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

This commit is contained in:
huang 2017-03-29 09:22:36 +08:00
commit afbe8267ae
115 changed files with 1006 additions and 417 deletions

View File

@ -4,9 +4,9 @@ unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
if RUBY_PLATFORM =~ /darwin/
# gem "rmagick", "= 2.15.4" ## osx must be this version
gem "rmagick", "= 2.15.4" ## osx must be this version
elsif RUBY_PLATFORM =~ /linux/
# gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel
gem "rmagick", "~> 2.13.1" ## centos yum install ImageMagick-devel
end
gem 'certified'
gem 'net-ssh', '2.9.1'

View File

@ -475,7 +475,6 @@ class AdminController < ApplicationController
else
@limit = 15#per_page_option
end
@status = params[:status] || 1
scope = User.logged.status(@status)
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present?
@ -483,8 +482,7 @@ class AdminController < ApplicationController
@user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'base'
@users = scope.offset(@user_pages.offset).limit(@user_pages.per_page)
@users = scope.order(sort_clause).offset(@user_pages.offset).limit(@user_pages.per_page).all
respond_to do |format|
format.html {
@groups = Group.all.sort

View File

@ -47,6 +47,8 @@ class AtController < ApplicationController
find_topic(id)
when 'JournalsForMessage'
find_journals_for_message(id)
when 'Journal'
find_journal(id)
when 'Principal'
find_principal(id)
when 'BlogComment'
@ -134,8 +136,14 @@ class AtController < ApplicationController
#Message
def find_message(id)
message = Message.find(id)
at_persons = message.board.messages.map(&:author)
(at_persons || []) + (find_project(message.board.project_id)||[])
if message.board.course_id.nil?
at_persons = message.board.messages.map(&:author)
(at_persons || []) + (find_project(message.board.project_id)||[])
else
type = 'Course'
course_id = message.board.course_id
find_at_users(type, course_id)
end
end
#News
@ -159,6 +167,12 @@ class AtController < ApplicationController
#Journal
def find_journal(id)
journal = Journal.find id
if journal.journalized_type == 'Issue'
issue_id = journal.issue.id
find_at_users(journal.journalized_type, issue_id)
end
end
#Document

View File

@ -310,7 +310,8 @@ class AttachmentsController < ApplicationController
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
@history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes",'is_publish','publish_time')
@status = @old_attachment.is_publish
# 如果附件描述被修改,则保存附件
unless params[:description] == @attachment.description
@old_attachment.description = params[:description]
@ -327,6 +328,14 @@ class AttachmentsController < ApplicationController
end
end
def update_attachment_publish_time
@attachment = Attachment.find params[:id]
@status = params[:status].to_i
if @status == 0
@attachment.update_attributes(:is_publish => 1, :publish_time => Time.now)
end
end
# prams[:type] => history 历史版本
def destroy
if params[:type] == "history"

View File

@ -31,6 +31,7 @@ class AvatarController < ApplicationController
end
end
size = @temp_file.size
if @temp_file && (@temp_file.size > 0)
if @temp_file.size > Setting.upload_avatar_max_size.to_i
@status = 1
@ -65,7 +66,11 @@ class AvatarController < ApplicationController
end
end
Trustie::Utils::Image.new(diskfile,true).compress(300)
if @source_type == 'Contest'
Trustie::Utils::Image.new(diskfile,true).compress(900)
else
Trustie::Utils::Image.new(diskfile,true).compress(300)
end
@status = 0
@msg = ''
else
@ -75,6 +80,15 @@ class AvatarController < ApplicationController
end
@temp_file = nil
sleep(3)
unless File.size(diskfile) < size
logger.info("###############################################################sleep")
sleep(0.5)
end
#@src_file = diskfile
respond_to do |format|
format.json{
render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'

View File

@ -15,7 +15,7 @@ class ContestantWorksController < ApplicationController
def new
#更新消息
if @contestwork.work_status == 1
#if @contestwork.work_status == 1
noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
noEvaluation.update_all(:viewed => true)
@ -24,9 +24,9 @@ class ContestantWorksController < ApplicationController
respond_to do |format|
format.html{ render :layout => "base_contests"}
end
else
render_403
end
#else
# render_403
#end
end
def index

View File

@ -627,13 +627,14 @@ class CoursesController < ApplicationController
member = @course.members.find params[:member_id]
student_role = member.member_roles.where("role_id = 10").first
teacher_role = member.member_roles.where("role_id = 7 || role_id = 9").first
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
if member && member.deletable? && student_role
user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, @course.id)
if user_admin.size > 0
user_admin.destroy_all
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
if member.member_roles.count > 1&& student_role && teacher_role
student_role.destroy

View File

@ -14,7 +14,9 @@ class ExerciseController < ApplicationController
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
if m.user_id != exercise.user_id
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
end
@ -42,7 +44,9 @@ class ExerciseController < ApplicationController
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
if m.user_id != exercise.user_id
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
end
@ -441,9 +445,6 @@ class ExerciseController < ApplicationController
@exercise.exercise_status = 2
@exercise.publish_time = Time.now
if @exercise.save
@exercise.course.members.each do |m|
@exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2)
end
#redirect_to exercise_index_url(:course_id=> @course.id)
respond_to do |format|
format.js
@ -483,6 +484,7 @@ class ExerciseController < ApplicationController
end
end
=end
@name,@select_group = params[:name].to_s.strip || "",params[:group]
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @is_teacher
@all_exercises = @course.exercises.order("created_at desc")
@ -490,17 +492,53 @@ class ExerciseController < ApplicationController
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
end
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
@exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where("user_id in #{student_id}")
@show_all = true;
elsif !@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id)
if @select_group
if @select_group == "0"
none_group_students = @course.members.select{ |member| member.course_group_id == 0 }
if none_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')'
end
elsif @select_group == "-1"
all_group_students = @course.members.select{ |member| member.course_group_id }
if all_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')'
end
else
course_group = CourseGroup.find_by_id(@select_group)
group_students = course_group.users
if group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + group_students.map{ |user| user.id }.join(',') + ')'
end
end
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id} and user_id in #{student_in_group}"), @name
@show_all = true;
elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id} and user_id in #{student_in_group}",User.current.id), @name
else
@exercise_users_list = []
end
else
@exercise_users_list = []
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id}"), @name
@show_all = true;
elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id), @name
else
@exercise_users_list = []
end
end
@exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count
@left_nav_type = 8
respond_to do |format|
format.js
format.html
format.xls {
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls"
@ -654,6 +692,10 @@ class ExerciseController < ApplicationController
# 更新提交状态
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1)
if @exercise.time && @exercise.time != -1
score = calculate_student_score(@exercise, User.current)
cur_exercise_user.update_attributes(:score => score)
end
# 答题过程中需要统计完成量
#@uncomplete_question = get_uncomplete_question(@exercise, User.current)
# 获取改学生的考试得分
@ -889,6 +931,19 @@ class ExerciseController < ApplicationController
xls_report.string
end
#根据条件过滤作业结果
def search_exercise_member exercises,name
if name == ""
select_exercises = exercises
else
name = name.downcase
select_exercises = exercises.select{ |exercise|
exercise.user[:login].to_s.downcase.include?(name) || exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name)
}
end
select_exercises
end
# ExerciseUser记录用户是否已提交问卷有对应的记录则已提交没有则新建一个
def get_exercise_user exercise_id,user_id
eu = ExerciseUser.find_by_exercise_id_and_user_id(exercise_id,user_id)

View File

@ -121,7 +121,7 @@ class ForumsController < ApplicationController
order = ""
@order_str = ""
if(params[:reorder_complex])
order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
order = "replies_count #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@order_str = "reorder_complex="+params[:reorder_complex]
elsif(params[:reorder_popu])
order = "replies_count #{params[:reorder_popu]}"
@ -166,16 +166,16 @@ class ForumsController < ApplicationController
order = ""
@order_str = ""
if(params[:reorder_complex])
order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
order = "#{Memo.table_name}.sticky desc, last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
@order_str = "reorder_complex="+params[:reorder_complex]
elsif(params[:reorder_popu])
order = "replies_count #{params[:reorder_popu]}"
order = "#{Memo.table_name}.sticky desc, replies_count #{params[:reorder_popu]}"
@order_str = "reorder_popu="+params[:reorder_popu]
elsif(params[:reorder_time])
order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}"
order = "#{Memo.table_name}.sticky desc, #{Memo.table_name}.updated_at #{params[:reorder_time]}"
@order_str = "reorder_time="+params[:reorder_time]
else
order = "#{Memo.table_name}.updated_at desc"
order = "#{Memo.table_name}.sticky desc, #{Memo.table_name}.updated_at desc"
@order_str = "reorder_time=desc"
end
@memo = Memo.new(:forum => @forum)

View File

