Merge branch 'cxt_course' into develop

hjq_resource
huang 9 years ago
commit 2d701b7d03

@ -593,7 +593,7 @@ class AdminController < ApplicationController
end
end
#代码测试列表
#代码测试列表
def code_work_tests
#求出所有条数
tCount = CodeTests.count()
@ -644,4 +644,13 @@ class AdminController < ApplicationController
format.html
end
end
#分享作业申请
def apply_for_homework
homeworks = ApplyHomework.where("user_id != 0")
@homework = paginateHelper homeworks,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
end

@ -760,49 +760,64 @@ class StudentWorkController < ApplicationController
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2
@score = student_work_score @work,User.current
#@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
#@score.score = params[:score] if params[:score]
#if User.current.admin?
# @score.reviewer_role = 1
#else
# role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
# @score.reviewer_role = get_role_by_name(role)
#end
#@is_new = false
@is_last_a = @work.student_works_scores.empty?
@new_score = StudentWorksScore.new
if @score && params[:score]
@new_score.score = params[:score].to_i == -1 ? @score.score : params[:score]
elsif @score.nil? && params[:score]
@new_score.score = params[:score].to_i == -1 ? nil : params[:score]
end
@new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@new_score.user_id = User.current.id
@new_score.student_work_id = @work.id
if User.current.admin?
@new_score.reviewer_role = 1
else
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
@new_score.reviewer_role = get_role_by_name(role)
end
if @score
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@score.score = params[:score] if params[:score]
if User.current.admin?
@score.reviewer_role = 1
if @is_teacher
@is_new = true
@is_last_a = false
else
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
@score.reviewer_role = get_role_by_name(role)
@is_new = false
end
@is_new = false
else
@is_last_a = @work.student_works_scores.empty?
@score = StudentWorksScore.new
@score.score = params[:score] if params[:score]
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
@score.user_id = User.current.id
@score.student_work_id = @work.id
if User.current.admin?
@score.reviewer_role = 1
else
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
@score.reviewer_role = get_role_by_name(role)
end
@is_new = true
end
@score.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@score)
@new_score.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@new_score)
if @score.save
case @score.reviewer_role
if @new_score.save
case @new_score.reviewer_role
when 1 #教师评分:最后一个教师评分为最终评分
@work.teacher_score = @score.score
@work.teacher_score = @new_score.score
when 2 #教辅评分 教辅评分显示平均分
@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
#@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
when 3 #学生评分 学生评分显示平均分
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
#@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.student_score = stu_score.first.score.try(:round, 2).to_f
end
@homework.update_attributes(:updated_at => Time.now)
update_course_activity(@homework.class,@homework.id)
update_user_activity(@homework.class,@homework.id)
update_org_activity(@homework.class,@homework.id)
if @work.save
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
respond_to do |format|
format.js
end
@ -835,6 +850,14 @@ class StudentWorkController < ApplicationController
end
end
#提交未评分的评语
def add_comments_to_work
@work = StudentWork.find params[:id]
respond_to do |format|
format.js
end
end
#为作品点赞
def praise_student_work
pt = PraiseTread.new
@ -990,6 +1013,10 @@ class StudentWorkController < ApplicationController
end
attachment = @work.attachments.where("attachtype = 7").first
attachment.update_attributes(:description => params[:description])
if attachment.attachtype == 7
student_work = StudentWork.find attachment.container_id
CourseMessage.create(:user_id => student_work.homework_common.user_id, :course_id => student_work.homework_common.course_id, :viewed => false,:course_message_id=>attachment.container_id,:course_message_type=>'StudentWork',:status=>2)
end
respond_to do |format|
format.js
end

