This commit is contained in:
alan 2014-12-05 10:53:58 +08:00
commit 078639b35a
12 changed files with 242 additions and 271 deletions

View File

@ -284,11 +284,6 @@ class HomeworkAttachController < ApplicationController
end
end
#获取指定作业的所有成员
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
#获取可选成员列表
#homework作业
#users该作业所有成员
@ -359,53 +354,21 @@ class HomeworkAttachController < ApplicationController
#显示作业信息
def show
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
# 打分统计
#stars_reates = @homework. rates(:quality)
#是否已经进行过评价
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first
@m_score = temp.nil? ? 0:temp.stars
@has_evaluation = @homework.has_rated?( User.current,:quality)
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
if User.current.admin? || User.current.member_of_course?(@course)
# 作业打分列表
@stars_reates = @homework.rates(:quality)
#我的评分
@has_evaluation = @stars_reates.where("rater_id = #{User.current.id}").first
@m_score = @has_evaluation.nil? ? 0 : @has_evaluation.stars
teachers = find_course_teachers(@course)
@teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
@is_teacher = is_course_teacher User.current,@course
@is_anonymous_comments = @bid.comment_status == 1 && !@homework.users.include?(User.current) && @homework.user != User.current && !@is_teacher #判断是不是匿评(开启匿评,当前用户不是作业的创建者或者参与者,不是老师)
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
@jour = paginateHelper jours,5 #留言
@cur_page = params[:cur_page] || 1
@cur_type = params[:cur_type] || 5
@jour = paginateHelper @jours,5
teachers = searchTeacherAndAssistant @course
@comprehensive_evaluation = []
#JourForMessage的is_comprehensive_evaluation字段
#1老师评价
#2学生评价
#3 || null学生留言
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
unless annymous_users.nil? || annymous_users == ""
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
end
#@totle_score = score_for_homework @homework
#@teaher_score = teacher_score_for_homework @homework
#is_student = is_cur_course_student @homework.bid.courses.first
@is_teacher = is_course_teacher User.current,@homework.bid.courses.first
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
#@is_comprehensive_evaluation 1教师评论2学生匿评3学生留言
if User.current.member_of_course?(@homework.bid.courses.first)
if @is_teacher
@is_comprehensive_evaluation = 1 #教师评论
else
if @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
else #是学生未开启匿评或者已经进行评分
@is_comprehensive_evaluation = 3 #留言
end
end
else
@is_comprehensive_evaluation = 3
end
respond_to do |format|
format.html
@ -418,27 +381,40 @@ class HomeworkAttachController < ApplicationController
#删除留言
def destroy_jour
@homework = HomeworkAttach.find(params[:jour_id])
@course=@homework.bid.courses.first
@homework = HomeworkAttach.find(params[:homework_id])
@journal_destroyed = JournalsForMessage.find(params[:object_id])
@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation
@journal_destroyed.destroy
if @is_comprehensive_evaluation == 3
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,5
elsif @is_comprehensive_evaluation == 2
annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
unless annymous_users.nil? || annymous_users.count == ""
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
end
elsif @is_comprehensive_evaluation == 1
teachers = searchTeacherAndAssistant @course
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
if @journal_destroyed.is_comprehensive_evaluation == 3 && @journal_destroyed.destroy
render_403 unless User.current == @journal_destroyed.user || User.current.admin?
teachers = find_course_teachers(@homework.bid.courses.first)
@stars_reates = @homework.rates(:quality)
@teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
@jour = paginateHelper jours,5 #留言
else
render_404
end
#@course=@homework.bid.courses.first
#@journal_destroyed = JournalsForMessage.find(params[:object_id])
#@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation
#@journal_destroyed.destroy
#if @is_comprehensive_evaluation == 3
# @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
# @jour = paginateHelper @jours,5
#elsif @is_comprehensive_evaluation == 2
# annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
# unless annymous_users.nil? || annymous_users.count == ""
# @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
# end
#elsif @is_comprehensive_evaluation == 1
# teachers = searchTeacherAndAssistant @course
# @comprehensive_evaluation = []
# teachers.each do|teacher|
# temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
# @comprehensive_evaluation << temp if temp
# end
#end
respond_to do |format|
format.js
end
@ -446,79 +422,49 @@ class HomeworkAttachController < ApplicationController
#添加留言
def addjours
@homework = HomeworkAttach.find(params[:jour_id])
@is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value]
@cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5
@homework = HomeworkAttach.find(params[:homework_id])
#保存评分
@homework.rate(params[:stars_value],User.current.id,:quality) if params[:stars_value] && params[:stars_value] != "0"
@homework.rate(@m_score,User.current.id,:quality) if @m_score && @m_score != "0"
#保存评论
@cur_is_comprehensive_evaluation = params[:is_comprehensive_evaluation]
if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言
@homework.addjours User.current.id, params[:new_form][:user_message],0,@cur_is_comprehensive_evaluation
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言
@homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
end
@cur_page = params[:cur_page] || 1
@cur_type = params[:cur_type] || 5
teachers = searchTeacherAndAssistant @homework.bid.courses.first
if @cur_is_comprehensive_evaluation == "3"
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
@jour = paginateHelper @jours,5
elsif @cur_is_comprehensive_evaluation == "2"
annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
unless annymous_users.nil? || annymous_users == ""
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
end
@m_score = params[:stars_value].to_i
elsif @cur_is_comprehensive_evaluation == "1"
@comprehensive_evaluation = []
teachers.each do|teacher|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
@comprehensive_evaluation << temp if temp
end
end
teachers = find_course_teachers(@homework.bid.courses.first)
@stars_reates = @homework.rates(:quality)
@teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
@jour = paginateHelper jours,5 #留言
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
@is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
#@is_comprehensive_evaluation 1教师评论2学生匿评3学生留言
if User.current.member_of_course?(@homework.bid.courses.first)
if is_teacher
@is_comprehensive_evaluation = 1 #教师评论
else
if @is_anonymous_comments && !@has_evaluation #是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
else #是学生未开启匿评或者已经进行评分
@is_comprehensive_evaluation = 3 #留言
end
end
else
@is_comprehensive_evaluation = 3
end
#teachers = find_course_teachers @homework.bid.courses.first
teachers_str = teachers.map{|teacher| teacher.user_id}.join(",")
if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面
@bid = @homework.bid
get_not_batch_homework_list "s_socre","desc",teachers_str,@homework.bid_id
get_not_batch_homework_list "s_socre","desc",teachers,@homework.bid_id
elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers_str}) and stars IS NOT NULL) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers_str})) AS s_score
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers}) and stars IS NOT NULL) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in (#{teachers_str})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in (#{teachers_str})) AS s_score
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id not in (#{teachers})) AS s_score
FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "4" #匿评作业列表
@is_student_batch_homework = true
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers_str})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers_str})) AS s_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN (#{teachers})) AS t_score,
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN (#{teachers})) AS s_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score
FROM homework_attaches
WHERE homework_attaches.id = #{@homework.id}").first
else #其他的不用管
end
respond_to do |format|
format.js
end
@ -622,5 +568,10 @@ class HomeworkAttachController < ApplicationController
WHERE table1.t_score IS NULL")
@homework_list = paginateHelper all_homework_list,10
end
#获取指定作业的所有成员
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
end

View File

@ -1,5 +1,6 @@
# encoding: utf-8
module FilesHelper
include AttachmentsHelper
def downloadAll containers
paths = []
@ -54,11 +55,11 @@ module FilesHelper
s.html_safe
end
#判断用户是否拥有除current_course以外的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
def has_course? user,current_course
#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
def has_course? user,file
result = false
user.courses.each do |course|
if current_course.id != course.id && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
if !course_contains_attachment?(course,file) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
return true
end
end

View File

@ -91,6 +91,11 @@ module HomeworkAttachHelper
@m_score = temp.nil? ? 0:temp.stars.to_i
end
#获取评分对应的评论
def get_homework_review homework,is_teacher,user
homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
end
def convert_array array
ary = "("
if array.nil? || array.count == 0

View File

@ -20,7 +20,7 @@
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<% if is_course_teacher(User.current,@course) && file.author_id == User.current.id %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,@course) %>
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>">
@ -30,7 +30,7 @@
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %>
<% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,@course) %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_course?(User.current,file) %>
<% end %>
<% else %>
<% end %>

