作业详情页

This commit is contained in:
cxt 2016-09-21 10:34:38 +08:00
parent ba4a1c64d9
commit d1c284c953
26 changed files with 469 additions and 380 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -84,7 +84,7 @@
<div class="cl"></div>
</div>
<div class="homeworkInfo" id="homeworkInformation">
<div class="homeworkInfo mb10" id="homeworkInformation">
<div class="">
<div class="homepagePostTitle fl hidden m_w460" title="<%= @exercise.exercise_name %>"><%= @exercise.exercise_name %></div>
<% if @exercise.exercise_status == 1 %>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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");

View File

@ -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");

View File

@ -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 %>
<div class="homepagePostSubmit">
<%=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 => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
@ -161,9 +161,9 @@
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% 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 => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id, '', sw.id)%>
<%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id, 2, '', sw.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>

View File

@ -0,0 +1,102 @@
<div class="homepagePostPortrait">
<%=link_to image_tag(url_to_avatar(homework.user),width:"50px", height: "50px"), user_activities_path(homework.user_id)%>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<%= 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' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to homework.course.name, course_path(homework.course_id), :class => "newsBlue"%>
</div>
<div class="homepagePostTitle hidden fl m_w505">
<% index = get_hw_index(homework, is_teacher) %>
<%= link_to "<span class='fontBlue2'>作业#{index + 1}</span>".html_safe + homework.name,student_work_index_path(:homework => homework.id),:class => "postGrey"%>
</div>
<%=get_hw_status(homework).html_safe %>
<div class="cl"></div>
<% if homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif homework.homework_type == 3 && homework.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% 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 %>
<div class="mt8 mb5">
<%= 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 %>
<div class="cl"></div>
<% end %>
<% if !homework.publish_time.nil? %>
<div class="homepagePostDeadline <%= (is_pro || is_base_group) ? 'mt8' : '' %>">
<%= l(:label_publish_time)%><%= homework.publish_time%>&nbsp;00:00
</div>
<% end %>
<% if homework.homework_detail_manual && homework.homework_detail_manual.comment_status < 2 %>
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">提交截止时间:<%= homework.end_time.to_s %>&nbsp;23:59</div>
<% elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status >= 2 && homework.anonymous_comment == 0%>
<div class="homepagePostDeadline ml15 <%= (is_pro || is_base_group) ? 'mt8' : '' %>">匿评截止时间:<%= homework.homework_detail_manual.evaluation_end.to_s %>&nbsp;23:59</div>
<% end %>
<div class="cl"></div>
</div>
<div class="homeworkInfo" id="homeworkInformation">
<div class="">
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">
<div id="homework_description">
<%= homework.description %>
</div>
</div>
<% if is_pro %>
<div class="mt10"> <span class="fontGrey3">测试集:<%=homework.homework_tests.count %>组</span>
<table class="mt5 test-set-table">
<tr>
<th width="25">&nbsp;</th>
<th width="290">测试集输入</th>
<th width="290">测试集输出</th>
</tr>
<% homework.homework_tests.each_with_index do |test, i| %>
<tr>
<td class="test_td_min"><%=i+1 %></td>
<td><%=test.input %></td>
<td ><%=test.output %></td>
</tr>
<% end %>
</table>
</div>
<% end %>
<div class="cl"></div>
<div class="mt5">
<% 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 %>
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">提交已截止</div>
<% 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 %>
<div class="fontGrey2 db fr">匿评剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60)%></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">匿评已截止</div>
<% end %>
<% end%>
<% end%>
<div class="cl"></div>
</div>
</div>
</div>
<div class="cl"></div>
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => homework} %>
</div>
<%= render :partial => "users/homework_base_info", :locals =>{:activity => homework, :user_activity_id =>homework.id, :is_teacher => is_teacher, :hw_status => 5} %>
</div>
<div class="cl"></div>

View File

@ -93,11 +93,8 @@
<% 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 %>
<% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %>
<% end %>

View File

@ -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 %>

View File

