diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index b5d55df28..4511e5a1f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -168,6 +168,8 @@ class HomeworkCommonController < ApplicationController redirect_to user_path(User.current.id) elsif @hw_status == 2 redirect_to course_path(@course.id) + elsif @hw_status == 5 + redirect_to student_work_index_url(:homework => @homework.id) else redirect_to homework_common_index_path(:course => @course.id) end @@ -244,6 +246,7 @@ class HomeworkCommonController < ApplicationController end @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i + @is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course) end #关闭匿评 @@ -262,6 +265,7 @@ class HomeworkCommonController < ApplicationController Mailer.send_mail_anonymous_comment_close(@homework).deliver @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i + @is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course) respond_to do |format| format.js end @@ -315,6 +319,7 @@ class HomeworkCommonController < ApplicationController end @user_activity_id = params[:user_activity_id] @hw_status = params[:hw_status].to_i + @is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher,@course) end def alert_open_student_works @@ -372,6 +377,7 @@ class HomeworkCommonController < ApplicationController @homework_detail_manual.save @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i + @is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher,@course) end end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b259737a1..a0d981b22 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -521,6 +521,7 @@ class StudentWorkController < ApplicationController # 消息传过来的ID @message_student_work_id = params[:student_work_id] @left_nav_type = 3 + @tab = params[:tab].to_i respond_to do |format| format.js format.html @@ -1076,6 +1077,7 @@ class StudentWorkController < ApplicationController if @project.save @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i + @is_teacher = User.current.allowed_to?(:as_teacher,@homework.course) || User.current.admin? respond_to do |format| format.js end @@ -1126,6 +1128,7 @@ class StudentWorkController < ApplicationController if relate_pro.destroy @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i + @is_teacher = User.current.allowed_to?(:as_teacher,@homework.course) || User.current.admin? respond_to do |format| format.js end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index f1bfc7a31..9c8954ed9 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -111,6 +111,7 @@ class WordsController < ApplicationController @user_activity_id = -1 end @hw_status = params[:hw_status].to_i + @is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? elsif @journal_destroyed.jour_type == 'Syllabus' @syllabus = Syllabus.find @journal_destroyed.jour_id @count = @syllabus.journals_for_messages.count @@ -309,7 +310,7 @@ class WordsController < ApplicationController format.js{ @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i - @homework_common_id = params[:homework_common_id] + @is_teacher = User.current.allowed_to?(:as_teacher, @homework_common.course) || User.current.admin? } end else @@ -343,6 +344,7 @@ class WordsController < ApplicationController format.js{ @user_activity_id = params[:user_activity_id].to_i @hw_status = params[:hw_status].to_i + @is_teacher = User.current.allowed_to?(:as_teacher, @homework_common.course) || User.current.admin? } end else diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d9a694eaa..8b5b594bd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2745,7 +2745,7 @@ module ApplicationHelper count = homework.student_works.has_committed.count if User.current.member_of_course?(homework.course) if is_teacher #老师显示作品数量 - link_to "作品(#{count})", student_work_index_url_in_org(homework.id), :class => "c_blue" + link_to "作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => "c_blue" else #学生显示提交作品、修改作品等按钮 work = cur_user_works_for_homework homework project = cur_user_projects_for_homework homework @@ -2763,20 +2763,20 @@ module ApplicationHelper end else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 - link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" + link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 - link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束" + link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :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 "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue' 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 "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue' else - link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" + link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品" end end end else - link_to "作品(#{count})",student_work_index_url_in_org(homework.id),:class => "c_blue" + link_to "作品(#{count})",student_work_index_url_in_org(homework.id, 2),:class => "c_blue" end end @@ -2799,15 +2799,15 @@ module ApplicationHelper end else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 - link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank' + link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "开启匿评后不可修改作品", :target => '_blank' elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 - link_to "查看作品",student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank' + link_to "查看作品",student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "匿评已结束", :target => '_blank' elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 link_to "修改作品", new_student_work_url_without_domain(homework.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank' 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 "修改作品", edit_student_work_url_without_domain(work.id),:class => 'hw_btn_green2 fr mt5', :target => '_blank' else - link_to "查看作品", student_work_index_url_in_org(homework.id), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank' + link_to "查看作品", student_work_index_url_in_org(homework.id, 2), :class => 'hw_btn_green2 fr mt5', :title => "作业截止后不可修改作品", :target => '_blank' end end end @@ -3136,13 +3136,13 @@ def homework_common_index_url_in_org(course_id) Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s end -def student_work_index_url_in_org(homework_id, is_focus = '', show_work_id = '') +def student_work_index_url_in_org(homework_id, tab = 1, is_focus = '', show_work_id = '') if is_focus != '' - Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&is_focus=" + is_focus.to_s + Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s + "&is_focus=" + is_focus.to_s elsif show_work_id != '' - Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&show_work_id=" + show_work_id.to_s + Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s + "&show_work_id=" + show_work_id.to_s else - Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s + "&tab=" + tab.to_s end end diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index 1cbe058a1..443a9f5f1 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -84,7 +84,7 @@
-
+
<% if @exercise.exercise_status == 1 %> diff --git a/app/views/homework_common/open_student_works.js.erb b/app/views/homework_common/open_student_works.js.erb index 2dd4a88a4..c65034689 100644 --- a/app/views/homework_common/open_student_works.js.erb +++ b/app/views/homework_common/open_student_works.js.erb @@ -1,4 +1,8 @@ +<% if @hw_status == 5 %> +$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); +<% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); +<% end %> <% if @user_activity_id != @homework.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb index 42bc842bc..e084967c7 100644 --- a/app/views/homework_common/set_evaluation_attr.js.erb +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -1,5 +1,9 @@ clickCanel(); +<% if @hw_status == 5 %> +$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); +<% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); +<% end %> <% if @user_activity_id != @homework.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index 94db99dd8..809ba5b05 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -1,6 +1,10 @@ <% if @statue == 1%> alert('启动成功'); + <% if @hw_status == 5 %> + $("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); + <% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); + <% end %> $("#evaluation_start_time_<%=@user_activity_id %>").html("匿评开启时间:<%=format_time(Time.now) %>"); <% if @user_activity_id != @homework.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index c540c323d..027f477a7 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,5 +1,9 @@ alert('关闭成功'); +<% if @hw_status == 5 %> +$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); +<% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); +<% end %> $("#evaluation_end_time_<%=@homework.id %>").html("匿评关闭时间:<%=format_time(Time.now) %>"); <% if @user_activity_id != @homework.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 510a743b1..ebbd5fa32 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -73,7 +73,7 @@ <% work = cur_user_works_for_homework activity %> <% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %>
- <%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> + <%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
<% end %> <% if activity.homework_type == 2 && is_teacher%> @@ -161,9 +161,9 @@
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %> - <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id, '', sw.id), :alt => "学生头像" %> + <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_url_in_org(activity.id, 2, '', sw.id), :alt => "学生头像" %> <% else %> <%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %> diff --git a/app/views/student_work/_homework_post_brief.html.erb b/app/views/student_work/_homework_post_brief.html.erb new file mode 100644 index 000000000..b575c8788 --- /dev/null +++ b/app/views/student_work/_homework_post_brief.html.erb @@ -0,0 +1,102 @@ +
+<%=link_to image_tag(url_to_avatar(homework.user),width:"50px", height: "50px"), user_activities_path(homework.user_id)%> +
+
+
+ <%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%> + TO + <%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %> + + <%= link_to homework.course.name, course_path(homework.course_id), :class => "newsBlue"%> +
+ +<%=get_hw_status(homework).html_safe %> +
+<% if homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1%> + 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! +<% elsif homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 0%> + 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! +<% end %> + +<% is_pro = homework.homework_type == 2 && is_teacher %> +<% is_base_group = homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1 && !is_teacher %> +
+ <%= render :partial => 'users/homework_opr', :locals => {:activity => homework, :is_teacher => is_teacher, :hw_status => 5, :user_activity_id => homework.id} %> + <% if is_pro || is_base_group %> +
+ <% end %> + <% if !homework.publish_time.nil? %> +
+ <%= l(:label_publish_time)%>:<%= homework.publish_time%> 00:00 +
+ <% end %> + <% if homework.homework_detail_manual && homework.homework_detail_manual.comment_status < 2 %> +
提交截止时间:<%= homework.end_time.to_s %> 23:59
+ <% elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status >= 2 && homework.anonymous_comment == 0%> +
匿评截止时间:<%= homework.homework_detail_manual.evaluation_end.to_s %> 23:59
+ <% end %> +
+
+
+
+
+
+ <%= homework.description %> +
+
+ <% if is_pro %> +
测试集:<%=homework.homework_tests.count %>组 + + + + + + + <% homework.homework_tests.each_with_index do |test, i| %> + + + + + + <% end %> +
 测试集输入测试集输出
