parent
4404222437
commit
fb36a0d5ba
|
@ -5,10 +5,9 @@ class CoursesController < ApplicationController
|
||||||
menu_item l(:label_sort_by_active), :only => :index
|
menu_item l(:label_sort_by_active), :only => :index
|
||||||
menu_item l(:label_sort_by_influence), :only => :index
|
menu_item l(:label_sort_by_influence), :only => :index
|
||||||
|
|
||||||
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
|
before_filter :authorize, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course]
|
||||||
before_filter :authorize, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
|
before_filter :authorize_global, :only => [:view_homework_attaches] #:new,:create]
|
||||||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar]
|
||||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
|
||||||
|
|
||||||
before_filter :require_login, :only => [:join, :unjoin]
|
before_filter :require_login, :only => [:join, :unjoin]
|
||||||
before_filter :allow_join, :only => [:join]
|
before_filter :allow_join, :only => [:join]
|
||||||
|
@ -22,7 +21,7 @@ class CoursesController < ApplicationController
|
||||||
members = []
|
members = []
|
||||||
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
||||||
course.members << members
|
course.members << members
|
||||||
|
|
||||||
StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
|
StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
|
||||||
@state = 0
|
@state = 0
|
||||||
else
|
else
|
||||||
|
@ -34,13 +33,13 @@ class CoursesController < ApplicationController
|
||||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id]), :object_id => params[:object_id]} }
|
format.js { render :partial => 'set_join', :locals => {:user => User.current, :course => Project.find(params[:object_id]), :object_id => params[:object_id]} }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def unjoin
|
def unjoin
|
||||||
if User.current.logged?
|
if User.current.logged?
|
||||||
|
|
||||||
@member = Member.where('project_id = ? and user_id = ?', params[:object_id], User.current.id)
|
@member = Member.where('project_id = ? and user_id = ?', params[:object_id], User.current.id)
|
||||||
@member.first.destroy
|
@member.first.destroy
|
||||||
|
|
||||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id])
|
joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id])
|
||||||
joined.each do |join|
|
joined.each do |join|
|
||||||
join.delete
|
join.delete
|
||||||
|
@ -52,7 +51,7 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_course courses,activities
|
def handle_course courses, activities
|
||||||
course_activity_count_array=activities.values()
|
course_activity_count_array=activities.values()
|
||||||
|
|
||||||
course_array=[]
|
course_array=[]
|
||||||
|
@ -62,30 +61,87 @@ class CoursesController < ApplicationController
|
||||||
i=i+1
|
i=i+1
|
||||||
end
|
end
|
||||||
|
|
||||||
courses=desc_sort_course_by_avtivity(course_activity_count_array,course_array)
|
courses=desc_sort_course_by_avtivity(course_activity_count_array, course_array)
|
||||||
|
|
||||||
return courses
|
return courses
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def create
|
||||||
@course_type = params[:course_type] ||= params[:course]
|
if User.current.user_extensions.identity
|
||||||
@issue_custom_fields = IssueCustomField.sorted.all
|
@course = Course.new
|
||||||
@trackers = Tracker.sorted.all
|
@course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
||||||
|
@course.safe_attributes = params[:course]
|
||||||
|
@course.tea_id = User.current.id
|
||||||
|
# added by bai
|
||||||
|
@course.term = params[:term]
|
||||||
|
@course.time = params[:time]
|
||||||
|
#@course.school_id = params[:occupation]
|
||||||
|
@course.school_id = User.current.user_extensions.school_id
|
||||||
|
@course.setup_time = params[:setup_time]
|
||||||
|
@course.endup_time = params[:endup_time]
|
||||||
|
@course.class_period = params[:class_period]
|
||||||
|
end
|
||||||
|
|
||||||
@course = Course.new
|
@issue_custom_fields = IssueCustomField.sorted.all
|
||||||
@course.safe_attributes = params[:course]
|
@trackers = Tracker.sorted.all
|
||||||
|
|
||||||
|
if User.current.user_extensions.identity == 0
|
||||||
|
if @course.save
|
||||||
|
unless User.current.admin?
|
||||||
|
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||||
|
m = Member.new(:user => User.current, :roles => [r])
|
||||||
|
#course = ProjectInfo.new(:user_id => User.current.id, :course_id => @course.id)
|
||||||
|
user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id)
|
||||||
|
if params[:course][:is_public] == '1'
|
||||||
|
course_status = CourseStatus.create(:course_id => @course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => @course_tag)
|
||||||
|
end
|
||||||
|
@course.members << m
|
||||||
|
#@course.course_infos << course
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.html {
|
||||||
|
flash[:notice] = l(:notice_successful_create)
|
||||||
|
if params[:continue]
|
||||||
|
redirect_to new_course_path(attrs, :course => '0')
|
||||||
|
elsif params[:course_continue]
|
||||||
|
redirect_to new_course_path(:course => '1')
|
||||||
|
else
|
||||||
|
redirect_to settings_course_path(@course, :course_type => 1)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@course.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { render :action => 'new', :layout => 'base' } #Added by young
|
||||||
|
format.api { render_validation_errors(@course) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def new
|
||||||
|
@course_type = params[:course_type] ||= params[:course]
|
||||||
|
@issue_custom_fields = IssueCustomField.sorted.all
|
||||||
|
@trackers = Tracker.sorted.all
|
||||||
|
|
||||||
|
@course = Course.new
|
||||||
|
@course.safe_attributes = params[:course]
|
||||||
|
|
||||||
render :layout => 'base'
|
render :layout => 'base'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def desc_sort_course_by_avtivity(activity_count,courses)
|
def desc_sort_course_by_avtivity(activity_count, courses)
|
||||||
return courses if activity_count.size<2
|
return courses if activity_count.size<2
|
||||||
(activity_count.size-2).downto(0) do |i|
|
(activity_count.size-2).downto(0) do |i|
|
||||||
(0..i).each do |j|
|
(0..i).each do |j|
|
||||||
if activity_count[j]<activity_count[j+1]
|
if activity_count[j]<activity_count[j+1]
|
||||||
courses[j],courses[j+1]=courses[j+1],courses[j]
|
courses[j], courses[j+1]=courses[j+1], courses[j]
|
||||||
activity_count[j],activity_count[j+1]=activity_count[j+1],activity_count[j]
|
activity_count[j], activity_count[j+1]=activity_count[j+1], activity_count[j]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -125,49 +181,49 @@ class CoursesController < ApplicationController
|
||||||
|
|
||||||
case params[:course_sort_type]
|
case params[:course_sort_type]
|
||||||
when '0'
|
when '0'
|
||||||
@courses = @courses_all.order("created_at desc")
|
@courses = @courses_all.order("created_at desc")
|
||||||
@s_type = 0
|
@s_type = 0
|
||||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
@course_activity_count=get_course_activity @courses, @course_activity_count
|
||||||
#gcmend
|
#gcmend
|
||||||
|
|
||||||
when '1'
|
when '1'
|
||||||
@courses = @courses_all.order("course_ac_para desc")
|
@courses = @courses_all.order("course_ac_para desc")
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
@course_activity_count=get_course_activity @courses, @course_activity_count
|
||||||
#gcmend
|
#gcmend
|
||||||
|
|
||||||
when '2'
|
when '2'
|
||||||
@courses = @courses_all.order("watchers_count desc")
|
@courses = @courses_all.order("watchers_count desc")
|
||||||
@s_type = 2
|
@s_type = 2
|
||||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
@course_activity_count=get_course_activity @courses, @course_activity_count
|
||||||
#gcmend
|
#gcmend
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
when '3'
|
when '3'
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
@course_activity_count=get_course_activity @courses_all,@course_activity_count
|
@course_activity_count=get_course_activity @courses_all, @course_activity_count
|
||||||
#gcmend
|
#gcmend
|
||||||
|
|
||||||
@courses=handle_course @courses_all,@course_activity_count
|
@courses=handle_course @courses_all, @course_activity_count
|
||||||
@s_type = 3
|
@s_type = 3
|
||||||
@courses = @courses[@course_pages.offset, @course_pages.per_page]
|
@courses = @courses[@course_pages.offset, @course_pages.per_page]
|
||||||
else
|
else
|
||||||
@s_type = 0
|
@s_type = 0
|
||||||
@courses = @courses_all.order("created_at desc")
|
@courses = @courses_all.order("created_at desc")
|
||||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
@course_activity_count=get_course_activity @courses, @course_activity_count
|
||||||
#gcmend
|
#gcmend
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -184,7 +240,7 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def get_course_activity courses,activities
|
def get_course_activity courses, activities
|
||||||
@course_ids=activities.keys()
|
@course_ids=activities.keys()
|
||||||
|
|
||||||
days = Setting.activity_days_default.to_i
|
days = Setting.activity_days_default.to_i
|
||||||
|
@ -192,14 +248,14 @@ class CoursesController < ApplicationController
|
||||||
date_from = date_to - days-1.years
|
date_from = date_to - days-1.years
|
||||||
|
|
||||||
#file_count
|
#file_count
|
||||||
Attachment.where(container_id: @course_ids, container_type: Project).where("created_on>?",date_from).each do |attachment|
|
Attachment.where(container_id: @course_ids, container_type: Project).where("created_on>?", date_from).each do |attachment|
|
||||||
activities[attachment.container_id]+=1
|
activities[attachment.container_id]+=1
|
||||||
end
|
end
|
||||||
|
|
||||||
#message_count
|
#message_count
|
||||||
Board.where(course_id: @course_ids).each do |board|
|
Board.where(course_id: @course_ids).each do |board|
|
||||||
# activities[board.course_id]+=1
|
# activities[board.course_id]+=1
|
||||||
activities[board.course_id]+=board.messages.where("updated_on>?",date_from).count
|
activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
|
||||||
end
|
end
|
||||||
|
|
||||||
#feedbackc_count
|
#feedbackc_count
|
||||||
|
@ -224,21 +280,19 @@ class CoursesController < ApplicationController
|
||||||
def allow_join
|
def allow_join
|
||||||
if course_endTime_timeout? Project.find(params[:object_id])
|
if course_endTime_timeout? Project.find(params[:object_id])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js{
|
format.js {
|
||||||
@state = 2
|
@state = 2
|
||||||
render :partial => 'set_join',
|
render :partial => 'set_join',
|
||||||
:locals => {:user => User.current,
|
:locals => {:user => User.current,
|
||||||
:course => Project.find(params[:object_id]),
|
:course => Project.find(params[:object_id]),
|
||||||
:object_id => params[:object_id]
|
:object_id => params[:object_id]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def index1
|
def index1
|
||||||
|
|
||||||
per_page_option = 10
|
per_page_option = 10
|
||||||
|
@ -258,13 +312,13 @@ class CoursesController < ApplicationController
|
||||||
@course_activity_count[course.id]=0
|
@course_activity_count[course.id]=0
|
||||||
end
|
end
|
||||||
|
|
||||||
@course_activity_count=get_course_activity @courses_all,@course_activity_count
|
@course_activity_count=get_course_activity @courses_all, @course_activity_count
|
||||||
|
|
||||||
#gcm end
|
#gcm end
|
||||||
|
|
||||||
case params[:course_sort_type]
|
case params[:course_sort_type]
|
||||||
when '0'
|
when '0'
|
||||||
@courses = @courses_all.order("created_on desc")
|
@courses = @courses_all.order("created_on desc")
|
||||||
@s_type = 0
|
@s_type = 0
|
||||||
when '1'
|
when '1'
|
||||||
@courses = @courses_all.order("grade desc")
|
@courses = @courses_all.order("grade desc")
|
||||||
|
@ -276,15 +330,15 @@ class CoursesController < ApplicationController
|
||||||
#gcm
|
#gcm
|
||||||
when '3'
|
when '3'
|
||||||
#@courses=desc_sort_course_by_avtivity(@course_activity_count_array,@course_all_array)
|
#@courses=desc_sort_course_by_avtivity(@course_activity_count_array,@course_all_array)
|
||||||
@courses=handle_course @courses_all,@course_activity_count
|
@courses=handle_course @courses_all, @course_activity_count
|
||||||
@s_type = 3
|
@s_type = 3
|
||||||
@courses = @courses[@course_pages.offset, @course_pages.per_page]
|
@courses = @courses[@course_pages.offset, @course_pages.per_page]
|
||||||
|
|
||||||
else
|
else
|
||||||
@courses = @courses = @courses_all.order("grade desc")
|
@courses = @courses = @courses_all.order("grade desc")
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
end
|
end
|
||||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
|
@ -294,7 +348,7 @@ class CoursesController < ApplicationController
|
||||||
# scope = scope.active
|
# scope = scope.active
|
||||||
# end
|
# end
|
||||||
}
|
}
|
||||||
format.api {
|
format.api {
|
||||||
# @offset, @limit = api_offset_and_limit
|
# @offset, @limit = api_offset_and_limit
|
||||||
# @course_count = Project.visible.count
|
# @course_count = Project.visible.count
|
||||||
# @courses = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
# @courses = Project.visible.offset(@offset).limit(@limit).order('lft').all
|
||||||
|
|
|
@ -23,6 +23,8 @@ class Course < ActiveRecord::Base
|
||||||
'term',
|
'term',
|
||||||
'password'
|
'password'
|
||||||
|
|
||||||
|
acts_as_customizable
|
||||||
|
|
||||||
scope :active, lambda { where(:status => STATUS_ACTIVE) }
|
scope :active, lambda { where(:status => STATUS_ACTIVE) }
|
||||||
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
|
scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
|
||||||
scope :all_public, lambda { where(:is_public => true) }
|
scope :all_public, lambda { where(:is_public => true) }
|
||||||
|
@ -43,6 +45,11 @@ class Course < ActiveRecord::Base
|
||||||
user.allowed_to?(:view_course, self)
|
user.allowed_to?(:view_course, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def extra_frozen?
|
||||||
|
errors[:extra].blank? && !(new_record? || extra.blank?)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.visible_condition(user, options={})
|
def self.visible_condition(user, options={})
|
||||||
allowed_to_condition(user, :view_course, options)
|
allowed_to_condition(user, :view_course, options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,21 +17,21 @@
|
||||||
|
|
||||||
|
|
||||||
<% object = [] %>
|
<% object = [] %>
|
||||||
<% object << 'project' %>
|
<% object << 'course' %>
|
||||||
<% object << 'course' %>
|
<% object << 'course' %>
|
||||||
<%= error_messages_for object %>
|
<%= error_messages_for object %>
|
||||||
|
|
||||||
|
|
||||||
<!--[form:project]-->
|
<!--[form:course]-->
|
||||||
<% unless @project.new_record? %>
|
<% unless @course.new_record? %>
|
||||||
<p><%= render :partial=>"avatar/avatar_form",:locals=> {source:@project} %></p>
|
<p><%= render :partial=>"avatar/avatar_form",:locals=> {source:@course} %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- <p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p> -->
|
<!-- <p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;" %></p> -->
|
||||||
<p><label for="project_name" style="font-size: 13px;" ><%=l(:label_tags_course_name)%><span class="required", > * </span></label><input id="project_name" type="text" value="<%=@project.name%>" style="width:490px;" size="60" name="project[name]"></p>
|
<p><label for="course_name" style="font-size: 13px;" ><%=l(:label_tags_course_name)%><span class="required" > * </span></label><input id="course_name" type="text" value="<%=@course.name%>" style="width:490px;" size="60" name="course[name]"></p>
|
||||||
|
|
||||||
<!-- <p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
|
<!-- <p><%= f.text_field :extra, :required => true, :size => 60, :style => "width:488px;", :disabled => @course.extra_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
|
||||||
<% unless @project.identifier_frozen? %>
|
<% unless @course.extra_frozen? %>
|
||||||
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
|
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_course_identifier_info).html_safe %></em>
|
||||||
<% end %></p> -->
|
<% end %></p> -->
|
||||||
|
|
||||||
<!-- added by bai 新增开课时间、结课时间、课时 -->
|
<!-- added by bai 新增开课时间、结课时间、课时 -->
|
||||||
|
@ -294,46 +294,33 @@
|
||||||
|
|
||||||
<!-- added by huang -->
|
<!-- added by huang -->
|
||||||
<!-- <p style="margin-left:-10px;"><%= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
|
<!-- <p style="margin-left:-10px;"><%= m.text_field :password, :required => true, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> -->
|
||||||
<p style="margin-left:-10px;"><label for="project[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="project_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@project.course_extra.password if @project.course_extra %>" size="60" name="project[course][password]"></p>
|
<p style="margin-left:-10px;"><label for="course[course]_password" style="font-size: 13px;" ><%=l(:label_new_course_password)%><span class="required"> *</span></label><input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%=@course.password %>" size="60" name="course[password]"></p>
|
||||||
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
|
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
|
<!-- <p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %></p> -->
|
||||||
<!--new added -->
|
<!--new added -->
|
||||||
<p style="margin-left:-20px;padding-right: 20px;"><label for="project_description" style="font-size: 13px;"><%=l(:label_new_course_description)%></label><span class="jstEditor"><textarea id="project_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="project[description]" cols="40" ><%=@project.description%></textarea></span></p>
|
<p style="margin-left:-20px;padding-right: 20px;"><label for="course_description" style="font-size: 13px;"><%=l(:label_new_course_description)%></label><span class="jstEditor"><textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40" ><%=@course.description%></textarea></span></p>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_public_info) %></em></p><!-- modified by bai -->
|
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_public_info) %></em></p><!-- modified by bai -->
|
||||||
<p style="display:none;"><%= f.text_field :project_type, :value => 1 %></p>
|
<p style="display:none;"><%= f.text_field :course_type, :value => 1 %></p>
|
||||||
|
|
||||||
|
|
||||||
<%= wikitoolbar_for 'project_description' %>
|
<%= wikitoolbar_for 'course_description' %>
|
||||||
|
|
||||||
<% @project.custom_field_values.each do |value| %>
|
<% @course.custom_field_values.each do |value| %>
|
||||||
<p><%= custom_field_tag_with_label :project, value %></p>
|
<p><%= custom_field_tag_with_label :course, value %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= call_hook(:view_projects_form, :project => @project, :form => f) %>
|
<%= call_hook(:view_courses_form, :course => @course, :form => f) %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--[eoform:project]-->
|
<!--[eoform:course]-->
|
||||||
|
|
||||||
<% unless @project.identifier_frozen? %>
|
<% unless @course.extra_frozen? %>
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= javascript_include_tag 'project_identifier' %>
|
<%= javascript_include_tag 'course_identifier' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %>
|
|
||||||
<%= javascript_tag do %>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#project_inherit_members").change(function(){
|
|
||||||
if (!$(this).is(':checked')) {
|
|
||||||
if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) {
|
|
||||||
$("#project_inherit_members").attr("checked", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="font_description">
|
<p class="font_description">
|
||||||
<!--teacher could create the course directly-->
|
<!--teacher could create the course directly-->
|
||||||
<%= l(:label_project_course_unadd) %><%= link_to "#{l(:label_course_new)}", {:controller => 'projects', :action => 'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' %>
|
<%= l(:label_project_course_unadd) %><%= link_to "#{l(:label_course_new)}", {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
class AddIsPublicToCourses < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :courses, :is_public, :tinyint,:default => 1
|
||||||
|
add_column :courses, :inherit_members, :tinyint,:default => 1
|
||||||
|
end
|
||||||
|
end
|
32
db/schema.rb
32
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140527060344) do
|
ActiveRecord::Schema.define(:version => 20140604071624) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -116,6 +116,7 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
t.integer "messages_count", :default => 0, :null => false
|
t.integer "messages_count", :default => 0, :null => false
|
||||||
t.integer "last_message_id"
|
t.integer "last_message_id"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
|
t.integer "course_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
|
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
|
||||||
|
@ -217,6 +218,16 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "course_statuses", :force => true do |t|
|
||||||
|
t.integer "changesets_count"
|
||||||
|
t.integer "watchers_count"
|
||||||
|
t.integer "course_id"
|
||||||
|
t.float "grade", :default => 0.0
|
||||||
|
t.integer "course_ac_para", :default => 0
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "courses", :force => true do |t|
|
create_table "courses", :force => true do |t|
|
||||||
t.integer "tea_id"
|
t.integer "tea_id"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
@ -224,8 +235,8 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
t.string "code"
|
t.string "code"
|
||||||
t.integer "time"
|
t.integer "time"
|
||||||
t.string "extra"
|
t.string "extra"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "location"
|
t.string "location"
|
||||||
t.string "term"
|
t.string "term"
|
||||||
t.string "string"
|
t.string "string"
|
||||||
|
@ -234,6 +245,13 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
t.string "endup_time"
|
t.string "endup_time"
|
||||||
t.string "class_period"
|
t.string "class_period"
|
||||||
t.integer "school_id"
|
t.integer "school_id"
|
||||||
|
t.text "description"
|
||||||
|
t.integer "status", :default => 1
|
||||||
|
t.integer "attachmenttype", :default => 2
|
||||||
|
t.integer "lft"
|
||||||
|
t.integer "rgt"
|
||||||
|
t.boolean "is_public", :default => true
|
||||||
|
t.integer "inherit_members", :limit => 1, :default => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "custom_fields", :force => true do |t|
|
create_table "custom_fields", :force => true do |t|
|
||||||
|
@ -296,6 +314,7 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
create_table "enabled_modules", :force => true do |t|
|
create_table "enabled_modules", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
|
t.integer "course_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
|
add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
|
||||||
|
@ -499,13 +518,14 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
|
|
||||||
create_table "members", :force => true do |t|
|
create_table "members", :force => true do |t|
|
||||||
t.integer "user_id", :default => 0, :null => false
|
t.integer "user_id", :default => 0, :null => false
|
||||||
t.integer "project_id", :default => 0, :null => false
|
t.integer "project_id", :default => 0
|
||||||
t.datetime "created_on"
|
t.datetime "created_on"
|
||||||
t.boolean "mail_notification", :default => false, :null => false
|
t.boolean "mail_notification", :default => false, :null => false
|
||||||
|
t.integer "course_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "members", ["project_id"], :name => "index_members_on_project_id"
|
add_index "members", ["project_id"], :name => "index_members_on_project_id"
|
||||||
add_index "members", ["user_id", "project_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
|
add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
|
||||||
add_index "members", ["user_id"], :name => "index_members_on_user_id"
|
add_index "members", ["user_id"], :name => "index_members_on_user_id"
|
||||||
|
|
||||||
create_table "memos", :force => true do |t|
|
create_table "memos", :force => true do |t|
|
||||||
|
@ -690,7 +710,7 @@ ActiveRecord::Schema.define(:version => 20140527060344) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "relative_memos", :force => true do |t|
|
create_table "relative_memos", :force => true do |t|
|
||||||
t.integer "osp_id", :null => false
|
t.integer "osp_id"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
t.string "subject", :null => false
|
t.string "subject", :null => false
|
||||||
t.text "content", :null => false
|
t.text "content", :null => false
|
||||||
|
|
Loading…
Reference in New Issue