修改新增课程通知视图
This commit is contained in:
parent
d6280befca
commit
97d920c195
|
@ -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
|
||||
|
|
|
@ -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})")
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<%= error_messages_for @news %>
|
||||
<div class="add_frame_header" >
|
||||
<% str = l(:bale_news_notice)%>
|
||||
<%= str %>
|
||||
</div>
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %></p>
|
||||
<!-- <p style="margin-left:-10px;"><%= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
|
||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
|
||||
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
|
||||
</div>
|
||||
|
||||
<%= wikitoolbar_for 'news_description' %>
|
|
@ -15,7 +15,7 @@
|
|||
<div id="add-news" class="add_frame" style="display:none;">
|
||||
<%= labelled_form_for @news, :url => course_news_index_path(@course),
|
||||
:html => {:id => 'news-form', :multipart => true} do |f| %>
|
||||
<%= render :partial => 'news/form', :locals => {:f => f} %>
|
||||
<%= render :partial => 'news/course_form', :locals => {:f => f} %>
|
||||
<%= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit --> |
|
||||
<%= preview_link preview_news_path(:course_id => @course), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
|
||||
|
|
||||
|
|
|
@ -112,6 +112,16 @@ Redmine::AccessControl.map do |map|
|
|||
map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
||||
map.permission :view_course_files, {:files => :index, :versions => :download}, :read => true
|
||||
end
|
||||
map.course_module :news do |map|
|
||||
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :comment_news, {:comments => :create}
|
||||
end
|
||||
#作业模块权限
|
||||
map.project_module :bids do |map|
|
||||
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true
|
||||
end
|
||||
|
||||
#end
|
||||
|
||||
map.project_module :issue_tracking do |map|
|
||||
|
|
Loading…
Reference in New Issue