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

Conflicts:
	public/stylesheets/css/project.css
This commit is contained in:
huang 2016-09-26 22:21:45 +08:00
commit db54d6e0d9
122 changed files with 1214 additions and 774 deletions

View File

@ -109,6 +109,28 @@ module Mobile
"项目"
end
end
when :homework_commit_count
if ac.act_type == "HomeworkCommon"
ac.act.student_works.has_committed.count
end
when :last_commit_info
if ac.act_type == "HomeworkCommon"
if ac.act.student_works.has_committed.count > 0
lc = ac.act.student_works.has_committed.reorder("commit_time desc").first
{:lasttime=>time_from_now(lc.commit_time), :lastname=>lc.user.show_name}
end
end
when :last_score_info
if ac.act_type == "HomeworkCommon"
if ac.act.student_works.has_committed.count > 0
sw_id = "("+ac.act.student_works.map{|sw| sw.id}.join(",")+")"
student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc")
unless student_work_scores.empty?
last_score = student_work_scores.first
{:lasttime=>time_from_now(last_score.created_at), :lastname=>last_score.user.show_name}
end
end
end
end
end
end
@ -153,6 +175,10 @@ module Mobile
act_expose :course_project_name #课程/项目名字
act_expose :syllabus_title #课程名字
act_expose :activity_type_name #课程问答区/项目缺陷等
act_expose :homework_commit_count #作品提交数
act_expose :last_commit_info #最近提交信息
act_expose :last_score_info #最近评阅信息
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue"
has_praise = false

View File

@ -38,6 +38,22 @@ module Mobile
wh.id
when :title
wh.name
when :homework_commit_count
wh.student_works.has_committed.count
when :last_commit_info
if wh.student_works.has_committed.count > 0
lc = wh.student_works.has_committed.reorder("commit_time desc").first
{:lasttime=>time_from_now(lc.commit_time), :lastname=>lc.user.show_name}
end
when :last_score_info
if wh.student_works.has_committed.count > 0
sw_id = "("+wh.student_works.map{|sw| sw.id}.join(",")+")"
student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc")
unless student_work_scores.empty?
last_score = student_work_scores.first
{:lasttime=>time_from_now(last_score.created_at), :lastname=>last_score.user.show_name}
end
end
end
end
end
@ -74,6 +90,9 @@ module Mobile
whomework_expose :evaluation_end
whomework_expose :praise_count
whomework_expose :comment_count
whomework_expose :homework_commit_count #作品提交数
whomework_expose :last_commit_info #最近提交信息
whomework_expose :last_score_info #最近评阅信息
expose :all_children, using: Mobile::Entities::Jours do |f, opt|
#f[:journals_for_messages] if f.is_a?(Hash) && f.key?(:journals_for_messages)
if f.is_a?(::HomeworkCommon)

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the SyllabusMember controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -58,10 +58,9 @@ class HomeworkCommonController < ApplicationController
def edit
@user = User.current
@is_in_course = params[:is_in_course]
@hw_status = params[:hw_status].to_i
@is_manage = params[:is_manage]
@course_activity = params[:course_activity].to_i
if @is_in_course.to_i == 1 || @course_activity == 1
if @hw_status != 1
@left_nav_type = 3
respond_to do |format|
format.html{render :layout => 'base_courses'}
@ -160,18 +159,19 @@ class HomeworkCommonController < ApplicationController
create_works_list @homework
end
@hw_status = params[:hw_status].to_i
if params[:is_manage] == "1"
redirect_to manage_or_receive_homeworks_user_path(User.current.id)
elsif params[:is_manage] == "2"
redirect_to my_homeworks_user_path(User.current.id)
elsif params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => @course.id)
elsif params[:is_in_course] == "0"
redirect_to user_homeworks_user_path(User.current.id)
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
elsif @hw_status == 1
redirect_to user_path(User.current.id)
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
elsif @hw_status == 2
redirect_to course_path(@course.id)
elsif @hw_status == 5
redirect_to student_work_index_url(:homework => @homework.id)
else
redirect_to homework_common_index_path(:course => @course.id)
end
end
end
@ -181,14 +181,13 @@ class HomeworkCommonController < ApplicationController
if @homework.destroy
respond_to do |format|
format.html {
if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => @course.id)
elsif params[:is_in_course] == "0"
redirect_to user_homeworks_user_path(User.current.id)
elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
redirect_to user_path(User.current.id)
elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
redirect_to course_path(@course.id)
@hw_status = params[:hw_status].to_i
if @hw_status == 1
redirect_to user_path(User.current.id)
elsif @hw_status == 2
redirect_to course_path(@course.id)
else
redirect_to homework_common_index_path(:course => @course.id)
end
}
end
@ -246,8 +245,8 @@ class HomeworkCommonController < ApplicationController
@statue = 3
end
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
end
#关闭匿评
@ -265,8 +264,8 @@ class HomeworkCommonController < ApplicationController
send_message_anonymous_comment(@homework, m_status = 3)
Mailer.send_mail_anonymous_comment_close(@homework).deliver
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
respond_to do |format|
format.js
end
@ -294,8 +293,7 @@ class HomeworkCommonController < ApplicationController
end
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
respond_to do |format|
format.js
end
@ -307,8 +305,7 @@ class HomeworkCommonController < ApplicationController
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course] if params[:is_in_course]
@course_activity = params[:course_activity] if params[:course_Activity]
@hw_status = params[:hw_status].to_i
respond_to do |format|
format.js
end
@ -321,8 +318,8 @@ class HomeworkCommonController < ApplicationController
@homework.update_column('is_open', 0)
end
@user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course] if params[:is_in_course]
@course_activity = params[:course_activity] if params[:course_Activity]
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
end
def alert_open_student_works
@ -331,8 +328,7 @@ class HomeworkCommonController < ApplicationController
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course] if params[:is_in_course]
@course_activity = params[:course_activity] if params[:course_Activity]
@hw_status = params[:hw_status].to_i
respond_to do |format|
format.js
end
@ -363,8 +359,7 @@ class HomeworkCommonController < ApplicationController
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course]
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
end
#设置匿评参数
@ -381,8 +376,8 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.evaluation_num = params[:evaluation_num]
@homework_detail_manual.save
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
end
end
@ -393,8 +388,7 @@ class HomeworkCommonController < ApplicationController
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course]
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
end
private

View File

@ -38,47 +38,45 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
@isReply = true
page = params[:page]
# Find the page of the requested reply
if params[:r] && page.nil?
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
page = 1 + offset / REPLIES_PER_PAGE
end
# page = params[:page]
# # Find the page of the requested reply
# if params[:r] && page.nil?
# offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
# page = 1 + offset / REPLIES_PER_PAGE
# end
all_comments = []
@reply_count = get_all_children(all_comments, @topic).count
@replies = get_all_children(all_comments, @topic)
@reply_count = @replies.count
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
#@replies = @topic.children.
#includes(:author, :attachments, :praise_tread_cache, {:board => :project}).
#reorder("#{Message.table_name}.created_on DESC").
#limit(@reply_pages.per_page).
#offset(@reply_pages.offset).
all
@replies = paginateHelper messages_replies,10
@reply = Message.new(:subject => "RE: #{@message.subject}")
#all
#@replies = paginateHelper messages_replies,10
@left_nav_type = 2
render :action => "show", :layout => "base_courses"#by young
elsif @project
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
#@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
# reorder("#{Message.table_name}.created_on DESC").
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
@reply = Message.new(:subject => "RE: #{@message.subject}")
render :action => "show", :layout => "base_projects"#by young
else
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
@replies = @topic.children.
includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.created_on DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all
# @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
# reorder("#{Message.table_name}.created_on DESC").
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
@reply = Message.new(:subject => "RE: #{@message.subject}")
@organization = @org_subfield.organization
render :action => "show", :layout => "base_org"#by young
end

View File

@ -521,6 +521,7 @@ class StudentWorkController < ApplicationController
# 消息传过来的ID
@message_student_work_id = params[:student_work_id]
@left_nav_type = 3
@tab = params[:tab].to_i
respond_to do |format|
format.js
format.html
@ -1012,8 +1013,7 @@ class StudentWorkController < ApplicationController
redirect_to student_work_index_url(:homework => @homework.id)
else
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
respond_to do |format|
format.js
end
@ -1035,8 +1035,7 @@ class StudentWorkController < ApplicationController
student_work.save
end
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
end
def revise_attachment
@ -1058,8 +1057,7 @@ class StudentWorkController < ApplicationController
def new_student_work_project
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
respond_to do |format|
format.js
end
@ -1078,8 +1076,8 @@ class StudentWorkController < ApplicationController
@project.is_leader = 1
if @project.save
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.allowed_to?(:as_teacher,@homework.course) || User.current.admin?
respond_to do |format|
format.js
end
@ -1129,8 +1127,8 @@ class StudentWorkController < ApplicationController
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
if relate_pro.destroy
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.allowed_to?(:as_teacher,@homework.course) || User.current.admin?
respond_to do |format|
format.js
end