@ -95,7 +95,13 @@ class UsersController < ApplicationController
case params[:type]
when 'HomeworkCommon'
@reply = JournalsForMessage.find params[:reply_id]
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
else
@user_activity_id = -1
end
@is_in_course = params[:is_in_course]
@course_activity = params[:course_activity].to_i
end
respond_to do |format|
format.js
@ -628,18 +634,27 @@ class UsersController < ApplicationController
course_ids = courses.empty? ? "(-1)" : "(" + courses.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and course_id in #{course_ids}").order("#{@order} #{@b_sort}")
elsif params[:type] == "3" #申请题库
#apply_homeworks = ApplyHomework.where("user_id = ?",@user.id)
none_visible_course = Course.where("is_delete = 1")
none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
#apply_homeworks = ApplyHomework.where("user_id = ?",@user.id).order('created_at desc')
#homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
#@homeworks = HomeworkCommon.where("id in #{homework_ids}")
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} order by ah.created_at desc"
#@homeworks = HomeworkCommon.where("id in #{homework_ids} and course_id not in #{none_visible_course_ids}")
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} and homework_commons.course_id not in #{none_visible_course_ids} order by ah.created_at desc"
@homeworks = HomeworkCommon.find_by_sql(sql)
end
if params[:property] && params[:property] == "1"
@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
elsif params[:property] && params[:property] == "2"
@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
elsif params[:property] && params[:property] == "3"
@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
if params[:property]
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
if params[:property] == "1"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
#@homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
elsif params[:property] == "2"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
#@homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
elsif params[:property] == "3"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
#@homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
end
end
@type = params[:type]
@property = params[:property]
@ -717,13 +732,15 @@ class UsersController < ApplicationController
elsif params[:type] == "3" #申请题库
apply_homeworks = ApplyHomework.where("user_id = ?",@user.id)
homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
none_visible_course = Course.where("is_delete = 1")
none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
if @order == "course_name"
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN courses ON homework_commons.course_id = courses.id where courses.is_delete = 0 and homework_commons.id in #{homework_ids} and homework_type in #{type_ids} and publish_time <= '#{Date.today}' and (homework_commons.name like '%#{search}%') order by CONVERT (courses.name USING gbk) COLLATE gbk_chinese_ci #{@b_sort}"
@homeworks = HomeworkCommon.find_by_sql(sql)
elsif @order == "user_name"
@homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
@homeworks = HomeworkCommon.where("homework_commons.id in #{homework_ids} and course_id not in #{none_visible_course_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").joins(:user).order("CONVERT (lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, CONVERT (firstname USING gbk) COLLATE gbk_chinese_ci #{@b_sort},login #{@b_sort}")
else
@homeworks = HomeworkCommon.where("id in #{homework_ids} and (name like '%#{search}%') and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
@homeworks = HomeworkCommon.where("id in #{homework_ids} and (name like '%#{search}%') and course_id not in #{none_visible_course_ids} and homework_type in #{type_ids}").order("#{@order} #{@b_sort}")
end
end
=begin
@ -1354,7 +1371,7 @@ class UsersController < ApplicationController
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
user_course_ids = (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
project_types = "('Message','Issue','ProjectCreateInfo')"
principal_types = "JournalsForMessage"

@ -317,7 +317,9 @@ class WordsController < ApplicationController
update_org_activity(@homework_common.class,@homework_common.id)
respond_to do |format|
format.js{
@is_in_course = params[:is_in_course]
@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
}
end
else

@ -2997,9 +2997,11 @@ 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 = '')
def student_work_index_url_in_org(homework_id, 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
elsif show_work_id != ''
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&show_work_id=" + show_work_id.to_s
else
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
end

@ -23,7 +23,7 @@ module StudentWorkHelper
#获取指定用户对某一作业的评分结果
def student_work_score work,user
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).first
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last
end
#获取指定评分的角色

@ -1,5 +1,5 @@
class ApplyHomework < ActiveRecord::Base
#status1. 待审核 2.审核通过 3.已拒绝
#status1. 等待回复 2.审核通过 3.已拒绝
belongs_to :user
belongs_to :homework_common
attr_accessible :status, :user_id, :homework_common_id

@ -301,7 +301,7 @@ class Attachment < ActiveRecord::Base
nil
end
def filename=(arg)
def filename=(arg)
write_attribute :filename, sanitize_filename(arg.to_s)
filename
end

@ -18,6 +18,7 @@ class HomeworkCommon < ActiveRecord::Base
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
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 :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy

@ -256,6 +256,11 @@ class JournalsForMessage < ActiveRecord::Base
end
end
if self.jour_type == 'HomeworkCommon'
if self.m_parent_id.nil?
if self.user_id != self.jour.user_id
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false)
end
end
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
if count == 0
ws = WechatService.new

