dev_zanle
huang 10 years ago
commit a791c39b4b

@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController
user_activity.updated_at = Time.now user_activity.updated_at = Time.now
user_activity.save user_activity.save
end end
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
course_message.save
@student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
respond_to do |format| respond_to do |format|
format.js format.js
@ -299,10 +302,11 @@ class StudentWorkController < ApplicationController
@submit_result = true @submit_result = true
@work.name = params[:student_work][:name] @work.name = params[:student_work][:name]
@work.description = params[:student_work][:description] @work.description = params[:student_work][:description]
@work.project_id = params[:student_work][:project]
@work.save_attachments(params[:attachments]) @work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@work) render_attachment_warning_if_needed(@work)
if @work.save if @work.save
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
course_message.save
=begin =begin
respond_to do |format| respond_to do |format|
format.html { format.html {
@ -687,6 +691,7 @@ class StudentWorkController < ApplicationController
end end
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
all_students = User.where("id in #{all_student_ids}") all_students = User.where("id in #{all_student_ids}")
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
@users = searchstudent_by_name all_students,name @users = searchstudent_by_name all_students,name
respond_to do |format| respond_to do |format|
format.js format.js

@ -2455,7 +2455,7 @@ module ApplicationHelper
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
else else
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"

@ -1,5 +1,5 @@
class CourseMessage < ActiveRecord::Base class CourseMessage < ActiveRecord::Base
# status说明 status在课程不同的类型区分不同的功能 # status说明 status在课程不同的类型区分不同的功能 status = 9 作品的提交记录
# HomeworkCommonstatus # HomeworkCommonstatus
# nil发布了作业 1作业截止时间到了提醒2:开启匿评; 3关闭匿评 4匿评开始失败 # nil发布了作业 1作业截止时间到了提醒2:开启匿评; 3关闭匿评 4匿评开始失败
attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status
@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base
def add_user_message def add_user_message
#unless self.course_message_type == 'JoinCourseRequest' #unless self.course_message_type == 'JoinCourseRequest'
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9
self.message_alls << MessageAll.new(:user_id => self.user_id) self.message_alls << MessageAll.new(:user_id => self.user_id)
end end
#end #end

@ -1,8 +1,7 @@
<% if @is_destroy%> <% if @is_destroy%>
$("#attachment_<%= @attachment.id%>").remove(); $("#attachment_<%= @attachment.id%>").remove();
if(document.getElementById("uploadReviseBox")) { if(document.getElementById("revise_attachment_div_<%= @attachment.id%>")) {
$("#uploadReviseBox").removeClass('disable_link'); $("#revise_attachment_div_<%= @attachment.id%>").remove();
$("#choose_revise_attach").attr("onclick","_file.click();");
} }
<%else%> <%else%>
var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>'); var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');

@ -33,6 +33,19 @@
}).mouseleave(function(){ }).mouseleave(function(){
$("#work_click_<%= exercise.id%>").hide(); $("#work_click_<%= exercise.id%>").hide();
}); });
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$("#show_student_result_div").on('click',show_result);
<% else %>
$("#show_student_result_div").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_id").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_id").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
function show_result() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}
</script> </script>
<ul class="hworkListRow" id="student_work_<%= exercise.id%>"> <ul class="hworkListRow" id="student_work_<%= exercise.id%>">
<li class="hworkList340 width530"> <li class="hworkList340 width530">
@ -40,22 +53,16 @@
<li class="hworkPortrait mt15 mr10"> <li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %> <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
</li> </li>
<div onclick="" style="cursor: pointer;" class="student_work_<%= exercise.id%>"> <div id="show_student_result_div" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li> <li>
<ul class="mt10 fl"> <ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名"> <li class="hworkStName mr15 mt16" title="姓名" id="student_name_id">
<% name = exercise.user.show_name %> <%=exercise.user.show_name %>
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
<%= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>
<% else %>
<span title="截止日期未到,暂不能查看学生答题结果。"><%=name%></span>
<%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %>
<% end %>
</li> </li>
<li class="hworkStID mr10 mt16" title="学号"> <li class="hworkStID mr10 mt16" title="学号" id="student_id_id">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
</li> </li>
<li class="hworkStID mt16" title="班级"> <li class="hworkStID mt16" title="班级" id="student_class_id">
-- --
</li> </li>
</ul> </ul>
@ -63,7 +70,7 @@
</div> </div>
</ul> </ul>
</li> </li>
<li class="hworkList130 c_grey student_work_<%= exercise.id%>" onclick="" style="cursor: pointer;"> <li class="hworkList130 c_grey student_work_<%= exercise.id%>">
<% if exercise.created_at%> <% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp; <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% end %> <% end %>