View File

@ -0,0 +1,64 @@
class SyllabusMemberController < ApplicationController
def syl_member_autocomplete
@syllabus = Syllabus.find(params[:syllabus])
@flag = params[:flag] || false
respond_to do |format|
format.js
end
end
def create
@syllabus = Syllabus.find(params[:syllabus])
if params[:membership].nil?
@fail_hint = l(:label_blank_user_lists_for_org)
else
member_ids = params[:membership][:user_ids]
last_rank = @syllabus.syllabus_members.order("rank asc").last.rank
user_ids = @syllabus.syllabus_members.map{|sy| sy.user_id}
member_ids.each_with_index do |user_id, i|
unless user_ids.include?(user_id.to_i)
member = SyllabusMember.create(:user_id => user_id, :rank => last_rank + 1 + i)
@syllabus.syllabus_members << member
end
end
@members = @syllabus.syllabus_members.order("rank asc")
end
respond_to do |format|
format.js
end
end
def destroy
member = SyllabusMember.find(params[:id])
@syllabus = member.syllabus
after_syl_members = @syllabus.syllabus_members.where("rank > #{member.rank}")
after_syl_members.update_all("rank = rank - 1")
member.destroy
@members = @syllabus.syllabus_members.order("rank asc")
respond_to do |format|
format.js
end
end
def update_rank
member = SyllabusMember.find(params[:id])
@syllabus = member.syllabus
members = @syllabus.syllabus_members
if params[:opr] == 'up' && member.rank > 2
before_mem = members.where("rank = #{member.rank - 1}").first
if before_mem && member.update_attribute('rank', member.rank - 1)
before_mem.update_attribute('rank', before_mem.rank + 1)
end
elsif params[:opr] == 'down' && member.rank > 1 && member.rank < members.count
after_mem = members.where("rank = #{member.rank + 1}").first
if after_mem && member.update_attribute('rank', member.rank + 1)
after_mem.update_attribute('rank', after_mem.rank - 1)
end
end
@members = @syllabus.syllabus_members.order("rank asc")
respond_to do |format|
format.js
end
end
end

View File

@ -6,7 +6,7 @@ class SyllabusesController < ApplicationController
include CoursesHelper
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus]
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus, :delete_des]
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus, :delete_des, :members]
def index
user = User.current
@syllabuses = user.syllabuses
@ -170,6 +170,15 @@ class SyllabusesController < ApplicationController
end
end
def members
@members = @syllabus.syllabus_members.includes(:user => {:user_extensions => [], :courses => []}).order("rank asc")
@show = params[:show] ? params[:show].to_i : 0
respond_to do |format|
format.js
format.html{render :layout => 'base_syllabus'}
end
end
private
def find_syllabus
@syllabus = Syllabus.find params[:id]

View File

@ -115,8 +115,7 @@ class UsersController < ApplicationController
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
when 'JournalsForMessage'
@reply = JournalsForMessage.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@ -1123,11 +1122,8 @@ class UsersController < ApplicationController
quotes_homework = HomeworkCommon.find params[:quotes].to_i
quotes_homework.update_column(:quotes, quotes_homework.quotes+1)
end
if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => homework.course_id)
else
redirect_to user_homeworks_user_path(User.current.id)
end
redirect_to homework_common_index_path(:course => homework.course_id)
end
end
else
@ -3573,8 +3569,7 @@ class UsersController < ApplicationController
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
@type = 'HomeworkCommon'
@journals = obj.journals_for_messages.reorder("created_on desc")
@is_in_course = params[:is_in_course].to_i if params[:is_in_course]
@course_activity = params[:course_activity].to_i if params[:course_activity]
@hw_status = params[:hw_status].to_i if params[:hw_status]
@is_teacher = User.current.allowed_to?(:as_teacher,obj.course)
@user_activity_id = params[:user_activity_id].to_i if params[:user_activity_id]
end

View File

@ -110,8 +110,8 @@ class WordsController < ApplicationController
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin?
elsif @journal_destroyed.jour_type == 'Syllabus'
@syllabus = Syllabus.find @journal_destroyed.jour_id
@count = @syllabus.journals_for_messages.count
@ -308,10 +308,9 @@ class WordsController < ApplicationController
update_org_activity(@homework_common.class,@homework_common.id)
respond_to do |format|
format.js{
@user_activity_id = params[:user_activity_id]
@is_in_course = params[:is_in_course]
@course_activity = params[:course_activity]
@homework_common_id = params[:homework_common_id]
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.allowed_to?(:as_teacher, @homework_common.course) || User.current.admin?
}
end
else
@ -344,8 +343,8 @@ class WordsController < ApplicationController
respond_to do |format|
format.js{
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
@hw_status = params[:hw_status].to_i
@is_teacher = User.current.allowed_to?(:as_teacher, @homework_common.course) || User.current.admin?
}
end
else

View File

@ -2750,15 +2750,15 @@ module ApplicationHelper
end
#获取匿评相关连接代码
def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1)
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
when 2
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
when 3
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
end
@ -2806,7 +2806,7 @@ module ApplicationHelper
count = homework.student_works.has_committed.count
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量
link_to "作品(#{count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
link_to "作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
@ -2824,20 +2824,20 @@ module ApplicationHelper
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
else
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
end
end
end
else
link_to "作品(#{count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
link_to "作品(#{count})",student_work_index_url_in_org(homework.id, 2),:class => "c_blue"
end
end
@ -2860,15 +2860,15 @@ module ApplicationHelper
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank'
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品",student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank'
link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank'
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank'
else
link_to "查看作品", student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank'
end
end
end
@ -3197,13 +3197,13 @@ def homework_common_index_url_in_org(course_id)
Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
end
def student_work_index_url_in_org(homework_id, is_focus = '', show_work_id = '')
def student_work_index_url_in_org(homework_id, tab = 1, is_focus = '', show_work_id = '')
if is_focus != ''
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s + "&is_focus=" + is_focus.to_s
elsif show_work_id != ''
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&show_work_id=" + show_work_id.to_s
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s + "&show_work_id=" + show_work_id.to_s
else
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s
end
end
@ -3307,7 +3307,12 @@ end
#获取所有子节点
def get_all_children result, jour
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) || (jour.kind_of? BlogComment) || (jour.kind_of? OrgDocumentComment)
if jour.kind_of? Message
jour.children.includes(:author, :praise_tread_cache).each do |jour_child|
result << jour_child
get_all_children result, jour_child
end
elsif (jour.kind_of? JournalsForMessage) || (jour.kind_of? BlogComment) || (jour.kind_of? OrgDocumentComment)
jour.children.each do |jour_child|
result << jour_child
get_all_children result, jour_child

View File

@ -57,12 +57,12 @@ module HomeworkCommonHelper
end
#根据传入作业确定跳转到开启匿评还是关闭匿评功能
def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,is_in_course,course_activity
def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,hw_status
link = ""
if homework_detail_manual.comment_status == 1
link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity
link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status
elsif homework_detail_manual.comment_status == 2
link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity
link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status
end
link
end

View File

@ -0,0 +1,17 @@
module SyllabusMemberHelper
include ApplicationHelper
def find_user_not_in_current_syllabus_by_name syllabus
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_syllabus(syllabus).like(params[:q])
else
scope = []
end
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals', :class => 'sy_new_tchlist')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, host_with_protocol + "/syllabus_member/syl_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:syllabus=> syllabus, :format => 'js').to_query, :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "syllabus_member_pagination_links" )
end
end

View File

@ -4,6 +4,20 @@ module SyllabusesHelper
Syllabus.tagged_with(tag_name).order('updated_at desc')
end
def find_user_not_in_current_syllabus_by_name syllabus
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_syllabus(syllabus).like(params[:q])
else
scope = []
end
principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals', :class => 'sy_new_tchlist')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, host_with_protocol + "/syllabus_member/syl_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:syllabus=> syllabus, :format => 'js').to_query, :remote => true
}
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "syllabus_member_pagination_links" )
end
def teacher_count syllabus
count = 0
courses = syllabus.courses

View File

@ -12,6 +12,8 @@ class BlogComment < ActiveRecord::Base
belongs_to :last_reply, :class_name => 'BlogComment', :foreign_key => 'last_comment_id'
# 虚拟关联
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
acts_as_watchable
validates_presence_of :title, :content

View File

@ -27,6 +27,8 @@ class Comment < ActiveRecord::Base
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
#end
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
acts_as_event :datetime => :updated_on,
:description => :comments,
:type => 'news',

View File

@ -13,6 +13,7 @@ class Contest < ActiveRecord::Base
has_many :join_in_competitions, foreign_key: 'competition_id', :dependent => :destroy
has_many :join_in_contests, class_name: 'JoinInCompetition', foreign_key: 'competition_id', :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
has_many :contestnotifications, :dependent => :destroy, :include => :author

View File

@ -19,6 +19,8 @@ class HomeworkCommon < ActiveRecord::Base
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :apply_homeworks, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy

View File