@ -156,7 +156,7 @@ class HomeworkCommonController < ApplicationController
eval_start = homework_detail_manual.evaluation_start
if eval_start.nil? || (Time.parse(eval_start.to_s) <= @homework.end_time && homework_detail_manual.comment_status <= 1)
homework_detail_manual.evaluation_start = @homework.end_time + 7
homework_detail_manual.evaluation_start = (@homework.end_time + 7*24*60*60).strftime("%Y-%m-%d")
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
end
end

View File

@ -50,6 +50,8 @@ class MemosController < ApplicationController
@memo = Memo.new(params[:memo])
@memo.forum_id = @forum.id
@memo.author_id = User.current.id
# 问吧置顶sticky:1 置顶0不置顶
@memo.sticky = params[:memo][:sticky].to_i
if params[:memo][:parent_id]
@memo.root_id = (Memo.find params[:memo][:parent_id]).root_id.nil? ? params[:memo][:parent_id].to_i : (Memo.find params[:memo][:parent_id]).root_id
@ -189,6 +191,14 @@ class MemosController < ApplicationController
end
end
#置顶功能
def change_sticky
@memo.sticky ? @memo.update_attribute(:sticky, false) : @memo.update_attribute(:sticky, true)
respond_to do |format|
format.html { redirect_to forum_memo_path(@memo.forum, @memo) }
end
end
private
def find_memo

View File

@ -57,6 +57,9 @@ class MessagesController < ApplicationController
@replies = @replies[@page * @limit..@page * @limit + 9]
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
#帖子消息状态更新
course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_message_id =? and course_id =? and viewed =?", User.current.id, 'Message', @topic.id, @course.id, 0)
course_messages.update_all(:viewed => true)
#@replies = @topic.children.
#includes(:author, :attachments, :praise_tread_cache, {:board => :project}).
#reorder("#{Message.table_name}.created_on DESC").
@ -64,6 +67,11 @@ class MessagesController < ApplicationController
#offset(@reply_pages.offset).
#all
#@replies = paginateHelper messages_replies,10
# 班级帖子回复消息设为已读
@replies.each do |comment|
course_message = CourseMessage.where(:course_message_type => 'Message', :course_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
course_message.update_all(:viewed => 1)
end
@left_nav_type = 2
respond_to do |format|
format.js
@ -71,6 +79,9 @@ class MessagesController < ApplicationController
end
#render :action => "show", :layout => "base_courses"#by young
elsif @project
#帖子消息状态更新
project_messages = ForgeMessage.where("user_id =? and forge_message_type =? and forge_message_id =? and project_id =? and viewed =?", User.current.id, 'Message', @topic.id, @project.id, 0)
project_messages.update_all(:viewed => true)
#@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
@ -78,11 +89,25 @@ class MessagesController < ApplicationController
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
# 项目帖子回复消息设为已读
@replies.each do |comment|
project_message = ForgeMessage.where(:forge_message_type => 'Message', :forge_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
project_message.update_all(:viewed => 1)
end
respond_to do |format|
format.js
format.html {render :layout => 'base_projects'}
end
elsif @contest
#帖子消息状态更新
contest_messages = ContestMessage.where("user_id =? and contest_message_type =? and contest_message_id =? and contest_id =? and viewed =?", User.current.id, 'Message', @topic.id, @contest.id, 0)
contest_messages.update_all(:viewed => true)
# 竞赛帖子回复消息设为已读
@replies.each do |comment|
contest_message = ContestMessage.where(:contest_message_type => 'Message', :contest_message_id => comment.id, :user_id => User.current.id, :viewed => 0)
contest_message.update_all(:viewed => 1)
end
@left_nav_type = 4
respond_to do |format|
format.js
@ -187,13 +212,15 @@ class MessagesController < ApplicationController
# @reply.reply_id = params[:id]
parent.children << @reply
else
@quote = params[:quote][:quote]
#@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.subject = @topic.subject
@reply.content = params[:content]
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
#@reply.content = @quote + @reply.content
#@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@reply.root_id = @topic.id
@topic.children << @reply
# @reply.reply_id = params[:id]

View File

@ -636,7 +636,7 @@ class OrganizationsController < ApplicationController
end
def apply_subdomain
organization = Organization.find(params[:id])
@applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase, :status => 1).count
@applied_message_count = AppliedMessage.where(:applied_id => organization.id, :name => params[:domain].downcase, :status => 0).count
# 如果申请过该名字,怎不能重复申请
if @applied_message_count > 0
@flag = 1
@ -670,7 +670,7 @@ class OrganizationsController < ApplicationController
end
# 自己处理自己的消息则不需要另外发送消息
if User.current.id != @applied_message.applied_user_id
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_id => organization_id, :applied_type => 'Organization', :viewed => 0, :satus => 2, :applied_user_id => User.current.id, :name => org_domain.downcase)
OrgMessage.create(:user_id => params[:user_id], :organization_id => organization_id, :message_type => 'AgreeApplySubdomain', :message_id => organization_id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end
@applied_message.status = 2
@applied_message.updated_at = Time.now
@ -696,7 +696,7 @@ class OrganizationsController < ApplicationController
applied_messages.update_all(:status => 4, :viewed => true, :updated_at => Time.now)
# 自己处理自己的消息则不需要另外发送消息
if User.current.id != @applied_message.applied_user_id
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_id => organization_id, :applied_type => 'Organization', :viewed => 0, :satus => 4, :applied_user_id => User.current.id, :name => org_domain.downcase)
OrgMessage.create(:user_id => params[:user_id], :organization_id => organization_id, :message_type => 'DisagreeApplySubdomain', :message_id => organization_id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
end
@applied_message.status = 4
@applied_message.updated_at = Time.now

View File

@ -212,6 +212,12 @@ class ProjectsController < ApplicationController
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
if params[:course_id]
@course = Course.find params[:course_id]
elsif params[:contest_id]
@contest = Contest.find params[:contest_id]
end
render :layout => 'new_base'
else
redirect_to signin_url

View File

@ -160,7 +160,7 @@ class StudentWorkController < ApplicationController
student_work.name = params[:title]
student_work.description = params[:src]
if @homework.end_time < Time.now.to_s
if !is_test && @homework.end_time < Time.now.to_s
student_work.late_penalty = @homework.late_penalty
else
student_work.late_penalty = 0
@ -954,6 +954,9 @@ class StudentWorkController < ApplicationController
render_attachment_warning_if_needed(@new_score)
if @new_score.save
if @work.re_commit && @new_score.reviewer_role != 3
@work.re_commit = 0
end
if @homework.homework_type == 3
@is_group_leader = !@work.student_work_projects.empty?
end
@ -1314,29 +1317,43 @@ class StudentWorkController < ApplicationController
end
def forbidden_anonymous_comment
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
homework_detail_manual = @homework.homework_detail_manual
homework_detail_programing = @homework.homework_detail_programing
if @homework.anonymous_comment == 1
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
else
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
end
if @homework.homework_type == 2 && homework_detail_programing
if homework_detail_manual.comment_status != 0
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
homework_detail_programing = @homework.homework_detail_programing
if @homework.anonymous_comment == 1
homework_detail_programing.ta_proportion = 0.6
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.4 : 1.0
@status = 1
else
homework_detail_programing.ta_proportion = 0.5
if @homework.end_time < Time.now
homework_detail_manual.evaluation_start = (Time.now + 7*24*60*60).strftime("%Y-%m-%d")
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
@status = 2
else
homework_detail_manual.evaluation_start = (@homework.end_time + 7*24*60*60).strftime("%Y-%m-%d")
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
@status = 3
end
homework_detail_manual.ta_proportion = @homework.homework_type == 2 ? 0.3 : 0.6
end
if @homework.homework_type == 2 && homework_detail_programing
if @homework.anonymous_comment == 1
homework_detail_programing.ta_proportion = 0.6
else
homework_detail_programing.ta_proportion = 0.5
end
end
homework_detail_manual.save
homework_detail_programing.save if homework_detail_programing
@homework.student_works.each do |student_work|
set_final_score @homework,student_work
student_work.save
end
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
else
@status = 0
end
homework_detail_manual.save
homework_detail_programing.save if homework_detail_programing
@homework.student_works.each do |student_work|
set_final_score @homework,student_work
student_work.save
end
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
end
def revise_attachment
@ -1351,6 +1368,7 @@ class StudentWorkController < ApplicationController
student_work = StudentWork.find attachment.container_id
CourseMessage.create(:user_id => student_work.homework_common.user_id, :course_id => student_work.homework_common.course_id, :viewed => false,:course_message_id=>attachment.container_id,:course_message_type=>'StudentWork',:status=>2)
end
@work.update_attributes(:re_commit => 1)
respond_to do |format|
format.js
end

View File

@ -1436,8 +1436,8 @@ class UsersController < ApplicationController
end
end
homework_detail_manual.evaluation_start = homework.end_time + 7 if homework.end_time
homework_detail_manual.evaluation_end = homework.end_time + 14 if homework.end_time
homework_detail_manual.evaluation_start = (homework.end_time + 7*24*60*60).strftime("%Y-%m-%d") if homework.end_time
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7 if homework.end_time
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.absence_penalty = 0
homework.homework_detail_manual = homework_detail_manual
@ -2089,6 +2089,8 @@ class UsersController < ApplicationController
def show
if User.current == @user
# 点击小铃铛,更新点击时间
update_onclick_time if params[:click_user_message] == 'true'
# 全部设为已读
# 自己的主页显示消息
messages_all = MessageAll.where(:user_id => @user.id)

View File

@ -202,6 +202,7 @@ class VersionsController < ApplicationController
@is_setting = params[:is_setting]
@is_create = params[:is_create]
@is_index = params[:is_index]
@version_id = params[:id]
end
def update
@ -276,10 +277,11 @@ class VersionsController < ApplicationController
end
# 判断里程碑是否重名
# 项目内的里程碑不能重名,项目之间的里程碑能重名
def judge_version_title
begin
version = Version.where(:name => params[:version_name], :project_id => @project.id).first
if version.blank?
if version.blank? || version.id == params[:version_id].to_i
result = {:result => true}
else
result = {:result => false}

View File

@ -6,7 +6,7 @@ class ZipdownController < ApplicationController
#检查权限
#勿删 before_filter :authorize, :only => [:assort,:download_user_homework]
## 200M
MAX_DOWN_SIZE = 200 * 1024 * 1024
MAX_DOWN_SIZE = 500 * 1024 * 1024
include ZipService
@ -32,7 +32,7 @@ class ZipdownController < ApplicationController
def assort
if params[:obj_class] == "Bid"
bid = Bid.find params[:obj_id]
render_403 if User.current.allowed_to?(:as_teacher,bid.courses.first)
#render_403 if User.current.allowed_to?(:as_teacher,bid.courses.first)
zipfile = checkfileSize(bid.homeworks) {
zip_bid bid
}

View File

@ -2492,7 +2492,7 @@ module ApplicationHelper
if attachment.container
if attachment.container.class.to_s=="PhoneAppVersion"
candown = true
elsif attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
elsif attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && attachment.container.class.to_s != "ContestantWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
project = attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
elsif attachment.container.is_a?(Project)
@ -2566,7 +2566,8 @@ module ApplicationHelper
#如果学生作品被打分后修改,应该给老师提示
def send_message_to_teacher student_work
if StudentWork === student_work
if student_work.student_works_scores.any?
if student_work.student_works_scores.where("reviewer_role != 3").any?
student_work.update_column('re_commit', 1)
course = student_work.homework_common.course
course.members.map(&:user_id).uniq.each do|user_id|
if User.find(user_id).allowed_to?(:as_teacher, course)
@ -3179,7 +3180,7 @@ module ApplicationHelper
def user_for_contest_work homework,is_contestant,work
count = homework.contestant_works.has_committed.count
if User.current.logged?
if User.current.member_of_contest?(homework.contest)
if User.current.member_of_contest?(homework.contest) || User.current.admin?
if !is_contestant #老师显示作品数量
link_to "作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => "c_blue"
else #学生显示提交作品、修改作品等按钮
@ -3191,6 +3192,12 @@ module ApplicationHelper
else
link_to "提交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_blue'
end
elsif work.nil? && homework.work_status > 1
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
link_to "补交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_blue'
end
else
if homework.work_status == 1 && work.user_id == User.current.id
link_to "修改作品(#{count})", edit_contestant_work_path(work.id),:class => 'c_blue'

View File

@ -1,7 +1,7 @@
#encoding: utf-8
module ContestantWorksHelper
def get_status status
def get_contest_new_status status
str = ""
case status
when 0

View File

@ -56,15 +56,19 @@ module StudentWorkHelper
result
end
def get_status status
def get_status status, re_commit
str = ""
case status
when 0
str = "未提交"
when 1
str = "已提交"
when 2
str = "迟交"
if re_commit
str = "重新提交"
else
case status
when 0
str = "未提交"
when 1
str = "已提交"
when 2
str = "迟交"
end
end
str
end

View File

@ -8,15 +8,25 @@ class Exercise < ActiveRecord::Base
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
# 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
after_create :acts_as_course_message
after_save :acts_as_course_message
def acts_as_course_message
if self.course
if self.exercise_status == 2 #未发布
if self.exercise_status == 2 && self.course_messages.where(:status => 2).blank? #已发布
self.delay.send_exercise_message_delay
#self.course.members.each do |m|
self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2)
#self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2)
#end
# else
# self.course_messages.destroy_all 这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的
else
#self.course_messages.destroy_all #这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的
end
end
end
#测验通知delay
def send_exercise_message_delay
self.course.members.each do |m|
if m.user_id != self.user_id
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false ,:status=>2)
end
end
end