@ -18,17 +18,29 @@ class StudentWorksScore < ActiveRecord::Base
receiver = self.student_work.user
# 判断是第一次评阅还是更新 status:0 新建1 更新
if self.created_at == self.updated_at
if self.comment.nil?
if self.comment.nil? && self.score
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}", :status=> false)
elsif self.score.nil? && self.comment
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "评语:#{self.comment}", :status=> false)
elsif self.comment.nil? && self.score.nil?
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "上传了批阅附件", :status=> false)
else
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}&nbsp;&nbsp;&nbsp; 评语:#{self.comment}", :status=> false)
end
else # 更新
if self.comment.nil?
if self.comment.nil? && self.score
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}", :status=> true)
elsif self.score.nil? && self.comment
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "评语:#{self.comment}", :status=> true)
elsif self.comment.nil? && self.score.nil?
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "上传了批阅附件", :status=> true)
else
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}&nbsp;&nbsp;&nbsp; 评语:#{self.comment}", :status=> true)

@ -108,6 +108,7 @@ class User < Principal
has_many :student_works_evaluation_distributions, :dependent => :destroy
has_many :student_works_scores, :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
has_many :apply_homeworks, :dependent => :destroy
#end
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},

@ -0,0 +1,89 @@
<h3>
<%=l(:label_apply_homework)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 120px;">
作业名称
</th>
<th style="width: 120px;">
课程名称
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 50px;">
申请者
</th>
<th style="width: 50px;">
申请状态
</th>
<th style="width: 70px;">
申请日期
</th>
</tr>
</thead>
<tbody>
<%@count=@page*30 %>
<% for homework in @homework do %>
<% unless homework.nil? %>
<% @count+=1 %>
<tr>
<td align="center">
<%=@count %>
</td>
<% c_h = HomeworkCommon.find homework.homework_common_id %>
<% if c_h %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=c_h.name%>'>
<%=link_to(c_h.try(:name), student_work_index_path(:homework => c_h.id))%>
</td>
<% if c_h.course %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=c_h.course.name%>'>
<%= link_to(c_h.course.name, course_path(c_h.course.id)) %>
</td>
<% end %>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if c_h.try(:user).try(:realname) == ' '%><%= c_h.try(:user)%><% else %><%=c_h.try(:user).try(:realname) %><% end %>'>
<% if c_h.try(:user).try(:realname) == ' '%>
<%= link_to(c_h.try(:user), user_path(c_h.user_id)) %>
<% else %>
<%= link_to(c_h.try(:user).try(:realname), user_path(c_h.user_id)) %>
<% end %>
</td>
<% end %>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
<% if homework.try(:user).try(:realname) == ' '%>
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>
<% else %>
<%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %>
<% end %>
</td>
<td align="center">
<% if homework.status == 1 %>
等待回复
<% elsif homework.status == 2 %>
已通过
<% else %>
已拒绝
<% end %>
</td>
<td align="center">
<%=format_date( homework.created_at ) %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_apply_homework)) -%>