@ -53,6 +53,7 @@ class Issue < ActiveRecord::Base
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# end
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
# ForgeMessage虚拟关联(多态)
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy

View File

@ -35,6 +35,8 @@ class Journal < ActiveRecord::Base
# 被ForgeMessage虚拟关联
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
has_many :at_messages, as: :at_message, dependent: :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
acts_as_attachable
attr_accessor :indice
acts_as_tree :counter_cache => :comments_count, :order => "#{Journal.table_name}.created_on ASC"

View File

@ -68,6 +68,8 @@ class JournalsForMessage < ActiveRecord::Base
has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy
has_many :at_messages, as: :at_message, dependent: :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message,

View File

@ -48,6 +48,8 @@ class Memo < ActiveRecord::Base
acts_as_attachable
has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
# 消息
has_many :memo_messages, :class_name =>'MemoMessage', :dependent => :destroy
# end

View File

@ -26,6 +26,7 @@ class Message < ActiveRecord::Base
belongs_to :board,:touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
# has_many :org_subfield_messages, :dependent => :destroy
# has_many :org_subfields, :through => :org_subfield_messages

View File

@ -40,6 +40,9 @@ class News < ActiveRecord::Base
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
#end
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
#转发表
has_many :forwards, :as => :from, :dependent => :destroy

View File

@ -6,6 +6,8 @@ class OrgDocumentComment < ActiveRecord::Base
belongs_to :organization
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
has_many :editor_of_documents, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
acts_as_tree :order => "#{OrgDocumentComment.table_name}.sticky asc, #{OrgDocumentComment.table_name}.created_at desc"
acts_as_attachable
has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy

View File

@ -1,6 +1,7 @@
class PraiseTreadCache < ActiveRecord::Base
attr_accessible :object_id,:object_type,:praise_num,:tread_num
belongs_to :object, :polymorphic => true
def plus(flag,num)
case flag
when 0

View File

@ -97,6 +97,16 @@ class Principal < ActiveRecord::Base
end
}
scope :not_member_of_syllabus, lambda {|syllabus|
syllabuses = [syllabus] unless syllabus.is_a?(Array)
if syllabuses.empty?
where("1=0")
else
ids = syllabuses.map(&:id)
where("#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{SyllabusMember.table_name} WHERE syllabus_id IN (?))", ids)
end
}
scope :sorted, lambda { order(*Principal.fields_for_order_statement)}
scope :applied_members, lambda {|project|

View File

@ -9,6 +9,9 @@ class Syllabus < ActiveRecord::Base
belongs_to :user
has_many :courses
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :syllabus_members, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
has_one :praise_tread_cache, as: :object, dependent: :destroy
attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
safe_attributes 'title','user', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course'

View File

@ -0,0 +1,5 @@
class SyllabusMember < ActiveRecord::Base
belongs_to :syllabus
belongs_to :user
attr_accessible :rank, :user_id, :syllabus_id
end

View File

@ -91,6 +91,7 @@ class User < Principal
has_many :homework_attaches, :through => :homework_users
has_many :homework_evaluations
has_many :syllabuses, :dependent => :destroy
has_many :syllabus_members, :dependent => :destroy
#问卷相关关关系
has_many :poll_users, :dependent => :destroy
has_many :poll_votes, :dependent => :destroy

View File

@ -60,7 +60,7 @@
<% act = activity.course_act %>
<% case activity.course_act_type.to_s %>
<% when 'HomeworkCommon' %>
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :course_activity => 1} %>
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :hw_status => 2} %>
<% when 'News' %>
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% when 'Message' %>

View File

@ -26,7 +26,7 @@
}
}
</script>
<%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
<%= render :partial => 'users/course_homework', :locals => {:activity => homework_common,:user_activity_id => homework_common.id, :hw_status => 3} %>
<% end%>
<% if homework_commons.count == 10%>
<%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>

View File

@ -28,14 +28,14 @@
<li class="chabox-w-401 chabox-txt-left" style =" text-align:left; text-indent:1em; " ><%=student_work_name%></li>
<li><%=student_work.user.show_name%></li>
<li><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> </li>
<li class="chabox-r-line"><%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%></li>
<li class="chabox-r-line"><%= Time.parse(format_time(student_work.commit_time)).strftime("%m-%d %H:%M")%></li>
<% if student_work.simi_id.to_i > 0 && @works_hash[student_work.simi_id.to_i] %>
<% simi_student_work = @works_hash[student_work.simi_id.to_i] %>
<% simi_student_work_name = simi_student_work.name.nil? || simi_student_work.name.empty? ? simi_student_work.user.show_name + '的作品' : simi_student_work.name%>
<li class="chabox-w-401 chabox-txt-left" style =" text-align:left; text-indent:1em; " ><%=simi_student_work_name%></li>
<li><%=simi_student_work.user.show_name%></li>
<li><%= simi_student_work.user.user_extensions.nil? ? "--" : simi_student_work.user.user_extensions.student_id%></li>
<li class="chabox-r-line"><%= Time.parse(format_time(simi_student_work.created_at)).strftime("%m-%d %H:%M")%></li>
<li class="chabox-r-line"><%= Time.parse(format_time(simi_student_work.commit_time)).strftime("%m-%d %H:%M")%></li>
<% if student_work.simi_value.to_i >= 90 %>
<li style = "color:red" ><%=student_work.simi_value.to_i%>%</li>
<% else %>

View File

@ -1,5 +1,5 @@
<% if @page == 0 %>
$("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>");
$("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :course_id => @course.id,:search=>@search} )%>");
<% else %>
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>");
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :course_id => @course.id,:search=>@search} )%>");
<% end %>

View File

@ -84,7 +84,7 @@
<div class="cl"></div>
</div>
<div class="homeworkInfo" id="homeworkInformation">
<div class="homeworkInfo mb10" id="homeworkInformation">
<div class="">
<div class="homepagePostTitle fl hidden m_w460" title="<%= @exercise.exercise_name %>"><%= @exercise.exercise_name %></div>
<% if @exercise.exercise_status == 1 %>

View File

@ -32,7 +32,7 @@
</p>
<% end %>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@is_in_course,@course_activity%>');" style="margin-bottom: 20px;" >
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual,@user_activity_id,@hw_status%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -22,7 +22,7 @@
</p>
<% end %>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickOK('<%= open_student_works_homework_common_path(@homework, :user_activity_id => @user_activity_id,:is_in_course=>@is_in_course, :course_activity => @course_activity)%>');" style="margin-bottom: 20px;" >
<a href="javascript:" class="tijiao" onclick="clickOK('<%= open_student_works_homework_common_path(@homework, :user_activity_id => @user_activity_id,:hw_status=>@hw_status)%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -1,4 +1,4 @@
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => homework_commons,:page => 0,:is_in_course => 1,:course_id => course_id} %>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => homework_commons,:page => 0,:course_id => course_id} %>
<div style="width:210px; text-align:center; margin:0 auto;">
<ul class="wlist" style=" border:none; display:inline-block; float:none; margin-top:10px;">

View File

@ -1,5 +1,5 @@
<div class="markPopup" id="popbox02">
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity},:method => "post",:remote => true) do |f|%>
<%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<span class="uploadText">匿评设置</span>
<div class="cl"></div>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity => @course_activity}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,5 +1,5 @@
<script type="text/javascript">
<% if @is_in_course.to_i == 1 || @course_activity == 1 %>
<% if @hw_status != 1 %>
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
@ -23,18 +23,16 @@
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
<% elsif @is_manage.to_i == 2 %>
window.location.href='<%=my_homeworks_user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == 1 %>
<% elsif @hw_status == 3 %>
window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
<% elsif @is_in_course.to_i == 0 %>
window.location.href='<%=user_homeworks_user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == -1 && @course_activity == 0 %>
<% elsif @hw_status == 1 %>
window.location.href='<%=user_path(User.current.id) %>';
<% elsif @is_in_course.to_i == -1 && @course_activity == 1 %>
<% elsif @hw_status == 2 %>
window.location.href='<%=course_path(@course.id) %>';
<% end %>
}
</script>
<div class="homepageRightBanner mb10 <%= (@is_in_course == 1 || @course_activity == 1) ? 'ml10' : '' %>">
<div class="homepageRightBanner mb10 <%= (@hw_status == 2 || @hw_status == 3 || @hw_status == 5) ? 'ml10' : '' %>">
<div class="NewsBannerName">编辑作业</div>
</div>
<div class="cl"></div>
@ -56,8 +54,7 @@
<% end %>
<%= form_for @homework do |f| %>
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
<input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
<input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>

View File

@ -1,7 +1,10 @@
<% if @user_activity_id.to_i == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
$("#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 %>
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity =>@course_activity,:remote=>true}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>');
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +

View File

