Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-09-28 11:32:55 +08:00
commit 8df86c96fd
31 changed files with 1281 additions and 1107 deletions

View File

@ -254,6 +254,28 @@ class ApplicationController < ActionController::Base
end
end
def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false)
if @attachment.container_type == "Memo"
allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
elsif @attachment.container_type == "Project"
elsif @attachment.container_type == "course"
elsif @attachment.container_type == "contest"
end
if allowed
true
else
if @project && @project.archived?
render_403 :message => :notice_not_authorized_archived_project
else
deny_access
end
end
end
def authorize_course(ctrl = params[:controller], action = params[:action], global = false)
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @course, :global => global)
if allowed

View File

@ -21,7 +21,7 @@ class AttachmentsController < ApplicationController
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
before_filter :delete_authorize, :only => :destroy
before_filter :authorize_global, :only => :upload
before_filter :authorize_attachment_download, :only => :download
before_filter :login_without_softapplication, only: [:download]
accept_api_auth :show, :download, :upload
require 'iconv'

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

@ -89,10 +89,9 @@ class MemosController < ApplicationController
offset(@reply_pages.offset).
all
if @memo.new_record?
format.html { redirect_to back_url, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
format.html { render :new,:layout=>'base'}
else
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
format.html { render action: :show }
format.json { render json: @memo.errors, status: :unprocessable_entity }
end

View File

@ -898,7 +898,7 @@ class ProjectsController < ApplicationController
@project = Project.find params[:id]
if User.current.login?
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
if members != nil
if members != nil && members.roles.first.to_s != "Manager"
members.destroy
end
respond_to do |format|

View File

@ -456,8 +456,8 @@ module CoursesHelper
#课程实践年份下拉框
def course_time_option
type = []
#work_types = WorksCategory.all
for i in (2008..2020)
now_year = Time.now.year
for i in (now_year..now_year + 10)
option = []
option << i
option << i

View File

@ -251,6 +251,7 @@ module WatchersHelper
end
def exit_project_link(project)
link_to("退出项目",exit_cur_project_path(project.id),:remote => true )
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
:remote => true, :confirm => l(:lable_sure_exit_project) )
end
end

View File

@ -291,7 +291,6 @@
<%= labelled_form_for @user, :url => register_path do |f| %>
<%= error_messages_for 'user' %>
<div class="box tabular">
<p>
<table>
@ -305,31 +304,34 @@
<option value="1"><%= l(:label_student) %></option>
<option value="2"><%= l(:label_enterprise) %></option>
<option value="3"><%= l(:label_account_developer) %></option>
</select>
</td>
<td>
<span id='technical_title' style='display:none'>
<select name="technical_title" id="userTechnical_title"></select></span>
<select name="technical_title" id="userTechnical_title"></select>
</span>
<span id='no' style='display:none'>
<strong>
<%= l(:label_bidding_user_studentcode) %>
<span class="required"> *</span>
</strong>
<% unless User.current.user_extensions.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %></span>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %>
<% else %>
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %></span>
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %>
<% end %>
</span>
</td>
</tr>
</table>
</p>
<% if @user.auth_source_id.nil? %>
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
<em class="info"><%= l(:label_max_number) %></em></p>
<em class="info"><%= l(:label_max_number) %></em>
</p>
<p><%= f.password_field :password, :size => 25, :required => true %>
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em></p>
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
</p>
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %></p>
<% end %>
<span id='name' style='display:none'>
@ -337,23 +339,29 @@
<p><%= f.text_field :lastname, :required => true %></p>
</span>
<span id='enterprise' style='display:none'>
<p><table>
<p>
<table>
<tr>
<td class="info" align="right" style="width: 90px"><strong>企业名<span class="required"> *</span></strong></td>
<td class="info" align="right" style="width: 90px">
<strong>企业名
<span class="required"> *</span>
</strong>
</td>
<td class="info" style="width: 10px">
<%= text_field_tag :enterprise_name %></td>
<%= text_field_tag :enterprise_name %>
</td>
</tr>
</table>
</p>
</span>
<p><%= f.text_field :mail, :required => true %><span id="valid_user_mail"></span></p>
<p>
<em class="info"><%= "#{l(:label_mail_attention)} " %></em></p>
<%= f.text_field :mail, :required => true %>
<span id="valid_user_mail"></span>
</p>
<p>
<em class="info"><%= "#{l(:label_mail_attention)} " %></em>
</p>
<p><%= f.select :language, lang_options_for_select, :required => true %></p>
<!-- added by bai 增加了身份、性别和地区-->
<span id='gender' style='display:none'>
@ -370,8 +378,6 @@
</table>
</p>
</span>
<p>
<table>
<tr>
@ -435,19 +441,13 @@
</table>
</p>
<% end %>
<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
<% end %>
<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
var $login = $('#user_login')
@ -486,5 +486,4 @@
;
});
});
</script>

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)
{
$("#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,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur=>"regexWorkdescription();"
%>
</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,
<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,
:rows => 3,
:onblur => 'regexDescription();',
: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

@ -8,13 +8,9 @@
$("#occupation").html(data);
}
})
}
)
}
</script>
<script type="text/javascript">
function check() {
var regex = /^\d*$/;
if (!regex.test($("#class_period").val())) {
@ -48,7 +44,8 @@
<span>&nbsp;<strong><%= l(:label_class_hour) %></strong></span>
</td>
</tr>
</table></p>
</table>
</p>
<% else %>
<p>
<table>
@ -87,8 +84,9 @@
</p>
<p style="margin-left:-10px;">
<label for="course[course]_password" style="font-size: 13px;"><%= l(:label_new_course_password) %>
<span class="required">
*</span></label><input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]">
<span class="required">*</span>
</label>
<input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]"/>
</p>
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<% end %>
@ -103,7 +101,10 @@
</span>
</p>
<p style="margin-left:-10px;">
<em style="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_course_public_info) %></em>
<em style="color: #888888;display: block;font-size: 90%;font-style: normal;">
<%= f.check_box :is_public, :style => "margin-left:10px;" %>
<%= l(:label_course_public_info) %>
</em>
</p><!-- modified by bai -->
<p style="display:none;"><%= f.text_field :course_type, :value => 1 %></p>
<%= wikitoolbar_for 'course_description' %>

