Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
Linda 2017-01-16 10:46:59 +08:00
commit 98c17ce8ec
137 changed files with 71332 additions and 4583 deletions

View File

@ -54,6 +54,7 @@ gem 'elasticsearch-rails'
### profile
# gem 'oneapm_rpm'
# gem 'therubyracer'
group :development do
gem 'grape-swagger'

View File

@ -124,6 +124,16 @@ class AdminController < ApplicationController
render :action => "projects", :layout => false if request.xhr?
end
def contests
@name = params[:name]
@contests = Contest.where("id >= 780 and name like '%#{@name}%'").order('created_at desc')
@contests = paginateHelper @contests,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
def syllabuses
@name = params[:name]
@syllabuses = Syllabus.like(@name).order('created_at desc')

View File

@ -577,19 +577,19 @@ class ApplicationController < ActionController::Base
end
def redirect_back_or_default(default, options={})
back_url = '' #params[:back_url].to_s
back_url = params[:back_url].to_s
if back_url.present?
begin
uri = URI.parse(back_url)
# do not redirect user to another host or to the login or register page
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s) if default.is_a?(:User)
back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s) if default.is_a?(User)
redirect_to(back_url)
return
end
rescue URI::InvalidURIError
logger.warn("Could not redirect to invalid URL #{back_url}")
# redirect to default
redirect to default
end
elsif options[:referer]
redirect_to_referer_or default

View File

@ -173,12 +173,19 @@ class BlogCommentsController < ApplicationController
render_attachment_warning_if_needed(@blogComment)
#@article.save
# redirect_to user_blogs_path(:user_id=>params[:user_id])
# 给回复的人发消息
reply_user_id = params[:reply_id].nil? ? @blogComment.blog.author_id: params[:reply_id].to_i
# 回复的作业与评论的作者不是同一人则发送消息
if ( params[:reply_id].nil? && @blogComment.author.id != @blogComment.blog.author_id )|| (!params[:reply_id].nil? && @blogComment.author.id != params[:reply_id].to_i)
BlogMessage.create(:user_id => reply_user_id, :blog_id => params[:blog_id].to_i, :content => params[:blog_comment][:content],
:blog_commont_id => @blogComment.id, :blog_message_type => "BlogComment", :user_operator_id => @blogComment.author.id)
end
respond_to do |format|
format.html {
if params[:course_id] #如果呆了course_id过来了那么这是要跳到课程大纲去的
redirect_to syllabus_course_path(:id=>params[:course_id])
else
redirect_to user_blog_blog_comment_path(:user_id=>@article.author_id,:blog_id=>@article.blog_id,:id=>@article)
redirect_to user_blog_blog_comment_path( @article.author, :blog_id => @article.blog_id, :id => @article)
end
}

View File

@ -97,11 +97,11 @@ class ContestantWorksController < ApplicationController
respond_to do |format|
format.js
format.html
# format.xls {
# filename = "#{@contest.user.lastname.to_s + @contest.user.firstname}_#{@contest.name}_#{@contestwork.name}#{l(:excel_homework_list)}.xls"
# send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
# :filename => filename_for_content_disposition(filename))
# }
format.xls {
filename = "#{@contest.user.show_name.to_s}_#{@contest.name}_#{@contestwork.name}_#{l(:excel_homework_list)}_#{DateTime.parse(Time.now.to_s).strftime('%Y%m%d%H%M%S').to_s}.xls"
send_data(work_score_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
:filename => filename_for_content_disposition(filename))
}
end
end
@ -472,4 +472,140 @@ class ContestantWorksController < ApplicationController
def is_logged
redirect_to signin_path unless User.current.logged?
end
#提交成绩导出
def work_score_to_xls items
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "work"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
if @contestwork.work_type == 1 #普通作业
#开启在线评审
if @contestwork.online_evaluation
sheet1.row(0).concat([l(:excel_contestant_id),l(:excel_user_name),l(:excel_nickname),l(:excel_mail),l(:excel_school),l(:excel_homework_name),l(:excel_homework_des)])
if @contestwork.work_detail_manual.evaluation_num != -1
num = @contestwork.work_detail_manual.evaluation_num
n = num < (contest_judges @contest).size ? num : (contest_judges @contest).size
else
n = (contest_judges @contest).size
end
for i in 1 .. n do i
sheet1.row(0).concat([l(:label_judge_score, :num => i),l(:label_judge_comment, :num => i)])
end
sheet1.row(0).concat([l(:label_highest_score),l(:label_lowest_score),l(:excel_f_score),l(:excel_commit_time)])
count_row = 1
items.each do |contestant_work|
sheet1[count_row,0] = contestant_work.user.id
sheet1[count_row,1] = contestant_work.user.show_name
sheet1[count_row,2] = contestant_work.user.login
sheet1[count_row,3] = contestant_work.user.mail
sheet1[count_row,4] = contestant_work.user.user_extensions.school.nil? ? "" : contestant_work.user.user_extensions.school.name
sheet1[count_row,5] = contestant_work.name
sheet1[count_row,6] = strip_html contestant_work.description if !contestant_work.description.nil?
work_scores = contestant_work_score_record contestant_work
for i in 1 .. n do i
sheet1[count_row,6 + i*2 -1] = (work_scores.nil? || work_scores[i - 1].nil?) ? l(:label_without_score) : work_scores[i - 1].score
sheet1[count_row,6 + i*2] = (work_scores.nil? || work_scores[i - 1].nil?) ? "" : work_scores[i - 1].comment
end
sheet1[count_row,7+2*n] = (work_scores.nil? || work_scores.reorder("score desc").first.nil?) ? l(:label_without_score) : work_scores.reorder("score desc").first.score
sheet1[count_row,8+2*n] = (work_scores.nil? || work_scores.reorder("score desc").last.nil?) ? l(:label_without_score) : work_scores.reorder("score desc").last.score
sheet1[count_row,9+2*n] = contestant_work.work_score.nil? ? l(:label_without_score) : contestant_work.work_score.round(2)
sheet1[count_row,10+2*n] = format_time contestant_work.commit_time
count_row += 1
end
#未开启在线评审
else
sheet1.row(0).concat([l(:excel_contestant_id),l(:excel_user_name),l(:excel_nickname),l(:excel_mail),l(:excel_school),l(:excel_homework_name),l(:excel_homework_des),l(:excel_commit_time)])
count_row = 1
items.each do |contestant_work|
sheet1[count_row,0] = contestant_work.user.id
sheet1[count_row,1] = contestant_work.user.show_name
sheet1[count_row,2] = contestant_work.user.login
sheet1[count_row,3] = contestant_work.user.mail
sheet1[count_row,4] = contestant_work.user.user_extensions.school.nil? ? "" : contestant_work.user.user_extensions.school.name
sheet1[count_row,5] = contestant_work.name
sheet1[count_row,6] = strip_html contestant_work.description if !contestant_work.description.nil?
sheet1[count_row,7] = format_time contestant_work.commit_time
count_row += 1
end
end
elsif @contestwork.work_type == 3 #分组作业
if @contestwork.online_evaluation
sheet1.row(0).concat([l(:excel_group_member),l(:excel_group_leader),l(:excel_group_leader_login),l(:excel_group_leader_mail),l(:excel_school)])
if @contestwork.work_detail_group.base_on_project
sheet1.row(0).concat([l(:excel_homework_project),l(:excel_homework_name),l(:excel_homework_des)])
else
sheet1.row(0).concat([l(:excel_homework_name),l(:excel_homework_des)])
end
if @contestwork.work_detail_manual.evaluation_num != -1
num = @contestwork.work_detail_manual.evaluation_num
n = num < (contest_judges @contest).size ? num : (contest_judges @contest).size
else
n = (contest_judges @contest).size
end
for i in 1 .. n do i
sheet1.row(0).concat([l(:label_judge_score, :num => i),l(:label_judge_comment, :num => i)])
end
sheet1.row(0).concat([l(:label_highest_score),l(:label_lowest_score),l(:excel_f_score),l(:excel_commit_time)])
count_row = 1
items.each do |contestant_work|
sheet1[count_row,0] = get_contest_group_member_names contestant_work
sheet1[count_row,1] = contestant_work.user.show_name
sheet1[count_row,2] = contestant_work.user.login
sheet1[count_row,3] = contestant_work.user.mail
sheet1[count_row,4] = contestant_work.user.user_extensions.school.nil? ? "" : contestant_work.user.user_extensions.school.name
if @contestwork.work_detail_group.base_on_project
sheet1[count_row,5] = (contestant_work.project_id == 0 || contestant_work.project_id.nil?) ? l(:excel_no_project) : contestant_work.project.name
current_column = 6
else
current_column = 5
end
sheet1[count_row,current_column] = contestant_work.name
sheet1[count_row,current_column + 1] = strip_html contestant_work.description if !contestant_work.description.nil?
work_scores = contestant_work_score_record contestant_work
for i in 1 .. n do i
sheet1[count_row,current_column + 1 + i*2 -1] = (work_scores.nil? || work_scores[i - 1].nil?) ? l(:label_without_score) : work_scores[i - 1].score
sheet1[count_row,current_column + 1 + i*2] = (work_scores.nil? || work_scores[i - 1].nil?) ? "" : work_scores[i - 1].comment
end
sheet1[count_row,current_column + 2 +2*n] = (work_scores.nil? || work_scores.reorder("score desc").first.nil?) ? l(:label_without_score) : work_scores.reorder("score desc").first.score
sheet1[count_row,current_column + 3 +2*n] = (work_scores.nil? || work_scores.reorder("score desc").last.nil?) ? l(:label_without_score) : work_scores.reorder("score desc").last.score
sheet1[count_row,current_column + 4 +2*n] = contestant_work.work_score.nil? ? l(:label_without_score) : contestant_work.work_score.round(2)
sheet1[count_row,current_column + 5 +2*n] = format_time contestant_work.commit_time
count_row += 1
end
else
if @contestwork.work_detail_group.base_on_project
sheet1.row(0).concat([l(:excel_group_member),l(:excel_group_leader),l(:excel_group_leader_login),l(:excel_group_leader_mail),l(:excel_school),l(:excel_homework_project),l(:excel_homework_name),l(:excel_homework_des),l(:excel_commit_time)])
else
sheet1.row(0).concat([l(:excel_group_member),l(:excel_group_leader),l(:excel_group_leader_login),l(:excel_group_leader_mail),l(:excel_school),l(:excel_homework_name),l(:excel_homework_des),l(:excel_commit_time)])
end
count_row = 1
items.each do |contestant_work|
sheet1[count_row,0] = get_contest_group_member_names contestant_work
sheet1[count_row,1] = contestant_work.user.show_name
sheet1[count_row,2] = contestant_work.user.login
sheet1[count_row,3] = contestant_work.user.mail
sheet1[count_row,4] = contestant_work.user.user_extensions.school.nil? ? "" : contestant_work.user.user_extensions.school.name
if @contestwork.work_detail_group.base_on_project
sheet1[count_row,5] = (contestant_work.project_id == 0 || contestant_work.project_id.nil?) ? l(:excel_no_project) : contestant_work.project.name
current_column = 6
else
current_column = 5
end
sheet1[count_row,current_column] = contestant_work.name
sheet1[count_row,current_column + 1] = strip_html contestant_work.description if !contestant_work.description.nil?
sheet1[count_row,current_column + 2] = format_time contestant_work.commit_time
count_row += 1
end
end
end
book.write xls_report
xls_report.string
end
end

View File

@ -9,7 +9,7 @@ class ContestsController < ApplicationController
include AvatarHelper
before_filter :find_contest, :only => [:show, :settings, :update, :destroy, :contest_activities, :search_member, :private_or_public, :switch_role, :set_invite_code_halt, :renew,
:member]
:member, :export_all_members, :feedback]
before_filter :is_logged, :only => [:index, :new, :create]
before_filter :is_admin?, :only => [:settings, :set_invite_code_halt, :destroy]
before_filter :is_member?, :only => [:show, :contest_activities]
@ -115,6 +115,30 @@ class ContestsController < ApplicationController
@contest.update_attributes(:is_delete => true)
end
def feedback
if (User.current.admin? || @contest.is_public || (!@contest.is_public && User.current.member_of_contest?(@contest)))
ContestMessage.where(:user_id => User.current.id, :contest_id => @contest.id, :contest_message_type => 'JournalsForMessage', :contest_message_id => @contest.journals_for_messages.map{|jour|jour.id}).update_all(:viewed => true)
page = params[:page]
# Find the page of the requested reply
@jours = @contest.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jour_count = @jours.count
@limit = 10
if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit
end
@jour = paginateHelper @jours,10
@state = false
@left_nav_type = 6
respond_to do |format|
format.html{render :layout => 'base_contests'}
format.api
end
else
render_403
end
end
def private_or_public
@contest.update_attributes(:is_public => !@contest.is_public)
@ -284,8 +308,52 @@ class ContestsController < ApplicationController
end
end
def export_all_members
sql = "SELECT DISTINCT(cmr.id) AS cmr_id, cmr.role_id, users.`login`, users.id AS user_id, users.`mail`, cmr.created_at FROM users, contest_members cm, contest_member_roles cmr, user_extensions ue, schools " +
"WHERE users.id = cm.`user_id` AND users.id=ue.`user_id` AND cmr.`contest_member_id` = cm.`id` AND cm.`contest_id` = #{@contest.id} AND (ue.`school_id` IS NULL OR ue.`school_id` = schools.`id`) " +
"ORDER BY role_id ASC, CONVERT(schools.`name` USING gbk) COLLATE gbk_chinese_ci DESC, CONVERT(users.`lastname` USING gbk) COLLATE gbk_chinese_ci DESC"
@members = ContestMemberRole.find_by_sql sql
respond_to do |format|
format.xls {
filename = "#{@contest.name.to_s}-成员列表-#{DateTime.parse(Time.now.to_s).strftime('%Y%m%d%H%M%S').to_s}.xls"
send_data(member_to_xls(@members), :type => "text/excel;charset=utf-8; header=present",
:filename => filename_for_content_disposition("#{filename}.xls"))
}
end
end
private
def member_to_xls members
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "成员列表"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
#sheet1.row(0).default_format = blue
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
sheet1[0,0] = "id"
sheet1[0,1] = "姓名"
sheet1[0,2] = "登录名"
sheet1[0,3] = "电子邮箱"
sheet1[0,4] = "单位"
sheet1[0,5] = "角色"
sheet1[0,6] = "加入时间"
count_row = 1
members.each_with_index do |member, i|
user = User.find(member.user_id)
sheet1[count_row,0]= user.id
sheet1[count_row,1] = user.show_name
sheet1[count_row,2] = user.login
sheet1[count_row,3] = user.mail
sheet1[count_row,4] = user.user_extensions.school_id.blank? ? "" : (user.user_extensions.school.blank? ? "" : user.user_extensions.school.name)
sheet1[count_row,5] = member.role_id == 13 ? "管理员" : (member.role_id == 14 ? "评委" : "参赛者")
sheet1[count_row,6] = format_time member.created_at
count_row += 1
end
book.write xls_report
xls_report.string
end
def find_contest
if params[:id].to_i < 780
render_403

