egroupware/phpgwapi/js/dynapi/ext/debug.html

137 lines
7.8 KiB
HTML
Raw Normal View History

<html>
<title>DynAPI Debugger</title>
<head>
<script>
function handleError(msg, url, lno) {
if (!(dynapi && dynapi.debug)) alert(msg);
else dynapi.debug.error(msg, "Debugger", lno);
};
var dynapi
var dform
var win = this;
var lastCaller=window.opener;
var imgwatch,imgnormal,imghelp,imginspect,imgreload;
var imgclear,imgeval,imgnext,imgprev;
win.onload = function() {
// move the debug window to the right edge?
//dynapi.debug.win.clientWidth = 200;
//win.document.body.style.width = 200; //clientWidth=200
//alert(win.setSize)
//alert(win.document.body.clientWidth)
var w = dynapi.ua.mac? (dynapi.ua.ie?330:300) : 360;
if (dynapi.ua.ie) {
var f = dynapi.frame;
var b = f.document.body;
var x = Math.min(f.screenLeft+b.clientWidth+20,screen.width-w-10);
dynapi.debug.win.moveTo(x,f.screenTop-50);
}
else if (dynapi.ua.ns4) {
var f = dynapi.frame;
var x=f.screenX+f.outerWidth;
var y=f.screenY+50;
dynapi.debug.win.moveTo(x,y);
}else{
dynapi.debug.win.moveTo(100,100)
}
dform=document.forms['debugform'];
dynapi.debug.print();
dynapi.debug.setEvaluate();
window.setTimeout('window.onfocus = setFocus;',500);
}
function NullFn(){}; // null function
function setFocus(){
dynapi={'_imageHook':NullFn};
if(window.opener) dynapi = window.opener.dynapi;
if(dynapi && dynapi.debug) {
if(!dynapi.debug.win) dynapi.debug.win=win;
var url = dynapi.documentPath+dynapi.library.path+'ext/';
var f=dynapi.functions;
imgwatch=f.getImage(url+'images/debug_imgwatch.gif',25,22,{alias:"DebugIMGWatch",name:"DebugIMGWatch",downsrc:url+"images/debug_imgwatch_down.gif",oversrc:url+"images/debug_imgwatch_on.gif",onclick:"dynapi.functions.False(dynapi.debug.switchMode('watch'))",tooltip:"Show Watch Mode"}).getHTML();
imgnormal=f.getImage(url+'images/debug_imgnormal.gif',25,22,{alias:"DebugIMGNormal",name:"DebugIMGNormal",downsrc:url+"images/debug_imgnormal_down.gif",oversrc:url+"images/debug_imgnormal_on.gif",onclick:"dynapi.functions.False(dynapi.debug.switchMode('normal'))",tooltip:"Show Normal Mode"}).getHTML();
imginspect=f.getImage(url+'images/debug_imginspect.gif',80,22,{alias:"DebugIMGInspect",name:"DebugIMGInspect",oversrc:url+"images/debug_imginspect_on.gif",onclick:"dynapi.functions.False(dynapi.debug.inspect(dynapi.debug.win.document.debugform.inspect.value))",tooltip:"Inspect Variable/Object",hspace:1}).getHTML();
imgreload=f.getImage(url+'images/debug_imgreload.gif',25,22,{alias:"DebugIMGReload",name:"DebugIMGReload",oversrc:url+"images/debug_imgreload_on.gif",onclick:"dynapi.functions.False(dynapi.debug.reload(dynapi.debug.win.document.debugform.reload.value))",tooltip:"Load/Reload DynAPI Packages, HTML Pages and JavaScript (.js) files",hspace:1}).getHTML();
imgclear=f.getImage(url+'images/debug_imgclear.gif',46,22,{alias:"DebugIMGClear",name:"DebugIMGClear",oversrc:url+"images/debug_imgclear_on.gif",onclick:"dynapi.functions.False(dynapi.debug.reset());",tooltip:"Clear debug window",hspace:1}).getHTML();
imgeval=f.getImage(url+'images/debug_imgeval.gif',100,22,{alias:"DebugIMGEval",name:"DebugIMGEval",oversrc:url+"images/debug_imgeval_on.gif",onclick:"dynapi.functions.False(dynapi.debug.evaluate(dynapi.debug.win.document.debugform.eval.value));",tooltip:"Evalute JavaScript",hspace:2}).getHTML();
imgnext=f.getImage(url+'images/debug_imgnext.gif',25,22,{alias:"DebugIMGNext",name:"DebugIMGNext",oversrc:url+"images/debug_imgnext_on.gif",onclick:"dynapi.functions.False(dynapi.debug.getEvalHistory(1))",tooltip:"Forward",hspace:1}).getHTML();
imgprev=f.getImage(url+'images/debug_imgprev.gif',25,22,{alias:"DebugIMGPrev",name:"DebugIMGPrev",oversrc:url+"images/debug_imgprev_on.gif",onclick:"dynapi.functions.False(dynapi.debug.getEvalHistory(-1))",tooltip:"Backward",hspace:1}).getHTML();
imghelp=f.getImage(url+'images/debug_imghelp.gif',25,22,{alias:"DebugIMGHelp",name:"DebugIMGHelp",downsrc:url+"images/debug_imghelp_down.gif",oversrc:url+"images/debug_imghelp_on.gif",onclick:"dynapi.functions.False(dynapi.debug.showHelp())",tooltip:"Quick Help",hspace:1}).getHTML();
}
// if main window was closed then create a dynapi._imageHook() function
// this will disable image roller and clicks
if(!dynapi) dynapi={'_imageHook':NullFn};
}
// set focus to debug window
setFocus();
if (!dynapi.ua.ns6) self.onerror = handleError;
// write out debug style
if(!dynapi.ua.ns4){
document.write('<style type="text/css">\n'
+'BODY {\n'
+' border-width:1px;\n'
+' border-style:solid;\n'
+' border-color:#000000;\n'
+'}\n'
+'.debugtextbox {\n'
+' border-width:1;\n'
+' border-style:solid;\n'
+' border-color:#3399CC;\n'
+'}\n'
+'.textinspect{width:90px;}'
+'.textreload{width:130px;}'
+'.textprint{width:100%; height:100%;}'
+'.textstat{width:100%;}'
+'.texteval{width:100%;height:132px;}'
+'.cboprev{width:100%;}'
+'</style>');
}
</script>
</head>
<body bgcolor="#0033CC" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" scrolling=no style="overflow:hidden">
<!--D4D0C8-->
<script>
var ua=dynapi.ua;
var url = dynapi.documentPath+dynapi.library.path+'ext/';
var str = ua.ie?"Internet Explorer":(ua.ns?"Netscape":(ua.moz?"Mozilla":ua.b));
var status = 'DynAPI '+dynapi.version+' ['+str+' '+dynapi.ua.v+']';
var s=0;h=[];
h[s++]='<form name="debugform"><div align="center"><center><font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">\n';
h[s++]='<table border="0" bgcolor="#EFEBDE" cellpadding="0" cellspacing="0" width="100%" height="100%">\n';
h[s++]='<tr><td colspan="2" bgcolor="#0033CC"><table border="0" width="100%" cellspacing="0" cellpadding="0">\n';
h[s++]='<tr><td width="50%" nowrap><b><font size="2" color="#FFFFFF" face="Arial"><span style="cursor:default"><img border="0" src="'+url+'images/debug_icon.gif" align="absmiddle" width="32" height="32">&nbsp;DynAPI Debugger</span></font></b></td>\n';
h[s++]='<td width="50%" bgcolor="#0033CC"><table border="0" width="100%"><tr><td width="100%" align="right">\n';
h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgwatch+' '+imgnormal+' '+imghelp+'</font></td></tr>\n';
h[s++]='</table></td></tr></table></td></tr>\n';
h[s++]='<tr><td colspan="2"><table border="0" cellspacing="0"><tr><td valign="middle">\n';
h[s++]='<input type="text" name="inspect" size="10" class="debugtextbox textinspect"></td><td>'+imginspect+'</td><td>\n';
h[s++]='<input type="text" name="reload" size="15" class="debugtextbox textreload"></td><td>'+imgreload+'</td></tr></table></td></tr><tr><td align="center" colspan="2">\n';
h[s++]='<textarea name="print" rows="11" cols="40" class="debugtextbox textprint" wrap="off"></textarea></td></tr>\n';
h[s++]='<tr><td nowrap><table border="0" cellspacing="0"><tr><td>\n';
h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgclear+'</font></td><td>\n';
h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgeval+'</font></td><td align="right">\n';
h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgprev+'</font></td><td align="right">\n';
h[s++]='<font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+imgnext+'</font></td></tr></table>\n';
h[s++]='</td><td nowrap align="center"><font size="2" face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" color="#000000">JavaScript&nbsp;</font>\n';
h[s++]='</td></tr><tr><td align="center" colspan="2">\n';
h[s++]='<textarea name="eval" rows="7" cols="40" class="debugtextbox texteval" wrap="off"></textarea></td></tr>\n';
h[s++]='<tr><td align="center" colspan="2">\n';
h[s++]='<input type="text" name="stat" size="42" '+(dynapi.ua.mac? 'style="font-family:Monaco"':'')+' value="'+status+'" class="debugtextbox textstat"></td>\n';
h[s++]='</tr></table></font></center></div></form>\n';
document.open();
document.write(h.join(''));
document.close();
</script>
</body>
</html>