From c6470bc69b2b9abbb39b32bd4239fd7d24ad506c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 15:31:15 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=88=86=E7=BB=84=E6=88=90=E5=91=98=E6=97=B6?= =?UTF-8?q?=E8=8B=A5=E6=9F=90=E4=B8=80=E4=B8=AA=E5=AD=A6=E7=94=9F=E5=B7=B2?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=B0=E5=85=B6=E4=BB=96=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E5=8F=AF=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + app/views/student_work/search_course_students.js.erb | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f79646ade..86e521b55 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -687,6 +687,7 @@ class StudentWorkController < ApplicationController end all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" all_students = User.where("id in #{all_student_ids}") + @commit_student_ids = @homework.student_work_projects.map{|student| student.user_id} @users = searchstudent_by_name all_students,name respond_to do |format| format.js diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index fb595e51f..1cea9f27e 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -18,7 +18,7 @@ $("#all_students_list").empty(); } } } - <% if user.id.to_i != User.current.id.to_i %> + <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").one("click",function choose_student() { var li = "
  • + if (str.indexOf(<%=user.id.to_s %>) < 0) { + $("#student_<%=user.id %>").attr("title","该学生已加入其它分组"); + } <% end %> <% end %> \ No newline at end of file From d4bde8e73c6b4bdec0a4b5ff199190b8d38fb33a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 16:05:18 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_evaluation_un_title.html.erb | 2 +- app/views/student_work/_evaluation_work.html.erb | 4 ++-- public/stylesheets/courses.css | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index 9988bd6e0..66b96431e 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,6 +1,6 @@
    • - 作品名称 + 作品名称 <% if @homework.homework_type != 3 %> 姓名 学号 diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 58f611b55..db680cbec 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -12,7 +12,7 @@
    • <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
    • -
    • +
    • <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
      <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> @@ -40,7 +40,7 @@
    • <%= image_tag(url_to_avatar(""),width:"40", height: "40") %>
    • -
    • +
    • <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
      diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index f13e6ef84..484d99344 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -83,6 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .width180{width: 180px;} .width525{width: 525px;} .width285{width: 285px;} +.width255{width: 255px;} .width530{width: 530px;} .mr95{margin-right: 95px;} .mr140 {margin-right: 140px;} From ac77f0d40ad86f56eb397802cab06b282d271e23 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 16:35:43 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=AD=A6=E5=8F=B7?= =?UTF-8?q?=E3=80=81=E7=8F=AD=E7=BA=A7=E4=B9=9F=E8=A6=81=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=AD=94=E9=A2=98=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_student_exercise.html.erb | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 4e27d57cb..3983fb0c4 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -33,6 +33,19 @@ }).mouseleave(function(){ $("#work_click_<%= exercise.id%>").hide(); }); + $(function(){ + <% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> + $("#show_student_result_div").on('click',show_result); + <% else %> + $("#show_student_result_div").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#student_name_id").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#student_id_id").attr("title","截止日期未到,暂不能查看学生答题结果"); + $("#student_class_id").attr("title","截止日期未到,暂不能查看学生答题结果"); + <% end %> + }); + function show_result() { + window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>'; + }
      • @@ -40,22 +53,24 @@
      • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
      • -
        + <%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> +
        • -
        • - <% name = exercise.user.show_name %> - <% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - <%= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> - <% else %> - <%=name%> +
        • + <%=exercise.user.show_name %> + <%# name = exercise.user.show_name %> + <%# if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> + <%#= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> + <%# else %> + <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> - <% end %> + <%# end %>
        • -
        • +
        • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
        • -
        • +
        • --
        @@ -63,7 +78,7 @@
    • -
    • +
    • <% if exercise.created_at%> <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>  <% end %> From 6c9a1394500c16c73d84cd43fc3a22d6b6722e43 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 16:36:19 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E4=BD=9C=E5=93=81=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 86e521b55..355743dd7 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -299,7 +299,6 @@ class StudentWorkController < ApplicationController @submit_result = true @work.name = params[:student_work][:name] @work.description = params[:student_work][:description] - @work.project_id = params[:student_work][:project] @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save From e5192c7b1a1e8f1539b47474468e9e2c5e04e970 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 17:02:34 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E7=9A=84=E6=8F=90=E4=BA=A4=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 +++++ app/models/course_message.rb | 4 ++-- app/views/exercise/_student_exercise.html.erb | 8 -------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 355743dd7..1fe798328 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js @@ -302,6 +305,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save =begin respond_to do |format| format.html { diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 11b0165c5..79d27f3c5 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,5 +1,5 @@ class CourseMessage < ActiveRecord::Base - # status说明: status在课程不同的类型,区分不同的功能 + # status说明: status在课程不同的类型,区分不同的功能 status = 9 作品的提交记录 # HomeworkCommon:status: # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败 attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status @@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base def add_user_message #unless self.course_message_type == 'JoinCourseRequest' - if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9 self.message_alls << MessageAll.new(:user_id => self.user_id) end #end diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 3983fb0c4..9c9916e60 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -53,19 +53,11 @@
    • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
    • - <%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
      • <%=exercise.user.show_name %> - <%# name = exercise.user.show_name %> - <%# if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - <%#= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> - <%# else %> - - <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> - <%# end %>
      • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> From 1674391e4be1bce98f87cbe69878daaf78224dbe Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 17:39:34 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E8=8B=A5=E5=88=A0=E9=99=A4=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E7=9A=84=E9=99=84=E4=BB=B6=EF=BC=8C=E5=88=99=E2=80=9C?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E9=99=84=E4=BB=B6=E2=80=9D=E5=AD=97=E6=A0=B7?= =?UTF-8?q?=E5=8F=8A=E2=80=9C=E8=BF=BD=E5=8A=A0=E6=97=B6=E9=97=B4=E2=80=9D?= =?UTF-8?q?=E4=B9=9F=E5=BA=94=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/destroy.js.erb | 5 ++--- app/views/student_work/_revise_attachment.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index cfbe68085..02a613e6e 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -1,8 +1,7 @@ <% if @is_destroy%> $("#attachment_<%= @attachment.id%>").remove(); - if(document.getElementById("uploadReviseBox")) { - $("#uploadReviseBox").removeClass('disable_link'); - $("#choose_revise_attach").attr("onclick","_file.click();"); + if(document.getElementById("revise_attachment_div_<%= @attachment.id%>")) { + $("#revise_attachment_div_<%= @attachment.id%>").remove(); } <%else%> var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>'); diff --git a/app/views/student_work/_revise_attachment.html.erb b/app/views/student_work/_revise_attachment.html.erb index 968a4853b..4d85b1813 100644 --- a/app/views/student_work/_revise_attachment.html.erb +++ b/app/views/student_work/_revise_attachment.html.erb @@ -4,7 +4,7 @@
        追加修订附件
        -
        +
        追加附件: <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>) @@ -15,7 +15,7 @@ 追加修订附件
        <% if revise_attachment %> -
        +
        追加附件: <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> 追加时间:<%=format_time revise_attachment.created_on.to_s %> From 1d2b6165ef0080bb3c64a29a0eaa14e143995285 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 18:00:55 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_attachment.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 7aefbd0b0..bba7627b1 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -55,7 +55,7 @@ <% end %>
        - <% if @homework %> + <% if @homework && @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> <% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %> <% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %> 关联项目:<%=project.name %> From 42f0fc62e993d065f0d0955843a10f4b15d10954 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 18:07:30 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=88=86=E7=BB=84=E6=88=90=E5=91=98?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E4=BF=AE=E6=94=B9=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8f4679c67..0d2f53820 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2455,7 +2455,7 @@ module ApplicationHelper link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' - elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' else link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"