View File

@ -187,6 +187,7 @@ class CoursesController < ApplicationController
# @is_remote = true
@sort_type = 'score'
@score_sort_by = "desc"
@search_name = "#{params[:name].strip}"
q = "#{params[:name].strip}"
if params[:incourse]
results = searchmember_by_name(student_homework_score(0,0,0,"desc"), q)
@ -350,19 +351,17 @@ class CoursesController < ApplicationController
@search = params[:search]
q = params[:search] ? "#{params[:search].strip}" : ""
@members = []
@members = @course.members.where("course_group_id = 0").joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id asc").select{|m| m.roles.to_s.include?("Student")}
if q.nil? || q == ""
@course.members.includes(:user =>[:user_extensions =>[]]).where("course_group_id = 0").each do |m|
if m && m.user && m.user.join_in?(@course)
@members << m
end
end
else
@course.members.includes(:user =>[:user_extensions =>[]]).where("course_group_id = 0").each do |m|
members = []
@members.each do |m|
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
if m && m.user && m.user.join_in?(@course) && (m.user[:login].to_s.downcase.include?(q) || m.user.user_extensions[:student_id].to_s.downcase.include?(q) || username.include?(q))
@members << m
if m && m.user && (m.user[:login].to_s.downcase.include?(q) || m.user.user_extensions[:student_id].to_s.downcase.include?(q) || username.include?(q))
members << m
end
end
@members = members
end
@is_search = params[:is_search] ? 1 : 0
respond_to do |format|
@ -402,6 +401,7 @@ class CoursesController < ApplicationController
@is_remote = true
@sort_type = 'score'
@score_sort_by = "desc"
@search_name = ""
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
@group = CourseGroup.find(params[:group_id])
@results = student_homework_score(@group.id,0, 0,"desc")
@ -455,6 +455,7 @@ class CoursesController < ApplicationController
@is_remote = true
@course_groups = @course.course_groups if @course.course_groups
@show_serch = params[:role] == '2'
@search_name = ""
case @role
when '1'
@subPage_title = l :label_teacher_list
@ -490,15 +491,16 @@ class CoursesController < ApplicationController
end
def export_course_member_excel
q = "#{params[:name].strip}"
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
group = CourseGroup.find params[:group_id]
unless group.nil?
@all_members = student_homework_score(group.id,0,0,"desc")
@all_members = searchmember_by_name(student_homework_score(group.id,0,0,"desc"), q)
end
elsif params[:group_id] && params[:group_id] == "-1"
@all_members = student_homework_score(-1, 0, 10,"desc")
@all_members = searchmember_by_name(student_homework_score(-1, 0, 10,"desc"), q)
else
@all_members = student_homework_score(0, 0, 10,"desc")
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
end
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at asc")
@ -657,6 +659,7 @@ class CoursesController < ApplicationController
course_status.destroy if course_status
course_status = CourseStatus.create(:course_id => @course.id, :grade => 0)
end
@syllabus = @course.syllabus
respond_to do |format|
format.js
end

View File

@ -89,7 +89,7 @@ class HomeworkCommonController < ApplicationController
end
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
param_end_time = Time.parse(params[:homework_common][:end_time]).strftime("%Y-%m-%d")
homework_end_time = Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d")
homework_end_time = @homework.end_time ? Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") : ''
if homework_end_time != param_end_time
if homework_end_time > param_end_time
@homework.student_works.where("work_status = 1").each do |st|
@ -172,7 +172,7 @@ class HomeworkCommonController < ApplicationController
end
#分组作业
if @homework.homework_type == 3
if @homework.homework_type == 3 && @homework.student_works.has_committed.count == 0
@homework.homework_detail_group ||= HomeworkDetailGroup.new
@homework_detail_group = @homework.homework_detail_group
@homework_detail_group.min_num = params[:min_num].to_i if params[:min_num]
@ -180,6 +180,12 @@ class HomeworkCommonController < ApplicationController
@homework_detail_group.base_on_project = params[:base_on_project] ? 1 : 0
end
if anonymous != @homework.anonymous_comment
@homework.student_works.where("work_status != 0").each do |student_work|
student_work.save
end
end
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
if @homework.save
homework_detail_manual.save if homework_detail_manual
@ -192,11 +198,11 @@ class HomeworkCommonController < ApplicationController
@hw_status = params[:hw_status].to_i
if params[:is_manage] == "1"
redirect_to manage_or_receive_homeworks_user_path(User.current.id)
redirect_to user_manage_homeworks_user_path(User.current.id)
elsif params[:is_manage] == "2"
redirect_to my_homeworks_user_path(User.current.id)
redirect_to user_receive_homeworks_user_path(User.current.id)
elsif @hw_status == 1
redirect_to user_path(User.current.id)
redirect_to user_course_community_path(User.current.id)
elsif @hw_status == 2
redirect_to course_path(@course.id)
elsif @hw_status == 5

View File

@ -51,7 +51,12 @@ class OrgSubfieldsController < ApplicationController
@organization = Organization.find(params[:id])
else
domain = Secdomain.where("subname=?", request.subdomain).first
@organization = Organization.find(domain.pid)
begin
@organization = Organization.find(domain.pid)
rescue
render_404
return
end
end
if @organization.is_public? or User.current.admin? or User.current.member_of_org?(@organization)
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+

View File

@ -28,7 +28,8 @@ class ProjectsController < ApplicationController
menu_item :feedback, :only => :feedback
menu_item :share, :only => :share
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project]
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,
:view_homework_attaches,:join_project, :project_home]
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar]
@ -72,6 +73,22 @@ class ProjectsController < ApplicationController
### added by william
include ActsAsTaggableOn::TagsHelper
# 仅仅为了转换Gitlab地址
def project_home
rep = params[:rep]
login = params[:username]
begin
user = User.find_by_login(login)
project = Project.find_by_sql("SELECT projects.* FROM `repositories`,`projects` where repositories.project_id = projects.id and projects.user_id =#{user.try(:id)} and repositories.identifier='#{rep}'").first
respond_to do |format|
format.html{redirect_to(:controller => 'repositories', :action => 'show', :id => project.id, :repository_id => rep)}
end
rescue
render_404
return
end
end
#查找组织
def search_public_orgs_not_in_project
condition = '%%'

View File

@ -157,6 +157,9 @@ class PullRequestsController < ApplicationController
def show
# compare_pull_request source_project, source_branch, target_project, target_branch
# compare_pull_request
# 如何从个人主页点击进入,则将该消息设为“已读”
ForgeMessage.where(:forge_message_id => params[:id], :forge_message_type => "PullRequest", :user_id => User.current.id, :viewed => false).update_all(:viewed => true)
@project_menu_type = 6
@type = params[:type]
@request = @g.merge_request(@project.gpid, params[:id])
@ -189,9 +192,13 @@ class PullRequestsController < ApplicationController
def accept_pull_request
begin
@status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid)
user = User.find_by_login(@status.author.try(:username))
# 更新管理员的pullrequest消息
update_pullrequest_message(params[:id].to_i, @project.id, "PullRequest", 2)
# 接受后,给用户发消息
send_message_to_author(@project.id, @status.author.try(:username), params[:id], 2)
if ForgeMessage.where(:forge_message_id => params[:id].to_i, :project_id => @project.id, :forge_message_type => "PullRequest", :user_id => user.id).count == 0
send_message_to_author(@project.id, @status.author.try(:username), params[:id], 2)
end
respond_to do |format|
format.js{redirect_to project_pull_request_path(@status.id, :project_id => @project.id)}
end
@ -225,8 +232,10 @@ class PullRequestsController < ApplicationController
request = @g.update_merge_request(@project.gpid, params[:id], User.current.gid, :state_event => params[:state])
user = User.find_by_login(request.author.try(:username))
status = params[:state] == "close" ? 4 : 3
send_message_to_manager(@project.id, params[:id], status)
if is_project_manager?(User.current.id, @project.id)
#send_message_to_manager(@project.id, params[:id], status)
update_pullrequest_message(request.id, @project.id, "PullRequest", status)
# 给作者发送消息,如何已经发送了消息,则不发
if is_project_manager?(User.current.id, @project.id) && ForgeMessage.where(:forge_message_id => request.id, :project_id => @project.id, :forge_message_type => "PullRequest", :user_id => user.id).count == 0
send_message_to_author(@project.id, user.login, request.id, status)
end
respond_to do |format|
@ -360,12 +369,21 @@ class PullRequestsController < ApplicationController
:project_id => project_id,
:forge_message_id => pull_request_id,
:forge_message_type => "PullRequest",
:viewed => true,
:viewed => false,
:status => status,
:operate_user_id => User.current.id,
)
end
def update_pullrequest_message forge_message_id, project_id, forge_message_type, status
# 更新这条pullrequest消息所有相关的信息
ForgeMessage.where(:forge_message_id => forge_message_id, :project_id => project_id, :forge_message_type => forge_message_type).update_all(:status => status, :operate_user_id => User.current.id, :updated_at => Time.now)
# 更新自己的消息为已读
ForgeMessage.where(:forge_message_id => forge_message_id, :project_id => project_id, :forge_message_type => forge_message_type, :user_id => User.current.id).update_all(:viewed => true)
# 更新pullrequest的status字段
PullRequest.where(:pull_request_id => forge_message_id).update_all(:status => status)
end
def authorize_logged
if !User.current.logged?
redirect_to signin_path

View File

@ -6,7 +6,7 @@ class QualityAnalysisController < ApplicationController
layout "base_projects"
include ApplicationHelper
include QualityAnalysisHelper
require 'jenkins_api_client'
# require 'jenkins_api_client'
require 'nokogiri'
require 'json'
require 'open-uri'
@ -230,7 +230,7 @@ class QualityAnalysisController < ApplicationController
# resource_id: login + @repository.id
def index
# 顶部导
# 顶部导
@project_menu_type = 5
begin

View File

@ -407,7 +407,8 @@ update
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
unless @entries.blank?
@changesets_latest_coimmit = @g.commit(@project.gpid, @entries.first.try(:lastrev))
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
# @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
# 获取默认分支
@ -497,7 +498,8 @@ update
entry_and_raw(false)
@content = @repository.cat(@path, @rev)
@changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
# @changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev))
@changesets_latest_coimmit = @g.rep_last_changes(@project.gpid, :rev => @rev, :path => @path)
# 总的提交数
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
if is_entry_text_data?(@content, @path)

View File

@ -8,7 +8,7 @@ class StudentWorkController < ApplicationController
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,
:search_course_students,:work_canrepeat,:add_group_member,:change_project]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work, :retry_work, :revise_attachment, :hide_score_detail]
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
@ -778,7 +778,7 @@ class StudentWorkController < ApplicationController
end
end
end
redirect_to student_homeworks_user_path(User.current.id)
redirect_to student_work_index_path(:homework => @homework.id)
end
def retry_work
@ -950,6 +950,19 @@ class StudentWorkController < ApplicationController
end
end
def hide_score_detail
student_work_score = StudentWorksScore.where(:id => params[:score_id]).first
if student_work_score
student_work_score.update_attributes(:is_hidden => 1)
end
@is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty?
@student_work_scores = student_work_score_record(@work)
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
respond_to do |format|
format.js
end
end
#缺评列表显示
def student_work_absence_penalty
order = params[:order] || "desc"

View File