View File

@ -1,35 +1,4 @@
<style>
input[type="submit"].bid_btn {
vertical-align: middle;
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
/*margin-right: -4px;*/
}
input[type="button"].bid_btn {
width: 60px;/*modified by ming*/
height: 25px;
line-height: 19px;
font-size: 14px;
color: rgb(0, 0, 0);
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
padding: 0px 0px 4px 0px;
border-radius: 2px;
border: 1px solid rgb(148, 148, 148);
box-shadow: none;
text-shadow: none;
margin-top: -10px;
margin-right: -2px;
}
textarea:focus {
border: #d5dee9 1px solid;
}
@ -61,16 +30,15 @@
<%= form_for('new_form', :remote => true, :method => :post,
:url => {:controller => 'homework_attach',
:action => 'addjours',
:jour_id => homework_attach.id,
:is_comprehensive_evaluation => is_comprehensive_evaluation,
:homework_id => homework_attach.id,
:cur_page => cur_page,
:cur_type => cur_type,
:sta => sta}) do |f|%>
:is_anonymous_comments => @is_anonymous_comments,
:is_teacher => @is_teacher
}) do |f|%>
<!-- 打分 -->
<div class="ping_star" id="star_score">
<% if @is_comprehensive_evaluation == 3 || User.current == homework_attach.user%>
<!-- 如果是留言,或者是作业创建者进入,不显示打星 -->
<% else @is_comprehensive_evaluation == 2 %>
<% if @is_anonymous_comments || @is_teacher %>
<!-- 学生匿评或者教师评价 -->
<%= l(:label_work_rating) %>
<%= render :partial => 'show_star',:locals => {start_score:m_score} %>
@ -79,19 +47,14 @@
<div class="cl"></div>
<!-- 打分js结束 -->
<div id = 'pre_show'>
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
</div>
<% if User.current.logged? %>
<%= f.text_area 'user_message', :rows => 3, :cols => 65,
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250),
:maxlength => 250
%>
:maxlength => 250 %>
<%= f.text_field :reference_user_id, :style=>"display:none"%>
<div style="float:right">
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1(<%= is_teacher%>);">
<%= l(:label_submit_comments) %>
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1(<%= @is_teacher%>);">
<%= l(:label_confirmation) %>
</a>
</div>
<% else %>

