Merge branch 'develop' into dev_bigdata

Conflicts:
	app/views/layouts/_logined_header.html.erb
	app/views/layouts/base_courses.html.erb
This commit is contained in:
ccccx 2017-01-23 21:01:07 +08:00
commit 45453a9857
87 changed files with 3765 additions and 3342 deletions

View File

@ -759,6 +759,9 @@ class AdminController < ApplicationController
# status: 0表示未批准 status1表示已批准 status 2表示已更改 status 3表示已拒绝 # status: 0表示未批准 status1表示已批准 status 2表示已更改 status 3表示已拒绝
def approve_applied_schools def approve_applied_schools
applied_school = ApplyAddSchools.find params[:id] applied_school = ApplyAddSchools.find params[:id]
applied_message_id = applied_school.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 1)
applied_school.update_column('status', 1) unless applied_school.nil? applied_school.update_column('status', 1) unless applied_school.nil?
school = applied_school.school school = applied_school.school
school.update_attribute("province", applied_school.province) school.update_attribute("province", applied_school.province)
@ -778,6 +781,10 @@ class AdminController < ApplicationController
#applied_add_school = ApplyAddSchools.where(:name => aas.name) #applied_add_school = ApplyAddSchools.where(:name => aas.name)
school = School.find params[:school_id] school = School.find params[:school_id]
begin begin
#更新消息表的status
applied_message_id = aas.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 2)
aas.update_attribute(:status, 2) aas.update_attribute(:status, 2)
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name ) AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
users = UserExtensions.where("school_id = #{aas.school_id}") users = UserExtensions.where("school_id = #{aas.school_id}")
@ -816,6 +823,9 @@ class AdminController < ApplicationController
# 单位审核:删除 # 单位审核:删除
def delete_applied_schools def delete_applied_schools
applied_school = ApplyAddSchools.find(params[:id]) applied_school = ApplyAddSchools.find(params[:id])
applied_message_id = applied_school.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 3)
applied_school.update_attribute(:status, 3) applied_school.update_attribute(:status, 3)
# 未审批删除 # 未审批删除
if params[:tip] == "unapplied" if params[:tip] == "unapplied"

View File

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

View File

@ -113,6 +113,8 @@ class BoardsController < ApplicationController
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true) ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
elsif @course elsif @course
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true) CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
elsif @contest
ContestMessage.where("user_id =? and contest_id =? and viewed =?", User.current.id, @contest.id, 0).update_all(:viewed => true)
end end
# sort_init 'updated_on', 'desc' # sort_init 'updated_on', 'desc'

View File

@ -8,7 +8,7 @@ class ContestsController < ApplicationController
helper :files helper :files
include AvatarHelper include AvatarHelper
before_filter :find_contest, :only => [:show, :settings, :update, :destroy, :contest_activities, :search_member, :private_or_public, :switch_role, :set_invite_code_halt, :renew, before_filter :find_contest, :only => [:show, :settings, :update, :destroy, :contest_activities, :private_or_public, :switch_role, :set_invite_code_halt, :renew,
:member, :export_all_members, :feedback] :member, :export_all_members, :feedback]
before_filter :is_logged, :only => [:index, :new, :create] before_filter :is_logged, :only => [:index, :new, :create]
before_filter :is_admin?, :only => [:settings, :set_invite_code_halt, :destroy] before_filter :is_admin?, :only => [:settings, :set_invite_code_halt, :destroy]
@ -17,6 +17,9 @@ class ContestsController < ApplicationController
layout "base_contests" layout "base_contests"
def show def show
#更新创建课程消息状态
contest_request_messages = ContestMessage.where("user_id = #{User.current.id} and contest_id = #{@contest.id} and contest_message_type in ('ContestRequestDealResult', 'JoinContest', 'RemoveFromContest') and viewed = 0")
contest_request_messages.update_all(:viewed => true)
@left_nav_type = 1 @left_nav_type = 1
respond_to do |format| respond_to do |format|
@ -26,10 +29,6 @@ class ContestsController < ApplicationController
end end
def contest_activities def contest_activities
#更新创建课程消息状态
contest_request_messages = ContestMessage.where(:user_id => User.current.id, :contest_id => @contest.id, :contest_message_type => "ContestRequestDealResult", :viewed => false)
contest_request_messages.update_all(:viewed => true)
contest_activities = @contest.contest_activities contest_activities = @contest.contest_activities
@page = params[:page] ? params[:page].to_i + 1 : 0 @page = params[:page] ? params[:page].to_i + 1 : 0
if params[:type].present? if params[:type].present?
@ -247,20 +246,6 @@ class ContestsController < ApplicationController
redirect_to contest_path(@contest) redirect_to contest_path(@contest)
end end
def search_member
if User.current.admin_of_contest?(@contest) || User.current.admin?
q = "#{params[:name].strip}"
@roles = Role.givable.all[11..13]
if q.nil? || q == ""
@members = @contest.member_principals.includes(:roles, :principal).all.sort
else
@members = searchmember_by_name(@contest.member_principals.includes(:roles, :principal).all.sort,q)
end
else
render_403
end
end
# 邀请码停用/启用 # 邀请码停用/启用
def set_invite_code_halt def set_invite_code_halt
if User.current.admin_of_contest?(@contest) || User.current.admin? if User.current.admin_of_contest?(@contest) || User.current.admin?

View File

@ -500,7 +500,7 @@ class CoursesController < ApplicationController
end end
def export_course_member_excel def export_course_member_excel
q = "#{params[:name].strip}" q = params[:name] ? "#{params[:name].strip}" : ""
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1" if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
group = CourseGroup.find params[:group_id] group = CourseGroup.find params[:group_id]
unless group.nil? unless group.nil?
@ -630,11 +630,6 @@ class CoursesController < ApplicationController
join_course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and status = ? and viewed =?", User.current.id, 'JoinCourse', @course.id, 1, 0) join_course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and status = ? and viewed =?", User.current.id, 'JoinCourse', @course.id, 1, 0)
join_course_messages.update_all(:viewed => true) join_course_messages.update_all(:viewed => true)
if params[:tab] && params[:tab] == 'boards'
@tab = 4
else
@tab = 0
end
if User.current.allowed_to?(:as_teacher,@course) if User.current.allowed_to?(:as_teacher,@course)
@select_tab = params[:tab] @select_tab = params[:tab]
@issue_custom_fields = IssueCustomField.sorted.all @issue_custom_fields = IssueCustomField.sorted.all
@ -644,6 +639,14 @@ class CoursesController < ApplicationController
@roles = Role.givable.all[3..5] @roles = Role.givable.all[3..5]
@members = @course.member_principals.includes(:roles, :principal).all.sort @members = @course.member_principals.includes(:roles, :principal).all.sort
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{@course.id}").map(&:organization_id)
if course_org_ids.empty?
@orgs_not_in_course = User.current.organizations
else
course_org_ids = "(" + course_org_ids.join(',') + ")"
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids}")
end
respond_to do |format| respond_to do |format|
format.html { render :layout => 'base_courses' } format.html { render :layout => 'base_courses' }
format.api { render_validation_errors(@course) } format.api { render_validation_errors(@course) }
@ -1160,6 +1163,7 @@ class CoursesController < ApplicationController
page = params[:page] page = params[:page]
# Find the page of the requested reply # Find the page of the requested reply
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jour_count = @jours.count
@limit = 10 @limit = 10
if params[:r] && page.nil? if params[:r] && page.nil?
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
@ -1367,9 +1371,25 @@ class CoursesController < ApplicationController
end end
#统计 #统计
def statistics_course def course_statistics
@left_nav_type = 10 @left_nav_type = 10
# @order = params[:order] ? params[:order] : 'desc'
# if !params[:tab] || params[:tab] == "activity"
# @type = params[:type] ? params[:type] : 'act_score'
# sql = "SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 + resource_num*5 + journal_num*1 + homework_journal_num*1) AS act_score,
# message_num, message_reply_num, news_reply_num, news_num, resource_num, journal_num, homework_journal_num, ccs.user_id FROM course_contributor_scores ccs
# JOIN students_for_courses ON students_for_courses.course_id = ccs.course_id AND students_for_courses.student_id = ccs.user_id
# WHERE ccs.course_id = #{@course.id} HAVING act_score != 0 ORDER BY #{@type} #{@order}, act_score #{@order}"
# @members = CourseContributorScore.find_by_sql(sql)
# end
#
# @limit = 20
# @page = params[:page].nil? ? 1 : params['page'].to_i
# @members_count = @members.count
# @mem_pages = Paginator.new @members_count, @limit, @page
# @members = paginateHelper @members, @limit
respond_to do |format| respond_to do |format|
format.js
format.html {render :layout => 'base_courses'} format.html {render :layout => 'base_courses'}
end end
end end

View File

@ -352,7 +352,9 @@ class MembersController < ApplicationController
role_ids = attrs.delete(:role_ids) role_ids = attrs.delete(:role_ids)
if role_ids && role_ids.include?("10") if role_ids && role_ids.include?("10")
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id) if StudentsForCourse.where(:student_id => @member.user_id, :course_id =>@course.id).blank?
StudentsForCourse.create(:student_id => @member.user_id, :course_id =>@course.id)
end
else else
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id) joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
joined.each do |join| joined.each do |join|

View File

