Conflicts:
	config/locales/zh.yml
This commit is contained in:
sw 2014-09-26 14:03:55 +08:00
commit 2542dd5592
16 changed files with 1020 additions and 867 deletions

View File

@ -269,7 +269,7 @@ class CoursesController < ApplicationController
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end
else
@course.destroy
#@course.destroy
respond_to do |format|
format.html { render :action => 'new', :layout => 'base' } #Added by young
format.api { render_validation_errors(@course) }

View File

@ -1,4 +1,4 @@
<h3><%=l(:label_news)%></h3>
<h3><%=l(:label_edit_contest_notice)%></h3>
<%= labelled_form_for @contestnotification,
:url => contest_contestnotification_path,

View File

@ -1,4 +1,8 @@
<script>
function cancel() {
$("#add_contestnotification").hide();
}
</script>
<div class="contextual">
<%= link_to(l(:button_edit),
edit_contest_contestnotification_path(@contest, @contestnotification),
@ -27,7 +31,7 @@
<div id="notificationcomments" style="margin-bottom:16px;">
<div style="margin:15px">
<div style="margin:15px" id ="add_contestnotification">
<span class="font_description">
<%= textilizable(@contestnotification, :description) %>
</span>
@ -62,7 +66,17 @@
</div>
<p>
<%= submit_tag l(:button_add) %>
<%= submit_tag l(:button_cancel), :onclick => "cancel();" %>
<!--modified by longjun 点击取消时收回添加回复的部分-->
<%= submit_tag l(:button_cancel),
:name => nil,
:onclick => "cancel();",
:type => 'button',
:class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"
%>
</p>
<% end %>
@ -97,7 +111,8 @@
</span>
<%= l(:label_comment_plural) %>
</td>
<td>
<!--modified by longjun 删除变成竖的IE浏览器兼容将宽度设置为40px-->
<td width="40px">
<% if notificationcomment.author==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete),
contest_contestnotification_notificationcomment_path(@contest, @contestnotification,notificationcomment),

View File