View File

@ -1,24 +1,45 @@
<div class="ping_list">
<div id="ping_tb_" class="ping_tb_">
<ul>
<li id="ping_tb_4" class="ping_normaltab" onclick="i:HoverLi(4);">
<%= l(:label_teacher_comments) %><span class="c_red" id="jour_count_4"><%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %></span></li>
<li id="ping_tb_5" class="ping_normaltab" onclick="i:HoverLi(5);">
<%= l(:label_anonymous_comments) %><span class="c_red" id="jour_count_5" ><%= @anonymous_comments.nil? ? 0 : @anonymous_comments.count %></span></li>
<li id="ping_tb_3" class="ping_hovertab" onclick="x:HoverLi(3);">
<%= l(:label_responses) %><span class="c_red" id="jour_count_3"><%= @jours.nil? ? 0 : @jours.count %></span></li>
<li id="ping_tb_4" class="ping_normaltab" onclick="HoverLi(4);">
<%= l(:label_teacher_comments) %>
<span class="c_red" id="jour_count_4">
<%= @teacher_stars.count %>
</span>
</li>
<li id="ping_tb_5" class="ping_normaltab" onclick="HoverLi(5);">
<%= l(:label_anonymous_comments) %>
<span class="c_red" id="jour_count_5" >
<%= @student_stars.count %>
</span>
</li>
<li id="ping_tb_3" class="ping_hovertab" onclick="HoverLi(3);">
<%= l(:label_responses) %>
<span class="c_red" id="jour_count_3">
<%= @obj_count %>
</span>
</li>
</ul>
</div>
<div class="cl"></div>
<div class="ping_ctt">
<div class="ping_dis" id="tbc_03">
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true} %>
<!-- 留言列表 -->
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count, :homework => @homework} %>
</div>
<div class="ping_undis" id="tbc_04">
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false} %>
<!-- 老师评价列表 -->
<%= render :partial => 'homework_attach/review',:locals => {:review_list => @teacher_stars,:show_name => true,:show_jour => true} %>
</div>
<div class="ping_undis" id="tbc_05">
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false} %>
<!-- 学生匿评列表 -->
<%= render :partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false} %>
</div>
</div>
</div><!---ping_list end--->