@ -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 %>
<script type="text/javascript">
@ -9,6 +10,29 @@
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
$("#Container").css("width","1000px");
<% if @tab == 2%>
$("#student_work_tab2").click();
<% end %>
sd_create_editor_from_data(<%= @homework.id %>, null, "100%", "<%= @homework.class.to_s %>");
});
function HoverLi(n){
for(var i=1;i<=2;i++){
$('#student_work_tab'+i).removeClass('selected');
$('#student_work_con'+i).addClass('undis');
}
$('#student_work_tab'+n).addClass('selected');
$('#student_work_con'+n).removeClass('undis');
}
$("#moreProject_<%=@homework.id %>").click(function(){
$("#relatePWrap_<%=@homework.id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=@homework.id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=@homework.id %>").click(function(){
$("#relatePWrap_<%=@homework.id %>").toggleClass('relatePWrap');
$("#moreProject_<%=@homework.id %>").show();
});
// 匿评弹框提示
@ -41,17 +65,6 @@
}
$(function(){
/*$("#homework_info_hidden").click(function(){
$("#homeworkInformation").hide();
$("#homework_info_hidden").hide();
$("#homework_info_show").show();
});
$("#homework_info_show").click(function(){
$("#homework_info_show").hide();
$("#homeworkInformation").show();
$("#homework_info_hidden").show();
});*/
if($("#homework_description").height() > 54) {
$("#homeworkDetailShow").show();
}
@ -137,89 +150,25 @@
<div class="cl"></div>
</div>
<div class="homeworkInfo" id="homeworkInformation">
<div class="">
<div class="homepagePostTitle fl hidden m_w460" title="<%= @homework.name %>"><%= @homework.name %></div>
<% if @homework.homework_detail_manual%>
<% if @homework.homework_detail_manual.comment_status == 0 %>
<span class="grey_homework_btn_cir ml5">未发布</span>
<% elsif @homework.homework_detail_manual.comment_status == 1%>
<% if @homework.anonymous_comment == 0%>
<span class="grey_homework_btn_cir ml5">未开启匿评</span>
<% else %>
<span class="grey_homework_btn_cir ml5">匿评已禁用</span>
<% end %>
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")%>
<span class="green_homework_btn_cir ml5">作品提交中</span>
<% elsif Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") %>
<span class="red_homework_btn_cir ml5">作品补交中</span>
<% end %>
<% elsif @homework.homework_detail_manual.comment_status == 2%>
<% if @homework.anonymous_comment == 0%>
<span class="green_homework_btn_cir ml5">匿评中</span>
<% else %>
<span class="grey_homework_btn_cir ml5">匿评已禁用</span>
<% end %>
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% elsif @homework.homework_detail_manual.comment_status == 3%>
<% if @homework.anonymous_comment == 0%>
<span class="grey_homework_btn_cir ml5">匿评已结束</span>
<% else %>
<span class="grey_homework_btn_cir ml5">匿评已禁用</span>
<% end %>
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% end%>
<% end%>
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" onclick="show_or_hide_info();" id="homework_info_hidden">[ 隐藏作业信息 ]</a> </span>
<div class="cl"></div>
<div class="fontGrey2 db mb5">发布者:<%= @homework.user.show_name %></div>
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">
<div id="homework_description"><%= @homework.description.html_safe %></div>
<ul class="homework-detail-tab mb10 mt15 fb">
<li class="selected" id="student_work_tab1" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="fontGrey3">作业信息</a>
</li>
<li onclick="HoverLi(2);" id="student_work_tab2">
<a href="javascript:void(0);" class="fontGrey3">作品列表</a>
</li>
<li style="width:515px;">&nbsp;</li>
</ul>
<div id="student_work_con1">
<div class="homepagePostBrief" id="homework_post_brief">
<%= render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher} %>
</div>
<div id="homeworkDetailShow" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="homeworkDetailHide" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => @homework, :user_activity_id => @homework.id, :hw_status => 3, :is_teacher => @is_teacher} %>
<div class="cl"></div>
<div>
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @homework} %>
<div class="cl"></div>
</div>
<div class="mt5">
<% if @homework.end_time && @homework.publish_time %>
<% if @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status < 2 %>
<div class="fontGrey2 db fl">提交截止时间:<%= @homework.end_time %>&nbsp;23:59</div>
<% elsif @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status >= 2 && @homework.anonymous_comment == 0 %>
<div class="fontGrey2 db fl">匿评截止时间:<%= @homework.homework_detail_manual.evaluation_end %>&nbsp;23:59</div>
<% end %>
<% if @homework.homework_detail_manual.comment_status == 0 %>
<div class="fontGrey2 db fl ml10">发布时间:<%= @homework.publish_time %>&nbsp;00:00</div>
<% end %>
<% 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 %>
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">提交已截止</div>
<% 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 %>
<div class="fontGrey2 db fr">匿评剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60)%></span> 天
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
<% else %>
<div class="fontGrey2 db fr c_red">匿评已截止</div>
<% end %>
<% end%>
<% end%>
<div class="cl"></div>
</div>
</div>
</div>
<div class="undis" id="student_work_con2">
<div class="hworkListContainer">
<div class="ctt2">
<div class="dis" id="homework_student_work_list">
@ -227,8 +176,7 @@
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<div class="cl"></div>