@ -1,8 +1,11 @@
clickCanel();
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>");
<% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% 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}) %>");
<% end %>
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -1,13 +1,15 @@
<% if @statue == 1%>
alert('启动成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
$("#evaluation_start_time_<%=@homework.id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
$("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
$("#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 %>
$("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
/*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/
<% elsif @statue == 2 %>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:is_in_course => @is_in_course,:course_activity =>@course_activity,:remote=>true}) %>');
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att',:locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status,:remote=>true}) %>');
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
showModal('ajax-modal', '350px');
$('#ajax-modal').siblings().remove();

View File

@ -1,12 +1,14 @@
alert('关闭成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
$("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
$("#evaluation_end_time_<%=@user_activity_id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
$("#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 %>
$("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
/*
$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/

View File

@ -3,38 +3,49 @@
<div class="scrollsidebar" id="scrollsidebar">
<div class="side_content">
<div class="side_list">
<div class="side_title">
<a title="<%= l(:button_hide) %>" class="close_btn">
<span>
</span>
</a>
<div style="background-color:#fff; padding:10px 0; border:1px solid #aaa; border-bottom:none;">
<span class="fontGrey3 f14 ml40" style="vertical-align:top;">问题和建议</span>
<span class="hide-side-bar side-bar-circle fr mt3 mr10" title="关闭"><span class="side-bar-content" style="font-family:'微软雅黑, 宋体'">×</span></span>
<span class="close_btn side-bar-circle fr mt3 mr10" title="隐藏"><span class="side-bar-content" style="left:4px; font-family:'微软雅黑, 宋体'"></span></span>
</div>
<div class="side_center">
<div class="custom_service">
<div style="background-color:#fff; border-left:1px solid #aaa; border-right:1px solid #aaa;">
<div class="custom_service tac">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
<%= f.text_area :subject, :id=>"subject", :class => "opnionText mb5", :placeholder => "完善您的基本资料后,可在此输入问题和建议", :disabled => "disabled" %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;height:21px" id="" onclick="">
<%= l(:label_submit)%>
</a>
<!--<span class="c_grey fl ml10">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>-->
<!--<a href="javascript:void(0);" class="linkBlue f14 fr mr10" style="height:21px;" id="" onclick="f_submit();">-->
<%#= l(:label_submit)%>
<!--</a>-->
<div class="cl"></div>
<% end %>
</div>
<div class="mt5" style="color: #269ac9;cursor: default">
</div>
<div style="background-color:#fff; border:1px solid #aaa; border-top:none; padding-top:5px;">
<div class="fl mt5 ml10 tac">
<!--<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">-->
<%#= l(:label_technical_support) %>
<!--白&nbsp;&nbsp;&nbsp;羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
<!--<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center"></p>-->
<!--<a href="mqqapi://card/show_pslcard?src_type=internal&version=1&uin=173184401&card_type=group&source=qrcode">QQ群号173184401</a>-->
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Trustie师姐师兄答疑群" title="Trustie师姐师兄答疑群"></a>
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img src="/images/QQ_Logo.png" width="30" style="cursor:default; border:1px solid #ddd; padding:20px; cursor:pointer;" /></a>
<p class="fontGrey3" style="padding-bottom:10px; padding-top:3px;">加入QQ群</p>
</div>
<div class="fr mr10 tac">
<img src="/images/wechat/trustie_QR.jpg" width="80" style="display:inline-block; margin-right:-5px;" /><p class="fontGrey3" style="padding-bottom:10px;">关注官方微信</p>
</div>
<div class="cl"></div>
</div>
<div class="side_bottom"></div>
</div>
</div>
<div class="show_btn">
<span><%= l(:label_submit)%></span>
<a href="javascript:void(0)" class="closeSidebar"></a>
<div class="show_btn tac">
<div style=" border:1px solid #aaa;">
<div style="height:79px;">
<img src="/images/dialog.png" width="18" class="mt10 mb5" />
<span class="f14 fontBlue">提<br />问</span>
</div>
<span class="closeSidebar f16">×</span>
</div>
</div>
</div>

View File

@ -15,7 +15,7 @@
<%= f.text_area :subject, :id=>"subject", :class => "opnionText mb5", :placeholder => l(:label_feedback_tips) %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_grey fl ml10">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
<a href="javascript:void(0);" class="linkBlue f14 fr mr10" style="height:21px;" id="" onclick="f_submit();">
<a href="javascript:void(0);" class="linkBlue f12 fr mr10" style="height:21px;" id="" onclick="f_submit();">
<%= l(:label_submit)%>
</a>
<div class="cl"></div>

View File

@ -1,10 +1,12 @@
<h3 class="sy_right_title">教师团队
<a href="javascript:void(0);" class="sy_cmore fr mr10 none" >增加教师</a>
<% if User.current == @syllabus.user || User.current.admin? %>
<a href="<%=members_syllabus_path(syllabus, :show => 1) %>" class="sy_cmore fr mr10">增加教师</a>
<% end %>
<div class="cl"></div>
</h3>
<ul class="sy_teachers_list">
<% teacher = syllabus.user %>
<%# teachers.each do |teacher| %>
<% members.each do |member| %>
<% teacher = member.user %>
<li >
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %>
<div class="sy_teachers_txt fl">
@ -17,5 +19,5 @@
</div>
<div class="cl"></div>
</li>
<%# end %>
<% end %>
</ul>

View File

@ -1,19 +1,16 @@
<% courses.each do |course|%>
<li>
<li class="pr">
<span class="user_icons_class"></span>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu pr" >
<% title = "<span class='course-name'>#{course.syllabus.title}</span>".html_safe %>
<%= link_to title, syllabus_path(course.syllabus_id), :target => '_blank', :class => 'hidden', :style => "max-width:91px; display:inline-block;"%>
<font class="fb c_grey" style="height:39px; line-height:39px; vertical-align:top;">·</font>
<% classes = "<span class='course-name'>#{course.name}</span>".html_safe %>
<%= link_to classes, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => "max-width:91px; display:inline-block;"%>
<span class="sub-menu-title c_dark">
课程名称:<%= course.syllabus.title %><br />
班级名称:<%= course.name+''+current_time_and_term(course)+'' %><br />
班级属性:<%= course.is_public? ? '公开' : '私有' %>
</span>
<p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu" >
<%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
</p>
<div class="sub-menu-title c_dark">
<em></em>
<font></font>
<div>课程:<%= link_to course.syllabus.title, syllabus_path(course.syllabus_id), :target => '_blank' %></div>
<div>班级:<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank' %></div>
</div>
<%#= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
:id => "show_course_#{course.id}", :class => 'course_list_menu hidden', :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+""+current_time_and_term(course)+""%>
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
@ -113,25 +110,26 @@
}
$(".course_list_menu").each(function(){
var courseWidth = $(this).children().eq(0).children().width();
var classWidth = $(this).children().eq(2).children().width();
var newClassWidth = 182 - courseWidth;
var newCourseWidth = 182 - classWidth;
console.log(courseWidth, classWidth);
if(courseWidth < 91 && classWidth > 91){
$(this).children().eq(2).css("max-width",newClassWidth + "px");
}
if(classWidth < 91 && courseWidth > 91){
$(this).children().eq(0).css("max-width",newCourseWidth + "px");
}
$(this).mouseenter(function(){
$(".sub-menu-title").hide();
$(this).next().stop();
$(this).next().show();
});
$(this).mouseleave(function(){
$(this).next().delay(500).hide(0);
});
})
$(".course-name").each(function(){
$(this).mouseenter(function(){
$(this).parent().parent().children().eq(3).show();
});
$(this).mouseleave(function(){
$(this).parent().parent().children().eq(3).hide();
});
})
$(".sub-menu-title").each(function(){
var boxWidth = $(this).width();
var leftAttr = boxWidth + 30
$(this).css("left",-leftAttr);
$(this).mouseover(function(){
$(this).stop();
$(this).show();
});
$(this).mouseout(function(){
$(this).delay(500).hide(0);
});
});
</script>

View File

@ -60,11 +60,12 @@
<%= yield %>
</div><!--sy_con_l end-->
<div class="sy_con_r fr mb10">
<% members = @syllabus.syllabus_members.order("rank asc") %>
<div class="sy_right_box" id="syllabus_base_info">
<%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
</div>
<div class="sy_right_box">
<%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %>
<div class="sy_right_box" id="syllabus_teacher_list">
<%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => members} %>
</div>
</div><!--sy_con_r end-->
<div class="cl"></div>
@ -123,16 +124,18 @@
}
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=2;i++){
//for(var i=1;i<=2;i++){
//g('sy_tab_nav_'+i).className='sy_tab_nomal';
//g('sy_tab_con_'+i).className='undis';
}
//}
//g('sy_tab_con_'+n).className='dis';
//g('sy_tab_nav_'+n).className='sy_tab_hover';
if(n == 1) {
window.location.href = '<%=syllabus_path(@syllabus) %>';
} else {
} else if(n == 2) {
window.location.href = '<%=syllabus_courselist_syllabus_path(@syllabus) %>';
} else if(n == 3) {
window.location.href = '<%=members_syllabus_path(@syllabus) %>';
}
}
//侧导航栏配置设置

View File

@ -163,7 +163,7 @@
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "linkGrey2" %></font>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user.id}, :style => "color:#aaa;" %></font>
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
<%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
@ -191,7 +191,7 @@
<ul class="users_accordion mb10">
<li id="user_06" class="user_icons_project">
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :class => 'linkGrey2'%></font>
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :style => "color:#aaa;" %></font>
<% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
<div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list">
<%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>

View File

@ -89,7 +89,7 @@
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.name%></a><%= format_date(reply.created_at) %></div>
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.show_name%></a><%= format_date(reply.created_at) %></div>
<div class="homepagePostReplyContent break_word" id="activity_description_<%= reply.id %>"><%= reply.content.gsub(/script/, "script&nbsp").html_safe %></div>
</div>
<script type="text/javascript">

View File

@ -93,10 +93,10 @@
</span>
</div>
</div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @topic) %>
<%# all_comments = []%>
<%# comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% comments.each_with_index do |reply,i| %>
<% @replies.each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');

View File

@ -127,10 +127,10 @@
</div>
<div class="homepagePostReplyBannerTime"></div>
</div>
<% all_comments = [] %>
<% comments = get_all_children(all_comments, @topic) %>
<%# all_comments = [] %>
<%# comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% comments.each_with_index do |reply, i| %>
<% @replies.each_with_index do |reply, i| %>
<script type="text/javascript">
$(function () {
showNormalImage('reply_message_description_<%= reply.id %>');

View File

@ -157,10 +157,10 @@
</span>
</div>
</div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @topic) %>
<%# all_comments = []%>
<%# comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% comments.each_with_index do |reply,i| %>
<% @replies.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');

View File

@ -63,7 +63,7 @@
<% if act.container_type == 'Course' %>
<% case act.org_act_type.to_s %>
<% when 'HomeworkCommon' %>
<%= render :partial => 'users/course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id,:course_activity => 0} %>
<%= render :partial => 'users/course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id, :hw_status => 4} %>
<% when 'News' %>
<%= render :partial => 'users/course_news', :locals => {:activity => News.find(act.org_act_id),:user_activity_id =>act.id} %>
<% when 'Message'%>

View File

@ -73,7 +73,7 @@
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
@ -161,9 +161,9 @@
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id, '', sw.id), :alt => "学生头像" %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id, 2, '', sw.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id, '', sw.id)%>
<%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id, 2, '', sw.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>

View File

@ -1,13 +1,13 @@
<% if PraiseTread.praised(activity) %>
<a href='<%= praise_tread_praise_plus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="点赞" >
<span class="likeText">赞</span>
<% num = get_praise_num(activity) %>
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
<span class="likeNum"><%= num > 0 ? "#{num}" : "" %></span>
</a>
<% else %>
<a href='<%= praise_tread_praise_minus_path({:obj_id=>activity.id,:obj_type=>activity.class,:user_activity_id=>user_activity_id,:type=>type }) %>' data-remote="true" class="<%=type == 'reply'? 'fr' : 'ml15' %> likeButton" title="取消点赞" >
<span class="likeText">已赞</span>
<% num = get_praise_num(activity) %>
<% num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %>
<span class="likeNum"><%= num > 0 ? "#{num}" : "" %></span>
</a>
<% end %>

View File

@ -13,7 +13,7 @@
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
<%= link_to "", new_project_issue_path(@project) , :class => "publish-icon fr mr10 mt2", :title => "发布问题" %>
<% end %>
</div>
<% end %>
@ -24,7 +24,7 @@
<a class="subnav_num">(<%= @project.project_score.board_num %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "", project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "publish-icon fr mr10 mt2", :title => "发布新帖" %>
<% end %>
</div>
<% end%>
@ -36,7 +36,7 @@
<% end %>
<% if User.current.member_of?(@project) %>
<%#= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
<a class="subnav_green m195" href="javascript:void(0);" onclick="project_files_upload();">+上传资源</a>
<a class="publish-icon fr mr10 mt2" href="javascript:void(0);" onclick="project_files_upload();" title="上传资源"></a>
<% end %>
</div>
<% end %>
@ -46,7 +46,7 @@
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<%= link_to "(#{pull_request_count(@project)})", project_pull_requests_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% if User.current.member_of?(@project) %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
<%= link_to "", new_project_pull_request_path(:project_id => @project.id), :class => "publish-icon fr mr10 mt2", :title => "新建请求" %>
<% end %>
</div>
<% end %>

View File

@ -5,7 +5,7 @@
禁用匿评后学生将不能对作品进行互评,且匿评不能再开启,是否确定禁用匿评?
</p>
<div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickOK('<%= forbidden_anonymous_comment_student_work_path(:homework=>@homework, :user_activity_id => user_activity_id, :course_activity => course_activity)%>');" style="margin-bottom: 20px;" >
<a href="javascript:" class="tijiao" onclick="clickOK('<%= forbidden_anonymous_comment_student_work_path(:homework=>@homework, :user_activity_id => user_activity_id, :hw_status => hw_status)%>');" style="margin-bottom: 20px;" >
确&nbsp;&nbsp;定
</a>
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">

View File

@ -5,7 +5,7 @@
</div>
<div id="about_hwork_<%= student_work.id %>"></div>
<div id="group_member_work_<%= student_work.id%>" class="undis">
<div id="group_member_work_<%= student_work.id%>">
<%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>
</div>
<% end %>

View File

@ -1,5 +1,5 @@
<div class="sy_courses_open f14 fontGrey3">
<span class="icons_sy_close fl mr5" title="点击展开/收起详情" style="cursor: pointer;"></span>
<span class="icons_sy_open fl mr5" title="点击展开/收起详情" style="cursor: pointer;"></span>
<span class="fl" style="width:280px;">
<span class="hidden fl" style="max-width:240px;"><%=student_work.name %></span>
<span class="fontGrey2 ml5 fl">

View File

@ -0,0 +1,102 @@
<div class="homepagePostPortrait">
<%=link_to image_tag(url_to_avatar(homework.user),width:"50px", height: "50px"), user_activities_path(homework.user_id)%>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%>
TO
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to homework.course.name, course_path(homework.course_id), :class => "newsBlue"%>
</div>
<div class="homepagePostTitle hidden fl m_w505">
<% 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"%>
</div>
<%=get_hw_status(homework).html_safe %>
<div class="cl"></div>
<% if homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>
<% is_pro = homework.homework_type == 2 && is_teacher %>
<% is_base_group = homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1 && !is_teacher %>
<div class="mt8 mb5">
<%= render :partial => 'users/homework_opr', :locals => {:activity => homework, :is_teacher => is_teacher, :hw_status => 5, :user_activity_id => homework.id} %>
<% if is_pro || is_base_group %>
<div class="cl"></div>
<% end %>
<% if !homework.publish_time.nil? %>
<div class="homepagePostDeadline <%= (is_pro || is_base_group) ? 'mt8' : '' %>">
<%= l(:label_publish_time)%><%= homework.publish_time%>&nbsp;00:00
</div>
<% end %>
<% if homework.homework_detail_manual && homework.homework_detail_manual.comment_status < 2 %>
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">提交截止时间:<%= homework.end_time.to_s %>&nbsp;23:59</div>
<% elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status >= 2 && homework.anonymous_comment == 0%>
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">匿评截止时间:<%= homework.homework_detail_manual.evaluation_end.to_s %>&nbsp;23:59</div>
<% end %>
<div class="cl"></div>
</div>
<div class="homeworkInfo" id="homeworkInformation">
<div class="">
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">
<div id="homework_description">
<%= homework.description.html_safe %>
</div>
</div>
<% if is_pro %>
<div class="mt10"> <span class="fontGrey3">测试集:<%=homework.homework_tests.count %>组</span>
<table class="mt5 test-set-table">
<tr>
<th width="25">&nbsp;</th>
<th width="290" style="max-width:290px;">测试集输入</th>
<th width="290" style="max-width:290px;">测试集输出</th>
</tr>
<% homework.homework_tests.each_with_index do |test, i| %>
<tr>
<td class="test_td_min"><%=i+1 %></td>
<td><pre style="max-width:290px; word-wrap:break-word; white-space:pre-wrap;"><%=test.input %></pre></td>
<td><pre style="max-width:290px; word-wrap:break-word; white-space:pre-wrap;"><%=test.output %></pre></td>
</tr>
<% end %>
</table>
</div>
<% end %>
<div class="cl"></div>
<div class="mt5">
<% if homework.homework_detail_manual%>
<% if homework.homework_detail_manual.comment_status == 1%>
<% end_time = homework.end_time.to_time.to_i + 24*60*60 - 1 %>
<% if end_time >= Time.now.to_i %>
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">提交已截止</div>
<% end %>
<% elsif homework.homework_detail_manual.comment_status == 2%>
<% end_time = homework.homework_detail_manual.evaluation_end.to_time.to_i + 24*60*60 - 1 %>
<% if end_time >= Time.now.to_i %>
<div class="fontGrey2 db fr">匿评剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60)%></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">匿评已截止</div>
<% end %>
<% end%>
<% end%>
<div class="cl"></div>
</div>
</div>
</div>
<div class="cl"></div>
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework} %>
</div>
<%= render :partial => "users/homework_base_info", :locals =>{:activity => homework, :user_activity_id =>homework.id, :is_teacher => is_teacher, :hw_status => 5} %>
</div>
<div class="cl"></div>

View File

@ -3,7 +3,7 @@
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
<%=format_time work.created_at %>
<%=format_time work.commit_time %>
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:165px; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
</li>

View File

@ -1,7 +1,7 @@
<div id="popbox02" style="">
<span class="f16 fontBlue">关联项目</span>
<a href="javascript:void(0);" class="popClose" onclick="clickCanel();"></a>
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course,:course_activity =>@course_activity),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:hw_status =>@hw_status),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
<div class="cl"></div>
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p>

View File

@ -3,7 +3,7 @@
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%>
<% else %>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity},:method => "post",:remote => true) do |f|%>
<%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id,:user_activity_id=>user_activity_id,:hw_status=>hw_status},:method => "post",:remote => true) do |f|%>
<% render :partial => 'student_work/set_score_rule_detail', :locals => {:homework => homework, :f => f}%>
<% end%>
<% end %>

View File

@ -12,7 +12,7 @@
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
<%=format_time work.created_at %>
<%=format_time work.commit_time %>
</li>
<% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>

View File

@ -93,10 +93,7 @@
<% elsif @homework.homework_type == 1 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
<% elsif @homework.homework_type == 3 %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% if pro && pro.student_work_id == work.id %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
<% end %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
<% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %>

View File

@ -1,7 +1,10 @@
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%");
<% else%>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%");
<% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% 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}) %>");
<% end %>
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -1,7 +1,6 @@
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -2,6 +2,7 @@
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= javascript_include_tag "resizeable_table" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<script type="text/javascript">
@ -9,6 +10,29 @@
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
$("#Container").css("width","1000px");
<% if @tab == 2%>
$("#student_work_tab2").click();
<% end %>
sd_create_editor_from_data(<%= @homework.id %>, null, "100%", "<%= @homework.class.to_s %>");
});
function HoverLi(n){
for(var i=1;i<=2;i++){
$('#student_work_tab'+i).removeClass('selected');
$('#student_work_con'+i).addClass('undis');
}
$('#student_work_tab'+n).addClass('selected');
$('#student_work_con'+n).removeClass('undis');
}
$("#moreProject_<%=@homework.id %>").click(function(){
$("#relatePWrap_<%=@homework.id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=@homework.id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=@homework.id %>").click(function(){
$("#relatePWrap_<%=@homework.id %>").toggleClass('relatePWrap');
$("#moreProject_<%=@homework.id %>").show();
});
// 匿评弹框提示
@ -41,17 +65,6 @@
}
$(function(){
/*$("#homework_info_hidden").click(function(){
$("#homeworkInformation").hide();
$("#homework_info_hidden").hide();
$("#homework_info_show").show();
});
$("#homework_info_show").click(function(){
$("#homework_info_show").hide();
$("#homeworkInformation").show();
$("#homework_info_hidden").show();
});*/
if($("#homework_description").height() > 54) {
$("#homeworkDetailShow").show();
}
@ -137,98 +150,33 @@
<div class="cl"></div>
</div>
<div class="homeworkInfo" id="homeworkInformation">
<div class="">
<div class="homepagePostTitle fl hidden m_w460" title="<%= @homework.name %>"><%= @homework.name %></div>
<% if @homework.homework_detail_manual%>
<% if @homework.homework_detail_manual.comment_status == 0 %>
<span class="grey_homework_btn_cir ml5">未发布</span>
<% elsif @homework.homework_detail_manual.comment_status == 1%>
<% if @homework.anonymous_comment == 0%>
<span class="grey_homework_btn_cir ml5">未开启匿评</span>
<% else %>
<span class="grey_homework_btn_cir ml5">匿评已禁用</span>
<% end %>
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
<span class="green_homework_btn_cir ml5">作品提交中</span>
<% elsif Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
<span class="red_homework_btn_cir ml5">作品补交中</span>
<% end %>
<% elsif @homework.homework_detail_manual.comment_status == 2%>
<% if @homework.anonymous_comment == 0%>
<span class="green_homework_btn_cir ml5">匿评中</span>
<% else %>
<span class="grey_homework_btn_cir ml5">匿评已禁用</span>
<% end %>
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% elsif @homework.homework_detail_manual.comment_status == 3%>
<% if @homework.anonymous_comment == 0%>
<span class="grey_homework_btn_cir ml5">匿评已结束</span>
<% else %>
<span class="grey_homework_btn_cir ml5">匿评已禁用</span>
<% end %>
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% end%>
<% end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" onclick="show_or_hide_info();" id="homework_info_hidden">[ 隐藏作业信息 ]</a> </span>
<div class="cl"></div>
<div class="fontGrey2 db mb5">发布者:<%= @homework.user.show_name %></div>
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">
<div id="homework_description"><%= @homework.description.html_safe %></div>
</div>
<div id="homeworkDetailShow" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="homeworkDetailHide" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div>
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @homework} %>
<div class="cl"></div>
</div>
<div class="mt5">
<% if @homework.end_time && @homework.publish_time %>
<% if @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status < 2 %>
<div class="fontGrey2 db fl">提交截止时间:<%= @homework.end_time %>&nbsp;23:59</div>
<% elsif @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status >= 2 && @homework.anonymous_comment == 0 %>
<div class="fontGrey2 db fl">匿评截止时间:<%= @homework.homework_detail_manual.evaluation_end %>&nbsp;23:59</div>
<% end %>
<% if @homework.homework_detail_manual.comment_status == 0 %>
<div class="fontGrey2 db fl ml10">发布时间:<%= @homework.publish_time %>&nbsp;00:00</div>
<% end %>
<% end %>
<% if @homework.homework_detail_manual%>
<% if @homework.homework_detail_manual.comment_status == 1%>
<% end_time = @homework.end_time.to_time.to_i + 24*60*60 - 1 %>
<% if end_time >= Time.now.to_i %>
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">提交已截止</div>
<% end %>
<% elsif @homework.homework_detail_manual.comment_status == 2%>
<% end_time = @homework.homework_detail_manual.evaluation_end.to_time.to_i + 24*60*60 - 1 %>
<% if end_time >= Time.now.to_i %>
<div class="fontGrey2 db fr">匿评剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60)%></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">匿评已截止</div>
<% end %>
<% end%>
<% end%>
<div class="cl"></div>
</div>
<ul class="homework-detail-tab mb10 mt15 fb">
<li class="selected" id="student_work_tab1" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="fontGrey3">作业信息</a>
</li>
<li onclick="HoverLi(2);" id="student_work_tab2">
<a href="javascript:void(0);" class="fontGrey3">作品列表</a>
</li>
<li style="width:515px;">&nbsp;</li>
</ul>
<div id="student_work_con1">
<div class="homepagePostBrief" id="homework_post_brief">
<%= render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher} %>
</div>
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @homework.id, :hw_status => 3, :is_teacher => @is_teacher} %>
<div class="cl"></div>
</div>
<div class="hworkListContainer">
<div class="ctt2">
<div class="dis" id="homework_student_work_list">
<%= render :partial => "student_work/student_work_list"%>
<div class="undis" id="student_work_con2">
<div class="hworkListContainer">
<div class="ctt2">
<div class="dis" id="homework_student_work_list">
<%= render :partial => "student_work/student_work_list"%>
</div>
</div>
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>

View File

@ -1,8 +1,11 @@
clickCanel();
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>");
<% if @hw_status != 5 %>
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% else %>
window.location.href = '<%=student_work_index_url(:homework => @homework.id) %>';
<% end %>

View File

@ -1,8 +1,11 @@
hideModal("#popbox02");
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%");
<% else%>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%");
<% if @hw_status == 5 %>
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
<% 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}) %>");
<% end %>
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -0,0 +1,4 @@
$("#syllabus_member_list").replaceWith("<%= escape_javascript(render :partial => 'syllabuses/syllabus_member_list') %>");
$("#syllabus_teacher_list").html("<%= escape_javascript(render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => @members}) %>");
$("#principal_search").val("");
$("#principals_for_new_member").html("");