View File

@ -111,8 +111,9 @@ class HomeworkCommon < ActiveRecord::Base
#作业微信通知delay
def send_homework_wechat_message_delay
self.course.members.each do |m|
# if m.user_id != self.user_id
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
if m.user_id != self.user_id
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
end
rolesids = []
m.roles.each do |role|
rolesids << role.id

View File

@ -69,7 +69,7 @@ class News < ActiveRecord::Base
:author_key => :author_id
acts_as_watchable
after_create :act_as_course_activity, :add_author_as_watcher, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send, :act_as_contest_message
after_create :act_as_course_activity, :add_author_as_watcher, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
after_update :update_activity
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
@ -230,13 +230,13 @@ class News < ActiveRecord::Base
end
def act_as_contest_message
if self.contest_id
self.contest.contest_members.each do | m|
if m.user_id != self.author_id
self.contest_messages << ContestMessage.new(:user_id => m.user_id, :contest_id => self.contest_id, :viewed => false)
end
end
end
# if self.contest_id
# self.contest.contest_members.each do | m|
# if m.user_id != self.author_id
# self.contest_messages << ContestMessage.new(:user_id => m.user_id, :contest_id => self.contest_id, :viewed => false)
# end
# end
# end
end
def delay_news_send
@ -265,7 +265,7 @@ class News < ActiveRecord::Base
vs = []
self.contest.contest_members.each do | m|
if m.user_id != self.author_id
vs << {contest_message_type:'Contest',contest_message_id:self.id, :user_id => m.user_id,
vs << {contest_message_type:'News',contest_message_id:self.id, :user_id => m.user_id,
:contest_id => self.contest_id, :viewed => false}
if vs.size >= 30

View File

@ -1,6 +1,6 @@
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品
class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time, :late_penalty, :absence_penalty
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time, :late_penalty, :absence_penalty, :re_commit
belongs_to :homework_common
belongs_to :user

View File

@ -402,7 +402,8 @@ class User < Principal
end
user = User.current
onclick_time = user.onclick_time.onclick_time
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
delete_courses = Course.where(:is_delete => 1).blank? ? "(-1)" : "(" + Course.where(:is_delete => 1).map(&:id).join(",") + ")"
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >? and course_id not in #{delete_courses}", user.id, 0, onclick_time).count
contest_count = ContestMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count

View File

@ -24,18 +24,34 @@ class ContestsService
if params[:invite_code].present?
role_ids = params[:role]
#如果已经发送过消息了,那么就要给个提示
if AppliedContest.where(:contest_id => contest.id, :user_id => current_user.id, :status => 0).count != 0
@state = 7
else
if role_ids.size == 1
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_ids[0], :status => 0)
else
role_ids.each do |role_id|
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_id, :status => 0)
end
if role_ids.include?("15")
member = ContestMember.new(:user_id => current_user.id)
contest.contest_members << member
contest_member_roles = member.contest_member_roles
contest_member_roles << ContestMemberRole.new(:role_id => 15)
ContestantForContest.create(:student_id => current_user.id, :contest_id => contest.id)
# 给管理员发消息
admins = contest_managers contest
admins.each do |member|
course_join = ContestMessage.new(:user_id =>member.user_id, :contest_message_id=>current_user.id,:contest_id => contest.id,:contest_message_type=>"JoinContest", :content => role_ids, :viewed => false, :status => 2)
course_join.save
end
@state = 0
else
#如果已经发送过消息了,那么就要给个提示
if AppliedContest.where(:contest_id => contest.id, :user_id => current_user.id, :status => 0).count != 0
@state = 7
else
if role_ids.size == 1
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_ids[0], :status => 0)
else
role_ids.each do |role_id|
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_id, :status => 0)
end
end
@state = 6
end
@state = 6
end
else
@state = 1

View File

