|
|
@ -73,79 +73,79 @@ function hidden_homework_score_form()
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
///////////////////////////////////////////////////////////////新建课程相关
|
|
|
|
///////////////////////////////////////////////////////////////新建课程相关
|
|
|
|
//验证课程名称
|
|
|
|
//验证课程名称
|
|
|
|
function regex_course_name()
|
|
|
|
function regex_course_name(str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var name = $.trim($("#course_name").val());
|
|
|
|
var name = $.trim($("#"+str+"_course_name").val());
|
|
|
|
if(name.length < 2)
|
|
|
|
if(name.length < 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_name_notice").show();
|
|
|
|
$("#"+str+"_course_name_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_name_notice").hide();
|
|
|
|
$("#"+str+"_course_name_notice").hide();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//验证课程学时
|
|
|
|
//验证课程学时
|
|
|
|
function regex_course_class_period()
|
|
|
|
function regex_course_class_period(str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var class_period = $.trim($("#class_period").val());
|
|
|
|
var class_period = $.trim($("#"+str+"_class_period").val());
|
|
|
|
var regex = /^\d*$/;
|
|
|
|
var regex = /^\d*$/;
|
|
|
|
if(class_period.length == 0)
|
|
|
|
if(class_period.length == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_class_period_notice").html("学时总数不能为空");
|
|
|
|
$("#"+str+"_course_class_period_notice").html("学时总数不能为空");
|
|
|
|
$("#course_class_period_notice").show();
|
|
|
|
$("#"+str+"_course_class_period_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (regex.test(class_period)) {
|
|
|
|
else if (regex.test(class_period)) {
|
|
|
|
if(parseInt(class_period) > 0)
|
|
|
|
if(parseInt(class_period) > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_class_period_notice").html("");
|
|
|
|
$("#"+str+"_course_class_period_notice").html("");
|
|
|
|
$("#course_class_period_notice").hide();
|
|
|
|
$("#"+str+"_course_class_period_notice").hide();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_class_period_notice").html("学时总数必须大于0");
|
|
|
|
$("#"+str+"_course_class_period_notice").html("学时总数必须大于0");
|
|
|
|
$("#course_class_period_notice").show();
|
|
|
|
$("#"+str+"_course_class_period_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_class_period_notice").html("学时总数必须为正整数");
|
|
|
|
$("#"+str+"_course_class_period_notice").html("学时总数必须为正整数");
|
|
|
|
$("#course_class_period_notice").show();
|
|
|
|
$("#"+str+"_course_class_period_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//验证开始学期和结束学期
|
|
|
|
//验证开始学期和结束学期
|
|
|
|
function regex_time_term(){
|
|
|
|
function regex_time_term(str){
|
|
|
|
var obj_time = document.getElementById("time");
|
|
|
|
var obj_time = document.getElementById(str+"_time");
|
|
|
|
var obj_end_time = document.getElementById("end_time");
|
|
|
|
var obj_end_time = document.getElementById(str+"_end_time");
|
|
|
|
var obj_term = document.getElementById("term");
|
|
|
|
var obj_term = document.getElementById(str+"_term");
|
|
|
|
var obj_end_term = document.getElementById("end_term");
|
|
|
|
var obj_end_term = document.getElementById(str+"_end_term");
|
|
|
|
var time = obj_time.options[obj_time.selectedIndex];
|
|
|
|
var time = obj_time.options[obj_time.selectedIndex];
|
|
|
|
var end_time = obj_end_time.options[obj_end_time.selectedIndex];
|
|
|
|
var end_time = obj_end_time.options[obj_end_time.selectedIndex];
|
|
|
|
var term = obj_term.options[obj_term.selectedIndex];
|
|
|
|
var term = obj_term.options[obj_term.selectedIndex];
|
|
|
|
var end_term = obj_end_term.options[obj_end_term.selectedIndex];
|
|
|
|
var end_term = obj_end_term.options[obj_end_term.selectedIndex];
|
|
|
|
if(time.value == end_time.value) {
|
|
|
|
if(time.value == end_time.value) {
|
|
|
|
if(set_term_val(term.value) > set_term_val(end_term.value)) {
|
|
|
|
if(set_term_val(term.value) > set_term_val(end_term.value)) {
|
|
|
|
$("#course_time_term_notice").html("开始学期不能晚于结束学期");
|
|
|
|
$("#"+str+"_course_time_term_notice").html("开始学期不能晚于结束学期");
|
|
|
|
$("#course_time_term_notice").show();
|
|
|
|
$("#"+str+"_course_time_term_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$("#course_time_term_notice").html("");
|
|
|
|
$("#"+str+"_course_time_term_notice").html("");
|
|
|
|
$("#course_time_term_notice").hide();
|
|
|
|
$("#"+str+"_course_time_term_notice").hide();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if(time.value < end_time.value) {
|
|
|
|
} else if(time.value < end_time.value) {
|
|
|
|
$("#course_time_term_notice").html("");
|
|
|
|
$("#"+str+"_course_time_term_notice").html("");
|
|
|
|
$("#course_time_term_notice").hide();
|
|
|
|
$("#"+str+"_course_time_term_notice").hide();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$("#course_time_term_notice").html("开始学期不能晚于结束学期");
|
|
|
|
$("#"+str+"_course_time_term_notice").html("开始学期不能晚于结束学期");
|
|
|
|
$("#course_time_term_notice").show();
|
|
|
|
$("#"+str+"_course_time_term_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -160,32 +160,32 @@ function set_term_val(val) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//验证密码
|
|
|
|
//验证密码
|
|
|
|
function regex_course_password()
|
|
|
|
function regex_course_password(str)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var class_period = $.trim($("#course_course_password").val());
|
|
|
|
var class_period = $.trim($("#"+str+"_course_course_password").val());
|
|
|
|
var regex = /^\w+$/;
|
|
|
|
var regex = /^\w+$/;
|
|
|
|
if(class_period.length == 0)
|
|
|
|
if(class_period.length == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_course_password_notice").html("课程密码不能为空");
|
|
|
|
$("#"+str+"_course_course_password_notice").html("课程密码不能为空");
|
|
|
|
$("#course_course_password_notice").show();
|
|
|
|
$("#"+str+"_course_course_password_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (regex.test(class_period)) {
|
|
|
|
else if (regex.test(class_period)) {
|
|
|
|
$("#course_course_password_notice").html("");
|
|
|
|
$("#"+str+"_course_course_password_notice").html("");
|
|
|
|
$("#course_course_password_notice").hide();
|
|
|
|
$("#"+str+"_course_course_password_notice").hide();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#course_course_password_notice").html("课程密码有非法字符");
|
|
|
|
$("#"+str+"_course_course_password_notice").html("课程密码有非法字符");
|
|
|
|
$("#course_course_password_notice").show();
|
|
|
|
$("#"+str+"_course_course_password_notice").show();
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//提交新建课程
|
|
|
|
//提交新建课程
|
|
|
|
function submit_new_course()
|
|
|
|
function submit_new_course()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
|
|
|
if(regex_course_name('new')&®ex_course_class_period('new')&®ex_time_term('new')&®ex_course_password('new'))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#new_course").submit();
|
|
|
|
$("#new_course").submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -193,7 +193,7 @@ function submit_new_course()
|
|
|
|
|
|
|
|
|
|
|
|
function submit_edit_course(id)
|
|
|
|
function submit_edit_course(id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
|
|
|
if(regex_course_name('edit')&®ex_course_class_period('edit')&®ex_time_term('edit')&®ex_course_password('edit'))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$("#edit_course_"+id).submit();
|
|
|
|
$("#edit_course_"+id).submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|