View File

@ -0,0 +1,2 @@
$("#syllabus_member_list").replaceWith("<%= escape_javascript(render :partial => 'syllabuses/syllabus_member_list') %>");
$("#syllabus_teacher_list").html("<%= escape_javascript(render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => @members}) %>");

View File

@ -0,0 +1,19 @@
<% if @syllabus %>
var checked = $("#principals_for_new_member input:checked").size();
if(checked > 0)
{
alert('翻页或搜索后将丢失当前选择的用户数据!');
}
$('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_syllabus_by_name(@syllabus)) %>');
<% end %>
var collection = $("#principals_for_new_member").children("#principals").children("label");
collection.css("text-overflow", "ellipsis");
collection.css("white-space", "nowrap");
collection.css("width", "200px");
collection.css("overflow", "hidden");
for(i = 0; i < collection.length; i++) { //增加悬浮显示
var label = collection[i];
var text = $(label).text();
$(label).attr("title", text);
}

View File

@ -0,0 +1,2 @@
$("#syllabus_member_list").replaceWith("<%= escape_javascript(render :partial => 'syllabuses/syllabus_member_list') %>");
$("#syllabus_teacher_list").html("<%= escape_javascript(render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus, :members => @members}) %>");

View File

@ -9,7 +9,7 @@
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<% end %>
<% if @syllabus.user == User.current %>
<% if @syllabus.syllabus_members.map{|sm| sm.user_id}.include?(User.current.id) %>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_btn_green fr mt10 mr15", :target => '_blank'%>
<% end %>
<div class="cl"></div>
@ -21,13 +21,13 @@
<% if course.is_public == 0 && !User.current.member_of_course?(course) && !User.current.admin? %>
<h3 class="sy_classlist_title fl">
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
&nbsp;<font class="fb">·</font>&nbsp;
<font class="fb"> · </font>
<%=course.name %><%=current_time_and_term_short(course) %>
</h3>
<% else %>
<h3 class="sy_classlist_title fl">
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
&nbsp;<font class="fb">·</font>&nbsp;
<font class="fb"> · </font>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+""+current_time_and_term(course)+""%>
</h3>
@ -88,12 +88,6 @@
<script type="text/javascript">
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
$(function() {
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight) {
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height() + diffHeight;
$(".listbox").css("height", tmpHeight);
}
$(".sy_con_l").css("min-height",$(".sy_con_r").height());
});
</script>