@ -12,6 +12,9 @@
</div>
</div>
<script type="text/javascript">
$("#search_course_input").bind('change',function(e){
search_courses(e)
});
function school_submit() {
var checkboxs = $("input[name='school_id[]']:checked");
if(checkboxs.length == 0) {
@ -34,22 +37,9 @@
url: '<%= url_for(:controller => 'admin', :action => 'all_schools') %>'+'?search='+ e.target.value+'&school_id=<%=edit_id %>',
type:'get',
data: {is_observe:true},
success: function(data){ },
success: function(data){ },
beforeSend: function(){ $(this).addClass('ajax-loading'); },
complete: function(){ $(this).removeClass('ajax-loading'); }
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询项目
$("input[name='search']").on('input', function (e) {
throttle(search_courses,window,e);
});
</script>

View File

@ -24,4 +24,4 @@
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a>
</div>
</div>
<div class="cl"></div>
<div class="cl"></div>

View File

@ -92,15 +92,7 @@
<% end%>
</td>
<td align="center">
<% unless user.user_extensions.nil? %>
<% if user.user_extensions.identity.to_i == 0 %>
<!--优先取school中校名如果校名不存在就取occupation-->
<% occupation = user.user_extensions.school_id.nil? ? "" : (School.where("id =?", user.user_extensions.school_id)).first.try(:name) %>
<%= occupation.blank? ? user.user_extensions.occupation : occupation %>
<% else %>
<%= user.user_extensions.occupation %>
<% end %>
<% end %>
<%= user.user_extensions.school_id.nil? ? "" : (School.find user.user_extensions.school_id).try(:name) %>
</td>
</tr>
<% end %>

View File

@ -0,0 +1,17 @@
<div id="muban_popup_box" style="width:470px;">
<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 style='text-align:center;font-family: "微软雅黑","宋体"' class="mt20 f14">
是否保留您设置的延期发布时间:<%= format_time @old_attachment.publish_time %>
</div>
<div style='width:164px; margin:0 auto; margin-top: 15px; text-align:center; font-family: "微软雅黑","宋体"'>
<%=link_to '取消', update_attachment_publish_time_path(@old_attachment, :status => 0),:style => 'margin-left: 25px;', :class => 'sy_btn_grey fl mr5', :remote => true%>
<%=link_to '确认', update_attachment_publish_time_path(@old_attachment, :status => 1), :class => 'sy_btn_blue fl', :remote => true%>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1,2 @@
hideModal();
$(".re_search").submit(); // 为了刷新

View File

@ -1,7 +1,11 @@
<% if @flag %>
hideModal();
alert('更新成功');
$(".re_search").submit(); // 为了刷新
<% if @status == 1 %>
notice_box("更新成功");
$(".re_search").submit(); // 为了刷新
<% else %>
var htmlvalue = "<%=escape_javascript(render :partial => 'update_publish_time_box') %>";
pop_box_new(htmlvalue, 470, 140);
<% end %>
<%else%>
$("#upload_file_count").html('(更新失败)');
<%end %>

View File

@ -126,14 +126,12 @@
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<%if User.current.member_of_contest?(contest) %>
<%if User.current.admin_of_contest?(contest) %>
<div class="mt10">
<% if User.current.id == contest.user_id %>
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<div class="cl"></div>
</div>
<% end %>

View File

@ -122,20 +122,18 @@
<div id="new_course_topic">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p>
</div>
<div id="topic_editor" style="display: none;">
<%if User.current.member_of_course?(course) %>
<div class="mt10">
<% if User.current.id == course.tea_id %>
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<div class="cl"></div>
</div>
<%if User.current.allowed_to?(:as_teacher, course) %>
<div class="mt10">
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<div class="cl"></div>
</div>
<% end %>
<div class="mt10">
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>

View File

@ -6,8 +6,10 @@
function reset_topic(){
$("#message_subject").val("");
$("#subjectmsg").text("");
document.getElementById("message_sticky").checked=false;
document.getElementById("message_locked").checked=false;
if(document.getElementById("message_sticky") && document.getElementById("message_locked")){
document.getElementById("message_sticky").checked=false;
document.getElementById("message_locked").checked=false;
}
$("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => Message.new, :isReply => @isReply})%>");
message_content_editor.html("");
$("#topic_editor").toggle();

View File

@ -22,6 +22,7 @@
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<span class="c_red fl" id="choose_member_notice"></span>
<div class="cl"></div>
</div>
<script type="text/javascript">
@ -82,10 +83,8 @@
}
function delete_student(id) {
$("#choose_member_notice").hide();
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){

View File

@ -2,10 +2,10 @@
<div>
<span class="fl" style="width:280px;" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<% end %>
<span class="fontGrey2 ml5 fl">已提交
<%# if student_work.work_status %>
<%#= get_contest_new_status student_work.work_status %>
<%# end %>
</span>
</span>
<a href="javascript:void(0)" class="linkBlue2 fr" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">评分</a>

View File

@ -2,10 +2,10 @@
<div>
<span class="fl" style="width:280px;" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<% end %>
<span class="fontGrey2 ml5 fl">已提交
<%# if student_work.work_status %>
<%#= get_contest_new_status student_work.work_status %>
<%# end %>
</span>
</span>
<a href="javascript:void(0)" class="linkBlue2 fr" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">查看</a>

View File

@ -13,8 +13,8 @@
<% my_work = cur_user_works_for_work @contestwork %>
<% if !@is_teacher && !@is_judge && my_work.nil? && User.current.member_of_contest?(@contest) %>
<span class="f12 c_red">您尚未提交作品</span>
<% if @contestwork.work_status == 1 && (@contestwork.work_type != 3 ||(@contestwork.work_type == 3 && !@contestwork.work_detail_group.base_on_project)) %>
<%=link_to "提交作品", new_contestant_work_path(:work => @contestwork.id),:class => 'blueCir ml5 f12' %>
<% if @contestwork.work_type != 3 ||(@contestwork.work_type == 3 && !@contestwork.work_detail_group.base_on_project) %>
<%=link_to @contestwork.work_status == 1 ? "提交作品" : "补交作品", new_contestant_work_path(:work => @contestwork.id),:class => 'blueCir ml5 f12' %>
<% end %>
<% elsif !@is_teacher && !@is_judge && my_work && @contestwork.work_status > 1 && !@stundet_works.empty?%>
<span class="f12 c_red">截止日期已过,已提交且不可修改</span>

View File

@ -12,7 +12,7 @@
<%=get_cw_status(homework).html_safe %>
<div class="cl"></div>
<% if homework.work_type == 3 && homework.work_detail_group.base_on_project %>
<span class="c_red">系统提示:该题目要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<span class="c_red">系统提示:该题目要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name, :contest_id => homework.contest_id),:target => "_blank",:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif homework.work_type == 3 && !homework.work_detail_group.base_on_project%>
<span class="c_red">系统提示:该题目要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>

View File

@ -19,24 +19,39 @@ if(lists.length > 0) {
}
}
}
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.contestant_of_contest?(@contest) %>
<%# if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.contestant_of_contest?(@contest) %>
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
$("#student_<%=user.id %>").on("click",function choose_student() {
if($("#choose_student_<%=user.id %>").length > 0){
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
} else{
$("#choose_member_notice").hide();
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
}
});
}
<% elsif !user.contestant_of_contest?(@contest) %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该项目成员不是本竞赛的参赛者");
}
<%# elsif !user.contestant_of_contest?(@contest) %>
//if (str.indexOf(<%#=user.id.to_s %>) < 0) {
// $("#student_<%#=user.id %>").attr("title","该项目成员不是本竞赛的参赛者");
//}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该成员已加入其它分组");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已加入其它分组");
$("#choose_member_notice").show();
});
} else{
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
});
}
<% end %>
<% end %>

View File

@ -1,4 +1,7 @@
<% if @members.count != 0 %>
<div>
<%= link_to "导出作业成绩", export_course_member_excel_course_path(@course, :format => 'xls'), :class => 'link-blue fr mb5'%>
</div>
<table class="muban_table clearfix mb15 t-center" cellpadding="0" cellspacing="0">
<thead>
<tr>

View File

@ -23,6 +23,7 @@
<li><a href="<%= edit_exercise_path(exercise.id) %>" class="postOptionLink" title="编辑试卷">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;辑</a></li>
<% end%>
<li><a href="<%= exercise_path(exercise.id) %>" class="postOptionLink" title="查看试卷">查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;看</a></li>
<li><a href="javascript:void(0)" onclick="send_exercise_to_course();" class="postOptionLink" title="发送到班级">发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送</a></li>
<% if exercise.exercise_status == 1 %>
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
<li><a href="javascript:" class="postOptionLink" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
@ -101,4 +102,11 @@
</div>
<% end%>
<% end%>
<% end%>
<script>
function send_exercise_to_course(){
var htmlvalue = "<%= escape_javascript(render :partial => 'exercise/send_to_course', :locals => {:exercise => exercise}) %>";
pop_box_new(htmlvalue, 450, 325);
}
</script>

View File

