diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 7b81d12db..0f8330afe 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -176,12 +176,6 @@ class FilesController < ApplicationController
def index
@flag = params[:flag] || false
- #sort_init 'filename', 'asc'
- # sort_init 'created_on', 'desc'
- # sort_update 'created_on' => "#{Attachment.table_name}.created_on",
- # 'filename' => "#{Attachment.table_name}.filename",
- # 'size' => "#{Attachment.table_name}.filesize",
- # 'downloads' => "#{Attachment.table_name}.downloads"
sort = ""
@sort = ""
@order = ""
diff --git a/app/views/avatar/_new_avatar_form.html.erb b/app/views/avatar/_new_avatar_form.html.erb
index 64abfbc30..de3bf2b65 100644
--- a/app/views/avatar/_new_avatar_form.html.erb
+++ b/app/views/avatar/_new_avatar_form.html.erb
@@ -1,11 +1,10 @@
<%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
-<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
-<%= l(:button_upload_photo) %>
+<%= l(:button_upload_photo) %>
<%= file_field_tag 'avatar[image]',
- :id => nil,
- :class => 'upload_file',
+ :id => "upload_img",
+ :class => 'undis',
:size => "1",
:multiple => true,
:data => {
diff --git a/db/migrate/20150925025200_alter_activities.rb b/db/migrate/20150925025200_alter_activities.rb
index 638918e8e..8a5480617 100644
--- a/db/migrate/20150925025200_alter_activities.rb
+++ b/db/migrate/20150925025200_alter_activities.rb
@@ -4,7 +4,7 @@ class AlterActivities < ActiveRecord::Migration
if activity.act_type == 'JournalsForMessage'
if activity.act
unless activity.act.m_parent_id.nil?
- parent_act = UserActivity.where("act_id = #{activity.act.parent.id} and act_type='JournalsForMessage' and container_type='Course'").first
+ parent_act = UserActivity.where("act_id = #{activity.act.m_parent_id} and act_type='JournalsForMessage' and container_type='Course'").first
if parent_act
parent_act.created_at = activity.act.parent.children.maximum("created_on")
parent_act.save
@@ -21,7 +21,7 @@ class AlterActivities < ActiveRecord::Migration
if activity.course_act_type == 'JournalsForMessage'
if activity.course_act
unless activity.course_act.m_parent_id.nil?
- parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent.id} and course_act_type='JournalsForMessage'").first
+ parent_act = CourseActivity.where("course_act_id = #{activity.course_act.m_parent_id} and course_act_type='JournalsForMessage'").first
if parent_act
parent_act.created_at = activity.course_act.parent.children.maximum("created_on")
parent_act.save
@@ -34,7 +34,7 @@ class AlterActivities < ActiveRecord::Migration
elsif activity.course_act_type == 'Message'
if activity.course_act
unless activity.course_act.parent_id.nil?
- parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent.id} and course_act_type='Message'").first
+ parent_act = CourseActivity.where("course_act_id = #{activity.course_act.parent_id} and course_act_type='Message'").first
if parent_act
parent_act.created_at = activity.course_act.parent.children.maximum("created_on")
parent_act.save
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 4a6f10360..46a98ed6d 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -446,63 +446,45 @@ function check_late_penalty(id)
}
//验证匿评数量
-function regex_evaluation_num()
-{
- if($("#evaluation_num").length == 0){ return true;}
- var evaluation_num = $.trim($("#evaluation_num").val());
- var regex = /^\d+$/;
- if(evaluation_num=="")
- {
- $("#evaluation_num_notice").html("匿评分配数量不能为空");
- $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
- return false;
- }
- else if(regex.test(evaluation_num))
- {
- if(evaluation_num > 0)
- {
- $("#evaluation_num_notice").html("每个学生将收到 "+ parseInt(evaluation_num) + " 份待匿评作品");
- $("#evaluation_num_notice").removeClass("c_red");
- return true;
- }
- else
- {
- $("#evaluation_num_notice").html("匿评分配数量必须为大于0");
- $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
- return false;
- }
- }
- else
- {
- $("#evaluation_num_notice").html("匿评分配数量只能为数字");
- $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
- return false;
- }
-}
+//function regex_evaluation_num()
+//{
+// if($("#evaluation_num").length == 0){ return true;}
+// var evaluation_num = $.trim($("#evaluation_num").val());
+// var regex = /^\d+$/;
+// if(evaluation_num=="")
+// {
+// $("#evaluation_num_notice").html("匿评分配数量不能为空");
+// $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
+// return false;
+// }
+// else if(regex.test(evaluation_num))
+// {
+// if(evaluation_num > 0)
+// {
+// $("#evaluation_num_notice").html("每个学生将收到 "+ parseInt(evaluation_num) + " 份待匿评作品");
+// $("#evaluation_num_notice").removeClass("c_red");
+// return true;
+// }
+// else
+// {
+// $("#evaluation_num_notice").html("匿评分配数量必须为大于0");
+// $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
+// return false;
+// }
+// }
+// else
+// {
+// $("#evaluation_num_notice").html("匿评分配数量只能为数字");
+// $("#evaluation_num_notice").removeClass("c_red").addClass("c_red");
+// return false;
+// }
+//}
//点击是否开启匿评单选框效果
$(function(){
- //$("#homework_common_homework_type").click(function(){
- // if($("#homework_common_homework_type").attr("checked") == "checked")
- // {
- // $("#evaluation_setting").slideDown();
- // $("#ta_proportion").removeAttr("disabled");
- // }
- // else
- // {
- // $("#evaluation_setting").slideUp();
- // $("#ta_proportion").attr("disabled","disabled");
- // }
- //});
-
$("#absence_penalty").change(function(){
$("#absence_penalty_notice").html(" "+ $("#absence_penalty").val() +" ");
});
-
- //$("#ta_proportion").change(function(){
- // var ta_proportion = $("#ta_proportion").val();
- // $("#student_proportion").val((100 - parseInt(ta_proportion * 100)) + "%");
- //});
});
//生成select
@@ -519,41 +501,101 @@ function build_selector(max_num){
return html;
}
-//第一次加载时,如果未开启匿评作业,隐藏显示匿评配置信息
-//$(function(){
-// if($("#homework_common_homework_type").attr("id") != null && $("#homework_common_homework_type").val() != 2)
-// {
-// if($("#homework_common_homework_type").attr("checked") == "checked")
-// {
-// $("#evaluation_setting").show();
-// $("#ta_proportion").removeAttr("disabled");
-// }
-// else
-// {
-// $("#evaluation_setting").hide();
-// $("#ta_proportion").attr("disabled","disabled");
-// }
-// }
-//});
-
-//老师提交 新建/修改 作业
-function submit_homework(id)
-{
- if(!regex_homework_name())
- {
- $("#homework_name").focus();
+//提交匿评参数设置
+function submit_set_evaluation_attr(end_time){
+ if(!regex_evaluation_start(end_time)){
+ $("#evaluation_start_time").focus();
}
- else if(!regex_evaluation_num())
- {
+ else if(!regex_evaluation_end()){
+ $("#evaluation_end_time").focus();
+ }
+ else if(!regex_evaluation_num()){
$("#evaluation_num").focus();
}
- else
- {
- homework_description_editor.sync();
- $("#"+id).submit();
+ else{
+ $('#popbox02 form').submit();
+ }
+}
+
+//验证匿评开启时间:大于截止时间,或者为空
+function regex_evaluation_start(end_time){
+ var evaluation_start = $.trim($("#evaluation_start_time").val());
+ if(evaluation_start == ""){
+ $("#homework_evaluation_start_time").text("开启匿评日期不能为空");
+ return false;
+ }
+ var end_time = new Date(end_time);
+ var evaluation_start_time = new Date(evaluation_start);
+ if(evaluation_start_time > end_time){
+ $("#homework_evaluation_start_time").text("");
+ return true;
+ }else{
+ $("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期");
+ return false;
+ }
+}
+
+//验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
+function regex_evaluation_end(){
+ var evaluation_start = $.trim($("#evaluation_start_time").val());
+ var evaluation_end = $.trim($("#evaluation_end_time").val());
+ if(evaluation_end == ""){
+ $("#homework_evaluation_end_time").text("关闭匿评日期不能为空");
+ return true;
+ }
+ var evaluation_start_time = new Date(evaluation_start);
+ var evaluation_end_time = new Date(evaluation_end);
+ if(evaluation_end_time > evaluation_start_time){
+ $("#homework_evaluation_end_time").text("");
+ return true;
+ }else{
+ $("#homework_evaluation_end_time").text("关闭匿评日期必须大于开启匿评日期");
+ return false;
+ }
+}
+
+//验证匿评数量
+function regex_evaluation_num(){
+ var evaluation_num = $.trim($("#evaluation_num").val());
+ var regex = /^\d+$/;
+ if(evaluation_num==""){
+ $("#evaluation_num_notice").text("匿评人数不能为空");
+ return false;
+ }
+ else if(regex.test(evaluation_num)){
+ if(evaluation_num > 0){
+ $("#evaluation_num_notice").html("");
+ return true;
+ }
+ else{
+ $("#evaluation_num_notice").text("匿评人数必须为大于0");
+ return false;
+ }
+ }
+ else{
+ $("#evaluation_num_notice").text("匿评人数只能为数字");
+ return false;
}
}
+//老师提交 新建/修改 作业
+//function submit_homework(id)
+//{
+// if(!regex_homework_name())
+// {
+// $("#homework_name").focus();
+// }
+// else if(!regex_evaluation_num())
+// {
+// $("#evaluation_num").focus();
+// }
+// else
+// {
+// homework_description_editor.sync();
+// $("#"+id).submit();
+// }
+//}
+
function regexHomeworkCommonName()
{
var name = $.trim($("#homework_attach_name").val());
@@ -661,7 +703,7 @@ $(document).ready(function () {
// 日历选择日期后关闭
function regexDeadLine()
{
- ('#ui-datepicker-div').hide;
+ ('#ui-datepicker-div').hide();
}
//新建、修改课程明码显示
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index ff6fdb32a..8661626c8 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -163,7 +163,7 @@ a.f_grey:hover {color:#000000;}
.resourcesIcon {margin-top:15px; display:block; width:25px; height:20px;}
.nolink_btn{ background:#BCBCBC; color: #fff; padding:2px 5px;}
.more_btn{-moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #9DCEFF; color:#9DCEFF; border-radius:3px; padding:0px 3px;}
-.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;}
+/*.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;}*/
.red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
.green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
.grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
@@ -511,7 +511,7 @@ a:hover.st_add{ color:#ff8e15;}
.upimg{ border:1px solid #eaeaea; display:block; width:60px; height:60px; padding:1px;}
.upimg:hover{ border:1px solid #64bdd9; }
.upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;}
-.upbtn:hover{border:1px solid #64bdd9; color:#64bdd9;cursor: pointer;}
+.upbtn:hover{color:#64bdd9;cursor: pointer;}
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
/* 功能倒计时*/
.w_img{ float:left; margin:10px 10px 15px 0px;}