function setUpg(n,t,i){$("#"+t).css("display",n?"block":"none");$("#"+i).css("display",n?"none":"block")}function ajaxFileUpload(){var n=$("#fileToUpload").val();return/\.(zip|rar)$/i.test(n)?confirm("该操作将会丢失现有数据，建议先备份系统后再进行还原。\n确定要用该备份文件还原系统吗？")?($(document).ajaxStart(function(){setUpg(!0,"loading2","upBackup")}).ajaxComplete(function(){}),$.ajaxFileUpload({url:"get.aspx?action=upload",secureuri:!1,fileElementId:"fileToUpload",dataType:"json",success:function(n){var t=n.files,i=null;typeof t!="undefined"&&t!=null&&t.length>0&&(i=t[0]);i==null?alert("文件上传失败！"):PageMethods.SysRestore(i,Restore_callback)},error:function(n,t,i){alert(i)}}),!1):!1:showAndExit("无效的文件！")}function Restore_callback(n){n=eval("("+n+")");n.complete==!0?(winalert("系统还原成功！点击确定后重新进入。\n请通知所有用户清空浏览器缓存。"),parent.location="default.aspx?src=login.aspx"):(alert(n.msg),setUpg(!1,"loading2","upBackup"))}function askRestore(){return confirm("确定要用系统App_Data文件夹下的备份文件还原数据库吗？")&&(setUpg(!0,"loading2","upBackup"),__doPostBack("btnRestoreDb","")),!1}function dbRestored(n){setUpg(!1,"loading2","upBackup");IsVoid(n)?(winalert("数据库原成功！点击确定后重新进入。"),parent.location="default.aspx?src=login.aspx"):alert(n)}function doClean(){return hasSelected("options")?(setUpg(!0,"loading1","options"),!0):(alert("请至少选择一个选项！"),!1)}function doCleanComplete(n){alert(n);setUpg(!1,"loading1","options")}function autoBackupToggled(){var n=$("#ab_cbAutoBackup").prop("checked");$(":text,select,#ab_cbKeep","#ab_Body").prop("disabled",!n)}function preSave(){if($("#ab_cbAutoBackup").prop("checked")){if($("#ab_tbTarget").val()=="")return showAndExit("必须输入备份文件的存储位置（服务器电脑上的路径，或网络共享文件夹路径）！");if($("#ab_tbFqcy").val()=="")return showAndExit("必须输入备份频率的时间量！")}return!0}function makeJsEditor(){CKEDITOR.replace("js_tbJs",{toolbar:"Compact",height:337,autoUpdateElement:!0,resize_enabled:!1,removePlugins:"autogrow,elementspath",startupMode:"source",extraPlugins:"codemirror",codemirror:{lineNumbers:!1,mode:"text/javascript"}})}function makeCssEditor(){CKEDITOR.replace("css_tbCss",{toolbar:"Compact",height:337,autoUpdateElement:!0,resize_enabled:!1,removePlugins:"autogrow,elementspath",startupMode:"source",extraPlugins:"codemirror",codemirror:{lineNumbers:!1,mode:"text/css"}})}LoadEditor();LoadDatePicker();var defTab=0;$(function(){$("#tabs").tabs({active:defTab,activate:function(){$("#ab_popup").is(":visible")&&HideDialog("ab_popup")}}).fadeIn(300);autoBackupToggled()})