2015-03-25 20:38:07 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////
|
2015-03-26 11:30:00 +08:00
|
|
|
|
//添加分班
|
|
|
|
|
function add_group(url,course_id) {
|
|
|
|
|
var group_name = $('#group_name').val();
|
2015-03-25 20:38:07 +08:00
|
|
|
|
$.get(
|
2015-03-26 11:30:00 +08:00
|
|
|
|
url,
|
2015-03-25 20:38:07 +08:00
|
|
|
|
{ valid: "name",
|
2015-03-26 11:30:00 +08:00
|
|
|
|
value: group_name,
|
2015-03-25 20:38:07 +08:00
|
|
|
|
course_id: course_id },
|
|
|
|
|
function (data) {
|
2015-03-26 11:30:00 +08:00
|
|
|
|
if (data.valid) {
|
|
|
|
|
$("#add_group_name").submit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-03-25 20:38:07 +08:00
|
|
|
|
alert(data.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-26 11:30:00 +08:00
|
|
|
|
);
|
2015-03-25 20:38:07 +08:00
|
|
|
|
}
|
2015-03-26 11:30:00 +08:00
|
|
|
|
//修改分班:修改分班时得考虑什么都不改但是点击确定的情况
|
|
|
|
|
function edit_group(id,url,course_id,group_id)
|
|
|
|
|
{
|
|
|
|
|
var group_name = $('#'+id).val();
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
valid: "name",
|
|
|
|
|
value: group_name,
|
|
|
|
|
course_id: course_id,
|
|
|
|
|
group_id: group_id
|
|
|
|
|
},
|
|
|
|
|
function (data) {
|
|
|
|
|
if (data.valid) {
|
|
|
|
|
$("#update_group_"+group_id).submit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alert(data.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2015-03-25 20:38:07 +08:00
|
|
|
|
}
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
|
2015-03-23 17:18:58 +08:00
|
|
|
|
//验证搜索时输入名字
|
2015-03-17 18:02:46 +08:00
|
|
|
|
function regexName(content)
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#name").val());
|
|
|
|
|
if(name.length == 0)
|
|
|
|
|
{
|
|
|
|
|
$("#project_name_span").text(content);
|
|
|
|
|
$("#project_name_span").css('color','#ff0000');
|
|
|
|
|
$("#project_name_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#project_name_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-23 17:18:58 +08:00
|
|
|
|
//提交搜索
|
2015-03-17 18:02:46 +08:00
|
|
|
|
function submitSerch(content)
|
|
|
|
|
{
|
|
|
|
|
if(regexName(content)){$("#course_search_form").submit();}
|
2015-03-18 15:18:06 +08:00
|
|
|
|
}
|
2015-03-23 17:18:58 +08:00
|
|
|
|
//课程描述显示更多信息
|
2015-03-18 15:18:06 +08:00
|
|
|
|
function show_more_msg()
|
|
|
|
|
{
|
|
|
|
|
$("#course_description").toggleClass("course_description_none");
|
2015-03-19 11:42:52 +08:00
|
|
|
|
}
|
2015-03-23 17:18:58 +08:00
|
|
|
|
//作业描述显示更多信息
|
2015-03-23 17:36:50 +08:00
|
|
|
|
function news_show_more_des(id)
|
|
|
|
|
{
|
|
|
|
|
$('#news_description_' + id).toggleClass("news_description_none");
|
|
|
|
|
}
|
2015-03-20 11:37:56 +08:00
|
|
|
|
function bid_show_more_des(id)
|
|
|
|
|
{
|
|
|
|
|
$("#bid_description_" + id).toggleClass("news_description_none");
|
|
|
|
|
}
|
2015-03-25 14:34:20 +08:00
|
|
|
|
|
2015-03-23 17:18:58 +08:00
|
|
|
|
//课程作业结束时间倒计时
|
2015-03-24 09:57:55 +08:00
|
|
|
|
function show_bid_dead_line(year,month,day,divname)
|
2015-03-19 17:28:36 +08:00
|
|
|
|
{
|
|
|
|
|
var now = new Date();
|
|
|
|
|
var endDate = new Date(year, month-1, day);
|
|
|
|
|
var leftTime=endDate.getTime()-now.getTime();
|
|
|
|
|
var leftsecond = parseInt(leftTime/1000);
|
|
|
|
|
var day1=Math.floor(leftsecond/(60*60*24));
|
|
|
|
|
var hour=Math.floor((leftsecond-day1*24*60*60)/3600);
|
|
|
|
|
var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60);
|
|
|
|
|
var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60);
|
2015-03-24 09:57:55 +08:00
|
|
|
|
$("#"+divname).html("<form name='formnow' class='fr'>"
|
|
|
|
|
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+day1+"' > 天"
|
|
|
|
|
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+hour+"' > 小时"
|
|
|
|
|
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+minute+"' > 分"
|
|
|
|
|
+ "<input class='c_orange' type='text' style='border:0;' size='1' value='"+second+"' > 秒"
|
|
|
|
|
+ "</form>"
|
|
|
|
|
+ "<p class='fr'>作业提交还剩:</p>");
|
2015-03-23 17:18:58 +08:00
|
|
|
|
}
|
|
|
|
|
//验证新建作业的名字
|
|
|
|
|
function regex_bid_name()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#bid_name").val());
|
|
|
|
|
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#bid_name_span").text("名称不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#bid_name_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-24 16:26:54 +08:00
|
|
|
|
|
|
|
|
|
//验证匿评数量
|
2015-03-23 17:18:58 +08:00
|
|
|
|
function regex_evaluation_num()
|
|
|
|
|
{
|
|
|
|
|
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
|
|
|
|
var regex = /^\d+$/;
|
|
|
|
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
|
|
|
|
{
|
|
|
|
|
if(evaluation_num=="")
|
|
|
|
|
{
|
|
|
|
|
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(regex.test(evaluation_num))
|
|
|
|
|
{
|
|
|
|
|
if(evaluation_num > 0)
|
|
|
|
|
{
|
|
|
|
|
$("#bid_evaluation_num_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-24 16:26:54 +08:00
|
|
|
|
//点击是否开启匿评单选框效果
|
2015-03-23 17:18:58 +08:00
|
|
|
|
$(function(){
|
|
|
|
|
$("#bid_open_anonymous_evaluation").click(function(){
|
|
|
|
|
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
|
|
|
|
{
|
|
|
|
|
$("#bid_evaluation_num").slideDown();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#bid_evaluation_num").slideUp();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-03-24 16:26:54 +08:00
|
|
|
|
//老师提交新建作业
|
2015-03-23 18:40:58 +08:00
|
|
|
|
function submit_new_bid(id)
|
2015-03-23 17:18:58 +08:00
|
|
|
|
{
|
|
|
|
|
if(regex_bid_name()&®ex_evaluation_num())
|
|
|
|
|
{
|
2015-03-23 18:40:58 +08:00
|
|
|
|
$("#"+id).submit();
|
2015-03-23 17:18:58 +08:00
|
|
|
|
}
|
2015-03-24 17:12:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function show_window (id1,id2,top,left) {
|
|
|
|
|
$('#'+ id1).css('top',top);
|
|
|
|
|
$('#'+ id1).css('left',left);
|
|
|
|
|
$('#'+ id1).css('display','block');
|
|
|
|
|
$('#' + id2).css('display','block');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function close_window(id1,id2){
|
|
|
|
|
$('#' + id1).css('display','none');
|
|
|
|
|
$('#' + id2).css('display','none');
|
|
|
|
|
}
|
2015-03-24 17:14:08 +08:00
|
|
|
|
|
2015-03-24 16:26:54 +08:00
|
|
|
|
//隐藏提示狂
|
|
|
|
|
function hidden_atert_form(cur_page,cur_type)
|
|
|
|
|
{
|
|
|
|
|
hideModal($("#popbox"));
|
2015-03-25 14:09:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-25 14:34:20 +08:00
|
|
|
|
//当课程描述长度小于112px时,不显示更多按钮
|
2015-03-25 14:09:44 +08:00
|
|
|
|
$(function(){
|
|
|
|
|
if($("#course_description_content").height()>112)
|
|
|
|
|
{
|
|
|
|
|
$("#lg-foot").show();
|
|
|
|
|
}
|
2015-03-25 14:34:20 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//将右侧的最小高度设置成左侧高度,美化界面
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
$("#RSide").css("min-height",$("#LSide").height()-30);
|
2015-03-25 14:09:44 +08:00
|
|
|
|
});
|