2015-08-24 11:03:09 +08:00
|
|
|
|
$(function(){
|
2015-08-24 16:16:07 +08:00
|
|
|
|
//右侧最小高度 = 左侧高度 - 15px 保证两边高度基本一样,页面美观
|
2015-08-28 17:27:51 +08:00
|
|
|
|
$("#RSide").css("min-height",$("#LSide").height()-35);
|
2016-01-08 16:16:57 +08:00
|
|
|
|
//$("#users_setting").css("min-height",$("#LSide").height()-100);
|
2015-08-24 16:16:07 +08:00
|
|
|
|
|
2015-08-24 11:03:09 +08:00
|
|
|
|
//头像相关
|
2015-08-29 11:59:52 +08:00
|
|
|
|
$("#homepage_portrait_image").on("mouseover",function(){
|
2015-08-24 11:03:09 +08:00
|
|
|
|
$("#edit_user_file_btn").show();
|
|
|
|
|
$("#watch_user_btn").show();
|
2015-08-29 11:59:52 +08:00
|
|
|
|
}).on("mouseout",function(){
|
2015-08-24 11:03:09 +08:00
|
|
|
|
$("#edit_user_file_btn").hide();
|
|
|
|
|
$("#watch_user_btn").hide();
|
|
|
|
|
});
|
2015-08-26 13:56:37 +08:00
|
|
|
|
|
|
|
|
|
//日历选择样式
|
|
|
|
|
//$(".ui-datepicker-trigger").replaceWith("<div class='fl DateBorder mr10'><img class='ui-datepicker-trigger'></div>")
|
2015-08-24 11:03:09 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//编辑个人简介
|
|
|
|
|
function show_edit_user_introduction() {
|
|
|
|
|
$("#user_brief_introduction_show").hide();
|
|
|
|
|
$("#user_brief_introduction_edit").show();
|
|
|
|
|
$("#user_brief_introduction_edit").focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//编辑个人简介完成之后提交
|
|
|
|
|
function edit_user_introduction(url){
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{ brief_introduction: $("#user_brief_introduction_edit").val() },
|
|
|
|
|
function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-24 14:44:22 +08:00
|
|
|
|
//显示更多的课程
|
|
|
|
|
function show_more_course(url){
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
function (data) {
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//显示更多的项目
|
|
|
|
|
function show_more_project(url){
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-08-26 17:29:47 +08:00
|
|
|
|
|
2016-01-20 18:37:47 +08:00
|
|
|
|
//个人留言
|
|
|
|
|
function jour_submit(){
|
|
|
|
|
if(jourReplyVerify()){
|
|
|
|
|
$("#private_flag").val("0");
|
|
|
|
|
jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
|
|
|
|
$("#user_feedback_new").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function private_jour_submit(){
|
|
|
|
|
if(jourReplyVerify()){
|
|
|
|
|
$("#private_flag").val("1");
|
|
|
|
|
jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
|
|
|
|
$("#user_feedback_new").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function jourReplyVerify() {
|
|
|
|
|
var content = jour_content_editor.html();//$.trim($("#message_content").val());
|
|
|
|
|
if (jour_content_editor.isEmpty()) {
|
2016-01-22 21:53:32 +08:00
|
|
|
|
$("#jour_content_span").text("留言不能为空");
|
2016-01-20 18:37:47 +08:00
|
|
|
|
$("#jour_content_span").css('color', '#ff0000');
|
|
|
|
|
$("#submit_feedback_user").one('click',function() {
|
|
|
|
|
jour_submit();
|
|
|
|
|
});
|
|
|
|
|
$("#private_submit_feedback_user").one('click',function() {
|
|
|
|
|
private_jour_submit();
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("#jour_content_span").text("填写正确");
|
|
|
|
|
$("#jour_content_span").css('color', '#008000');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-26 17:29:47 +08:00
|
|
|
|
//老师提交 新建/修改 作业
|
2015-09-21 17:11:45 +08:00
|
|
|
|
function submit_homework(id){
|
|
|
|
|
if(!regex_homework_name()){
|
2015-08-26 17:29:47 +08:00
|
|
|
|
$("#homework_name").focus();
|
|
|
|
|
}
|
2015-09-21 17:11:45 +08:00
|
|
|
|
else if(!regex_homework_end_time()){
|
2015-09-02 16:12:33 +08:00
|
|
|
|
$("#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-21 17:11:45 +08:00
|
|
|
|
else if(!regex_course_id()){
|
2015-09-02 16:12:33 +08:00
|
|
|
|
$("#course_id").focus();
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-08-26 17:29:47 +08:00
|
|
|
|
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-08-28 10:00:48 +08:00
|
|
|
|
}
|
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 end_time = Date.parse($("#homework_end_time").val());
|
|
|
|
|
var publish_time = Date.parse($("#homework_publish_time").val());
|
|
|
|
|
if(end_time < publish_time)
|
|
|
|
|
{
|
|
|
|
|
$("#homework_end_time_span").text("截止日期不能小于发布日期");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#homework_end_time_span").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-02 16:12:33 +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-02 16:12:33 +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-08-28 10:00:48 +08:00
|
|
|
|
|
2016-09-13 16:18:57 +08:00
|
|
|
|
//验证分组作业的参数
|
|
|
|
|
function regex_group_attr(){
|
|
|
|
|
var min = $.trim($("#min_num").val());
|
|
|
|
|
var max = $.trim($("#max_num").val());
|
|
|
|
|
var regex = /^\d+$/;
|
|
|
|
|
if(!regex.test(min) || parseInt(min) <= 0) {
|
|
|
|
|
$("#min_max_num_notice").html("人数为正整数");
|
|
|
|
|
$("#min_max_num_notice").show();
|
|
|
|
|
$("#min_num").focus();
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
$("#min_max_num_notice").html("");
|
|
|
|
|
$("#min_max_num_notice").hide();
|
|
|
|
|
}
|
|
|
|
|
if(!regex.test(max) || parseInt(max) <= 0) {
|
|
|
|
|
$("#min_max_num_notice").html("人数为正整数");
|
|
|
|
|
$("#min_max_num_notice").show();
|
|
|
|
|
$("#max_num").focus();
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
$("#min_max_num_notice").html("");
|
|
|
|
|
$("#min_max_num_notice").hide();
|
|
|
|
|
}
|
|
|
|
|
if(parseInt(min) > parseInt(max)) {
|
|
|
|
|
$("#min_max_num_notice").html("最小人数不得大于最大人数");
|
|
|
|
|
$("#min_max_num_notice").show();
|
|
|
|
|
$("#max_num").focus();
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
$("#min_max_num_notice").html("");
|
|
|
|
|
$("#min_max_num_notice").hide();
|
|
|
|
|
}
|
|
|
|
|
if ($("#base_on_project").is(":checked")) {
|
|
|
|
|
$("#base_on_project").val(1);
|
|
|
|
|
} else {
|
|
|
|
|
$("#base_on_project").val(0);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证编程作业的参数
|
|
|
|
|
function regex_program_attr() {
|
2016-09-14 19:27:12 +08:00
|
|
|
|
var result = true;
|
2016-09-13 16:18:57 +08:00
|
|
|
|
$.each($('#programHomework textarea.InputBox'), function(i, val){
|
2016-09-14 19:27:12 +08:00
|
|
|
|
if (result && $(val).val().length<=0) {
|
2016-09-13 16:18:57 +08:00
|
|
|
|
$(val)[0].focus();
|
2016-09-14 19:27:12 +08:00
|
|
|
|
result = false;
|
2016-09-13 16:18:57 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2016-09-14 19:27:12 +08:00
|
|
|
|
return result;
|
2016-09-13 16:18:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-28 10:00:48 +08:00
|
|
|
|
//老师导入作业时查询作业
|
|
|
|
|
function search_homework_by_name(url){
|
|
|
|
|
$.get(
|
|
|
|
|
url,
|
|
|
|
|
{ name: $("#search_homework_name").val() },
|
|
|
|
|
function (data) {
|
|
|
|
|
}
|
|
|
|
|
);
|
2015-09-02 19:52:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-23 15:44:48 +08:00
|
|
|
|
//提交匿评参数设置
|
|
|
|
|
function submit_set_evaluation_attr(end_time){
|
|
|
|
|
if(!regex_evaluation_start(end_time)){
|
|
|
|
|
$("#evaluation_start_time").focus();
|
|
|
|
|
}
|
|
|
|
|
else if(!regex_evaluation_end()){
|
|
|
|
|
$("#evaluation_end_time").focus();
|
|
|
|
|
}
|
|
|
|
|
else if(!regex_evaluation_num()){
|
|
|
|
|
$("#evaluation_num").focus();
|
|
|
|
|
}
|
|
|
|
|
else{
|
2016-11-02 16:46:47 +08:00
|
|
|
|
$('#muban_popup_box form').submit();
|
2016-11-04 09:23:23 +08:00
|
|
|
|
hideModal();
|
2015-09-23 15:44:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-21 17:11:45 +08:00
|
|
|
|
//验证匿评开启时间:大于截止时间,或者为空
|
2015-09-23 15:44:48 +08:00
|
|
|
|
function regex_evaluation_start(end_time){
|
2015-09-21 17:11:45 +08:00
|
|
|
|
var evaluation_start = $.trim($("#evaluation_start_time").val());
|
|
|
|
|
if(evaluation_start == ""){
|
2015-09-23 15:44:48 +08:00
|
|
|
|
$("#homework_evaluation_start_time").text("开启匿评日期不能为空");
|
|
|
|
|
return false;
|
2015-09-21 17:11:45 +08:00
|
|
|
|
}
|
2015-09-23 15:44:48 +08:00
|
|
|
|
var end_time = new Date(end_time);
|
2015-09-21 17:11:45 +08:00
|
|
|
|
var evaluation_start_time = new Date(evaluation_start);
|
|
|
|
|
if(evaluation_start_time > end_time){
|
2015-09-23 15:44:48 +08:00
|
|
|
|
$("#homework_evaluation_start_time").text("");
|
2015-09-21 17:11:45 +08:00
|
|
|
|
return true;
|
|
|
|
|
}else{
|
2015-09-23 15:44:48 +08:00
|
|
|
|
$("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期");
|
2015-09-21 17:11:45 +08:00
|
|
|
|
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 == ""){
|
2015-09-23 15:44:48 +08:00
|
|
|
|
$("#homework_evaluation_end_time").text("关闭匿评日期不能为空");
|
2015-09-21 17:11:45 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
var evaluation_start_time = new Date(evaluation_start);
|
|
|
|
|
var evaluation_end_time = new Date(evaluation_end);
|
2015-12-14 16:54:28 +08:00
|
|
|
|
if(evaluation_end_time >= evaluation_start_time){
|
2015-09-23 15:44:48 +08:00
|
|
|
|
$("#homework_evaluation_end_time").text("");
|
2015-09-21 17:11:45 +08:00
|
|
|
|
return true;
|
|
|
|
|
}else{
|
2015-12-14 17:03:20 +08:00
|
|
|
|
$("#homework_evaluation_end_time").text("关闭匿评日期不能小于开启匿评日期");
|
2015-09-23 15:44:48 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 15:44:03 +08:00
|
|
|
|
//处理迟交、缺评扣分
|
|
|
|
|
function check_late_penalty(id)
|
|
|
|
|
{
|
|
|
|
|
var obj = $("#" + id);
|
|
|
|
|
var regex = /^\d+$/;
|
|
|
|
|
if(regex.test(obj.val()))
|
|
|
|
|
{
|
|
|
|
|
if(obj.val() > 50)
|
|
|
|
|
{
|
|
|
|
|
obj.val("50");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
obj.val("");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-23 15:44:48 +08:00
|
|
|
|
//验证匿评数量
|
|
|
|
|
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("匿评人数只能为数字");
|
2015-09-21 17:11:45 +08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-02 19:52:44 +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-09-02 19:52:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function edit_student_work(id)
|
|
|
|
|
{
|
|
|
|
|
if(regexStudentWorkName()&®exStudentWorkDescription())
|
2015-11-09 11:16:19 +08:00
|
|
|
|
{
|
2015-12-17 19:06:10 +08:00
|
|
|
|
if($("#group_member_ids").length > 0) {
|
|
|
|
|
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
|
|
|
|
|
$("#edit_student_work_" + id).submit();
|
|
|
|
|
$("#ajax-indicator").hide();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$("#edit_student_work_" + id).submit();
|
|
|
|
|
$("#ajax-indicator").hide();
|
|
|
|
|
}
|
2015-11-09 11:16:19 +08:00
|
|
|
|
}
|
2015-09-02 19:52:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证作品名称
|
|
|
|
|
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-09-09 16:10:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
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-09-15 15:18:33 +08:00
|
|
|
|
//学生作品
|
|
|
|
|
function show_project()
|
|
|
|
|
{
|
|
|
|
|
$("#about_project").slideToggle();
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-03 09:17:36 +08:00
|
|
|
|
//添加分组成员
|
|
|
|
|
function show_group_member(){
|
|
|
|
|
$("#chooseGroupMember").dialog("open");
|
|
|
|
|
$(".ui-dialog-titlebar").hide();
|
|
|
|
|
$("a.popClose").on('click', function(){
|
|
|
|
|
$("#chooseGroupMember" ).dialog("close");
|
|
|
|
|
});
|
|
|
|
|
$("#cancel_add").on('click', function(){
|
|
|
|
|
$("#chooseGroupMember" ).dialog("close");
|
|
|
|
|
});
|
|
|
|
|
//$('#min_num').focus();
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-09 16:50:46 +08:00
|
|
|
|
//textarea自适应高度 纯js写的 有浏览器判断
|
|
|
|
|
/**
|
|
|
|
|
* 文本框根据输入内容自适应高度
|
|
|
|
|
* @param {HTMLElement} 输入框元素
|
|
|
|
|
* @param {Number} 设置光标与输入框保持的距离(默认0)
|
|
|
|
|
* @param {Number} 设置最大高度(可选)
|
|
|
|
|
*/
|
|
|
|
|
var autoTextarea = function (elem, extra, maxHeight) {
|
|
|
|
|
extra = extra || 0;
|
|
|
|
|
var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
|
|
|
|
|
isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
|
|
|
|
|
addEvent = function (type, callback) {
|
|
|
|
|
elem.addEventListener ?
|
|
|
|
|
elem.addEventListener(type, callback, false) :
|
|
|
|
|
elem.attachEvent('on' + type, callback);
|
|
|
|
|
},
|
|
|
|
|
getStyle = 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(getStyle('paddingTop')) -
|
|
|
|
|
parseFloat(getStyle('paddingBottom')) + 'px';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
} : function (name) {
|
|
|
|
|
return getComputedStyle(elem, null)[name];
|
|
|
|
|
},
|
|
|
|
|
minHeight = parseFloat(getStyle('height'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elem.style.resize = 'none';
|
|
|
|
|
|
|
|
|
|
var change = function () {
|
|
|
|
|
var scrollTop, height,
|
|
|
|
|
padding = 0,
|
|
|
|
|
style = elem.style;
|
|
|
|
|
|
|
|
|
|
if (elem._length === elem.value.length) return;
|
|
|
|
|
elem._length = elem.value.length;
|
|
|
|
|
|
|
|
|
|
if (!isFirefox && !isOpera) {
|
|
|
|
|
padding = parseInt(getStyle('paddingTop')) + parseInt(getStyle('paddingBottom'));
|
|
|
|
|
};
|
|
|
|
|
scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
|
|
|
|
|
|
|
|
elem.style.height = minHeight + 'px';
|
|
|
|
|
if (elem.scrollHeight > minHeight) {
|
|
|
|
|
if (maxHeight && elem.scrollHeight > maxHeight) {
|
|
|
|
|
height = maxHeight - padding;
|
|
|
|
|
style.overflowY = 'auto';
|
|
|
|
|
} else {
|
|
|
|
|
height = elem.scrollHeight - padding;
|
|
|
|
|
style.overflowY = 'hidden';
|
|
|
|
|
};
|
|
|
|
|
style.height = height + extra + 'px';
|
|
|
|
|
scrollTop += parseInt(style.height) - elem.currHeight;
|
|
|
|
|
document.body.scrollTop = scrollTop;
|
|
|
|
|
document.documentElement.scrollTop = scrollTop;
|
|
|
|
|
elem.currHeight = parseInt(style.height);
|
|
|
|
|
};
|
2015-09-09 16:10:11 +08:00
|
|
|
|
};
|
|
|
|
|
|
2015-09-09 16:50:46 +08:00
|
|
|
|
addEvent('propertychange', change);
|
|
|
|
|
addEvent('input', change);
|
|
|
|
|
addEvent('focus', change);
|
|
|
|
|
change();
|
2015-09-24 09:40:53 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function limitStrsize(id,length){
|
2015-09-25 15:55:29 +08:00
|
|
|
|
$('#'+id).keypress(function(e)
|
2015-09-24 09:40:53 +08:00
|
|
|
|
{
|
|
|
|
|
var n = 0;
|
2015-09-25 16:32:02 +08:00
|
|
|
|
var str = this.value;
|
2015-09-24 09:40:53 +08:00
|
|
|
|
for (i = 0; i < str.length; i++) {
|
|
|
|
|
var leg = str.charCodeAt(i);//ASCII码
|
|
|
|
|
if (leg > 255) {//大于255的都是中文
|
|
|
|
|
n += 2;//如果是中文就是2个字节
|
|
|
|
|
} else {
|
|
|
|
|
n += 1;//英文,不多说了
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-25 15:55:29 +08:00
|
|
|
|
if(n >= length && e.keyCode !== 8)
|
|
|
|
|
if(document.all)
|
|
|
|
|
{
|
|
|
|
|
e.returnValue = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
})
|
2015-09-15 16:11:55 +08:00
|
|
|
|
}
|
2015-09-25 10:04:56 +08:00
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////创建项目
|
|
|
|
|
//验证项目名称是不是为空
|
|
|
|
|
function regex_project_name(){
|
|
|
|
|
var name = $.trim($("#project_name").val());
|
|
|
|
|
if(name=="")
|
|
|
|
|
{
|
|
|
|
|
$("#project_name_error_msg").text("项目名称不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#project_name_error_msg").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证项目名称是否重复---项目名称可以重复。。。。
|
|
|
|
|
function regex_project_name_same(){
|
2015-09-15 16:11:55 +08:00
|
|
|
|
var name = $.trim($("#project_name").val());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证项目描述
|
|
|
|
|
function regex_project_desc(){
|
|
|
|
|
var desc = $.trim($("#project_description").val());
|
|
|
|
|
if(desc == "")
|
|
|
|
|
{
|
|
|
|
|
$("#project_desc_error_msg").text("项目名称不能为空");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#project_desc_error_msg").text("");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//提交
|
|
|
|
|
function submit_project(){
|
|
|
|
|
if(regex_project_name()&®ex_project_desc()){
|
|
|
|
|
$("#new_project").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-16 10:26:13 +08:00
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////创建项目 end
|
|
|
|
|
//匿评弹框取消按钮
|
|
|
|
|
function clickCanel(){hideModal("#popbox02");}
|
|
|
|
|
//匿评弹框确定按钮
|
|
|
|
|
function clickOK(path)
|
|
|
|
|
{
|
|
|
|
|
clickCanel();
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "GET",
|
|
|
|
|
url: path,
|
|
|
|
|
data: 'text',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2015-09-28 17:09:07 +08:00
|
|
|
|
//关闭引入资源弹框
|
|
|
|
|
function hideResource(){
|
|
|
|
|
$('#ajax-modal').parent().removeClass("popbox").removeClass("referenceResourcesPopup");
|
|
|
|
|
hideModal();
|
|
|
|
|
}
|
2015-09-18 11:29:38 +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();
|
2016-06-15 17:24:46 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function user_name_keypress(e){
|
|
|
|
|
if (e.keyCode == '13') {
|
|
|
|
|
$('#main_login_form').submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeRegisterBtn(checkbox){
|
|
|
|
|
if(checkbox.checked == true){
|
2016-06-16 10:21:21 +08:00
|
|
|
|
$("#loginUpButton").removeClass('new_login_submit_disable');
|
|
|
|
|
$("#loginUpButton").addClass('new_login_submit');
|
2016-06-15 17:24:46 +08:00
|
|
|
|
}else{
|
2016-06-16 10:21:21 +08:00
|
|
|
|
$("#loginUpButton").removeClass('new_login_submit')
|
|
|
|
|
$("#loginUpButton").addClass('new_login_submit_disable');
|
2016-06-15 17:24:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clearInfo(id, content) {
|
|
|
|
|
var text = $('#' + id);
|
|
|
|
|
if (text.val() == content) {
|
|
|
|
|
$('#' + id).val('');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showInfo(id, content) {
|
|
|
|
|
var text = $('#' + id);
|
|
|
|
|
if (text.val() == '') {
|
|
|
|
|
$('#' + id).val(content);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function login(){
|
|
|
|
|
$('#main_login_form').submit(); //表单提交没有任何反应的原因:js冲突
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function register(){
|
2016-06-16 10:21:21 +08:00
|
|
|
|
if($("#loginUpButton").hasClass('new_login_submit_disable')){
|
2016-06-15 17:24:46 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if($login_correct && $mail_correct && $passwd_correct && $passwd_comfirm_correct && $("#read_and_confirm").attr("checked") == 'checked'){
|
|
|
|
|
$("#main_reg_form").submit();
|
|
|
|
|
}else{
|
|
|
|
|
$('#user_login').blur();
|
|
|
|
|
$('#user_mail').blur();
|
|
|
|
|
$('#user_password').blur();
|
|
|
|
|
$('#user_password_confirmation').blur();
|
|
|
|
|
}
|
2016-06-17 11:33:48 +08:00
|
|
|
|
}
|