@ -240,10 +240,13 @@ class NewsController < ApplicationController
# 更新新闻 # 更新新闻
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
# 更新新闻的时候一并更新回复 # 更新新闻的时候一并更新回复
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank? ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
else elsif @course
query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank? CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
elsif @contest
query_message_news = ContestMessage.where("contest_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
ContestMessage.where("contest_message_id in (#{ids}) and contest_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
end end
query_message_news.update_attribute(:viewed, true) unless query_message_news.nil? query_message_news.update_attribute(:viewed, true) unless query_message_news.nil?
# over # over

View File

@ -16,5 +16,15 @@ class OrgCoursesController < ApplicationController
@course = Course.find(params[:course_id]) @course = Course.find(params[:course_id])
@org_course = OrgCourse.find(params[:id]) @org_course = OrgCourse.find(params[:id])
@org_course.destroy @org_course.destroy
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{@course.id}").map(&:organization_id)
if course_org_ids.empty?
@orgs_not_in_course = User.current.organizations
else
course_org_ids = "(" + course_org_ids.join(',') + ")"
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids}")
end
respond_to do |format|
format.js
end
end end
end end

View File

@ -1055,6 +1055,31 @@ class StudentWorkController < ApplicationController
end end
no_anon_penalty = params[:no_anon_penalty] ? 0 : 1 no_anon_penalty = params[:no_anon_penalty] ? 0 : 1
if (params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s)
homework_detail_manual.absence_penalty = params[:absence_penalty]
homework_detail_manual.save if homework_detail_manual
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
@homework.student_works.where("work_status != 0").each do |student_work|
if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count != 0
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
else
if no_anon_penalty
student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count
else
student_work.absence_penalty = 0
end
end
student_work.save
end
end
end
if no_anon_penalty != homework_detail_manual.no_anon_penalty if no_anon_penalty != homework_detail_manual.no_anon_penalty
homework_detail_manual.no_anon_penalty = no_anon_penalty homework_detail_manual.no_anon_penalty = no_anon_penalty
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值 if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
@ -1076,19 +1101,6 @@ class StudentWorkController < ApplicationController
homework_detail_manual.save if homework_detail_manual homework_detail_manual.save if homework_detail_manual
end end
if (params[:absence_penalty] && homework_detail_manual.absence_penalty.to_s != params[:absence_penalty].to_s)
homework_detail_manual.absence_penalty = params[:absence_penalty]
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
@homework.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
end
homework_detail_manual.save if homework_detail_manual
end
if params[:ta_mode] && homework_detail_manual.ta_mode.to_i != params[:ta_mode].to_i if params[:ta_mode] && homework_detail_manual.ta_mode.to_i != params[:ta_mode].to_i
homework_detail_manual.ta_mode = params[:ta_mode].to_i homework_detail_manual.ta_mode = params[:ta_mode].to_i
homework_detail_manual.save homework_detail_manual.save

View File

@ -191,7 +191,7 @@ class UsersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html{render :layout => 'static_base'} format.html{render :layout => 'static_base'}
format.xls{ format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls" filename = "我发布的#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
} }
format.api format.api
@ -237,7 +237,7 @@ class UsersController < ApplicationController
respond_to do |format| respond_to do |format|
format.html{render :layout => 'static_base'} format.html{render :layout => 'static_base'}
format.xls{ format.xls{
filename = "发布的_#{l(:label_issue_list_xls)}.xls" filename = "收到的#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
} }
format.api format.api
@ -2023,39 +2023,44 @@ class UsersController < ApplicationController
reorder("#{MessageAll.table_name}.created_at desc") reorder("#{MessageAll.table_name}.created_at desc")
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count @unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).count
# 用户待完成的作业
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course). my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).
where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")" where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
# 用户待完成的作业
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'") homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")" homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0") student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
@unfinished_homework_count = homeworks.count - student_works.count @unfinished_homework_count = homeworks.count - student_works.count
# 用户待完成的测验 # 用户待完成的测验
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2") exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
exercise_ids = exercises.blank? ? "(-1)" : "(" + exercises.map{|ex| ex.id}.join(",") + ")" exercise_users = ExerciseUser.where(:user_id => @user.id, :exercise_id => exercises.map{|ex| ex.id})
exercise_users = ExerciseUser.where("user_id = #{@user.id} and exercise_id in #{exercise_ids}")
@unfinished_test_count = exercises.count - exercise_users.count @unfinished_test_count = exercises.count - exercise_users.count
# 用户待完成的问卷 # 用户待完成的问卷
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2") polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
poll_ids = polls.blank? ? "(-1)" : "(" + polls.map{|poll| poll.id}.join(",") + ")" poll_users = PollUser.where(:user_id => @user.id, :poll_id => polls.map{|poll| poll.id})
poll_users = PollUser.where("user_id = #{@user.id} and poll_id in #{poll_ids}")
@unfinished_poll_count = polls.count - poll_users.count @unfinished_poll_count = polls.count - poll_users.count
# 用户待匿评的作品 # 用户待匿评的作品
homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status in (1,2)") homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status = 2")
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
student_work_scores = @user.student_works_scores.where("reviewer_role = 3") student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")" anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}") unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
unfinished_evaluations_work_ids = unfinished_evaluations.blank? ? "(-1)" : "(" + unfinished_evaluations.map{|st| st.student_work_id}.join(",") + ")" @anonymous_evaluation_count = StudentWork.where(:id => unfinished_evaluations.map{|ev| ev.student_work_id}, :homework_common_id => homeworks.map{|hw| hw.id}).count
@anonymous_evaluation_count = StudentWork.where("student_works.id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").count
# 待评阅的作业 暂不做 # 待评阅的作业 暂不做
# @unreview_homework = 1 # @unreview_homework = 1
# 待审批的申请 # 待审批的申请
applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count #applied_message_count = AppliedMessage.where(:applied_type => ["Organization", "AppliedContest", "StudentWorksScoresAppeal", "AppliedProject", "ApplyAddSchools"], :user_id => User.current.id, :status => 0).count
applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count #applied_course_message_count = CourseMessage.where(:user_id => User.current.id, :course_message_type => "JoinCourseRequest", :status => 0).count
applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count # applied_pull_request_message_count = ForgeMessage.where(:user_id => User.current.id, :forge_message_type => "PullRequest", :status => [1,3]).count
@applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count # @applied_message_alls_count = applied_message_count + applied_course_message_count + applied_pull_request_message_count
user_id = User.current.id
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
(ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
(ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );"
message_alls = MessageAll.find_by_sql(sql)
@applied_message_alls_count = message_alls.count
else else
# 看别人的主页显示动态 # 看别人的主页显示动态
#更新用户申请成为课程老师或教辅消息的状态 #更新用户申请成为课程老师或教辅消息的状态
@ -2245,7 +2250,7 @@ class UsersController < ApplicationController
left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id left join `course_messages` cm on ma.message_id=cm.id left join `applied_messages` apm on ma.message_id=apm.id
where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or where (ma.user_id =#{user_id} and ma.message_type = 'ForgeMessage' and fm.forge_message_type='PullRequest' and fm.status=0 and fm.user_id=#{user_id} ) or
(ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or (ma.user_id=#{user_id} and ma.message_type='AppliedMessage' and apm.applied_type in ('Organization', 'AppliedContest', 'StudentWorksScoresAppeal', 'AppliedProject', 'ApplyAddSchools') and apm.user_id =#{user_id} and apm.status =0 ) or
(ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id} );" (ma.user_id=#{user_id} and ma.message_type='CourseMessage' and cm.course_message_type='JoinCourseRequest' and cm.status=0 and cm.user_id=#{user_id}) order by ma.created_at desc;"
@message_alls = MessageAll.find_by_sql(sql) @message_alls = MessageAll.find_by_sql(sql)
@message_count = @message_alls.count @message_count = @message_alls.count
@message_alls = paginateHelper @message_alls, 20 @message_alls = paginateHelper @message_alls, 20

View File

@ -95,6 +95,14 @@ class WordsController < ApplicationController
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count @jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
@user_activity_id = params[:user_activity_id] if params[:user_activity_id] @user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id] @activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
unless @activity
if params[:user_activity_id] == params[:activity_id]
redirect_to course_feedback_path(@course)
else
redirect_to course_path(@course)
end
return
end
elsif @journal_destroyed.jour_type == "Principal" elsif @journal_destroyed.jour_type == "Principal"
@user = User.find(@journal_destroyed.jour_id) @user = User.find(@journal_destroyed.jour_id)
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
@ -282,7 +290,7 @@ class WordsController < ApplicationController
# add by nwb # add by nwb
def leave_course_message def leave_course_message
user = User.current user = User.current
message = params[:new_form][:course_message] message = params[:new_form][:content]
feedback = Course.add_new_jour(user, message, params[:id]) feedback = Course.add_new_jour(user, message, params[:id])
if(feedback.errors.empty?) if(feedback.errors.empty?)
if params[:asset_id] if params[:asset_id]

View File

@ -112,7 +112,7 @@ class WorksController < ApplicationController
homework_end_time = Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") homework_end_time = Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d")
work_detail_manual = @contestwork.work_detail_manual work_detail_manual = @contestwork.work_detail_manual
if homework_end_time != param_end_time if homework_end_time != param_end_time
eval_start = work_detail_manual.evaluation_start eval_start = Time.parse(work_detail_manual.evaluation_start.to_s).strftime("%Y-%m-%d")
if eval_start.nil? || (eval_start <= param_end_time && @contestwork.work_status <= 2) if eval_start.nil? || (eval_start <= param_end_time && @contestwork.work_status <= 2)
work_detail_manual.evaluation_start = @contestwork.end_time + 7 work_detail_manual.evaluation_start = @contestwork.end_time + 7
work_detail_manual.evaluation_end = work_detail_manual.evaluation_start + 7 work_detail_manual.evaluation_end = work_detail_manual.evaluation_start + 7

View File

@ -3162,13 +3162,13 @@ module ApplicationHelper
project = cur_user_projects_for_homework homework project = cur_user_projects_for_homework homework
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank' link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else else
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank' link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green fr mt5', :target => '_blank'
end end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "查看详情", homework_common_index_path(:course_id => homework.course_id), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank' link_to "关联项目", student_work_index_url_in_org(homework.id, 1), :class => 'hw_btn_green fr mt5',:title => '查看分组作业详情', :target => '_blank'
else else
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'btn_orange_big fr mt5', :target => '_blank' link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'btn_orange_big fr mt5', :target => '_blank'
end end

View File

@ -56,13 +56,14 @@ class Comment < ActiveRecord::Base
# end # end
end end
elsif self.commented.contest elsif self.commented.contest
if self.author_id != self.commented.author_id if self.parent.nil?
self.contest_messages << ContestMessage.new(:user_id => self.commented.author_id, :contest_id => self.commented.contest.id, :viewed => false) if self.author_id != self.commented.author_id
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count self.contest_messages << ContestMessage.new(:user_id => self.commented.author_id, :contest_id => self.commented.contest.id, :viewed => false)
# if count == 0 end
# content = strip_html self.comments.html_safe, 200 else
# ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content if self.author_id != self.parent.author_id
# end self.contest_messages << ContestMessage.new(:user_id => self.parent.author_id, :contest_id => self.commented.contest.id, :viewed => false)
end
end end
else # 项目相关 else # 项目相关
# if self.author_id != self.commented.author_id # if self.author_id != self.commented.author_id

View File

@ -55,6 +55,7 @@ class Course < ActiveRecord::Base
has_many :student_works, :through => :homework_commons, :dependent => :destroy has_many :student_works, :through => :homework_commons, :dependent => :destroy
has_many :course_groups, :dependent => :destroy has_many :course_groups, :dependent => :destroy
#has_many :course_homework_statistics, :dependent => :destroy
# 课程动态 # 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy

View File

@ -78,7 +78,7 @@ class JournalsForMessage < ActiveRecord::Base
validates :notes, presence: true, if: :is_homework_jour? validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_course_activity, :act_as_course_message, :act_as_contest_activity, after_create :act_as_course_activity, :act_as_course_message, :act_as_contest_activity,
act_as_at_message(:notes, :user_id), :act_as_user_feedback_message, act_as_at_message(:notes, :user_id), :act_as_user_feedback_message,
:act_as_principal_activity :act_as_principal_activity, :act_as_contest_message
# after_create :reset_counters! # after_create :reset_counters!
#after_update :update_activity #after_update :update_activity
# after_destroy :reset_counters! # after_destroy :reset_counters!
@ -325,6 +325,23 @@ class JournalsForMessage < ActiveRecord::Base
end end
end end
# 竞赛留言消息通知
def act_as_contest_message
# 主留言
if self.jour_type == 'Contest'
if self.m_parent_id.nil?
receivers = self.jour.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager") && cm.user_id != self.user_id}
receivers.each do |r|
self.contest_messages << ContestMessage.new(:user_id => r.user_id, :contest_id => self.jour.id, :viewed => false)
end
else # 留言回复
if self.user_id != self.reply_id # 添加我回复的那个人
self.contest_messages << ContestMessage.new(:user_id => self.reply_id, :contest_id => self.jour.id, :viewed => false)
end
end
end
end
# 课程成员得分(活跃度) # 课程成员得分(活跃度)
def act_as_student_score def act_as_student_score
if self.jour_type == "Course" if self.jour_type == "Course"

View File

@ -55,6 +55,9 @@ class Member < ActiveRecord::Base
if (new_role_ids.include?(7) || new_role_ids.include?(9)) && role_ids.include?(10) if (new_role_ids.include?(7) || new_role_ids.include?(9)) && role_ids.include?(10)
member_roles.where("role_id = 10").first.update_column('is_current', 0) member_roles.where("role_id = 10").first.update_column('is_current', 0)
end end
if ids.include?(10) && !ids.include?(7) && !ids.include?(9) && role_ids.include?(10)
member_roles.where("role_id = 10").first.update_column('is_current', 1)
end
# Add new roles # Add new roles
if new_role_ids.include?(7) && new_role_ids.include?(10) if new_role_ids.include?(7) && new_role_ids.include?(10)
member_roles << MemberRole.new(:role_id => 7) member_roles << MemberRole.new(:role_id => 7)

View File

@ -9,8 +9,8 @@ class StudentsForCourse < ActiveRecord::Base
validates_presence_of :course_id, :student_id validates_presence_of :course_id, :student_id
validates_uniqueness_of :student_id, :scope => :course_id validates_uniqueness_of :student_id, :scope => :course_id
after_destroy :delete_student_works after_destroy :delete_student_works, :delete_course_homework_statistic
after_create :recovery_student_works, :create_student_works after_create :recovery_student_works, :create_student_works, :create_course_homework_statistic
#退出班级或删除学生时隐藏学生的作品 #退出班级或删除学生时隐藏学生的作品
def delete_student_works def delete_student_works
@ -37,4 +37,41 @@ class StudentsForCourse < ActiveRecord::Base
end end
end end
end end
#加入班级时创建一条记录
def create_course_homework_statistic
# if CourseHomeworkStatistic.where(:user_id => self.student_id, :course_id => self.course_id).count == 0
# course = self.course
# user = self.student
# hw_count = course.homework_commons.count
# homework_ids = course.homework_commons.empty? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
# student_works = StudentWork.where("homework_common_id in #{homework_ids}")
# is_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 2")
# is_eva_student_works = StudentWork.where(:homework_common_id => is_eva_homeworks.map{|hw| hw.id})
# has_eva_homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_commons.anonymous_comment = 0 and homework_detail_manuals.comment_status = 3")
# has_eva_student_works = StudentWork.where(:homework_common_id => has_eva_homeworks.map{|hw| hw.id})
# course.student.each do |student|
# user = student.student
# if user
# committed_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status != 0").count
# un_commit_work_num = hw_count - committed_work_num
# late_commit_work_num = user.student_works.where("homework_common_id in #{homework_ids} and work_status = 2").count
# absence_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => has_eva_student_works.map(&:id)).count -
# user.student_works_scores.where(:reviewer_role => 3, :student_work_id => has_eva_student_works.map(&:id)).group_by(&:student_work_id).count
# un_evaluation_work_num = user.student_works_evaluation_distributions.where(:student_work_id => is_eva_student_works.map(&:id)).count -
# user.student_works_scores.where(:reviewer_role => 3, :student_work_id => is_eva_student_works.map(&:id)).group_by(&:student_work_id).count
# appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
# average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
# total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
# CourseHomeworkStatistic.create(:course_id => course.id, :user_id => user.id, :committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
# :late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
# :appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
# end
# end
# end
end
def delete_course_homework_statistic
#CourseHomeworkStatistic.where(:user_id => self.student_id, :course_id => self.course_id).destroy_all
end
end end

View File

@ -183,6 +183,8 @@ class User < Principal
# 课程贡献榜 # 课程贡献榜
has_many :course_contributor_scores, :dependent => :destroy has_many :course_contributor_scores, :dependent => :destroy
#has_many :course_homework_statistics, :dependent => :destroy
######added by nie ######added by nie
has_many :project_infos, :dependent => :destroy has_many :project_infos, :dependent => :destroy
has_one :user_status, :dependent => :destroy has_one :user_status, :dependent => :destroy

View File

@ -1,8 +1,9 @@
<a href="javascript:void(0)"> <div class="banner-course-avatar fl">
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片", :class => "fl ml5 pro_new_upimg")%> <%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片", :class => "fl pro_new_upimg")%>
</a> <a class="banner-course-inner" href="javascript:void(0)" onclick="$('#upload_course_logo').click();"></a>
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %> <a class="banner-course-notice" href="javascript:void(0)" onclick="$('#upload_course_logo').click();">更换图片</a>
<a href="javascript:void(0)" class="sub_btn fl mt35 ml5" style="line-height: 1.5" onclick="$('#upload_course_logo').click();"><%= l(:button_upload_photo) %></a> </div>
<a href="javascript:void(0)" class="fl mt45 ml5" style="line-height: 1.5" onclick="$('#upload_course_logo').click();">点击更换</a>
<%= file_field_tag 'avatar[image]', <%= file_field_tag 'avatar[image]',
:id => 'upload_course_logo', :id => 'upload_course_logo',
:class => 'undis upload_file', :class => 'undis upload_file',

View File

@ -1,4 +1,5 @@
<% if @course %> <% if @course %>
hideModal();
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>"); $("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where("parent_id is NULL").first %> <% course_board = @course.boards.where("parent_id is NULL").first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>"); $("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");

View File

@ -1,4 +1,5 @@
<% if @course %> <% if @course %>
hideModal();
$("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>"); $("#tbc_04").html("<%=escape_javascript(render :partial => 'courses/settings/boards_setting') %>");
<% course_board = @course.boards.where("parent_id is NULL").first %> <% course_board = @course.boards.where("parent_id is NULL").first %>
$("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>"); $("#board_children_list").html("<%= escape_javascript(render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board})%>");

View File

@ -1 +1,8 @@
$("#contest_message_join_<%=@msg.id %>").html('<%= escape_javascript(render :partial => 'users/join_contest_applied_message', :locals => {:ma => @msg}) %>'); $("#contest_message_join_<%=@msg.id %>").html('<%= escape_javascript(render :partial => 'users/join_contest_applied_message', :locals => {:ma => @msg}) %>');
$(".messageInformationContents").each(function(){
var parentWidth = $(this).parent().width();
var eq0Width = $(this).parent().children().eq(0).width();
var eq1Width = $(this).parent().children().eq(1).width();
var classWidth = parentWidth - eq0Width - eq1Width - 20;
$(this).css("max-width",classWidth + "px");
});

View File

@ -1 +0,0 @@
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');

View File