@ -36,7 +36,7 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :update_message_viewed,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues,
@ -44,6 +44,7 @@ class UsersController < ApplicationController
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community]
before_filter :auth_user_extension, only: :show
before_filter :show_system_message, :only => [:show]
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
@ -151,96 +152,98 @@ class UsersController < ApplicationController
end
# 我发布的issue
def user_manage_issues
@manage_issues = "我发布的Issue"
# 排序(默认以更新时间降序)
order = "updated_on desc"
if params[:reorder_release_time]
order = "created_on #{params[:reorder_release_time]}"
elsif params[:reorder_turnover_time]
order = "updated_on #{params[:reorder_turnover_time]}"
end
def user_manage_issues
@manage_issues = "我发布的Issue"
# 排序(默认以更新时间降序)
order = "updated_on desc"
if params[:reorder_release_time]
order = "created_on #{params[:reorder_release_time]}"
elsif params[:reorder_turnover_time]
order = "updated_on #{params[:reorder_turnover_time]}"
end
@subject = params[:subject]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
@issues = Issue.where("author_id =? and subject like ?",
@user.id, "%#{@subject}%").order(order)
else
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
@user.id, @project_id, "%#{@subject}%").order(order)
end
@issues_filter = Issue.where("author_id =?", @user.id).order('updated_on desc')
@issue_open_count = Issue.where(:author_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
@issue_close_count = Issue.where(:author_id => @user.id, :status_id => 5).count
@subject = params[:subject]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
@issues = Issue.where("author_id =? and subject like ?",
@user.id, "%#{@subject}%").order(order)
else
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
@user.id, @project_id, "%#{@subject}%").order(order)
end
@issues_filter = Issue.where("author_id =?", @user.id)
@issue_open_count = @issues_filter.where(:status_id => [1, 2, 3, 4, 6]).count
@issue_close_count = @issues_filter.where(:status_id => 5).count
# @issue_open_count = Issue.where(:author_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
# @issue_close_count = Issue.where(:author_id => @user.id, :status_id => 5).count
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
end
end
end
# 我收到的issue
def user_receive_issues
@receive_issues = "我收到的Issue"
# 排序(默认以更新时间降序)
order = "updated_on desc"
if params[:reorder_release_time]
order = "created_on #{params[:reorder_release_time]}"
elsif params[:reorder_turnover_time]
order = "updated_on #{params[:reorder_turnover_time]}"
end
def user_receive_issues
@receive_issues = "我收到的Issue"
# 排序(默认以更新时间降序)
order = "updated_on desc"
if params[:reorder_release_time]
order = "created_on #{params[:reorder_release_time]}"
elsif params[:reorder_turnover_time]
order = "updated_on #{params[:reorder_turnover_time]}"
end
@subject = params[:subject]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
@issues = Issue.where("assigned_to_id =? and subject like ?",
@user.id, "%#{@subject}%").order(order)
else
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
@user.id, @project_id, "%#{@subject}%").order(order)
end
@issues_filter = Issue.where("assigned_to_id =?", @user.id).order('updated_on desc')
@issue_open_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
@issue_close_count = Issue.where(:assigned_to_id => @user.id, :status_id => 5).count
@subject = params[:subject]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
@issues = Issue.where("assigned_to_id =? and subject like ?",
@user.id, "%#{@subject}%").order(order)
else
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
@user.id, @project_id, "%#{@subject}%").order(order)
end
@issues_filter = Issue.where("assigned_to_id =?", @user.id)
@issue_open_count = @issues_filter.where(:status_id => [1, 2, 3, 4, 6]).count
@issue_close_count = @issues_filter.where(:status_id => 5).count
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
end
end
end
#展开所有回复
def show_all_replies
@ -388,6 +391,16 @@ end
comment.reply_id = params[:reply_id]
comment.root_id = reply.root_id
reply.children << comment
# 评论后,给回复人发消息(如果是本人就不发)
if comment.author.id != BlogComment.find(comment.reply_id).author_id
BlogMessage.create(:user_id => BlogComment.find(comment.reply_id).author_id,
:blog_commont_id => comment.id,
:blog_id => comment.blog_id,
:blog_message_type => "BlogComment",
:content => comment.content,
:user_operator_id => comment.author.id
)
end
when 'OrgDocumentComment'
@root = reply.root
comment = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:reply_id])
@ -476,9 +489,9 @@ end
# 初始化/更新 点击按钮时间, 24小时内显示系统消息
update_onclick_time
# 全部设为已读
if params[:viewed] == "all"
update_message_viewed(@user)
end
# if params[:viewed] == "all"
# update_message_viewed(@user)
# end
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
courses = @user.courses.where("is_delete = 1")
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
@ -486,7 +499,7 @@ end
when nil
# 系统消息为管理员发送,我的消息中包含有系统消息
@message_alls = []
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
messages = MessageAll.where(:user_id => @user.id).includes(:message).order("created_at desc")
messages.each do |message_all|
mess = message_all.message
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
@ -558,21 +571,28 @@ end
end
# 消息设置为已读
def update_message_viewed(user)
def update_message_viewed
if User.current.id == @user.id
course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0)
forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
org_querys = OrgMessage.where("user_id=? and viewed=0", user)
at_querys = AtMessage.where("user_id=? and viewed=0", user)
course_querys.update_all(:viewed => true) unless course_querys.nil?
forge_querys.update_all(:viewed => true) unless forge_querys.nil?
user_querys.update_all(:viewed => true) unless user_querys.nil?
forum_querys.update_all(:viewed => true) unless forum_querys.nil?
org_querys.update_all(:viewed => true) unless org_querys.nil?
at_querys.update_all(:viewed => true) unless at_querys.nil?
course_querys = CourseMessage.where("user_id =? and viewed =?", @user.id, 0)
forge_querys = ForgeMessage.where("user_id =? and viewed =?", @user.id, 0)
user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", @user.id, 0)
forum_querys = MemoMessage.where("user_id =? and viewed =?", @user.id, 0)
org_querys = OrgMessage.where("user_id=? and viewed=0", @user.id)
at_querys = AtMessage.where("user_id=? and viewed=0", @user.id)
contest_querys = ContestMessage.where(:user_id => @user.id, :viewed => 0)
blog_querys = BlogMessage.where(:user_id => @user.id, :viewed => 0)
applied_querys = AppliedMessage.where("user_id=? and viewed =?", @user.id, 0)
course_querys.update_all(:viewed => true) unless course_querys.nil?
forge_querys.update_all(:viewed => true) unless forge_querys.nil?
user_querys.update_all(:viewed => true) unless user_querys.nil?
forum_querys.update_all(:viewed => true) unless forum_querys.nil?
org_querys.update_all(:viewed => true) unless org_querys.nil?
at_querys.update_all(:viewed => true) unless at_querys.nil?
contest_querys.update_all(:viewed => true) unless contest_querys.nil?
blog_querys.update_all(:viewed => true) unless blog_querys.nil?
applied_querys.update_all(:viewed => true) unless applied_querys.nil?
end
redirect_to user_path(@user)
end
# 系统消息
@ -1990,26 +2010,22 @@ end
end
def show
if is_current_user
if User.current == @user
# 全部设为已读
# 自己的主页显示消息
# 系统消息为管理员发送,我的消息中包含有系统消息
@message_alls = []
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" , @user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
messages.each do |message_all|
mess = message_all.message
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
if (message_all.message_type =="SystemMessage" && !many_days_ago(mess.created_at, 30))
next
else
@message_alls << mess
end
end
end
@message_count = @message_alls.count
@message_alls = paginateHelper @message_alls, 20
messages_all = MessageAll.where(:user_id => @user.id)
@message_count = messages_all.count
# REDO:已删除的内容应该在页面中显示不点击
@message_all_pages = Paginator.new @message_count, per_page_option, params['page']
@message_alls = messages_all.includes(:message).
limit(@message_all_pages.per_page).
offset(@message_all_pages.offset).
reorder("#{MessageAll.table_name}.created_at desc")
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count
# 用户待完成的作业
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
@ -2037,7 +2053,9 @@ end
# 待审批的申请
@applied_message_alls = []
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage"]).includes(:message)
OrgMessage
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message)
applied_messages_all.each do |message_all|
mess = message_all.message
if !mess.nil?
@ -2053,6 +2071,13 @@ end
if mess.course_message_type == "JoinCourseRequest" && mess.status == 0
@applied_message_alls << mess
end
elsif message_all.message_type == "ForgeMessage"
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && PullRequest.where(:pull_request_id => mess.forge_message_id).first.user_id != User.current.id
user_id = PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).first.id
if ForgeMessage.where("status in (1,3) and user_id != #{user_id} and pull_request_id = #{mess.forge_message_id}")
@applied_message_alls << mess
end
end
end
end
end
@ -2248,7 +2273,7 @@ end
def unapproval_applied_list
@message_alls = []
# messages_all = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage"]).includes(:message).order("created_at desc")
messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message).order("created_at desc")
messages_all.each do |message_all|
mess = message_all.message
if !mess.nil?
@ -2262,14 +2287,15 @@ end
end
elsif message_all.message_type == "CourseMessage"
if mess.course_message_type == "JoinCourseRequest" && mess.status == 0
@message_alls << mess
end
=begin
elsif message_all.message_type == "ForgeMessage"
if mess.forge_message_type == "PullRequest" && PullRequest.where(:forge_message_id => mess.forge_message_id, :status =>0 )
@message_alls << mess
end
=end
elsif message_all.message_type == "ForgeMessage"
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && PullRequest.where(:pull_request_id => mess.forge_message_id).first.user_id != User.current.id
user_id = PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).first.id
if ForgeMessage.where("status in (1,3) and user_id != #{user_id} and pull_request_id = #{mess.forge_message_id}")
@message_alls << mess
end
end
end
end
end
@ -2280,7 +2306,7 @@ end
end
end
# 课程社区
# 课程社区
def course_community
@course_community = "课程"
if params[:course_id] != nil
@ -2349,7 +2375,7 @@ end
end
end
# 项目社区
# 项目社区
def project_community
# 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态
@ -2402,7 +2428,7 @@ end
end
end
# 竞赛社区
# 竞赛社区
def contest_community
@contest_community = "竞赛"
shield_contest_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Contest'").map(&:shield_id)
@ -2604,7 +2630,7 @@ end
end
#Modified by nie
#Modified by nie
unless User.current.admin?
if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?)
# redirect_to home_path
@ -2619,9 +2645,9 @@ end
end
end
##end fq
##end fq
#### added by fq
#### added by fq
def info
message = []
@ -2650,7 +2676,7 @@ end
format.api
end
end
#### end
#### end
def new
@ -2764,7 +2790,7 @@ end
end
end
# 上传用户资源
# 上传用户资源
def user_resource_create
user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id}
user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id }
@ -2819,7 +2845,7 @@ end
end
end
# 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源
# 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源
def user_resource_delete
if params[:resource_id].present?
Attachment.where("author_id =? and id =?", User.current.id, params[:resource_id]).first.destroy
@ -2877,7 +2903,7 @@ end
end
end
#根据id或者名称搜索教师或者助教为当前用户的课程
#根据id或者名称搜索教师或者助教为当前用户的课程
def search_user_course
@user = User.current
if !params[:search].nil?
@ -2897,7 +2923,7 @@ end
end
end
# 根据id或者名称搜索当前用户所在的项目
# 根据id或者名称搜索当前用户所在的项目
def search_user_project
@user = User.current
if !params[:search].nil?
@ -2917,7 +2943,7 @@ end
end
end
# 将资源发送到对应的课程,分为发送单个,或者批量发送
# 将资源发送到对应的课程,分为发送单个,或者批量发送
def add_exist_file_to_course
@flag = true
if params[:send_id].present?
@ -3028,7 +3054,7 @@ end
end
end
# 添加资源到对应的项目
# 添加资源到对应的项目
def add_exist_file_to_project
@flag = true
# 发送单个资源
@ -3448,7 +3474,7 @@ end
end
# 资源预览
# 资源预览
def resource_preview
preview_id = params[:resource_id]
@file = Attachment.find(preview_id)
@ -3461,7 +3487,7 @@ end
end
end
# 重命名资源
# 重命名资源
def rename_resource
@attachment = Attachment.find(params[:res_id]) if params[:res_id].present?
if @attachment != nil
@ -3506,7 +3532,7 @@ end
end
end
################# added by william
################# added by william
def tag_save
@tags = params[:tag_for_save][:name]
@obj_id = params[:tag_for_save][:object_id]
@ -3592,7 +3618,7 @@ end
format.html
end
end
###add by huang
###add by huang
def user_watchlist
limit = 10;
query = User.watched_by(@user.id);
@ -3602,7 +3628,7 @@ end
@action = 'watch'
render :template=>'users/user_fanslist',:layout=>'new_base_user'
end
###add by huang
###add by huang
def user_fanslist
limit = 10;
query = @user.watcher_users;
@ -3624,7 +3650,7 @@ end
render :template=>'users/user_fanslist',:layout=>'base_users_new'
end
#william
#william
def update_extensions(user_extensions)
user_extensions = params[:user_extensions]
unless user_extensions.nil?
@ -3638,7 +3664,7 @@ end
@user = User.find(params[:id])
end
#修改个人简介
#修改个人简介
def edit_brief_introduction
if @user && @user.extensions
@user.extensions.update_column("brief_introduction",params[:brief_introduction])
@ -3648,133 +3674,133 @@ end
end
end
# 获取公共资源
# 获取公共资源
def get_public_resources user_course_ids, user_project_ids, order, score
attachments = Attachment.where("(is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源搜索
# 获取公共资源搜索
def get_public_resources_search user_course_ids, user_project_ids, order, score, search
attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的资源
# 获取我的资源
def get_my_resources author_id, user_course_ids, user_project_ids, order, score
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的资源查询结果
# 获取我的资源查询结果
def get_my_resources_search (author_id, user_course_ids, user_project_ids, order, score, search)
@attachments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的课程资源
# 获取我的课程资源
def get_course_resources author_id, user_course_ids, order, score
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# # 获取我的私有资源分享结果
# def get_my_private_resources apply_ids, resource_type, order, score
# attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}")
# end
#
# # 获取我的私有资源分享搜索结果
# def get_my_private_resources_search apply_ids, resource_type, order, score, search
# attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
# end
# # 获取我的私有资源分享结果
# def get_my_private_resources apply_ids, resource_type, order, score
# attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}")
# end
#
# # 获取我的私有资源分享搜索结果
# def get_my_private_resources_search apply_ids, resource_type, order, score, search
# attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
# end
# 获取我的课程资源中搜索结果
# 获取我的课程资源中搜索结果
def get_course_resources_search author_id, user_course_ids, order, score, search
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中课程资源
# 获取公共资源中课程资源
def get_course_resources_public user_course_ids, order, score
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中课程资源搜索结果
# 获取公共资源中课程资源搜索结果
def get_course_resources_public_search user_course_ids, order, score, search
attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的项目资源
# 获取我的项目资源
def get_project_resources author_id, user_project_ids, order, score
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的项目资源搜索
# 获取我的项目资源搜索
def get_project_resources_search author_id, user_project_ids, order, score, search
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源的项目资源
# 获取公共资源的项目资源
def get_project_resources_public user_project_ids, order, score
attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源的项目资源搜索
# 获取公共资源的项目资源搜索
def get_project_resources_public_search user_project_ids, order, score, search
attchments = Attachment.where("(container_type = 'Project' and container_id is not null and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我上传的附件
# 获取我上传的附件
def get_attch_resources author_id, order, score
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
'Document','Message','News','StudentWorkScore','HomewCommon'))").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我上传的附件搜索结果
# 获取我上传的附件搜索结果
def get_attch_resources_search author_id, order, score, search
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
'Document','Message','News','StudentWorkScore','HomewCommon')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中我上传的附件
# 获取公共资源中我上传的附件
def get_attch_resources_public order, score
attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')
and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中我上传的附件
# 获取公共资源中我上传的附件
def get_attch_resources_public_search order, score, search
attchments = Attachment.where("(container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')
and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
# 获取我的用户类型资源
def get_principal_resources author_id, order, score
attchments = Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源搜索
# 获取我的用户类型资源搜索
def get_principal_resources_search author_id, order, score, search
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
# 获取我的用户类型资源
def get_principal_resources_public order, score
attchments = Attachment.where("container_type = 'Principal' and is_public =1 and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
# 获取我的用户类型资源
def get_principal_resources_public_search order, score, search
attchments = Attachment.where("(container_type = 'Principal'and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 资源库 分为全部 课程资源 项目资源 附件
# 资源库 分为全部 课程资源 项目资源 附件
def user_resource
# 别人的资源库是没有权限去看的
if User.current.id.to_i != @user.id.to_i
@ -3841,7 +3867,7 @@ end
end
end
# 导入资源
# 导入资源
def import_resources
@resource_id = params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id]
@resource_type = params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"
@ -3904,7 +3930,7 @@ end
end
end
# 内容导入到对象中
# 内容导入到对象中
def import_into_container
send_ids = params[:checkbox1]
# mul_id为当前课程id、项目id、组织id的多种形态
@ -3961,7 +3987,7 @@ end
end
end
# 根据资源关键字进行搜索
# 根据资源关键字进行搜索
def resource_search
@order, @b_sort = params[:order] || "created_on", params[:sort] || "desc"
@score = @b_sort == "desc" ? "asc" : "desc"
@ -4109,7 +4135,7 @@ end
end
end
#课程列表的排序
#课程列表的排序
def sort_syllabus_list
@order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1
@ -4155,7 +4181,7 @@ end
end
end
#归档班级列表
# 归档班级列表
def user_archive_courses
if User.current.logged?
@order, @c_sort, @type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
@ -4198,7 +4224,7 @@ end
end
end
#展开课程下的班级
# 展开课程下的班级
def expand_courses
@syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first
unless @syllabus.nil?
@ -4213,7 +4239,7 @@ end
end
end
#收藏班级/项目/竞赛
# 收藏班级/项目/竞赛
def cancel_or_collect
if params[:project]
@project = Project.find params[:project]
@ -4382,6 +4408,10 @@ end
end
private
def show_system_message
# 系统消息总显示在最前面,显示周期30天
@system_messages = SystemMessage.where("created_at > ?", Time.now - 86400 * 30)
end
def find_user
if params[:id] == 'current'

View File

@ -109,6 +109,19 @@ class WordsController < ApplicationController
end
return
end
elsif @journal_destroyed.jour_type == "Contest"
@contest = Contest.find(@journal_destroyed.jour_id)
@jours_count = @contest.journals_for_messages.where('m_parent_id IS NULL').count
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
unless @activity
if params[:user_activity_id] == params[:activity_id]
redirect_to feedback_contest_path(@contest)
else
redirect_to contest_activities_contest_path(@contest)
end
return
end
elsif @journal_destroyed.jour_type == 'HomeworkCommon'
@homework = HomeworkCommon.find @journal_destroyed.jour_id
if params[:user_activity_id]
@ -305,6 +318,18 @@ class WordsController < ApplicationController
end
end
def leave_contest_message
if User.current.logged?
@contest = Contest.find params[:id]
if params[:new_form][:content].size>0 && User.current.logged?
@contest.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:content], :reply_id => 0, :status => true, :is_readed => false)
end
redirect_to feedback_contest_path(@contest)
else
render_403
end
end
#作业的回复
def leave_homework_message
if User.current.logged?

