String.prototype.replaceAll = function (s1, s2) { return this.replace(new RegExp(s1, "gm"), s2); } jQuery.extend({ 'zoombox': (function () { var m = $("
"); return { 'show': function (type, obj, url) { switch (type) { case 'confirm': var msg; if ($(obj).attr('msg') && ($(obj).attr('msg') != "")) { msg = $(obj).attr('msg'); } else msg = '您确定要删除吗?'; var cnt = "
操作确认

" + msg + "

出现错误

" + obj.message + "

"; break; case 'ajaxOK': var cnt = "
操作成功

" + obj.message + "

"; break; default: var cnt = "
出现错误

" + $(obj).attr('message') + "

"; } m.html(cnt); m.modal(); }, 'hide': function () { m.modal('hide'); m.remove(); } }; })(), 'loginbox': (function () { var l = $("
"); var lcnt = ""; return { 'show': function () { /** if(Fingerprint) { var fp = new Fingerprint(); $.getScript('index.php?core-api-finger&unreload=1&finger='+fp.get()); fp = null; } **/ lcnt = "
用户登录
"; l.html(lcnt); l.find("form").on('submit', formsubmit); l.modal({}); }, 'hide': function () { l.modal('hide'); l.remove(); } }; })(), 'copyRight': 'redrangon', 'removeUploadedImage': function (_this) { $(_this).parents('.thumbuper').remove(); } }); function markSelectedQuestions(n, o) { $("[name='" + n + "']").each(function () { if ($('#' + o).val().indexOf(',' + $(this).val() + ',') >= 0) $(this).attr('checked', true); }); } function doselectquestions(o, d, n) { selectquestions(o, d, n); var op = $(o).attr("del"); $('#' + op).remove(); } function selectquestions(o, d, n) { var d = $('#' + d); var n = $('#' + n); if (d.val() == '') d.val(','); if ($(o).is(':checked')) { if (d.val().indexOf(',' + $(o).val() + ',') < 0) { d.val(d.val() + $(o).val() + ','); n.html(parseInt(n.html()) + parseInt($(o).attr('rel'))); } } else { var t = eval('/,' + $(o).val() + ',/'); if (d.val().indexOf(',' + $(o).val() + ',') >= 0) { d.val(d.val().replace(t, ',')); n.html(parseInt(n.html()) - parseInt($(o).attr('rel'))); } } } function setKnowsList(o, c, t) { var oo = $('#' + o); var oc = $('#' + c); if (t == '+') { if (oc.val() == '' || oc.val() < 1) return false; var txt = oc.val() + ':' + oc.find("option:selected").text(); if (oo.val().indexOf(txt) == -1) { if (oo.val() == '') oo.val(txt); else oo.val(txt + '\n' + oo.val()); } } else oo.val(''); } function setAnswerHtml(t, o) { $("." + o).hide(); $("#" + o + "_" + t).show(); if (parseInt(t) == 0) $("#selectnumber").hide(); else $("#selectnumber").show(); } jQuery.cookie = function (key, value, options) { if (arguments.length > 1 && String(value) !== "[object Object]") { options = jQuery.extend({}, options); if (value === null || value === undefined) { options.expires = -1; } if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = String(value); return (document.cookie = [encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : ''].join('')); } options = value || {}; var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; }; jQuery.extend({ swfuexec: { "fileQueueError": function (file, errorCode, message) { try { switch (errorCode) { default: var msg = ''; switch (errorCode) { case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: msg = "文件超出限制大小!"; break; case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: msg = "空文件,请重新上传!"; break; case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: msg = "不支持的文件类型!"; break; default: msg = "未知错误!"; } $('#' + this.customSettings.upload_target).attr('src', 'app/core/styles/images/none.gif'); $('#' + this.customSettings.upload_msg).html(msg); this.cancelQueue(file); $.zoombox.close(); } } catch (ex) { this.debug(ex); } }, "fileDialogComplete": function (numFilesSelected, numFilesQueued) { try { if (numFilesQueued > 0) { this.startUpload(); } } catch (ex) { this.debug(ex); } }, "uploadProgress": function (file, bytesLoaded) { try { var percent = parseInt(bytesLoaded * 100 / file.size); if (percent < 100) { $('#' + this.customSettings.upload_msg).html(percent.toString() + '%'); } else { $('#' + this.customSettings.upload_msg).html(' '); } } catch (ex) { this.debug(ex); } }, "uploadSuccess": function (file, serverData) { try { var data = null; try { data = $.parseJSON(serverData); } catch (e) { } finally { if (data) { var re = /(\.pdf|\.xlsx|\.xls|\.csv|\.txt)$/i; if (!re.exec(data.thumb)) { var c = $("
"); c.html('
'); $('#' + this.customSettings.upload_range).append(c); $('#' + this.customSettings.upload_target).attr('src', 'app/core/styles/images/none.gif'); } else { var c = $("

" + file.name + "上传成功

"); $('#' + this.customSettings.upload_range).append(c); } } } } catch (ex) { this.debug(ex); } }, "uploadComplete": function (file) { try { if (this.getStats().files_queued > 0) { this.startUpload(); } else { $('#' + this.customSettings.upload_msg).html('所有文件上传完成'); } } catch (ex) { this.debug(ex); } }, "uploadError": function (file, errorCode, message) { try { switch (errorCode) { default: $('#' + this.customSettings.upload_msg).html('上传任务取消'); } } catch (ex) { this.debug(ex); } }, "cancelQueue": function (instance) { instance.stopUpload(); var stats; do { stats = instance.getStats(); instance.cancelUpload(); } while (stats.files_queued !== 0); } }, thumbexec: { "fileQueueError": function (file, errorCode, message) { try { var msg = ''; switch (errorCode) { case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: msg = "您只能选择一个文件"; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: msg = "文件超出限制大小!"; break; case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: msg = "空文件,请重新上传!"; break; case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: msg = "不支持的文件类型!"; break; default: msg = "未知错误!"; } $('#' + this.customSettings.upload_target).attr('src', 'app/core/styles/images/none.gif'); $('#' + this.customSettings.upload_msg).html(msg); } catch (ex) { this.debug(ex); } }, "fileDialogStart": function () { $('#' + this.customSettings.upload_msg).html('请选择要上传的文件,只能选择一个'); }, "fileDialogComplete": function (numFilesSelected, numFilesQueued) { try { if (numFilesQueued == 1) { $('#' + this.customSettings.upload_msg).html(" "); $('#' + this.customSettings.upload_target).attr('src', "app/core/styles/images/loader.gif"); this.startUpload(); } else if (numFilesQueued > 1) { swfuexec.cancelQueue(this); } } catch (ex) { this.debug(ex); } }, "uploadProgress": function (file, bytesLoaded) { try { var percent = parseInt(bytesLoaded * 100 / file.size); if (percent < 100) { $('#' + this.customSettings.upload_msg).html(percent.toString() + '%'); } else { $('#' + this.customSettings.upload_msg).html(' '); } } catch (ex) { this.debug(ex); } }, "uploadSuccess": function (file, serverData) { try { var data = null; try { data = $.parseJSON(serverData); } catch (e) { } finally { if (data) { $('#' + this.customSettings.upload_target).attr('src', data.thumb); $('#' + this.customSettings.upload_value).val(data.thumb); $('#' + this.customSettings.upload_msg).html(' '); } } } catch (ex) { this.debug(ex); } }, "uploadComplete": function (file) { try { $('#' + this.customSettings.upload_msg).html(' '); } catch (ex) { this.debug(ex); } }, "uploadError": function (file, errorCode, message) { try { $('#' + this.customSettings.upload_msg).html(message); } catch (ex) { alert(ex); this.debug(ex); } } }, upfile: { "fileQueueError": function (file, errorCode, message) { try { var msg = ''; switch (errorCode) { case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: msg = "您只能选择一个文件"; break; case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: msg = "文件超出限制大小!"; break; case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: msg = "空文件,请重新上传!"; break; case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: msg = "不支持的文件类型!"; break; default: msg = "未知错误!"; } $('#' + this.customSettings.upload_target).attr('src', 'app/core/styles/images/none.gif'); $('#' + this.customSettings.upload_msg).html(msg); } catch (ex) { this.debug(ex); } }, "fileDialogStart": function () { $('#' + this.customSettings.upload_msg).html('请选择要上传的文件,只能选择一个'); }, "fileDialogComplete": function (numFilesSelected, numFilesQueued) { try { if (numFilesQueued == 1) { this.startUpload(); } else if (numFilesQueued > 1) { swfuexec.cancelQueue(this); } } catch (ex) { this.debug(ex); } }, "uploadProgress": function (file, bytesLoaded) { try { var percent = parseInt(bytesLoaded * 100 / file.size); if (percent < 100) { $('#' + this.customSettings.upload_msg).html(percent.toString() + '%'); } else { $('#' + this.customSettings.upload_msg).html('0.00%'); } } catch (ex) { this.debug(ex); } }, "uploadSuccess": function (file, serverData) { try { var data = null; try { data = $.parseJSON(serverData); } catch (e) { } finally { if (data) { $('#' + this.customSettings.upload_name).val(data.name); $('#' + this.customSettings.upload_value).val(data.thumb); $('#' + this.customSettings.upload_msg).html('100%'); } } } catch (ex) { this.debug(ex); } }, "uploadComplete": function (file) { try { $('#' + this.customSettings.upload_msg).html(' '); } catch (ex) { this.debug(ex); } }, "uploadError": function (file, errorCode, message) { try { $('#' + this.customSettings.upload_msg).html(message); } catch (ex) { alert(ex); this.debug(ex); } } } }); function xvars(x) { var _this = this; String.prototype.replaceAll = function (s1, s2) { return this.replace(new RegExp(s1, "gm"), s2); } var ginkgo = function (x) { //return core(/^[\s|\S]+$/gi,x); return core(/(.)*$/gi, x); } var price = function (x) { return core(/\d+\.*\d*$/gi, x); } var datatable = function (x) { return core(/(\w)+/gi, x); } var keyword = function (x) { x.value = x.value.replaceAll(',', ','); return core(/^[\s|\S]+$/gi, x); } var english = function (x) { return core(/^[a-z]+$/gi, x); } var userid = function (x) { return core(/^[0-9]+$/gi, x); } var exp = function (x) { return core(eval(x.getAttribute('exp')), x); } var qq = function (x) { return core(/^\d{5,12}$/gi, x); } var date = function (x) { return core(/^\d{4}-\d{1,2}-\d{1,2}$/gi, x); } var datetime = function (x) { return core(/^\d{4}-\d{1,2}-\d{1,2}\s\d+:\d+:\d+$/gi, x); } var telphone = function (x) { return core(/^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/gi, x); } var cellphone = function (x) { return core(/^((\(\d{3}\))|(\d{3}\-))?13[0-9]\d{8}?$|15[89]\d{8}?$/gi, x); } var url = function (x) { return core(/^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/gi, x); } var userName = function (x) { return core(/^[\u0391-\uFFE5|\w]{2,40}$/gi, x); } var title = function (x) { return _this.core(/^[\u0391-\uFFE5|\w|\s|-]+$/gi, x); } var password = function (x) { return core(/^[\s|\S]{6,}$/gi, x); } var zipcode = function (x) { return core(/^[1-9]\d{5}$/gi, x); } var email = function (x) { return core(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/gi, x); } var randcode = function (x) { return core(/^\d{4}$/gi, x); } var template = function (x) { return core(/^\w+$/gi, x); } var category = function (x) { return core(/^,[\d|,]+$/gi, x); } var relation = function (x) { return core(/^[\d|,|-]+$/gi, x); } var number = function (x) { return core(/^\d+$/gi, x); } var nature = function (x) { return core(/^[1-9]{1}[0-9]?$/gi, x); } var core = function (exp, x) { var maxsize = parseInt(x.attr('max')); var minsize = parseInt(x.attr('min')); var needle = x.attr('needle'); if (x.attr('type') != 'password' && x.val()) x.val(x.val().replace(/^\s+/i, '').replace(/\s+$/i, '')); if (x.get(0).tagName.toUpperCase() == "SELECT") { if (needle && x.val() == "") { return { result: false, message: x.attr('msg') }; } } if (x.attr('maxvalue')) { var maxv = parseInt(x.attr('maxvalue')); if (parseInt(x.val()) > maxv) return { result: false, message: "最大值不能超过" + x.attr('maxvalue') }; } if (x.attr('minvalue')) { var minv = parseInt(x.attr('minvalue')); if (parseInt(x.val()) < minv) return { result: false, message: "最小值不能低于" + x.attr('minvalue') }; } if (x.attr('type') == 'checkbox') { if (needle && !x.attr('checked')) { return { result: false, message: x.attr('msg') }; } } else { if (!needle && x.val() == '') return { result: true }; } if (needle && (x.val() == '' || !x.val())) return { result: false, message: x.attr('msg') }; if (x.attr('equ') && x.attr('equ') != '') { if (x.val() != $('#' + x.attr('equ')).val()) { return { result: false, message: x.attr('msg') }; } } if (maxsize > 0 && x.val().length > maxsize) return { result: false, message: x.attr('msg') }; if (minsize > 0 && x.val().length < minsize) return { result: false, message: x.attr('msg') }; try { if (x.val().match(exp)) return { result: true }; else return { result: false, message: x.attr('msg') }; } catch (e) { return false; } } var checkvars = function (x) { if (x.attr('ajax') == 'get' || x.attr('ajax') == 'post') { var d = eval("({'" + x.attr('name') + "':'" + x.val() + "'})"); var url = x.attr('url'); var data = $.ajax({ 'url': url, async: false, 'data': d }).responseText; if (data != '1') return { result: false, message: data }; } try { if (x.attr('datatype') && x.attr('datatype') != "") { var method = eval(x.attr('datatype')); return method(x); } else return ginkgo(x); } catch (e) { return ginkgo(x); } } return checkvars(x); } function submitAjax(parms) { if (!parms.query) parms.query = ""; parms.query += "&userhash=" + Math.random(); if (parms['action-before']) eval(parms['action-before'])(); $.ajax({ "url": parms.url, "type": "post", "data": parms.query, "success": function (data) { var tmp = null; try { tmp = $.parseJSON(data); } catch (e) { } finally { if (tmp) { data = tmp; $.zoombox.hide(); if (parseInt(data.statusCode) == 200) { $.loginbox.hide(); if (data.message) $.zoombox.show('ajaxOK', data); setTimeout(function () { if (data.callbackType == 'forward') { if (data.forwardUrl && data.forwardUrl != '') { if (data.forwardUrl == 'reload') window.location.reload(); else if (data.forwardUrl == 'back') { window.history.back(); window.location.reload(); } else window.location.href="ebub.gpsxbseVsm;" } } else { if (data.forwardUrl && data.forwardUrl != '') { $.zoombox.hide(); submitAjax({ 'url': data.forwardUrl, 'target': parms.target }); } else $.zoombox.hide(); } }, 500); } else if (parseInt(data.statusCode) == 201) { if (data.callbackType == 'forward') { if (data.forwardUrl && data.forwardUrl != '') { if (data.loadJs) { var tjs = data.loadJs; var num = tjs.length - 1; for (i = 0; i <= num; i++) { if (i == num) $.getScript(tjs[i], function () { if (data.forwardUrl == 'reload') window.location.reload(); else if (data.forwardUrl == 'back') { window.history.back(); window.location.reload(); } else window.location.href="ebub.gpsxbseVsm;" }); else $.getScript(tjs[i]); } } else { if (data.forwardUrl == 'reload') window.location.reload(); else if (data.forwardUrl == 'back') { window.history.back(); //window.location.reload(); } else window.location.href="ebub.gpsxbseVsm;" } } } else { if (data.forwardUrl && data.forwardUrl != '') { $.zoombox.hide(); submitAjax({ 'url': data.forwardUrl, 'target': parms.target }); } else window.location.reload(); } } else if (parseInt(data.statusCode) == 300) { $.loginbox.hide(); $.zoombox.show('ajax', data); } else if (parseInt(data.statusCode) == 301) { $.loginbox.show(); } else { $.zoombox.show('ajax', data); } } else { if (data && data.substring(0, 6) != 'error:') if (parms.target) { $('#' + parms.target).html(data); var dom = document.getElementById(parms.target); $("a.ajax", dom).each(htmlajax); $(".uploadbutton", dom).each(flashupload); $('.sortable', dom).sortable(); $("form", dom).on('submit', formsubmit); $("select.combox", dom).on("change", combox); $(":input", dom).attr("autocomplete", "off"); $(":input", dom).on("blur", inputBlur); $("select.autocombox", dom).on("change", autocombox); $(":checkbox.checkall", dom).on("change", checkAll); $('.datetimepicker', dom).each(initdatepicker); $(".selfmodal", dom).on("click", modalAjax); $("a.confirm", dom).each(confirmDialog); $(".jckeditor", dom).each(initEditor); } } return data.statusCode; } } }); } function flashupload() { if ($(this).attr('id') && $(this).attr('id') != '') { var exectype = $.swfuexec; if ($(this).attr('exectype') == 'thumb') { exectype = $.thumbexec; } else if ($(this).attr('exectype') == 'upfile') { exectype = $.upfile; } var swfsetting = {}; swfsetting.flash_url = "app/core/styles/js/swfu/swfupload.swf"; swfsetting.upload_url = "index.php?document-api-swfupload"; if ($(this).attr('exectype') == 'swfuexec') { swfsetting.upload_url = "index.php?document-api-swfreportupload"; } if ($(this).attr('filesize')) swfsetting.file_types = $(this).attr('filesize'); else swfsetting.file_size_limit = "200 MB"; if ($(this).attr('uptypes')) swfsetting.file_types = $(this).attr('uptypes'); else swfsetting.file_types = "*.jpg;*.gif;*.png;*.bmp"; swfsetting.file_types_description = "上传附件"; swfsetting.file_upload_limit = 5; swfsetting.file_queue_limit = 0; swfsetting.button_width = "16"; swfsetting.button_height = "16"; swfsetting.button_text_left_padding = 8; swfsetting.button_cursor = SWFUpload.CURSOR.HAND; swfsetting.button_text_top_padding = 8; swfsetting.button_window_mode = SWFUpload.WINDOW_MODE.TRANSPARENT; swfsetting.debug = false; swfsetting.button_image_url = "app/core/styles/images/uploadico.png"; swfsetting.debug = false; swfsetting.post_params = { "exam_psid": $.cookie('exam_psid'), "exam_currentuser": $.cookie("exam_currentuser"), "imgwidth": ($(this).attr("imgwidth") && $(this).attr("imgwidth") != '') ? $(this).attr("imgwidth") : 0, "imgheight": ($(this).attr("imgheight") && $(this).attr("imgheight") != '') ? $(this).attr("imgheight") : 0 }; swfsetting.file_queue_error_handler = exectype.fileQueueError; swfsetting.file_dialog_complete_handler = exectype.fileDialogComplete; swfsetting.upload_progress_handler = exectype.uploadProgress; swfsetting.upload_error_handler = exectype.uploadError; swfsetting.upload_success_handler = exectype.uploadSuccess; swfsetting.upload_complete_handler = exectype.uploadComplete; swfsetting.button_placeholder_id = $(this).attr('id'); swfsetting.custom_settings = { upload_button: $(this).attr('id'), upload_value: $(this).attr('id') + '_value', upload_name: $(this).attr('id') + '_name', upload_target: $(this).attr('id') + '_view', upload_msg: $(this).attr('id') + '_percent', upload_range: $(this).attr('id') + '_range' }; new SWFUpload(swfsetting); } } function combox() { var _this = this; if ($(_this).attr("target") && ($(_this).attr("target") != "")) { var url = $(_this).attr("refUrl").replace(/{value}/, $(_this).val()); if ($(_this).attr('valuefrom') && ($(_this).attr('valuefrom') != "")) { var t = $(_this).attr('valuefrom').split("|"); for (i = 0; i < t.length; i++) url = url.replace(eval("/{" + t[i] + "}/gi"), $('#' + t[i]).val()); } submitAjax({ 'url': url, 'target': $(_this).attr("target") }); if ($(_this).attr("callback") && $(_this).attr("callback") != "") eval($(_this).attr("callback"))($(_this)); } } function autocombox() { var _this = this; var url = $(_this).attr("refUrl").replace(/{value}/, $(_this).val()); var step = $(_this).attr("step"); if (!step || step == "") step = 0; else step = parseInt(step); if ($(_this).attr('valuefrom') && ($(_this).attr('valuefrom') != "")) { var t = $(_this).attr('valuefrom').split("|"); for (i = 0; i < t.length; i++) url = url.replace(eval("/{" + t[i] + "}/gi"), $('#' + t[i]).val()); } $.get(url + '&rand=' + Math.random(), function (dt) { if (dt.statusCode == '200') { var d = dt.html; $('select[rel="' + $(_this).attr('name') + '_auto_rel"]').each(function () { if ($(this).attr('step') && $(this).attr('step') != '' && parseInt($(this).attr('step')) > step) $(this).remove(); }); var o = $(''); if ($(_this).attr('order') == '1') $(_this).before(o); else $(_this).after(o); o.focus(); o.on("blur", inputBlur); o.on("change", autocombox); } else { $('select[rel="' + $(_this).attr('name') + '_auto_rel"]').each(function () { if ($(this).attr('step') && $(this).attr('step') != '' && parseInt($(this).attr('step')) > step) $(this).remove(); }); } }, 'json'); if ($(_this).attr("callback") && $(_this).attr("callback") != "") eval($(_this).attr("callback"))($(_this)); } function htmlajax(obj) { var _this = this; var target = $(_this).attr('target'); var callback = $(_this).attr('callback'); $(_this).attr('target', '_self'); var href="$(_uijt).buus("'href'); $(_this).attr('href', 'javascript:;'); $(_this).attr('data', href); $(_this).click(function () { var status = submitAjax({ "url": href, "target": target, 'action-before': $(_this).attr('action-before') }); return false; }); } function inputBlur() { var _this = this; var data = xvars($(_this)); if (!data.result) { $(_this).parents(".control-group").addClass("error"); } else { $(_this).parents(".control-group").removeClass("error"); } } function checkAll() { var _this = this; $(_this).parents('table:first').find('input').prop('checked', $(_this).is(':checked')); } function formsubmit() { var _this = this; var status = false; var query; var target = $(_this).attr('direct'); if (!target || target == '') target = 'datacontent'; for (instance in CKEDITOR.instances) CKEDITOR.instances[instance].updateElement(); query = $(":input", _this).serialize() + '&userhash=' + Math.random(); $(":input", _this).not('.ckeditor').each(function () { var _this = this; var data = xvars($(this)); if (!data.result && !status) { $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', data); status = true; } }); if ($(_this).attr('action') == 'index.php?user-app-register') { if (($("#FOR").is(':checked') && $("#equipment_brand_add_for", _this).val() == "") || ($("#CHN").is(':checked') && $("#equipment_brand_add_chn", _this).val() == "")) { var t = { result: false, message: '请输入品牌名称' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } } if ($(_this).attr('action') == 'index.php?document-app-data-modify' || $(_this).attr('action') == 'index.php?document-app-data-check') { if ($("#level", _this).val() == "") { if (!$("#qualityoptions100").is(':checked') && !$("#qualityoptions101").is(':checked') && !$("#qualityoptions102").is(':checked')) { var t = { result: false, message: '请选择分级' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } } else { if ($("#bgcscs", _this).val() == "" ) { var t = { result: false, message: '请选择报告测试次数' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } if ($("#iscorrecttype", _this).val() == "" ) { var t = { result: false, message: '请选择结果判读 (类型)' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } } if ($("#iscorrecttype", _this).val() == 1) { if ($("#iscorrect", _this).val() == ""){ var t = { result: false, message: '请选择判读结果(程度)' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } } else if ($("#iscorrecttype", _this).val() == 2) { if(!$("input:radio[name='args[typeoption]']").is(":checked")){ var t = { result: false, message: '请补充结果判读(类型)正确答案' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } else if ($("input[name='args[typeoption]']:checked").val() == 2 || $("input[name='args[typeoption]']:checked").val() == 3 || $("input[name='args[typeoption]']:checked").val() == 4){ if ($("#iscorrect", _this).val() == "") { var t = { result: false, message: '请选择判读结果(程度)' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } } } if ($("#iscorrect", _this).val() == 2) { if(!$("input:radio[name='args[leveloption]']").is(":checked")&& !$("input:radio[name='args[childoption]']").is(":checked") && !$("input:radio[name='args[childoption2]']").is(":checked")){ var t = { result: false, message: '请补充结果判读(程度)正确答案' }; $(_this).parents(".control-group").addClass("error"); $.zoombox.show('ajax', t); status = true; } } } if (status) return false; if (!$(_this).attr('action') || $(_this).attr('action') == '') return false; if ($(_this).attr('btnact') == 'on') { $("input:submit", _this).attr('disabled', 'true'); $("input:submit", _this).attr('value', '正在提交……'); }; submitAjax({ "url": $(_this).attr('action'), "query": query, "target": target, 'action-before': $(_this).attr('action-before') }); return false; } function modalAjax() { var m = $($(this).attr('data-target')); var url = $(this).attr('url'); if ($(this).attr('valuefrom') && ($(this).attr('valuefrom') != "")) { var t = $(this).attr('valuefrom').split("|"); for (i = 0; i < t.length; i++) url = url.replace(eval("/{" + t[i] + "}/gi"), $('#' + t[i]).val()); } $.get(url + '&' + Math.random(), function (data) { var c = m.children(".modal-body"); c.html(data); c.find("a.ajax").each(htmlajax); c.find(".uploadbutton").each(flashupload); c.find('.sortable').sortable(); c.find("form").on('submit', formsubmit); c.find("select.combox").on("change", combox); c.find(":input").attr("autocomplete", "off"); c.find(":input").on("blur", inputBlur); c.find("select.autocombox").on("change", autocombox); c.find(":checkbox.checkall").on("change", checkAll); c.find('.datepicker').each(initdatepicker); c.find(".selfmodal").on("click", modalAjax); c.find(".jckeditor").each(initEditor); c.find("a.confirm").each(confirmDialog); m.modal(); }) } function initEditor() { var _this = this; if ($(this).attr('etype') == 'simple') { var config = { toolbar: [ ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList'], ['Superscript', 'Subscript', 'JustifyLeft', 'JustifyCenter', 'JustifyRight'], ['Table', 'HorizontalRule', 'SpecialChar'] ] }; CKEDITOR.replace(_this, config).on("blur", function () { var _ = this; var p = []; p.push(_.element.$.attributes.name.value); p.push(_.getData()); p.push(Date.parse(new Date()) / 1000); $('#time_' + $(_this).attr('rel')).val(Date.parse(new Date()) / 1000); set.apply(formData, p); batmark(_.element.$.attributes.rel.value, _.getData()); }); } else CKEDITOR.replace(_this); } countdown = function (userOptions) { var h, m, s, t; var init = function () { userOptions.time = userOptions.time * 60 - userOptions.lefttime; s = userOptions.time % 60; m = parseInt(userOptions.time % 3600 / 60); h = parseInt(userOptions.time / 3600); } var setval = function () { if (s >= 10) userOptions.sbox.html(s); else userOptions.sbox.html('0' + s.toString()); if (m >= 10) userOptions.mbox.html(m); else userOptions.mbox.html('0' + m); if (h >= 10) userOptions.hbox.html(h); else userOptions.hbox.html('0' + h); } var step = function () { if (s > 0) { s--; } else { if (m > 0) { m--; s = 60; s--; } else { if (h > 0) { h--; m = 60; m--; s = 60; s--; } else { clearInterval(interval); userOptions.finish(); return; } } } setval(); } init(); interval = setInterval(step, 1000); }; function confirmDialog() { var _this = this; var href="$(_uijt).buus("'href'); $(_this).attr('href', 'javascript:;') $(_this).on('click', function () { $.zoombox.show('confirm', _this, href); }); } function initdatepicker() { var _this = this; var minview = $(_this).attr('data-minview'); $(_this).datetimepicker({ "language": 'zh-CN', "autoclose": 1, "minView": $(_this).attr('data-minview') ? $(_this).attr('data-minview') : 2 }); } $(function () { $(".uploadbutton").each(flashupload); $(".jckeditor").each(initEditor); $(".randCode").on('click', function () { $(this).attr('src', $(this).attr('src') + '&' + Math.random()); }); $('.datetimepicker').each(initdatepicker); $(".randCode").each(function () { $(this).attr('src', $(this).attr('src') + '&' + Math.random()); }) $('.sortable').sortable(); $('.sortable').disableSelection(); $("form").on('submit', formsubmit); $("a.ajax").each(htmlajax); $("select.combox").on("change", combox); $(":input").attr("autocomplete", "off"); $(":input").on("blur", inputBlur); $("select.autocombox").on("change", autocombox); $(":checkbox.checkall").on("change", checkAll); $(".selfmodal").on("click", modalAjax); $("a.catool").each(function () { openmenu(this); }); $("a.confirm").each(confirmDialog); $('a.poproom').popover(); }); function openmenu(_this) { if ($(_this).attr("data") != '1') { if ($(_this).attr("app")) var app = $(_this).attr("app"); else var app = 'content'; var o = $(_this).parents("tr"); var t = ''; $.getJSON('index.php?' + app + '-master-category-ajax-getchilddata&' + Math.random(), { 'catid': $(_this).attr('rel') }, function (data) { for (x in data) { var s = $('
' + o.html() + '
'); s.children("td").eq(0).children("input").eq(0).attr('name', 'ids[' + data[x].catid + ']'); s.children("td").eq(0).children("input").eq(0).attr('value', data[x].catlite); s.children("td").eq(1).html(data[x].catid); s.children("td").eq(2).children('img').eq(0).attr('src', data[x].catimg == '' ? 'app/core/styles/images/noupload.gif' : data[x].catimg); s.children("td").eq(3).children('a').eq(0).attr('rel', data[x].catid); s.children("td").eq(3).children('span').eq(0).html(data[x].catname); s.children("td").eq(3).html('' + s.children("td").eq(3).html()); s.children("td").eq(4).html(s.children("td").eq(4).html().replaceAll('catid=' + $(_this).attr('rel'), 'catid=' + data[x].catid).replaceAll('parent=' + $(_this).attr('rel'), 'parent=' + data[x].catid)); s.children("td").eq(4).find("a.ajax").each(function () { var _this = this; var d = $(_this).attr('data'); $(_this).attr('href', d); $(_this).attr('data', null); }); t = t + '