diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 917040170..61a06ece6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -366,16 +366,35 @@ class HomeworkAttachController < ApplicationController #是否开启互评功能 @is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil @limit = 10 - @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation is null").order("created_on DESC") + #@jours留言 is null条件用以兼容历史数据 + @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @feedback_count = @jours.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @offset ||= @feedback_pages.offset @jour = @jours[@offset, @limit] - @comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation is not null").order("created_on DESC") + #@comprehensive_evaluation教师评论 + @comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC") + #@anonymous_comments 匿评 + @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC") @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 = true #是否开启了匿评 + if !User.current.member_of_course?(@homework.bid.courses.first) + @is_comprehensive_evaluation = 3 #留言 + elsif is_student && is_anonymous_comments #是学生且开启了匿评 + @is_comprehensive_evaluation = 2 #匿评 + elsif is_student && !is_anonymous_comments #是学生未开启匿评 + @is_comprehensive_evaluation = 3 #留言 + elsif is_teacher + @is_comprehensive_evaluation = 1 #教师评论 + else + @is_comprehensive_evaluation = 3 + end + respond_to do |format| format.html format.js diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 20e0c15f4..4819cd253 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -14,6 +14,7 @@ class JournalsForMessage < ActiveRecord::Base "is_readed", # 留言是否已读 "m_reply_count", # 留言的回复数量 "m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id) + "is_comprehensive_evaluation" # 1 教师评论、2 匿评、3 留言 acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC" belongs_to :project, diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index 51853cd23..28b1cc0e8 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -3,7 +3,7 @@ function g(o){return document.getElementById(o);} function HoverLi(n){ //如果有N个标签,就将i<=N; - for(var i=3;i<=4;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab'; + for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab'; } //如果要做成点击后再转到请将
  • 中的onmouseover 改成 onclick; //]]> @@ -62,10 +62,12 @@
      -
    • - 全部评论(30
    • - 教师评论(30
    • + <%= l(:label_teacher_comments) %>(30) +
    • + <%= l(:label_anonymous_comments) %>(30
    • +
    • + <%= l(:label_responses) %>(30
    @@ -153,9 +155,40 @@
    +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,多了,或者

    +
    + + + +
    +
    +
    +
    +
    +
    +
    + gugu012014-10-24评分: +
    +

    我写了一个验证身份证号码的程序,它是以一定内存空间(大概100M)换取cpu消耗,然后它的运算量就降低了,多了,或者

    +
    + + + +
    +
    +
    +
    - + + \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 8a07284ba..a8d85efed 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1847,4 +1847,6 @@ en: label_max_length: A maximum of 250 characters label_create_person: Create personnel label_participation_person: The participation of personnel - label_homework_without_description: The homework without any description! \ No newline at end of file + label_homework_without_description: The homework without any description! + label_teacher_comments: Teacher comments + label_anonymous_comments: Anonymous comments \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3df099ef5..3b7c8e7db 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2179,3 +2179,5 @@ zh: label_create_person: 创建人员 label_participation_person: 参与人员 label_homework_without_description: 该作业无任何描述! + label_teacher_comments: 教师评论 + label_anonymous_comments: 匿评 \ No newline at end of file