var AsDebug = {
URL:"",
toggleWindow:function() {
var d = top.dialog.get('as-debug-dialog');
if (d) {
d.remove();
} else {
this.showWindow();
}
},
showWindow:function() {
var d = top.dialog({
id: 'as-debug-dialog',
title: '调试工具栏['+AsDebug.getURL()+"]",
onclose: function () {
AsDebug.removeWindow();
},
quickClose: true
});
var html="
| ";
html+=" DWINFO ";
html+=" CTRLCT ";
html+=" PGSRC ";
html+=" COMP ";
html+=" REQ ";
html+=" ReloadCacheAll ";
html+=" |
| ";
//html+=""+AsDebug.getPage()+" ";
html+=""+AsDebug.getPage()+" ";
//html+="【"+AsDebug.getURL()+"】";
html+="【"+AsDebug.getURL()+"】";
html+=" |
";
d.content(html);
d.showModal();
},
alert:function(title,message,width,height,mask,time,okButton,openCallback,closeCallback,flag) {
this.showMessage(title,message,width,height,mask,time,okButton,openCallback,closeCallback,flag);
},
showMessage:function(title,message,width,height,mask,time,okButton,openCallback,closeCallback,flag){
var d;
if(typeof(mask) == "undefined") mask = true;
if(!okButton){
d = top.dialog({
id: 'dialog-message',
width:width?width:"350px",
height:height?height:"50px",
skin:"ui-popup-show",
title: "" == title?"提示":title,
okValue: '确定',
ok:function(){
AsDebug.removeMessage();
},
onclose: function(){
AsDebug.removeMessage();
},
onshow:openCallback,
onremove:closeCallback,
cancel:false,
quickClose: mask?false:true
});
}else{
d = top.dialog({
id: 'dialog-message',
width:width?width:"350px",
height:height?height:"40px",
skin:"ui-popup-show",
title: "" == title?"提示":title,
onclose: function(){
AsDebug.removeMessage();
},
onshow:openCallback,
onremove:closeCallback,
cancel:false,
quickClose: mask?false:true
});
}
var mesDiv = ""+message+"
";
d.content(mesDiv);
d.showModal();
if(time){
setTimeout(function(){
AsDebug.removeMessage();
},time);
}
},
removeMessage:function() {
var d = window.top.dialog.get('dialog-message');
if (d) d.remove();
},
removeWindow:function() {
var d = top.dialog.get('as-debug-dialog');
if (d) d.remove();
},
getURL:function() {
if (typeof(AsDebug_URL) != "undefined") this.URL = AsDebug_URL;
if (this.URL != "") return this.URL.substring(this.URL.lastIndexOf(sWebRootPath)+sWebRootPath.length);
return document.URL;
},
getPage:function() {
if (typeof(AsDebug_URL) != "undefined") this.URL = AsDebug_URL;
if (this.URL != "") return this.URL.substring(this.URL.lastIndexOf("/")+1);
return document.URL;
},
reloadAREService:function(serviceId){
if (typeof(serviceId) == "undefined" || serviceId.length == 0) serviceId = "JBO";
var sReturn = RunJavaMethod("com.amarsoft.app.util.ReloadServiceAction","reloadService","ServiceId="+serviceId);
if(sReturn=="SUCCESS") alert(getMessageText("AWES0017")); // 重载ARE服务成功!
else alert(getMessageText("AWES0018")); // 重载ARE服务失败!
},
reloadAppCalculation:function(){
if (typeof(serviceId) == "undefined" || serviceId.length == 0) serviceId = "JBO";
var sReturn = RunJavaMethod("com.amarsoft.app.util.ReloadCalculationToolAction","cleanCalculationToolData","");
if(sReturn=="SUCCESS") alert("CLEAN Calculation Tool SUCCESS");
else alert("CLEAN Calculation Tool FAIL");
},
reloadCacheAll:function(){
var sReturn = RunJavaMethod("com.amarsoft.app.util.ReloadCacheConfigAction","reloadCacheAll","");
if(sReturn=="SUCCESS") alert(getMessageText("AWES0015")); // 重载参数缓存成功!
else alert(getMessageText("AWES0016")); // 重载参数缓存失败!
},
reloadCache:function(CacheType){
var sReturn = RunJavaMethod("com.amarsoft.app.util.ReloadCacheConfigAction","reloadCache","ConfigName="+CacheType);
if(sReturn=="SUCCESS") alert(getMessageText("AWES0019")); // 刷新参数缓存成功!
else alert(getMessageText("AWES0020")); // 刷新参数缓存失败!
},
reloadFixSkins:function(){
var sReturn = AsControl.RunJsp("/AppConfig/ControlCenter/ReloadSkin.jsp","ReloadType=FixSkins");
if(sReturn=="SUCCESS") alert(getMessageText("AWES0021")); // 重载定制皮肤成功!
else alert(getMessageText("AWES0022")); // 重载定制皮肤失败!
},
reloadConfigFile:function(){
var sReturn = AsControl.RunJsp("/AppConfig/ControlCenter/ClearConfigFileCache.jsp","","");
if(sReturn=="SUCCESS") alert(getMessageText("AWES0023")); // 重载配置文件成功!
else alert(getMessageText("AWES0024")); // 重载配置文件失败!
},
openControlCenter:function() {
this.removeWindow();
AsControl.OpenPage("/AppConfig/ControlCenter/ControlCenterTab.jsp","","");
},
displayHTML:function(oBody) {
var d = dialog({
height:400,
width:800,
title: '页面运行代码['+AsDebug.getURL()+"]",
content: '',
onshow: function () {
$("#testSource").text(oBody.ownerDocument.documentElement.innerHTML);
},
quickClose: true
});
d.showModal();
},
displayBodyHTML:function() {
this.removeWindow();
this.displayHTML(document.body);
},
viewCompDetail:function() {
this.removeWindow();
AsControl.OpenPage("/Frame/page/debug/tools/CompDetail.jsp","ToShowClientID="+sCompClientID,"");
},
displayDwInfo:function() {
this.removeWindow();
try{
var sUrl = "/Frame/page/dw/DisplayDWInfo.jsp";
if(!window.WindowType) sUrl = "/Frame/page/ow/DisplayOWInfo.jsp";
window.open(sWebRootPath + sUrl+ "?dono="+DisplayDONO+"&url="+this.getURL(),"","status:no,resizable:yes,scrollbars=yes,height:768,width:1024");
}catch(e){
alert("No DWInfo");
}
},
displayURL:function displayURL() {
prompt("URLName",this.getURL());
},
displayPageName:function() {
prompt("PageName",this.getPage());
},
displayURLnPara:function() {
prompt("URL",document.URL);
},
showOnlineUserList:function(){
OpenPage("/AppConfig/ControlCenter/OnlineUserList.jsp?rand="+randomNumber());
},
editDW:function(){
if(typeof(DisplayDONO)=="undefined" || DisplayDONO.length == 0){
alert("No DWInfo");
return;
}
if(typeof(WindowType) !="undefined" && WindowType.length != 0){
AsControl.OpenNewWin("/AppConfig/PageMode/DWConfig/DataObjectStrip.jsp","DONO="+DisplayDONO+"&RightType=All");
}else{
AsControl.OpenNewWin("/AppConfig/PageMode/DWConfig/ObjectModelStrip.jsp","DONO="+DisplayDONO+"&RightType=All");
}
}
};
/**
*
* @param event
* @returns {Boolean} true 触发了某些事件 false 没触发事件
*/
function keydownAction(event){
if(event.altKey && event.keyCode == 49){ //alt+1
AsDebug.toggleWindow(event);
return true;
}else if(event.altKey && event.keyCode == 50){ //alt+2
if(typeof OverrideAlt2 == 'function') OverrideAlt2();
else AsDebug.editDW();
return true;
}else if(event.altKey && event.keyCode == 51){ //alt+3
AsDebug.reloadCacheAll();
return true;
}else if(event.altKey && event.keyCode == 52){ //alt+4
AsDebug.reloadAREService();
return true;
}else if(event.altKey && event.keyCode == 67){ //alt+c
AsDebug.reloadAppCalculation();
return true;
}else if(event.keyCode == "27"){ //esc
AsDebug.removeWindow();
return true;
}else if(event.keyCode==113 && window.as_defaultExport){//F2导出excel
as_defaultExport("F2导出");
return true;
}else if(event.keyCode==8){ // backspace
var target = $(event.target);
// 可以取到值、为可编辑的表单、不为按钮/下拉选择/勾选/只读等允许使用backspace键
return target.val() && target.is(":input:enabled") && !target.is(":button,:selected,:checked,[readonly]");
}
}
$(document).keydown(keydownAction);