@ -0,0 +1,137 @@
<% if @members.count != 0 %>
<table class="muban_table clearfix mb15 t-center" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="table-td-w20" >姓名</th>
<th class="table-td-w10">
<%= link_to '发布资源', course_statistics_course_path(@course, :type => 'resource_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "resource_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "resource_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '发布帖子', course_statistics_course_path(@course, :type => 'message_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "message_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "message_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '帖子回复', course_statistics_course_path(@course, :type => 'message_reply_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "message_reply_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "message_reply_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '发布通知', course_statistics_course_path(@course, :type => 'news_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "news_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "news_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '通知回复', course_statistics_course_path(@course, :type => 'news_reply_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "news_reply_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "news_reply_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '作业回复', course_statistics_course_path(@course, :type => 'homework_journal_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "homework_journal_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "homework_journal_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '班级留言', course_statistics_course_path(@course, :type => 'journal_num', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "journal_num" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "journal_num" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
<th class="table-td-w10">
<%= link_to '活跃度', course_statistics_course_path(@course, :type => 'act_score', :order => (@order == "desc" ? "asc" : "desc")), method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @type == "act_score" && @order == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
<% elsif @type == "act_score" && @order == 'asc' %>
<a href="javascript:" class= "sy_sortdownbtn"></a>
<% end %>
</th>
</tr>
</thead>
<tbody>
<% @members.each do |member| %>
<tr>
<td><%= link_to member.user.show_name, user_path(member.user), :class => 'course_class_users_st_name' %></td>
<td><%= member.resource_num %></td>
<td><%= member.message_num %></td>
<td><%= member.message_reply_num %></td>
<td><%= member.news_num %></td>
<td><%= member.news_reply_num %></td>
<td><%= member.homework_journal_num %></td>
<td><%= member.journal_num %></td>
<td class="pr">
<span><%= member.act_score %></span>
<div class="st_tips_box_inner undis" style="text-align:left;">
<em></em>
<span></span>
<p>资源发布数*5=<%= member.resource_num %>*5=<%= member.resource_num.to_i * 5 %><br/>
帖子发布数*2=<%= member.message_num %>*2=<%= member.message_num.to_i * 2 %><br/>
帖子回复数*1=<%= member.message_reply_num %>*1=<%= member.message_reply_num.to_i * 1 %><br/>
通知发布数*1=<%= member.news_num %>*1=<%= member.news_num.to_i * 1 %><br/>
通知回复数*1=<%= member.news_reply_num %>*1=<%= member.news_reply_num.to_i * 1 %><br/>
作业留言数*1=<%= member.homework_journal_num %>*1=<%= member.homework_journal_num.to_i * 1 %><br/>
班级留言数*1=<%= member.journal_num %>*1=<%= member.journal_num.to_i * 1 %><br/>
总得分:<%= member.act_score %>
</p>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @mem_pages, @members_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
<% else%>
<div class="icons_tishi"><img src="/images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">没有数据可以显示!</p>
<% end %>
<script>
$(".muban_table tbody tr").each(function(){
$(this).mouseenter(function(){
$(".st_tips_box_inner").hide();
$(this).children().eq(8).children().eq(1).stop();
$(this).children().eq(8).children().eq(1).show();
});
$(this).mouseleave(function(){
$(this).children().eq(8).children().eq(1).delay(500).hide(0);
});
});
$(".st_tips_box_inner").each(function(){
$(this).mouseover(function(){
$(this).stop();
$(this).show();
});
$(this).mouseout(function(){
$(this).delay(500).hide(0);
});
});
</script>

View File

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

View File

@ -1,118 +0,0 @@
<div style="margin-left: 15px">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
<span style="font-size: 12px; float: left; margin-right: 5px">
<%= l(:label_current_group)%>:&nbsp;
<%= @group.name %>
</span>
<% end %>
</div>
<div class="cl"></div>
<% if members.any? %>
<% if @result_count %>
<p style="font-size: 18px;">
<%= l(:label_search_member_count) %>
<%= @result_count %>
<%= l(:label_member_people) %>
</p>
<% end %>
<div class="cl"></div>
<div class="st_box">
<ul class="st_box_top" style="margin-left: 17px;">
<% if @subPage_title == l(:label_student_list) %>
<li class="ml358">
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
<% if @score_sort_by == 'desc' %>
<a id="pic" href="javascript:void(0)" class= "st_down"></a>
<% else %>
<a id="pic" href="javascript:void(0)" class= "st_up"></a>
<% end %>
</li>
<li class="ml50">
<a href="javascript:" >加入时间</a>
</li>
<% else %>
<li class="ml50">
</li>
<li class="ml50" style="margin-left: 470px">
</li>
<li class="ml50" style="margin-left: 80%">
<a href="javascript:" >加入时间</a>
</li>
<% end %>
</ul>
<div id="list_detail" style="margin-left: 17px">
<% members.each do |member| %>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<a href="javascript:" class="st_img" style="float:left;">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %>
</a>
<ul style="margin-left: 15px">
<% if @canShowCode %>
<% if member.user.show_name == '' && member.user.user_extensions.student_id == '' %>
<li>
<%= l(:label_username)%>
<%= link_to(member.user.name, user_path(member.user)) %>
</li>
<% else %>
<% unless member.user.show_name == ''%>
<li>
<%= l(:label_bidding_user_studentname) %> :
<%= link_to member.user.show_name, user_path(member.user) %>
</li>
</br>
<% end %>
<% unless member.user.user_extensions.student_id == '' %>
<li>
<%= l(:label_bidding_user_studentcode) %> :
<%= link_to member.user.user_extensions.student_id, user_path(member.user) %>
</li>
<% end %>
<% end %>
<%#= content_tag "li", "#{l(:label_bidding_user_studentname)}#{' : '}"link_to(member.user.show_name, user_path(member.user)) %>
<% else %>
<li>
<%= l(:label_username)%>
<%= link_to(member.user.name, user_path(member.user)) %>
</li>
<% end %>
<!--teacher's code disapeared moified by huang-->
</ul>
<% if @subPage_title == l(:label_student_list) %>
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
:action => 'show_member_score',
:member_id => member.id,
:remote => true},
:class => 'ml258 c_red', :style => "color:red;" %>
<% unless member.created_on.nil? %>
<%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey" %>
<% end %>
<% else %>
<% unless member.created_on.nil? %>
<%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey", :style=>"margin-left:195px" %>
<% end %>
<% end %>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div>
<% end; reset_cycle %>
</div>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count,:per_page_links => false, :remote =>@is_remote %>
</div>
<% else %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end %>

View File

@ -1,60 +0,0 @@
<% members.each do |member| %>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<% next if member.new_record? %>
<a href="javascript:void(0)" class="st_img" style="float:left;"> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %></a>
<ul style="margin-left: 15px">
<% if @canShowCode %>
<% if member.user.show_name == '' && member.user.user_extensions.student_id == '' %>
<li>
<%= l(:label_username)%>
<%= link_to(member.user.name, user_path(member.user)) %>
</li>
<% else %>
<% unless member.user.show_name == ''%>
<li>
<%= l(:label_bidding_user_studentname) %> :
<%= link_to member.user.show_name, user_path(member.user) %>
</li>
</br>
<% end %>
<% unless member.user.user_extensions.student_id == '' %>
<li>
<%= l(:label_bidding_user_studentcode) %> :
<%= link_to member.user.user_extensions.student_id, user_path(member.user) %>
</li>
<% end %>
<% end %>
<%#= content_tag "li", "#{l(:label_bidding_user_studentname)}#{' : '}"link_to(member.user.show_name, user_path(member.user)) %>
<% else %>
<li>
<%= l(:label_username)%>
<%= link_to(member.user.name, user_path(member.user)) %>
</li>
<% end %>
<!--teacher's code disapeared moified by huang-->
</ul>
<% if @subPage_title == l(:label_student_list) %>
<%= link_to format("%0.2f",member.score.to_s), {
:action => 'show_member_score',
:member_id => member.id,
:remote => true},
:class => 'ml258 c_red', :style => "color:red;" %>
<% unless member.created_on.nil? %>
<%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey" %>
<% end %>
<% else %>
<% unless member.created_on.nil? %>
<%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey", :style=>"margin-left:195px" %>
<% end %>
<% end %>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div>
<% end; reset_cycle %>

View File

@ -162,9 +162,8 @@
</div> </div>
</div> </div>
<% else%> <% else%>
<p class="nodata"> <div class="icons_tishi"><img src="/images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
<%= l(:label_no_data) %> <p class="sy_tab_con_p">没有数据可以显示!</p>
</p>
<% end %> <% end %>
<script> <script>

View File

@ -67,6 +67,6 @@
<% end %> <% end %>
<% if show_nav?(0) %> <% if show_nav?(0) %>
<li> <li>
<a href="<%=statistics_course_course_path(@course) %>">统计</a> <a href="<%=course_statistics_course_path(@course) %>">统计</a>
</li> </li>
<% end %> <% end %>

View File

@ -0,0 +1,5 @@
<div class="sy_class_r ml10">
<div class="icons_tishi"><img src="../../images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">统计功能即将上线,届时我们一起享受教育大数据的红利吧!</p>
<div style="height:400px;"></div>
</div><!--sy_class_r end-->

View File

@ -0,0 +1,5 @@
<% if !params[:tab] || params[:tab] == "activity" %>
$("#act_table_<%=@course.id %>").html("<%= escape_javascript(render :partial => 'act_table')%>");
<% else %>
<% end %>

View File

@ -1,15 +1,28 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %> <div class="homepageRight mt0 ml10">
<!-- <#%= stylesheet_link_tag 'css', :media => 'all' %> --> <div class="homepageRightBanner mb10">
<div class="courseRSide fl"> <div class="NewsBannerName pr"><span id="mesLabel">班级留言</span></div>
</div>
<div class="cl"></div>
<div class="project_r_h" style="width:730px;"> <div id="messageContent">
<h2 class="project_h2"><%= l(:label_contest_userresponse) %></h2> <div class="resources"><%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %>
</div> <div class="fl" style="width:658px;">
<%= form_for('new_form',:url => leave_course_message_path(@course.id), :html =>{:id => "course_feedback_new"}, :method => "post") do |f|%>
<%= render :partial => "users/jour_form", :locals => {:f => f, :object => @course} %>
<%= render :partial => 'courses_jours', <input id="private_flag" name="private" type="hidden" value="0"/>
:locals => { :contest => @contest, :journals => @jour, :state => false} <a href="javascript:void(0);" class="blue_n_btn fr mt5" id="submit_feedback_user" >留言</a>
%> <a href="javascript:void(0);" onclick="cancel_jour_submit()" class="greyBtn2 postReplySubmit mt5 mr15">取消</a>
<% end %>
<% html_title(l(:label_course_feedback)) -%> </div>
</div>
<%=render :partial => "course_jours_list", :locals => {:jours =>@jours, :page => 0, :count => @jour_count} %>
<div class="cl"></div>
</div><!--message_box end-->
</div> </div>
<script type="text/javascript">
$(function(){
$("#submit_feedback_user").one('click',function() {
course_jour_submit();
});
});
</script>

View File

@ -1 +1 @@
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/settings/member') %>');

View File

@ -5,9 +5,9 @@
} }
<% end %> <% end %>
$("#search_orgs_result_list").html(""); $("#search_orgs_result_list").html("");
$("#search_orgs_result_list").append('<ul class="ml20">'); $("#search_orgs_result_list").append('<ul class="sy_new_tchlist ml20">');
<% @orgs_not_in_course.each do |org|%> <% @orgs_not_in_course.each do |org|%>
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='<%=org.id%>'/><span class='relateOrgName fl'> <%=org.name %> </span></label></li><div class='cl mt5'></div>"; link = "<li><label><input type='checkbox'class='mr5 fl' name='orgNames[]' style='height:28px' value='<%=org.id%>'/><span class='relateOrgName fl' style='line-height: 28px;'> <%=org.name %> </span></label></li><div class='cl mt5'></div>";
$("#search_orgs_result_list").append(link ); $("#search_orgs_result_list").append(link );
<%end %> <%end %>
$("#search_orgs_result_list").append('</ul>') $("#search_orgs_result_list").append('</ul>')

View File

@ -1,151 +1,63 @@
<div class="courseRSide fl" id="homework_page_right"> <div class="sy_class_r fr mb10 ml10" id="homework_page_right">
<div class="project_r_h" style="width:730px;"> <h3 class="game-setting-h3 "><span class="ml15"></span>班级配置</h3>
<h2 class="project_h2"><%= l(:label_course_modify_settings)%></h2> <div class="game-setting-tab">
<ul id="game-setting-tab-nav">
<li id="tb_1" class="game-setting-nav-hover" onclick="HoverLi(1);">
<a href="javascript:void(0);">基本信息</a>
</li>
<li id="tb_2" onclick="HoverLi(2);">
<a href="javascript:void(0);">成员</a>
</li>
<li id="tb_3" onclick="HoverLi(3);">
<a href="javascript:void(0);">组织</a>
</li>
<li id="tb_4" onclick="HoverLi(4);">
<a href="javascript:void(0);">讨论区设置</a>
</li>
<div class="cl"></div>
</ul>
<div class="hwork_dis" id="tbc_01" style="padding-top: 10px;">
<%= render :partial => 'courses/settings/edit' %>
</div>
<div class="hwork_undis" id="tbc_02">
<%= render :partial => 'courses/settings/member'%>
</div><!---成员结束-->
<div class="hwork_undis" id="tbc_03">
<%= render :partial => 'courses/settings/join_org' %>
</div>
<div class="hwork_undis" id="tbc_04">
<%= render :partial => 'courses/settings/boards_setting' %>
</div>
</div>
</div> </div>
<script> <script>
$(function(){ $(function(){
var tab = <%= @tab %>;
if(tab != 0){
course_setting(tab);
}
<% if @select_tab == 'member'%> <% if @select_tab == 'member'%>
$("#tb_2").click(); $("#tb_2").click();
<% elsif @select_tab == 'boards'%>
$("#tb_4").click();
<% end %> <% end %>
$("#homework_page_right").css("min-height",$("#courseLSide").height()+45); $("#homework_page_right").css("min-height",$("#courseLSide").height()+45);
}) });
</script>
<div class="hwork_new">
<div id="tb_" class="hwork_tb_">
<ul>
<li id="tb_1" class="hwork_hovertab" onclick="course_setting(1);" >
基本信息
</li>
<li id="tb_2" class="hwork_normaltab" onclick="course_setting(2);">
成员
</li>
<li id="tb_3" class="hwork_normaltab" onclick="course_setting(3);">
组织
</li>
<li id="tb_4" class="hwork_normaltab" onclick="course_setting(4);">
讨论区设置
</li>
</ul>
</div>
<div class="hwork_dis" id="tbc_01" style="padding-top: 10px;">
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45 mb10" id="course_avatar_form">
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<span id="edit_syllabus_id"><%=@course.syllabus.title %></span>
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="edit_course_name" autocomplete="off" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
<div class="cl"></div>
<span class="c_red ml80" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
</li>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="edit_class_period" class="hwork_input02" onkeyup="regex_course_class_period('edit');" maxlength="6" value="<%= @course.class_period%>">
<span class="c_red" id="edit_course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"edit_time"} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"edit_term"} %>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"edit_end_time"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"edit_end_term"} %>
<span class="c_red" id="edit_course_time_term_notice"></span>
</li>
<div class="cl"></div>
<!--<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%#= l(:label_new_course_password)%>&nbsp;&nbsp;</label>
<input type="password" name="course[password]" id="edit_course_course_password" class="hwork_input02" value="<%#= @course.password%>" onkeyup="regex_course_password('edit');">
<a id="psw_btn" href="javascript:void(0)">显示明码</a>
<span class="c_red" id="edit_course_course_password_notice"></span>
<div class="cl"></div>
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
</li>-->
<!--<li class="ml45">-->
<!--<label class="fl" >&nbsp;&nbsp;<%#= l(:label_new_course_description)%>&nbsp;&nbsp;</label>-->
<!--<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl" maxlength="6000"><%#= @course.description%></textarea>-->
<!--<div class="cl"></div>-->
<!--</li>-->
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox">
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生列表公开&nbsp;&nbsp;</label>
<input <%= @course.open_student == 1 ? 'checked' : ''%> id="course_open_student" name="course[open_student]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生上传资源&nbsp;&nbsp;</label>
<input <%= @course.publish_resource == 1 ? 'checked' : ''%> id="course_publish_resource" name="course[publish_resource]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(选中后允许学生上传班级资源,否则不允许)</span>
<div class="cl"></div>
</li>
<li class="mt10 ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_edit_course(<%= @course.id%>);" >提交</a>
<%= link_to l(:button_cancel), course_path(@course), :class => "grey_btn fl c_white ml10" %>
<div class="cl"></div>
</li>
<% end %>
</ul>
<% if @course.is_delete == 1 %>
<div class="mt30"><%=link_to "恢复该班级", renew_course_path(@course) %></div>
<% else %>
<div class="mt30">
<img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该班级", course_path(@course), :method => :delete, :confirm=>"确认要删除该班级吗?" %>
<span>(友情提示:删除该班级后如果您想恢复该班级,请联系系统管理员!)</span>
</div>
<% end %>
</div> function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=4;i++){
g('tb_'+i).className='game-setting-nav-nomall';
g('tbc_0'+i).className='undis';
}
g('tb_'+n).className='game-setting-nav-hover';
g('tbc_0'+n).className='game-dis';
}
<div class="hwork_undis" id="tbc_02">
<div class="search_course fl">
<%= form_tag(search_member_course_path,:id => "course_member_search_form", :method => :get, :class => "search_form_course",:remote => true) do %>
<!-- , :onkeyup => "regexQ('#{l(:label_search_conditions_not_null)}');" -->
<%= text_field_tag 'name', params[:name], :placeholder => "登录名、学号、姓名搜索", :class => "search_text fl" %>
<a href="javascript:void(0)" onclick="submitMemberSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white ml10" >
<%= l(:label_search)%>
</a>
<br />
<span id="course_member_name_span" style="float: left"></span>
<% end %>
</div>
<div id="course_members_setting">
<%= render :partial => "course_members" %>
</div>
</div><!---成员结束-->
<div class="hwork_undis" id="tbc_03">
<%= render :partial => 'courses/settings/join_org' %>
</div>
<div class="hwork_undis" id="tbc_04">
<%= render :partial => 'courses/settings/boards_setting' %>
</div>
</div><!--talknew end-->
<div class="cl"></div>
<script type="text/javascript">
function select() { function select() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>');
showModal('ajax-modal', '500px'); showModal('ajax-modal', '500px');
@ -155,7 +67,4 @@
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9"); $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos"); $('#ajax-modal').parent().addClass("anonymos");
} }
//$("#time").click(select);
//$("#term").click(select);
</script> </script>
</div>

View File

@ -1,12 +1,8 @@
<ul> <ul>
<li><span class="relatedListName fb fl">名称</span><span class="relatedListOption fb fl">操作</span></li>
<% orgs.each do |org| %> <% orgs.each do |org| %>
<li> <li class="clear mb5">
<a href="<%= organization_path(org) %>" class="relatedListName linkBlue fl"><%= org.name %></a> <a href="<%= organization_path(org) %>" title="<%= org.name %>" style="max-width: 250px;" class="hidden fl"><%= org.name %></a>
<a href="javascript:void(0);" onclick="cancel_org_course_relation(<%= OrgCourse.where(:organization_id => org.id, :course_id => course_id).first.id %>, '<%= course_id %>');" <a href = "javascript:void(0);" onclick="delete_confirm_box_2('<%= org_course_path(OrgCourse.where(:organization_id => org.id, :course_id => course_id).first.id, :course_id => course_id) %>', '确定取消关联吗?')" class="fr sy_btn_grey_mini ml5" >取消关联</a>
class = "relatedListOption fl linkGrey3">取消关联</a>
<%#= link_to "取消关联", org_course_path(:id => OrgCourse.where(:organization_id => org.id, :course_id => course_id).first.id, :course_id => course_id),
:method => 'delete',:remote => true, :class => "relatedListOption fl linkGrey3" %>
</li> </li>
<% end %> <% end %>
</ul> </ul>

View File