@ -153,12 +153,14 @@
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %>
</div>
<div class="ur_buttons" style="width: 220px;">
<div class="ur_buttons" style="width: 298px;">
<%= link_to "返回", exercise_index_path(:course_id => @course.id),:class => "btn_grey_64_width" %>
<a href="javascript:void(0)" onclick="send_exercise_to_course();" class="btn_green_64_width ml10 mr10">发送</a>
<% if exercise.exercise_status == 1 %>
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "btn_blue_64_width" %>
<a class="btn_green_64_width mr10" onclick="$.get('<%= publish_exercise_exercise_path(@exercise) %>');">立即发布</a>
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "btn_blue_64_width" %>
<% else %>
<span class="btn_grey_64_width mr10" title="测验已发布">立即发布</span>
<span class="btn_grey_64_width" title="测验已发布,不可再编辑">编辑</span>
<% end %>
</div>

View File

@ -5,13 +5,13 @@
(<%= @exercise_count%>人已答)
</font>
</span>
<%#if @is_teacher || @exercise.exercise_status == 3%>
<!--<div class="hworkSearchBox">
<input type="text" id="course_student_name" value="<%#= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%#= student_work_index_path(:homework => @homework.id)%>',event);"/>
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%#= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
</div>-->
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<%# end%>
<%if @is_teacher || @exercise.exercise_status == 3%>
<div class="hworkSearchBox">
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_exercise_list_exercise_path(@exercise)%>',event);"/>
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%= student_exercise_list_exercise_path(@exercise)%>');" href="javascript:void(0)"></a>
</div>
<%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@select_group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
<% end %>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" onclick="show_or_hide_info();" style="display: none">[ 显示测验信息 ]</a> </span>
<div class="group_work_tip_box fontGrey2">

View File

@ -47,7 +47,7 @@
<script type="text/javascript">
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
<% if (!@exercise.time.nil? && @exercise.time != -1) || Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$(".student_work_<%= exercise.id%>").mouseenter(function(){
$("#work_click_<%= exercise.id%>").show();
}).mouseleave(function(){

View File

@ -2,5 +2,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
notice_box("发布成功");
<% else %>
notice_box_redirect('<%= exercise_url(@exercise) %>', '发布成功');
notice_box_redirect('<%= exercise_index_path(:course_id => @course.id) %>', '发布成功');
<% end %>

View File

@ -1,5 +1,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
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>'+
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 muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消成功</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
pop_box_new(htmlvalue, 300, 152);

View File

@ -114,7 +114,7 @@
<div class="hworkListContainer">
<div class="ctt2">
<div class="dis" id="homework_student_work_list">
<div class="dis" id="exercise_student_work_list">
<%= render :partial => "exercise/student_exercise"%>
</div>
</div>

View File

@ -0,0 +1,2 @@
$("#exercise_student_work_list").html("<%= escape_javascript(render :partial => 'exercise/student_exercise') %>");
$("#export_student_work").replaceWith("<%= escape_javascript( link_to "导出成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :group => @select_group, :name => @name, :format => 'xls'),:class=>'linkBlue', :id => 'export_student_work') %>");

View File

@ -1,23 +1,24 @@
<script src="/javascripts/jquery.datetimepicker.js" type="text/javascript"></script>
<div id="muban_popup_box" style="width:300px;">
<div id="muban_popup_box" style="width:340px;">
<div class="muban_popup_top">
<h3 class="fl">发布设置</h3>
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="$('#datetimepicker_mask').datetimepicker('destroy');"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear mt15" style="margin-left: 47px;">
<div class="muban_popup_con clear mt15" style="margin-left: 37px;">
<%= form_tag(republish_file_course_file_path(@course,@file), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<div class="mb10">
<label class="fl c_dark f14" style="margin-top: 4px;">延期发布:</label>
<div class="calendar_div fl">
<input type="text" name="publish_time" id="datetimepicker_mask" placeholder="发布时间" style="width: 130px;" class="InputBox fl calendar_input" value="<%=format_time(@file.publish_time) %>">
<input type="text" name="publish_time" id="datetimepicker_mask" readonly="readonly" placeholder="发布时间" style="width: 130px;" class="InputBox fl calendar_input" value="<%=format_time(@file.publish_time) %>">
<%#= calendar_for('attachment_publish_time')%>
</div>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_publish_time();">清空</a>
<span class="fl c_red" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
</div>
<a href="javascript:void(0);" class="fr sy_btn_blue" style="margin-right: 95px;" id="submit_file" onclick="submit_republish_file();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_blue" style="margin-right: 115px;" id="submit_file" onclick="submit_republish_file();">确定</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="$('#datetimepicker_mask').datetimepicker('destroy');hideModal();">取消</a>
<% end %>
</div>
@ -51,6 +52,11 @@
$('#submit_file').parent().submit();
}
}
function reset_publish_time(){
$("#datetimepicker_mask").val('');
$("#reset_time").hide();
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
@ -58,7 +64,13 @@
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
},
onSelectTime:function() {
$("#reset_time").show();
}
});
});
</script>

View File

@ -52,6 +52,7 @@
<div class="calendar_div fl ml10">
<input type="text" name="publish_time" id="datetimepicker_mask" placeholder="发布时间(可选)" style="width: 130px;" class="InputBox fl calendar_input" readonly="readonly">
</div>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_publish_time();">清空</a>
<div class="cl"></div>
<span class="c_red f12" style="margin-top: 4px;" id="publish_time_notice"></span>
<div class="cl"></div>
@ -109,6 +110,10 @@
$('#submit_resource').parent().submit();
<% end %>
}
function reset_publish_time(){
$("#datetimepicker_mask").val('');
$("#reset_time").hide();
}
$(function(){
$('#datetimepicker_mask').datetimepicker({
allowBlank:true,
@ -116,7 +121,13 @@
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
},
onSelectTime:function() {
$("#reset_time").show();
}
});
});
</script>

View File

@ -1,2 +1,2 @@
var htmlvalue = '<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>';
pop_box_new(htmlvalue, 300, 140);
pop_box_new(htmlvalue, 340, 140);

View File

@ -26,8 +26,11 @@
<%= link_to image_tag(url_to_avatar(topic.author), :width => 50,:height => 50,:alt => '贴吧图片'), user_path(topic.author) if topic.author%>
</div>
<div class="postDetailWrap">
<div class="postDetailTitle fl">
<a href="<%= forum_memo_path(topic.forum, topic) %>" class="f14 linkGrey4 fb"><%=topic.subject%></a>
<div class="postDetailTitle" style="display: inline-block;">
<a href="<%= forum_memo_path(topic.forum, topic) %>" class="fl f14 linkGrey4 fb" style="max-width: 550px"><%= topic.subject %></a>
<% if topic.sticky && !params[:id].blank? %>
<span class="fl ml10 red-cir-btn">顶</span>
<% end %>
</div>
<div class="postDetailReply fr">
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>

View File

@ -7,7 +7,7 @@
<%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20">
<ul class="pro_newsetting_con fl">
<ul class="pro_newsetting_con fl" style="max-height: 440px; overflow: auto;">
<li class="mb10 fl">
<label class="pop_box_label fl">迟交扣分&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class="fl w180" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>

View File

@ -7,7 +7,7 @@
<%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:student_path => student_path,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post", :remote => !student_path) do |f|%>
<div class="muban_popup_con clear">
<div class="clear mt15 ml20">
<ul class="pro_newsetting_con fl">
<ul class="pro_newsetting_con fl" style="max-height: 440px; overflow: auto;">
<li class="mb10 fl">
<label class="pop_box_label fl">迟交扣分&nbsp;&nbsp;:&nbsp;</label>
<input type="text" name="late_penalty" id="late_penalty_num" placeholder="0-50" class="fl w180" value="<%= homework.late_penalty%>" onkeyup="check_late_penalty('late_penalty_num')"/>

View File

@ -45,7 +45,7 @@
<% if @homework.homework_type == 1 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.homework_type == 2 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。</p>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
<% end %>

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, 772);
pop_box_new(htmlvalue, 630, 500);
<% 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, 742);
pop_box_new(htmlvalue, 630, 500);
<% 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

@ -94,10 +94,10 @@
</div>
<div class="navHomepageNews" id="user_messages">
<%= link_to "", user_path(User.current), :class => "homepageNewsIcon", :target => "_Blank", :title => "您的所有消息" %>
<%= link_to "", user_path(User.current, :click_user_message => true), :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>
<div ><%= link_to new_message_count, user_path(User.current, :click_user_message => true), :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">

View File