View File

@ -1,7 +1,11 @@
clickCanel();
<% if @hw_status != 5 %>
$("#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}) %>");
<% if @user_activity_id != @homework.id %>
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
<% else %>
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
<% end %>
<% else %>
window.location.href = '<%=student_work_index_url(:homework => @homework.id) %>';
<% end %>

View File

@ -1,5 +1,9 @@
hideModal("#popbox02");
<% 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 %>

View File

@ -34,51 +34,7 @@
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>
<div class="homepagePostSubmitContainer">
<% 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? %>
<div class="homepagePostSubmit">
<%=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=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id) %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=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=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% if activity.homework_detail_manual.comment_status != 0 %>
<div class="homepagePostSubmit">
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %>
</div>
<% end %>
<% end %>
<% if activity.homework_type == 2%>
<div class="homepagePostDeadline mr15">
语言:
<%= activity.language_name%>
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>
<% end %>
<%= render :partial => 'users/homework_opr', :locals => {:activity => activity, :is_teacher => is_teacher, :hw_status => hw_status, :user_activity_id => user_activity_id} %>
<% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
<div class="homepagePostDeadline">提交截止时间:<%= activity.end_time.to_s %>&nbsp;23:59</div>
<% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 && activity.anonymous_comment == 0%>
@ -99,221 +55,13 @@
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
<div class="mt10">
<div class="homepagePostDeadline">
迟交扣分:<%= activity.late_penalty%>分
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<% end %>
</div>
<div class="cl"></div>
<div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<% end %>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.has_committed.count != 0 %>
<% sw = activity.student_works.has_committed.reorder("commit_time desc").first %>
<div class="mt10 homepagePostDeadline mb10">
#&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div>
<p class="mb10 fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
</p>
</div>
<% end %>
<div>
<% if activity.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% 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_path(:homework => activity.id,:show_work_id => sw.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id,:show_work_id => sw.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<% if student_works.count > 5 %>
<%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<%# first_pro = sort_projects.first %>
<% first_pro = Project.find sort_projects.first.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div>
<div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none");
});
});
</script>
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% 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' %>
<p class="mh18 hidden"><%=link_to (User.find project.user_id).show_name+"(组长)", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{(User.find project.user_id).show_name}(组长)" %></p>
<% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
<p class="mh18 hidden"><%=link_to update_time+" "+project.project_score.changeset_num.to_s+"提交", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{update_time} #{project.project_score.changeset_num.to_s}提交" %></p>
<% 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 => "私有项目不可访问") %>
<p class="mh18 hidden" title="私有项目不可访问"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18 hidden" title="私有项目不可访问"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<% end %>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
</div>
</div>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "postOptionLink"%>
</li>
<li>
<%= 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") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) %>
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= 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%>
</li>
<li>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
<li>
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li>
<% elsif activity.is_open == 1 %>
<li>
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end%>
<%= render :partial => "users/homework_base_info", :locals =>{:activity => activity, :user_activity_id =>user_activity_id, :is_teacher => is_teacher, :hw_status => hw_status} %>
</div>
<div class="cl"></div>
</div>
<% count=activity.journals_for_messages.count %>
<div class="homepagePostReply">
<%= 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 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%=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} %>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= 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 %>
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
</div>
<script type="text/javascript">
$("#moreProject_<%=user_activity_id %>").click(function(){

View File

@ -0,0 +1,178 @@
<div class="mt10">
<div class="homepagePostDeadline">
迟交扣分:<%= activity.late_penalty%>分
</div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_start_time_<%=user_activity_id %>">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<% end %>
</div>
<div class="cl"></div>
<div>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<% end %>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.has_committed.count != 0 %>
<% sw = activity.student_works.has_committed.reorder("commit_time desc").first %>
<div class="mt10 homepagePostDeadline">
#&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %>
<% unless student_work_scores.empty? %>
<% last_score = student_work_scores.first %>
<div class="mt10">
<p class="fontGrey2">#&nbsp;<%=time_from_now last_score.created_at %>
<%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
</p>
</div>
<% end %>
<div>
<% if activity.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% 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, 2, '', sw.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name,student_work_index_url_in_org(activity.id, 2, '', sw.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<% if student_works.count > 5 %>
<%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<%# first_pro = sort_projects.first %>
<% first_pro = Project.find sort_projects.first.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
</div>
<div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none");
});
});
</script>
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% 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' %>
<p class="mh18 hidden"><%=link_to (User.find project.user_id).show_name+"(组长)", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{(User.find project.user_id).show_name}(组长)" %></p>
<% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
<p class="mh18 hidden"><%=link_to update_time+" "+project.project_score.changeset_num.to_s+"提交", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{update_time} #{project.project_score.changeset_num.to_s}提交" %></p>
<% 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 => "私有项目不可访问") %>
<p class="mh18 hidden" title="私有项目不可访问"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18 hidden" title="私有项目不可访问"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<% end %>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
</div>
</div>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit),edit_homework_common_path(activity, :hw_status => hw_status), :class => "postOptionLink"%>
</li>
<li>
<%= 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") %>
</li>
<li>
<%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true) %>
</li>
<% if activity.anonymous_comment == 0 %>
<li>
<%= 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%>
</li>
<li>
<%= homework_anonymous_comment activity,hw_status,user_activity_id %>
</li>
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
<li>
<%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id),:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品", :remote => true)%>
</li>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
<li>
<%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li>
<% elsif activity.is_open == 1 %>
<li>
<%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status),:class => "postOptionLink", :remote => true)%>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end%>

