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
end end
#获取指定作业的所有成员
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
#获取可选成员列表 #获取可选成员列表
#homework作业 #homework作业
#users该作业所有成员 #users该作业所有成员
@ -359,53 +354,21 @@ class HomeworkAttachController < ApplicationController
#显示作业信息 #显示作业信息
def show def show
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) if User.current.admin? || User.current.member_of_course?(@course)
# 打分统计 # 作业打分列表
#stars_reates = @homework. rates(:quality) @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 @has_evaluation = @stars_reates.where("rater_id = #{User.current.id}").first
@m_score = temp.nil? ? 0:temp.stars @m_score = @has_evaluation.nil? ? 0 : @has_evaluation.stars
@has_evaluation = @homework.has_rated?( User.current,:quality) teachers = find_course_teachers(@course)
#@jours留言 is null条件用以兼容历史数据 @teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @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_page = params[:cur_page] || 1
@cur_type = params[:cur_type] || 5 @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| respond_to do |format|
format.html format.html
@ -418,27 +381,40 @@ class HomeworkAttachController < ApplicationController
#删除留言 #删除留言
def destroy_jour def destroy_jour
@homework = HomeworkAttach.find(params[:jour_id]) @homework = HomeworkAttach.find(params[:homework_id])
@course=@homework.bid.courses.first
@journal_destroyed = JournalsForMessage.find(params[:object_id]) @journal_destroyed = JournalsForMessage.find(params[:object_id])
@is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation if @journal_destroyed.is_comprehensive_evaluation == 3 && @journal_destroyed.destroy
@journal_destroyed.destroy render_403 unless User.current == @journal_destroyed.user || User.current.admin?
if @is_comprehensive_evaluation == 3 teachers = find_course_teachers(@homework.bid.courses.first)
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @stars_reates = @homework.rates(:quality)
@jour = paginateHelper @jours,5 @teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
elsif @is_comprehensive_evaluation == 2 @student_stars = @stars_reates.where("rater_id not in (#{teachers})") #学生评分列表
annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',') jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")#jours留言 is null条件用以兼容历史数据
unless annymous_users.nil? || annymous_users.count == "" @jour = paginateHelper jours,5 #留言
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC") else
end render_404
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 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| respond_to do |format|
format.js format.js
end end
@ -446,79 +422,49 @@ class HomeworkAttachController < ApplicationController
#添加留言 #添加留言
def addjours 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] @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] != "" #有没有留言 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 @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
end end
@cur_page = params[:cur_page] || 1 teachers = find_course_teachers(@homework.bid.courses.first)
@cur_type = params[:cur_type] || 5 @stars_reates = @homework.rates(:quality)
teachers = searchTeacherAndAssistant @homework.bid.courses.first @teacher_stars = @stars_reates.where("rater_id in (#{teachers})") #老师评分列表
if @cur_is_comprehensive_evaluation == "3" @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 = @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 @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
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" #如果当前是老师未批列表,需要刷新整个作业列表界面 if @cur_type == "1" #如果当前是老师未批列表,需要刷新整个作业列表界面
@bid = @homework.bid @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" #老师已批列表 elsif @cur_type == "2" #老师已批列表
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, @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 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_str})) AS s_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 FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "3" #全部作业列表 elsif @cur_type == "3" #全部作业列表
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, @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 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_str})) AS s_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 FROM homework_attaches WHERE id = #{@homework.id}").first
elsif @cur_type == "4" #匿评作业列表 elsif @cur_type == "4" #匿评作业列表
@is_student_batch_homework = true @is_student_batch_homework = true
@result_homework = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, @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 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_str})) AS s_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 (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 FROM homework_attaches
WHERE homework_attaches.id = #{@homework.id}").first WHERE homework_attaches.id = #{@homework.id}").first
else #其他的不用管 else #其他的不用管
end end
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -622,5 +568,10 @@ class HomeworkAttachController < ApplicationController
WHERE table1.t_score IS NULL") WHERE table1.t_score IS NULL")
@homework_list = paginateHelper all_homework_list,10 @homework_list = paginateHelper all_homework_list,10
end end
#获取指定作业的所有成员
def users_for_homework homework
homework.nil? ? [] : (homework.users + [homework.user])
end
end end

View File

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

View File

