2015-04-07 12:48:47 +08:00
|
|
|
|
//配置课程信息
|
|
|
|
|
function course_setting(id)
|
|
|
|
|
{
|
|
|
|
|
//alert(id);
|
2015-11-17 17:34:50 +08:00
|
|
|
|
//$('#tb_'+id).removeClass().addClass("hwork_hovertab");
|
|
|
|
|
//$('#tbc_0'+id).removeClass().addClass("dis");
|
|
|
|
|
//$('#tb_'+(3-id)).removeClass().addClass("hwork_normaltab");
|
|
|
|
|
//$('#tbc_0'+(3-id)).removeClass().addClass("undis");
|
|
|
|
|
for (var i = 1; i < 4; i++) {
|
|
|
|
|
if (i == id) {
|
|
|
|
|
$("#tb_" + i).removeClass().addClass("hwork_hovertab");
|
|
|
|
|
$("#tbc_0" + i).removeClass().addClass("dis");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("#tb_" + i).removeClass().addClass("hwork_normaltab");
|
|
|
|
|
$("#tbc_0" + i).removeClass().addClass("undis");
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-08 15:31:13 +08:00
|
|
|
|
$(function(){
|
|
|
|
|
$("img").removeAttr("align");
|
|
|
|
|
});
|
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
//添加分班
|
|
|
|
|
function add_group(url,course_id) {
|
|
|
|
|
var group_name = $('#group_name').val();
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{ valid: "name",
|
|
|
|
|
value: group_name,
|
|
|
|
|
course_id: course_id },
|
|
|
|
|
function (data) {
|
|
|
|
|
if (data.valid) {
|
|
|
|
|
$("#add_group_name").submit();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alert(data.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
//修改分班:修改分班时得考虑什么都不改但是点击确定的情况
|
|
|
|
|
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-04-22 11:11:51 +08:00
|
|
|
|
|
|
|
|
|
function hidden_homework_score_form()
|
|
|
|
|
{
|
|
|
|
|
hideModal($("#user_score"));
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
///////////////////////////////////////////////////////////////新建课程相关
|
|
|
|
|
//验证课程名称
|
|
|
|
|
function regex_course_name()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#course_name").val());
|
|
|
|
|
if(name.length == 0)
|
|
|
|
|
{
|
|
|
|
|
$("#course_name_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#course_name_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//验证课程学时
|
|
|
|
|
function regex_course_class_period()
|
|
|
|
|
{
|
|
|
|
|
var class_period = $.trim($("#class_period").val());
|
|
|
|
|
var regex = /^\d*$/;
|
|
|
|
|
if(class_period.length == 0)
|
|
|
|
|
{
|
|
|
|
|
$("#course_class_period_notice").html("学时总数不能为空");
|
|
|
|
|
$("#course_class_period_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (regex.test(class_period)) {
|
2015-04-17 15:07:01 +08:00
|
|
|
|
if(parseInt(class_period) > 0)
|
|
|
|
|
{
|
|
|
|
|
$("#course_class_period_notice").html("");
|
|
|
|
|
$("#course_class_period_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#course_class_period_notice").html("学时总数必须大于0");
|
|
|
|
|
$("#course_class_period_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#course_class_period_notice").html("学时总数必须为数字");
|
|
|
|
|
$("#course_class_period_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-31 11:12:09 +08:00
|
|
|
|
//验证开始学期和结束学期
|
|
|
|
|
function regex_time_term(){
|
|
|
|
|
var obj_time = document.getElementById("time");
|
|
|
|
|
var obj_end_time = document.getElementById("end_time");
|
|
|
|
|
var obj_term = document.getElementById("term");
|
|
|
|
|
var obj_end_term = document.getElementById("end_term");
|
|
|
|
|
var time = obj_time.options[obj_time.selectedIndex];
|
|
|
|
|
var end_time = obj_end_time.options[obj_end_time.selectedIndex];
|
|
|
|
|
var term = obj_term.options[obj_term.selectedIndex];
|
|
|
|
|
var end_term = obj_end_term.options[obj_end_term.selectedIndex];
|
|
|
|
|
if(time.value == end_time.value) {
|
|
|
|
|
if(set_term_val(term.value) > set_term_val(end_term.value)) {
|
|
|
|
|
$("#course_time_term_notice").html("开始学期不能晚于结束学期");
|
|
|
|
|
$("#course_time_term_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
$("#course_time_term_notice").html("");
|
|
|
|
|
$("#course_time_term_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else if(time.value < end_time.value) {
|
|
|
|
|
$("#course_time_term_notice").html("");
|
|
|
|
|
$("#course_time_term_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
$("#course_time_term_notice").html("开始学期不能晚于结束学期");
|
|
|
|
|
$("#course_time_term_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//学期转换为数字
|
|
|
|
|
function set_term_val(val) {
|
|
|
|
|
if(val == "春季学期"){
|
|
|
|
|
return 1;
|
|
|
|
|
} else if(val == "夏季学期"){
|
|
|
|
|
return 2;
|
|
|
|
|
} else if(val == "秋季学期"){
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-17 15:07:01 +08:00
|
|
|
|
//验证密码
|
|
|
|
|
function regex_course_password()
|
|
|
|
|
{
|
|
|
|
|
var class_period = $.trim($("#course_course_password").val());
|
|
|
|
|
var regex = /^\w+$/;
|
|
|
|
|
if(class_period.length == 0)
|
|
|
|
|
{
|
|
|
|
|
$("#course_course_password_notice").html("课程密码不能为空");
|
|
|
|
|
$("#course_course_password_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (regex.test(class_period)) {
|
|
|
|
|
$("#course_course_password_notice").html("");
|
|
|
|
|
$("#course_course_password_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#course_course_password_notice").html("课程密码有非法字符");
|
|
|
|
|
$("#course_course_password_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
//提交新建课程
|
|
|
|
|
function submit_new_course()
|
|
|
|
|
{
|
2015-12-31 11:12:09 +08:00
|
|
|
|
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
2015-04-07 12:48:47 +08:00
|
|
|
|
{
|
|
|
|
|
$("#new_course").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submit_edit_course(id)
|
|
|
|
|
{
|
2016-01-22 15:17:11 +08:00
|
|
|
|
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
2015-04-07 12:48:47 +08:00
|
|
|
|
{
|
|
|
|
|
$("#edit_course_"+id).submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-15 16:17:48 +08:00
|
|
|
|
//课程讨论区
|
|
|
|
|
function regexTopicSubject() {
|
|
|
|
|
var name = $("#message_subject").val();
|
|
|
|
|
if(name.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#subjectmsg").text("标题不能为空");
|
|
|
|
|
$("#subjectmsg").css('color','#ff0000');
|
|
|
|
|
$("#message_subject").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.length <= 255)
|
|
|
|
|
{
|
|
|
|
|
$("#subjectmsg").text("填写正确");
|
|
|
|
|
$("#subjectmsg").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#subjectmsg").text("标题超过255个字符");
|
|
|
|
|
$("#subjectmsg").css('color','#ff0000');
|
|
|
|
|
$("#message_subject").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regexTopicDescription()
|
|
|
|
|
{
|
|
|
|
|
var name = message_content_editor.html();
|
2015-11-04 11:03:45 +08:00
|
|
|
|
if(message_content_editor.isEmpty())
|
2015-10-15 16:17:48 +08:00
|
|
|
|
{
|
|
|
|
|
$("#message_content_span").text("描述不能为空");
|
|
|
|
|
$("#message_content_span").css('color','#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.length >=6000){
|
|
|
|
|
$("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)");
|
|
|
|
|
$("#message_content_span").css('color','#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#message_content_span").text("填写正确");
|
|
|
|
|
$("#message_content_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submit_topic()
|
|
|
|
|
{
|
|
|
|
|
if(regexTopicSubject() && regexTopicDescription())
|
|
|
|
|
{
|
|
|
|
|
message_content_editor.sync();
|
|
|
|
|
$("#message-form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reset_topic(){
|
|
|
|
|
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
//////////////////////////////////////////////////////////////课程讨论区
|
2015-05-14 15:11:20 +08:00
|
|
|
|
function regexSubject(id) {
|
|
|
|
|
var subjectid = "#message_subject" + id ;
|
|
|
|
|
var content = $.trim($(subjectid).val());
|
|
|
|
|
var message = "#subject_span" + id;
|
|
|
|
|
if (content.length == 0) {
|
|
|
|
|
$(message).text("主题不能为空");
|
|
|
|
|
$(message).css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-05-14 15:11:20 +08:00
|
|
|
|
else {
|
|
|
|
|
$(message).text("填写正确");
|
|
|
|
|
$(message).css('color', '#008000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-05-14 15:11:20 +08:00
|
|
|
|
function regexContent(id) {
|
|
|
|
|
var contentid = "#message_content" + id;
|
|
|
|
|
var message = "#message_content_span"+ id;
|
|
|
|
|
var content = $.trim($(contentid).val());
|
|
|
|
|
if (content.length == 0) {
|
|
|
|
|
$(message).text("描述不能为空");
|
|
|
|
|
$(message).css('color', '#ff0000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-05-14 15:11:20 +08:00
|
|
|
|
else {
|
|
|
|
|
$(message).text("填写正确");
|
|
|
|
|
$(message).css('color', '#008000');
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-05-14 15:11:20 +08:00
|
|
|
|
|
|
|
|
|
// 项目讨论区编辑和提交
|
|
|
|
|
function submitProjectsBoard(id) {
|
|
|
|
|
var formid = "#message-form" + id;
|
|
|
|
|
if (regexSubject(id) && regexContent(id)) {
|
|
|
|
|
$(formid).submit();
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
2015-05-14 15:11:20 +08:00
|
|
|
|
|
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////// 课程通知
|
|
|
|
|
function regexTitle()
|
|
|
|
|
{
|
|
|
|
|
var name = $("#news_title").val();
|
|
|
|
|
if(name.length ==0)
|
|
|
|
|
{
|
|
|
|
|
$("#title_notice_span").text("标题不能为空");
|
|
|
|
|
$("#title_notice_span").css('color','#ff0000');
|
2015-04-16 10:26:03 +08:00
|
|
|
|
$("#news_title").focus();
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.length <= 60)
|
|
|
|
|
{
|
|
|
|
|
$("#title_notice_span").text("填写正确");
|
|
|
|
|
$("#title_notice_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#title_notice_span").text("标题超过60个字符");
|
|
|
|
|
$("#title_notice_span").css('color','#ff0000');
|
2015-04-16 10:26:03 +08:00
|
|
|
|
$("#news_title").focus();
|
2015-04-07 12:48:47 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regexDescription()
|
|
|
|
|
{
|
2015-04-09 09:22:09 +08:00
|
|
|
|
var name = news_description_editor.html();
|
2015-11-04 10:13:25 +08:00
|
|
|
|
if(news_description_editor.isEmpty())
|
2015-04-07 12:48:47 +08:00
|
|
|
|
{
|
|
|
|
|
$("#description_notice_span").text("描述不能为空");
|
|
|
|
|
$("#description_notice_span").css('color','#ff0000');
|
|
|
|
|
$("#description_notice_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-12-21 13:20:09 +08:00
|
|
|
|
/*else if(name.length >=6000){
|
2015-04-09 09:22:09 +08:00
|
|
|
|
$("#description_notice_span").text("描述最多3000个汉字(或6000个英文字符)");
|
|
|
|
|
$("#description_notice_span").css('color','#ff0000');
|
|
|
|
|
$("#description_notice_span").focus();
|
|
|
|
|
return false;
|
2015-12-21 13:20:09 +08:00
|
|
|
|
}*/
|
2015-04-07 12:48:47 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#description_notice_span").text("填写正确");
|
|
|
|
|
$("#description_notice_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-16 10:26:03 +08:00
|
|
|
|
function submitNews()
|
2015-04-07 12:48:47 +08:00
|
|
|
|
{
|
|
|
|
|
if(regexTitle() && regexDescription())
|
|
|
|
|
{
|
2015-04-09 09:22:09 +08:00
|
|
|
|
news_description_editor.sync();
|
2015-04-07 12:48:47 +08:00
|
|
|
|
$("#news-form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submitFocus(obj)
|
|
|
|
|
{
|
|
|
|
|
$(obj).focus();
|
|
|
|
|
}
|
2015-04-09 09:22:09 +08:00
|
|
|
|
|
2015-04-16 10:26:03 +08:00
|
|
|
|
function submitComment()
|
|
|
|
|
{
|
2015-09-15 15:45:16 +08:00
|
|
|
|
if (newsReplyVerify()) {
|
|
|
|
|
comment_editor.sync();
|
|
|
|
|
$("#add_comment_form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function newsReplyVerify() {
|
|
|
|
|
var content = comment_editor.html();
|
2015-11-04 11:03:45 +08:00
|
|
|
|
if(comment_editor.isEmpty()) {
|
2015-09-15 15:45:16 +08:00
|
|
|
|
$("#add_reply_news").text("评论不能为空");
|
|
|
|
|
$("#add_reply_news").css('color', '#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
$("#add_reply_news").text("填写正确");
|
|
|
|
|
$("#add_reply_news").css('color', '#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2015-04-16 10:26:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-09 09:22:09 +08:00
|
|
|
|
/////////////////////////////////////////////////课程讨论区
|
|
|
|
|
function course_board_submit_message_replay()
|
|
|
|
|
{
|
|
|
|
|
if(MessageReplayVevify())
|
|
|
|
|
{
|
|
|
|
|
message_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
|
|
|
|
$("#message_form").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-08 14:55:56 +08:00
|
|
|
|
|
|
|
|
|
function course_board_canel_message_replay()
|
|
|
|
|
{
|
|
|
|
|
$("#reply").hide(200);
|
|
|
|
|
$("#message_quote").html("");
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-09 09:22:09 +08:00
|
|
|
|
function MessageReplayVevify() {
|
|
|
|
|
var content = message_content_editor.html();//$.trim($("#message_content").val());
|
2015-11-04 11:03:45 +08:00
|
|
|
|
if (message_content_editor.isEmpty()) {
|
2015-04-16 10:26:03 +08:00
|
|
|
|
$("#message_content_span").text("回复不能为空");
|
2015-04-09 09:22:09 +08:00
|
|
|
|
$("#message_content_span").css('color', '#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2015-04-16 10:26:03 +08:00
|
|
|
|
$("#message_content_span").text("填写正确");
|
2015-04-09 09:22:09 +08:00
|
|
|
|
$("#message_content_span").css('color', '#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
|
2015-04-07 12:48:47 +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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//提交搜索
|
|
|
|
|
function submitSerch(content)
|
|
|
|
|
{
|
|
|
|
|
if(regexName(content)){$("#course_search_form").submit();}
|
|
|
|
|
}
|
2015-04-17 15:07:01 +08:00
|
|
|
|
|
|
|
|
|
//验证搜索时输入名字
|
|
|
|
|
function regexQ(content)
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#q").val());
|
|
|
|
|
if(name.length == 0)
|
|
|
|
|
{
|
|
|
|
|
$("#course_member_name_span").text(content);
|
|
|
|
|
$("#course_member_name_span").css('color','#ff0000');
|
|
|
|
|
$("#course_member_name_span").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#course_member_name_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//提交课程成员搜索
|
|
|
|
|
function submitMemberSerch(content)
|
|
|
|
|
{
|
|
|
|
|
//if(regexQ(content)){$("#course_member_search_form").submit();}
|
|
|
|
|
$("#course_member_search_form").submit();
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
//课程描述显示更多信息
|
|
|
|
|
function show_more_msg()
|
|
|
|
|
{
|
|
|
|
|
$("#course_description").toggleClass("course_description_none");
|
|
|
|
|
}
|
|
|
|
|
//作业描述显示更多信息
|
|
|
|
|
function news_show_more_des(id)
|
|
|
|
|
{
|
|
|
|
|
$('#news_description_' + id).toggleClass("news_description_none");
|
2015-06-10 16:39:28 +08:00
|
|
|
|
if($("#news_description_" + id).hasClass("news_description_none"))
|
|
|
|
|
{
|
|
|
|
|
$("#news_foot_" + id).html("[收起]");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#news_foot_" + id).html("[展开]");
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
|
|
|
|
function bid_show_more_des(id)
|
|
|
|
|
{
|
|
|
|
|
$("#bid_description_" + id).toggleClass("news_description_none");
|
2015-06-10 16:37:18 +08:00
|
|
|
|
if($("#bid_description_" + id).hasClass("news_description_none"))
|
|
|
|
|
{
|
|
|
|
|
$("#bid_show_more_des_button" + id).html("[收起]");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#bid_show_more_des_button" + id).html("[展开]");
|
|
|
|
|
}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//课程作业结束时间倒计时
|
|
|
|
|
function show_bid_dead_line(year,month,day,divname)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
$("#"+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>"
|
2015-04-22 11:11:51 +08:00
|
|
|
|
+ "<p class='fr'>作品提交还剩:</p>");
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
2015-06-16 10:39:42 +08:00
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
|
2015-09-17 20:20:20 +08:00
|
|
|
|
//处理迟交、缺评扣分
|
|
|
|
|
function check_late_penalty(id)
|
2015-08-14 15:44:54 +08:00
|
|
|
|
{
|
2015-09-17 20:20:20 +08:00
|
|
|
|
var obj = $("#" + id);
|
2015-08-14 15:44:54 +08:00
|
|
|
|
var regex = /^\d+$/;
|
|
|
|
|
if(regex.test(obj.val()))
|
|
|
|
|
{
|
|
|
|
|
if(obj.val() > 50)
|
|
|
|
|
{
|
|
|
|
|
obj.val("50");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
obj.val("0");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-07 12:48:47 +08:00
|
|
|
|
//验证匿评数量
|
2015-09-29 14:23:50 +08:00
|
|
|
|
//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("每个学生将收到<span class='c_red'> "+ parseInt(evaluation_num) + " </span>份待匿评作品");
|
|
|
|
|
// $("#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;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2015-04-07 12:48:47 +08:00
|
|
|
|
|
|
|
|
|
//点击是否开启匿评单选框效果
|
|
|
|
|
$(function(){
|
2015-05-20 15:43:55 +08:00
|
|
|
|
$("#absence_penalty").change(function(){
|
|
|
|
|
$("#absence_penalty_notice").html(" "+ $("#absence_penalty").val() +" ");
|
|
|
|
|
});
|
2015-04-07 12:48:47 +08:00
|
|
|
|
});
|
2015-09-17 20:20:20 +08:00
|
|
|
|
|
|
|
|
|
//生成select
|
|
|
|
|
function build_selector(max_num){
|
|
|
|
|
var html = "<select class='markPercentage' id='ta_proportion' name='ta_proportion'>";
|
|
|
|
|
for(var i = 0; i <= max_num; i += 10){
|
|
|
|
|
if( i == max_num){
|
|
|
|
|
html += "<option value='" + parseFloat(i)/100 + "' selected='selected'>" + i + "%</option>";
|
|
|
|
|
}else{
|
|
|
|
|
html += "<option value='" + parseFloat(i)/100 + "'>" + i + "%</option>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
html += "</select>";
|
|
|
|
|
return html;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-29 14:23:50 +08:00
|
|
|
|
//提交匿评参数设置
|
|
|
|
|
function submit_set_evaluation_attr(end_time){
|
|
|
|
|
if(!regex_evaluation_start(end_time)){
|
|
|
|
|
$("#evaluation_start_time").focus();
|
2015-06-05 16:57:09 +08:00
|
|
|
|
}
|
2015-09-29 14:23:50 +08:00
|
|
|
|
else if(!regex_evaluation_end()){
|
|
|
|
|
$("#evaluation_end_time").focus();
|
|
|
|
|
}
|
|
|
|
|
else if(!regex_evaluation_num()){
|
2015-06-05 16:57:09 +08:00
|
|
|
|
$("#evaluation_num").focus();
|
|
|
|
|
}
|
2015-09-29 14:23:50 +08:00
|
|
|
|
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;
|
2015-04-07 12:48:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-29 14:23:50 +08:00
|
|
|
|
//验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
|
|
|
|
|
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);
|
2015-12-14 17:03:20 +08:00
|
|
|
|
if(evaluation_end_time >= evaluation_start_time){
|
2015-09-29 14:23:50 +08:00
|
|
|
|
$("#homework_evaluation_end_time").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}else{
|
2015-12-14 17:03:20 +08:00
|
|
|
|
$("#homework_evaluation_end_time").text("关闭匿评日期不能小于开启匿评日期");
|
2015-09-29 14:23:50 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//老师提交 新建/修改 作业
|
2015-09-29 17:10:16 +08:00
|
|
|
|
function submit_homework(id){
|
|
|
|
|
if(!regex_homework_name()){
|
|
|
|
|
$("#homework_name").focus();
|
|
|
|
|
}
|
|
|
|
|
else if(!regex_homework_end_time()){
|
|
|
|
|
$("#homework_end_time").focus();
|
|
|
|
|
}
|
2015-10-30 13:58:54 +08:00
|
|
|
|
else if(!regex_homework_end_publish_time()){
|
|
|
|
|
$("#homework_end_time").focus();
|
|
|
|
|
}
|
2015-09-29 17:10:16 +08:00
|
|
|
|
else if(!regex_course_id()){
|
|
|
|
|
$("#course_id").focus();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
homework_description_editor.sync();
|
|
|
|
|
$("#"+id).submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证新建作业的名字
|
|
|
|
|
function regex_homework_name()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#homework_name").val());
|
|
|
|
|
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#homework_name_span").text("名称不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_name_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-30 13:58:54 +08:00
|
|
|
|
//验证发布时间不能大于截止时间
|
|
|
|
|
function regex_homework_end_publish_time()
|
|
|
|
|
{
|
|
|
|
|
var myDate = new Date();
|
|
|
|
|
if($.trim($("#homework_publish_time").val()) == "")
|
|
|
|
|
{
|
2015-11-06 09:56:37 +08:00
|
|
|
|
$("#homework_publish_time").val(formate_date(myDate));
|
2015-10-30 13:58:54 +08:00
|
|
|
|
}
|
|
|
|
|
var publish_time = Date.parse($("#homework_publish_time").val());
|
2015-11-02 09:49:58 +08:00
|
|
|
|
var end_time = Date.parse($("#homework_end_time").val());
|
2015-10-30 13:58:54 +08:00
|
|
|
|
if(end_time < publish_time)
|
|
|
|
|
{
|
|
|
|
|
$("#homework_end_time_span").text("截止日期不能小于发布日期");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_end_time_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-29 17:10:16 +08:00
|
|
|
|
//验证截止时间
|
|
|
|
|
function regex_homework_end_time()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#homework_end_time").val());
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#homework_end_time_span").text("截止时间不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_end_time_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-06 09:56:37 +08:00
|
|
|
|
function formate_date(date){
|
|
|
|
|
var str = "";
|
|
|
|
|
var year = date.getFullYear();
|
|
|
|
|
var month = date.getMonth() + 1;
|
|
|
|
|
var day = date.getDate();
|
|
|
|
|
if(month < 10) {
|
|
|
|
|
month = '0' + month;
|
|
|
|
|
}
|
|
|
|
|
if(day < 10) {
|
|
|
|
|
day = '0' + day;
|
|
|
|
|
}
|
|
|
|
|
str = year + '-' + month + '-' + day;
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-29 17:10:16 +08:00
|
|
|
|
//验证发送到课程
|
|
|
|
|
function regex_course_id(){
|
|
|
|
|
var course_id = $("#course_id").val();
|
|
|
|
|
if(course_id == -1)
|
|
|
|
|
{
|
|
|
|
|
$("#homework_course_id_span").text("发布课程不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_course_id_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-29 14:23:50 +08:00
|
|
|
|
|
2015-07-18 16:34:24 +08:00
|
|
|
|
function regexHomeworkCommonName()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#homework_attach_name").val());
|
|
|
|
|
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#homework_attach_name_span").text("作品名称不能为空");
|
|
|
|
|
$("#homework_attach_name_span").css('color','#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_attach_name_span").text("填写正确");
|
|
|
|
|
$("#homework_attach_name_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function regexHomeworkCommonDescription()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#homework_attach_description").val());
|
|
|
|
|
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#homework_attach_description_span").text("作品描述不能为空");
|
|
|
|
|
$("#homework_attach_description_span").css('color','#ff0000');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_attach_description_span").text("填写正确");
|
|
|
|
|
$("#homework_attach_description_span").css('color','#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submit_homework_form(){if(regexHomeworkCommonName()&®exHomeworkCommonDescription()){$('#new_homework_attach').submit();}}
|
|
|
|
|
|
2015-06-16 17:55:07 +08:00
|
|
|
|
//增加测试结果
|
|
|
|
|
function add_programing_test(obj) {
|
|
|
|
|
var now = new Date().getTime();
|
2015-07-30 17:27:42 +08:00
|
|
|
|
obj.after("<div><li><label class='label02'> 测试输入: </label><input type='text' class='fl h26 w190 mb10' name='input[" + now +"]'' />" +
|
|
|
|
|
"</li><li ><label class='fl f14 ml10'> 输出: </label><input type='text' class='fl h26 w190 mb10' name='output[" + now +"]' />" +
|
2015-06-16 17:55:07 +08:00
|
|
|
|
"</li><li><a class='icon_add ml10' href='javascript:void(0);' title='添加测试' onclick='add_programing_test($(this).parent().parent())'></a>" +
|
|
|
|
|
"<a class='icon_remove' href='javascript:void(0);' title='删除测试' onclick='remove_programing_test($(this).parent().parent())'></a>" +
|
2015-08-01 10:45:32 +08:00
|
|
|
|
"<a class='blue_btn fl ml5 mt1 programing_test' onclick='programing_test("+ now +")' id='test_send_" + now + "'>测试</a>" +
|
2015-07-30 21:02:04 +08:00
|
|
|
|
"<input type='hidden' id='test_result_" + now +"' name='result[" + now +"]'/>" +
|
2015-07-18 16:34:24 +08:00
|
|
|
|
"</li><div class='cl'></div></div>");
|
2015-06-16 17:55:07 +08:00
|
|
|
|
}
|
|
|
|
|
//删除测试结果
|
|
|
|
|
function remove_programing_test(obj) {
|
|
|
|
|
if(obj.siblings("div").length == 0){
|
|
|
|
|
alert("至少需要一组测试");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
obj.remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-07 12:48:47 +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');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//隐藏提示狂
|
|
|
|
|
function hidden_atert_form(cur_page,cur_type)
|
|
|
|
|
{
|
|
|
|
|
hideModal($("#popbox"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//当课程描述长度小于112px时,不显示更多按钮
|
|
|
|
|
$(function(){
|
2015-12-30 16:27:56 +08:00
|
|
|
|
if($("#course_description_content").height()>400)
|
2015-04-07 12:48:47 +08:00
|
|
|
|
{
|
|
|
|
|
$("#lg-foot").show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-04-16 10:26:03 +08:00
|
|
|
|
//将右侧的最小高度设置成左侧高度,美化界面
|
|
|
|
|
// firefox pre标签换行
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
$("#RSide").css("min-height",$("#LSide").height()-30);
|
|
|
|
|
var userAgent = navigator.userAgent.toLowerCase();
|
|
|
|
|
var browser = {
|
|
|
|
|
version: (userAgent.match(/.+(?:rv|it|ra|ie)[/: ]([d.]+)/) || [])[1],
|
|
|
|
|
safari: /webkit/.test(userAgent),
|
|
|
|
|
opera: /opera/.test(userAgent),
|
|
|
|
|
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
|
|
|
|
|
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
|
|
|
|
|
};
|
|
|
|
|
if (browser.mozilla || browser.opera){
|
|
|
|
|
$("pre").addClass("break_word_firefox");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$("pre").addClass("break_word");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2015-04-09 09:22:09 +08:00
|
|
|
|
// 日历选择日期后关闭
|
|
|
|
|
function regexDeadLine()
|
|
|
|
|
{
|
2015-09-29 14:23:50 +08:00
|
|
|
|
('#ui-datepicker-div').hide();
|
2015-04-16 10:26:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//新建、修改课程明码显示
|
|
|
|
|
$(function(){
|
|
|
|
|
$("#psw_btn").click(function() {
|
|
|
|
|
alert("密码: "+$("#course_course_password").val());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//查找TAG资源
|
2015-10-08 11:08:26 +08:00
|
|
|
|
var clickFunction = null; //单击事件函数
|
|
|
|
|
var isdb = false; //是否双击
|
2015-04-16 10:26:03 +08:00
|
|
|
|
function search_tag_attachment(url,tag_name,q,course_id,sort)
|
|
|
|
|
{
|
2015-05-08 16:14:46 +08:00
|
|
|
|
//alert("111");
|
2015-10-08 11:08:26 +08:00
|
|
|
|
//clearTimeout(clickFunction);
|
|
|
|
|
clickFunction = setTimeout(function() {
|
|
|
|
|
search_func()
|
2015-10-08 13:51:55 +08:00
|
|
|
|
}, 500);
|
2015-10-08 11:08:26 +08:00
|
|
|
|
function search_func(){
|
|
|
|
|
if(isdb!= false ) return;
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
tag_name: tag_name,
|
|
|
|
|
q: q,
|
|
|
|
|
course_id:course_id
|
|
|
|
|
},
|
|
|
|
|
function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-04-16 10:26:03 +08:00
|
|
|
|
|
|
|
|
|
}
|
2015-05-08 09:55:19 +08:00
|
|
|
|
|
|
|
|
|
// 课程讨论区
|
|
|
|
|
function showhelpAndScrollToMessage(id, id1, count) {
|
|
|
|
|
$('#' + id).toggle();
|
|
|
|
|
if(cookieget("repositories_visiable") == "true")
|
|
|
|
|
{
|
|
|
|
|
cookiesave("repositories_visiable", false,'','','');
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cookiesave("repositories_visiable", true,'','','');
|
|
|
|
|
}
|
|
|
|
|
var information = $(id1);
|
|
|
|
|
var val = information.attr("value");
|
|
|
|
|
if(val=="show_help")
|
|
|
|
|
{
|
|
|
|
|
$(id1).text("收起回复(" + count + ")" );
|
|
|
|
|
information.attr("value", "hide_help");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$(id1).text("展开回复(" + count + ")");
|
|
|
|
|
information.attr("value", "show_help");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function show_more_reply(contentid, id2, id3) {
|
|
|
|
|
$(contentid).toggleClass("course_description_none");
|
|
|
|
|
var information = $(id2);
|
|
|
|
|
var arrow = $(id3);
|
|
|
|
|
var val = information.attr("value");
|
|
|
|
|
if (val == "show_more") {
|
|
|
|
|
$(id2).text("[收起]");
|
|
|
|
|
information.attr("value", "hide_more");
|
|
|
|
|
arrow.attr("src", "/images/jiantouup.jpg")
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$(id2).text("[展开]");
|
|
|
|
|
information.attr("value", "show_more");
|
|
|
|
|
arrow.attr("src", "/images/jiantou.jpg")
|
|
|
|
|
}
|
2015-05-21 11:58:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////
|
|
|
|
|
//学生作品
|
|
|
|
|
function show_project()
|
|
|
|
|
{
|
|
|
|
|
$("#about_project").slideToggle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证作品名称
|
|
|
|
|
function regexStudentWorkName()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#student_work_name").val());
|
|
|
|
|
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#student_work_name_span").text("作品名称不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#student_work_name_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regexStudentWorkDescription()
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#student_work_description").val());
|
|
|
|
|
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#student_work_description_textarea").text("作品描述不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#student_work_description_textarea").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-11 14:57:09 +08:00
|
|
|
|
function regexStudentWorkMember(min, max) {
|
|
|
|
|
var members = $.trim($("#group_member_ids").val()).split(',');
|
|
|
|
|
if ( min <= members.length && members.length <= max ){
|
|
|
|
|
$("#student_work_group_textarea").text("");
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
$("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-21 11:58:34 +08:00
|
|
|
|
//提交新建作品
|
|
|
|
|
function new_student_work()
|
|
|
|
|
{
|
|
|
|
|
if(regexStudentWorkName()&®exStudentWorkDescription())
|
2015-11-09 11:16:19 +08:00
|
|
|
|
{
|
2015-12-11 14:57:09 +08:00
|
|
|
|
if($("#group_member_ids").length > 0) {
|
|
|
|
|
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
|
|
|
|
$("#new_student_work").submit();
|
|
|
|
|
$("#ajax-indicator").hide();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$("#new_student_work").submit();
|
|
|
|
|
$("#ajax-indicator").hide();
|
|
|
|
|
}
|
2015-11-09 11:16:19 +08:00
|
|
|
|
}
|
2015-05-21 15:52:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-28 17:09:38 +08:00
|
|
|
|
function edit_student_work(id)
|
|
|
|
|
{
|
|
|
|
|
if(regexStudentWorkName()&®exStudentWorkDescription())
|
2015-11-09 11:16:19 +08:00
|
|
|
|
{
|
|
|
|
|
$("#edit_student_work_" + id).submit();
|
|
|
|
|
$("#ajax-indicator").hide();
|
|
|
|
|
}
|
2015-05-28 17:09:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-25 15:55:57 +08:00
|
|
|
|
//
|
|
|
|
|
|
2015-05-21 15:52:27 +08:00
|
|
|
|
//滑动打分
|
|
|
|
|
$.fn.peSlider = function(settings){
|
|
|
|
|
//configurable options (none so far)
|
|
|
|
|
var o = $.extend({},settings);
|
|
|
|
|
if( !$('body').is('[role]') ){ $('body').attr('role','application'); }
|
|
|
|
|
return $(this).each(function(){
|
|
|
|
|
var thisLabel = $('label[for=' + $(this).attr('id') + ']').attr('id', $(this).attr('id') + '-label').attr('id');
|
|
|
|
|
var thisUnits = $(this).attr('data-units') || '';
|
|
|
|
|
var slider = $('<div></div>');
|
|
|
|
|
if( $(this).is('input') ){
|
|
|
|
|
var input = $(this);
|
|
|
|
|
var thisUnits = input.attr('data-units');
|
|
|
|
|
var friendlyVal = input.val() + ' ' + thisUnits;
|
|
|
|
|
var sliderOptions = $.extend(o,{
|
|
|
|
|
min: parseFloat(input.attr('min')),
|
|
|
|
|
max: parseFloat(input.attr('max')),
|
|
|
|
|
value: parseFloat(input.val())
|
|
|
|
|
});
|
|
|
|
|
slider
|
|
|
|
|
.insertBefore(input)
|
|
|
|
|
.slider(sliderOptions)
|
|
|
|
|
.bind('slide', function(e, ui){
|
|
|
|
|
input.val(ui.value);
|
|
|
|
|
friendlyVal = input.val() + ' ' + thisUnits;
|
|
|
|
|
slider.find('a').attr({
|
|
|
|
|
'aria-valuenow': ui.value,
|
2015-06-03 16:27:05 +08:00
|
|
|
|
'aria-valuetext': friendlyVal
|
2015-05-21 15:52:27 +08:00
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.find('a')
|
|
|
|
|
.attr({
|
|
|
|
|
'role': 'slider',
|
|
|
|
|
'aria-valuemin': input.attr('min'),
|
|
|
|
|
'aria-valuemax': input.attr('max'),
|
|
|
|
|
'aria-valuenow': input.val(),
|
|
|
|
|
'aria-valuetext': friendlyVal,
|
|
|
|
|
'aria-labelledby': thisLabel
|
|
|
|
|
});
|
|
|
|
|
input
|
|
|
|
|
.keyup(function(){
|
|
|
|
|
var inVal = parseFloat(input.val());
|
|
|
|
|
if( !isNaN(inVal) ){
|
|
|
|
|
slider.slider('value', inVal);
|
|
|
|
|
input.val(slider.slider('value'));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.change(function(){
|
|
|
|
|
var inVal = parseFloat(input.val());
|
|
|
|
|
if( !isNaN(inVal) ){
|
|
|
|
|
slider.slider('value', inVal);
|
|
|
|
|
input.val(slider.slider('value'));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.blur(function(){
|
|
|
|
|
var inVal = parseFloat(input.val());
|
|
|
|
|
if( isNaN(inVal) ){
|
|
|
|
|
input.val(0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if( !settings.step ){
|
|
|
|
|
var step = Math.round( parseFloat(input.attr('max')) / slider.width());
|
|
|
|
|
if(step > 1){ slider.slider('option','step',step); }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2015-05-21 17:17:54 +08:00
|
|
|
|
//返回顶部
|
|
|
|
|
$(function(){goTopEx();});
|
|
|
|
|
|
|
|
|
|
var Sys = {};
|
|
|
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
|
|
|
var s;
|
|
|
|
|
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
|
|
|
|
|
(s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
|
|
|
|
|
(s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
|
|
|
|
|
(s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
|
|
|
|
|
(s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
|
|
|
|
|
|
|
|
|
|
function goTopEx() {
|
|
|
|
|
var obj = document.getElementById("goTopBtn");
|
2015-05-27 09:29:27 +08:00
|
|
|
|
if(obj != null)
|
|
|
|
|
{
|
|
|
|
|
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
|
|
|
|
|
function getScrollTop() {
|
|
|
|
|
var xsun = document.documentElement.scrollTop;
|
|
|
|
|
if (Sys.chrome) {
|
|
|
|
|
xsun=document.body.scrollTop;
|
|
|
|
|
}
|
|
|
|
|
return xsun;
|
2015-05-21 17:17:54 +08:00
|
|
|
|
}
|
2015-05-27 09:29:27 +08:00
|
|
|
|
function setScrollTop(value) {
|
|
|
|
|
if (Sys.chrome) {
|
|
|
|
|
document.body.scrollTop = value;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
document.documentElement.scrollTop = value;
|
|
|
|
|
}
|
2015-05-21 17:17:54 +08:00
|
|
|
|
}
|
2015-05-27 09:29:27 +08:00
|
|
|
|
window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
|
|
|
|
|
obj.onclick = function () {
|
|
|
|
|
var goTop = setInterval(scrollMove, 10);
|
|
|
|
|
function scrollMove() {
|
|
|
|
|
setScrollTop(getScrollTop() / 1.1);
|
|
|
|
|
if (getScrollTop() < 1) clearInterval(goTop);
|
|
|
|
|
}
|
2015-05-21 17:17:54 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-21 15:52:27 +08:00
|
|
|
|
$(function(){
|
2015-06-05 10:37:24 +08:00
|
|
|
|
//匿评评分提示
|
2015-09-17 14:26:41 +08:00
|
|
|
|
$(".student_score_info").live("mouseover",function(){
|
2015-05-21 17:17:54 +08:00
|
|
|
|
$(this).find("div").show();
|
|
|
|
|
});
|
2015-09-17 14:26:41 +08:00
|
|
|
|
$(".student_score_info").live("mouseout",function(){
|
2015-05-21 17:17:54 +08:00
|
|
|
|
$(this).find("div").hide();
|
|
|
|
|
});
|
2015-07-03 10:47:10 +08:00
|
|
|
|
//最终成绩提示
|
2015-09-17 14:26:41 +08:00
|
|
|
|
$(".student_final_scor_info").live("mouseover",function(){
|
2015-07-03 10:47:10 +08:00
|
|
|
|
$(this).find("div").show();
|
|
|
|
|
});
|
2015-09-17 14:26:41 +08:00
|
|
|
|
$(".student_final_scor_info").live("mouseout",function(){
|
2015-07-03 10:47:10 +08:00
|
|
|
|
$(this).find("div").hide();
|
|
|
|
|
});
|
2015-06-05 10:37:24 +08:00
|
|
|
|
|
|
|
|
|
$("#about_project label").eq(1).remove();
|
2015-06-26 14:29:03 +08:00
|
|
|
|
|
2015-09-17 17:20:29 +08:00
|
|
|
|
////附件下载提示
|
|
|
|
|
//$(".zip_download_alert").bind("mouseover",function(){
|
|
|
|
|
// $(this).next("div").show();
|
|
|
|
|
//});
|
|
|
|
|
//$(".zip_download_alert").bind("mouseout",function(){
|
|
|
|
|
// $(this).next("div").hide();
|
|
|
|
|
//});
|
2015-05-26 10:00:37 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//匿评弹框取消按钮
|
|
|
|
|
function clickCanel(){hideModal("#popbox02");}
|
|
|
|
|
//匿评弹框确定按钮
|
|
|
|
|
function clickOK(path)
|
|
|
|
|
{
|
|
|
|
|
clickCanel();
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "GET",
|
|
|
|
|
url: path,
|
|
|
|
|
data: 'text',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-05-28 09:46:35 +08:00
|
|
|
|
}
|
2015-09-28 17:09:07 +08:00
|
|
|
|
//关闭引入资源弹框
|
|
|
|
|
function hideResource(){
|
|
|
|
|
$('#ajax-modal').parent().removeClass("popbox").removeClass("referenceResourcesPopup");
|
|
|
|
|
hideModal();
|
|
|
|
|
}
|
2015-05-28 12:02:26 +08:00
|
|
|
|
//查询
|
2015-07-18 11:38:00 +08:00
|
|
|
|
function SearchByName(url,event)
|
2015-05-28 09:46:35 +08:00
|
|
|
|
{
|
|
|
|
|
var keycode = (event.keyCode ? event.keyCode : event.which);
|
|
|
|
|
if(keycode == '13'){
|
2015-09-22 15:52:08 +08:00
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
name : $("#course_student_name").val(),
|
2015-09-22 16:16:55 +08:00
|
|
|
|
group : $("#student_work_in_group").val()
|
2015-09-22 15:52:08 +08:00
|
|
|
|
},
|
|
|
|
|
function (data) {
|
|
|
|
|
}
|
|
|
|
|
);
|
2015-05-28 09:46:35 +08:00
|
|
|
|
}
|
2015-05-28 17:09:38 +08:00
|
|
|
|
}
|
2015-07-18 11:38:00 +08:00
|
|
|
|
function SearchByName_1(url)
|
2015-06-04 10:49:32 +08:00
|
|
|
|
{
|
2015-09-22 16:16:55 +08:00
|
|
|
|
//alert($("#student_work_in_group").val());
|
2015-09-22 15:52:08 +08:00
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
name : $("#course_student_name").val(),
|
2015-09-22 16:16:55 +08:00
|
|
|
|
group : $("#student_work_in_group").val()
|
2015-09-22 15:52:08 +08:00
|
|
|
|
},
|
|
|
|
|
function (data) {
|
|
|
|
|
}
|
|
|
|
|
);
|
2015-06-04 10:49:32 +08:00
|
|
|
|
}
|
2015-09-11 16:57:49 +08:00
|
|
|
|
|
2015-09-22 16:16:55 +08:00
|
|
|
|
$(function(){
|
|
|
|
|
$("#student_work_in_group").live("change",function(){
|
|
|
|
|
$("#search_in_student_work").click();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-11 16:57:49 +08:00
|
|
|
|
//新建作业临时弹框
|
|
|
|
|
function new_homework_alert(){
|
|
|
|
|
alert("您好!课程内直接发布作业的功能正在改进中,请直接点击\n顶部导航栏的“作业”向本课程发送作业。谢谢!如有问\n题,可参见帮助中心。");
|
|
|
|
|
}
|
2015-09-24 09:25:56 +08:00
|
|
|
|
|
|
|
|
|
function show_student_work(url){
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
function (data) {
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-09-28 15:52:30 +08:00
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
|
|
|
|
extra = extra || 0;
|
|
|
|
|
var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
|
|
|
|
|
isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
|
|
|
|
|
addEvent = function (element, type, callback) {
|
|
|
|
|
element.addEventListener ?
|
|
|
|
|
element.addEventListener(type, callback, false) :
|
|
|
|
|
element.attachEvent('on' + type, callback);
|
|
|
|
|
},
|
|
|
|
|
getFirstStyle = elem.currentStyle ? function (name) {
|
|
|
|
|
var val = elem.currentStyle[name];
|
|
|
|
|
|
|
|
|
|
if (name === 'height' && val.search(/px/i) !== 1) {
|
|
|
|
|
var rect = elem.getBoundingClientRect();
|
|
|
|
|
return rect.bottom - rect.top -
|
|
|
|
|
parseFloat(getFirstStyle('paddingTop')) -
|
|
|
|
|
parseFloat(getFirstStyle('paddingBottom')) + 'px';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
} : function (name) {
|
|
|
|
|
return getComputedStyle(elem, null)[name];
|
|
|
|
|
},
|
|
|
|
|
minHeight = parseFloat(getFirstStyle('height'))
|
|
|
|
|
|
|
|
|
|
elem.style.resize = 'none';
|
|
|
|
|
elem2.style.resize = 'none';
|
|
|
|
|
var change = function () {
|
|
|
|
|
var scrollTop, height,
|
|
|
|
|
padding = 0,
|
|
|
|
|
style = elem.style,
|
|
|
|
|
style2 = elem2.style;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (elem._length === elem.value.length) return;
|
|
|
|
|
elem._length = elem.value.length;
|
|
|
|
|
elem2._length = elem._length;
|
|
|
|
|
if (!isFirefox && !isOpera) {
|
|
|
|
|
padding = parseInt(getFirstStyle('paddingTop')) + parseInt(getFirstStyle('paddingBottom'));
|
|
|
|
|
};
|
|
|
|
|
scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
|
|
|
|
|
|
|
|
elem.style.height = minHeight + 'px';
|
|
|
|
|
elem2.style.height = minHeight + 'px';
|
|
|
|
|
if (elem.scrollHeight > minHeight) {
|
|
|
|
|
if (maxHeight && elem.scrollHeight > maxHeight) {
|
|
|
|
|
height = maxHeight - padding;
|
|
|
|
|
style.overflowY = 'auto';
|
|
|
|
|
style2.overflowY = 'auto';
|
|
|
|
|
} else {
|
|
|
|
|
height = elem.scrollHeight - padding;
|
|
|
|
|
style.overflowY = 'hidden';
|
|
|
|
|
style2.overflowY = 'hidden';
|
|
|
|
|
};
|
|
|
|
|
style.height = height + extra + 'px';
|
|
|
|
|
style2.height = height + extra + 'px';
|
|
|
|
|
scrollTop += parseInt(style.height) - elem.currHeight;
|
|
|
|
|
document.body.scrollTop = scrollTop;
|
|
|
|
|
document.documentElement.scrollTop = scrollTop;
|
|
|
|
|
elem.currHeight = parseInt(style.height);
|
|
|
|
|
};
|
|
|
|
|
if (elem2.scrollHeight > minHeight) {
|
|
|
|
|
if (maxHeight && elem2.scrollHeight > maxHeight) {
|
|
|
|
|
height = maxHeight - padding;
|
|
|
|
|
style.overflowY = 'auto';
|
|
|
|
|
style2.overflowY = 'auto';
|
|
|
|
|
} else {
|
|
|
|
|
height = elem2.scrollHeight - padding;
|
|
|
|
|
style.overflowY = 'hidden';
|
|
|
|
|
style2.overflowY = 'hidden';
|
|
|
|
|
};
|
|
|
|
|
style.height = height + extra + 'px';
|
|
|
|
|
style2.height = height + extra + 'px';
|
|
|
|
|
scrollTop += parseInt(style2.height) - elem2.currHeight;
|
|
|
|
|
document.body.scrollTop = scrollTop;
|
|
|
|
|
document.documentElement.scrollTop = scrollTop;
|
|
|
|
|
elem2.currHeight = parseInt(style2.height);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
addEvent(elem, 'propertychange', change);
|
|
|
|
|
addEvent(elem, 'input', change);
|
|
|
|
|
addEvent(elem, 'focus', change);
|
|
|
|
|
addEvent(elem2, 'propertychange', change);
|
|
|
|
|
addEvent(elem2, 'input', change);
|
|
|
|
|
addEvent(elem2, 'focus', change);
|
|
|
|
|
change();
|
2015-10-28 15:54:27 +08:00
|
|
|
|
};
|
|
|
|
|
|
2015-10-30 11:51:09 +08:00
|
|
|
|
//课程大纲选择请求,第二个参数是可选的,判断当前页面是大纲显示页面还是 课程首页
|
2015-10-28 15:54:27 +08:00
|
|
|
|
function course_outline(id){
|
|
|
|
|
$.get(
|
2015-10-30 11:51:09 +08:00
|
|
|
|
' /courses/'+id+'/course_outline'+"?is_in_show_outline_page="+(arguments[1] ? arguments[1] : 'N')
|
2015-10-28 15:54:27 +08:00
|
|
|
|
)
|
2015-10-29 09:07:26 +08:00
|
|
|
|
}
|
2015-11-18 10:57:17 +08:00
|
|
|
|
|
|
|
|
|
//取消课程组织关联
|
|
|
|
|
function cancel_org_course_relation(id, courseId){
|
2015-11-18 11:12:40 +08:00
|
|
|
|
if(confirm("确定取消关联吗?") == false) return;
|
2015-11-18 10:57:17 +08:00
|
|
|
|
$.ajax({
|
|
|
|
|
url:"/org_courses/" + id + "?course_id=" + courseId,
|
|
|
|
|
type: "delete",
|
|
|
|
|
success:function(data){
|
|
|
|
|
$.ajax({
|
2015-11-18 16:52:03 +08:00
|
|
|
|
url: "/courses/" + courseId + "/search_public_orgs_not_in_course?hint_flag=true",
|
2015-11-18 10:57:17 +08:00
|
|
|
|
type:'get'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2015-10-29 09:07:26 +08:00
|
|
|
|
//$(function(){
|
|
|
|
|
// $('#course_outline_search').on('input',function(){
|
|
|
|
|
// alert('<%= @course.id%>')
|
|
|
|
|
// })
|
2015-11-02 09:49:58 +08:00
|
|
|
|
//})
|
2015-11-24 17:29:57 +08:00
|
|
|
|
|
|
|
|
|
//项目点击展开
|
|
|
|
|
function expand_tools_expand(content) {
|
|
|
|
|
if (content == "invit") {
|
|
|
|
|
$("#expand_tools_expand_invit").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
|
|
|
|
|
$("#expand_tools_expand_invit").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
|
|
|
|
|
$("#expand_tools_expand_invit").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// $("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd");
|
|
|
|
|
// $("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt");
|
|
|
|
|
// $("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500);
|
|
|
|
|
$("#navContent").toggle(500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改数字控制速度, slideUp(500)控制卷起速度
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通过cookie存储伸开形式
|
|
|
|
|
$(function(){
|
|
|
|
|
var personalized_expand_key = "personalized_expand";
|
|
|
|
|
function personalized_init(){
|
|
|
|
|
var personalized_map = cookieget(personalized_expand_key);
|
|
|
|
|
if(personalized_map!=false){
|
|
|
|
|
personalized_map = JSON.parse(personalized_map);
|
2016-01-15 15:37:17 +08:00
|
|
|
|
$("*[nhtype='toggle4cookiecourse']").each(function(){
|
2015-11-24 17:29:57 +08:00
|
|
|
|
var personalized_id=$(this).data('id');
|
|
|
|
|
var val = personalized_map[personalized_id];
|
|
|
|
|
if(val!=undefined && val!=$(this).data('val')){
|
|
|
|
|
personalized_click($(this),0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function personalized_click(obj,timeout){
|
|
|
|
|
var target = $(obj.data('target'));
|
|
|
|
|
var oldval = obj.data('val');
|
|
|
|
|
var val='';
|
|
|
|
|
if(oldval=='expand'){val='retract';}else{val='expand';}
|
|
|
|
|
obj.data('val',val);
|
|
|
|
|
var personalized_map = cookieget(personalized_expand_key);
|
|
|
|
|
if(personalized_map == false){
|
|
|
|
|
personalized_map={};
|
|
|
|
|
}else{
|
|
|
|
|
personalized_map = JSON.parse(personalized_map);
|
|
|
|
|
}
|
|
|
|
|
var personalized_id=obj.data('id');
|
|
|
|
|
personalized_map[personalized_id]=val;
|
|
|
|
|
cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
|
|
|
|
|
target.toggle(timeout);
|
|
|
|
|
}
|
2016-01-15 15:37:17 +08:00
|
|
|
|
$("*[nhtype='toggle4cookiecourse']").on('click',function(){
|
2015-11-24 17:29:57 +08:00
|
|
|
|
personalized_click($(this),500);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
personalized_init();
|
2015-12-10 18:59:54 +08:00
|
|
|
|
});
|
2015-12-11 09:42:19 +08:00
|
|
|
|
function submit_course_feedback() {
|
|
|
|
|
var flag = false;
|
|
|
|
|
if(flag == false){
|
|
|
|
|
$("#course_feedback_new").submit();
|
|
|
|
|
var flag = true
|
|
|
|
|
}
|
2015-12-14 17:03:20 +08:00
|
|
|
|
}
|
2016-01-15 15:37:17 +08:00
|
|
|
|
|
|
|
|
|
function show_more_tool(){
|
|
|
|
|
$('#navContentCourse').css('display', 'block');
|
|
|
|
|
}
|