258 lines
9.5 KiB
JavaScript
258 lines
9.5 KiB
JavaScript
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="<table><tr><td>";
|
||
html+="<span class='pageversion' ondblclick='javascript:AsDebug.displayDwInfo();'> DWINFO </span>";
|
||
html+="<span class='pageversion' ondblclick='javascript:AsDebug.openControlCenter();'> CTRLCT </span>";
|
||
html+="<span class='pageversion' ondblclick='javascript:AsDebug.displayBodyHTML();'> PGSRC </span>";
|
||
html+="<span class='pageversion' ondblclick='javascript:AsDebug.viewCompDetail();'> COMP </span>";
|
||
html+="<span class='pageversion' ondblclick='javascript:AsDebug.displayURLnPara();'> REQ </span>";
|
||
html+="<span class='pageversion' ondblclick='javascript:AsDebug.reloadCacheAll();'> ReloadCacheAll </span>";
|
||
html+="</td></tr><tr><td>";
|
||
//html+="<span class='pageversion' ondblclick='javascript:AsDebug.displayPageName();'>"+AsDebug.getPage()+" </span>";
|
||
html+="<span class='pageversion'>"+AsDebug.getPage()+" </span>";
|
||
//html+="<span class='pageversion' ondblclick='javascript:AsDebug.displayURL();'>¡¾"+AsDebug.getURL()+"¡¿</span>";
|
||
html+="<span class='pageversion'>¡¾"+AsDebug.getURL()+"¡¿</span>";
|
||
html+="</td></tr></table>";
|
||
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 = "<div style='width:100%;height:100%;display:table;'><h3 id='messageContent' style='display:table-cell;vertical-align:middle;text-align:center;'>"+message+"</h3></div>";
|
||
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( "ÖØÔØ"+CacheType+"³É¹¦"); // ˢвÎÊý»º´æ³É¹¦£¡
|
||
else alert( "ÖØÔØ"+CacheType+"ʧ°Ü" ); // ˢвÎÊý»º´æÊ§°Ü£¡
|
||
},
|
||
/**
|
||
* ÖØÖÃ×Ô¶¨ÒåÀàÐ͵Ļº´æ
|
||
* @param CacheType »º´æÊý×é( 'ObjectWindow»º´æ', '´úÂë±í' )
|
||
* @another zhulh
|
||
*/
|
||
reloadCacheCustom: function( CacheType ) {
|
||
var msgNo = 'AWES0033';
|
||
var errorMsgNo = 'AWES0034';
|
||
switch ( CacheType ) {
|
||
case '²úÆ·²ÎÊý,ºËËã½»Ò×¶¨Òå':
|
||
msgNo = 'ÖØÔØ²úÆ·»º´æ³É¹¦';
|
||
errorMsgNo = 'ÖØÔØ²úÆ·»º´æÊ§°Ü';
|
||
}
|
||
var sReturn = RunJavaMethod( "com.amarsoft.app.util.ReloadCacheConfigAction", "reloadCacheCustom","ConfigName=" + CacheType.replace( /,/ig, '@_@' ) );
|
||
if ( sReturn === "SUCCESS" ) alert( msgNo ); // ˢвÎÊý»º´æ³É¹¦£¡
|
||
else alert( errorMsgNo ); // ˢвÎÊý»º´æÊ§°Ü£¡
|
||
},
|
||
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: '<textarea id=\"testSource\" style=\"width: 100%; height: 100%;\"></textarea>',
|
||
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 ´¥·¢ÁËijЩʼþ 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 == 53){ //alt+5 Çå¿ÕÄ£°å»º´æ
|
||
AsDebug.reloadCache('ObjectWindow»º´æ');
|
||
return true;
|
||
}else if(event.altKey && event.keyCode == 55){
|
||
AsDebug.reloadCache('²Ëµ¥');
|
||
return true;
|
||
} else if ( event.altKey && event.keyCode === 56 ) { //alt+8 Çå¿Õ²úÆ·»º´æ by zhulh
|
||
AsDebug.reloadCacheCustom('²úÆ·²ÎÊý,ºËËã½»Ò×¶¨Òå' );
|
||
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);
|