View File

@ -0,0 +1,60 @@
<% is_admin = User.current == @syllabus.user || User.current.admin? %>
<table class="sy_new_table clear mb15" cellpadding="0" cellspacing="0" id="syllabus_member_list">
<thead>
<tr>
<th>序号</th>
<th class="sy_new_namebox">姓名</th>
<th>职业</th>
<th>创建班级数</th>
<th>参与班级数</th>
<% if is_admin %>
<th>操作</th>
<% end %>
</tr>
</thead>
<tbody>
<% @members.each_with_index do |member, i| %>
<% user = member.user %>
<% allow_delete = @syllabus.courses.where(:tea_id => member.user_id).empty? && i != 0 %>
<tr>
<td><%= member.rank %></td>
<td>
<% if member.rank == 1 %>
<div style="display: inline-block"><span class="sy_new_name fl"><%= user.show_name %></span><span class="sy_new_orange ml5 fl mt12">创建者</span></div>
<% else %>
<span class="sy_new_long_name"><%= user.show_name %></span>
<% end %>
</td>
<td>
<% if user.user_extensions && user.user_extensions.identity %>
<%= get_user_roll user %>
<% end%>
</td>
<% courses = user.courses.not_deleted %>
<td><%= courses.where("tea_id = #{user.id}").count %></td>
<td><%= courses.where("tea_id != #{user.id}").count %></td>
<% if is_admin %>
<td>
<% if i == 0 %>
&nbsp;
<% else %>
<% if allow_delete %>
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
<% else %>
<a href="javascript:void(0)" class="fr sy_btn_grey mr5" title="该老师已在本课程下创建了班级,不能删除">删除</a>
<% end %>
<% if i == 1 %>
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
<% elsif i == @members.count - 1 %>
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
<% else %>
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
<% end %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>