View File

@ -20,26 +20,34 @@
<% members.each do |member| %>
<% next if member.new_record? %>
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
<td class="<%= member.principal.class.name.downcase %>">
<%= link_to_user member.principal %>
</td>
<td class="roles">
<span id="member-<%= member.id %>-roles">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
</span>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
<%= form_for(member, {:as => :membership, :remote => true,
:url => course_memberships_path(member),:method => :put,
:html => {:id => "member-#{member.id}-roles-form",
:class => 'hol'}}
) do |f| %>
<p>
<% roles.each do |role| %>
<label><%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
<% end %></p>
<label>
<%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
<%= h role %>
</label>
<br/>
<% end %>
</p>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<p><%= submit_tag l(:button_change), :class => "small" %>
<p>
<%= submit_tag l(:button_change), :class => "small" %>
<%= link_to_function l(:button_cancel),
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
%></p>
%>
</p>
<% end %>
</td>
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
@ -71,8 +79,10 @@
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
<fieldset>
<legend><%= l(:label_member_new) %></legend>
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
<p>
<%= label_tag "principal_search", l(:label_principal_search) %>
<%= text_field_tag 'principal_search', nil %>
</p>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js') }')" %>
<div id="principals_for_new_member">
@ -82,10 +92,12 @@
<!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% roles.each do |role| %>
<label><%= radio_button_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
<% end %></p>
<label>
<%= radio_button_tag 'membership[role_ids][]', role.id %>
<%= h role %>
</label>
<% end %>
</p>
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
</fieldset>
<% end %>

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

@ -14,7 +14,9 @@
<!--添加退出项目-->
<div style="margin-left: 20px;">
<% if ((User.current.member_of? @project) && User.current.login?) %>
<% if ((User.current.member_of? @project) &&
User.current.login? &&
Member.where(:user_id => User.current.id, :project_id=>@project.id).first.roles.first.to_s != "Manager") %>
<%= exit_project_link(@project) %>
<% end %>
</div>

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,15 +1,5 @@
<%= labelled_form_for(@memo, :url => forum_memos_path) do |f| %>
<% if @memo.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
<ul>
<% @memo.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="actions" style="max-width:680px">
<p><%= f.text_field :subject, :required => true, :size => 95 %></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor01' %></p>
@ -20,6 +10,6 @@
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>
<%= f.submit :value => l(:label_memo_create) %>
<%= f.submit :value => l(:label_memo_create) %> <%= link_to l(:button_back), forum_path(@forum) %>
</div>
<% end %>

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

@ -27,5 +27,5 @@
<%= render :partial => 'memos/topic_form' %>
</div>
<%= link_to l(:button_back), forum_path(@forum) %>
</div>

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) %>
@ -27,6 +63,7 @@
<% end %>
</fieldset>
<% 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>
@ -47,6 +139,8 @@
</tr>
<% end %>
<% end %>
<% end %>
</tbody>
</table>
</div>

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>
<!--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.truncate(10,omisiion:'...') %></lable></p>
<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,8 +491,11 @@ zh:
permission_edit_course: 编辑课程
permission_select_contest_modules: 选择竞赛模块
permission_manage_contestnotifications: 管理竞赛通知
permission_notificationcomment_contestnotifications: 添加竞赛通知评论
permission_memos_attachments_download: 下载贴吧附件
permission_projects_attachments_download: 项目附件下载
permission_course_attachments_download: 课程附件下载
permission_contest_attachments_download: 竞赛附件下载
project_module_issue_tracking: 问题跟踪
project_module_time_tracking: 时间跟踪
@ -705,6 +708,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 +1940,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 +2004,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 +2050,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: 上传作品软件包和作品截图
@ -2129,3 +2141,5 @@ zh:
lable_hot_projects: 热门项目
lable_user_active: 用户动态
lable_bar_active: 贴吧动态
lable_student_list_visable: 学生列表是否公开
lable_sure_exit_project: 是否确认退出该项目

View File

@ -1,13 +0,0 @@
class Change225BidData < ActiveRecord::Migration
def up
bid = Bid.find 225
bid.proportion = 60
bid.save
end
def down
bid = Bid.find 225
bid.proportion = 60
bid.save
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140922032830) do
ActiveRecord::Schema.define(:version => 20140916005319) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -437,9 +437,9 @@ ActiveRecord::Schema.define(:version => 20140922032830) do
t.string "web_title"
t.string "title"
t.text "description"
t.string "page_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "page_type"
t.integer "sort_type"
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
@ -879,7 +879,7 @@ ActiveRecord::Schema.define(:version => 20140922032830) do
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :limit => 16777215, :null => false
t.text "content", :null => false
t.integer "author_id"
t.integer "replies_count", :default => 0
t.integer "last_reply_id"

View File

@ -89,54 +89,61 @@ 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.permission :memos_attachments_download,{:attachments => :download}
map.permission :projects_attachments_download,{:attachments => :download},:belong_to_project => true
map.permission :course_attachments_download,{:attachments => :download},:belong_to_course => true
map.permission :contest_attachments_download,{:attachments => :download},:belong_to_contest => 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 +196,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; }