View File

@ -242,7 +242,8 @@ class WorksController < ApplicationController
def set_score_rule
# 未启动在线评审时才能更改评审参数
if @contestwork.work_status < 3
@contestwork.online_evaluation = params[:online_evaluation] ? 1 : 0
@contestwork.online_evaluation = params[:online_evaluation].to_i ? 1 : 0
@contestwork.save
# 如果开启在线评审
if params[:online_evaluation]

View File

@ -43,10 +43,10 @@ class ZipdownController < ApplicationController
zip_homework_common homework
}
elsif params[:obj_class] == "Work"
homework = Work.find params[:obj_id]
render_403 if User.current.admin_of_contest?(homework.contest)
zipfile = checkfileSize(homework.contestant_works) {
zip_homework_common homework
contest_work = Work.find params[:obj_id]
render_403 if User.current.admin_of_contest?(contest_work.contest)
zipfile = checkfileSize(contest_work.contestant_works) {
zip_contest_work contest_work
}
else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"

View File

@ -1341,6 +1341,8 @@ module ApplicationHelper
title << @contest.name
elsif @organization
title << @organization.name
elsif @forum || params[:controller] == "forums"
title << "问吧"
elsif @user
if !@project_community.blank?
title << @project_community
@ -2904,8 +2906,7 @@ module ApplicationHelper
# 用户竞赛总数
def user_contest_count
count = @user.favorite_contests.visible.where("is_delete =?", 0).count
return count
@user.favorite_contests.visible.where("is_delete =?", 0).count
end
# 用户项目总数
@ -2944,14 +2945,12 @@ module ApplicationHelper
# 用户发布的issue数
def issues_author_is_self_count
@issues = Issue.where( :author_id => @user.id )
@issues_author_is_self_count = @issues.count
Issue.where(:author_id => @user.id).count
end
# 用户收到的issue数
def issues_assigned_is_self_count
@issues = Issue.where( :assigned_to_id => @user.id )
@issues_assigned_is_self_count = @issues.count
Issue.where( :assigned_to_id => @user.id ).count
end
def get_user_roll user
@ -4012,6 +4011,23 @@ def get_group_member_names work
result
end
def get_contest_group_member_names work
result = ""
unless work.nil?
work.contestant_work_projects.each do |member|
user = User.where(:id => member.user_id).first
unless user.nil?
if result != ""
result += "#{user.show_name}"
else
result += user.show_name
end
end
end
end
result
end
def course_syllabus_option user = User.current
syllabus_members = SyllabusMember.where("user_id = #{user.id}")
syllabus_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|mem| mem.syllabus_id}.join(',') + ")"
@ -4127,6 +4143,10 @@ def searchstudent_by_name users, name
mems
end
def contest_feedback_count
@contest.journals_for_messages.where('m_parent_id IS NULL').count
end
def add_reply_adapter obj, options
#modify by nwb
#添加对课程留言的支持
@ -4138,6 +4158,8 @@ def add_reply_adapter obj, options
Project.add_new_jour(nil, nil, obj.jour_id, options)
when 'Course'
Course.add_new_jour(nil, nil, obj.jour_id, options)
when 'Contest'
Contest.add_new_jour(nil, nil, obj.jour_id, options)
#when 'Bid'
# obj.jour.add_jour(nil, nil, nil, options)
#when 'Contest'

View File

@ -36,8 +36,7 @@ module ContestantWorksHelper
def contestant_work_score_record work
sql = "SELECT MAX(id) id FROM contestant_work_scores WHERE reviewer_role = 2 AND score IS NOT NULL AND contestant_work_id = #{work.id} GROUP BY user_id"
tea_ts_ids = ContestantWorkScore.find_by_sql sql
tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
scores = work.contestant_work_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
scores = work.contestant_work_scores.where(:id => tea_ts_ids.map{|tea| tea.id}).order("updated_at desc")
return scores
end

View File

@ -69,12 +69,13 @@ module StudentWorkHelper
str
end
#获取学生作品的评分记录:同一个教师或教辅只显示最后一次评分
#获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分
def student_work_score_record work
sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND student_work_id = #{work.id} GROUP BY user_id"
tea_ts_ids = StudentWorksScore.find_by_sql sql
tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
# sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id"
# tea_ts_ids = StudentWorksScore.find_by_sql sql
# tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
# scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
return scores
end

View File

@ -307,7 +307,10 @@ module UsersHelper
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
at_count = user.at_messages.where(viewed: false).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count
contest_count = ContestMessage.where(:user_id => user, :viewed => 0).count
applied_count = AppliedMessage.where("user_id=? and viewed =?", user, 0).count
blog_count = BlogMessage.where(:user_id => user, :viewed => 0).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count + contest_count + blog_count + applied_count
end
def user_mail_notification_options(user)

View File

@ -355,7 +355,7 @@ module WatchersHelper
text = collected == 1 ? l(:label_project_collect_cancel) : l(:label_project_collect)
url = store_mine_project_path(project_id)
method = 'post'
link = link_to(text, url, :remote => true, :method => method, :id => "#{project_id}", :class => "pro_new_topbtn_left fl", :title => "#{collected == 1 ? '点击将其从个人主页的项目列表中移除' : '点击将其添加至人主页的项目列表中'}")
link = link_to(text, url, :remote => true, :method => method, :id => "#{project_id}", :class => "pro_new_topbtn_left fl", :title => "#{collected == 1 ? '点击将其从左侧导航的项目列表中移除' : '点击将其添加至左侧导航的项目列表中'}")
# link.html_safe
end

View File

@ -6,6 +6,7 @@ class BlogComment < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :blog
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :blog_messages, :class_name => 'BlogMessage', :as => :blog_message, :dependent => :destroy
acts_as_tree :counter_cache => :comments_count, :order => "#{BlogComment.table_name}.sticky desc ,#{BlogComment.table_name}.created_on ASC"
acts_as_attachable

View File

@ -0,0 +1,20 @@
class BlogMessage < ActiveRecord::Base
# attr_accessible :title, :body
attr_accessible :content, :blog_commont_id, :blog_message_type, :viewed, :user_id, :blog_id, :user_operator_id
belongs_to :blog_comment ,:polymorphic => true
belongs_to :user
has_many :message_alls, :class_name => 'MessageAll', :as => :message, :dependent => :destroy
validates :user_id, presence: true
validates :blog_id, presence: true
validates :blog_commont_id, presence: true
validates :blog_message_type, presence: true
after_create :add_user_message
def add_user_message
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
end
end

View File

@ -16,7 +16,7 @@ class Contest < ActiveRecord::Base
has_many :contestant_work_projects, :dependent => :destroy
has_many :boards, :dependent => :destroy, :order => "position ASC"
has_many :files
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :news, :dependent => :destroy, :include => :author
@ -131,4 +131,16 @@ class Contest < ActiveRecord::Base
logger.error "[Contest Model] ===> Auto create board when contest saved, because #{@board.full_messages}"
end
end
# 新增竞赛留言
def self.add_new_jour(user, notes, id, options={})
contest = Contest.find(id)
if options.count == 0
pjfm = contest.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
else
pjfm = contest.journals_for_messages.build(options)
end
pjfm.save
pjfm
end
end

View File

@ -76,7 +76,7 @@ class JournalsForMessage < ActiveRecord::Base
has_one :praise_tread_cache, as: :object, dependent: :destroy
validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_course_activity, :act_as_course_message,
after_create :act_as_course_activity, :act_as_course_message, :act_as_contest_activity,
act_as_at_message(:notes, :user_id), :act_as_user_feedback_message,
:act_as_principal_activity
# after_create :reset_counters!
@ -222,6 +222,13 @@ class JournalsForMessage < ActiveRecord::Base
end
end
#竞赛动态公共表记录
def act_as_contest_activity
if self.jour_type == 'Contest' && self.m_parent_id.nil?
self.contest_acts << ContestActivity.new(:user_id => self.user_id,:contest_id => self.jour_id)
end
end
# 课程/作品回复 留言消息通知
def act_as_course_message
if self.jour_type == 'StudentWorksScore'

View File

@ -1,5 +1,6 @@
class MessageAll < ActiveRecord::Base
attr_accessible :message_id, :message_type, :user_id
belongs_to :user
# 虚拟关联---项目消息表/课程消息表/用户留言消息表/贴吧消息表
belongs_to :message ,:polymorphic => true
end

View File

@ -1,6 +1,6 @@
class PullRequest < ActiveRecord::Base
# status 1创建 2接受 3重新打开 4关闭
attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title
attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title, :status
validates_uniqueness_of :pull_request_id
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy

View File

@ -2,7 +2,7 @@
class StudentWorksScore < ActiveRecord::Base
#reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
#appeal_status: 0正常1申诉中2撤销申诉3申诉成功4申诉被拒绝
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role, :is_hidden
belongs_to :user
belongs_to :student_work

View File

@ -1,3 +1,4 @@
#encoding: utf-8
class StudentsForCourse < ActiveRecord::Base
attr_accessible :course_id, :student_id
@ -9,7 +10,7 @@ class StudentsForCourse < ActiveRecord::Base
validates_uniqueness_of :student_id, :scope => :course_id
after_destroy :delete_student_works
after_create :recovery_student_works
after_create :recovery_student_works, :create_student_works
#退出班级或删除学生时隐藏学生的作品
def delete_student_works
@ -26,4 +27,14 @@ class StudentsForCourse < ActiveRecord::Base
student_works = StudentWork.where("user_id = #{self.student_id} && homework_common_id in #{homework_ids}")
student_works.update_all(:is_delete => 0)
end
#加入班级时创建已发布作业的作品
def create_student_works
course = self.course
course.homework_commons.each do |hw|
if hw.homework_type != 3 && hw.student_works.where("user_id = #{self.student_id}").count == 0
hw.student_works << StudentWork.new(:user_id => self.student_id, :name => hw.name.to_s+"的作品提交", :work_status => 0)
end
end
end
end

View File

@ -407,7 +407,8 @@ class User < Principal
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
applied_count = AppliedMessage.where("user_id=? and viewed =? and created_at >?", user.id, 0, onclick_time).count
messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count
blog_message_count = BlogMessage.where("user_id=? and viewed=? and created_at >?", user.id, 0, onclick_time).count
messages_count = course_count + contest_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count + applied_count + blog_message_count
end
# 查询指派给我的缺陷记录

View File

@ -72,7 +72,7 @@ module ZipService
digests = []
homework_common.contestant_works.each do |work|
unless work.attachments.empty?
out_file = zip_student_work_by_user(work)
out_file = zip_contestant_work_by_user(work)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
@ -151,7 +151,7 @@ module ZipService
end
def zip_student_work_by_user(work)
def zip_contestant_work_by_user(work)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
@ -169,13 +169,13 @@ module ZipService
#单个文件的话,不需要压缩,只改名
out_file = nil
if homeworks_attach_path.size == 1
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
out_file = find_or_pack(work.work_id, work.user_id, digests.sort){
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
FileUtils.cp homeworks_attach_path.first, des_path
des_path
}
else
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
out_file = find_or_pack(work.work_id, work.user_id, digests.sort){
zipping("#{make_zip_name(work)}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}

View File

@ -0,0 +1,88 @@
<h3>
<%=l(:label_contest_plural)%>
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
竞赛:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '竞赛名称' %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'contests'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 40px;">
序号
</th>
<th style="width: 180px;">
竞赛
</th>
<th style="width: 40px;">
公开
</th>
<th style="width: 80px;">
创建者
</th>
<th style="width: 40px;">
成员数
</th>
<th style="width: 40px;">
提交数
</th>
<th style="width: 80px;">
创建于
</th>
<th style="width: 130px;">
最新动态时间
</th>
</tr>
</thead>
<tbody>
<% @contests.each do |contest| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= contest.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=contest.name%>'>
<span>
<%= link_to contest.name, contest_path(contest), :target => '_blank' %>
</span>
</td>
<td align="center">
<%= checked_image contest.is_public %>
</td>
<td style="text-align: center; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=contest.user.show_name%>'>
<span>
<%= link_to contest.user.show_name, user_path(contest.user), :target => '_blank' %>
</span>
</td>
<td align="center">
<%=contest.contest_members.count %>
</td>
<td align="center">
<%=contest.works.count %>
</td>
<td align="center">
<%= format_date(contest.created_at) %>
</td>
<td align="center">
<%= contest.contest_acts.order("updated_at asc").last.updated_at.strftime('%Y-%m-%d %H:%M:%S') %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_project_plural)) -%>

View File

@ -1,12 +1,17 @@
<div id="popbox02">
<div class="ni_con">
<div><p align='center' style='margin-top: 35px'>您已提交过作品,请不要重复提交,如果想修改作品请点击编辑。</p></div>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">提示</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div><p align='center' style='margin-top: 30px'>您已提交过作品,请不要重复提交,如果想修改作品请点击编辑。</p></div>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
<a href="javascript:" class="fr sy_btn_blue mr30" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
编&nbsp;&nbsp;辑
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 15px;margin-top:15px;" >
<a href="javascript:" class="fr sy_btn_grey mr5" onclick="clickCanel();" style="margin-bottom: 15px;margin-top:15px;" >
取&nbsp;&nbsp;消
</a>
</div>

View File