@ -1,67 +1,59 @@
<% board = @course.boards.where("parent_id is NULL").first %> <% board = @course.boards.where("parent_id is NULL").first %>
<div class="w730 mt10" id="org_subfield_list"> <div class="pro_new_setting_conbox" style="width:100%; border:none;">
<ul class="orgListRow borderBottomNone orgListBg"> <div class="sy_new_tchbox clear undis" style="margin-left:10px; margin-right:10px;" id="add_sub_board">
<li class="w270 fb fl"><span class="ml15">名称</span></li> <%= form_tag url_for(:controller => 'boards', :action => 'create', :course_id => @course.id, :board_id => board.id), :id=> 'add_board_form_subboard',:remote => true do %>
<li class="w140 fb fl">状态</li> <ul class="pro_newsetting_con mb15">
<li class="w170 fb fl">类型</li> <li>
<li class="w150 fb fl"><span class="mr15 fr">操作</span></li> <label class="fl">新增子栏目名称&nbsp;&nbsp;:&nbsp;</label>
<div class="cl"></div> <input id="subfield_name" name="name" placeholder="请输入子栏目名称" maxlength="30" class="fl h28" style="width: 420px" type="text">
</ul> <a href="javascript:void(0);" class="fr sy_btn_grey" onclick="$('#add_sub_board').toggle();">取消</a>
<ul class="orgListRow"> <a href="javascript:void(0);" class="fr sy_btn_blue mr5" id="subMenuSubmit">保存</a>
<li class="w270 fl"> <span class="ml15">班级讨论区</span> </li>
<li class="w140 fl">默认</li>
<li class="w170 fl">帖子</li>
<li class="w150 fl"> <a href="javascript:void(0)" class="link-blue fr mr15" id="addSubMenu">添加子栏目</a> </li>
<div class="cl"></div>
<% count = board.children.count %>
<% board.children.reorder("position asc").each_with_index do |board, i|%>
<ul class="orgSubList" style="border-top: 1px solid rgb(228, 228, 228);">
<li class="<%= i == count - 1 ? 'orgSubTree2' : 'orgSubTree' %>"></li>
<li class="w210 mr10 fl">
<div id="board_sub_show_<%= board.id %>" class="w210 hidden" title="<%=board.name %>"><%=board.name %></div>
<div id="board_sub_edit_<%= board.id %>" style="display:none;">
<input type="text" name="name" onblur="update_sub_board_name('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>','<%= board.id %>','<%= @course.id %>',$(this).val());" value="<%= board.name %>" style="width:140px;"/>
</div>
</li>
<li class="w140 fl">新增</li>
<li class="w170 fl">帖子</li>
<li class="w150 fl">
<a href="javascript:void(0);" class="linkGrey fr ml5 mr15" onclick="edit('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>');">编辑</a>
<%= link_to('删除', {:controller => 'boards', :action => 'destroy', :id => board.id, :course_id => @course.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "linkGrey fr ml5 mr5", :title => l(:button_delete)) %>
<% if i < count - 1 %>
<%= link_to('下移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'down'},:remote => true, :method => 'post', :class => "linkGrey fr ml5 mr5", :title => '下移') %>
<% end %>
<% unless i == 0 %>
<%= link_to('上移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'up'},:remote => true, :method => 'post', :class => "linkGrey fr ml5 mr5", :title => '上移') %>
<% end %>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<span id="new_notice" class="undis fl c_red">名称不能为空</span>
</ul> </ul>
<% end %> <% end %>
</ul> </div>
<div class="clear ml10 mr10">
<table class="sy_new_table clearfix mb15" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>名称</th>
<th style="width:280px;">操作</th>
</tr>
</thead>
<tbody>
<tr>
<td class="game-text-left"><span class="ml20"></span>班级讨论区</td>
<td class="game-text-right"><a href="javascript:void(0);" class="sy_btn_green mr5" onclick="$('#add_sub_board').toggle();">添加子栏目</a></td>
</tr>
<% count = board.children.count %>
<% board.children.reorder("position asc").each_with_index do |board, i|%>
<tr>
<td class="game-text-left">
<div id="board_sub_show_<%= board.id %>" class="ml40 w350 hidden" title="<%=board.name %>"><%=board.name %></div>
<div id="board_sub_edit_<%= board.id %>" style="display:none;" class="ml40">
<input type="text" name="name" class="h28 w300" id="board_sub_name_<%=board.id %>" maxlength="30"
onblur="update_sub_board_name('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>','<%= board.id %>','<%= @course.id %>',$(this).val());" value="<%= board.name %>"/>
</div>
</td>
<td class="game-text-right">
<% unless i == 0 %>
<%= link_to('上移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'up'},:remote => true, :method => 'post', :class => "sy_btn_blue mr5", :title => '上移') %>
<% end %>
<% if i < count - 1 %>
<%= link_to('下移', {:controller => 'boards', :action => 'update_position', :id => board.id, :course_id => @course.id, :opr => 'down'},:remote => true, :method => 'post', :class => "sy_btn_blue mr5", :title => '下移') %>
<% end %>
<a href="javascript:void(0);" class="sy_btn_blue mr5" onclick="edit('#board_sub_show_<%= board.id %>','#board_sub_edit_<%= board.id %>');">编辑</a>
<a href="javascript:void(0);" class="sy_btn_blue mr5" onclick="delete_confirm_box_2('<%=course_board_path(board, :course_id => @course.id) %>', '您是否确定删除')">删除</a>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div> </div>
<!--新增二级栏目-->
<div class="mt10 fl orgListBg w730 undis" id="subMenuContent">
<%= form_tag url_for(:controller => 'boards', :action => 'create', :course_id => @course.id, :board_id => board.id), :id=> 'add_board_form_subboard',:remote => true do %>
<div class="ml15 mt10">
<span class="fontGrey3 mb5 mr10">新增子栏目名称 :</span>
<input id="subfield_name" name="name" placeholder="请输入子栏目名称" maxlength="30" class="orgAddSearch mb10" type="text">
<span id="new_notice" class="undis ml10">名称不能为空</span>
</div>
<div class="mb10">
<span class="fontGrey3 ml50 mr15 fl">栏目类型 :</span>
<input class="mr5" id="orgMng" value="Post" name="field_type" checked="checked" type="radio">
<label for="orgMng">帖子</label>
</div>
<div class="mb10">
<a href="javascript:void(0);" class="grey_btn_cir fr c_white mr15 ml15" id="subMenuCancel">取消</a>
<a href="javascript:void(0);" class="blue_btn_cir fr c_white" id="subMenuSubmit">确定</a>
<div class="cl"></div>
</div>
</form>
<% end %>
</div>
<!--over-->
<script> <script>
$(function(){ $(function(){
@ -80,28 +72,31 @@
}); });
} }
} }
$("#addSubMenu").click(function(){
$("#subMenuContent").toggle();
});
$("#subMenuCancel").click(function(){
$("#subMenuContent").hide();
});
function update_sub_board_name(show_id, edit_id, field_id, domain_id, input_value) { function update_sub_board_name(show_id, edit_id, field_id, domain_id, input_value) {
if (input_value.trim() != "" && $(show_id).html().trim() != input_value.trim()) { if (input_value.trim() != "" && $(show_id).html().trim() != input_value.trim()) {
if (confirm('确定修改为' + input_value + "?")) 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>'+
$.ajax({ '<div class="clear mt15"><p class="text_c f16 fontGrey7">确定修改为' + input_value + '</p><div class="cl"></div><a href="javascript:void(0)" class="fr sy_btn_blue mt10"' +
url: "/boards/" + field_id + "/update_name?course_id=" + domain_id + "&name=" + input_value, ' style="margin-right: 92px;" onclick="update_confirm(1,' + field_id + ',' + domain_id + ');">确定</a>'+
type: 'put' '<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="update_confirm(2,' + field_id + ',' + domain_id + ');">取消</a></div></div>';
}); pop_box_new(htmlvalue, 300, 140);
else{
$(edit_id).children("input").val($(show_id).html().trim());
}
} }
$(show_id).show(); $(show_id).show();
$(edit_id).hide(); $(edit_id).hide();
} }
function update_confirm(type, field_id, domain_id){
if(type == 1){
$.ajax({
url: "/boards/" + field_id + "/update_name?course_id=" + domain_id + "&name=" + $("#board_sub_name_"+field_id).val(),
type: 'put'
});
} else {
hideModal();
$("#board_sub_edit_"+field_id).children("input").val($("#board_sub_show_"+field_id).html().trim());
}
}
function edit(show_id, edit_id) { function edit(show_id, edit_id) {
$(show_id).toggle(); $(show_id).toggle();
$(edit_id).toggle(); $(edit_id).toggle();

View File

@ -0,0 +1,90 @@
<table class="sy_new_table clearfix mb15" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th style="width: 35px;">序号</th>
<th style="width:180px;">姓名</th>
<th style="width:140px;">学号</th>
<th>角色</th>
<th class="sy_new_namebox">操作</th>
</tr>
</thead>
<tbody>
<% @members.each_with_index do |member, index| %>
<tr>
<td><%= index + 1 %></td>
<td>
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname ml10 mr10", :title => "#{member.user.show_name}" %>
</td>
<td>
<span class="pro_new_school_name ml5 mr5"><%=member.user.user_extensions.student_id %></span>
</td>
<td style="width: 200px">
<span id="member_role_<%=member.id %>"><%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %></span>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %>
<ul class="clear ml15">
<script>
$(function() {
$("#edit_member_role_<%=member.id %>_7").on('click', function(){
if($("#edit_member_role_<%=member.id %>_7").is(":checked")) {
$("#edit_member_role_<%=member.id %>_9").attr("checked",false);
$("#edit_member_role_<%=member.id %>_9").attr('disabled', 'disabled');
} else {
$("#edit_member_role_<%=member.id %>_9").removeAttr('disabled');
}
});
$("#edit_member_role_<%=member.id %>_9").on('click', function(){
if($("#edit_member_role_<%=member.id %>_9").is(":checked")) {
$("#edit_member_role_<%=member.id %>_7").attr('disabled', 'disabled');
$("#edit_member_role_<%=member.id %>_7").attr("checked",false);
} else {
$("#edit_member_role_<%=member.id %>_7").removeAttr('disabled');
}
});
});
</script>
<% @roles.each do |role| %>
<li class="fl mr5">
<!--<label style="width: 54px;">-->
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), :id => "edit_member_role_#{member.id}_#{role.id}",
:disabled => member.member_roles.detect {|mr| mr.role_id == role.id && !mr.inherited_from.nil?}, :class => "mt6 fl h28" %>
<p class="fl ml5"><%= zh_course_role(h role) %></p>
<!--</label>-->
</li>
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
</ul>
<% end %>
</td>
<td>
<% unless member.user == @course.teacher %>
<a href="javascript:void(0)" class="sy_btn_blue mr5" onclick="edit_member($(this), <%=member.id %>);">编辑</a>
<a href="javascript:void(0)" class="sy_btn_blue mr5" style="display: none;" onclick="$('#member-<%= member.id%>-roles-form').submit();">保存</a>
<a href="javascript:void(0)" class="sy_btn_grey mr5" style="display: none;" onclick="cancel_edit($(this), <%=member.id %>);">取消</a>
<a href="javascript:void(0)" class="sy_btn_grey mr5" id="delete_member_<%=member.id %>" onclick="delete_confirm_box_2('<%=membership_path(member) %>', '<%= l(:label_delete_confirm)%>')">删除</a>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<script>
function edit_member(div, id){
$('#member_role_' + id).hide();
$('#member-' + id + '-roles-form').show();
$(div).next().show();
$(div).next().next().show();
$('#delete_member_' + id).hide();
$(div).hide();
}
function cancel_edit(div, id){
$('#member_role_' + id).show();
$('#member-' + id + '-roles-form').hide();
$(div).prev().hide();
$(div).prev().prev().show();
$('#delete_member_' + id).show();
$(div).hide();
}
</script>

View File

@ -0,0 +1,72 @@
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45 mb10" id="course_avatar_form">
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<span id="edit_syllabus_id"><%=@course.syllabus.title %></span>
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="edit_course_name" autocomplete="off" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
<div class="cl"></div>
<span class="c_red ml80" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
</li>
<div class="cl"></div>
<li class="mb5 fontGrey3" style="margin-left: 125px;"><span class="success-icon mr25">正确示例软件工程计算机系2016秋季A班</span></li>
<li class="mb10 fontGrey3" style="margin-left: 125px;"><span class="error-icon">错误示例计算机系2016秋季A班</span></li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>
<input type="text" name="class_period" id="edit_class_period" class="hwork_input02 w290" onkeyup="regex_course_class_period('edit');" maxlength="6" value="<%= @course.class_period%>">
<span class="c_red" id="edit_course_class_period_notice" style="display: none;"></span>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_course_term)%>&nbsp;&nbsp;</label>
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"edit_time", :class => "h28 w145 mr8"} %>
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"edit_term", :class => "h28 w145"} %>
</li>
<div class="cl"></div>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;结束学期&nbsp;&nbsp;</label>
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"edit_end_time", :class => "h28 w145 mr8"} %>
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"edit_end_term", :class => "h28 w145"} %>
<span class="c_red" id="edit_course_time_term_notice"></span>
</li>
<div class="cl"></div>
<li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label>
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox">
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生列表公开&nbsp;&nbsp;</label>
<input <%= @course.open_student == 1 ? 'checked' : ''%> id="course_open_student" name="course[open_student]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(选中后对所有用户可见,否则仅对本班级成员可见)</span>
<div class="cl"></div>
</li>
<li class=" mb5 ml30">
<label >学生上传资源&nbsp;&nbsp;</label>
<input <%= @course.publish_resource == 1 ? 'checked' : ''%> id="course_publish_resource" name="course[publish_resource]" type="checkbox" style="margin-left: 1px;"/>
<span class="c_grey">(选中后允许学生上传班级资源,否则不允许)</span>
<div class="cl"></div>
</li>
<li class="mt10" style="margin-left: 125px;">
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_edit_course(<%= @course.id%>);" >提交</a>
<%= link_to l(:button_cancel), course_path(@course), :class => "grey_btn fl c_white ml10" %>
<div class="cl"></div>
</li>
<% end %>
</ul>
<% if @course.is_delete == 1 %>
<div class="mt30 ml30"><%=link_to "恢复该班级", renew_course_path(@course) %></div>
<% else %>
<div class="mt30 ml30">
<img src="/images/pic_del.gif" class="mr5"><%=link_to "删除该班级", course_path(@course), :method => :delete, :confirm=>"确认要删除该班级吗?" %>
<span>(友情提示:删除该班级后如果您想恢复该班级,请联系系统管理员!)</span>
</div>
<% end %>

View File

