diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb
index 493b313cf..8d9d1c20b 100644
--- a/app/controllers/boards_controller.rb
+++ b/app/controllers/boards_controller.rb
@@ -33,7 +33,7 @@ class BoardsController < ApplicationController
#modify by nwb
@flag = params[:flag] || false
if @project
- if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
+ if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? && !User.current.allowed_to?(:view_messages, @project)
render_403
else
@boards = @project.boards.includes(:last_message => :author).all
diff --git a/app/controllers/contestant_works_controller.rb b/app/controllers/contestant_works_controller.rb
index a73775ae8..fd4e3264b 100644
--- a/app/controllers/contestant_works_controller.rb
+++ b/app/controllers/contestant_works_controller.rb
@@ -15,13 +15,17 @@ class ContestantWorksController < ApplicationController
def new
#更新消息
- noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
- noEvaluation.update_all(:viewed => true)
+ if @contestwork.work_status == 1
+ noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
+ noEvaluation.update_all(:viewed => true)
- @user = User.current
- @student_work = ContestantWork.new
- respond_to do |format|
- format.html{ render :layout => "base_contests"}
+ @user = User.current
+ @student_work = ContestantWork.new
+ respond_to do |format|
+ format.html{ render :layout => "base_contests"}
+ end
+ else
+ render_403
end
end
diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb
index 5295477f5..444b5b03e 100644
--- a/app/controllers/contests_controller.rb
+++ b/app/controllers/contests_controller.rb
@@ -175,11 +175,11 @@ class ContestsController < ApplicationController
end
case params[:agree]
when 'Y'
- if ContestMember.where(:user_id => apply_user.id).first.nil?
+ if ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first.nil?
member = ContestMember.new(:user_id => apply_user.id)
Contest.find(applied_contest.contest_id).contest_members << member
else
- member = ContestMember.where(:user_id => apply_user.id).first
+ member = ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first
end
contest_member_roles = member.contest_member_roles
diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb
index 06ea33c09..375ded942 100644
--- a/app/controllers/memos_controller.rb
+++ b/app/controllers/memos_controller.rb
@@ -72,7 +72,7 @@ class MemosController < ApplicationController
end
end
format.js
- format.html { redirect_to back_memo_url}
+ format.html {redirect_to back_memo_url}
format.json { render json: @memo, status: :created, location: @memo }
else
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 87b021678..e65f4c768 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -273,7 +273,7 @@ class NewsController < ApplicationController
elsif @news.contest_id
@contest = Contest.find(@news.contest_id)
if @contest
- @left_nav_type = 4
+ @left_nav_type = 5
respond_to do |format|
format.js
format.html {render :layout => 'base_contests'}
diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb
index 4b64e7fb1..75a30ba57 100644
--- a/app/controllers/works_controller.rb
+++ b/app/controllers/works_controller.rb
@@ -70,7 +70,7 @@ class WorksController < ApplicationController
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
- homework.work_status = homework.publish_time > Date.today ? 0 : 1
+ homework.work_status = homework.publish_time > Date.today ? 0 : (homework.end_time < Date.today ? 2 : 1)
work_detail_manual = WorkDetailManual.new
diff --git a/app/models/message.rb b/app/models/message.rb
index 177b5f7ee..39902d757 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -103,8 +103,10 @@ class Message < ActiveRecord::Base
:if => lambda {|message, user|
if message.project
user.allowed_to?(:edit_messages, message.project)
- else
+ elsif message.course
user.allowed_to?(:edit_messages, message.course)
+ elsif message.contest
+ user.admin_of_contest?(message.contest)
end
}
diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb
index d07a42ed5..1f0cea922 100644
--- a/app/views/forums/show.html.erb
+++ b/app/views/forums/show.html.erb
@@ -29,7 +29,7 @@
-
推荐问吧
+ 推荐贴吧
<%= render :partial => "forums/right_bar" %>
diff --git a/app/views/layouts/_base_footer_public.html.erb b/app/views/layouts/_base_footer_public.html.erb
index 043c254e2..2cec0fc27 100644
--- a/app/views/layouts/_base_footer_public.html.erb
+++ b/app/views/layouts/_base_footer_public.html.erb
@@ -8,8 +8,8 @@
<% unless memo.nil? %>
<%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|
<% end %>
-
<%= l(:label_forums)%>|
-
<%= l(:label_language)%>
+ <%= l(:label_forums)%>|
+
<%= l(:label_language)%>
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 29fa421cc..1d6d8f0f1 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -26,7 +26,7 @@
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<% end %>
<% else %>
diff --git a/app/views/layouts/_org_custom_footer.html.erb b/app/views/layouts/_org_custom_footer.html.erb
index ffaa22fd7..0fce573e2 100644
--- a/app/views/layouts/_org_custom_footer.html.erb
+++ b/app/views/layouts/_org_custom_footer.html.erb
@@ -6,7 +6,7 @@
<% unless memo.nil? %>
帮助中心|
<% end %>
- 贴吧交流
+ 问吧交流
Copyright 2007~2016, All Rights Reserved 湘ICP备09019772
diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb
index 644e99126..a422dd780 100644
--- a/app/views/layouts/base_org.html.erb
+++ b/app/views/layouts/base_org.html.erb
@@ -156,7 +156,7 @@
<% unless memo.nil? %>
帮助中心|
<% end %>
- 贴吧交流
+ 问吧交流
diff --git a/app/views/layouts/base_org_newstyle.html.erb b/app/views/layouts/base_org_newstyle.html.erb
index b68b226d6..1b5cea835 100644
--- a/app/views/layouts/base_org_newstyle.html.erb
+++ b/app/views/layouts/base_org_newstyle.html.erb
@@ -410,7 +410,7 @@
<% unless memo.nil? %>
帮助中心
<% end %>
- 贴吧交流
+ 问吧交流
Copyright 2007~2016 All Rights Reserved
湘ICP备09019772
diff --git a/app/views/layouts/base_organization.html.erb b/app/views/layouts/base_organization.html.erb
index b4b1fa52e..31394265d 100644
--- a/app/views/layouts/base_organization.html.erb
+++ b/app/views/layouts/base_organization.html.erb
@@ -110,7 +110,7 @@
<% unless memo.nil? %>
帮助中心|
<% end %>
- 贴吧交流
+ 问吧交流
diff --git a/app/views/news/_contest_show.html.erb b/app/views/news/_contest_show.html.erb
index a74007f00..bb846ef43 100644
--- a/app/views/news/_contest_show.html.erb
+++ b/app/views/news/_contest_show.html.erb
@@ -32,14 +32,14 @@
l(:button_edit),
{:action => 'edit', :id => @news},
:class => 'postOptionLink'
- ) if User.current == @news.author || User.current.admin_of_contest?(@contest) %>
+ ) if User.current == @news.author || User.current.admin_of_contest?(@contest) || User.current.admin? %>
<%= delete_link(
news_path(@news),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
- ) if User.current == @news.author || User.current.admin_of_contest?(@contest) %>
+ ) if User.current == @news.author || User.current.admin_of_contest?(@contest) || User.current.admin? %>
diff --git a/app/views/users/_contest_list_contents.html.erb b/app/views/users/_contest_list_contents.html.erb
index 3d9b290c8..b887d87fb 100644
--- a/app/views/users/_contest_list_contents.html.erb
+++ b/app/views/users/_contest_list_contents.html.erb
@@ -11,7 +11,7 @@
更新时间:<%= format_date(contest.updated_at) %>
- 创建者:<%= contest.user.show_name %>
+ 创建者:<%= link_to contest.user.show_name, user_path(contest.user) %>
diff --git a/app/views/users/_contest_news.html.erb b/app/views/users/_contest_news.html.erb
index b97932124..70c71017a 100644
--- a/app/views/users/_contest_news.html.erb
+++ b/app/views/users/_contest_news.html.erb
@@ -45,14 +45,14 @@
l(:button_edit),
{controller:'news', :action => 'edit', :id => activity.id},
:class => 'postOptionLink'
- ) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) %>
+ ) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) || User.current.admin? %>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
- ) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) %>
+ ) if User.current == activity.author || User.current.admin_of_contest?(activity.contest) || User.current.admin? %>
<% end %>
diff --git a/app/views/users/_user_message_contest.html.erb b/app/views/users/_user_message_contest.html.erb
index c2c18837a..b0232e75c 100644
--- a/app/views/users/_user_message_contest.html.erb
+++ b/app/views/users/_user_message_contest.html.erb
@@ -102,7 +102,7 @@
发布了竞赛题:
- <% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? %>
+ <% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 %>
<%= link_to ma.contest_message.name, new_contestant_work_path(:work => ma.contest_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 7412ac071..d4e1475b2 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2135,7 +2135,7 @@ zh:
label_recruitment_information: 招聘信息
label_surpport_group: 帮助中心
#label_forums: 论坛反馈
- label_forums: 贴吧交流
+ label_forums: 问吧交流
label_language: 语言
label_license: 湘ICP备09019772
label_org_name: 组织名称:
diff --git a/config/routes.rb b/config/routes.rb
index 8b53d9b4b..952ee65f9 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -458,7 +458,7 @@ RedmineApp::Application.routes.draw do
post 'create_memo'
post 'create_feedback'
post 'mail_feedback'
- post 'update_memo_description'
+ post 'update_memo_description'
match 'search_memo', :via => [:get, :post]
match 'delete_forum_tag',:via =>[:get]
match 'add_forum_tag',:via=>[:get]
diff --git a/lib/tasks/contest_work_evaluation.rake b/lib/tasks/contest_work_evaluation.rake
index d97d4ba3d..6d72d4f01 100644
--- a/lib/tasks/contest_work_evaluation.rake
+++ b/lib/tasks/contest_work_evaluation.rake
@@ -3,7 +3,10 @@
namespace :contest_work_evaluation do
desc "start and end evaluation"
def get_assigned_contestant_works(judges, n, index, num)
- judges[(index % num) .. ((index + n - 1) % num)]
+ judges = judges + judges
+ first_index = (index * n) % num
+ last_index = (index * n + n - 1) % num < first_index ? ((index * n + n - 1) % num) + num : (index * n + n - 1) % num
+ judges[first_index .. last_index]
end
# 获取竞赛的评委人员
def contest_judges contest