From 21343a01113a15f7150d104d7352454220e38874 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 25 Sep 2014 15:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8A=A5=E8=A1=A8=E7=95=8C=E9=9D=A2=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=9D=83=E9=99=90=E4=B8=8E=E8=AF=BE=E7=A8=8B=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=88=86=E5=BC=80=E6=95=B4=E7=90=86=EF=BC=8C#1300=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86--=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=92=8C=E6=9D=83=E9=99=90--=E6=9D=83=E9=99=90=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E6=98=BE=E7=A4=BA=E8=B6=85=E5=87=BA=E8=BE=B9?= =?UTF-8?q?=E6=A1=86=20=E8=A7=A3=E5=86=B3=EF=BC=9A=E4=BF=AE=E6=94=B9css?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/roles/permissions.html.erb | 128 +++++++++++++++++++++++---- config/locales/en.yml | 2 + config/locales/zh.yml | 2 +- lib/redmine.rb | 51 ++++++----- public/stylesheets/application.css | 2 +- 5 files changed, 143 insertions(+), 42 deletions(-) diff --git a/app/views/roles/permissions.html.erb b/app/views/roles/permissions.html.erb index 1942092cd..2d59c86eb 100644 --- a/app/views/roles/permissions.html.erb +++ b/app/views/roles/permissions.html.erb @@ -19,33 +19,127 @@ <% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %> <% perms_by_module.keys.sort.each do |mod| %> - <% unless mod.blank? %> + <% if mod.blank? %> + <% perms_by_module[mod].select{ |p| !(p.belong_to_project?) && !(p.belong_to_course?) && !(p.belong_to_contest?) }.each do |permission| %> + + + <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')", + :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> + <%= l_or_humanize(permission.name, :prefix => 'permission_') %> + + <% @roles.each do |role| %> + + <% if role.setable_permissions.include? permission %> + <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %> + <% end %> + + <% end %> + + <% end %> + + + +   + <%= l(:label_project) %> + + <% @roles.each do |role| %> + <%= h(role.name) %> + <% end %> + + <% perms_by_module[mod].select{ |p| p.belong_to_project? }.each do |permission| %> + + + <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')", + :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> + <%= l_or_humanize(permission.name, :prefix => 'permission_') %> + + <% @roles.each do |role| %> + + <% if role.setable_permissions.include? permission %> + <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %> + <% end %> + + <% end %> + + <% end %> + + +   + <%= l(:label_course) %> + + <% @roles.each do |role| %> + <%= h(role.name) %> + <% end %> + + <% perms_by_module[mod].select{ |p| p.belong_to_course? }.each do |permission| %> + + + <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')", + :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> + <%= l_or_humanize(permission.name, :prefix => 'permission_') %> + + <% @roles.each do |role| %> + + <% if role.setable_permissions.include? permission %> + <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %> + <% end %> + + <% end %> + + <% end %> + + +   + <%= l(:label_contest) %> + + <% @roles.each do |role| %> + <%= h(role.name) %> + <% end %> + + <% perms_by_module[mod].select{ |p| p.belong_to_contest? }.each do |permission| %> + + + <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')", + :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> + <%= l_or_humanize(permission.name, :prefix => 'permission_') %> + + <% @roles.each do |role| %> + + <% if role.setable_permissions.include? permission %> + <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %> + <% end %> + + <% end %> + + <% end %> + <% else %>   <%= l_or_humanize(mod, :prefix => 'project_module_') %> <% @roles.each do |role| %> - <%= h(role.name) %> + <%= h(role.name) %> <% end %> - <% end %> - <% perms_by_module[mod].each do |permission| %> - - - <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')", - :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> - <%= l_or_humanize(permission.name, :prefix => 'permission_') %> - - <% @roles.each do |role| %> - - <% if role.setable_permissions.include? permission %> - <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %> + <% perms_by_module[mod].each do |permission| %> + + + <%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')", + :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %> + <%= l_or_humanize(permission.name, :prefix => 'permission_') %> + + <% @roles.each do |role| %> + + <% if role.setable_permissions.include? permission %> + <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %> + <% end %> + + <% end %> + <% end %> - - <% end %> - <% end %> + <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 8ba8402ed..d7b7f5421 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -497,6 +497,8 @@ en: permission_view_real_name: View real name permission_view_students: View students permission_export_homeworks: Export homeworks + permission_notificationcomment_contestnotifications: Add the notice of contest comments + project_module_issue_tracking: Issue tracking project_module_time_tracking: Time tracking diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2e6fe6ddb..4201f7119 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -491,7 +491,7 @@ zh: permission_edit_course: 编辑课程 permission_select_contest_modules: 选择竞赛模块 permission_manage_contestnotifications: 管理竞赛通知 - + permission_notificationcomment_contestnotifications: 添加竞赛通知评论 project_module_issue_tracking: 问题跟踪 diff --git a/lib/redmine.rb b/lib/redmine.rb index 17234b54f..e0a14c7e9 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -97,7 +97,9 @@ Redmine::AccessControl.map do |map| map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member ,:belong_to_project => true map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member ,:belong_to_project => true map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member ,:belong_to_project => true - map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true + #错的权限,先注释掉 + #map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true + map.permission :quote_project, {},:require => :member,:belong_to_contest => true map.permission :is_manager,{},:require => :member ,:belong_to_project => true map.permission :as_teacher,{},:require => :member ,:belong_to_course => true @@ -112,30 +114,33 @@ Redmine::AccessControl.map do |map| map.permission :select_course_modules, {:courses => :modules}, :require => :member ,:belong_to_course => true map.permission :view_course_journals_for_messages, {:courses => :feedback}, :require => :member,:read => true ,:belong_to_course => true - map.course_module :files 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_course_news, {:news => [:index, :show]}, :public => true, :read => true - map.permission :comment_news, {:comments => :create} - end + #与项目一致,注释掉 + #map.course_module :files 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_course_news, {:news => [:index, :show]}, :public => true, :read => true + # map.permission :comment_news, {:comments => :create} + # end #作业模块权限 map.course_module :bids do |map| - map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true - map.permission :paret_in_homework,{},:require => :member + map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true,:belong_to_course => true + map.permission :paret_in_homework,{},:require => :member ,:belong_to_course => true end - map.course_module :boards do |map| - map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member - map.permission :view_course_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true - map.permission :add_messages, {:messages => [:new, :reply, :quote]} - map.permission :edit_messages, {:messages => :edit}, :require => :member - map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin - map.permission :delete_messages, {:messages => :destroy}, :require => :member - map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin - end + #讨论区权限与项目统一,注释掉此课程讨论区权限 + #map.course_module :boards do |map| + # map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member + # map.permission :view_course_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true + # map.permission :add_messages, {:messages => [:new, :reply, :quote]} + # map.permission :edit_messages, {:messages => :edit}, :require => :member + # map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin + # map.permission :delete_messages, {:messages => :destroy}, :require => :member + # map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin + #end #end @@ -188,9 +193,9 @@ Redmine::AccessControl.map do |map| end map.contest_module :contestnotifications do |map| - map.permission :manage_contestnotifications, {:contestnotifications => [:new, :create, :edit, :update, :destroy], :notificationcomments => [:destroy]}, :require => :member + map.permission :manage_contestnotifications, {:contestnotifications => [:new, :create, :edit, :update, :destroy], :notificationcomments => [:destroy]}, :require => :member,:belong_to_contest => true map.permission :view_contestnotifications, {:contestnotifications => [:index, :show]}, :public => true, :read => true - map.permission :notificationcomment_contestnotifications, {:notificationcomments => :create} + map.permission :notificationcomment_contestnotifications, {:notificationcomments => :create},:belong_to_contest => true end map.project_module :documents do |map| diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 1fda63f93..d69ed6171 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1273,7 +1273,7 @@ a.collapsible.collapsed {background: url(../images/arrow_collapsed.png) no-repea a#toggle-completed-versions {color:#999;} /***** Tables *****/ table.list { border: 1px solid #e4e4e4; border-collapse: collapse; width: 100%; margin-bottom: 4px; } -table.list th { background-color:#EEEEEE; padding: 4px; white-space:nowrap; } +table.list th { background-color:#EEEEEE; padding: 4px; white-space:pre-line; } table.list td { vertical-align: top; padding-right:10px; } table.list td.id { width: 2%; text-align: center;} table.list td.checkbox { width: 15px; padding: 2px 0 0 0; }