@ -12,7 +12,7 @@
<% elsif ma.course_message_type == "Comment" %>
<li><a href="<%=news_path(ma.course_message.commented.id) %>" target="_blank" title="<%=ma.course_message.author.show_name %> 评论了通知:<%=ma.course_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.course_message.author.show_name %> </span>评论了通知:<%= ma.course_message.commented.title%></a></li>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
<li><a href="<%= (!User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil?) ? new_student_work_path(:homework => ma.course_message.id) : student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了班级作业:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了班级作业:作业标题:<%= ma.course_message.name%></a></li>
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布了班级作业:作业标题:<%= ma.course_message.name%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布了班级作业:作业标题:<%= ma.course_message.name%></a></li>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<li><a href="<%= student_work_index_path(:homework => ma.course_message.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>老师 发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>老师 </span>发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了</a></li>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
@ -59,7 +59,7 @@
<% if ma.course_message.jour_type == 'Course' %>
<li><a href="<%= course_feedback_path(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> 在班级中留言了:<%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span>在班级中留言了:<%= message_content(ma.course_message.notes)%></a></li>
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
<li><a href="<%= homework_common_index_url_in_org(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%></a></li>
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%></a></li>
<% else %>
<% show_name = ma.course_message.jour.reviewer_role != 3 || ma.course_message.user.allowed_to?(:as_teacher, ma.course) %>
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=show_name ? ma.course_message.user.show_name + "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}" : "匿名用户" %> 回复了作品评论:<%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=show_name ? ma.course_message.user.show_name + "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}" : "匿名用户" %> </span>回复了作品评论:<%= message_content(ma.course_message.notes)%></a></li>
@ -101,11 +101,13 @@
<% elsif ma.contest_message_type == "Comment" %>
<li><a href="<%=news_path(ma.contest_message.commented.id) %>" target="_blank" title="<%=ma.contest_message.author.show_name %> 回复了竞赛通知:<%=ma.contest_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.contest_message.author.show_name %> </span>回复了竞赛通知:<%= ma.contest_message.commented.title%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status.nil? %>
<li><a href="<%= User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 ? new_contestant_work_path(:work => ma.contest_message.id) : contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 发布了竞赛题:<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>发布了竞赛题:<%= ma.contest_message.name%></a></li>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 发布了竞赛题:<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>发布了竞赛题:<%= ma.contest_message.name%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 1 %>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 发布的竞赛题:<%= ma.contest_message.name%>的截止日期快到了"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>发布的竞赛题:<%= ma.contest_message.name%>的截止时间快到啦</a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 2 %>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 启动了在线评审:<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>启动了在线评审:<%= ma.contest_message.name%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 3 %>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 关闭了在线评审:<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>关闭了在线评审:<%= ma.contest_message.name%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 4 %>
<li><a href="<%= contestant_works_path(:work => ma.contest_message.id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> 在线评审启动失败(评委数为0或作品数为0)<%= ma.contest_message.name%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span>在线评审启动失败(评委数为0或作品数为0)<%= ma.contest_message.name%></a></li>
<% elsif ma.contest_message_type == "Work" && ma.status == 5 %>
@ -137,7 +139,10 @@
<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 %>
<li><a href="<%=settings_contest_path(ma.contest_id, :tab=>'member') %>" target="_blank" title="系统提示 您增加了新的竞赛成员:<%= User.find(ma.contest_message_id).login+"("+User.find(ma.contest_message_id).show_name+")"%>"><span class="shadowbox_news_user">系统提示 </span>您增加了新的竞赛成员:<%= User.find(ma.contest_message_id).login+"("+User.find(ma.contest_message_id).show_name+")"%></a></li>
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 2 %>
<% user = User.find(ma.contest_message_id) %>
<li><a href="<%=contest_path(ma.contest) %>" target="_blank" title="<%=user.show_name %> <%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? '' : '来自'+user.user_extensions.school.name+'' %>以'参赛者'的身份加入了竞赛:<%= ma.contest.name%>"><span class="shadowbox_news_user"><%=user.show_name %> </span><%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? '' : '来自'+user.user_extensions.school.name+'' %>以'参赛者'的身份加入了竞赛:<%= ma.contest.name%></a></li>
<% elsif ma.contest_message_type == "RemoveFromContest" %>
<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>
<% end %>
<% elsif ma.class == AppliedMessage %>

View File

@ -318,6 +318,8 @@
len = t.length;
for(var i=0;i<len;i++){
t[i].href = 'javascript:void(0)';
// 火狐浏览器点击弹开空白页
t[i].target = '_self';
}
// 退出按钮可用
var d = document.getElementById("logout_trustie");

View File

@ -6,7 +6,16 @@
<div class="wenba-tiwen-con">
<ul >
<li class="mb10">
<%= f.text_field :subject, :no_label => true, :id => "memo_subject", :maxlength => "50", :style => "width:708px", :onblur => "check_memo_name();", :onfocus => "$('#memo_name_error_tips').hide();", :onmouseover => "this.style.borderColor='#d9d9d9'", :class => "wenba-tiwen-input", :placeholder => "请输入标题" %>
<%= f.text_field :subject,
:no_label => true,
:id => "memo_subject",
:maxlength => "50",
:style => "width:708px",
:onblur => "check_memo_name();",
:onfocus => "$('#memo_name_error_tips').hide();",
:onmouseover => "this.style.borderColor='#d9d9d9'",
:class => "wenba-tiwen-input",
:placeholder => "请输入标题" %>
<p class="c_red" style="display: none" id="memo_name_error_tips"></p>
<script>
var textarea1 = document.getElementById('memo_subject');

View File

@ -34,6 +34,13 @@
<% if @memo.author.id == User.current.id || User.current.admin? %>
<li><a href="<%= edit_forum_memo_path(@memo.forum,@memo)%>" class="postOptionLink">编辑</a></li>
<% end %>
<% if User.current.admin? || User.current == @forum.creator %>
<% if @memo.sticky %>
<li><a href="<%= change_sticky_forum_memo_path(@memo.forum,@memo) %>" class="postOptionLink">取消置顶</a></li>
<% else %>
<li><a href="<%= change_sticky_forum_memo_path(@memo.forum,@memo) %>" class="postOptionLink">置顶</a></li>
<% end %>
<% end %>
<li><a href="javascript:void(0);" class="postOptionLink" onclick="del_confirm();">删除</a></li>
<li style="display: none"><a href="<%= forum_memo_path(@memo.forum, @memo) %>" data-method="delete" id="del_memo_link" ></a></li>
</ul>

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
@ -105,11 +105,18 @@
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "grey_btn fr c_white mt10 mr5 ml10" %>
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
<% end %>
<div nhname='new_message_<%= @topic.id%>' style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<input type="hidden" name="journal_id" value="<%= @topic.id %>"/>
<div nhname='toolbar_container_<%= @topic.id %>' ></div>
<div class="cl"></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @topic.id%>' name="content"></textarea>
<div class="cl"></div>
<span nhname='contentmsg_<%= @topic.id%>' class="fl"></span>
<a id="new_message_submit_btn_<%= @topic.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -32,7 +32,7 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
@ -88,7 +88,7 @@
}
}
$(function() {
sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%= @topic.class.to_s %>");
showNormalImage('message_description_<%= @topic.id %>');
});
</script>
@ -165,11 +165,21 @@
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "grey_btn fr c_white mt10 mr5 ml10" %>
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
<% end %>
<div nhname='new_message_<%= @topic.id%>' style="display:none;">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%#= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
<%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "grey_btn fr c_white mt10 mr5 ml10" %>
<%#= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
<input type="hidden" name="journal_id" value="<%= @topic.id %>"/>
<div nhname='toolbar_container_<%= @topic.id %>' ></div>
<div class="cl"></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @topic.id%>' name="content"></textarea>
<div class="cl"></div>
<span nhname='contentmsg_<%= @topic.id%>' class="fl"></span>
<a id="new_message_submit_btn_<%= @topic.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -1,15 +1,29 @@
<%if @project%>
<% if params[:is_project] %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/act_messages', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% else %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<% if @project %>
<% if params[:is_project] %>
$("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/act_messages',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id,
:is_course => @is_course,
:is_board => @is_board}) %>");
// ForgeActivity是具体项目的动态UserActivity是社区的动态
// sd_create_editor_from_data(<%#= @user_activity_id %>, "", "100%", "ForgeActivity");
<% else %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<%elsif @course%>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%elsif @contest%>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/contest_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<% end %>
<% elsif @course %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<% elsif @contest %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/contest_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<% elsif @org_subfield %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply',
:locals => { :activity => @topic,
:user_activity_id => @user_activity_id}) %>");
<% end %>
sd_create_editor_from_data(<%= @user_activity_id %>, "", "100%", "UserActivity");

View File

@ -40,7 +40,16 @@
<li>&nbsp;&nbsp;</li>
</ul>
<ul class="setting_right ">
<li><%= f.text_field :login,:no_label=>true, :required => true, :style => "color:grey", :nh_required => "1", :name => "login", :class => "w210" %></li>
<li>
<%= f.text_field :login,
:no_label => true,
:required => true,
:style => "color:grey",
:nh_required => "1",
:name => "login",
:class => "w210"
%>
</li>
<% if @force %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%></li>
<% else %>

View File