@ -1,85 +1,84 @@
<!--<div class="members_left">-->
<!--<input type="text" id="orgs_not_course_member_search" name="orgAddSearch" placeholder="支持姓名、邮箱、昵称搜索" class="orgAddSearch mb20" />-->
<!--<%#= javascript_tag "observeSearchfield('orgs_not_course_member_search', null, '#{ escape_javascript autocomplete_search_organizations_path(:course_id=> @course.id, :format => 'js') }')" %>-->
<!--<div id="new_orgs_for_course">-->
<!--</div>-->
<!--</div>-->
<%= stylesheet_link_tag 'css/org' %> <%= stylesheet_link_tag 'css/org' %>
<div> <% if @orgs_not_in_course.empty? && @course.organizations.empty? %>
<div class="relateOrg fl"> <div class="icons_tishi"><img src="/images/new_project/icons_smile.png" width="110" height="110" alt="" ></div>
<span class="pic_add fl mr5 mt3"></span><span class="f14 fontBlue fl">关联组织</span> <p class="sy_tab_con_p">您没有创建组织,请先 <%=link_to '新建组织', new_organization_path, :class => 'sy_btn_green', :target => '_blank' %>,再关联</p>
<div class="cl mb5"></div> <% else %>
<%= form_tag url_for(:controller => 'org_courses', :action => 'create', :course_id => @course.id), :id => 'join_orgs_for_course', :remote => true do %> <div class="sy_new_tchbox clear mt10">
<input type="text" name="orgs" class="searchOrg mb5 ml20" placeholder="请输入组织名称" /> <div class="course_setting_org_fl fl">
<div id="search_orgs_result_list" class="ml20"></div> <h3 class="mb10 fl" style="color: #8f8f8f;">关联组织</h3>
<ul id="paginator" class="wlist ml20" style="float:none;"></ul> <div class="cl mb5"></div>
<a href="javascript:void(0);" class="saveBtn db fl ml20 mr15 mt5" onclick="course_join_org(<%= @course.id %>);">关联</a> <%= form_tag url_for(:controller => 'org_courses', :action => 'create', :course_id => @course.id), :id => 'join_orgs_for_course', :remote => true do %>
<a href="javascript:void(0);" class="org-cancel-btn db fl mt5" onclick="cancel_join_orgs();">取消</a> <input type="text" name="orgs" class="sy_new_search" style="height: 28px; width: 300px;" placeholder="请输入组织名称" />
<% end %> <div class="cl mb5"></div>
</div> <div id="search_orgs_result_list" ></div>
<div class="relatedList fr"> <ul id="paginator" class="wlist ml20" style="float:none;"></ul>
<div class="fr mr15"> <a href="javascript:void(0);" class="fl sy_btn_blue mr5" onclick="course_join_org(<%= @course.id %>);">关联</a>
<span class="f14 fontBlue">已关联组织</span> <a href="javascript:void(0);" class="fl sy_btn_grey mr5" onclick="cancel_join_orgs();">取消</a>
<div id="added_orgs">
<%= render :partial => 'courses/settings/added_orgs', :locals => {:orgs => @course.organizations, :course_id => params[:id]} %> <% end %>
</div> </div>
<div> <div class="course_setting_org_fr fr">
</div> <h3 class="mb20" style="color: #8f8f8f;">已关联组织</h3>
<ul>
<div id="added_orgs">
<%= render :partial => 'courses/settings/added_orgs', :locals => {:orgs => @course.organizations, :course_id => @course.id} %>
</div>
</ul>
</div>
</div> </div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
var lastSearchCondition = ''; var lastSearchCondition = '';
var page = 1; var page = 1;
var count = 0; var count = 0;
var maxPage = 0; var maxPage = 0;
function search_orgs(e){ function search_orgs(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '') if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{ {
return; return;
}
lastSearchCondition = $(e.target).val().trim();
page = 1;
$.ajax({
url: '<%= url_for(:controller => 'courses', :action => 'search_public_orgs_not_in_course') %>'+'?name='+ e.target.value+'&page='+page,
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询组织
$("input[name='orgs']").on('input', function (e) {
throttle(search_orgs,window,e);
});
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'courses', :action => 'search_public_orgs_not_in_course') %>'+'?page=1',
type:'get'
});
});
function cancel_join_orgs() {
$("#join_orgs_for_course input:checked").attr("checked", false);
}
function course_join_org(courseId) {
$.ajax({
url: "/org_courses?" + $("#join_orgs_for_course").serialize() + "&course_id=" + courseId,
type: "post",
success: function (data) {
$.ajax({
url: "/courses/" + courseId + "/search_public_orgs_not_in_course?hint_flag=true&name=" + $("input[name='orgs']").val().trim(),
type: "get"
});
} }
lastSearchCondition = $(e.target).val().trim();
page = 1;
$.ajax({
url: '<%= url_for(:controller => 'courses', :action => 'search_public_orgs_not_in_course') %>'+'?name='+ e.target.value+'&page='+page,
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询组织
$("input[name='orgs']").on('input', function (e) {
throttle(search_orgs,window,e);
}); });
}
</script> $(document).ready(function(){
$.ajax({
url: "/courses/<%=@course.id.to_s %>/search_public_orgs_not_in_course?page=1" ,
type:'get'
});
});
function cancel_join_orgs() {
$("#join_orgs_for_course input:checked").attr("checked", false);
}
function course_join_org(courseId) {
$.ajax({
url: "/org_courses?" + $("#join_orgs_for_course").serialize() + "&course_id=" + courseId,
type: "post",
success: function (data) {
$.ajax({
url: "/courses/" + courseId + "/search_public_orgs_not_in_course?hint_flag=true&name=" + $("input[name='orgs']").val().trim(),
type: "get"
});
}
});
}
</script>
<% end %>

View File

@ -0,0 +1,67 @@
<div class="pro_new_setting_conbox fl " style="width:100%; border:none;">
<a href="javascript:void(0);" class="fl sy_btn_green mb10 ml15" onclick="add_course_member();">添加成员</a>
<div class="cl"></div>
<div class=" sy_new_tchbox clear undis" style="margin-left:10px; margin-right:10px" id="add_course_member">
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
<div class="hw_search_box mb10">
<input class="sy_new_search" placeholder="支持姓名、邮箱、登录名搜索" id="principal_search" type="text">
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js',:flag => true) }')" %>
<%#= javascript_tag "observeSearchfield('principal_search', null, '#{escape_javascript "/contest_members/contest_member_autocomplete?" + {:contest => @contest.id}.to_query }')" %>
</div>
<div class="fl mb10 pro_new_idlist" id="principals_for_new_member">
<%= render_principals_for_new_course_members(@course) %>
</div>
<div class="fl">
<ul class="fl pro_new_idbox">
<li class="clear ">
<label>
<input type="checkbox" class="mt2 fl h28" name="membership[role_ids][]" value="9" id="add_member_checkbox_9">
<p class="fl ml5"> 教师</p>
</label>
</li>
<li class="clear ">
<label>
<input type="checkbox" class="mt2 fl h28" name="membership[role_ids][]" value="7" id="add_member_checkbox_7">
<p class="fl ml5"> 助教</p>
</label>
</li>
<li class="clear ">
<label>
<input type="checkbox" class="mt2 fl h28" name="membership[role_ids][]" value="10" id="add_member_checkbox_10">
<p class="fl ml5"> 学生</p>
</label>
</li>
</ul>
</div>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_grey" onclick='$("#add_course_member").hide();'>取消</a>
<a href="javascript:void(0);" class="fr sy_btn_blue mr5" onclick="$('#new_membership').submit();">保存</a>
<% end %>
</div>
<div class="clear ml10 mr10">
<%= render :partial => 'courses/settings/course_member' %>
</div>
</div>
<script>
function add_course_member(){
$("#add_course_member").toggle();
}
$(function() {
$("#add_member_checkbox_7").on('click', function(){
if($("#add_member_checkbox_7").is(":checked")) {
$("#add_member_checkbox_9").attr('disabled', 'disabled');
} else {
$("#add_member_checkbox_9").removeAttr('disabled');
}
});
$("#add_member_checkbox_9").on('click', function(){
if($("#add_member_checkbox_9").is(":checked")) {
$("#add_member_checkbox_7").attr('disabled', 'disabled');
} else {
$("#add_member_checkbox_7").removeAttr('disabled');
}
});
});
</script>

View File

@ -70,9 +70,8 @@
</tbody> </tbody>
</table> </table>
<% else %> <% else %>
<p class="nodata"> <div class="icons_tishi"><img src="/images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
<%= l(:label_no_data) %> <p class="sy_tab_con_p">没有数据可以显示!</p>
</p>
<% end %> <% end %>
</div> </div>

View File

@ -10,20 +10,20 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<th ><p class="popup_ziyuan_title fl"><%= @attachment.filename %></p><span class="muban_icons_blue ml5 fl mt12">当前版本</span></th> <td><p class="popup_ziyuan_title fl"><%= @attachment.filename %></p><span class="muban_icons_blue ml5 fl">当前版本</span></td>
<th><%= @attachment.downloads %></th> <td class="text_c"><%= @attachment.downloads %></td>
<th><%= @attachment.try(:quotes).to_i %></th> <td class="text_c"><%= @attachment.try(:quotes).to_i %></td>
<th><%= format_time(@attachment.created_on) %></th> <td class="text_c"><%= format_time(@attachment.created_on) %></td>
<!--<th></th>--> <!--<th></th>-->
</tr> </tr>
<% @attachment_histories.each do |history| %> <% @attachment_histories.each do |history| %>
<tr> <tr>
<th ><p class="popup_ziyuan_title"> <td ><p class="popup_ziyuan_title">
<%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p> <%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p>
</th> </td>
<th><%= history.downloads %></th> <td class="text_c"><%= history.downloads %></td>
<th><%= history.try(:quotes).to_i %></th> <td class="text_c"><%= history.try(:quotes).to_i %></td>
<th><%= format_time(history.created_on) %></th> <td class="text_c"><%= format_time(history.created_on) %></td>
<!--<th>--> <!--<th>-->
<%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"), <%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
# :remote => true, # :remote => true,

View File

@ -10,29 +10,29 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<th ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></th> <td ><p class="popup_ziyuan_title"><%= @attachment.filename %><span class="muban_icons_blue ml5">当前版本</span></p></td>
<th><%= @attachment.downloads %></th> <td class="text_c"><%= @attachment.downloads %></td>
<th><%= @attachment.try(:quotes).to_i %></th> <td class="text_c"><%= @attachment.try(:quotes).to_i %></td>
<th><%= format_time(@attachment.created_on) %></th> <td class="text_c"><%= format_time(@attachment.created_on) %></td>
<th></th> <td class="text_c"></td>
</tr> </tr>
<% @attachment_histories.each do |history| %> <% @attachment_histories.each do |history| %>
<tr> <tr>
<th ><p class="popup_ziyuan_title"> <td ><p class="popup_ziyuan_title">
<%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p> <%= link_to history.filename, download_history_attachment_path(history.id, history.filename), :title => history.filename+"\n"+history.description.to_s %></p>
</th> </td>
<th><%= history.downloads %></th> <td class="text_c"><%= history.downloads %></td>
<th><%= history.try(:quotes).to_i %></th> <td class="text_c"><%= history.try(:quotes).to_i %></td>
<th><%= format_time(history.created_on) %></th> <td class="text_c"><%= format_time(history.created_on) %></td>
<th> <td class="text_c">
<%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history_delete"), <%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history_delete"),
:remote => true, :remote => true,
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:method => :delete, :method => :delete,
:class => "postOptionLink", :class => "postOptionLink",
:class => "btn") if allow_to_delete_attachment(history) %> :class => "btn") if allow_to_delete_attachment(history) %>
</th> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -1,6 +1,6 @@
alert('关闭成功'); alert('关闭成功');
<% if @hw_status == 5 %> <% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); window.location.href = '<%=student_work_index_url(:homework => @homework.id) %>';
<% else %> <% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
<% end %> <% end %>

View File

@ -116,7 +116,7 @@
<li><a href="<%= href %>" target="_blank" title="<%=ma.contest_message.author.show_name %> <%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %><%= content%>"><span class="shadowbox_news_user"><%=ma.contest_message.author.show_name %> </span><%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %><%= content%></a></li> <li><a href="<%= href %>" target="_blank" title="<%=ma.contest_message.author.show_name %> <%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %><%= content%>"><span class="shadowbox_news_user"><%=ma.contest_message.author.show_name %> </span><%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %><%= content%></a></li>
<% elsif ma.contest_message_type == "JournalsForMessage" %> <% elsif ma.contest_message_type == "JournalsForMessage" %>
<% if ma.contest_message.jour_type == 'Contest' %> <% if ma.contest_message.jour_type == 'Contest' %>
<li><a href="<%= contest_feedback_path(ma.contest_id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> <%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%></a></li> <li><a href="<%= feedback_contest_path(ma.contest_id) %>" target="_blank" title="<%=ma.contest_message.user.show_name %> <%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%>"><span class="shadowbox_news_user"><%=ma.contest_message.user.show_name %> </span><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:"%><%= message_content(ma.contest_message.notes)%></a></li>
<% end %> <% end %>
<% elsif ma.contest_message_type == "ContestRequestDealResult" %> <% elsif ma.contest_message_type == "ContestRequestDealResult" %>
<% user = User.find(ma.user_id) %> <% user = User.find(ma.user_id) %>

View File

@ -19,7 +19,7 @@
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel', 'css/font-awesome' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel', 'css/font-awesome','css/contest' %>
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %> <%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
@ -127,7 +127,7 @@
<% statistics_count = 0 %> <% statistics_count = 0 %>
<% unless show_nav?(statistics_count) %> <% unless show_nav?(statistics_count) %>
<li id="sy_10" class="sy_icons_st"> <li id="sy_10" class="sy_icons_st">
<a href="<%=statistics_course_course_path(@course) %>">统计<span></span></a> <a href="<%=course_statistics_course_path(@course) %>">统计<span></span></a>
<!--<a href="javascript:void(0);" class="sy_class_add"></a>--> <!--<a href="javascript:void(0);" class="sy_class_add"></a>-->
</li> </li>
<% end %> <% end %>

View File

@ -9,12 +9,12 @@
<% end%> <% end%>
<%elsif @course%> <%elsif @course%>
<% if @create_member_error_messages%> <% if @create_member_error_messages%>
alert("<%= @create_member_error_messages%>"); notice_box("<%= @create_member_error_messages%>");
<% else%> <% else%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/settings/member') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>"); $("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>");
$("#student_number").html("<%= studentCount(@course) %>"); $("#student_number").html("<%= studentCount(@course) %>");
alert("添加成功"); notice_box("添加成功");
<% end%> <% end%>
hideOnLoad(); hideOnLoad();
<%end%> <%end%>

View File

@ -1,9 +1,9 @@
<%if @project%> <%if @project%>
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); $('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
$("#project_members_number").html("<%= @project.members.count %>"); $("#project_members_number").html("<%= @project.members.count %>");
// $('#tab-content-members').html('<%#= escape_javascript(render :partial => 'projects/settings/members') %>');
<%elsif @course%> <%elsif @course%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); hideModal();
$('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/settings/member') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>") $("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>")
$("#student_number").html("<%= studentCount(@course) %>"); $("#student_number").html("<%= studentCount(@course) %>");
<%end%> <%end%>

View File

@ -1,7 +1,7 @@
<%if @project%> <%if @project%>
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); $('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
<%elsif @course%> <%elsif @course%>
$('#course_members_setting').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/settings/member') %>');
$("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>") $("#teacher_number").html("<%= searchTeacherAndAssistant(@course).count %>")
$("#student_number").html("<%= studentCount(@course) %>"); $("#student_number").html("<%= studentCount(@course) %>");
<%end%> <%end%>

View File

@ -1,8 +1,7 @@
<div> <div>
<% if newss.empty? %> <% if newss.empty? %>
<p class="nodata"> <div class="icons_tishi"><img src="/images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
<%= l(:label_no_data) %> <p class="sy_tab_con_p">没有数据可以显示!</p>
</p>
<% else %> <% else %>
<% newss.each do |news| %> <% newss.each do |news| %>
<div class="problem_main upload_img"> <div class="problem_main upload_img">

View File

@ -1,4 +1,4 @@
$("#added_orgs").html(""); hideModal();
$("#added_orgs").html('<%= escape_javascript(render :partial => "courses/settings/added_orgs", :locals => {:orgs => @course.organizations, :course_id => @course.id}) %>'); $("#tbc_03").html('<%= escape_javascript(render :partial => "courses/settings/join_org") %>');

View File

@ -1,9 +1,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>'); <% if @status == 0 %>
showModal('ajax-modal', '270px'); notice_box_redirect("<%= poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') %>", "提交成功!");
$('#ajax-modal').css('height','110px'); <% elsif @status == 1 %>
$('#ajax-modal').siblings().remove(); notice_box("您还有尚未作答的必答题目请完成后再提交!");
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" + <% else %>
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); notice_box("发生未知错误,请检查您的网络。");
$('#ajax-modal').parent().removeClass("alert_praise"); <% end %>
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("alert_box");

View File

@ -337,7 +337,8 @@
<% end %> <% end %>
<% end %> <% end %>
if(!result){ if(!result){
alert("您的多选题答题不符合要求,请检查后再提交"); notice_box("您的多选题答题不符合要求,请检查后再提交");
//alert("");
} }
return result; return result;
} }

View File

@ -69,9 +69,9 @@
<% i = 0 %> <% i = 0 %>
<% members.each do |member| %> <% members.each do |member| %>
<tr> <tr>
<th><%= i += 1 %></th> <td class="text_c"><%= i += 1 %></td>
<th><%= link_to member.principal.show_name, user_path(member.principal), :target => "_blank" %></th> <td class="text_c"><%= link_to member.principal.show_name, user_path(member.principal), :target => "_blank" %></td>
<th> <td class="text_c">
<% if User.current.language == "zh" %> <% if User.current.language == "zh" %>
<% zh_roles = [] %> <% zh_roles = [] %>
@ -98,8 +98,8 @@
{ :onblur => "remote_function('#members-#{member.id}-roles-form');", :id =>"membership[role_ids][]", :name => "membership[role_ids][]", :style => "border:1px solid #e5e5e5;"}) %> { :onblur => "remote_function('#members-#{member.id}-roles-form');", :id =>"membership[role_ids][]", :name => "membership[role_ids][]", :style => "border:1px solid #e5e5e5;"}) %>
<% end %> <% end %>
</th> </td>
<th> <td class="text_c">
<% unless member.user_id == @project.user_id %> <% unless member.user_id == @project.user_id %>
<a href="javascript:void(0);" class=" sy_btn_blue mr5 " onclick="$('#members-<%= member.id%>-roles-form').show();$('#members_<%= member.id %>_role_show').hide();">编辑</a> <a href="javascript:void(0);" class=" sy_btn_blue mr5 " onclick="$('#members-<%= member.id%>-roles-form').show();$('#members_<%= member.id %>_role_show').hide();">编辑</a>
<%#= delete_link membership_path(member), <%#= delete_link membership_path(member),
@ -110,7 +110,7 @@
<%= link_to "删除", delete_member_pop_project_path(@project, :member => member), :remote => true, :class => "sy_btn_grey mr5"%> <%= link_to "删除", delete_member_pop_project_path(@project, :member => member), :remote => true, :class => "sy_btn_grey mr5"%>
<% end %> <% end %>
<% end %> <% end %>
</th> </td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -17,7 +17,7 @@
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %> <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<th class="hworkList390" style="text-align:left;">组长</th> <th class="hworkList390" style="text-align:left;">组长</th>
<% end %> <% end %>
<th class="hworkList130 pl10"> <th class="hworkList90 pl10">
状态 状态
</th> </th>
<% if @homework.homework_type == 2%> <% if @homework.homework_type == 2%>
@ -28,6 +28,8 @@
<th class="hworkList70 pr10 pl10" style="font-size:12px;"> <th class="hworkList70 pr10 pl10" style="font-size:12px;">
我的评分 我的评分
</th> </th>
<th class="hworkList40 pl10">
</th>
</tr> </tr>
<% @stundet_works.each_with_index do |student_work, i|%> <% @stundet_works.each_with_index do |student_work, i|%>
<% score_open = @homework.score_open == 1 || student_work.user == User.current %> <% score_open = @homework.score_open == 1 || student_work.user == User.current %>