@ -2,6 +2,7 @@
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<% end %>
<script type="text/javascript">
var first_click = true;
function nh_check_field(params){
var result=true;
if(!regexTopicSubject()) {
@ -49,10 +50,12 @@
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(first_click && is_checked){
if(flag){
first_click = false;
return true;
}else{
first_click = false;
$(this)[0].submit();
return false;
}

@ -50,29 +50,19 @@
}*/
</script>
<ul class="hworkListRow" id="student_work_<%= exercise.id%>">
<li class="hworkList340 width530">
<ul>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
</li>
<div id="show_student_result_div_<%= exercise.id%>" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li>
<ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名" id="student_name_<%= exercise.id%>">
<%=exercise.user.show_name %>
</li>
<li class="hworkStID mr10 mt16" title="学号" id="student_id_<%= exercise.id%>">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
</li>
<li class="hworkStID mt16" title="班级" id="student_class_<%= exercise.id%>">
--
</li>
</ul>
</li>
</div>
</ul>
<li class="ml5 mr5" style="width:28px; text-align:center;">1</li>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(exercise.user)) %>
</li>
<li class="hworkList130 c_grey student_work_<%= exercise.id%>">
<li class="hworkStName" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
<%=exercise.user.show_name %>
</li><li class="hworkStID pl15 pr10" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
</li>
<li class="hworkStID" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
--
</li>
<li class="hworkList130 ml200 c_grey student_work_<%= exercise.id%>">
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if @exercise.end_time <= exercise.created_at %>

@ -1,5 +1,6 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 width530">
<span class="c_dark f14 fb fl mr5">序号</span>
<span class="c_dark f14 fb fl mr55">&nbsp;&nbsp;</span>
<span class="c_dark f14 fb fl mr60">姓名</span>
<span class="c_dark f14 fb fl mr60">学号</span>

@ -186,7 +186,7 @@
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %>
</a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
<%= l(:label_comment_with_space) %>
</a>
</p>
@ -199,6 +199,9 @@
</div>
<script type="text/javascript">
$(function(){
$("#news_submit_comment").one('click',function(){
submitComment();
});
$("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");

@ -161,7 +161,7 @@
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %>
</a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
<%= l(:label_comment_with_space) %>
</a>
</p>
@ -174,6 +174,9 @@
</div>
<script type="text/javascript">
$(function(){
$("#news_submit_comment").one('click',function(){
submitComment();
});
$("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");

@ -171,7 +171,7 @@
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %>
</a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
<a href="javascript:void(0)" class="blue_btn fr" id="news_submit_comment">
<%= l(:label_comment_with_space) %>
</a>
</p>
@ -184,6 +184,9 @@
</div>
<script type="text/javascript">
$(function(){
$("#news_submit_comment").one('click',function(){
submitComment();
});
$("#message_description_<%= @news.id %> p,#message_description_<%= @news.id %> span,#message_description_<%= @news.id %> em").each(function(){
var postContent = $(this).html();
postContent = postContent.replace(/&nbsp;/g," ");

@ -140,8 +140,8 @@
<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}").reorder("created_at desc") %>
<%# 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>
@ -159,8 +159,18 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id)%></p>
<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 => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_url_in_org(activity.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>
@ -276,7 +286,8 @@
<% count=activity.journals_for_messages.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<div class="homepagePostReplyBannerCount"><span>回复</span>
<span class="reply_iconup" > ︿</span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.user == User.current %>
@ -318,23 +329,60 @@
<% else %>
<%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<%= time_from_now(comment.created_on) %>
</div>
<% unless comment.m_parent_id.nil? %>
<% parents_rely = [] %>
<% parents_rely = get_reply_parents parents_rely, comment %>
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 3 %>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div id="comment_reply_<%=parents_rely[length - 1].id %>">
<%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
</div>
<div class="orig_cont_hide clearfix"><span class="orig_icon" >&darr; </span><span class="orig_icon" style="display:none;" > &uarr;</span><%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %></div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>
<% end %>
</span>
<div id="message_edit_<%=comment.id %>" style="display: none" class="mr10 fr">
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
<% end %>
</div>
</div>
</div>
<% end %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
</span>
<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 => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<!--<a action-type="reply" href="javascript:;" poped="false" class="fr mr20 linkGrey3" title="回复">回复</a>-->
<% 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 => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
</div>
<div class="cl"></div>
</li>

@ -7,8 +7,9 @@
<p id="hint_message_<%=work.id %>" style="margin-left: 65px;"></p>
<li >
<span class="tit_fb mt2"> 评分:</span>
<input type="number" name="score" id="score_<%= work.id%>" value="<%= score.nil? ? 0 : score.score%>" min="0" max="100" size="4" data-units="dollars" />
<span class=" ml5">分</span>
<input type="number" name="score" id="score_<%= work.id%>" value="<%= (score.nil? || score.score.nil?) ? -1 : score.score%>" min="-1" max="100" size="4" data-units="dollars" />
<span class="ml5">分</span>
<span id="score_notice_span_<%= work.id%>" class="ml5 c_red" style="display: none;">未评分</span>
<div class="cl"></div></li>
<li >
<% if @is_teacher%> <!-- 老师才可以上传批阅结果 -->
@ -16,24 +17,54 @@
<div>
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
</div>
<div class="cl"></div>
<span class="c_red ml5" style="display: none;" id="none_notice_<%= work.id%>">评语、评分、批阅结果至少有一个不为空。</span>
<%end%>
<a href="javascript:void(0);" id="work_submit_<%= work.id %>" class="blue_n_btn fr evaluation_submit" onclick="score_submit('<%=work.id %>');">提交</a>
<div class="cl"></div>
</li>
<% end%>
<script type="text/javascript">
var first_click_score = true;
function score_submit(id){
<% if !@is_teacher %>
if ($.trim($('#score_comment_'+id).val()) == "") {
$('#hint_message_'+id).html("为了对其他学生的作品负责,请您务必填写评语");
$("#hint_message_"+id).css('color','#ff0000');
$("#score_comment_"+id).focus();
} else {
} else if (parseFloat($("#score_"+id).val()) == -1) {
$('#score_notice_span_'+id).html("请先评分");
$('#score_notice_span_'+id).show();
$("#score_"+id).focus();
}
else if(first_click_score) {
first_click_score = false;
$("#work_submit_"+id).parent().parent().submit();
$('#about_hwork_'+id).html('');
}
<% else %>
$("#work_submit_"+id).parent().parent().submit();
if($.trim($('#score_comment_'+id).val()) == "" && parseFloat($("#score_"+id).val()) == -1 && $("#attachments_fields"+id).children().length == 0){
$("#none_notice_"+id).show();
} else if(parseFloat($("#score_"+id).val()) == -1) {
$.ajax({
type: "GET",
url: "/student_work/"+id+"/add_comments_to_work",
data: 'text',
success: function (data) {
}
});
}
else if(first_click_score) {
first_click_score = false;
$("#work_submit_" + id).parent().parent().submit();
}
<% end %>
}
function submit_teacher_score(id){
if (first_click_score) {
first_click_score = false;
$("#work_submit_"+id).parent().parent().submit();
hideModal();
}
}
</script>

@ -1,5 +1,14 @@
<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => score.id)) do |f|%>
<%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
<input type="hidden" value="<%= is_last%>" name="is_last">
<a href="javascript:void(0);" class="fr blue_n_btn" onclick="$('#add_score_reply_<%= score.id%>').find('form').submit();">回复</a>
<% end%>
<a href="javascript:void(0);" class="fr blue_n_btn" onclick="add_score_Reply_submit('<%=score.id %>');">回复</a>
<script type="text/javascript">
var first_click = true;
function add_score_Reply_submit(id){
if(first_click) {
first_click = false;
$('#add_score_reply_'+id).find('form').submit();
}
}
</script>
<% end%>

@ -1,13 +1,15 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 w455">
<span class="HomeworkNameTitle f14 fb fl w235">作品名称</span>
<li class="hworkList30 hworkH30 ml5 mr5"><span class="c_dark f14 fb fl">序号</span></li>
<li class="hworkList50 hworkH30">&nbsp;</li>
<li class="hworkList260 hworkH30">
<span class="f14 fb fl">作品名称</span>
</li>
<% if @homework.homework_type != 3 %>
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
<span class="HomeworkStuTitle f14 fb fl">学号</span>
<li class="hworkList80 hworkH30"><span class="HomeworkStuTitle f14 fb fl">姓名</span></li>
<li class="hworkList80 hworkH30"><span class="HomeworkStuTitle f14 fb fl">学号</span></li>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
<li class="hworkList160 hworkH30"><span class="HomeworkStuTitle f14 fb fl">关联项目</span></li>
<% end %>
</li>
<li class="hworkList130 hworkH30 fb ml10">
时间
@ -19,7 +21,7 @@
</li>
<% end%>
<li class="hworkList50 hworkH30 fb mr10 ml10" style="float: right;">
<li class="hworkList50 hworkH30 fb mr10 ml10">
我的评分
</li>
</ul>

@ -1,21 +1,29 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr150 ml50'%>">作品名称</span>
<li class="hworkList30 hworkH30 ml5 mr5"><span class="c_dark f14 fb fl">序号</span></li>
<li class="hworkList50">&nbsp;</li>
<li class="<%= @homework.homework_type == 2 ? 'hworkList80 mr10' : 'hworkList130 mr10'%> hworkH30">
<span class="c_dark f14 fb fl <%#= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr150 ml50'%>">作品名称</span>
</li>
<% if @homework.homework_type != 3 %>
<!--<span class="c_dark f14 fb fl mr50">姓名</span>-->
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl" ,:remote => true%>
<li class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> hworkH30 mr10">
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml18" ,:remote => true%>
<% if @show_all && @order == "lastname"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
<% end%>
</li>
<li class="<%=@homework.anonymous_comment == 1 ? 'hworkList90' : 'hworkList80'%> hworkH30 mr10">
<!--<span class="c_dark f14 fb fl">学号</span>-->
<%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%>
<%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml30" ,:remote => true%>
<% if @show_all && @order == "student_id"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
<% end%>
</li>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<span class="c_dark f14 fb fl">关联项目</span>
<li class="hworkList160 hworkH30">
<span class="c_dark f14 fb">关联项目</span>
</li>
<% end %>
</li>
<li class="hworkList130 hworkH30">
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%>

@ -1,44 +1,36 @@
<!-- 匿评作品列表,显示某一个作品的信息 -->
<a name="<%= student_work.id%>"></a>
<ul class="hworkListRow" id="student_work_<%= student_work.id%>">
<li class="hworkList340 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<ul>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
</li>
<div class="student_work_<%= student_work.id%>">
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
<li class="hworkList30 ml5 mr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></li>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %>
</li>
<div class="student_work_<%= student_work.id%>">
<li class="hworkName mt12 pr10 <%= @homework.homework_type == 2 ? '' : 'width130'%>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</li>
<% if @homework.homework_type != 3 %>
<li class="<%=@homework.anonymous_comment == 1 ? 'hworkStName100' : 'hworkStName'%> pr10" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.show_name%>
</li>
<li>
<% if @homework.homework_type != 3 %>
<ul class="mt10 fl" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<li class="hworkStName mr10 mt16" title="<%= student_work.user.show_name%>">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<ul class="mt10 fl">
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<li class="hworkPrName mr10 mt12" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</li>
<% else %>
<li class="hworkPrName mr10 mt12" title="该项目是私有的">
<%= student_work.project.name %>
</li>
<% end %>
</ul>
<% end %>
<li class="<%=@homework.anonymous_comment == 1 ? 'hworkStID90' : 'hworkStID'%> pr10" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</div>
</ul>
</li>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<li class="hworkPrName" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</li>
<% else %>
<li class="hworkPrName" title="该项目是私有的">
<%= student_work.project.name %>
</li>
<% end %>
<% end %>
</div>
<li class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.created_at && @homework.end_time%>
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
@ -70,11 +62,11 @@
<% end %>
<% unless student_work.student_score.nil?%>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>)
</span>
<div class="infoNi none">
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>&nbsp;</span>
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.student_score)%>&nbsp;</span>分。
</div>

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

Loading…
Cancel
Save