@ -221,6 +221,7 @@
},
success:function(){
if(!$is_exist){
$("#apply_hint").text("");
$.ajax({
url:"<%= apply_subdomain_organization_path %>",
type:'post',

View File

@ -1,3 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<div class="container-big mt10" id="user_activity_<%= user_activity_id%>">
<div class="pr">
<div class="homepagePostPortrait">

View File

@ -1,10 +1,16 @@
<div class="orig_user fl">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
</div>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<div class="orig_right fl" style="width: 93%;" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %>
<span class="orig_area"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
<div class="orig_content ">
<div class="orig_content" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>

View File

@ -1,10 +1,16 @@
<div class="orig_user fl">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
</div>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<div class="orig_right fl">
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %>
<span class="orig_area"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
<div class="orig_content ">
<div class="orig_content" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>

View File

@ -1,10 +1,16 @@
<div class="orig_user fl">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
</div>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<div class="orig_right fl" style="width: 93%;" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %>
<span class="orig_area"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
<div class="orig_content ">
<div class="orig_content" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>

View File

@ -57,7 +57,13 @@
</li>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_project();" >提交</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
<% if @course %>
<%= link_to "取消",homework_common_index_path(:course => @course.id),:class => "grey_btn fl c_white ml10"%>
<% elsif @contest %>
<%= link_to "取消",works_path(:contest => @contest.id),:class => "grey_btn fl c_white ml10"%>
<% else %>
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
<% end %>
<div class="cl"></div>
</li>
<% end%>

View File

@ -22,6 +22,7 @@
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<span class="c_red fl" id="choose_member_notice"></span>
<div class="cl"></div>
</div>
<script type="text/javascript">
@ -82,10 +83,8 @@
}
function delete_student(id) {
$("#choose_member_notice").hide();
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){

View File

@ -5,7 +5,7 @@
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</span>
</span>

View File

@ -48,7 +48,7 @@
<% end %>
<td class="<%= @homework.homework_type ==2 ? 'hworkList110' : 'hworkList130' %> c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</td>
<td class="hworkList70 <%= score_color (!score_open || student_work.teacher_score.nil? ? nil : student_work.teacher_score)%>">
@ -107,7 +107,7 @@
<em></em>
<font></font>
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where("reviewer_role = 3 and appeal_status != 3").group_by(&:user_id).count%>&nbsp;</span>
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.student_score)%>&nbsp;</span>分。
</div>

View File

@ -72,7 +72,7 @@
<% end%>
<td class="hworkList130 pl10 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<%= get_status student_work.work_status, student_work.re_commit %>
<% end %>
</td>

View File

@ -11,7 +11,7 @@
</div>
<div class="cl"></div>
<% if homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name, :course_id => homework.course_id),:class=>"linkBlue",:target => "_blank",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>

View File

@ -16,7 +16,7 @@
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">
截止时间:<%= @homework.end_time%>
截止时间:<%= format_time @homework.end_time%>
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class="c_blue">

View File

@ -4,11 +4,18 @@ sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% if @homework.anonymous_comment == 0 %>
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="muban_popup_con ml30 mr30 mt20 mb10 clear"><p class="mb10 f14 text_c">将于7天后自动启动该作业的匿评</p><p class="mb10 f14 text_c">您可以在匿评设置中进行修改</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" style="margin-left: 142px;" onclick="hideModal();">知道啦</a></div></div>';
pop_box_new(htmlvalue, 400, 178);
<% else %>
hideModal();
<% end %>
var str = "";
<% case @status %>
<% when 0 %>
str = "请于作业发布后再进行操作";
<% when 1 %>
str = "作业已禁用匿评";
<% when 2 %>
str = "将于7天后自动启动该作业的匿评<br/>您可以在匿评设置中进行修改";
<% when 3 %>
str = "将于作业截止7天后自动启动该作业的匿评<br/>您可以在匿评设置中进行修改";
<% end %>
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="muban_popup_con ml30 mr30 mt20 mb10 clear"><p class="mb10 f14 text_c">' + str + '</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" style="margin-left: 142px;" onclick="hideModal();">知道啦</a></div></div>';
pop_box_new(htmlvalue, 400, 178);

View File

@ -222,7 +222,7 @@
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">
截止时间:<%= @homework.end_time%>
截止时间:<%= format_time @homework.end_time%>
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class="c_blue">

View File

@ -21,22 +21,39 @@ $("#all_students_list").empty();
}
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
$("#student_<%=user.id %>").on("click",function choose_student() {
if($("#choose_student_<%=user.id %>").length > 0){
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
} else{
$("#choose_member_notice").hide();
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
$("#choose_students_list").append(li);
}
});
}
<% elsif !user.member_of_course?(@course) %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该项目成员不是本班级的学生");
$("#choose_member_notice").show();
});
}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该学生已加入其它分组");
$("#choose_member_notice").show();
});
} else{
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
});
}
<% end %>
<% end %>

View File

@ -1,17 +1,25 @@
<br>
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
</br>
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.not_deleted.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a>
<% else %>
<a href='javascript:void(0);' class='Blue-btn' style="margin-left: 50px;" onclick='hideModal()'>取消</a>
<% end %>
<div id="muban_popup_box" style="width:470px;">
<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 style='text-align:center;font-family: "微软雅黑","宋体"' class="mt20 f14">
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
<% end %>
</div>
<div style='width:164px; margin:0 auto; margin-top: 15px; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.not_deleted.empty? %>
<a href='javascript:void(0);' class='sy_btn_grey fl mr5' style="margin-left: 25px;" onclick='hideModal()'>取消</a>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'sy_btn_blue fl', :method => 'delete'%>
<% else %>
<a href='javascript:void(0);' class='sy_btn_blue' onclick='hideModal()'>确定</a>
<% end %>
<div class="cl"></div>
</div>
</div>

View File

@ -68,11 +68,34 @@
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%>
<% end %>
<% if User.current == course.teacher || User.current.admin? %>
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0, 1);" class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0, 1);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px; right: -275px;">
<em></em>
<span></span>
<p class="mt5 mb5 break_word">
此班级的信息将不再显示<br/>
您和您的学生将不能在此班级中继续互动<br/>
但您可以点击“归档管理”重新恢复
</p>
</div>
</div>
<% end %>
<% else %>
<% if User.current == course.teacher || User.current.admin? %>
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1, 1);" class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1, 1);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px; right: -275px; top: -10px;">
<em style="top: 21px;"></em>
<span style="top: 21px;"></span>
<p class="mt5 mb5 break_word">
此班级的信息将恢复显示<br/>
您和您的学生将可以重新在此班级中互动
</p>
</div>
</div>
<% end %>
<% end %>
<div class="cl"></div>

View File

@ -1,2 +1,2 @@
var htmlvalue = "<%=escape_javascript(render :partial => 'delete_syllabus') %>";
pop_up_box(htmlvalue,500,30,50);
pop_box_new(htmlvalue, 470, 30);

View File

@ -1,10 +1,16 @@
<div class="orig_user fl">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user), :alt => "用户头像" %>
</div>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<div class="<%= type == 'TrainingTask' ? 'new_orig_right fl' : 'orig_right fl' %>" onmouseout="$(this).find('.reply-right').hide();" onmouseover="$(this).find('.reply-right').show();">
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user), :class => "content-username" %>
<span class="orig_area"><%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %></span>
<div class="orig_content">
<div class="orig_content" id="reply_content_<%= comment.id %>">
<% if comment.class == Journal %>
<% if comment.details.any? %>
<% details_to_strings(comment.details).each do |string| %>

View File

@ -29,7 +29,7 @@
<div class="cl"></div>
<% if activity.work_type == 3 && activity.work_detail_group.base_on_project %>
<span class="c_red">系统提示:该题目要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<span class="c_red">系统提示:该题目要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name, :contest_id => activity.contest_id),:target => "_blank",:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif activity.work_type == 3 && !activity.work_detail_group.base_on_project%>
<span class="c_red">系统提示:该题目要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>

View File

@ -27,7 +27,7 @@
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name, :course_id => activity.course_id),:target => "_blank",:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>

View File

@ -1,3 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
<% count = all_replies.count %>
<% no_children_comments = get_no_children_comments all_replies %>

View File

@ -26,9 +26,9 @@
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, <%=course.is_delete %>, 0);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5 mr15" style="width: 56px;"><%= course.is_delete == 0 ? '归档' : '恢复' %></a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px;">
<em></em>
<span></span>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px; top: -10px;">
<em style="top: 21px;"></em>
<span style="top: 21px;"></span>
<p class="mt5 mb5 break_word">
<% if course.is_delete == 0 %>
此班级的信息将不再显示<br/>

View File

