From 515e2be4f85e95d6893ccb12c004e77287665498 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 29 Sep 2015 14:23:50 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=86=85=E7=9A=84=E4=BD=9C?=
=?UTF-8?q?=E4=B8=9A=E5=88=97=E8=A1=A8=E5=8C=BF=E8=AF=84=E8=AE=BE=E7=BD=AE?=
=?UTF-8?q?=E7=A1=AE=E5=AE=9A=E6=8C=89=E9=92=AE=E6=97=A0=E6=95=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/javascripts/course.js | 204 +++++++++++++++++++++--------------
1 file changed, 123 insertions(+), 81 deletions(-)
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();
}
//新建、修改课程明码显示