View File

@ -26,9 +26,21 @@
</span> </span>
</div> </div>
<div class="flex-cell student_work_<%= st.id%>"> <div class="flex-cell student_work_<%= st.id%>">
<span class="<%= score_color (!score_open || st.teaching_asistant_score.nil? ? nil : st.teaching_asistant_score) %>"> <div class="<%= score_color (!score_open || st.teaching_asistant_score.nil? ? nil : st.teaching_asistant_score) %> student_score_info pr">
<%= st.teaching_asistant_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",st.teaching_asistant_score))%> <% if st.teaching_asistant_score.nil? || !score_open %>
</span> <span title=""><%=st.teaching_asistant_score.nil? ? "--" : "**" %></span>
<% else %>
<%= format("%.1f",st.teaching_asistant_score) %>
<div class="anonymous-tip none" style="line-height: 18px; top:-5px; <%= @homework.anonymous_comment == 0 ? 'right:-373px;' : 'right:-317px;' %>">
<em></em>
<font></font>
现共有
<span class="c_red">&nbsp;<%= st.student_works_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>&nbsp;</span>
名助教进行了评分,<%=@homework.homework_detail_manual.ta_mode == 1 ? "平均" : "复审" %>分为
<span class="c_red">&nbsp;<%= format("%.1f",st.teaching_asistant_score)%>&nbsp;</span>分。
</div>
<% end %>
</div>
</div> </div>
<% if @homework.anonymous_comment == 0 %> <% if @homework.anonymous_comment == 0 %>
<div class="flex-cell student_work_<%= st.id%>"> <div class="flex-cell student_work_<%= st.id%>">
@ -57,12 +69,14 @@
<span class="linkBlue"> <span class="linkBlue">
(<%= anon_count %>) (<%= anon_count %>)
</span> </span>
<div class="g_infoNi none"> <div class="anonymous-tip none" style="line-height: 18px; top:-5px; right:-288px;">
现共有 <em></em>
<span class="c_red">&nbsp;<%= anon_count %>&nbsp;</span> <font></font>
名学生进行了匿评,平均分为 现共有
<span class="c_red">&nbsp;<%= format("%.1f", st.student_score) %>&nbsp;</span>分。 <span class="c_red">&nbsp;<%= anon_count%>&nbsp;</span>
</div> 名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f",st.student_score)%>&nbsp;</span>分。
</div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@ -73,7 +87,7 @@
<div class="<%= score_color (!score_open || score.nil? ? nil : score)%> student_final_scor_info pr" style="display: inline"> <div class="<%= score_color (!score_open || score.nil? ? nil : score)%> student_final_scor_info pr" style="display: inline">
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%> <%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%>
<% unless !score_open || score.nil?%> <% unless !score_open || score.nil?%>
<div class="score-tip none tl" style="line-height: 18px; top:-32px; right:-273px;"> <div class="score-tip none tl" style="line-height: 18px; <%=@homework.anonymous_comment == 0 ? 'top:-50px; right:-273px;' : 'top:-13px; right:-288px;' %>">
<em></em> <em></em>
<font></font> <font></font>
作品最终评分为 作品最终评分为
@ -102,20 +116,13 @@
</div> </div>
</div> </div>
</div> </div>
<% if User.current.allowed_to?(:as_teacher, st.homework_common.course) %> <% if @is_teacher %>
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px; cursor: pointer;" onclick="show_student_work('<%= student_work_path(st)%>')">评分</div> <div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px; cursor: pointer;" onclick="show_student_work('<%= student_work_path(st)%>')">评分</div>
<% end %> <% end %>
<div class="hworkTip" style="display: none; left:710px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2">点击进行评分</font></div>
</li> </li>
</ul> </ul>
<script type="text/javascript"> <script type="text/javascript">
$(".student_work_<%= st.id%>").mouseenter(function(){
$("#work_click_<%= st.id%>").show();
}).mouseleave(function(){
$("#work_click_<%= st.id%>").hide();
}).mouse;
$(".syllabus_class_list").mouseenter(function(){ $(".syllabus_class_list").mouseenter(function(){
$(this).css("background-color","#f6fafd"); $(this).css("background-color","#f6fafd");
}); });

View File

@ -24,7 +24,7 @@
</th> </th>
<% else %> <% else %>
<% if @homework.homework_detail_group.base_on_project == 1 %> <% if @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList130 pl5 pr5" style="text-align:left;">组长</th> <th class="hworkList130 pl5 pr5" style="text-align:left;">组长</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList140' : 'hworkList70' %>"> <th class="<%= @homework.anonymous_comment == 1 ? 'hworkList140' : 'hworkList70' %>">
<span class="c_dark f14 fb">关联项目</span> <span class="c_dark f14 fb">关联项目</span>
</th> </th>
@ -32,7 +32,7 @@
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList270' : 'hworkList200' %> pl5 pr5" style="text-align:left;">组长</th> <th class="<%= @homework.anonymous_comment == 1 ? 'hworkList270' : 'hworkList200' %> pl5 pr5" style="text-align:left;">组长</th>
<% end %> <% end %>
<% end %> <% end %>
<th class="<%= @homework.homework_type ==2 ? 'hworkList110' : 'hworkList130' %>"> <th class="<%= @homework.homework_type ==2 ? 'hworkList70' : 'hworkList90' %>">
<%= link_to "状态", @show_all ? student_work_index_path(:homework => @homework.id, :order => "work_status", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %> <%= link_to "状态", @show_all ? student_work_index_path(:homework => @homework.id, :order => "work_status", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "work_status" %> <% if @show_all && @order == "work_status" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "work_status", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %> <%= link_to "", student_work_index_path(:homework => @homework.id, :order => "work_status", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
@ -72,6 +72,8 @@
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %> <%= link_to "", student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %> <% end %>
</th> </th>
<th class="hworkList40">
</th>
</tr> </tr>
<%# end %> <%# end %>
<% @stundet_works.each_with_index do |student_work, i| %> <% @stundet_works.each_with_index do |student_work, i| %>

View File

@ -55,7 +55,21 @@
<%= student_work.teacher_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teacher_score))%> <%= student_work.teacher_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teacher_score))%>
</td> </td>
<td class="hworkList70 <%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%>"> <td class="hworkList70 <%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score)%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : (!score_open ? "**" : format("%.1f",student_work.teaching_asistant_score)) %> <div class="<%= score_color (!score_open || student_work.teaching_asistant_score.nil? ? nil : student_work.teaching_asistant_score) %> student_score_info pr">
<% if student_work.teaching_asistant_score.nil? || !score_open %>
<span title=""><%=student_work.teaching_asistant_score.nil? ? "--" : "**" %></span>
<% else %>
<%= format("%.1f",student_work.teaching_asistant_score) %>
<div class="anonymous-tip none" style="line-height: 18px; top:5px; <%= @homework.anonymous_comment == 0 ? (@homework.homework_type == 1 ? 'right:-322px;' : 'right:-392px;') : (@homework.homework_type == 1 ? 'right:-253px;' : 'right:-323px;') %>">
<em></em>
<font></font>
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>&nbsp;</span>
名助教进行了评分,<%=@homework.homework_detail_manual.ta_mode == 1 ? "平均" : "复审" %>分为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.teaching_asistant_score)%>&nbsp;</span>分。
</div>
<% end %>
</div>
</td> </td>
<% if @homework.homework_type == 2%> <% if @homework.homework_type == 2%>
@ -110,7 +124,7 @@
<td class="hworkList70 <%= score_color (!score_open || score.nil? ? nil : score)%> student_final_scor_info pr"> <td class="hworkList70 <%= score_color (!score_open || score.nil? ? nil : score)%> student_final_scor_info pr">
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%> <%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score))%>
<% unless !score_open || score.nil?%> <% unless !score_open || score.nil?%>
<div class="score-tip none tl" style="line-height: 18px;"> <div class="score-tip none tl" style="line-height: 18px; <%= @homework.anonymous_comment == 0 ? '' : 'top: 10px;' %>">
<em></em> <em></em>
<font></font> <font></font>
作品最终评分为 作品最终评分为
@ -136,7 +150,16 @@
</div> </div>
<% end%> <% end%>
</td> </td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td> <td>
<% if @is_teacher %>
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px; cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>')">评分</div>
<% end %>
</td>
<td>
<div style="position:relative;">
<div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div>
</div>
</td>
</tr> </tr>
<%# end %> <%# end %>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -88,6 +88,9 @@
<td class="hworkList70 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10 ml10"> <td class="hworkList70 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10 ml10">
<%= my_score.nil? ? "--" : format("%.1f",my_score.score)%> <%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
</td> </td>
<td>
<div class="fr ml5" style="width:25px; color: #3b94d6; text-align:right; margin-right:5px; cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>')">评分</div>
</td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td> <td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr> </tr>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,5 +1,5 @@
<% user_ids = student_work.student_work_projects.empty? ? "(-1)" : "(" + student_work.student_work_projects.map{|st| st.user_id}.join(",") + ")" %> <% user_ids = student_work.student_work_projects.map(&:user_id) %>
<% student_work_groups = @homework.student_works.where("user_id in #{user_ids}").order("created_at asc") %> <% student_work_groups = @homework.student_works.where(user_id: user_ids).includes(:user).order("created_at asc") %>
<% anon_count = student_work.student_works_scores.where("reviewer_role = 3 and appeal_status != 3").group_by(&:user_id).count %> <% anon_count = student_work.student_works_scores.where("reviewer_role = 3 and appeal_status != 3").group_by(&:user_id).count %>
<% student_work_groups.each_with_index do |st, j| %> <% student_work_groups.each_with_index do |st, j| %>
<% score_open = @is_teacher || @homework.score_open == 1 || st.user == User.current %> <% score_open = @is_teacher || @homework.score_open == 1 || st.user == User.current %>

View File

@ -5,11 +5,10 @@
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%> <%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%>
</div> </div>
<div class="homepagePostTitle hidden fl m_w505"> <div class="homepagePostTitle break_full_word fl">
<% index = get_hw_index(homework, is_teacher) %> <% index = get_hw_index(homework, is_teacher) %>
<%= link_to "<span class='fontBlue2'>作业#{index + 1}</span>".html_safe + homework.name,student_work_index_path(:homework => homework.id),:class => "postGrey"%> <span class='postGrey fl'><font class="fontBlue2">作业<%= index + 1 %></font><%= homework.name%> <%=get_hw_status(homework).html_safe %></span>
</div> </div>
<%=get_hw_status(homework).html_safe %>
<div class="cl"></div> <div class="cl"></div>
<% if homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1%> <% 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),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>

View File