@ -4,7 +4,7 @@
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start.nil? ? '--' : (activity.homework_detail_manual.evaluation_start.to_s+" 00:00") %>
</div>
<% end %>
</div>
@ -15,7 +15,7 @@
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end.nil? ? '--' : (activity.homework_detail_manual.evaluation_end.to_s+" 00:00") %>
</div>
<% end %>
</div>
@ -111,12 +111,12 @@
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<% if activity.anonymous_comment == 0 && comment_status == 1 %>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% elsif activity.anonymous_comment == 1 %>
<% elsif activity.anonymous_comment == 1 && comment_status > 0 %>
<li>
<%= link_to("启用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "wpostOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>

View File

@ -46,7 +46,7 @@
<li>
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
</li>
<% if User.current == syllabus.user %>
<% if User.current == syllabus.user || User.current.admin? %>
<li><%=link_to '删除课程', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
<% end %>
</ul>

View File

@ -68,7 +68,15 @@
format:'Y-m-d H:i',
formatTime:'H:i',
formatDate:'Y-m-d',
validateOnBlur:false
validateOnBlur:false,
onSelectDate:function() {
$("#reset_time").show();
$("#homework_publish_time_div").show();
},
onSelectTime:function() {
$("#reset_time").show();
$("#homework_publish_time_div").show();
}
});
<% end %>
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
@ -94,6 +102,7 @@
function reset_end_time(){
$("#homework_end_time").val('');
$("#homework_publish_time").val('');
$("#reset_time").hide();
$("#homework_publish_time_div").hide();
}
@ -280,7 +289,7 @@
<%# end %>
</div>
<% if !edit_mode || (edit_mode && homework.homework_detail_manual.comment_status.to_i < 1) %>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" onclick="reset_end_time();">清空</a>
<a href="javascript:void(0)" id="reset_time" class="fl sy_btn_grey ml10" style="display: none;" onclick="reset_end_time();">清空</a>
<% end %>
<div class="fl <%= homework.publish_time.nil? ? 'none' : '' %> ml50" id="homework_publish_time_div">
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布时间(可选):</label>
@ -359,6 +368,7 @@
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
<% end %>
<p id="modify_inputs_notice" class="mt3 fr none c_red mr10"></p>
<div class="cl"></div>
</div>
</div>

View File

@ -46,7 +46,7 @@
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--被管理员拉入竞赛-->
<!--被管理员拉入竞赛:学生身份-->
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 0 %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
@ -64,7 +64,7 @@
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--被管理员拉入竞赛-->
<!--被管理员拉入竞赛:老师身份-->
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
@ -85,6 +85,32 @@
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--主动加入竞赛-->
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 2 %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<% user = User.find(ma.contest_message_id) %>
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl">
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30"), user_path(user), :target => '_blank' %>
</div>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">
<%=link_to user.show_name, user_path(user),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %></span>
<span class="homepageNewsType fl">
<%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"" %>
以"参赛者"的身份加入了竞赛:
</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--被老师移出课程-->
<% elsif ma.contest_message_type == "RemoveFromContest" %>
<ul class="homepageNewsList fl">
@ -115,19 +141,11 @@
<span class="homepageNewsType fl">发布了竞赛题:</span>
</li>
<li class="messageInformationContents">
<% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 %>
<%= link_to ma.contest_message.name, new_contestant_work_path(:work => ma.contest_message.id),
:class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
<% else %>
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
<% end %>
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
@ -176,6 +194,24 @@
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--关闭在线评审-->
<% elsif ma.contest_message_type == "Work" && ma.status == 3 && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">关闭了在线评审:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => "_blank"%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--在线评审启动失败-->
<% elsif ma.contest_message_type == "Work" && ma.status == 4 && ma.contest_message %>
<ul class="homepageNewsList fl">
@ -188,7 +224,7 @@
<span class="homepageNewsType fl">在线评审启动失败<font class="c_red">(评委数为0或作品数为0)</font></span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}"%>
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => "_blank" %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -66,23 +66,11 @@
<span class="homepageNewsType fl">发布了班级作业:</span>
</li>
<li class="messageInformationContents">
<% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
<%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "作业标题:#{ma.course_message.name}"
%>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
<% else %>
<%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "作业标题:#{ma.course_message.name}"
%>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
<% end %>
<%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "作业标题:#{ma.course_message.name}"
%>
</li>
</div>
<div style="display: none" class="message_title_red system_message_style">
@ -490,7 +478,7 @@
</span>
</li>
<li class="messageInformationContents">
<%= link_to message_content(ma.course_message.notes), homework_common_index_url_in_org( ma.course_id),
<%= link_to message_content(ma.course_message.notes), student_work_index_path(:homework => ma.course_message.jour.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->

View File

@ -41,3 +41,19 @@
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.message_type == 'DisagreeApplySubdomain'%>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div>
</li>
<li class="homepageNewsPubType fl">
<span class='homepageNewsType fl'>管理员拒绝了您的子域名申请:</span>
</li>
<li class="messageInformationContents">
<%= ma.content %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -14,7 +14,7 @@
</li>
<li class="messageInformationContents">
<%= link_to message_content(ma.journals_for_message.notes),
feedback_path(ma.journals_for_message.jour_id,
feedback_path(ma.journals_for_message.reply_id == 0 ? ma.journals_for_message.jour_id : ma.journals_for_message.user_id,
:anchor => "user_activity_#{ma.journals_for_message.id}"),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank'%>

View File

@ -8,15 +8,13 @@
<% homework.homework_samples.each_with_index do |sample, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="sample_inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox w547 fl mr5" placeholder="样例输入" name="sample[input][]" <%= not_allow_select ? 'disabled' : '' %>><%= sample.input %></textarea>
<% unless not_allow_select %>
<a href="javascript:void(0);" class="fl icon_add sample_icon_add" title="增加样例组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class="fl icon_remove sample_icon_remove" title="删除样例组"></a>
<% end %>
<textarea class="InputBox w547 fl mr5" placeholder="样例输入" name="sample[input][]"><%= sample.input %></textarea>
<a href="javascript:void(0);" class="fl icon_add sample_icon_add" title="增加样例组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class="fl icon_remove sample_icon_remove" title="删除样例组"></a>
<% end %>
<div class="cl"></div>
<textarea class="InputBox w547 fl ml30 mt10" placeholder="样例输出" name="sample[output][]" <%= not_allow_select ? 'disabled' : '' %>><%= sample.output %></textarea>
<textarea class="InputBox w547 fl ml30 mt10" placeholder="样例输出" name="sample[output][]"><%= sample.output %></textarea>
<div class="cl"></div>
</div>
<% end %>
@ -40,17 +38,16 @@
<span class="f12 c_red mt5 fr">温馨提示:您可以在发布作业后,在作业"模拟答题"中进行标准代码的检测。</span>
<div class="cl"></div>
<div id="input_boxes_div">
<% if edit_mode && homework.is_program_homework? %>
<% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]" <%= not_allow_select ? 'disabled' : '' %>><%= test.input %></textarea>
<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]" <%= not_allow_select ? 'disabled' : '' %>><%= test.output %></textarea>
<% unless not_allow_select %>
<a href="javascript:void(0);" class=" fl icon_add test_icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove test_icon_remove" title="删除测试组"></a>
<% end %>
<textarea class="InputBox w265 fl mr10" placeholder="测试输入" name="program[input][]"><%= test.input %></textarea>
<textarea class="InputBox w265 fl mr5" placeholder="测试输出" name="program[output][]"><%= test.output %></textarea>
<a href="javascript:void(0);" class=" fl icon_add test_icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove test_icon_remove" title="删除测试组"></a>
<% end %>
<div class="cl"></div>
</div>
@ -65,6 +62,7 @@
<div class="cl"></div>
</div>
<% end %>
</div>
</div>
</div>
@ -74,6 +72,10 @@
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
<% if not_allow_select %>
$("#input_boxes_div .InputBox").on('focus', modify_input_notice);
<% end %>
$("#programHomework").on('click', 'a.test_icon_add', function () {
var html = bt('t:test-answer-list', null);
$(this).parent('.mt10').after(html);
@ -90,6 +92,9 @@
}
}
$(inputs[inputs.length - 1]).focus();
<% if not_allow_select %>
$("#input_boxes_div .InputBox").on('focus', modify_input_notice);
<% end %>
});
$("#programHomework").on('click', 'a.test_icon_remove', function () {
$(this).parent('.mt10').remove();
@ -152,4 +157,9 @@
}
}
<% end %>
function modify_input_notice(){
$("#modify_inputs_notice").html("修改测试集后请通知学生重新提交作品");
$("#modify_inputs_notice").show();
}
</script>

View File

@ -1,11 +1,11 @@
<% work = cur_user_works_for_work activity %>
<% if activity.work_type == 3 && User.current.contestant_of_contest?(activity.contest) && activity.work_detail_group.base_on_project %>
<% projects = cur_user_projects_for_work activity %>
<% if work.nil? && projects.nil? && activity.work_status == 1 %>
<% if work.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_contestant_works_path(:work => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联项目' %>
</div>
<% elsif work.nil? && activity.work_status == 1 %>
<% elsif work.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_contestant_works_path(:work => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>

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