View File

@ -1,65 +1,50 @@
<% jours.nil? || jours.count == 0 || jours.each do |jour| %>
<div class="ping_C">
<div class="ping_dispic">
<% if show_name %>
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
<% else %>
<a><%= image_tag(url_to_avatar(nil))%></a>
<% end %>
</div>
<div class="ping_discon">
<div class="ping_distop">
<span>
<% if show_name %>
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
<% else%>
<span style=" font-weight:bold; color:#15bccf; margin-right:5px; background:none;"><%= l(:label_anonymous) %></span>
<% end %>
</span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;"><%= format_time(jour.created_on) %></span>
<span style="font-weight:bold; color:#a6a6a6; float: right;">
<% if show_score %>
<span style="float:left">
<%= l(:label_work_rating) %>
</span>
<div class="ping_star">
<% star = get_homework_score(jour.user,@homework)%>
<%= render :partial => 'homework_attach/show_static_star', :locals => {:start_score => star } %>
<% unless jours.nil?%>
<% jours.each do |jour| %>
<div class="ping_C">
<div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %>
</div>
<% end %>
</span>
<div class="cl"></div>
<p><%= textilizable jour.notes%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<span>
<% if (jour.user==User.current|| User.current.admin?) && show_name && !show_score %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user,:jour_id =>@homework.id },
<div class="ping_discon">
<div class="ping_distop">
<span>
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
</span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;">
<%= format_time(jour.created_on) %>
</span>
<div class="cl"></div>
<p><%= textilizable jour.notes%></p>
</div>
<div class="ping_disfoot">
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<span>
<% if jour.user==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour',
:object_id => jour,
:user_id => jour.user,
:homework_id =>homework.id },
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} ##{l(:label_reply_plural)} #{jour.user.name}:
%>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"}
%>
</span>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name} %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end %>
<% if is_jour%>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> true} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> true} %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end %>
<div class="dis">
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true%></ul>
<ul class="wlist">
<%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => true, :flag => true%>
</ul>
</div>
<% end %>

View File

@ -0,0 +1,61 @@
<!-- 评论列表,包括老师评论和学生匿评 -->
<% unless review_list.nil?%>
<% review_list.each do |review|%>
<% user = review.rater %>
<% jour = get_homework_review @homework,show_jour,user %>
<div class="ping_C">
<div class="ping_dispic">
<% if show_name %>
<%= link_to image_tag(url_to_avatar(user)) , user_path(user), :target =>"_blank" %>
<% else %>
<a><%= image_tag(url_to_avatar(nil))%></a>
<% end %>
</div>
<div class="ping_discon">
<div class="ping_distop">
<span>
<% if show_name %>
<%= link_to user, user_path(user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
<% else%>
<span style=" font-weight:bold; color:#15bccf; margin-right:5px; background:none;">
<%= l(:label_anonymous) %>
</span>
<% end %>
</span>
<span style="color:#a6a6a6; margin-right:30px; margin-left:10px;">
<%= format_time(review.created_at) %>
</span>
<span style="font-weight:bold; color:#a6a6a6; float: right;">
<span style="float:left">
<%= l(:label_work_rating) %>
</span>
<div class="ping_star">
<%= render :partial => 'homework_attach/show_static_star', :locals => {:start_score => review.stars } %>
</div>
</span>
<div class="cl"></div>
<p><%= textilizable jour.nil? ? "" : jour.notes%></p>
</div>
<% unless jour.nil? %>
<% ids = 'project_respond_form_'+ jour.id.to_s%>
<div class="ping_disfoot">
<span>
<%= link_to l(:label_projects_feedback_respond),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"}
%>
</span>
</div>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
</div>
<div style="clear: both;"></div>
<div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name} %>
</div>
<% end %>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% end %>
<% end %>

