socialforge/public/javascripts/syllabus.js

127 lines
3.2 KiB
JavaScript
Raw Normal View History

//显示更多的班级
function show_more_course(url){
$.get(
url,
{ page: $("#course_page_num").val() },
function (data) {
}
);
}
2016-06-29 10:45:56 +08:00
function regex_sylla_description() {
syllabus_description_editor.sync();
var name = syllabus_description_editor.html();
if (name.length == 0) {
$("#description_notice_span").text("描述不能为空");
$("#description_notice_span").css('color', '#ff0000');
$("#description_notice_span").focus();
return false;
}
else {
$("#description_notice_span").text("填写正确");
$("#description_notice_span").css('color', '#008000');
return true;
}
}
function submit_syllabus() {
if (regex_sylla_description()) {
$("#syllabus-form").submit();
}
2016-07-01 11:11:53 +08:00
}
//编辑英文名称
function show_edit_eng_name() {
EngEdit = true;
2016-07-01 11:11:53 +08:00
$("#syllabus_eng_name_show").hide();
$("#syllabus_eng_name_edit").show();
$("#syllabus_eng_name_edit").focus();
}
//编辑英文名称之后提交
function edit_syllabus_eng_name(url){
if(EngEdit) {
EngEdit = false;
$.get(
url,
{ eng_name: $("#syllabus_eng_name_edit").val() },
function (data) {
2016-07-01 11:11:53 +08:00
}
);
}
2016-07-01 11:11:53 +08:00
}
2016-07-07 15:04:57 +08:00
//编辑课程名称
function show_edit_title(str) {
IsEdit = true;
2016-07-07 15:04:57 +08:00
$("#syllabus_title_show").hide();
$("#syllabus_title_edit").show();
$("#syllabus_title_edit").text(str);
2016-07-07 15:04:57 +08:00
$("#syllabus_title_edit").focus();
}
//编辑课程名称之后提交
function edit_syllabus_title(url){
if(IsEdit) {
IsEdit = false;
$.get(
url,
{ title: $("#syllabus_title_edit").val().trim() },
function (data) {
2016-07-07 15:04:57 +08:00
}
);
}
2016-07-07 15:04:57 +08:00
}
2016-07-01 11:11:53 +08:00
//展开所有属性
function toggle_all_syllabus_attr(){
var btn = $("#show_all_syllabus_attr");
var target = $("#all_syllabus_attr li");
var none = $("#all_syllabus_attr li.none_attr");
if(btn.data('init')=='0'){
btn.data('init',1);
btn.removeClass('homepageLeftMenuMoreIcon');
btn.addClass('homepageLeftMenuHideIcon');
target.show();
}else{
btn.data('init',0);
btn.addClass('homepageLeftMenuMoreIcon');
btn.removeClass('homepageLeftMenuHideIcon');
none.hide();
}
}
function update_syllabus_info(){
if(regex_syllabus_credit('credit') && regex_syllabus_credit('hours') && regex_syllabus_credit('theory_hours') && regex_syllabus_credit('practice_hours')) {
$("#submit_edit_info").parent().submit();
}
}
function regex_syllabus_credit(str){
var num = $.trim($("#syllabus_"+str+"_input").val());
var regex = /^\d*$/;
if(num.length > 0)
{
if (regex.test(num)) {
if(parseInt(num) > 0)
{
$("#syllabus_"+str+"_notice").hide();
return true;
} else
{
$("#syllabus_"+str+"_notice").show();
$("#syllabus_"+str+"_input").focus();
return false;
}
} else {
$("#syllabus_"+str+"_notice").show();
$("#syllabus_"+str+"_input").focus();
return false;
}
} else {
return true;
}
2016-06-29 10:45:56 +08:00
}