@ -1,39 +1,49 @@
<div id="popbox02">
<div class="ni_con">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5 break_word">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red"><%= "无附件"%></span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">作品确认</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20" style="color:#808181;">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5 break_word">
<span class="fb">作品名称:</span><%= @student_work.name %>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 330px;"><%= @student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red">无附件</span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment, i| %>
<div id="attachment_<%= attachment.id %>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
</p>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px; margin-left: 55px;" >
<a href="javascript:" class="sy_btn_blue" onclick="clickOK();" style="margin-left: 55px;">
确&nbsp;&nbsp;定
</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -1,40 +1,50 @@
<div id="popbox02">
<div class="ni_con">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5 break_word">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div id="worksDescription" class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red"><%= "无附件"%></span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">作品确认</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20" style="color:#808181;">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5 break_word">
<span class="fb">作品名称:</span><%= @student_work.name %>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div id="worksDescription" class="upload_img fl" style="max-width: 330px;"><%= @student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red"><%= "无附件" %></span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment, i| %>
<div id="attachment_<%= attachment.id %>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
</p>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
<a href="javascript:" class="fr sy_btn_blue mr45" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;">
确&nbsp;定
</a>
<%= link_to("重 试", retry_work_contestant_work_path(@student_work.id),:class => "tijiao",:style =>"margin-bottom: 15px;margin-top:15px;",:remote => true)%>
</div>
<%= link_to("重 试", retry_work_contestant_work_path(@student_work.id), :class => "fr sy_btn_blue mr5", :style => "margin-bottom: 15px;margin-top:15px;", :remote => true) %>
</div>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -1,21 +1,12 @@
hideModal();
<% if @has_commit %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'has_commit_work') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
var htmlvalue = '<%= escape_javascript(render :partial => 'contestant_works/has_commit_work') %>';
pop_box_new(htmlvalue, 500, 163);
<% elsif @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'work_information') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='/student_work/"+ <%=@student_work.id%> +"/retry_work' class='upload_btn' data-remote='true'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
var htmlvalue = '<%= escape_javascript(render :partial => 'contestant_works/work_information') %>';
pop_box_new(htmlvalue, 500, 400);
<% else %>
window.location.href = '<%= new_contestant_work_path(:work => @contestwork.id)%>';
window.location.href = '<%= new_contestant_work_path(:work => @contestwork.id)%>';
<% end %>
function clickCanel() {

View File

@ -37,51 +37,6 @@
$("#relatePWrap_<%=@contestwork.id %>").toggleClass('relatePWrap');
$("#moreProject_<%=@contestwork.id %>").show();
});
// 匿评弹框提示
<%# if @is_evaluation && !@stundet_works.empty?%>
// $(function(){
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/praise_alert') %>');
// showModal('ajax-modal', '500px');
// $('#ajax-modal').siblings().remove();
// $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
// "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
// $('#ajax-modal').parent().css("top","").css("left","");
// $('#ajax-modal').parent().addClass("anonymos");
// });
<%# end%>
// function set_score_rule_submit() {
// if($("#late_penalty_num").val() == ""){
// $("#late_penalty_num").val("0");
// }
// if($("#absence_penalty_num").val() == ""){
// $("#absence_penalty_num").val("0");
// }
// $('#muban_popup_box').find('form').submit();
// hideModal();
// }
// //设置评分规则
// function set_score_rule(){
<!--<%# if @homework.homework_type == 2 %>-->
<!--<%# if @homework.anonymous_comment == 0 %>-->
// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>";
// pop_box_new(htmlvalue, 570, 355);
<!--<%# else %>-->
// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>";
// pop_box_new(htmlvalue, 500, 285);
<!--<%# end %>-->
<!--<%# else %>-->
<!--<%# if @homework.anonymous_comment == 0 %>-->
// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>";
// pop_box_new(htmlvalue, 500, 325);
<!--<%# else %>-->
// var htmlvalue = "<%#= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => true, :user_activity_id => -1,:hw_status => 5}) %>";
// pop_box_new(htmlvalue, 500, 225);
<!--<%# end %>-->
<!--<%# end %>-->
// }
</script>
<div class="homepageRight mt0 ml10">
@ -116,28 +71,29 @@
<!---menu_r end--->
</div>
<!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
<%# if @is_teacher%>
<!--<div class="fr mt5">-->
<!--<ul class="">-->
<!--<li class="pr export_icon_li">-->
<!--<a href="javascript:void(0);" class="export_icon linkBlue2">导出</a>-->
<!--<ul class="hworkMenu" style="top: 30px; left: -100px;">-->
<!--&lt;!&ndash;<li>&ndash;&gt;-->
<!--&lt;!&ndash;<%#= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>&ndash;&gt;-->
<!--&lt;!&ndash;</li>&ndash;&gt;-->
<!--<li>-->
<!--<%# if @contestwork.contestant_works.empty?%>-->
<!--<%#= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>-->
<!--<%# else%>-->
<!--<%#= link_to "导出作业附件", zipdown_assort_path(obj_class: @contestwork.class, obj_id: @contestwork, format: :json),-->
<!--remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %>-->
<!--<%# end%>-->
<!--</li>-->
<!--</ul>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<%# end%>
<% if @is_teacher%>
<div class="fr mt5">
<ul class="">
<li class="pr export_icon_li">
<a href="javascript:void(0);" class="export_icon linkBlue2">导出</a>
<ul class="hworkMenu" style="top: 30px; left: -100px;">
<li>
<%= link_to "导出提交成绩", contestant_works_path(:work => @contestwork.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
</li>
<li>
<% if @contestwork.contestant_works.has_committed.empty?%>
<a href="javascript:void(0)" class="hworkExport resourcesGrey" onclick="notice_box('没有学生提交作业,无法下载附件')">导出作业附件</a>
<%#= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "导出作业附件", zipdown_assort_path(obj_class: @contestwork.class, obj_id: @contestwork, format: :json),
remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %>
<% end%>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
<div class="cl"></div>
</div>

View File

@ -21,28 +21,6 @@
});
<% end %>
// //快速创建项目的弹框
// function new_project(){
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/new_project') %>');
// showModal('ajax-modal', '800px');
// $('#ajax-modal').siblings().remove();
// $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
// "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
// $('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed").css("border","3px solid #269ac9");
// }
// // 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
// function store_seleted_resource(dom){
// if(dom.attr('checked') == 'checked' ){
// $.get(
// '<%#= store_selected_resource_user_path(User.current) %>'+'?save=y&res_id='+dom.val()
// )
// }else {
// $.get(
// '<%#= store_selected_resource_user_path(User.current) %>'+'?save=n&res_id='+dom.val()
// )
// }
// }
// 添加组成员
function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'choose_group_member',:locals => {:homework=>@contestwork}) %>');

View File

@ -1,11 +1,7 @@
hideModal();
<% if @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'work_edit_information') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
var htmlvalue = '<%= escape_javascript(render :partial => 'contestant_works/work_edit_information') %>';
pop_box_new(htmlvalue, 500, 400);
<% else %>
window.location.href = '<%= edit_contestant_work_path(@work)%>';
<% end %>

View File

@ -47,7 +47,7 @@
<% when 'Poll' %>
<%#= render :partial => 'users/contest_poll', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
<% when 'JournalsForMessage' %>
<%#= render :partial => 'users/contest_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
<%= render :partial => 'users/contest_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id, :is_contest => 1} %>
<% when 'Attachment' %>
<%#= render :partial => 'users/contest_attachment', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% when 'Contest' %>

View File

@ -0,0 +1,19 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<%#= javascript_include_tag "init_KindEditor","user" %>
<% end %>
<%if jours %>
<% jours.each do |jour|%>
<script type="text/javascript">
$(function(){
sd_create_editor_from_data(<%= jour.id%>, null, "100%", "<%=jour.class.to_s%>");
});
</script>
<%= render :partial => 'users/contest_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id, :is_contest => 1} %>
<%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %>
<%end%>
<% end%>
<% if (jours.count + page * 10) < count %>
<%= link_to "点击展开更多",feedback_contest_path(@contest.id, :page => page),:id => "show_more_jours",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>

View File

@ -2,7 +2,8 @@
<thead>
<tr>
<th style="width: 35px;">序号</th>
<th style="width:320px;">姓名</th>
<th style="width:180px;">姓名</th>
<th style="width:140px;">单位</th>
<th>角色</th>
<th class="sy_new_namebox">操作</th>
</tr>
@ -12,7 +13,10 @@
<tr>
<td><%= index + 1 %></td>
<td>
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname ml10", :title => "#{member.user.show_name}" %>
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname ml10 mr10", :title => "#{member.user.show_name}" %>
</td>
<td>
<span class="pro_new_school_name ml5 mr5"><%=member.user.user_extensions.school ? member.user.user_extensions.school.name : '--' %></span>
</td>
<td style="width: 200px">
<span id="member_role_<%=member.id %>"><%= zh_contest_role(h member.roles.sort.collect(&:to_s).join(', ')) %></span>

View File

@ -2,7 +2,7 @@
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><%= link_to !@contest.is_public ? "设为公开" : "设为私有", {:controller => 'contests', :action => 'private_or_public', :id => @contest},:remote=>true,:confirm=>"您确定要设置为"+(!@contest.is_public ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
<li><a href="javascript:void(0);" class="postOptionLink" onclick="delete_confirm_box('<%=private_or_public_contest_path(@contest) %>', '您确定要设置为<%= !@contest.is_public ? '公开' : '私有'%>吗')"><%= !@contest.is_public ? '设为公开' : '设为私有'%></a></li>
<% if @contest.invite_code_halt == 0 %>
<li><a href="javascript:void(0);" class="postOptionLink" onclick="alert_halt_code();">暂停加入</a></li>
<% elsif @contest.invite_code_halt == 1 %>

View File

@ -1,5 +1,6 @@
<div class="pro_new_setting_conbox fl " style="width:100%; border:none;">
<a href="javascript:void(0);" class="fl sy_btn_green mb10 ml15" onclick="add_contest_member();">添加成员</a>
<a href="javascript:void(0);" class="fl sy_btn_green mb10 ml15" onclick="add_contest_member();">添加成员</a>
<%= link_to "Excel导出", export_all_members_contest_path(@contest, :format => 'xls'), :class => 'fl sy_btn_green mb10 ml15' %>
<div class="cl"></div>
<div class=" sy_new_tchbox clear undis" style="margin-left:10px; margin-right:10px" id="add_contest_member">
<%= form_tag url_for(:controller => 'contest_members', :action => 'create', :contest => @contest.id),:id => 'contest_member_add_form', :remote => true do |f|%>

View File

@ -12,7 +12,7 @@
<li><%= link_to "通知动态", contest_activities_contest_path(@contest, :type => 'news'), :class => "homepagePostTypeNotice postTypeGrey"%></li>
<!--<li><%#= link_to "资源库动态", {:controller => "courses", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey"%></li>-->
<li><%= link_to "论坛动态", contest_activities_contest_path(@contest, :type => 'message'), :class => "homepagePostTypeForum postTypeGrey"%></li>
<!--<li><%#= link_to "留言动态", {:controller => "courses", :action => "show", :type => "journalsForMessage"}, :class => "homepagePostTypeMessage postTypeGrey"%></li>-->
<li><%= link_to "留言动态", contest_activities_contest_path(@contest, :type => 'journalsForMessage'), :class => "homepagePostTypeMessage postTypeGrey"%></li>
<!--<li><%#= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%></li>-->
</ul>
</li>

View File

@ -0,0 +1,28 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner mb10">
<div class="NewsBannerName pr"><span id="mesLabel">竞赛留言</span></div>
</div>
<div class="cl"></div>
<div id="messageContent">
<div class="resources"><%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %>
<div class="fl" style="width:658px;">
<%= form_for('new_form',:url => leave_contest_message_path(@contest.id), :html =>{:id => "contest_feedback_new"}, :method => "post") do |f|%>
<%= render :partial => "users/jour_form", :locals => {:f => f, :object => @contest} %>
<input id="private_flag" name="private" type="hidden" value="0"/>
<a href="javascript:void(0);" class="blue_n_btn fr mt5" id="submit_feedback_user" >留言</a>
<a href="javascript:void(0);" onclick="cancel_jour_submit()" class="greyBtn2 postReplySubmit mt5 mr15">取消</a>
<% end %>
</div>
</div>
<%=render :partial => "contest_jours_list", :locals => {:jours =>@jours, :page => 0, :count => @jour_count} %>
<div class="cl"></div>
</div><!--message_box end-->
</div>
<script type="text/javascript">
$(function(){
$("#submit_feedback_user").one('click',function() {
contest_jour_submit();
});
});
</script>

View File

@ -0,0 +1 @@
$("#show_more_jours").replaceWith("<%= escape_javascript( render :partial => 'contests/contest_jours_list',:locals => {:jours => @jours, :page => @page, :count => @jour_count} )%>");

View File

@ -6,7 +6,7 @@
<%= labelled_form_for @contest do |f| %>
<li class="mt10 ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_contest_name)%>&nbsp;&nbsp;</label>
<input type="text" name="contest[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:顶尖移动应用开发大赛" onkeyup="regex_contest_name('new');">
<input type="text" name="contest[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:全国大学生软件创新大赛" onkeyup="regex_contest_name('new');">
<div class="cl"></div>
<span class="c_red ml80" id="new_course_name_notice" style="display: none;">竞赛名称不能为空且至少有两个字符</span>
</li>

View File

@ -1,3 +1,4 @@
hideModal();
$("#contest_base_info").html('<%=escape_javascript(render :partial=>'contests/contest_base_info') %>');
if(document.getElementById("contest_is_public")) {
<% if !@contest.is_public %>

View File

@ -1,21 +1,31 @@
<div class="f14 fb fontGrey3 mb10">选择成员加入分班</div>
<div class="fl mr10">
<input type="text" name="search" value="<%=@search %>" placeholder="输入学生登录名/姓名/学号进行搜索" class="subjectSearch" />
<div class="cl"></div>
<%= form_tag(add_members_course_path(@course, :group_id => @group.id), method: 'post',:class => "f_l",:id => "add_group_members") do %>
<div id="search_member_list">
<%=render :partial => 'search_member_list', :locals => {:members => members} %>
</div>
<% end %>
<div class="cl"></div>
<span class="c_red none" id="add_members_notice"></span>
<div class="cl"></div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="submit_add_members_form();">确定</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
<div id="muban_popup_box" style="width:400px;">
<div class="muban_popup_top">
<h3 class="fl">添加成员</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div class="muban_popup_con clear">
<div class="f14 fb fontGrey3 mb10 mt15 ml20">选择成员加入分班</div>
<div class="fl mr10 ml20 w350">
<input type="text" name="search" value="<%=@search %>" placeholder="输入学生登录名/姓名/学号进行搜索" class="subjectSearch" />
<div class="cl"></div>
<%= form_tag(add_members_course_path(@course, :group_id => @group.id), method: 'post',:class => "",:id => "add_group_members") do %>
<div id="search_member_list">
<%=render :partial => 'search_member_list', :locals => {:members => members} %>
</div>
<% end %>
<div class="cl"></div>
<span class="c_red none" id="add_members_notice"></span>
<div class="cl"></div>
<div class="mt10">
<a href="javascript:void(0);" class="fl sy_btn_blue mr10" onclick="submit_add_members_form();">确定</a>
<a href="javascript:void(0);" class="fl sy_btn_grey" onclick="hideModal();">取消</a>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<script>
var lastSearchCondition = '';
var count = 0;

View File

@ -2,5 +2,5 @@
<% if User.current.allowed_to?(:as_teacher,@course) %>
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'link-blue ml10 fr mt5' %>
<% end %>
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0),:format => 'xls'), :class => 'link-blue fr mt5'%>
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :name => @search_name,:format => 'xls'), :class => 'link-blue fr mt5'%>
<div class="cl"></div>

View File

@ -5,7 +5,7 @@
<li>
<span class="sy_sq_orange fl mr5 mt5"><%= i+1 %></span>
<div class="fl" style="width:185px;">
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10" %>
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10", :target => '_blank' %>
</div>
<div class="cl"></div>
<p class="sy_cgrey ml20">

View File

@ -74,7 +74,7 @@ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muba
pop_box_new(htmlvalue, 300, 140);
<% elsif @state == 14 %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">此二维码已停用,请与老师联系</p><div class="cl"></div>'+
'<div class="clear mt15"><p class="text_c f14">此邀请码已停用,请与老师联系</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% else %>

View File