<%=i+1 %><%=test.input %><%=test.output %>
+
+ <% end %> +
+
+ <% if homework.homework_detail_manual%> + <% if homework.homework_detail_manual.comment_status == 1%> + <% end_time = homework.end_time.to_time.to_i + 24*60*60 - 1 %> + <% if end_time >= Time.now.to_i %> +
提交剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60) %> 天 + <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 + <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
+ <% else %> +
提交已截止
+ <% end %> + <% elsif homework.homework_detail_manual.comment_status == 2%> + <% end_time = homework.homework_detail_manual.evaluation_end.to_time.to_i + 24*60*60 - 1 %> + <% if end_time >= Time.now.to_i %> +
匿评剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60)%> 天 + <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 + <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
+ <% else %> +
匿评已截止
+ <% end %> + <% end%> + <% end%> +
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework} %> +
+ +<%= render :partial => "users/homework_base_info", :locals =>{:activity => homework, :user_activity_id =>homework.id, :is_teacher => is_teacher, :hw_status => 5} %> +
+
\ No newline at end of file diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 73f37602b..6bcb2bb5e 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -93,10 +93,7 @@ <% elsif @homework.homework_type == 1 %> $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); <% elsif @homework.homework_type == 3 %> - <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> - <% if pro && pro.student_work_id == work.id %> - $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); - <% end %> + $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>"); <% end %> $('#score_<%= work.id%>').peSlider({range: 'min'}); <% end %> diff --git a/app/views/student_work/cancel_relate_project.js.erb b/app/views/student_work/cancel_relate_project.js.erb index 2dd4a88a4..c65034689 100644 --- a/app/views/student_work/cancel_relate_project.js.erb +++ b/app/views/student_work/cancel_relate_project.js.erb @@ -1,4 +1,8 @@ +<% if @hw_status == 5 %> +$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>"); +<% else %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); +<% end %> <% if @user_activity_id != @homework.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 3ec6232db..8ab08b7e0 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -2,6 +2,7 @@ <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> <%= javascript_include_tag "resizeable_table" %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> +<%= import_ke(enable_at: true, prettify: false, init_activity: true) %> <% end %> -
- <% com_time = project.project_score.commit_time %> - <% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> - <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> - <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像", :target => '_blank' %> - - <% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %> - - <% else %> - <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %> - - - <% end %> -
- 项目名称:<%=project.name %>
- 创建者:<%=(User.find project.user_id).show_name %>(组长)
- 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %> -
-
- <% if i == 9 && projects.count > 10 %> -
更多>> - <% end %> - <% if i > 9 && i == (projects.count - 1) %> - 收回<< - <% end %> - <% end %> -
- <% end %> - <% end %> -
- <% if is_teacher%> - <% comment_status = activity.homework_detail_manual.comment_status %> -
-
    -
  • -
      -
    • - <%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "postOptionLink"%> -
    • -
    • - <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity, :hw_status => hw_status),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> -
    • -
    • - <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) %> -
    • - <% if activity.anonymous_comment == 0 %> -
    • - <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%> -
    • -
    • - <%= homework_anonymous_comment activity,hw_status,user_activity_id %> -
    • - <% end %> - <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> -
    • - <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "postOptionLink", - :title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%> -
    • - <% end %> - <% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %> -
    • - <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%> -
    • - <% elsif activity.is_open == 1 %> -
    • - <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%> -
    • - <% end %> -
    -
  • -