View File

@ -0,0 +1,55 @@
<ul id="sy_tab_nav">
<li id="sy_tab_nav_1" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="sy_tab_type" >课程大纲</a>
</li>
<li id="sy_tab_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
</li>
<li id="sy_tab_nav_3" class="sy_tab_hover" onclick="HoverLi(3);">
<a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
</li>
</ul>
<div id="sy_tab_con_3">
<div class="sy_new_tablebox clear">
<%= render :partial => 'syllabus_member_list' %>
<% if User.current == @syllabus.user %>
<a href="javascript:void(0);" class="fl sy_btn_green" onclick="toggle_search();">添加成员</a>
<% end %>
</div>
<% if User.current == @syllabus.user %>
<div class="sy_new_tchbox clear <%= @show == 1 ? '' : 'undis' %>" id="sy_search_box">
<%= form_tag url_for(:controller => 'syllabus_member', :action => 'create', :syllabus => @syllabus),:id => 'syllabus_member_add_form', :remote => true do |f|%>
<input hidden="hidden" value="true" name="flag">
<div class="hw_search_box mb10">
<input id="principal_search" class="sy_new_search" type="text" placeholder="<%= l(:label_invite_trustie_user_tips)%>">
<%= javascript_tag "observeSearchfield('principal_search', null, '#{escape_javascript "/syllabus_member/syl_member_autocomplete?" + {:syllabus => @syllabus.id}.to_query }')" %>
</div>
<div class="cl"></div>
<div id="principals_for_new_member">
<%= find_user_not_in_current_syllabus_by_name(@syllabus) %>
</div>
<div class="cl mb10"></div>
<a href="javascript:void(0);" class="fl sy_btn_blue mr5" onclick="$('#syllabus_member_add_form').submit();">确定</a>
<a href="javascript:void(0);" class="fl sy_btn_grey mr5" onclick="reset_search();">取消</a>
<% end%>
</div>
<% end %>
</div>
<script>
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
$(function() {
$(".sy_con_l").css("min-height",$(".sy_con_r").height());
});
function toggle_search() {
$("#sy_search_box").toggle();
}
function reset_search() {
$("#sy_search_box").toggle();
$("#principal_search").val("");
$("#principals_for_new_member").html("");
}
</script>

View File

@ -14,6 +14,9 @@
<li id="sy_tab_nav_2" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
</li>
<li id="sy_tab_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
</li>
</ul>
<div id="sy_tab_con_1">
<% if @syllabus.des_status == 0 && User.current == @syllabus.user %>

View File

@ -5,6 +5,9 @@
<li id="sy_tab_nav_2" class="sy_tab_hover" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="sy_tab_type" >班级列表</a>
</li>
<li id="sy_tab_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" class="sy_tab_type" >教师团队</a>
</li>
</ul>
<div id="sy_tab_con_2">

View File

@ -11,12 +11,20 @@
TO <!--+"(课程名称)" -->
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.course.name.to_s+" | 班级作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue"%>
<% if hw_status == 3 || hw_status == 5 %>
<%= link_to activity.course.name, course_path(activity.course_id), :class => "newsBlue"%>
<% else %>
<%= link_to activity.course.name.to_s+" | 班级作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue"%>
<% end %>
</div>
<div class="homepagePostTitle hidden fl m_w505"> <!--+"(作业名称)"-->
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
<% if hw_status == 3 || hw_status == 5 %>
<% index = get_hw_index(activity, is_teacher) %>
<%= link_to "<span class='fontBlue2'>作业#{index+1}</span>".html_safe+activity.name,student_work_index_path(:homework => activity.id),:class => "postGrey"%>
<% else %>
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
<% end %>
</div>
<%=get_hw_status(activity).html_safe %>
<div class="cl"></div>
@ -26,56 +34,17 @@
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>
<div class="homepagePostSubmitContainer">
<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
<% projects = cur_user_projects_for_homework activity %>
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% if activity.homework_detail_manual.comment_status != 0 %>
<div class="homepagePostSubmit">
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %>
</div>
<% end %>
<% end %>
<% if activity.homework_type == 2%>
<div class="homepagePostDeadline mr15">
语言:
<%= activity.language_name%>
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>
<% end %>
<%= render :partial => 'users/homework_opr', :locals => {:activity => activity, :is_teacher => is_teacher, :hw_status => hw_status, :user_activity_id => user_activity_id} %>
<% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
<div class="homepagePostDeadline">提交截止时间:<%= activity.end_time.to_s %>&nbsp;23:59</div>
<% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
<div class="homepagePostDeadline">匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %>&nbsp;23:59</div>
<% end %>
<% if activity.homework_detail_manual.comment_status == 0 && !activity.publish_time.nil? %>
<div class="homepagePostDeadline ml15">
<%= l(:label_publish_time)%><%= activity.publish_time%>&nbsp;00:00
</div>
<% end %>
</div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
@ -86,221 +55,13 @@
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
<div class="mt10">
<div class="homepagePostDeadline">
迟交扣分:<%= activity.late_penalty%>分
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<% end %>
</div>
<div class="cl"></div>
<div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<% end %>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.has_committed.count != 0 %>
<% sw = activity.student_works.has_committed.reorder("commit_time desc").first %>
<div class="mt10 homepagePostDeadline mb10">
#&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div>
<p class="mb10 fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
</p>
</div>
<% end %>
<div>
<% if activity.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id,:show_work_id => sw.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id,:show_work_id => sw.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<% if student_works.count > 5 %>
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<%# first_pro = sort_projects.first %>
<% first_pro = Project.find sort_projects.first.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div>
<div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none");
});
});
</script>
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% com_time = project.project_score.commit_time %>
<% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像", :target => '_blank' %>
<p class="mh18 hidden"><%=link_to (User.find project.user_id).show_name+"(组长)", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{(User.find project.user_id).show_name}(组长)" %></p>
<% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
<p class="mh18 hidden"><%=link_to update_time+" "+project.project_score.changeset_num.to_s+"提交", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{update_time} #{project.project_score.changeset_num.to_s}提交" %></p>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %>
<p class="mh18 hidden" title="私有项目不可访问"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18 hidden" title="私有项目不可访问"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<% end %>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
</div>
</div>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
</li>
<li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) %>
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
</li>
<li>
<%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
<li>
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
</li>
<% elsif activity.is_open == 1 %>
<li>
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end%>
<%= render :partial => "users/homework_base_info", :locals =>{:activity => activity, :user_activity_id =>user_activity_id, :is_teacher => is_teacher, :hw_status => hw_status} %>
</div>
<div class="cl"></div>
</div>
<% count=activity.journals_for_messages.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity} %>
<% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :is_in_course => -1,:course_activity=>course_activity, :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
</div>
<script type="text/javascript">
$("#moreProject_<%=user_activity_id %>").click(function(){

View File

@ -0,0 +1,178 @@
<div class="mt10">
<div class="homepagePostDeadline">
迟交扣分:<%= activity.late_penalty%>分
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<% end %>
</div>
<div class="cl"></div>
<div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<% end %>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.has_committed.count != 0 %>
<% sw = activity.student_works.has_committed.reorder("commit_time desc").first %>
<div class="mt10 homepagePostDeadline">
#&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div class="mt10">
<p class="fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
</p>
</div>
<% end %>
<div>
<% if activity.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id, 2, '', sw.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name,student_work_index_url_in_org(activity.id, 2, '', sw.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<% if student_works.count > 5 %>
<%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<%# first_pro = sort_projects.first %>
<% first_pro = Project.find sort_projects.first.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div>
<div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none");
});
});
</script>
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% com_time = project.project_score.commit_time %>
<% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像", :target => '_blank' %>
<p class="mh18 hidden"><%=link_to (User.find project.user_id).show_name+"(组长)", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{(User.find project.user_id).show_name}(组长)" %></p>
<% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
<p class="mh18 hidden"><%=link_to update_time+" "+project.project_score.changeset_num.to_s+"提交", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{update_time} #{project.project_score.changeset_num.to_s}提交" %></p>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %>
<p class="mh18 hidden" title="私有项目不可访问"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18 hidden" title="私有项目不可访问"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<% end %>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
</div>
</div>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "postOptionLink"%>
</li>
<li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) %>
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
</li>
<li>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
<li>
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li>
<% elsif activity.is_open == 1 %>
<li>
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end%>