@ -1,51 +1,77 @@
<%#= error_messages_for 'softapplication' %>
<script type="text/javascript" xmlns="http://www.w3.org/1999/html">
<script type="text/javascript" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
//验证作品名称
function regexName()
{
var name = $("#softapplication_name").val();
if(name.length ==0)
if(name.length == 0)
{
$("#spane_name_notice").text("作品名称不能为空");
$("#spane_name_notice").text("<%= l(:label_no_softapplication_name) %>");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
else if(name.length <= 25)
{
$("#spane_name_notice").text("填写正确");
$("#spane_name_notice").text("<%= l(:label_field_correct) %>");
$("#spane_name_notice").css('color','#008000');
return true;
}
else
{
$("#spane_name_notice").text("作品名称超过25个汉字");
$("#spane_name_notice").text("<%= l(:label_work_name_condition) %>");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
}
// added by longjun
//验证作品简介
function regexDescription()
{
var name = $("#softapplication_description").val();
if(name.length ==0)
{
$("#span_sofapplication_description").text("<%= l(:label_no_softapplication_description) %>");
$("#span_sofapplication_description").css('color','#ff0000');
$("#span_sofapplication_description").focus();
return false;
}
else if(name.length <= 500)
{
$("#span_sofapplication_description").text("<%= l(:label_field_correct) %>");
$("#span_sofapplication_description").css('color','#008000');
return true;
}
else
{
$("#span_sofapplication_description").text("<%= l(:label_work_description_condition) %>");
$("#span_sofapplication_description").css('color','#ff0000');
$("#span_sofapplication_description").focus();
return false;
}
}
//验证运行平台
function regexWorkdescription()
{
var workDescription = $("#softapplication_android_min_version_available").val();
if(workDescription.length ==0)
{
$("#spane_workdescription_notice").text("运行平台不能为空");
$("#spane_workdescription_notice").text("<%= l(:label_no_softapplication_platform) %>");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#spane_workdescription_notice").text("填写正确");
$("#spane_workdescription_notice").text("<%= l(:label_field_correct) %>");
$("#spane_workdescription_notice").css('color','#008000');
return true;
}
else
{
$("#spane_workdescription_notice").text("运行平台超过125个汉字");
$("#spane_workdescription_notice").text("<%= l(:label_work_platform_condition) %>");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
@ -77,7 +103,7 @@
//提交验证
function submit_new_softapplication()
{
if(regexName() && regexWorkdescription() && regexDevelopers())
if(regexName() && regexDescription() && regexDevelopers())
{
$("#new_softapplication").submit();
}
@ -90,71 +116,39 @@
<tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>:
<td>
<%= f.text_field :name,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur => "regexName();"
%>
</td>
<span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :android_min_version_available,
<tr style="width:800px; padding-bottom: 30px;">
<span style="margin-top: 5px; float: left; display: block;"><%= l(:label_work_description) %>&nbsp;</span>
<span style="margin-top: 5px;float: left; display: block;" class="contest-star"> * </span>
<span style="margin-top: 5px; float: left; display: block;"> &nbsp;:&nbsp;</span>
<!-- modified by longjun 将单行输入框改成多行-->
<%= f.text_area :description,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur=>"regexWorkdescription();"
:rows => 3,
:onblur => 'regexDescription();',
:style => "width:320px; "
%>
</td>
<span style="font-size: 10px" id="spane_workdescription_notice">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<span>
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
</span>
<%= f.select :app_type_name,work_type_opttion,
{},
{:style => "width:328px;",:onchange => "selectChange(this)"} %>
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
</td>
<span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 120px;" id="other_input" name = "other_input"/>
</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<td style="padding-bottom: 290px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>:
</td>
<td style="width: 100px">
<%= f.text_field :description,
:required => true,
:size => 60,
:style => "width:320px;"
%>
</td>
<span style="font-size: 10px;" id="span_sofapplication_description">(<%= l(:label_work_description_lengthlimit) %>)</span>
<!--span style="font-size: 10px">(<%#= l(:label_workdescription_lengthlimit) %>)</span-->
</tr>
<br/>
<br/>
@ -163,14 +157,14 @@
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :application_developers,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur => 'regexDevelopers();'
%>
</td>
<span style="font-size: 10px" id="span_softapplication_application_developers">
(<%= l(:label_workdescription_lengthlimit) %>)
</span>

View File

@ -1,5 +1,5 @@
<!-- added by fq -->
<div id="add-memo" class='lz' style="display: none; padding: 20px;">
<div id="add-memo" class='lz' style="<% unless @memo.errors.any?%>display: none;<% end %> padding: 20px;">
<h3><%=l(:label_memo_new)%></h3>
<% if User.current.logged? %>
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
@ -40,5 +40,4 @@
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
</span>
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>

View File

@ -1,5 +1,5 @@
<%= form_for(@memo_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %>
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
<%= f.hidden_field :subject, :required => true, value: "RE: "+@memo.subject %>
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
<div id="message_quote" class="wiki"></div>

View File

@ -1,5 +1,5 @@
<!-- <h1>New memo</h1> -->
<% @replying ||= false %>
<% @replying = !@memo.parent.nil? %>
<h3><%=l(:label_memo_edit)%></h3>
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo)) do |f| %>
<% if @memo.errors.any? %>
@ -13,7 +13,7 @@
</div>
<% end %>
<div class="actions">
<p><%= f.text_field :subject, :required => true, :size => 96 %></p>
<p><%= f.text_field :subject, :required => true, :size => 96 ,:readonly => @replying%></p>
<p>
<% unless @replying %>
<% if @memo.safe_attribute? 'sticky' %>

View File

@ -90,7 +90,8 @@
)if !@memo.locked? && User.current.logged? %>
<%= link_to(
image_tag('edit.png'),
#image_tag('edit.png'),
l(:button_edit),
{:action => 'edit', :id => reply},
:title => l(:button_edit)
) if reply.editable_by?(User.current) %>

View File

@ -18,7 +18,43 @@
<div class="box tabular" id="permissions">
<% perms_by_module = @role.setable_permissions.group_by {|p| p.project_module.to_s} %>
<% perms_by_module.keys.sort.each do |mod| %>
<fieldset><legend><%= mod.blank? ? l(:label_project) : l_or_humanize(mod, :prefix => 'project_module_') %></legend>
<% if mod.blank? %>
<fieldset>
<legend><%= l(:label_project) %></legend>
<% perms_by_module[mod].each do |permission| %>
<% if permission.belong_to_project? %>
<label class="floating">
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
</label>
<% end %>
<% end %>
</fieldset>
<fieldset>
<legend><%= l(:label_course) %></legend>
<% perms_by_module[mod].each do |permission| %>
<% if permission.belong_to_course? %>
<label class="floating">
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
</label>
<% end %>
<% end %>
</fieldset>
<fieldset>
<legend><%= l(:label_contest) %></legend>
<% perms_by_module[mod].each do |permission| %>
<% if permission.belong_to_contest? %>
<label class="floating">
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
</label>
<% end %>
<% end %>
</fieldset>
<% else %>
<fieldset>
<legend><%= l_or_humanize(mod, :prefix => 'project_module_') %></legend>
<% perms_by_module[mod].each do |permission| %>
<label class="floating">
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
@ -26,7 +62,8 @@
</label>
<% end %>
</fieldset>
<% end %>
<% end %>
<% end %>
<br /><%= check_all_links 'permissions' %>
<%= hidden_field_tag 'role[permissions][]', '' %>
</div>

View File

@ -19,7 +19,100 @@
<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>
@ -29,7 +122,6 @@
<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>
@ -46,6 +138,8 @@
<% end %>
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>

View File

@ -9,30 +9,13 @@
<div style="float: left; width: 600px; padding-top: 6px; margin-left: 8px"><%= softapplication.description.truncate(95, omission: '...') %></div>
<div style="float: left; width: 200px; margin-left: 70px; margin-top: -3px; line-height: 0.5em ">
<%contest = softapplication.contests.first%>
<!--<table width="100%" border="0">-->
<!--<tr>-->
<!--<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_contest)%></td>-->
<!--<td style="width: 100px; word-wrap: break-word; word-break: break-all">-->
<!--<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_belongs_type)%></td>-->
<!--<td style="width: 100px; word-wrap: break-word; word-break: break-all">-->
<!--<%= softapplication.app_type_name %>-->
<!--</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td style="width: 70px; word-wrap: break-word; word-break: break-all"><%=l(:label_attendingcontestwork_adaptive_system)%></td>-->
<!--<td style="width: 100px; word-wrap: break-word; word-break: break-all">-->
<!--<%= softapplication.android_min_version_available %>-->
<!--</td>-->
<!--</tr>-->
<!--</table>-->
<p><%=l(:label_attendingcontestwork_belongs_contest)%><%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%></p>
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name.truncate(14, omission: '...') %></p>
<%strTitle = softapplication.android_min_version_available%>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><lable title="<%= strTitle %>"><%= strTitle.truncate(10,omisiion:'...') %></lable></p>
<!--modified by longjun 因为新建竞赛作品时没有填写运行平台和类别所有如果为空不能使用truncate函数-->
<p><%=l(:label_attendingcontestwork_belongs_type)%><%= softapplication.app_type_name ? softapplication.app_type_name.truncate(14, omission: '...') : "" %></p>
<% strTitle = softapplication.android_min_version_available %>
<p><%=l(:label_attendingcontestwork_adaptive_system)%><lable title="<%= strTitle %>"><%= strTitle ? strTitle.truncate(10,omisiion:'...') : "" %></lable></p>
</div>
<div style="padding-left: 53px">
<span><%=l(:label_attendingcontestwork_developers)%><%= softapplication.application_developers %></span>

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: 问题跟踪
@ -705,6 +705,7 @@ zh:
label_report_plural: 报表
label_news: 新闻
label_news_new: 添加新闻
label_edit_contest_notice: 编辑竞赛通知
bale_news_notice: 添加通知 #huang
bale_edit_notice: 修改通知
label_news_notice: 发布课程通知
@ -1936,8 +1937,8 @@ zh:
label_first_page_create_fail: 首页定制失败
label_forum_edit: 编辑讨论区
label_memo_create: 发布
label_memo_new: 新建主题
label_memo_edit: 修改主题
label_memo_new: 新建帖子
label_memo_edit: 编辑帖子
label_memo_new_from_forum: 发布帖子
label_forum: 公共贴吧
label_forum_new: 新建贴吧
@ -2000,8 +2001,15 @@ zh:
label_work_deposit_project_url: 托管项目网址
label_work_deposit_project: 托管项目
label_softapplication_name_condition: 25个汉字以内50个字符
label_softapplication_description_condition: 125个汉字以内
label_softapplication_description_condition: 125个汉字以内,开发人员用,隔开
label_work_description_lengthlimit: 500个汉字以内
label_softapplication_developers_condition: 开发人员超过125个汉字
label_no_softapplication_name: 作品名称不能为空
label_work_name_condition: 作品名称超过25个汉字
label_no_softapplication_description: 作品简介不能为空
label_work_description_condition: 作品简介名称超过500个汉字
label_no_softapplication_platform: 运行平台不能为空
label_work_platform_condition: 运行平台超过125个汉字
label_no_softapplication_developers: 开发人员不能为空
label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。
label_contest_description_no: 暂无描述。
@ -2039,11 +2047,12 @@ zh:
label_contest_delete: 删除竞赛
label_noawards_current: 暂未评奖
label_softapplication: 应用软件
label_attending_contest: 参加竞赛
label_new_attendingcontest_work: 新建参赛作品
label_workname_lengthlimit: 25个汉字以内
label_workdescription_lengthlimit: 125个汉字以内
label_workdescription_lengthlimit: 125个汉字以内,用英文逗号隔开
label_please_input_password: 请输入竞赛密码
label_please_select_project: 请选择项目
label_upload_softworkpacket_photo: 上传作品软件包和作品截图

View File

@ -89,54 +89,58 @@ end
Redmine::AccessControl.map do |map|
map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true
map.permission :search_project, {:search => :index}, :public => true, :read => true
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true
map.permission :select_project_modules, {:projects => :modules}, :require => :member
map.permission :select_contest_modules, {:contests => :modules}, :require => :member
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
map.permission :quote_project, {},:require => :member
map.permission :is_manager,{},:require => :member
map.permission :as_teacher,{},:require => :member
map.permission :as_student,{},:require => :member
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin ,:belong_to_project => true
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member ,:belong_to_project => true
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_project => true
map.permission :select_project_modules, {:projects => :modules}, :require => :member ,:belong_to_project => true
map.permission :select_contest_modules, {:contests => :modules}, :require => :member ,:belong_to_contest => true
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 :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
map.permission :as_student,{},:require => :member ,:belong_to_course => true
#课程权限模块
#added by nwb
map.permission :view_course, {:courses => [:show], :activities => [:index]}, :public => true, :read => true
map.permission :search_course, {:search => :index}, :public => true, :read => true
map.permission :add_course, {:courses => [:new, :create]}, :require => :loggedin
map.permission :edit_course, {:courses => [:settings, :edit, :update]}, :require => :member
map.permission :close_course, {:courses => [:close, :reopen]}, :require => :member, :read => true
map.permission :select_course_modules, {:courses => :modules}, :require => :member
map.permission :view_course_journals_for_messages, {:courses => :feedback}, :require => :member,:read => true
map.permission :add_course, {:courses => [:new, :create]}, :require => :loggedin ,:belong_to_course => true
map.permission :edit_course, {:courses => [:settings, :edit, :update]}, :require => :member ,:belong_to_course => true
map.permission :close_course, {:courses => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_course => true
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
@ -189,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

@ -126,7 +126,9 @@ module Redmine
@course_module = options[:course_module]
@project_module = options[:project_module]
@contest_module = options[:contest_module]
@belong_to_project = options[:belong_to_project] || false
@belong_to_course = options[:belong_to_course] || false
@belong_to_contest =options[:belong_to_contest] || false
hash.each do |controller, actions|
if actions.is_a? Array
@actions << actions.collect {|action| "#{controller}/#{action}"}
@ -152,6 +154,19 @@ module Redmine
def read?
@read
end
def belong_to_project?
@belong_to_project
end
def belong_to_course?
@belong_to_course
end
def belong_to_contest?
@belong_to_contest
end
end
end
end

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