-
- <% end%> + <%= render :partial => "users/homework_base_info", :locals =>{:activity => activity, :user_activity_id =>user_activity_id, :is_teacher => is_teacher, :hw_status => hw_status} %>
- <% count=activity.journals_for_messages.count %> -
- <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status} %> - - <% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %> - <% if count > 0 %> -
- <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :hw_status => hw_status, :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %> -
- <% end %> - -
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
- <% if User.current.logged? %> -
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> - <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> - <%= hidden_field_tag 'hw_status',params[:hw_status],:value =>hw_status %> -
- - -
-

- <% end%> -
- <% else %> - <%= render :partial => "users/show_unlogged" %> - <% end %> -
-
-
-
-
+ <%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
+ +
+ <% com_time = project.project_score.commit_time %> + <% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> + <% if project.is_public || User.current.member_of?(project) || User.current.admin? %> + <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像", :target => '_blank' %> + + <% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %> + + <% else %> + <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %> + + + <% end %> +
+ 项目名称:<%=project.name %>
+ 创建者:<%=(User.find project.user_id).show_name %>(组长)
+ 更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %> +
+
+ <% if i == 9 && projects.count > 10 %> + 更多>> + <% end %> + <% if i > 9 && i == (projects.count - 1) %> + 收回<< + <% end %> + <% end %> + + <% end %> +<% end %> +
+ +<% if is_teacher%> + <% comment_status = activity.homework_detail_manual.comment_status %> +
+ +
+<% end%> \ No newline at end of file diff --git a/app/views/users/_homework_opr.html.erb b/app/views/users/_homework_opr.html.erb new file mode 100644 index 000000000..53d16b15d --- /dev/null +++ b/app/views/users/_homework_opr.html.erb @@ -0,0 +1,43 @@ +<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%> + <% projects = cur_user_projects_for_homework activity %> + <% works = cur_user_works_for_homework activity %> + <% if works.nil? && projects.nil? %> +
+ <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %> +
+ <% elsif works.nil? %> +
+ <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %> +
+ <% end %> +<% end %> +
+ <%= user_for_homework_common activity,is_teacher %> +
+<% work = cur_user_works_for_homework activity %> +<% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %> +
+ <%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> +
+<% end %> +<% if activity.homework_type == 2 && is_teacher%> +
+ <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> +
+ <% if activity.homework_detail_manual.comment_status != 0 %> +
+ <%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %> +
+ <% end %> +<% end %> +<% if activity.homework_type == 2%> +
+ 语言: + <%= activity.language_name%> +
+<% end %> +<% if activity.homework_type == 3 && activity.homework_detail_group%> +
+ 分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人 +
+<% end %> \ No newline at end of file diff --git a/app/views/users/_homework_post_reply.html.erb b/app/views/users/_homework_post_reply.html.erb new file mode 100644 index 000000000..0037e35ac --- /dev/null +++ b/app/views/users/_homework_post_reply.html.erb @@ -0,0 +1,34 @@ +<% count=activity.journals_for_messages.count %> +
+ <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status} %> + + <% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %> + <% if count > 0 %> +
+ <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :hw_status => hw_status, :is_teacher => is_teacher, :user_activity_id => user_activity_id, :activity_id => activity.id} %> +
+ <% end %> + +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+ <% if User.current.logged? %> +
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> + <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> + <%= hidden_field_tag 'hw_status',params[:hw_status],:value =>hw_status %> +
+ + +
+