@ -91,6 +91,11 @@ module HomeworkAttachHelper
@m_score = temp.nil? ? 0:temp.stars.to_i @m_score = temp.nil? ? 0:temp.stars.to_i
end 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 def convert_array array
ary = "(" ary = "("
if array.nil? || array.count == 0 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" %> <%= 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 User.current.logged? %>
<% if is_course_teacher(User.current,@course) && file.author_id == User.current.id %> <% 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" %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>"> <span id="is_public_<%= file.id %>">
@ -30,7 +30,7 @@
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> --> <!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %> <% end %>
<% else %> <% 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 %> <% end %>
<% else %> <% else %>
<% end %> <% end %>

View File

@ -1,35 +1,4 @@
<style> <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 { textarea:focus {
border: #d5dee9 1px solid; border: #d5dee9 1px solid;
} }
@ -61,16 +30,15 @@
<%= form_for('new_form', :remote => true, :method => :post, <%= form_for('new_form', :remote => true, :method => :post,
:url => {:controller => 'homework_attach', :url => {:controller => 'homework_attach',
:action => 'addjours', :action => 'addjours',
:jour_id => homework_attach.id, :homework_id => homework_attach.id,
:is_comprehensive_evaluation => is_comprehensive_evaluation,
:cur_page => cur_page, :cur_page => cur_page,
:cur_type => cur_type, :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"> <div class="ping_star" id="star_score">
<% if @is_comprehensive_evaluation == 3 || User.current == homework_attach.user%> <% if @is_anonymous_comments || @is_teacher %>
<!-- 如果是留言,或者是作业创建者进入,不显示打星 -->
<% else @is_comprehensive_evaluation == 2 %>
<!-- 学生匿评或者教师评价 --> <!-- 学生匿评或者教师评价 -->
<%= l(:label_work_rating) %> <%= l(:label_work_rating) %>
<%= render :partial => 'show_star',:locals => {start_score:m_score} %> <%= render :partial => 'show_star',:locals => {start_score:m_score} %>
@ -79,19 +47,14 @@
<div class="cl"></div> <div class="cl"></div>
<!-- 打分js结束 --> <!-- 打分js结束 -->
<div id = 'pre_show'>
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
</div>
<% if User.current.logged? %> <% if User.current.logged? %>
<%= f.text_area 'user_message', :rows => 3, :cols => 65, <%= f.text_area 'user_message', :rows => 3, :cols => 65,
:style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250), :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"%> <%= f.text_field :reference_user_id, :style=>"display:none"%>
<div style="float:right"> <div style="float:right">
<a href="#" class="ping_sub1" id="jours_submit" onclick="submit1(<%= is_teacher%>);"> <a href="#" class="ping_sub1" id="jours_submit" onclick="submit1(<%= @is_teacher%>);">
<%= l(:label_submit_comments) %> <%= l(:label_confirmation) %>
</a> </a>
</div> </div>
<% else %> <% else %>

View File

@ -1,24 +1,45 @@
<div class="ping_list"> <div class="ping_list">
<div id="ping_tb_" class="ping_tb_"> <div id="ping_tb_" class="ping_tb_">
<ul> <ul>
<li id="ping_tb_4" class="ping_normaltab" onclick="i:HoverLi(4);"> <li id="ping_tb_4" class="ping_normaltab" onclick="HoverLi(4);">
<%= l(:label_teacher_comments) %><span class="c_red" id="jour_count_4"><%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %></span></li> <%= l(:label_teacher_comments) %>
<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> <span class="c_red" id="jour_count_4">
<li id="ping_tb_3" class="ping_hovertab" onclick="x:HoverLi(3);"> <%= @teacher_stars.count %>
<%= l(:label_responses) %><span class="c_red" id="jour_count_3"><%= @jours.nil? ? 0 : @jours.count %></span></li> </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> </ul>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="ping_ctt"> <div class="ping_ctt">
<div class="ping_dis" id="tbc_03"> <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>
<div class="ping_undis" id="tbc_04"> <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>
<div class="ping_undis" id="tbc_05"> <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> </div>
</div><!---ping_list end---> </div><!---ping_list end--->

View File

@ -1,65 +1,50 @@
<% jours.nil? || jours.count == 0 || jours.each do |jour| %> <% unless jours.nil?%>
<div class="ping_C"> <% jours.each do |jour| %>
<div class="ping_dispic"> <div class="ping_C">
<% if show_name %> <div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %> <%= 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 } %>
</div> </div>
<div class="ping_discon">
<% end %> <div class="ping_distop">
</span> <span>
<div class="cl"></div> <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%>
<p><%= textilizable jour.notes%></p> </span>
</div> <span style="color:#a6a6a6; margin-right:30px; margin-left:10px;">
<div class="ping_disfoot"> <%= format_time(jour.created_on) %>
<% ids = 'project_respond_form_'+ jour.id.to_s%> </span>
<span> <div class="cl"></div>
<% if (jour.user==User.current|| User.current.admin?) && show_name && !show_score %> <p><%= textilizable jour.notes%></p>
<%= 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>
<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)) %> :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %> <% end %>
<%= link_to l(:label_projects_feedback_respond),'', <%= 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}: {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"}
%> %>
</span> </span>
</div> </div>
<div id='<%= ids %>' class="respond-form"> <div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %> <%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> true} %>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<div> <div>
<%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name} %> <%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> true} %>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div>
</div> <div class="cl"></div>
<div class="cl"></div> <% end %>
<% end %>
<% if is_jour%>
<div class="dis"> <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> </div>
<% end %> <% 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> <ul>
<li><%= l(:label_create_person) %> <li><%= l(:label_create_person) %>
<span class="c_grey"> <span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %> <% if @is_anonymous_comments %>
<%= l(:label_anonymous) %> <%= l(:label_anonymous) %>
<% else %> <% else %>
<%= link_to @homework.user, user_path(@homework.user)%> <%= link_to @homework.user, user_path(@homework.user)%>
@ -37,7 +37,7 @@
<% if @homework.users.count > 0 %> <% if @homework.users.count > 0 %>
<div> <div>
<%= l(:label_participation_person) %> <%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %> <% if @is_anonymous_comments %>
<%= l(:label_anonymous) %> <%= l(:label_anonymous) %>
<%else%> <%else%>
<% @homework.users.each do |homework_user| %> <% @homework.users.each do |homework_user| %>
@ -77,8 +77,7 @@
</span> </span>
</p> </p>
<div id="add_jour"> <div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, <%= render :partial => 'addjour', :locals => {:homework_attach => @homework,
:is_comprehensive_evaluation => @is_comprehensive_evaluation,
:m_score => @m_score, :m_score => @m_score,
:cur_page => @cur_page, :cur_page => @cur_page,
:cur_type => @cur_type, :cur_type => @cur_type,
@ -88,6 +87,5 @@
</div><!---ping_con end---> </div><!---ping_con end--->
<%= render :partial => 'histoey_new' %> <%= render :partial => 'histoey_new' %>
</div> </div>
</div> </div>

View File

@ -1,35 +1,31 @@
//教师评论 //教师评论
<% if @cur_is_comprehensive_evaluation == "1" %> <% if @is_teacher %>
HoverLi(4); HoverLi(4);
$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>'); $('#jour_count_4').html('<%= @teacher_stars.count %>');
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>'); $('#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" %> <% elsif @is_anonymous_comments %>
$('#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})) %>');
HoverLi(5); HoverLi(5);
$('#jour_count_5').html('<%= @anonymous_comments.count %>'); $('#jour_count_5').html('<%= @student_stars.count %>');
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>'); $('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/review',:locals => {:review_list => @student_stars,:show_name => false || @is_teacher, :show_jour => false})) %>');
//留言 //留言
<% else %> <% else %>
HoverLi(3); HoverLi(3);
$('#jour_count_3').html('<%= @jours.count %>'); $('#jour_count_3').html('<%= @obj_count %>');
$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>'); $('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour, :obj_pages => @obj_pages, :obj_count => @obj_count,:homework => @homework})) %>');
<% end %> <% end %>
$('#new_form_user_message').val(""); $('#new_form_user_message').val("");
$('#new_form_reference_user_id').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" %> <% if @cur_type == "1" %>
$("#tbc_01").html('<%= escape_javascript(render(:partial => 'homework_attach/homeworks_list',:locals => {:homeworks => @homework_list, $("#tbc_01").html('<%= escape_javascript(render(:partial => 'homework_attach/homeworks_list',:locals => {:homeworks => @homework_list,
:homework_count => @obj_count, :homework_count => @obj_count,
:remote => false,:is_student_batch_homework => false})) %>'); :remote => false,:is_student_batch_homework => false})) %>');
<% elsif @cur_type == "2" || @cur_type == "3" || @cur_type == "4" %> <% 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, $("#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_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 %>
<% end %> <% end %>

View File

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

View File

@ -4,6 +4,7 @@ $('#ajax-modal').css('height','569px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#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>"); "<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().css("top","").css("left","");
$('#ajax-modal').parent().addClass("alert_box"); $('#ajax-modal').parent().addClass("alert_box");