View File

@ -18,7 +18,7 @@
<ul>
<li><%= l(:label_create_person) %>
<span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<% if @is_anonymous_comments %>
<%= l(:label_anonymous) %>
<% else %>
<%= link_to @homework.user, user_path(@homework.user)%>
@ -37,7 +37,7 @@
<% if @homework.users.count > 0 %>
<div>
<%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<% if @is_anonymous_comments %>
<%= l(:label_anonymous) %>
<%else%>
<% @homework.users.each do |homework_user| %>
@ -77,8 +77,7 @@
</span>
</p>
<div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0,
:is_comprehensive_evaluation => @is_comprehensive_evaluation,
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework,
:m_score => @m_score,
:cur_page => @cur_page,
:cur_type => @cur_type,
@ -88,6 +87,5 @@
</div><!---ping_con end--->
<%= render :partial => 'histoey_new' %>
</div>
</div>

View File

@ -1,35 +1,31 @@
//教师评论
<% if @cur_is_comprehensive_evaluation == "1" %>
<% if @is_teacher %>
HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>');
$('#jour_count_4').html('<%= @teacher_stars.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @teacher_stars,:show_name => true,:show_jour => true})) %>');
//匿评
<% elsif @cur_is_comprehensive_evaluation == "2" %>
$('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0,
:is_comprehensive_evaluation => @is_comprehensive_evaluation,
:cur_type => @cur_type, :cur_page => @cur_page, :m_score => @m_score, :is_teacher => false})) %>');
<% elsif @is_anonymous_comments %>
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>');
$('#jour_count_5').html('<%= @student_stars.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false})) %>');
//留言
<% else %>
HoverLi(3);
$('#jour_count_3').html('<%= @jours.count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>');
$('#jour_count_3').html('<%= @obj_count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count,:homework => @homework})) %>');
<% end %>
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");
<% if @cur_is_comprehensive_evaluation == "1" || @cur_is_comprehensive_evaluation == "2" %>
<% if @is_anonymous_comments || @is_teacher %>
<% if @cur_type == "1" %>
$("#tbc_01").html('<%= escape_javascript(render(:partial => 'homework_attach/homeworks_list',:locals => {:homeworks => @homework_list,
:homework_count => @obj_count,
:remote => false,:is_student_batch_homework => false})) %>');
<% elsif @cur_type == "2" || @cur_type == "3" || @cur_type == "4" %>
<% is_teacher = is_course_teacher(User.current,@homework.bid.courses.first) %>
$("#homework_li_<%= @homework.id%>").html('<%= escape_javascript(render(:partial => 'homework_attach/homework',:locals => {:homework => @result_homework || @homework,
:is_student_batch_homework => @is_student_batch_homework || false,
:is_my_homework => false, :is_teacher => is_teacher})) %>');
:is_my_homework => false, :is_teacher => @is_teacher})) %>');
<% end %>
<% end %>

View File

@ -1,19 +1,8 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% else %>
<% if @is_comprehensive_evaluation == 1 %>
HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>');
//匿评
<% elsif @is_comprehensive_evaluation == 2 %>
HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>');
//留言
<% else %>
HoverLi(3);
$('#jour_count_3').html('<%= @jours.count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>');
<% end %>
//只有留言才能被删除
HoverLi(3);
$('#jour_count_3').html('<%= @obj_count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => "homework_attach/jour",:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count, :homework => @homework})) %>');
<% end %>

View File

@ -4,6 +4,7 @@ $('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_homework_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("alert_box");