@ -11,11 +11,15 @@
window.location.href = "<%=course_files_path(@course) %>";
}
<% else %>
<% if @course.is_public? %>
if($("#syllabus_course_ul_<%=@syllabus.id %>").length > 0){
window.location.href = "<%= user_courselist_user_path(User.current)%>";
} else{
<% if @course.is_public? %>
$("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% else %>
<% else %>
$("#show_course_<%= @course.id %>").attr("title","私有班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% end %>
$("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
<% end %>
$("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
:id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');
}
<% end %>

View File

@ -1,6 +1,6 @@
<% if @is_search == 0 %>
var htmlvalue = "<%= escape_javascript( render :partial => 'courses/add_members', :locals => {:members => @members} )%>";
pop_up_box(htmlvalue,400,30,50);
pop_box_new(htmlvalue,400,510);
<% else %>
$("#search_member_list").html("<%= escape_javascript(render :partial => 'search_member_list', :locals => {:members => @members}) %>");
<% end %>

View File

@ -3,4 +3,5 @@
*/
$('#new_group_name').hide();
$('#edit_group_form').hide();
$("#course_member_opr").html("<%= escape_javascript( render :partial => 'course_member_opr')%>");
$("#member_content").html("<%= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");

View File

@ -2,14 +2,19 @@
<div class="fl mr10"><%= link_to image_tag(url_to_avatar(User.current), :width => 50, :height => 50,:alt=>'贴吧图像' ), user_path( User.current) %></div>
<div class="fl">
<div class="f16 fontGrey2 ml38">我在问吧</div>
<div class="homepageImageBlock" style="width: 68px !important;">
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_memos_count %></a></div>
<div class="homepageImageText">回答</div>
<div class="homepageImageBlock" style="width: 75px !important;">
<!--<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%#= @my_memos_count %></a></div>-->
<div class="mt10">
<div class="homepageImageText fl ml10">回答</div>
<div><a href="javascript:void(0);" class="homepageImageNumber fl ml10" style="cursor: default;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%= @my_memos_count %>"><%= @my_memos_count %></a></div>
</div>
</div>
<div class="homepageVerDiv"></div>
<div class="homepageImageBlock" style="width: 68px !important;">
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_forums_count %></a></div>
<div class="homepageImageText">发帖</div>
<!-- <div class="homepageVerDiv"></div>-->
<div class="homepageImageBlock" style="width: 70px !important;">
<div class="mt10">
<div class="homepageImageText fl ml10">发帖</div>
<div><a href="javascript:void(0);" class="homepageImageNumber fl ml10" style="width:26px;cursor:default; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%= @my_forums_count %>"><%= @my_forums_count %></a></div>
</div>
</div>
</div>
<div class="cl"></div>

View File

@ -1,14 +1,9 @@
<% @forums.each_with_index do |forum, i| %>
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px"><%= link_to forum.name, forum_path(forum), :class => "", :target => "_blank" %></h4>
<ul class=" fl right-line wenba-rightbar-ul" >
<li><%= link_to forum.memo_count, forum_path(forum), :class => "linkGrey5" %></li>
<li>回答</li>
</ul>
<ul class=" fl wenba-rightbar-ul" >
<li><%= link_to forum.topic_count, forum_path(forum), :class => "linkGrey5" %></li>
<li>帖子</li>
</ul>
<% @forums.each_with_index do |forum, i| %>
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px;font-weight: normal;"><%= link_to forum.name, forum_path(forum), :style => "color:#666;", :target => "_blank" %></h4>
<div style="width: 40px; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" class="mt5 mr10 fr" title="回答数+帖子数">
<%= link_to forum.topic_count + forum.memo_count, forum_path(forum), :class => "fontGrey4", :style => "font-size: 10px;" %>
</div>
<% end %>
</div>
<% end %>

View File

@ -33,9 +33,10 @@
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
<% replies_count = Memo.where("root_id = #{topic.id}").count %>
<%= link_to (replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
<% if get_praise_num(topic) > 0 %>
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
<% end %>
</div>
<div class="postDetailDes maxh300" id = "postDetailDes_<%= topic.id %>">
<div id="intro_content_<%= topic.id %>">
<%= topic.content.html_safe%>

View File

@ -9,7 +9,7 @@
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class=""></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
<div class="creatPost" id="create_memo_btn">
<%= link_to "发布新帖",new_forum_memo_path(:forum_id => Forum.first.id), :class => "c_white db creatPostIcon bBlue" %>
<%= link_to "发布新帖",new_forum_memo_path(:forum_id => Forum.first.id), :class => "c_white db creatPostIcon bGreen" %>
</div>
<div class="cl"></div>
</div>
@ -23,7 +23,7 @@
<div class="wenba-rightbar fr">
<div class="wenba-rightbar-top clearfix">
<h3 class="fl ml10">问吧</h3>
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue btn fr mt5 mr5", :remote => true %>
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue forum_btn fr mt7 mr5", :remote => true %>
</div>
<div id="forums_right_list">
<%= render :partial => "forums/right_bar" %>

View File

@ -20,9 +20,9 @@
}
function cancel_edit(){
<% if @is_manage.to_i == 1 %>
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
window.location.href='<%=user_manage_homeworks_user_path(User.current.id) %>';
<% elsif @is_manage.to_i == 2 %>
window.location.href='<%=my_homeworks_user_path(User.current.id) %>';
window.location.href='<%=user_receive_homeworks_user_path(User.current.id) %>';
<% elsif @hw_status == 3 %>
window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
<% elsif @hw_status == 1 %>

View File

@ -1,7 +1,7 @@
<% if @homework.homework_type == 2 %>
<% if @homework.anonymous_comment == 0 %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 630, 758);
pop_box_new(htmlvalue, 630, 914);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 530, 404);
@ -9,7 +9,7 @@
<% else %>
<% if @homework.anonymous_comment == 0 %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 630, 758);
pop_box_new(htmlvalue, 630, 885);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
pop_box_new(htmlvalue, 530, 332);

View File

@ -58,11 +58,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<% if hidden_unproject_infos %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子" />
<% else %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的项目、用户、资源以及帖子" />
<% end %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索" style="width: 300px" />
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
@ -98,13 +94,14 @@
</div>
<div class="navHomepageNews" id="user_messages">
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target => "_Blank", :title => "您的所有消息" %>
<% if User.current.count_new_message.to_i > 0 %>
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target => "_Blank" %></div>
<%= link_to "", user_path(User.current), :class => "homepageNewsIcon", :target => "_Blank", :title => "您的所有消息" %>
<% new_message_count = User.current.count_new_message.to_i %>
<% if new_message_count > 0 %>
<div ><%= link_to new_message_count, user_path(User.current), :class => "newsActive", :target => "_Blank" %></div>
<% end %>
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
<div class="shadowbox_news undis" id="user_messages_list">
<%=render :partial => 'layouts/message_loading' %>
<%= render :partial => 'layouts/message_loading' %>
</div>
</div>
</div>

View File

@ -83,8 +83,7 @@
<% content = User.find(ma.course_message_id).name+"申请成为班级\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "教辅"}" %>
<li><a href="<%=user_path(User.find(ma.course_message_id), :course_id => ma.course_id) %>" target="_blank" title="系统提示 您有了新的班级成员申请:<%=content %>"><span class="shadowbox_news_user">系统提示 </span>您有了新的班级成员申请:<%=content %></a></li>
<% elsif ma.course_message_type == "CourseRequestDealResult" %>
<% content = ma.status == 1 ? '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' : '您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content && ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝' %>
<li><a href="<%=course_path(Course.find(ma.course_id)) %>" target="_blank" title="系统提示 班级申请进度反馈:<%=content %>"><span class="shadowbox_news_user">系统提示 </span>班级申请进度反馈:<%=content %></a></li>
<li><a href="<%=course_path(Course.find(ma.course_id)) %>" target="_blank" title="<%= User.find(ma.user_id).show_name%> 申请以“<%= ma.content.include?('9') ? '教师' : '教辅' %>”身份加入:<%=Course.find(ma.course_id).name %> <%=User.find(ma.course_message_id).show_name%><%=ma.status == 1 ? '已通过' : '已拒绝' %>"><span class="shadowbox_news_user"><%= User.find(ma.user_id).show_name%> </span>申请以“<%= ma.content.include?('9') ? '教师' : '教辅' %>”身份加入:<%=Course.find(ma.course_id).name %> <%=User.find(ma.course_message_id).show_name%><%=ma.status == 1 ? '已通过' : '已拒绝' %></a></li>
<% elsif ma.course_message_type == "JoinCourse" and ma.status == 0 %>
<li><a href="<%=course_member_path(ma.course) %>" target="_blank" title="<%=User.find(ma.course_message_id).show_name %> 将您加入了班级:<%=ma.course.name %>"><span class="shadowbox_news_user"><%=User.find(ma.course_message_id).show_name %> </span>将您加入了班级:<%=ma.course.name %></a></li>
<% elsif ma.course_message_type == "JoinCourse" and ma.status == 1 %>
@ -120,6 +119,7 @@
<li><a href="<%= contest_feedback_path(ma.contest_id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> <%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%></a></li>
<% end %>
<% elsif ma.contest_message_type == "ContestRequestDealResult" %>
<% user = User.find(ma.user_id) %>
<% if ma.content
role_str = ""
if ma.content.include?('13') && ma.content.include?('14')
@ -132,7 +132,7 @@
role_str = "参赛者"
end
end %>
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='系统提示 竞赛申请进度反馈:您申请成为竞赛"<%=Contest.find(ma.contest_id).name %>"的"<%=role_str %>"<%= ma.status == 1 ? "申请已通过" : "的申请被拒绝"%>'><span class="shadowbox_news_user">系统提示 </span>竞赛申请进度反馈:您申请成为竞赛"<%=Contest.find(ma.contest_id).name %>"的"<%=role_str %>"<%= ma.status == 1 ? "申请已通过" : "的申请被拒绝"%></a></li>
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"" %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"" %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 0 %>
<li><a href="<%=contest_path(ma.contest) %>" target="_blank" title="<%=User.find(ma.contest_message_id).show_name %> 将您加入了竞赛:<%= ma.contest.name%>"><span class="shadowbox_news_user"><%=User.find(ma.contest_message_id).show_name %> </span>将您加入了竞赛:<%= ma.contest.name%></a></li>
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
@ -202,11 +202,17 @@
<li><a href="<%=news_path(ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>发布了新闻:<%= ma.forge_message.title.html_safe%></a></li>
<% elsif ma.forge_message_type == "Comment" %>
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
<%# elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
<%# send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
<%# author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
<!-- <li><a href="<%#= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%#= User.find(author.id).show_name %> <%#= pull_request_message_status(ma) %> <%#= send_message_user[0].title %>"><span class="shadowbox_news_user"><%#= User.find(author.id).show_name %> </span><%#= pull_request_message_status(ma) %> <%#= send_message_user[0].title %></a></li>-->
<% elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
<% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
<% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
<li><a href="<%= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%= User.find(author.id).show_name %> <%= pull_request_message_status(ma) %> <%= send_message_user[0].title %>"><span class="shadowbox_news_user"><%= User.find(author.id).show_name %> </span><%= pull_request_message_status(ma) %> <%= send_message_user[0].title %></a></li>
<% end %>
<% elsif ma.class == BlogMessage %>
<% if ma.blog_message_type == "BlogComment" %>
<% user_id = User.find(BlogComment.find(ma.blog_commont_id).blog.author_id) %>
<% blog_id = BlogComment.find(ma.blog_commont_id).root_id %>
<li><a href="<%= user_blog_blog_comment_path(:user_id => user_id, :blog_id => ma.blog_id, :id => blog_id) %>" target="_blank" title="<%= User.find(ma.user_operator_id).show_name %> 回复了博客:<%= message_content(ma.content) %>"><span class="shadowbox_news_user"><%= User.find(ma.user_operator_id).show_name %> </span>回复了博客:<%= message_content(ma.content) %></a></li>
<% end %>
<% elsif ma.class == MemoMessage %>
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%></a></li>

View File

@ -71,7 +71,10 @@
<%= link_to "", contest_news_index_path(@contest,:is_new => 1), :class => "sy_class_add" %>
<% end %>
</li>
<!--<li id="sy_06" class="sy_icons_feedback"> <a href="">留言<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
<li id="sy_06" class="sy_icons_feedback">
<a href="<%= feedback_contest_path(@contest) %>">留言<span id="course_jour_count"><%=contest_feedback_count %></span></a>
<%= link_to( "", feedback_contest_path(@contest), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}") if User.current.member_of_contest?(@contest) %>
</li>
</ul>
</div><!--sy_class_leftnav end-->
</div><!--sy_class_l end-->

View File

@ -48,7 +48,7 @@
<% if hidden_unproject_infos %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
<%= link_to '班级',user_courselist_user_path(@user), :id => "user_course_list" %>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">

View File

@ -11,7 +11,7 @@
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup' ,:media => 'all'%>
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup', 'css/font-awesome', :media => 'all'%>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -9,7 +9,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/font-awesome' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>

View File

@ -37,27 +37,6 @@
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
});
// $(".homepagePostPortrait").mouseover(function(){
// onImage = true;
// $(this).children(".userCard").css("display","block");
// });
// $(".homepagePostPortrait").mouseout(function(){
// var cur = $(this);
// onImage = false;
// setTimeout(function(){
// if (onUserCard == false && onImage == false) {
// $(cur).children(".userCard").css("display","none");
// }
// },500);
// });
// $(".userCard").mouseover(function(){
// onUserCard = true;
// $(this).css("display","block");
// });
// $(".userCard").mouseout(function(){
// onUserCard = false;
// $(this).css("display","none");
// });
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})
@ -102,7 +81,7 @@
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10">
<% if User.current.logged? && User.current == @user%>
<% if User.current.logged? && User.current == @user %>
<div class="pr" style="width: 80px; margin:0 auto;">
<%= link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %>

View File

@ -1,7 +1,11 @@
<% if @project.is_public? %>
if($("#collect_project_icon_<%= @project.id %>").length > 0){
window.location.href = "<%= user_projectlist_user_path(User.current)%>";
} else {
<% if @project.is_public? %>
$("#show_project_<%= @project.id %>").attr("title","公开项目:<%= @project.name %>");
<% else %>
<% else %>
$("#show_project_<%= @project.id %>").attr("title","私有项目:<%= @project.name %>");
<% end %>
$("#set_project_public_<%= @project.id %>").replaceWith('<%= escape_javascript(link_to @project.is_public? ? "设为私有" : "设为公开", {:controller => "projects", :action => "set_public_or_private", :id => @project.id,:user_page => true},
:id => "set_project_public_"+ @project.id.to_s,:method => "post",:remote=>true,:confirm=>"您确定要设置为"+(@project.is_public? ? "私有" : "公开")+"吗") %>');
<% end %>
$("#set_project_public_<%= @project.id %>").replaceWith('<%= escape_javascript(link_to @project.is_public? ? "设为私有" : "设为公开", {:controller => "projects", :action => "set_public_or_private", :id => @project.id,:user_page => true},
:id => "set_project_public_"+ @project.id.to_s,:method => "post",:remote=>true,:confirm=>"您确定要设置为"+(@project.is_public? ? "私有" : "公开")+"吗") %>');
}

