diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 46fc68184..fb7bf50f0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -321,6 +321,8 @@ class ApplicationController < ActionController::Base render_404 end + #added by nwb + #获取课程 def find_course @course= Course.find(params[:id]) rescue ActiveRecord::RecordNotFound diff --git a/app/models/course.rb b/app/models/course.rb index 545330705..ff4f1a222 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -95,8 +95,7 @@ class Course < ActiveRecord::Base allowed_to_condition(user, :view_course, options) end - - # 获取课程的资源类型列表 + # 获取课程的资源类型列表 def attachmenttypes @attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ]) end @@ -131,6 +130,7 @@ class Course < ActiveRecord::Base end end + # 课程允许的权限集合 def allowed_permissions @allowed_permissions ||= begin module_names = enabled_modules.all(:select => :name).collect {|m| m.name} @@ -138,6 +138,7 @@ class Course < ActiveRecord::Base end end + # 课程允许的动作集合 def allowed_actions @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten end @@ -160,6 +161,7 @@ class Course < ActiveRecord::Base end end + # 创建课程留言 def create_board_sync @board = self.boards.build self.name=" #{l(:label_borad_course) }" @@ -173,6 +175,7 @@ class Course < ActiveRecord::Base end end + # 删除课程所有成员 def delete_all_members me, mr = Member.table_name, MemberRole.table_name connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})") diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb new file mode 100644 index 000000000..6e3060c3c --- /dev/null +++ b/app/views/news/_course_form.html.erb @@ -0,0 +1,13 @@ +<%= error_messages_for @news %> +
+ <% str = l(:bale_news_notice)%> + <%= str %> +
+
+

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

+ +

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

+

<%= render :partial => 'attachments/form', :locals => {:container => @news} %>

+
+ +<%= wikitoolbar_for 'news_description' %> diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index d980cbacf..60d0f0ed3 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -15,7 +15,7 @@