@ -36,6 +36,20 @@
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %> 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if defined?(is_course) && is_course == 1 && (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher, course))%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<a href="javascript:void(0)" class="postOptionLink" title="删除"
onclick="delete_confirm_box_3('<%= words_destroy_path(:object_id => activity, :user_id => activity.user.id,:user_activity_id => user_activity_id, :activity_id => activity.id)%>', '确定要删除该留言吗?')">删除</a>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -18,7 +18,7 @@
</span> </span>
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<% content = message_user.show_name + "申请成为班级\"" + "#{contest.name}" + "\"的" + get_role_str(ma.role) %> <% content = message_user.show_name + "申请成为竞赛\"" + "#{contest.name}" + "\"的" + get_role_str(ma.role) %>
<%= link_to contest.name, contest_path(contest.id), <%= link_to contest.name, contest_path(contest.id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank', :title => "#{content}" %> :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank', :title => "#{content}" %>
</li> </li>

View File

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

View File

@ -15,7 +15,7 @@
<%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %>
<% end %> <% end %>
<% end %> <% end %>
<% else %> <% elsif User.current == @user %>
<%= render :partial => "projects/no_data" %> <%= render :partial => "projects/no_data" %>
<% end %> <% end %>
<% if (jours.count + page * 10) < count %> <% if (jours.count + page * 10) < count %>

View File

@ -31,7 +31,7 @@
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to Contest.find(ma.contest_id).name, contest_path(ma.contest_id), <%= link_to Contest.find(ma.contest_id).name, contest_path(ma.contest_id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li> </li>
</div> </div>
<li class="messageOperateContents fl"> <li class="messageOperateContents fl">
@ -58,7 +58,7 @@
<span class="homepageNewsType fl">将您加入了竞赛:</span> <span class="homepageNewsType fl">将您加入了竞赛:</span>
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> <%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li> </li>
</div> </div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
@ -78,7 +78,7 @@
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to User.find(ma.contest_message_id).login+"("+(User.find(ma.contest_message_id).realname ? User.find(ma.contest_message_id).realname : User.find(ma.contest_message_id).login) +")", <%= link_to User.find(ma.contest_message_id).login+"("+(User.find(ma.contest_message_id).realname ? User.find(ma.contest_message_id).realname : User.find(ma.contest_message_id).login) +")",
{:controller => 'contests', :action => 'settings', :id => ma.contest_id, :tab=>'member'}, {:controller => 'contests', :action => 'settings', :id => ma.contest_id, :tab=>'member'},
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank' %> :target => '_blank' %>
</li> </li>
</div> </div>
@ -97,7 +97,7 @@
<span class="homepageNewsType fl">将您移出了竞赛:</span> <span class="homepageNewsType fl">将您移出了竞赛:</span>
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> <%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li> </li>
</div> </div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
@ -117,13 +117,13 @@
<li class="messageInformationContents"> <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 %> <% 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), <%= link_to ma.contest_message.name, new_contestant_work_path(:work => ma.contest_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank', :target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}" :title => "竞赛题:#{ma.contest_message.name}"
%> %>
<% else %> <% else %>
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), <%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank', :target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}" :title => "竞赛题:#{ma.contest_message.name}"
%> %>
@ -148,7 +148,7 @@
<span class="homepageNewsType fl">发布的竞赛题:</span></li> <span class="homepageNewsType fl">发布的竞赛题:</span></li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), <%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank', :target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}" :title => "竞赛题:#{ma.contest_message.name}"
%> %>
@ -170,7 +170,7 @@
<span class="homepageNewsType fl">启动了在线评审:</span> <span class="homepageNewsType fl">启动了在线评审:</span>
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}"%> <%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}"%>
</li> </li>
</div> </div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
@ -188,7 +188,7 @@
<span class="homepageNewsType fl">在线评审启动失败<font class="c_red">(评委数为0或作品数为0)</font></span> <span class="homepageNewsType fl">在线评审启动失败<font class="c_red">(评委数为0或作品数为0)</font></span>
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}"%> <%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}"%>
</li> </li>
</div> </div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
@ -209,7 +209,7 @@
<span class="homepageNewsType fl">启动的在线评审:</span></li> <span class="homepageNewsType fl">启动的在线评审:</span></li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), <%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank', :target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}" :title => "竞赛题:#{ma.contest_message.name}"
%> %>
@ -232,7 +232,7 @@
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.title, {:controller => 'news', :action => 'show', :id => ma.contest_message.id }, <%= link_to ma.contest_message.title, {:controller => 'news', :action => 'show', :id => ma.contest_message.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank', :target => '_blank',
:title => "#{ma.contest_message.title}" :title => "#{ma.contest_message.title}"
%> %>
@ -254,7 +254,7 @@
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.contest_message.commented.id }, <%= link_to ma.contest_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.contest_message.commented.id },
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" , :class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}" ,
:target => '_blank', :target => '_blank',
:title => "#{ma.contest_message.commented.title}" :title => "#{ma.contest_message.commented.title}"
%> %>
@ -277,7 +277,7 @@
<% if ma.contest_message.parent_id.nil? %> <% if ma.contest_message.parent_id.nil? %>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to ma.contest_message.subject, board_message_path(ma.contest_message.board_id, ma.contest_message.id), <%= link_to ma.contest_message.subject, board_message_path(ma.contest_message.board_id, ma.contest_message.id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank', :target => '_blank',
:title => "#{ma.contest_message.subject}" :title => "#{ma.contest_message.subject}"
%> %>
@ -285,7 +285,7 @@
<% else %> <% else %>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to message_content(ma.contest_message.content), board_message_path(ma.contest_message.board_id, ma.contest_message.parent_id), <%= link_to message_content(ma.contest_message.content), board_message_path(ma.contest_message.board_id, ma.contest_message.parent_id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li> </li>
<% end %> <% end %>
</div> </div>
@ -304,8 +304,8 @@
<span class="homepageNewsType fl"><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:" %></span> <span class="homepageNewsType fl"><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:" %></span>
</li> </li>
<li class="messageInformationContents"> <li class="messageInformationContents">
<%= link_to message_content(ma.contest_message.notes), contest_feedback_path(:id => ma.contest_id), <%= link_to message_content(ma.contest_message.notes), feedback_contest_path(:id => ma.contest_id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li> </li>
</div> </div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -28,12 +28,12 @@
<% else %> <% else %>
$('#course_jour_count').html("<%= @jours_count %>"); $('#course_jour_count').html("<%= @jours_count %>");
<% end %> <% end %>
<% elsif @contest && @jours_count%> <% elsif @contest && @jours_count%>
<% if @user_activity_id %> <% if @user_activity_id %>
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_journal_post_reply', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>"); $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/user_journal_post_reply', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity"); sd_create_editor_from_data('<%= @user_activity_id%>', "", "100%", "UserActivity");
<% end %> <% end %>
<% elsif @user && @jours_count%> <% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>"); $('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%> <% elsif @homework%>
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>"); $("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @user_activity_id, :is_teacher => @is_teacher}) %>");

View File

@ -1,4 +1,4 @@
if Rails.env.development? if Rails.env.development?
Rack::MiniProfiler.config.position = 'right' Rack::MiniProfiler.config.position = 'right'
Rack::MiniProfiler.config.start_hidden = true Rack::MiniProfiler.config.start_hidden = false
end end

View File

@ -1354,7 +1354,7 @@ RedmineApp::Application.routes.draw do
get 'search_public_orgs_not_in_course' get 'search_public_orgs_not_in_course'
get "homework_search" get "homework_search"
get "show_comparecode" get "show_comparecode"
get "statistics_course" get "course_statistics"
get "switch_role" get "switch_role"
get 'search_not_group_member' get 'search_not_group_member'
post 'add_members' post 'add_members'
@ -1408,7 +1408,7 @@ RedmineApp::Application.routes.draw do
end # end of resources :courses end # end of resources :courses
match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback' match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback'
match '/courses/search', :via => [:get, :post] match '/courses/search', :via => [:get, :post]
match 'words/:id/leave_course_message', :to => 'words#leave_course_message' match 'words/:id/leave_course_message', :to => 'words#leave_course_message', :as => "leave_course_message"
match 'workflows', :to => 'workflows#index', :via => :get match 'workflows', :to => 'workflows#index', :via => :get

View File

@ -0,0 +1,5 @@
class AddIndexToUserExtensions < ActiveRecord::Migration
def change
add_index :user_extensions, :user_id
end
end

View File

@ -0,0 +1,8 @@
class UpdateAppliedMessageStatus < ActiveRecord::Migration
def up
AppliedMessage.where(:applied_type => "ApplyAddSchools", :status => 0).update_all(:status => 1)
end
def down
end
end

View File

@ -350,16 +350,14 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids" add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
create_table "changesets", :force => true do |t| create_table "changesets", :force => true do |t|
t.integer "repository_id", :null => false t.integer "repository_id", :null => false
t.string "revision", :null => false t.string "revision", :null => false
t.string "committer" t.string "committer"
t.datetime "committed_on", :null => false t.datetime "committed_on", :null => false
t.text "comments" t.text "comments"
t.date "commit_date" t.date "commit_date"
t.string "scmid" t.string "scmid"
t.integer "user_id" t.integer "user_id"
t.integer "project_id"
t.integer "type", :default => 0
end end
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on" add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
@ -630,6 +628,20 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.integer "container_id", :default => 0 t.integer "container_id", :default => 0
end end
create_table "course_class_post", :id => false, :force => true do |t|
t.integer "班级id", :default => 0, :null => false
t.string "班级名"
t.integer "帖子id", :default => 0, :null => false
t.integer "主贴id"
t.string "帖子标题", :default => "", :null => false
t.text "帖子内容"
t.integer "帖子用户id"
t.integer "帖子回复数", :default => 0, :null => false
t.integer "最后回帖id"
t.datetime "发帖时间", :null => false
t.datetime "帖子更新时间", :null => false
end
create_table "course_contributor_scores", :force => true do |t| create_table "course_contributor_scores", :force => true do |t|
t.integer "course_id" t.integer "course_id"
t.integer "user_id" t.integer "user_id"
@ -657,6 +669,21 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
add_index "course_groups", ["course_id"], :name => "index_course_groups_on_course_id" add_index "course_groups", ["course_id"], :name => "index_course_groups_on_course_id"
create_table "course_homework_statistics", :force => true do |t|
t.integer "user_id"
t.integer "course_id"
t.integer "committed_work_num", :default => 0
t.integer "un_commit_work_num", :default => 0
t.integer "late_commit_work_num", :default => 0
t.integer "absence_evaluation_work_num", :default => 0
t.integer "un_evaluation_work_num", :default => 0
t.integer "appeal_num", :default => 0
t.float "average_score", :default => 0.0
t.float "total_score", :default => 0.0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "course_infos", :force => true do |t| create_table "course_infos", :force => true do |t|
t.integer "course_id" t.integer "course_id"
t.integer "user_id" t.integer "user_id"
@ -698,8 +725,8 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.string "code" t.string "code"
t.integer "time" t.integer "time"
t.string "extra" t.string "extra"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "location" t.string "location"
t.string "term" t.string "term"
t.string "string" t.string "string"
@ -709,29 +736,28 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.string "class_period" t.string "class_period"
t.integer "school_id" t.integer "school_id"
t.text "description" t.text "description"
t.integer "status", :default => 1 t.integer "status", :default => 1
t.integer "attachmenttype", :default => 2 t.integer "attachmenttype", :default => 2
t.integer "lft" t.integer "lft"
t.integer "rgt" t.integer "rgt"
t.integer "is_public", :limit => 1, :default => 1 t.integer "is_public", :limit => 1, :default => 1
t.integer "inherit_members", :limit => 1, :default => 1 t.integer "inherit_members", :limit => 1, :default => 1
t.integer "open_student", :default => 0 t.integer "open_student", :default => 0
t.integer "outline", :default => 0 t.integer "outline", :default => 0
t.integer "publish_resource", :default => 0 t.integer "publish_resource", :default => 0
t.integer "is_delete", :default => 0 t.integer "is_delete", :default => 0
t.integer "end_time" t.integer "end_time"
t.string "end_term" t.string "end_term"
t.integer "is_excellent", :default => 0 t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0 t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0 t.integer "is_copy", :default => 0
t.integer "visits", :default => 0 t.integer "visits", :default => 0
t.integer "syllabus_id" t.integer "syllabus_id"
t.string "invite_code" t.string "invite_code"
t.string "qrcode" t.string "qrcode"
t.integer "qrcode_expiretime", :default => 0 t.integer "qrcode_expiretime", :default => 0
t.integer "professional_level_id", :limit => 1 t.integer "invite_code_halt", :limit => 1, :default => 0
t.integer "invite_code_halt", :limit => 1, :default => 0 t.integer "os_allow", :default => 0
t.integer "os_allow", :default => 0
end end
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
@ -806,11 +832,6 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "disciplines", :force => true do |t|
t.string "name"
t.integer "professional_level_id", :limit => 1
end
create_table "discuss_demos", :force => true do |t| create_table "discuss_demos", :force => true do |t|
t.string "title" t.string "title"
t.text "body" t.text "body"
@ -936,11 +957,13 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.integer "exercise_status" t.integer "exercise_status"
t.integer "user_id" t.integer "user_id"
t.integer "time" t.integer "time"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.datetime "publish_time" t.datetime "publish_time"
t.datetime "end_time" t.datetime "end_time"
t.integer "show_result" t.integer "show_result"
t.integer "question_random", :default => 0
t.integer "choice_random", :default => 0
end end
create_table "first_pages", :force => true do |t| create_table "first_pages", :force => true do |t|
@ -1130,10 +1153,6 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
create_table "invite_lists", :force => true do |t| create_table "invite_lists", :force => true do |t|
t.integer "project_id" t.integer "project_id"
t.integer "user_id" t.integer "user_id"
@ -1666,12 +1685,9 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
end end
create_table "professional_levels", :force => true do |t| create_table "professional_levels", :force => true do |t|
t.integer "level" t.string "level"
end t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
create_table "professions", :force => true do |t|
t.string "name"
t.integer "discipline_id", :limit => 1
end end
create_table "project_infos", :force => true do |t| create_table "project_infos", :force => true do |t|
@ -1734,6 +1750,7 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.boolean "hidden_repo", :default => false, :null => false t.boolean "hidden_repo", :default => false, :null => false
t.integer "attachmenttype", :default => 1 t.integer "attachmenttype", :default => 1
t.integer "user_id" t.integer "user_id"
t.integer "dts_test", :default => 0
t.string "enterprise_name" t.string "enterprise_name"
t.integer "organization_id" t.integer "organization_id"
t.integer "project_new_type" t.integer "project_new_type"
@ -1741,11 +1758,6 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.integer "forked_from_project_id" t.integer "forked_from_project_id"
t.integer "forked_count" t.integer "forked_count"
t.integer "publish_resource", :default => 0 t.integer "publish_resource", :default => 0
t.integer "boards_count", :default => 0
t.integer "news_count", :default => 0
t.integer "acts_count", :default => 0
t.integer "journals_count", :default => 0
t.integer "boards_reply_count", :default => 0
t.integer "visits", :default => 0 t.integer "visits", :default => 0
t.integer "hot", :default => 0 t.integer "hot", :default => 0
t.string "invite_code" t.string "invite_code"
@ -2144,8 +2156,8 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.string "title" t.string "title"
t.text "description" t.text "description"
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "eng_name" t.string "eng_name"
t.integer "syllabus_type" t.integer "syllabus_type"
t.integer "credit" t.integer "credit"
@ -2154,9 +2166,8 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.integer "practice_hours" t.integer "practice_hours"
t.string "applicable_major" t.string "applicable_major"
t.string "pre_course" t.string "pre_course"
t.integer "visits", :default => 0 t.integer "visits", :default => 0
t.integer "des_status", :default => 0 t.integer "des_status", :default => 0
t.integer "professional_level_id", :limit => 1
end end
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
@ -2278,6 +2289,8 @@ ActiveRecord::Schema.define(:version => 20170120021457) do
t.string "description", :default => "" t.string "description", :default => ""
end end
add_index "user_extensions", ["user_id"], :name => "index_user_extensions_on_user_id"
create_table "user_feedback_messages", :force => true do |t| create_table "user_feedback_messages", :force => true do |t|
t.integer "user_id" t.integer "user_id"
t.integer "journals_for_message_id" t.integer "journals_for_message_id"

16
lib/tasks/test.rake Normal file
View File

@ -0,0 +1,16 @@
Rake::TaskManager.class_eval do
def delete_task(task_name)
@tasks.delete(task_name.to_s)
end
Rake.application.delete_task("db:test:purge")
Rake.application.delete_task("db:test:prepare")
end
namespace :db do
namespace :test do
task :purge do
end
task :prepare do
end
end
end

View File

@ -614,13 +614,13 @@ function warnLeavingUnsaved(message) {
$(this).data('changed', 'changed'); $(this).data('changed', 'changed');
}); });
window.onbeforeunload = function(){ window.onbeforeunload = function(){
var warn = false; // var warn = false;
$('textarea').blur().each(function(){ // $('textarea').blur().each(function(){
if ($(this).data('changed')) { // if ($(this).data('changed')) {
warn = true; // warn = true;
} // }
}); // });
if (warn) {return warnLeavingUnsavedMessage;} // if (warn) {return warnLeavingUnsavedMessage;}
}; };
} }
@ -1773,6 +1773,14 @@ function notice_box(str){
pop_box_new(htmlvalue, 300, 140); pop_box_new(htmlvalue, 300, 140);
} }
//提示框:只有一个确定按钮,点击跳转
function notice_box_redirect(url, str){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">' + str + '</p><div class="cl"></div>'+
'<a href="'+ url +'" class="fr sy_btn_blue mt10 mr10" style="margin-right: 124px;">确定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
//删除组织成员 //删除组织成员
function ifDeleteOrgMember(id,name){ function ifDeleteOrgMember(id,name){
var htmlvalue = "</br><div style='width:550px;text-align:center'>您确定要删除"+name+"吗?</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn fl' onclick='deleteOrgMember("+id+")'>确定</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a></div>" + var htmlvalue = "</br><div style='width:550px;text-align:center'>您确定要删除"+name+"吗?</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn fl' onclick='deleteOrgMember("+id+")'>确定</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a></div>" +

View File

@ -158,6 +158,7 @@ function jourReplyVerify() {
if (jour_content_editor.isEmpty()) { if (jour_content_editor.isEmpty()) {
$("#jour_content_span").text("留言不能为空"); $("#jour_content_span").text("留言不能为空");
$("#jour_content_span").css('color', '#ff0000'); $("#jour_content_span").css('color', '#ff0000');
$("#jour_content_span").show();
$("#submit_feedback_user").one('click',function() { $("#submit_feedback_user").one('click',function() {
contest_jour_submit(); contest_jour_submit();
}); });

View File

@ -1606,3 +1606,35 @@ function submit_course_feedback() {
function show_more_tool(){ function show_more_tool(){
$('#navContentCourse').css('display', 'block'); $('#navContentCourse').css('display', 'block');
} }
//留言
function course_jour_submit(){
if(jourReplyVerify()){
jour_content_editor.sync();//提交内容之前要sync不然服务器端取不到值
$("#course_feedback_new").submit();
}
}
function jourReplyVerify() {
var content = jour_content_editor.html();//$.trim($("#message_content").val());
if (jour_content_editor.isEmpty()) {
$("#jour_content_span").text("留言不能为空");
$("#jour_content_span").show();
$("#jour_content_span").css('color', '#ff0000');
$("#submit_feedback_user").one('click',function() {
course_jour_submit();
});
return false;
}
else {
$("#jour_content_span").text("填写正确");
$("#jour_content_span").css('color', '#008000');
return true;
}
}
function cancel_jour_submit(){
jour_content_editor.html("");
$("#jour_content_span").text("");
$("#jour_content_span").hide();
}

View File

@ -103,7 +103,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mt1{margin-top: 1px;}.mt2{ margin-top:2px;}.mt3{ margin-top:3px;}.mt4{ margin-top:4px;}.mt5{ margin-top:5px;}.mt6{ margin-top:6px;}.mt7 {margin-top:7px;} .mt1{margin-top: 1px;}.mt2{ margin-top:2px;}.mt3{ margin-top:3px;}.mt4{ margin-top:4px;}.mt5{ margin-top:5px;}.mt6{ margin-top:6px;}.mt7 {margin-top:7px;}
.mt8{ margin-top:8px !important;}.mt9{ margin-top:9px !important;}.mt10{ margin-top:10px !important;}.mt12 { margin-top:12px !important;} .mt8{ margin-top:8px !important;}.mt9{ margin-top:9px !important;}.mt10{ margin-top:10px !important;}.mt12 { margin-top:12px !important;}
.mt15 {margin-top:15px;}.mt16{ margin-top:16px !important;}.mt19 {margin-top:19px !important;}.mt20{margin-top: 20px;}.mt28 {margin-top:28px;}.mt30{ margin-top: 30px;} .mt15 {margin-top:15px;}.mt16{ margin-top:16px !important;}.mt19 {margin-top:19px !important;}.mt20{margin-top: 20px;}.mt28 {margin-top:28px;}.mt30{ margin-top: 30px;}
.mt35 {margin-top:35px;}.mt40{ margin-top: 40px;}.mt50{ margin-top:50px;}.mt100{ margin-top:100px;}.mb0 {margin-bottom: 0px !important;}.mb4{ margin-bottom:4px;} .mt35 {margin-top:35px;}.mt40{ margin-top: 40px;}.mt45{ margin-top: 45px;}.mt50{ margin-top:50px;}.mt100{ margin-top:100px;}.mb0 {margin-bottom: 0px !important;}.mb4{ margin-bottom:4px;}
.mb5{ margin-bottom:5px;}.mb8 {margin-bottom:8px !important;}.pb5{ padding-bottom: 5px;}.mb10{ margin-bottom:10px !important;}.mb12 {margin-bottom:12px !important;} .mb5{ margin-bottom:5px;}.mb8 {margin-bottom:8px !important;}.pb5{ padding-bottom: 5px;}.mb10{ margin-bottom:10px !important;}.mb12 {margin-bottom:12px !important;}
.mb15{margin-bottom: 15px;}.mb20{ margin-bottom:20px;}.mb25{ margin-bottom:25px;}.mb30 {margin-bottom:30px;}.mb40 {margin-bottom:40px;}.pl5{ padding-left:5px;} .mb15{margin-bottom: 15px;}.mb20{ margin-bottom:20px;}.mb25{ margin-bottom:25px;}.mb30 {margin-bottom:30px;}.mb40 {margin-bottom:40px;}.pl5{ padding-left:5px;}
.pl10 {padding-left:10px;}.pr5 {padding-right:5px;}.pr10{padding-right: 10px;}.pl62 {padding-left: 62px;}.pl15{ padding-left:15px;}.pt5{ padding-top:5px;} .pl10 {padding-left:10px;}.pr5 {padding-right:5px;}.pr10{padding-right: 10px;}.pl62 {padding-left: 62px;}.pl15{ padding-left:15px;}.pt5{ padding-top:5px;}
@ -111,7 +111,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w56 {width:56px;}.w60{ width:60px;}.w61{ width:61px;}.w65{ width:65px;}.w70{ width:70px;}.w80{ width:80px;}.w90{ width:90px;}.w100 {width: 100px;}.w110{width:110px !important;} .w56 {width:56px;}.w60{ width:60px;}.w61{ width:61px;}.w65{ width:65px;}.w70{ width:70px;}.w80{ width:80px;}.w90{ width:90px;}.w100 {width: 100px;}.w110{width:110px !important;}
.w108 {width:108px;}.w125{width:125px;}.w128{ width:128px;}.w130{ width:130px;}.w140{ width:140px;}.w145{ width:145px;}.w150{ width:150px;} .w108 {width:108px;}.w125{width:125px;}.w128{ width:128px;}.w130{ width:130px;}.w140{ width:140px;}.w145{ width:145px;}.w150{ width:150px;}
.w160{width:160px !important;}.w170{width:170px;}.w180{width:180px;}.w186{ width:186px;}.w190{width: 190px;}.w196{ width:196px;}.w200{width: 200px;}.w210{ width:210px;} .w160{width:160px !important;}.w170{width:170px;}.w180{width:180px;}.w186{ width:186px;}.w190{width: 190px;}.w196{ width:196px;}.w200{width: 200px;}.w210{ width:210px;}
.w230{width:230px !important;}.w235{ width:235px !important;}.w265{ width: 265px;}.w270{ width: 270px;}.w280{ width:280px;}.w289{ width:289px !important;} .w230{width:230px !important;}.w235{ width:235px !important;}.w265{ width: 265px;}.w270{ width: 270px;}.w280{ width:280px;}.w289{ width:289px !important;}.w290{ width:290px !important;}
.w300{ width:300px !important;}.w305{ width:305px;}.w350 {width:350px;}.w362 {width:362px;}.h400{height:400px !important;}.w430{ width:430px;} .w300{ width:300px !important;}.w305{ width:305px;}.w350 {width:350px;}.w362 {width:362px;}.h400{height:400px !important;}.w430{ width:430px;}
.W440{ width:440px;}.w450 {width:450px;}.w455{width:455px !important;}.w459{ width:459px;}.w460{ width:460px;}.w465{width:465px !important;} .W440{ width:440px;}.w450 {width:450px;}.w455{width:455px !important;}.w459{ width:459px;}.w460{ width:460px;}.w465{width:465px !important;}
.w490{width:490px;}.w536{ width:536px;}.w543{ width:543px;}.w557{ width:557px;}.w570 {width:570px !important;}.w576{ width:576px;}.w590{ width:590px !important;} .w490{width:490px;}.w536{ width:536px;}.w543{ width:543px;}.w557{ width:557px;}.w570 {width:570px !important;}.w576{ width:576px;}.w590{ width:590px !important;}
@ -244,7 +244,7 @@ a.submit_btn2:hover {background-color: #297fb8;}
/****翻页***/ /****翻页***/
.wlist{float:right;} .wlist{float:right;}
.wlist li{float:left;} .wlist li{float:left;}
.wlist a{ float:left; border:1px solid #3b94d6; padding:0 5px; margin-left:3px; color:#3b94d6;} .wlist a{ float:left; border:1px solid #64bdd9; padding:0 5px; margin-right:5px; color:#888;}
.wlist a:hover{border:1px solid #3b94d6; background-color:#3b94d6; color:#fff; text-decoration:none;} .wlist a:hover{border:1px solid #3b94d6; background-color:#3b94d6; color:#fff; text-decoration:none;}
.wlist_select a { background-color:#3b94d6; color:#fff;} .wlist_select a { background-color:#3b94d6; color:#fff;}
/*add by Tim*/ /*add by Tim*/

View File

@ -188,10 +188,10 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
.HomeworkNameTitle{width: 285px;text-align: left;margin-left: 50px;} .HomeworkNameTitle{width: 285px;text-align: left;margin-left: 50px;}
.HomeworkStuTitle{width: 80px;text-align: center;} .HomeworkStuTitle{width: 80px;text-align: center;}
.StudentName{display: table-cell;width: 115px;vertical-align: middle;text-align: left;height: 40px;} .StudentName{display: table-cell;width: 115px;vertical-align: middle;text-align: left;height: 40px;}
.score-tip {width:140px; color:#666; position:absolute; padding:3px 5px; border:1px solid #eaeaea; right:-183px; top:-8px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); white-space:nowrap;} .score-tip {width:140px; color:#666; position:absolute; padding:3px 5px; border:1px solid #eaeaea; right:-223px; top:-30px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); white-space:nowrap;}
.score-tip em {display:block; border-width:8px; position:absolute; bottom:32px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} .score-tip em {display:block; border-width:8px; position:absolute; bottom:32px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.score-tip font {display:block; border-width:8px; position:absolute; bottom:31px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;} .score-tip font {display:block; border-width:8px; position:absolute; bottom:31px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;}
.anonymous-tip {width:100px;color:#666; position:absolute; padding:3px 5px; border:1px solid #eaeaea; right:-213px; top:-1px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} .anonymous-tip {width:100px;color:#666; position:absolute; padding:3px 5px; border:1px solid #eaeaea; right:-253px; top:-1px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);}
.anonymous-tip em {display:block; border-width:8px; position:absolute; bottom:25px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} .anonymous-tip em {display:block; border-width:8px; position:absolute; bottom:25px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.anonymous-tip font {display:block; border-width:8px; position:absolute; bottom:26px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;} .anonymous-tip font {display:block; border-width:8px; position:absolute; bottom:26px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;}
/*作业信息*/ /*作业信息*/
@ -495,3 +495,41 @@ a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-
.archive_course_notice em {display:block; border-width:10px; position:absolute;top:26px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} .archive_course_notice em {display:block; border-width:10px; position:absolute;top:26px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.archive_course_notice span {display:block; border-width:10px; position:absolute;top:26px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;} .archive_course_notice span {display:block; border-width:10px; position:absolute;top:26px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;}
.teacher_member_img{width:50px; height:50px; border: 1px solid #fff;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;} .teacher_member_img{width:50px; height:50px; border: 1px solid #fff;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;}
/* 设置页的头像更换 */
.banner-course-avatar { width: 64px; height: 62px; position: relative; overflow: hidden;}
.banner-course-inner {
display: block;
position: absolute;
left: 0;
top: 100%;
width: 100%;
height: 100%;
background: #000;
text-align: center;
opacity: 0.3;
-moz-transition: top ease 200ms;
-o-transition: top ease 200ms;
-webkit-transition: top ease 200ms;
transition: top ease 200ms;
}
a.banner-course-notice {position: absolute; font-size: 12px; line-height: 20px; top: 102px; left: 10px; color: #fff;}
.banner-course-avatar:hover .banner-course-inner { top: 0;}
.banner-course-avatar:hover .banner-course-notice { top: 20px;}
.course_setting_org_fl {width: 49%; border-right: 1px solid #e5e5e5;}
.course_setting_org_fr {width: 49%;}
/*20161222班级统计*/
.game-setting-h3{ width: 100%; height: 40px; line-height: 40px; font-size: 14px; color: #666; font-weight: normal; background: #fff; border-bottom: 10px solid #eaebec;}
.t-center{ text-align: center;}
.table-td-w20{ width: 18%;}
.table-td-w10{ width: 10%;}
.table-td-w30{ width: 30%;}
.new_project_title_width {font-size: 14px;color: #666; max-width: 180px;font-weight: normal;white-space: nowrap;overflow: hidden; text-overflow: ellipsis;}
.syllabus_class_property { font-size: 12px; padding: 0 5px;border-radius: 3px;line-height: 14px;}
.syllabus_class_private {color: #ff4a1b;border: 1px solid #ff4a1b;}
.syllabus_class_open { color: #7dd26c; border: 1px solid #7dd26c;}
.st_tips_box_inner{ position: absolute;line-height: 2.0;padding: 5px 10px; white-space: nowrap; background-color: #fff; left:100px; top: -5px; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}
.st_tips_box_inner span { display: block; border-width: 10px;position: absolute;top: 15px; left: -18px; border-style: dashed solid dashed dashed;border-color: transparent #fff transparent transparent;font-size: 0;line-height: 0;}
.course_class_users_st_name{ display: inline-block;width:120px; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

View File

@ -14,7 +14,7 @@ input.radio-width90{ width: 90px; }
.muban_table thead tr{ height:40px; line-height:40px;} .muban_table thead tr{ height:40px; line-height:40px;}
.muban_table thead tr th{ border-bottom:1px solid #e5e5e5;} .muban_table thead tr th{ border-bottom:1px solid #e5e5e5;}
.muban_table tbody tr:hover{ background:#f5f5f5;} .muban_table tbody tr:hover{ background:#f5f5f5;}
.muban_table tbody tr th{ height:40px; line-height:40px; border-bottom:1px solid #e5e5e5; font-weight:normal; color:#888;} .muban_table tbody tr td{ height:40px; border-bottom:1px solid #e5e5e5; font-weight:normal; color:#888;}
/*模板icons 20161013byLB*/ /*模板icons 20161013byLB*/
.muban_icons_orange{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #ff4a1b;border: 1px solid #ff4a1b;} .muban_icons_orange{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #ff4a1b;border: 1px solid #ff4a1b;}
.muban_icons_blue{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #3b94d6;border: 1px solid #3b94d6;} .muban_icons_blue{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #3b94d6;border: 1px solid #3b94d6;}

View File

@ -317,6 +317,13 @@ a.postRouteLink:hover {text-decoration:underline;}
.resourceSendO {width:65px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-48px; top:20px; padding:2px 0px; display:none;} .resourceSendO {width:65px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-48px; top:20px; padding:2px 0px; display:none;}
.ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;}
.ReplyToMessageInputContainer {width:582px; float:left;} .ReplyToMessageInputContainer {width:582px; float:left;}
/****翻页***/
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
ul.wlist li{float: left;}
ul.wlist li a{ border:1px solid #d1d1d1; padding: 1px 4px 1px 4px; margin-right:5px;}
ul.wlist li a:hover{ background:#3b94d6; color:#fff; text-decoration:none;}
/*.wlist_select { background-color:#64bdd9; color:#fff; padding: 1px 5px 0px 5px; margin-left:3px;margin-top: -2px; border:1px solid #64bdd9;}*/
.wlist_select a{background-color: #3b94d6;cursor: default;}
/*博客列表界面样式*/ /*博客列表界面样式*/
.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; } .listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; }
/*.bloglistbox{ min-height:690px;}*/ /*.bloglistbox{ min-height:690px;}*/

View File

@ -607,6 +607,7 @@ a:hover.sy_class_ltitle{ color:#333;}
.sy_new_table tbody tr:hover{ background:#f5f5f5;} .sy_new_table tbody tr:hover{ background:#f5f5f5;}
.sy_new_table tbody tr td{ height:40px; line-height:40px; border-bottom:1px dashed #e5e5e5; font-weight:normal; color:#888; text-align: center} .sy_new_table tbody tr td{ height:40px; line-height:40px; border-bottom:1px dashed #e5e5e5; font-weight:normal; color:#888; text-align: center}
.sy_new_table tbody tr:last-child{ height:40px;} .sy_new_table tbody tr:last-child{ height:40px;}
.sy_new_table tbody tr:last-child td{ border-bottom:none;}
.sy_new_tchlist li{ height:30px; line-height:30px;} .sy_new_tchlist li{ height:30px; line-height:30px;}
.sy_new_search{-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; border:1px solid #d3d3d3; background:#fff; padding-left:5px; color:#888; height:32px; width:370px;box-shadow: inset 0px 0px 3px #dcdcdc; } .sy_new_search{-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; border:1px solid #d3d3d3; background:#fff; padding-left:5px; color:#888; height:32px; width:370px;box-shadow: inset 0px 0px 3px #dcdcdc; }
.sy_new_tchbox{ background:#f5f5f5; padding:15px; margin:15px; margin-top:0px;} .sy_new_tchbox{ background:#f5f5f5; padding:15px; margin:15px; margin-top:0px;}

View File

@ -30,7 +30,6 @@ RSpec.configure do |config|
config.use_transactional_fixtures = true config.use_transactional_fixtures = true
config.before(:suite) do config.before(:suite) do
require_relative "seeds"
end end
# RSpec Rails can automatically mix in different behaviours to your tests # RSpec Rails can automatically mix in different behaviours to your tests

View File

@ -1,38 +1,16 @@
require 'rails_helper' require 'rails_helper'
require 'shared_account_spec'
# "attachments"=>{"1"=>{"filename"=>"11.gif", "description"=>"", "is_public_checkbox"=>"1", "token"=>"33731.8a74e086d7716f89bc4fbac0606589c7"}} # "attachments"=>{"1"=>{"filename"=>"11.gif", "description"=>"", "is_public_checkbox"=>"1", "token"=>"33731.8a74e086d7716f89bc4fbac0606589c7"}}
RSpec.describe "作业打包下载", :type => :request do RSpec.describe ZipdownController, :type => :controller do
let(:student){FactoryGirl.create(:student)}
describe "单独下载某学生作业" do describe "单独下载某学生作业" do
include_context "create user"
before { before {
FactoryGirl.create(:user) session[:user_id] = 3135
shared_login session[:atime] = Time.now.utc.to_i
@homework = FactoryGirl.create(:homework, author_id: current_user.id) session[:ctime] = Time.now.utc.to_i
@attch = HomeworkAttach.new
@attch.bid_id = @homework.id
@attch.user_id = student.id
@attachment = Attachment.new(:file => File.open(File.join(Rails.root, "spec/fixtures/test.jpg")))
@attachment.author = User.current
@attachment.container_type = 'HomeworkAttach'
@attachment.container_id = @attch.id
@attachment.filename = "test.jpg"
@attachment.save
params = {"1"=>{"filename" => "test.jpg", "description" =>"",
"is_public_checkbox"=>"1",
"token" => "#{@attachment.id}.#{@attachment.digest}" }
}
@attch.save_attachments(params)
@attch.name = "test.jpg"
@attch.save!
} }
it "正常下载" do it "正常下载" do
uu = current_user get 'download_user_homework', {homework:24753}
allow(uu).to receive(:admin?).and_return(true)
allow(User).to receive(:current).and_return(uu)
get zipdown_download_user_homework_path, {homework:@attch.id}
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
expect(response.content_type).to eq(Mime::Type.new("applcation/zip",:zip)) expect(response.content_type).to eq(Mime::Type.new("applcation/zip",:zip))
end end

View File

@ -1,7 +1,13 @@
require 'test_helper' require 'test_helper'
class ZipdownControllerTest < ActionController::TestCase class ZipdownControllerTest < ActionController::TestCase
# test "the truth" do def setup
# assert true login
# end end
test "能够正常下载学生作业" do
get 'download_user_homework', {homework:861}
assert response.response_code == 200
puts response
end
end end

View File

@ -519,3 +519,11 @@ ActionView::TestCase::TestController.class_eval do
Rails.application.routes Rails.application.routes
end end
end end
class ActionController::TestCase
def login
session[:user_id] = 3135
session[:atime] = Time.now.utc.to_i
session[:ctime] = Time.now.utc.to_i
end
end