View File

@ -1,4 +1,5 @@
<%= javascript_include_tag 'highcharts','highcharts-more' %>
<%= render :partial => "header" %>
<div class="container-big mb10">

View File

@ -3,15 +3,13 @@
<% unless @path.blank? %>
<tbody>
<tr style="border: 1px solid #DDD; border-bottom:none;">
<td>
<a href="javascript:history.go(-1)" class="fl linkBlue2 mt3" >
<span class="new_roadmap_icons_back mr5"></span>
返回上级目录
</a>
<td colspan="4">
<!--<a href="javascript:history.go(-1)" class="fl linkBlue2 mt3" >-->
<!--<span class="new_roadmap_icons_back mr5"></span>-->
<!--<span></span>返回上级目录-->
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<!--</a>-->
</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
<% end %>

View File

@ -22,7 +22,7 @@
<% end %>
<%= link_to h(ent_name),
{:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev},
:class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
:class => (entry.is_dir? ? 'old-icon old-icon-folder' : "old-icon old-icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%>
</td>
<div id="children_tree">
<td class="tree-author c_grey">

View File

@ -1,25 +1,11 @@
<div class="recordBanner mt3">
<% if @changesets_latest_coimmit %>
<% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150 ml5"><%=link_to get_user_by_mail(@changesets_latest_coimmit.author_email).show_name, user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %></div>
<div class="fl">提交于 <%= time_tag(@changesets_latest_coimmit.created_at) %> 前:</div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<% else %>
<span class="fl"><div class="fb fontGrey3 mr5 fl hidden maxwidth150 ml5"><%= @changesets_latest_coimmit.author_email %></div>
<div class="fl">提交于<%= time_tag(@changesets_latest_coimmit.created_at) %></div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.comments %>"><%= @changesets_latest_coimmit.message %></div>
</span>
<%end%>
<%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.try(:author_email))), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
<%= link_to_user_mail(@changesets_latest_coimmit.try(:author_email), "fb fontGrey3 mr5 fl hidden maxwidth150 ml5") %>
<div class="fl">提交于 <%= time_tag(@changesets_latest_coimmit.try(:time)) %> 前:</div>
<div class="commit_content_dec fl" title="<%= @changesets_latest_coimmit.message %>"><%= @changesets_latest_coimmit.message %></div>
<% end %>
<% if @entry && @entry.kind == 'file' %>
<%= render :partial => 'link_to_functions' %>
<% else %>
<span class="fr mr5 "><font class="fb ml2 mr2 vl_branch mt2"><%= @repository.branches.count %></font> 个分支</span>
<% end %>
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)} 提交", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
</span>
</div>

View File

@ -17,8 +17,9 @@
{:method => :get, :id => 'revision_selector'}) do -%>
<!-- Branches Dropdown -->
<% if !@repository.branches.nil? && @repository.branches.length > 0 -%>
<%= l(:label_branch) %>:
<%= select_tag :branch, options_for_select(@repository.branches, @rev), :id => 'branch' %>
<label class="pro-fenzhi-label fl">分支</label>
<%= select_tag :branch, options_for_select(@repository.branches, @rev), :id => 'branch', :class => "pro-fenzhi-select fl" %>
<% end -%>
<%# if !@repository.tags.nil? && @repository.tags.length > 0 -%>

View File

@ -1,8 +1,5 @@
<%#= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
<div class="wrap-big">
<div class="project_r_h">
<%= render :partial => "top" %>
</div>
<div class="repository_con" style="line-height:1.9;">
<% if @entries.nil? %>
<%# 未提交代码提示 %>
@ -20,33 +17,43 @@
<div class="cl"></div>
</div>
<% else %>
<%= render :partial => 'navigation' %>
<div class="fl c_grey02 mt5 mr5">克隆网址:</div>
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%= @repos_url.to_s.lstrip %></textarea>
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
<!--quality_analysis-->
<% unless @entries.nil? %>
<a href="<%= @zip_path %>" class="btn_zipdown fr" onclick="">ZIP下载</a>
<% if User.current.member_of?(@project) && @project.is_public? %>
<% if quality_analysis(User.current.try(:login), @repository.id).nil? %>
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fr" %>
<% else %>
<%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fr" %>
<% end %>
<% end %>
<% end %>
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fr" %>
<% end %>
<ul class="clearfix pro-top-info mb10">
<li><i class="icon-time mr5 c_grey02 f16 fb"></i>
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}",
{:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param,
:rev => @rev, :page => 1 ,:commit_count =>"#{@changesets_all_count}"}, :class => "linkBlue fb" %> 提交
</li>
<li><i class="icon-sitemap mr5 c_grey02 f16 fb"></i>
<a class="linkBlue fb "><%= @repository.branches.count %></a>分支
</li>
<li><i class="icon-bar-chart mr5 c_grey02 f16 fb"></i>
<%=link_to "贡献统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev,
:creator => @creator, :default_branch => @g_default_branch ) %>
</li>
</ul>
<div class=" clearfix mb5">
<div class=" fl clearfix">
<%= render :partial => 'navigation' %>
</div>
<a href="<%= @zip_path %>" class="btn_zipdown fl ml10" onclick="">ZIP下载</a>
<% if User.current.member_of?(@project) && @project.is_public? %>
<% if quality_analysis(User.current.try(:login), @repository.id).nil? %>
<%= link_to "质量分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "1"), :remote => true, :class => "btn_zipdown fl ml10" %>
<% else %>
<%= link_to "重新分析", quality_analysis_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :default_branch => @g_default_branch, :type => "2"), :remote => true, :class => "btn_zipdown fl ml10" %>
<% end %>
<% end %>
<% unless QualityAnalysis.where(:project_id => @project.id).first.nil? %>
<%= link_to "代码分析结果", project_quality_analysis_path(:project_id => @project.id), :class => "btn_zipdown fl ml10" %>
<% end %>
<div class="fl mt5 ml15">
<%=link_to "代码统计", stats_repository_project_path(:id => @project.id, :repository_id => @repository.identifier, :rev => @rev, :creator => @creator, :default_branch => @g_default_branch ), :class => "fl vl_zip" %>
</div>
<div class="cl"></div>
<!--目录跳转-->
<div class="mt3">
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
<div class="fr ">
<label class="pro-fenzhi-label fl">克隆网址</label>
<input type="text" id="copy_rep_content" class="pro-fenzhi-input fl" value="<%= @repos_url.to_s.lstrip %>"/>
<a href="javascript:void(0);" alt="点击复制版本库地址" onclick="jsCopy()" title="点击复制版本库地址" class="fl pro-fenzhi-a"><i class="icon-copy"></i></a>
</div>
</div>
<div class="cl"></div>
<%= render :partial => 'latest_commit' %>
<div class="cl"></div>

View File

@ -1,16 +1,21 @@
<div id="popbox02">
<div class="ni_con">
<div><p align='center' style='margin-top: 35px'>您已提交过作品,请不要重复提交,如果想修改作品请点击编辑。</p></div>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">提示</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div><p align='center' style='margin-top: 30px'>您已提交过作品,请不要重复提交,如果想修改作品请点击编辑。</p></div>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
<a href="javascript:" class="fr sy_btn_blue mr30" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
编&nbsp;&nbsp;辑
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 15px;margin-top:15px;" >
<a href="javascript:" class="fr sy_btn_grey mr5" onclick="clickCanel();" style="margin-bottom: 15px;margin-top:15px;" >
取&nbsp;&nbsp;消
</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -13,6 +13,13 @@
<%= show_real_score ? score.score : "**" %>分
</a>
<% end %>
<% if @is_teacher && score.user == User.current && score.reviewer_role != 3 %>
<% scores = User.current.student_works_scores.where("student_work_id = #{score.student_work_id} and reviewer_role != 3").order("created_at desc") %>
<% if scores.first != score %>
<a onclick="delete_confirm_box('<%=hide_score_detail_student_work_path(score.student_work_id, :score_id => score.id) %>', '本条评分详情将不再显示<br/>您是否确定隐藏')"
href="javascript:void(0);" class="fr linkBlue ml10 mr5">隐藏</a>
<% end %>
<% end %>
<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
<% if @homework.anonymous_appeal == 1 %>
<% if score.student_work.user == User.current && score.reviewer_role == 3 && score.appeal_status == 0 %>
@ -48,10 +55,10 @@
<div class="ping_back mt10" style="border-top: 1px dashed #CCCCCC; padding-top: 10px;">
<span class="fl">申诉</span>
<% if score.appeal_status == 1 && score.student_work.user == User.current %>
<a href="javascript:void(0)" onclick="deal_appeal_score(<%=score.id %>, 2);" class="fr linkBlue mr5 ml20">撤销申诉</a>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%=deal_appeal_score_student_work_index_path(:is_last=>true,:score_id=>score.id,:status=>2) %>', '撤销后将不能再对该成绩发起申诉<br/>您是否确认撤销申诉');" class="fr linkBlue mr5 ml20">撤销申诉</a>
<% elsif @is_teacher && score.appeal_status == 1 %>
<a href="javascript:void(0)" onclick="deal_appeal_score(<%=score.id %>, 3);" class="fr linkBlue mr5">接受</a>
<a href="javascript:void(0)" onclick="deal_appeal_score(<%=score.id %>, 4);" class="fr linkBlue mr10 ml20">拒绝</a>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%=deal_appeal_score_student_work_index_path(:is_last=>true,:score_id=>score.id,:status=>3) %>', '此匿评成绩将被废弃,且评阅人的作品将被违规扣分<br/>您是否确定接受');" class="fr linkBlue mr5">接受</a>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%=deal_appeal_score_student_work_index_path(:is_last=>true,:score_id=>score.id,:status=>4) %>', '此匿评成绩将被认为合理<br/>您是否确定拒绝');" class="fr linkBlue mr10 ml20">拒绝</a>
<% end %>
<span class="fr c_grey">
<%=format_time score.student_works_scores_appeal.updated_at %>
@ -73,24 +80,3 @@
</div>
</ul>
<script>
function deal_appeal_score(score_id, status){
if(status == '2'){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">撤销后将不能再对该成绩发起申诉</p><p class="text_c mt10 f14">您是否确认撤销申诉</p><div class="cl"></div>'+
'<a href="/student_work/deal_appeal_score?is_last=true&score_id='+ score_id + '&status=2" class="fr sy_btn_blue mr135 mt10" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
}else if(status == '3'){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">此匿评成绩将被废弃,且评阅人的作品将被违规扣分</p><p class="text_c mt10 f14">您是否确定接受</p><div class="cl"></div>'+
'<a href="/student_work/deal_appeal_score?is_last=true&score_id='+ score_id + '&status=3" class="fr sy_btn_blue mr135 mt10" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
}else if(status == '4'){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">此匿评成绩将被认为合理</p><p class="text_c mt10 f14">您是否确定拒绝</p><div class="cl"></div>'+
'<a href="/student_work/deal_appeal_score?is_last=true&score_id='+ score_id + '&status=4" class="fr sy_btn_blue mr135 mt10" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
}
pop_box_new(htmlvalue, 400, 180);
}
</script>

View File

@ -1,39 +1,49 @@
<div id="popbox02">
<div class="ni_con">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red"><%= "无附件"%></span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">作品确认</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20" style="color:#808181;">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5">
<span class="fb">作品名称:</span><%= @student_work.name %>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div class="upload_img fl" style="max-width: 330px;"><%= @student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red">无附件</span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment, i| %>
<div id="attachment_<%= attachment.id %>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
</p>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px; margin-left: 55px;" >
<a href="javascript:" class="sy_btn_blue" onclick="clickOK();" style="margin-left: 55px;">
确&nbsp;&nbsp;定
</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">

View File

@ -1,38 +1,48 @@
<div id="popbox02">
<div class="ni_con">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5">
<span class="fb">作品名称:</span><%=@student_work.name%>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div id="worksDescription" class="upload_img fl" style="max-width: 330px;"><%=@student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red"><%= "无附件"%></span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
</p>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">作品确认</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
确&nbsp;定
</a>
<%= link_to("重 试", retry_work_student_work_path(@student_work.id),:class => "tijiao",:style =>"margin-bottom: 15px;margin-top:15px;",:remote => true)%>
</div>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20" style="color:#808181;">
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
<p class="f14 mt5">
<span class="fb">作品名称:</span><%= @student_work.name %>
</p>
<div class="f14 mt5 break_word" style="max-width: 425px; color:#808181; max-height:300px; overflow-x:hidden; overflow-y: auto;">
<div class="fb fl dis">作品描述:</div>
<div id="worksDescription" class="upload_img fl" style="max-width: 330px;"><%= @student_work.description.html_safe %></div>
<div class="cl"></div>
</div>
<p class="mt5">
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
<% if @student_work.attachments.empty? %>
<span class="fl c_red"><%= "无附件" %></span>
<% else %>
<div class="fl grey_c">
<% @student_work.attachments.each_with_index do |attachment, i| %>
<div id="attachment_<%= attachment.id %>">
<%= link_to_short_attachment attachment, :class => 'link_file_a fl', :download => true -%>
<%= link_to('&nbsp;'.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload fl', :confirm => l(:text_are_you_sure)) %>
<span class="ml5 fl">(<%= number_to_human_size attachment.filesize %>)</span>
<div class="cl"></div>
</div>
<% end -%>
<%#= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
</div>
<% end %>
</p>
<div class="cl"></div>
<div class="ni_btn mt10">
<a href="javascript:" class="fr sy_btn_blue mr45" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;">
确&nbsp;定
</a>
<%= link_to("重 试", retry_work_student_work_path(@student_work.id), :class => "fr sy_btn_blue mr5", :style => "margin-bottom: 15px;margin-top:15px;", :remote => true) %>
</div>
</div>
</div>
</div>

View File

@ -1,19 +1,10 @@
hideModal();
<% if @has_commit %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
var htmlvalue = '<%= escape_javascript(render :partial => 'student_work/has_commit_work') %>';
pop_box_new(htmlvalue, 500, 163);
<% elsif @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='/student_work/"+ <%=@student_work.id%> +"/retry_work' class='upload_btn' data-remote='true'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
var htmlvalue = '<%= escape_javascript(render :partial => 'student_work/work_information') %>';
pop_box_new(htmlvalue, 500, 400);
<% else %>
window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>';
<% end %>

View File

@ -0,0 +1,2 @@
hideModal();
$("#score_list_<%= @work.id%>").html("<%=escape_javascript(render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => @is_member_work}) %>");

View File

@ -126,7 +126,7 @@
<%= link_to "导出作业成绩", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :group => @group, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
</li>
<li>
<% if @homework.student_works.empty?%>
<% if @homework.student_works.has_committed.empty?%>
<%= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "导出作业附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),

View File

@ -1,11 +1,7 @@
hideModal();
<% if @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
var htmlvalue = '<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>';
pop_box_new(htmlvalue, 500, 400);
<% else %>
window.location.href = '<%= edit_student_work_url(@work)%>';
<% end %>

View File

@ -1,7 +1,7 @@
<% member = Member.where("user_id = #{@user.id} and course_id = #{course.id}").first %>
<% if User.current == @user %>
<% if member %>
<%= link_to "", cancel_or_collect_user_path(@user, :course => course.id), :class => "#{member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的班级列表中移除' : '点击将其添加至个人主页的班级列表中'}" %>
<%= link_to "", cancel_or_collect_user_path(@user, :course => course.id), :class => "#{member.is_collect == 1 ? 'icons_sy_favorite' : 'icons_sy_star'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从左侧导航的班级列表中移除' : '点击将其添加至左侧导航的班级列表中'}" %>
<% end %>
<% else %>
<% if member %>

View File

@ -1,7 +1,7 @@
<% member = Member.where("user_id = #{@user.id} and project_id = #{project.id}").first %>
<% if User.current == @user %>
<% if member %>
<%= link_to "", cancel_or_collect_user_path(@user, :project => project.id), :class => "#{member.is_collect == 1 ? 'icons_project_favorite mt3' : 'icons_project_star mt3'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从个人主页的项目列表中移除' : '点击将其添加至个人主页的项目列表中'}" %>
<%= link_to "", cancel_or_collect_user_path(@user, :project => project.id), :class => "#{member.is_collect == 1 ? 'icons_project_favorite mt3' : 'icons_project_star mt3'}",:target => '_blank', :remote => true, :title => "#{member.is_collect == 1 ? '点击将其从左侧导航的项目列表中移除' : '点击将其添加至左侧导航的项目列表中'}" %>
<% end %>
<% else %>
<% if member %>

View File

@ -0,0 +1,65 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %>
<%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<%= link_to activity.user.show_name, user_path(activity.user), :class => "newsBlue mr15" %>
TO
<% contest=Contest.find(activity.jour_id) %>
<% str = defined?(is_contest) && is_contest == 1 ? "竞赛留言" : "#{contest.name.to_s} | 竞赛留言" %>
<%= link_to str, feedback_contest_path(contest), :class => "newsBlue ml15" %>
</div>
<% if activity.parent %>
<% content = activity.parent.notes %>
<% else %>
<% content = activity.notes %>
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="homepagePostDate fl">
留言时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ContestActivity.where("contest_act_type='#{activity.class}' and contest_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<% if defined?(is_contest) && is_contest == 1 && (activity.user == User.current || User.current.admin? || User.current.admin_of_contest?(contest))%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<a href="javascript:void(0)" class="postOptionLink" title="删除"
onclick="delete_confirm_box_3('<%= words_destroy_path(:object_id => activity, :user_id => activity.user.id,:user_activity_id => user_activity_id, :activity_id => activity.id)%>', '确定要删除该留言吗?')">删除</a>
<%#= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user.id,:user_activity_id => user_activity_id, :activity_id => activity.id},
:confirm => l(:text_are_you_sure), :method => 'delete',
:class => "postOptionLink", :title => l(:button_delete)) %>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReply">
<div id="activity_post_reply_<%=user_activity_id %>">
<%=render :partial => 'users/user_journal_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
user_card_show_hide();
});
</script>