@ -1,6 +1,6 @@
<ul class="hworkUl"> <ul class="hworkUl">
<li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>"> <li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr140 ml50'%>">作品名称</span> <span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr150 ml50'%>">作品名称</span>
<% if @homework.homework_type != 3 %> <% if @homework.homework_type != 3 %>
<span class="c_dark f14 fb fl mr50">姓名</span> <span class="c_dark f14 fb fl mr50">姓名</span>
<span class="c_dark f14 fb fl">学号</span> <span class="c_dark f14 fb fl">学号</span>

@ -12,7 +12,7 @@
<li class="hworkPortrait mt15 mr10"> <li class="hworkPortrait mt15 mr10">
<%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %> <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
</li> </li>
<li class="hworkName mt15 mr15 width285 student_work_<%= student_work.id%>"> <li class="hworkName mt15 mr15 width255 student_work_<%= student_work.id%>">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div> <div>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
@ -40,7 +40,7 @@
<li class="hworkPortrait mt15 mr10"> <li class="hworkPortrait mt15 mr10">
<%= image_tag(url_to_avatar(""),width:"40", height: "40") %> <%= image_tag(url_to_avatar(""),width:"40", height: "40") %>
</li> </li>
<li class="hworkName mt15 mr15 width285 student_work_<%= student_work.id%>"> <li class="hworkName mt15 mr15 width255 student_work_<%= student_work.id%>">
<div> <div>
<%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
</div> </div>

@ -4,7 +4,7 @@
<div class="resubAtt mb15"> <div class="resubAtt mb15">
<span class="resubTitle">追加修订附件</span> <span class="resubTitle">追加修订附件</span>
</div> </div>
<div class="mb10"> <div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>">
<span class="tit_fb"> 追加附件:</span> <span class="tit_fb"> 追加附件:</span>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %>
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>&nbsp;&nbsp;(<%=revise_attachment_status @homework,revise_attachment %>) <span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>&nbsp;&nbsp;(<%=revise_attachment_status @homework,revise_attachment %>)
@ -15,7 +15,7 @@
<span class="resubTitle">追加修订附件</span> <span class="resubTitle">追加修订附件</span>
</div> </div>
<% if revise_attachment %> <% if revise_attachment %>
<div class="mb10"> <div class="mb10" id="revise_attachment_div_<%=revise_attachment.id %>">
<span class="tit_fb"> 追加附件:</span> <span class="tit_fb"> 追加附件:</span>
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %>
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %> <span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>

@ -18,7 +18,7 @@ $("#all_students_list").empty();
} }
} }
} }
<% if user.id.to_i != User.current.id.to_i %> <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
if (str.indexOf(<%=user.id.to_s %>) < 0) { if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() { $("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'"; var li = "<li id='choose_student_<%=user.id %>'";
@ -29,5 +29,9 @@ $("#all_students_list").empty();
$("#choose_students_list").append(li); $("#choose_students_list").append(li);
}); });
} }
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
}
<% end %> <% end %>
<% end %> <% end %>

@ -55,7 +55,7 @@
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<span class="fl fontGrey2" id="relate_project_show"> <span class="fl fontGrey2" id="relate_project_show">
<% if @homework %> <% if @homework && @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %> <% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %>
<% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %> <% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %>
关联项目:<%=project.name %> 关联项目:<%=project.name %>

@ -83,6 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
.width180{width: 180px;} .width180{width: 180px;}
.width525{width: 525px;} .width525{width: 525px;}
.width285{width: 285px;} .width285{width: 285px;}
.width255{width: 255px;}
.width530{width: 530px;} .width530{width: 530px;}
.mr95{margin-right: 95px;} .mr95{margin-right: 95px;}
.mr140 {margin-right: 140px;} .mr140 {margin-right: 140px;}

Loading…
Cancel
Save