View File

@ -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? %>
<div class="homepagePostSubmit">
<%=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=> '请各组长关联作业项目' %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=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=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<%= user_for_homework_common activity,is_teacher %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if activity.end_time < Date.today && !is_teacher && !work.nil? && work.user == User.current %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% if activity.homework_detail_manual.comment_status != 0 %>
<div class="homepagePostSubmit">
<%= link_to "代码查重", work_canrepeat_student_work_index_path(homework: activity.id, course_id: activity.course.id), class: 'c_blue test-program-btn',:remote => true %>
</div>
<% end %>
<% end %>
<% if activity.homework_type == 2%>
<div class="homepagePostDeadline mr15">
语言:
<%= activity.language_name%>
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>
<% end %>

View File

@ -0,0 +1,34 @@
<% count=activity.journals_for_messages.count %>
<div class="homepagePostReply" id="homework_post_reply_<%= user_activity_id %>">
<%= 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 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%=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} %>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= 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 %>
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="homework_message"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<% else %>
<%= render :partial => "users/show_unlogged" %>
<% end %>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>

View File

@ -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 %>
<div class="homepagePostSubmit">
<%=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 => "可追加作品修订附件" %>
</div>
<% end %>
<% if homework_common.homework_type == 2 && is_teacher%>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -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; }

View File

@ -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;}