View File

@ -32,8 +32,8 @@
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div class="mt10">
<p class="fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
<%= link_to last_score.reviewer_role == 3 && !is_teacher ? '学生匿名' : last_score.user.show_name, last_score.reviewer_role == 3 && !is_teacher ? "javascript:void(0)" : user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
<p class="fontGrey2">
#&nbsp;<%=time_from_now last_score.created_at %><%= link_to last_score.reviewer_role == 3 && !is_teacher ? '学生匿名' : last_score.user.show_name, last_score.reviewer_role == 3 && !is_teacher ? "javascript:void(0)" : user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
</p>
</div>
<% end %>

View File

@ -39,10 +39,10 @@
|
<%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true',:class=>'linkBlue'%>
<% elsif ma.status == 1%> <!-- 同意 -->
您已同意申请
<%= Course.find(ma.course_id).teacher.show_name %>已同意
<% elsif ma.status == 2%> <!-- 拒绝 -->
您已拒绝申请
<%end %>
<%= Course.find(ma.course_id).teacher.show_name %>已拒绝
<% end %>
</span>
</li>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -23,7 +23,7 @@
<script type="text/javascript">
$(function(){
setTimeout(function(){
elocalStorage(jour_content_editor,'user_newfeedback_<%=User.current.id %>_<%=@user.id %>');
elocalStorage(jour_content_editor,'user_newfeedback_<%=User.current.id %>_<%=object.id %>');
}, 10000);
});
</script>

View File

@ -7,7 +7,7 @@
<ul class="sy_classlist">
<span class="icons-user-homework homework-user-leftnav-li fl"></span>
<div class="fl ">
<h3 class="sy_classlist_title fl">
<h3 class="sy_classlist_title fl" style="max-width: 800px" title="<%= homework.course.name %> / <%= homework.name %>">
<%= link_to homework.course.name+" / "+homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
</h3>
<div class="cl"></div>

View File

@ -1,32 +1,55 @@
<% message_alls.each do |ma| %>
<%# 系统消息 %>
<%= render :partial => 'users/user_message_system', :locals => {:ma => ma} %>
<%# 系统消息总显示在最上面 %>
<%= render :partial => 'users/user_message_system' if !@system_messages.nil? %>
<%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %>
<% message_alls.each do |ma| %>
<% ma = ma.try(:message) if ma.is_a?(MessageAll) %>
<% if ma.class == AtMessage && ma.at_valid? && ma.at_message %>
<%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %>
<% end %>
<%# 课程消息 %>
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>
<% if ma.class == CourseMessage %>
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>
<% end %>
<!--项目消息-->
<%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %>
<% if ma.class == ForgeMessage %>
<%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %>
<% end %>
<%# 竞赛消息 %>
<%= render :partial => 'users/user_message_contest', :locals => {:ma => ma} %>
<% if ma.class == ContestMessage %>
<%= render :partial => 'users/user_message_contest', :locals => {:ma => ma} %>
<% end %>
<%# 博客消息 %>
<%= render :partial => 'users/user_message_blog', :locals => {:ma => ma} %>
<!--公共贴吧-->
<%= render :partial => 'users/user_message_forum', :locals => {:ma => ma} %>
<% if ma.class == MemoMessage %>
<%= render :partial => 'users/user_message_forum', :locals => {:ma => ma} %>
<% end %>
<!--用户留言-->
<%= render :partial => 'users/user_message_userfeedaback', :locals => {:ma => ma} %>
<% if ma.class == UserFeedbackMessage %>
<%= render :partial => 'users/user_message_userfeedaback', :locals => {:ma => ma} %>
<% end %>
<%= render :partial => 'users/user_message_org', :locals => {:ma => ma} %>
<% if ma.class == OrgMessage %>
<%= render :partial => 'users/user_message_org', :locals => {:ma => ma} %>
<% end %>
<%# 申请类消息 %>
<%= render :partial => 'users/user_message_applied', :locals => {:ma => ma} %>
<% if ma.class == AppliedMessage %>
<%= render :partial => 'users/user_message_applied', :locals => {:ma => ma} %>
<% end %>
<% end %>
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
<% if params[:action] == "unapproval_applied_list" %>
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
<% else %>
<%= pagination_links_full @message_all_pages, @messages_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
<% end %>
</ul>
<script>
$(function(){

View File

@ -7,7 +7,7 @@
<ul class="sy_classlist">
<span class="icons-user-homework homework-user-leftnav-li fl"></span>
<div class="fl ">
<h3 class="sy_classlist_title fl">
<h3 class="sy_classlist_title fl" style="max-width: 800px" title="<%= homework.course.name %> / <%= homework.name %>">
<%= link_to homework.course.name + " / " +homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
</h3>
<div class="cl"></div>

View File

@ -94,7 +94,7 @@
<% when 'Contest' %>
<%= render :partial => 'users/contest_create', :locals => {:activity => act, :user_activity_id => act.id} %>
<% when 'JournalsForMessage' %>
<%#= render :partial => 'users/contest_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<%= render :partial => 'users/contest_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% end %>
<% when 'Principal' %>
<% case user_activity.act_type.to_s %>

View File

@ -1,34 +1,33 @@
<% if ma.class == AtMessage && ma.at_valid? && ma.at_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"), user_path(ma.author) %>
</li>
<li class="homepageNewsPubType fl">
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"), user_path(ma.author) %>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">
<%= link_to ma.author.show_name, user_path(ma.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
</span><span class="homepageNewsType fl">提到了你:</span>
</li>
<li class="messageInformationContents">
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
<%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id,
:topic_id => ma.at_message.id),
:title => "#{ma.subject.html_safe}",
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %>
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
<%= link_to ma.subject.html_safe, project_boards_path(ma.at_message.project,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id,
:topic_id => ma.at_message.id),
:title => "#{ma.subject.html_safe}",
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %>
<% else %>
<%= link_to ma.subject.html_safe, ma.url,
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
:title => "#{ma.subject.html_safe}" %>
<% end %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
</li>
<li class="messageInformationContents">
<% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
<%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id,
:topic_id => ma.at_message.id),
:title => "#{ma.subject.html_safe}",
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %>
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
<%= link_to ma.subject.html_safe, project_boards_path(ma.at_message.project,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id,
:topic_id => ma.at_message.id),
:title => "#{ma.subject.html_safe}",
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}" %>
<% else %>
<%= link_to ma.subject.html_safe, ma.url,
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
:title => "#{ma.subject.html_safe}" %>
<% end %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>

View File

@ -57,10 +57,14 @@
<% end %>
});
function checked_val() {
if ($("#anonymous_comment").is(":checked")) {
$("#anonymous_comment").val(0);
} else {
$("#anonymous_comment").val(1);
if ($("#anonymous_comment").length > 0){
if ($("#anonymous_comment").is(":checked")) {
$("#anonymous_comment").val(0);
$("#real_anonymous_comment").val(0);
} else {
$("#anonymous_comment").val(1);
$("#real_anonymous_comment").val(1);
}
}
}
function nh_reset_homework_form(params){
@ -232,11 +236,13 @@
</div>
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
<div class="fr f14 ml10" style="margin-top: 4px;">
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
<input type="checkbox" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
<span class="f14 c_grey">启用匿评</span>
<!--<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>-->
</div>
<% end %>
<input type="hidden" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="real_anonymous_comment"/>
</div>
<div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p>

View File

@ -5,29 +5,29 @@
<%= link_to "拒绝", refused_allow_to_join_project_project_memberships_path(:project_id => ma.project_id, :applied_message_id => ma.id),
:remote => true, :method => :get, :class => "link-blue",:style => "font-size: 14px;" %>
<% elsif ma.status == 2 %>
<span class="fontGrey3" style="font-size:14px;">已处理</span>
<span style="font-size:14px;">已处理</span>
<% elsif ma.status == 4 %>
<% operator_message = AppliedMessage.where("applied_id=? and status = 4", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已拒绝">
<span style="font-size:14px" title="<%= operator %>已拒绝">
<%= operator %>已拒绝
</span>
<% elsif ma.status == 5 %>
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,5)", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.applied_user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已拒绝">
<span style="font-size:14px" title="<%= operator %>已拒绝">
<%= operator %>已拒绝
</span>
<% elsif ma.status == 6 %>
<% operator_message = AppliedMessage.where("applied_id=? and status = 6", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 6", ma.applied_id, ma.user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已同意">
<span style="font-size:14px" title="<%= operator %>已同意">
<%= operator %>已同意
</span>
<% elsif ma.status == 7 %>
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,7)", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 6", ma.applied_id, ma.applied_user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已同意">
<span style="font-size:14px" title="<%= operator %>已同意">
<%= operator %>已同意
</span>
<% end %>

View File

@ -1,54 +1,52 @@
<% if ma.class == AppliedMessage %>
<!-- 申请添加单位 -->
<% if ma.applied_type == "ApplyAddSchools" %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<% if ma.status == 0 %>
<% applied_user = User.find(ma.applied_user_id) %>
<%= link_to image_tag(url_to_avatar(applied_user), :width => "30", :height => "30"), user_path(applied_user), :target => '_blank' %>
<% else %>
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
<% end %>
</li>
<li class="homepageNewsPubType fl">
<%= render :partial => "users/user_message_applied_schools", :locals =>{:ma => ma} %>
</li>
<li class = "messageInformationContents">
<%= render :partial => "users/user_message_applied_school_action", :locals =>{:ma => ma} %>
</li>
<!-- 申请添加单位 -->
<% if ma.applied_type == "ApplyAddSchools" %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<% if ma.status == 0 %>
<% applied_user = User.find(ma.applied_user_id) %>
<%= link_to image_tag(url_to_avatar(applied_user), :width => "30", :height => "30"), user_path(applied_user), :target => '_blank' %>
<% else %>
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
<% end %>
</li>
<li class="homepageNewsPubType fl">
<%= render :partial => "users/user_message_applied_schools", :locals =>{:ma => ma} %>
</li>
<li class = "messageInformationContents">
<%= render :partial => "users/user_message_applied_school_action", :locals =>{:ma => ma} %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!-- 申请加入项目 -->
<% elsif ma && ma.applied_type == "AppliedProject" %>
<ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>">
<%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %>
</ul>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!-- 申请加入项目 -->
<% elsif ma && ma.applied_type == "AppliedProject" %>
<ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>">
<%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %>
</ul>
<!-- 匿评成绩申诉 -->
<% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<% applied_user = User.find(ma.applied_user_id) %>
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(applied_user), :width => "30", :height => "30"), user_path(applied_user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to applied_user.show_name, user_path(applied_user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">申诉匿评成绩:</span>
</li>
<li class="messageInformationContents fl">
<% homework = ma.applied.student_works_score.student_work.homework_common %>
<%= link_to homework.name, student_work_index_path(:homework => homework.id, :show_work_id => ma.applied.student_works_score.student_work_id, :tab => 2), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %>
</li>
</ul>
<% elsif ma && ma.applied_type == "AppliedContest" %>
<ul class="homepageNewsList fl" id="contest_message_join_<%=ma.id %>">
<%= render :partial => 'join_contest_applied_message', :locals => {:ma => ma} %>
</ul>
<% end %>
<% end %>
<% elsif ma && ma.applied_type == "StudentWorksScoresAppeal" %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<% applied_user = User.find(ma.applied_user_id) %>
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(applied_user), :width => "30", :height => "30"), user_path(applied_user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to applied_user.show_name, user_path(applied_user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">申诉匿评成绩:</span>
</li>
<li class="messageInformationContents fl">
<% homework = ma.applied.student_works_score.student_work.homework_common %>
<%= link_to homework.name, student_work_index_path(:homework => homework.id, :show_work_id => ma.applied.student_works_score.student_work_id, :tab => 2), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %>
</li>
</ul>
<% elsif ma && ma.applied_type == "AppliedContest" %>
<ul class="homepageNewsList fl" id="contest_message_join_<%=ma.id %>">
<%= render :partial => 'join_contest_applied_message', :locals => {:ma => ma} %>
</ul>
<% end %>

Some files were not shown because too many files have changed in this diff Show More