超级管理员权限报表界面项目权限与课程权限分开整理,#1300 配置管理--角色和权限--权限报表,显示超出边框 解决:修改css样式

This commit is contained in:
z9hang 2014-09-25 15:34:00 +08:00
parent a4be3340bd
commit 21343a0111
5 changed files with 143 additions and 42 deletions

View File

@ -19,33 +19,127 @@
<tbody>
<% 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| %>
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
<td>
<%= 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_') %>
</td>
<% @roles.each do |role| %>
<td align="center">
<% 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 %>
</td>
<% end %>
</tr>
<% end %>
<tr class="group open">
<td>
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<%= l(:label_project) %>
</td>
<% @roles.each do |role| %>
<td class="role"><%= h(role.name) %></td>
<% end %>
</tr>
<% perms_by_module[mod].select{ |p| p.belong_to_project? }.each do |permission| %>
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
<td>
<%= 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_') %>
</td>
<% @roles.each do |role| %>
<td align="center">
<% 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 %>
</td>
<% end %>
</tr>
<% end %>
<tr class="group open">
<td>
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<%= l(:label_course) %>
</td>
<% @roles.each do |role| %>
<td class="role"><%= h(role.name) %></td>
<% end %>
</tr>
<% perms_by_module[mod].select{ |p| p.belong_to_course? }.each do |permission| %>
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
<td>
<%= 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_') %>
</td>
<% @roles.each do |role| %>
<td align="center">
<% 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 %>
</td>
<% end %>
</tr>
<% end %>
<tr class="group open">
<td>
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<%= l(:label_contest) %>
</td>
<% @roles.each do |role| %>
<td class="role"><%= h(role.name) %></td>
<% end %>
</tr>
<% perms_by_module[mod].select{ |p| p.belong_to_contest? }.each do |permission| %>
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
<td>
<%= 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_') %>
</td>
<% @roles.each do |role| %>
<td align="center">
<% 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 %>
</td>
<% end %>
</tr>
<% end %>
<% else %>
<tr class="group open">
<td>
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<%= l_or_humanize(mod, :prefix => 'project_module_') %>
</td>
<% @roles.each do |role| %>
<td class="role"><%= h(role.name) %></td>
<td class="role"><%= h(role.name) %></td>
<% end %>
</tr>
<% end %>
<% perms_by_module[mod].each do |permission| %>
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
<td>
<%= 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_') %>
</td>
<% @roles.each do |role| %>
<td align="center">
<% 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| %>
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
<td>
<%= 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_') %>
</td>
<% @roles.each do |role| %>
<td align="center">
<% 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 %>
</td>
<% end %>
</tr>
<% end %>
</td>
<% end %>
</tr>
<% end %>
<% end %>
</tbody>
</table>

View File

@ -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

View File

@ -491,7 +491,7 @@ zh:
permission_edit_course: 编辑课程
permission_select_contest_modules: 选择竞赛模块
permission_manage_contestnotifications: 管理竞赛通知
permission_notificationcomment_contestnotifications: 添加竞赛通知评论
project_module_issue_tracking: 问题跟踪

View File

@ -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|

View File

@ -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; }