View File

@ -0,0 +1,43 @@
<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
<% projects = cur_user_projects_for_homework activity %>
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<%= user_for_homework_common activity,is_teacher %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% if activity.homework_detail_manual.comment_status != 0 %>
<div class="homepagePostSubmit">
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %>
</div>
<% end %>
<% end %>
<% if activity.homework_type == 2%>
<div class="homepagePostDeadline mr15">
语言:
<%= activity.language_name%>
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>
<% end %>

View File

@ -0,0 +1,34 @@
<% count=activity.journals_for_messages.count %>
<div class="homepagePostReply" id="homework_post_reply_<%= user_activity_id %>">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status} %>
<% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :hw_status => hw_status, :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'hw_status',params[:hw_status],:value =>hw_status %>
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -8,7 +8,7 @@
<div class="fl ">
<h3 class="sy_classlist_title fl">
<% if type == "1" %>
<%=link_to homework.name, student_work_index_path(:homework => homework), :class => 'hw_cgrey', :target => "_blank" %>
<%=link_to homework.name, student_work_index_path(:homework => homework), :class => 'linkGrey5', :target => "_blank" %>
<% else %>
<%=homework.name %>
<% end %>

View File

@ -20,13 +20,13 @@
</span>
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
<span class="fl">作品:</span>
<span class="sy_corange hw_w20 fl "><%=homework.student_works.has_committed.count %></span>
<span class="sy_corange hw_w30 fl "><%=homework.student_works.has_committed.count %></span>
<span class="fl">/</span>
<span class="sy_cgrey hw_w20 fl mr15"><%= homework.homework_type == 3 ? '--' : homework.course.student.count %></span>
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.homework_type == 3 ? '--' : homework.course.student.count %></span>
<span class="fl">待评阅:</span>
<span class="sy_corange hw_w20 fl"><%= homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %></span>
<span class="sy_corange hw_w30 fl"><%= homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %></span>
<span class="fl">/</span>
<span class="sy_cgrey hw_w20 fl mr15"><%=homework.student_works.has_committed.count %></span>
<span class="sy_cgrey hw_w30 fl mr15"><%=homework.student_works.has_committed.count %></span>
<span class="mr15 fl">发布时间:
<% if homework.publish_time %>
<%= format_date(homework.publish_time) %>

View File

@ -36,14 +36,14 @@
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity},
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :hw_status => hw_status, :user_activity_id => user_activity_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course, :user_activity_id => user_activity_id, :course_activity => course_activity},
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:hw_status => hw_status, :user_activity_id => user_activity_id},
:id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) %>
<% end %>
<% elsif type == 'News' %>

View File

@ -10,12 +10,8 @@
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<% if activity.class.to_s == 'HomeworkCommon' && is_in_course == -1 %>
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'HomeworkCommon',<%=user_activity_id %>,-1,<%=course_activity %>,<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% elsif activity.class.to_s == 'HomeworkCommon' %>
<a id="reply_btn_<%=activity.id%>" onclick="expand_reply_homework('#reply_div_<%= activity.id %> li','#reply_btn_<%=activity.id%>',<%= activity.id %>,'HomeworkCommon',<%=activity.id %>,<%=is_in_course %>,-1, -1)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
<% if activity.class.to_s == 'HomeworkCommon' %>
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'HomeworkCommon',<%=activity.id %>,<%=hw_status %>,<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% elsif activity.class.to_s == 'Message' %>

View File

@ -5,9 +5,8 @@
<div nhname='new_message_<%= reply.id%>'>
<% if @type == 'HomeworkCommon' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
<input type="hidden" name="is_in_course" value=<%=@is_in_course %>>
<input type="hidden" name="hw_status" value=<%=@hw_status %>>
<input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>>
<input type="hidden" name="course_activity" value=<%=@course_activity %>>
<input type="hidden" name="reply[subject]" id="reply_subject">
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>

View File

@ -51,7 +51,7 @@
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:hw_status => 1} %>
<% end %>
<%# end %>
<% when 'News' %>

View File

@ -50,7 +50,7 @@
<% work = cur_user_works_for_homework homework_common %>
<% if !is_teacher && !work.nil? && homework_common.end_time < Date.today && work.user == User.current %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
<%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if homework_common.homework_type == 2 && is_teacher%>

View File

@ -26,15 +26,10 @@
}
}
</script>
<%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
<%= render :partial => 'users/course_homework', :locals => {:activity => homework_common, :user_activity_id =>homework_common.id, :hw_status => 3} %>
<% end%>
<% if homework_commons.count == 10%>
<% if is_in_course == 1%>
<!-- 在课程内 -->
<%#= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% else%>
<!-- 在个人主页 -->
<%= link_to "点击展开更多",student_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%>
<!-- 在课程内 -->
<%#= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%>
</div>

View File

@ -1,47 +0,0 @@
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>");
//homework_description_editor.html("");
$("#homework_name_span").text("");
$("#homework_end_time_span").text("");
$("#homework_end_time_span").text("");
$("#homework_course_id_span").text("");
$("#homework_editor").toggle();
}
// 点击 checkbox选中引用的资源的时候保存该资源的id到session里去
function store_seleted_resource(dom){
if(dom.attr('checked') == 'checked' ){
$.get(
'<%= store_selected_resource_user_path %>'+'?save=y&res_id='+dom.val()
)
}else {
$.get(
'<%= store_selected_resource_user_path %>'+'?save=n&res_id='+dom.val()
)
}
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div>
</div>
<div class="cl"></div>
<% if @is_teacher%>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10" nhname='homework_common_form'>
<% homework = HomeworkCommon.new %>
<% homework.homework_detail_manual = HomeworkDetailManual.new%>
<%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
</div>
<% end%>
</div><!----HomeWork end-->
<% end%>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>

View File

@ -1,5 +1,5 @@
<% if params[:type] == 'HomeworkCommon' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id, :activity_id => params[:id].to_i}) %>');
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :hw_status =>@hw_status, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id, :activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'JournalsForMessage' %>
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i}) %>');
<% elsif params[:type] == 'Message' %>

View File

@ -31,12 +31,11 @@
<% elsif @user && @jours_count%>
$('#jour_count').html("<%= @jours_count %>");
<% elsif @homework%>
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
sd_create_editor_from_data(<%= @homework.id%>,"","100%");
$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @user_activity_id, :hw_status => @hw_status, :is_teacher => @is_teacher}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%");
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% end %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')

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