+ <% end%> +
+ <% else %> + <%= render :partial => "users/show_unlogged" %> + <% end %> +
+
+
+
+
\ No newline at end of file diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 6f1fb7843..3351ae3f2 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -50,7 +50,7 @@ <% work = cur_user_works_for_homework homework_common %> <% if !is_teacher && !work.nil? && homework_common.end_time < Date.today && work.user == User.current %>
- <%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %> + <%=link_to "追加附件", student_work_index_url_in_org(homework_common.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
<% end %> <% if homework_common.homework_type == 2 && is_teacher%> diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index 5dcdc6401..ab41b1ae6 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -31,7 +31,7 @@ <% elsif @user && @jours_count%> $('#jour_count').html("<%= @jours_count %>"); <% elsif @homework%> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); + $("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @user_activity_id, :hw_status => @hw_status, :is_teacher => @is_teacher}) %>"); <% if @user_activity_id != @homework.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> diff --git a/app/views/words/leave_homework_message.js.erb b/app/views/words/leave_homework_message.js.erb index 61a8aca14..f6a89323f 100644 --- a/app/views/words/leave_homework_message.js.erb +++ b/app/views/words/leave_homework_message.js.erb @@ -1,4 +1,4 @@ -$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); +$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework_common, :user_activity_id => @user_activity_id, :hw_status => @hw_status, :is_teacher => @is_teacher}) %>"); <% if @user_activity_id != @homework_common.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> diff --git a/app/views/words/reply_to_homework.js.erb b/app/views/words/reply_to_homework.js.erb index 61a8aca14..f6a89323f 100644 --- a/app/views/words/reply_to_homework.js.erb +++ b/app/views/words/reply_to_homework.js.erb @@ -1,4 +1,4 @@ -$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>"); +$("#homework_post_reply_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/homework_post_reply', :locals => {:activity => @homework_common, :user_activity_id => @user_activity_id, :hw_status => @hw_status, :is_teacher => @is_teacher}) %>"); <% if @user_activity_id != @homework_common.id %> sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity"); <% else %> diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 8f6c56a4b..a2117bdf3 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -130,7 +130,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re /*作业信息*/ .mt-2 {margin-top:-2px;} -.homeworkInfo {background:#F6F6F6; padding:10px; margin-bottom:10px;} +.homeworkInfo {background:#F6F6F6; padding:10px;} .homeworkDetail {line-height:18px; font-size:12px; color:#484848; overflow:hidden;} .homeworkDetail p,.homeworkDetail div,.homeworkDetail em, .homeworkDetail span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .max_h54 {max-height:54px; } diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index 1841e0348..eccbcc9b1 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -249,7 +249,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .StudentName{display: table-cell;width: 115px;vertical-align: middle;text-align: left;height: 40px;} /*作业信息*/ -.homeworkInfo {background:#F6F6F6; padding:10px; margin-bottom:10px;} +.homeworkInfo {background:#F6F6F6; padding:10px;} .homeworkDetail {line-height:18px; font-size:12px; color:#484848; overflow:hidden;} .homeworkDetail p,.homeworkDetail div,.homeworkDetail em, .homeworkDetail span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .homeworkState {padding:3px 5px; background-color:#28be6c; border-radius:3px; float:left; margin-left:15px; color:#ffffff;}