Initial commit: Kimai TMS

Kimai time management system (PHP 5.6 / MySQL) with custom extensions:
- Budget tracking (ki_budget)
- Change request form (ki_changerequest)
- Invoice generation (ki_invoice)
- Expense tracking (ki_expenses)
- Flexi time (ki_flexitime)
- Export, admin panel, timesheets, tasks, summary

Database: ~900K time entries, 2,000+ users, 439 projects.
Config: includes/autoconf.php — localhost/kimai/kimai
This commit is contained in:
TMS
2026-06-18 21:20:26 +00:00
commit eb299c9131
1099 changed files with 359817 additions and 0 deletions

View File

@@ -0,0 +1,409 @@
try{if('undefined'==typeof xajax.config)xajax.config={};}catch(e){xajax={};xajax.config={};}
xajax.config.setDefault=function(option,defaultValue){if('undefined'==typeof xajax.config[option])
xajax.config[option]=defaultValue;}
xajax.config.setDefault('commonHeaders',{'If-Modified-Since':'Sat, 1 Jan 2000 00:00:00 GMT'
});xajax.config.setDefault('postHeaders',{});xajax.config.setDefault('getHeaders',{});xajax.config.setDefault('waitCursor',false);xajax.config.setDefault('statusMessages',false);xajax.config.setDefault('baseDocument',document);xajax.config.setDefault('requestURI',xajax.config.baseDocument.URL);xajax.config.setDefault('defaultMode','asynchronous');xajax.config.setDefault('defaultHttpVersion','HTTP/1.1');xajax.config.setDefault('defaultContentType','application/x-www-form-urlencoded');xajax.config.setDefault('defaultResponseDelayTime',1000);xajax.config.setDefault('defaultExpirationTime',10000);xajax.config.setDefault('defaultMethod','POST');xajax.config.setDefault('defaultRetry',5);xajax.config.setDefault('defaultReturnValue',false);xajax.config.setDefault('maxObjectDepth',20);xajax.config.setDefault('maxObjectSize',2000);xajax.config.status={update:function(){return{onRequest:function(){window.status='Sending Request...';},
onWaiting:function(){window.status='Waiting for Response...';},
onProcessing:function(){window.status='Processing...';},
onComplete:function(){window.status='Done.';}
}
},
dontUpdate:function(){return{onRequest:function(){},
onWaiting:function(){},
onProcessing:function(){},
onComplete:function(){}
}
}
}
xajax.config.cursor={update:function(){return{onWaiting:function(){if(xajax.config.baseDocument.body)
xajax.config.baseDocument.body.style.cursor='wait';},
onComplete:function(){xajax.config.baseDocument.body.style.cursor='auto';}
}
},
dontUpdate:function(){return{onWaiting:function(){},
onComplete:function(){}
}
}
}
xajax.tools={}
xajax.tools.$=function(sId){if(!sId)
return null;var oDoc=xajax.config.baseDocument;var obj=oDoc.getElementById(sId);if(obj)
return obj;if(oDoc.all)
return oDoc.all[sId];return obj;}
xajax.tools.arrayContainsValue=function(array,valueToCheck){var i=0;var l=array.length;while(i < l){if(array[i]==valueToCheck)
return true;++i;}
return false;}
xajax.tools.doubleQuotes=function(haystack){return haystack.replace(new RegExp("'",'g'),'"');}
xajax.tools.singleQuotes=function(haystack){return haystack.replace(new RegExp('"','g'),"'");}
xajax.tools._escape=function(data){if('undefined'==typeof data)
return data;if('string'!=typeof data)
return data;var needCDATA=false;if(encodeURIComponent(data)!=data){needCDATA=true;var segments=data.split('<![CDATA[');var segLen=segments.length;data=[];for(var i=0;i < segLen;++i){var segment=segments[i];var fragments=segment.split(']]>');var fragLen=fragments.length;segment='';for(var j=0;j < fragLen;++j){if(0!=j)
segment+=']]]]><![CDATA[>';segment+=fragments[j];}
if(0!=i)
data.push('<![]]><![CDATA[CDATA[');data.push(segment);}
data=data.join('');}
if(needCDATA)
data='<![CDATA['+data+']]>';return data;}
xajax.tools._objectToXML=function(obj,guard){var aXml=[];aXml.push('<xjxobj>');for(var key in obj){++guard.size;if(guard.maxSize < guard.size)
return aXml.join('');if('undefined'!=typeof obj[key]){if('constructor'==key)
continue;if('function'==typeof obj[key])
continue;aXml.push('<e><k>');var val=xajax.tools._escape(key);aXml.push(val);aXml.push('</k><v>');if('object'==typeof obj[key]){++guard.depth;if(guard.maxDepth > guard.depth){try{aXml.push(xajax.tools._objectToXML(obj[key],guard));}catch(e){}
}
--guard.depth;}else{var val=xajax.tools._escape(obj[key]);if('undefined'==typeof val||null==val){aXml.push('*');}else{var sType=typeof val;if('string'==sType)
aXml.push('S');else if('boolean'==sType)
aXml.push('B');else if('number'==sType)
aXml.push('N');aXml.push(val);}
}
aXml.push('</v></e>');}
}
aXml.push('</xjxobj>');return aXml.join('');}
xajax.tools._enforceDataType=function(value){value=new String(value);var type=value.substr(0,1);value=value.substr(1);if('*'==type)
value=null;else if('N'==type)
value=value-0;else if('B'==type)
value=!!value;return value;}
xajax.tools._nodeToObject=function(node){if(null==node)
return '';if('undefined'!=typeof node.nodeName){if('#cdata-section'==node.nodeName||'#text'==node.nodeName){var data='';do if(node.data)data+=node.data;while(node=node.nextSibling);return xajax.tools._enforceDataType(data);}else if('xjxobj'==node.nodeName){var key=null;var value=null;var data=new Array;var child=node.firstChild;while(child){if('e'==child.nodeName){var grandChild=child.firstChild;while(grandChild){if('k'==grandChild.nodeName)
key=xajax.tools._enforceDataType(grandChild.firstChild.data);else('v'==grandChild.nodeName)
value=xajax.tools._nodeToObject(grandChild.firstChild);grandChild=grandChild.nextSibling;}
if(null!=key){data[key]=value;key=value=null;}
}
child=child.nextSibling;}
return data;}
}
throw{code:10001,data:node.nodeName};}
xajax.tools.getRequestObject=function(){if('undefined'!=typeof XMLHttpRequest){xajax.tools.getRequestObject=function(){return new XMLHttpRequest();}
}else if('undefined'!=typeof ActiveXObject){xajax.tools.getRequestObject=function(){try{return new ActiveXObject('Msxml2.XMLHTTP.4.0');}catch(e){xajax.tools.getRequestObject=function(){try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e2){xajax.tools.getRequestObject=function(){return new ActiveXObject('Microsoft.XMLHTTP');}
return xajax.tools.getRequestObject();}
}
return xajax.tools.getRequestObject();}
}
}else if(window.createRequest){xajax.tools.getRequestObject=function(){return window.createRequest();}
}else{xajax.tools.getRequestObject=function(){throw{code:10002};}
}
return xajax.tools.getRequestObject();}
xajax.tools.getBrowserHTML=function(sValue){var oDoc=xajax.config.baseDocument;if(!oDoc.body)
return '';var elWorkspace=xajax.$('xajax_temp_workspace');if(!elWorkspace){elWorkspace=oDoc.createElement('div');elWorkspace.setAttribute('id','xajax_temp_workspace');elWorkspace.style.display='none';elWorkspace.style.visibility='hidden';oDoc.body.appendChild(elWorkspace);}
elWorkspace.innerHTML=sValue;var browserHTML=elWorkspace.innerHTML;elWorkspace.innerHTML='';return browserHTML;}
xajax.tools.willChange=function(element,attribute,newData){if('string'==typeof element)
element=xajax.$(element);if(element){var oldData;eval('oldData=element.'+attribute);return(newData!=oldData);}
return false;}
xajax.tools.getFormValues=function(parent){var submitDisabledElements=false;if(arguments.length > 1&&arguments[1]==true)
submitDisabledElements=true;var prefix='';if(arguments.length > 2)
prefix=arguments[2];if('string'==typeof parent)
parent=xajax.$(parent);var aFormValues={};if(parent)
if(parent.childNodes)
xajax.tools._getFormValues(aFormValues,parent.childNodes,submitDisabledElements,prefix);return aFormValues;}
xajax.tools._getFormValues=function(aFormValues,children,submitDisabledElements,prefix){var iLen=children.length;for(var i=0;i < iLen;++i){var child=children[i];if('undefined'!=typeof child.childNodes)
xajax.tools._getFormValues(aFormValues,child.childNodes,submitDisabledElements,prefix);xajax.tools._getFormValue(aFormValues,child,submitDisabledElements,prefix);}
}
xajax.tools._getFormValue=function(aFormValues,child,submitDisabledElements,prefix){if(!child.name)
return;if(child.disabled)
if(true==child.disabled)
if(false==submitDisabledElements)
return;if(prefix!=child.name.substring(0,prefix.length))
return;if(child.type)
if(child.type=='radio'||child.type=='checkbox')
if(false==child.checked)
return;var name=child.name;var values=[];if('select-multiple'==child.type){var jLen=child.length;for(var j=0;j < jLen;++j){var option=child.options[j];if(true==option.selected)
values.push(option.value);}
}else{values=child.value;}
var keyBegin=name.indexOf('[');if(0 <=keyBegin){var n=name;var k=n.substr(0,n.indexOf('['));var a=n.substr(n.indexOf('['));if(typeof aFormValues[k]=='undefined')
aFormValues[k]={};var p=aFormValues;while(a.length!=0){var sa=a.substr(0,a.indexOf(']')+1);var lk=k;var lp=p;a=a.substr(a.indexOf(']')+1);p=p[k];k=sa.substr(1,sa.length-2);if(k==''){if('select-multiple'==child.type){k=lk;p=lp;}else{var i=0;for(afoo in p)i++;k=i;}
}
if(typeof p[k]=='undefined'){p[k]={};}
}
p[k]=values;}else{aFormValues[name]=values;}
}
xajax.tools.stripOnPrefix=function(sEventName){sEventName=sEventName.toLowerCase();if(0==sEventName.indexOf('on'))
sEventName=sEventName.replace(/on/,'');return sEventName;}
xajax.tools.addOnPrefix=function(sEventName){sEventName=sEventName.toLowerCase();if(0!=sEventName.indexOf('on'))
sEventName='on'+sEventName;return sEventName;}
xajax.tools.xml={};xajax.tools.xml.parseAttributes=function(child,obj){var iLen=child.attributes.length;for(var i=0;i < iLen;++i){var attr=child.attributes[i];obj[attr.name]=attr.value;}
}
xajax.tools.xml.parseChildren=function(child,obj){obj.data='';if(0 < child.childNodes.length){if(1 < child.childNodes.length){var grandChild=child.firstChild;do{if('#cdata-section'==grandChild.nodeName||'#text'==grandChild.nodeName){obj.data+=grandChild.data;}
}while(grandChild=grandChild.nextSibling);}else{var grandChild=child.firstChild;if('xjxobj'==grandChild.nodeName){obj.data=xajax.tools._nodeToObject(grandChild);return;}else if('#cdata-section'==grandChild.nodeName||'#text'==grandChild.nodeName){obj.data=grandChild.data;}
}
}else if('undefined'!=typeof child.data){obj.data=child.data;}
obj.data=xajax.tools._enforceDataType(obj.data);}
xajax.tools.xml.processFragment=function(xmlNode,seq,oRequest){var xx=xajax;var xt=xx.tools;while(xmlNode){if('cmd'==xmlNode.nodeName){var obj={};obj.fullName='*unknown*';obj.sequence=seq;obj.request=oRequest;obj.context=oRequest.context;xt.xml.parseAttributes(xmlNode,obj);xt.xml.parseChildren(xmlNode,obj);xt.queue.push(xx.response,obj);}else if('xjxrv'==xmlNode.nodeName){oRequest.returnValue=xt._nodeToObject(xmlNode.firstChild);}else if('debugmsg'==xmlNode.nodeName){}else
throw{code:10004,data:xmlNode.nodeName}
++seq;xmlNode=xmlNode.nextSibling;}
}
xajax.tools.queue={}
xajax.tools.queue.create=function(size){return{start:0,
size:size,
end:0,
commands:[],
timeout:null
}
}
xajax.tools.queue.retry=function(obj,count){var retries=obj.retries;if(retries){--retries;if(1 > retries)
return false;}else retries=count;obj.retries=retries;return true;}
xajax.tools.queue.rewind=function(theQ){if(0 < theQ.start)
--theQ.start;else
theQ.start=theQ.size;}
xajax.tools.queue.setWakeup=function(theQ,when){if(null!=theQ.timeout){clearTimeout(theQ.timeout);theQ.timeout=null;}
theQ.timout=setTimeout(function(){xajax.tools.queue.process(theQ);},when);}
xajax.tools.queue.process=function(theQ){if(null!=theQ.timeout){clearTimeout(theQ.timeout);theQ.timeout=null;}
var obj=xajax.tools.queue.pop(theQ);while(null!=obj){try{if(false==xajax.executeCommand(obj))
return false;}catch(e){}
delete obj;obj=xajax.tools.queue.pop(theQ);}
return true;}
xajax.tools.queue.push=function(theQ,obj){var next=theQ.end+1;if(next > theQ.size)
next=0;if(next!=theQ.start){theQ.commands[theQ.end]=obj;theQ.end=next;}else
throw{code:10003}
}
xajax.tools.queue.pushFront=function(theQ,obj){xajax.tools.queue.rewind(theQ);theQ.commands[theQ.start]=obj;}
xajax.tools.queue.pop=function(theQ){var next=theQ.start;if(next==theQ.end)
return null;next++;if(next > theQ.size)
next=0;var obj=theQ.commands[theQ.start];delete theQ.commands[theQ.start];theQ.start=next;return obj;}
xajax.responseProcessor={};xajax.responseProcessor.xml=function(oRequest){var xx=xajax;var xt=xx.tools;var xcb=xx.callback;var gcb=xcb.global;var lcb=oRequest.callback;if(xt.arrayContainsValue(xx.responseSuccessCodes,oRequest.request.status)){xcb.execute([gcb,lcb],'onSuccess',oRequest);var seq=0;if(oRequest.request.responseXML){var responseXML=oRequest.request.responseXML;if(responseXML.documentElement){oRequest.status.onProcessing();var child=responseXML.documentElement.firstChild;xt.xml.processFragment(child,seq,oRequest);}
}
var obj={};obj.fullName='Response Complete';obj.sequence=seq;obj.request=oRequest;obj.context=oRequest.context;obj.cmd='rcmplt';xt.queue.push(xx.response,obj);if(null==xx.response.timeout)
xt.queue.process(xx.response);}else if(xt.arrayContainsValue(xx.responseRedirectCodes,oRequest.request.status)){xcb.execute([gcb,lcb],'onRedirect',oRequest);window.location=oRequest.request.getResponseHeader('location');xx.completeResponse(oRequest);}else if(xt.arrayContainsValue(xx.responseErrorsForAlert,oRequest.request.status)){xcb.execute([gcb,lcb],'onFailure',oRequest);xx.completeResponse(oRequest);}
return oRequest.returnValue;}
xajax.js={}
xajax.js.includeScriptOnce=function(command){command.fullName='includeScriptOnce';var fileName=command.data;var oDoc=xajax.config.baseDocument;var loadedScripts=oDoc.getElementsByTagName('script');var iLen=loadedScripts.length;for(var i=0;i < iLen;++i){var script=loadedScripts[i];if(script.src){if(0 <=script.src.indexOf(fileName))
return true;}
}
return xajax.js.includeScript({data:fileName});}
xajax.js.includeScript=function(command){command.fullName='includeScript';var fileName=command.data;var oDoc=xajax.config.baseDocument;var objHead=oDoc.getElementsByTagName('head');var objScript=oDoc.createElement('script');objScript.type='text/javascript';objScript.src=fileName;if('function'==command.onload){objScript.onload.command.onload;}
objHead[0].appendChild(objScript);return true;}
xajax.js.removeScript=function(command){command.fullName='removeScript';var fileName=command.data;var unload=command.unld;var oDoc=xajax.config.baseDocument;var loadedScripts=oDoc.getElementsByTagName('script');var iLen=loadedScripts.length;for(var i=0;i < iLen;++i){var script=loadedScripts[i];if(script.src){if(0 <=script.src.indexOf(fileName)){if('undefined'!=typeof unload){var args={};args.data=unload;args.context=window;xajax.js.execute(args);}
var parent=script.parentNode;parent.removeChild(script);}
}
}
return true;}
xajax.js.sleep=function(command){command.fullName='sleep';if(xajax.tools.queue.retry(command,command.prop)){xajax.tools.queue.setWakeup(xajax.response,100);return false;}
return true;}
xajax.js.confirmCommands=function(command){command.fullName='confirmCommands';var msg=command.data;var numberOfCommands=command.id;if(false==confirm(msg)){while(0 < numberOfCommands){xajax.tools.queue.pop(xajax.response);--numberOfCommands;}
}
return true;}
xajax.js.execute=function(args){args.fullName='execute Javascript';var returnValue=true;args.context.xajaxDelegateCall=function(){eval(args.data);}
args.context.xajaxDelegateCall();return returnValue;}
xajax.js.waitFor=function(args){args.fullName='waitFor';var bResult=false;var cmdToEval='bResult = (';cmdToEval+=args.data;cmdToEval+=');';try{args.context.xajaxDelegateCall=function(){eval(cmdToEval);}
args.context.xajaxDelegateCall();}catch(e){}
if(false==bResult){if(xajax.tools.queue.retry(args,args.prop)){xajax.tools.queue.setWakeup(xajax.response,100);return false;}
}
return true;}
xajax.js.call=function(args){args.fullName='call js function';var parameters=args.data;var scr=new Array();scr.push(args.func);scr.push('(');if('undefined'!=typeof parameters){if('object'==typeof parameters){var iLen=parameters.length;if(0 < iLen){scr.push('parameters[0]');for(var i=1;i < iLen;++i)
scr.push(', parameters['+i+']');}
}
}
scr.push(');');args.context.xajaxDelegateCall=function(){eval(scr.join(''));}
args.context.xajaxDelegateCall();return true;}
xajax.js.setFunction=function(args){args.fullName='setFunction';var code=new Array();code.push(args.func);code.push(' = function(');if('object'==typeof args.prop){var separator='';for(var m in args.prop){code.push(separator);code.push(args.prop[m]);separator=',';}
}else code.push(args.prop);code.push(') { ');code.push(args.data);code.push(' }');args.context.xajaxDelegateCall=function(){eval(code.join(''));}
args.context.xajaxDelegateCall();return true;}
xajax.js.wrapFunction=function(args){args.fullName='wrapFunction';var code=new Array();code.push(args.func);code.push(' = xajax.js.makeWrapper(');code.push(args.func);code.push(', args.prop, args.data, args.type, args.context);');args.context.xajaxDelegateCall=function(){eval(code.join(''));}
args.context.xajaxDelegateCall();return true;}
xajax.js.makeWrapper=function(origFun,args,codeBlocks,returnVariable,context){var originalCall='';if(0 < returnVariable.length){originalCall+=returnVariable;originalCall+=' = ';}
var originalCall='origFun(';originalCall+=args;originalCall+='); ';var code='wrapper = function(';code+=args;code+=') { ';if(0 < returnVariable.length){code+=' var ';code+=returnVariable;code+=' = null;';}
var separator='';var bLen=codeBlocks.length;for(var b=0;b < bLen;++b){code+=separator;code+=codeBlocks[b];separator=originalCall;}
if(0 < returnVariable.length){code+=' return ';code+=returnVariable;code+=';';}
code+=' } ';var wrapper=null;context.xajaxDelegateCall=function(){eval(code);}
context.xajaxDelegateCall();return wrapper;}
xajax.dom={}
xajax.dom.assign=function(element,property,data){if('string'==typeof element)
element=xajax.$(element);switch(property){case 'innerHTML':
element.innerHTML=data;break;case 'outerHTML':
if('undefined'==typeof element.outerHTML){var r=xajax.config.baseDocument.createRange();r.setStartBefore(element);var df=r.createContextualFragment(data);element.parentNode.replaceChild(df,element);}else element.outerHTML=data;break;default:
if(xajax.tools.willChange(element,property,data))
eval('element.'+property+' = data;');break;}
return true;}
xajax.dom.append=function(element,property,data){if('string'==typeof element)
element=xajax.$(element);eval('element.'+property+' += data;');return true;}
xajax.dom.prepend=function(element,property,data){if('string'==typeof element)
element=xajax.$(element);eval('element.'+property+' = data + element.'+property);return true;}
xajax.dom.replace=function(element,sAttribute,aData){var sSearch=aData['s'];var sReplace=aData['r'];if(sAttribute=='innerHTML')
sSearch=xajax.tools.getBrowserHTML(sSearch);if('string'==typeof element)
element=xajax.$(element);eval('var txt = element.'+sAttribute);var bFunction=false;if('function'==typeof txt){txt=txt.join('');bFunction=true;}
var start=txt.indexOf(sSearch);if(start >-1){var newTxt=[];while(start >-1){var end=start+sSearch.length;newTxt.push(txt.substr(0,start));newTxt.push(sReplace);txt=txt.substr(end,txt.length-end);start=txt.indexOf(sSearch);}
newTxt.push(txt);newTxt=newTxt.join('');if(bFunction){eval('element.'+sAttribute+'=newTxt;');}else if(xajax.tools.willChange(element,sAttribute,newTxt)){eval('element.'+sAttribute+'=newTxt;');}
}
return true;}
xajax.dom.remove=function(element){if('string'==typeof element)
element=xajax.$(element);if(element&&element.parentNode&&element.parentNode.removeChild)
element.parentNode.removeChild(element);return true;}
xajax.dom.create=function(objParent,sTag,sId){if('string'==typeof objParent)
objParent=xajax.$(objParent);var target=xajax.config.baseDocument.createElement(sTag);target.setAttribute('id',sId);if(objParent)
objParent.appendChild(target);return true;}
xajax.dom.insert=function(objSibling,sTag,sId){if('string'==typeof objSibling)
objSibling=xajax.$(objSibling);var target=xajax.config.baseDocument.createElement(sTag);target.setAttribute('id',sId);objSibling.parentNode.insertBefore(target,objSibling);return true;}
xajax.dom.insertAfter=function(objSibling,sTag,sId){if('string'==typeof objSibling)
objSibling=xajax.$(objSibling);var target=xajax.config.baseDocument.createElement(sTag);target.setAttribute('id',sId);objSibling.parentNode.insertBefore(target,objSibling.nextSibling);return true;}
xajax.dom.contextAssign=function(args){args.fullName='context assign';var code=[];code.push('this.');code.push(args.prop);code.push(' = data;');code=code.join('');args.context.xajaxDelegateCall=function(data){eval(code);}
args.context.xajaxDelegateCall(args.data);return true;}
xajax.dom.contextAppend=function(args){args.fullName='context append';var code=[];code.push('this.');code.push(args.prop);code.push(' += data;');code=code.join('');args.context.xajaxDelegateCall=function(data){eval(code);}
args.context.xajaxDelegateCall(args.data);return true;}
xajax.dom.contextPrepend=function(args){args.fullName='context prepend';var code=[];code.push('this.');code.push(args.prop);code.push(' = data + this.');code.push(args.prop);code.push(';');code=code.join('');args.context.xajaxDelegateCall=function(data){eval(code);}
args.context.xajaxDelegateCall(args.data);return true;}
xajax.css={}
xajax.css.add=function(filename){var oDoc=xajax.config.baseDocument;var oHeads=oDoc.getElementsByTagName('head');var oHead=oHeads[0];var oLinks=oHead.getElementsByTagName('link');var found=false;var iLen=oLinks.length;for(var i=0;i < iLen&&false==found;++i)
if(0 < oLinks[i].href.indexOf(filename))
found=true;if(false==found){var oCSS=oDoc.createElement('link');oCSS.rel='stylesheet';oCSS.type='text/css';oCSS.href=filename;oHead.appendChild(oCSS);}
return true;}
xajax.css.remove=function(filename){var oDoc=xajax.config.baseDocument;var oHeads=oDoc.getElementsByTagName('head');var oHead=oHeads[0];var oLinks=oHead.getElementsByTagName('link');var i=0;while(i < oLinks.length)
if(0 <=oLinks[i].href.indexOf(filename))
oHead.removeChild(oLinks[i]);else++i;return true;}
xajax.css.waitForCSS=function(args){var oDocSS=xajax.config.baseDocument.styleSheets;var ssEnabled=[];var iLen=oDocSS.length;for(var i=0;i < iLen;++i){ssEnabled[i]=0;try{ssEnabled[i]=oDocSS[i].cssRules.length;}catch(e){try{ssEnabled[i]=oDocSS[i].rules.length;}catch(e){}
}
}
var ssLoaded=true;var iLen=ssEnabled.length;for(var i=0;i < iLen;++i)
if(0==ssEnabled[i])
ssLoaded=false;if(false==ssLoaded){if(xajax.tools.queue.retry(args,args.prop)){xajax.tools.queue.setWakeup(xajax.response,10);return false;}
}
return true;}
xajax.forms={}
xajax.forms.getInput=function(type,name,id){if('undefined'==typeof window.addEventListener){xajax.forms.getInput=function(type,name,id){return xajax.config.baseDocument.createElement('<input type="'+type+'" name="'+name+'" id="'+id+'">');}
}else{xajax.forms.getInput=function(type,name,id){var oDoc=xajax.config.baseDocument;var Obj=oDoc.createElement('input');Obj.setAttribute('type',type);Obj.setAttribute('name',name);Obj.setAttribute('id',id);return Obj;}
}
return xajax.forms.getInput(type,name,id);}
xajax.forms.createInput=function(command){command.fullName='createInput';var objParent=command.id;var sType=args.type;var sName=args.data;var sId=args.prop;if('string'==typeof objParent)
objParent=xajax.$(objParent);var target=xajax.forms.getInput(sType,sName,sId);if(objParent&&target)
objParent.appendChild(target);return true;}
xajax.forms.insertInput=function(command){command.fullName='insertInput';var objSibling=command.id;var sType=command.type;var sName=command.data;var sId=command.prop;if('string'==typeof objSibling)
objSibling=xajax.$(objSibling);var target=xajax.forms.getInput(sType,sName,sId);if(target&&objSibling&&objSibling.parentNode)
objSibling.parentNode.insertBefore(target,objSibling);return true;}
xajax.forms.insertInputAfter=function(command){command.fullName='insertInputAfter';var objSibling=command.id;var sType=command.type;var sName=command.data;var sId=command.prop;if('string'==typeof objSibling)
objSibling=xajax.$(objSibling);var target=xajax.forms.getInput(sType,sName,sId);if(target&&objSibling&&objSibling.parentNode)
objSibling.parentNode.insertBefore(target,objSibling.nextSibling);return true;}
xajax.events={}
xajax.events.setEvent=function(command){command.fullName='addEvent';var element=command.id;var sEvent=command.prop;var code=command.data;if('string'==typeof element)
element=xajax.$(element);sEvent=xajax.tools.addOnPrefix(sEvent);code=xajax.tools.doubleQuotes(code);eval('element.'+sEvent+' = function() { '+code+'; }');return true;}
xajax.events.addHandler=function(element,sEvent,fun){if(window.addEventListener){xajax.events.addHandler=function(command){command.fullName='addHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element)
element=xajax.$(element);sEvent=xajax.tools.stripOnPrefix(sEvent);eval('element.addEventListener("'+sEvent+'", '+fun+', false);');return true;}
}else{xajax.events.addHandler=function(command){command.fullName='addHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element)
element=xajax.$(element);sEvent=xajax.tools.addOnPrefix(sEvent);eval('element.attachEvent("'+sEvent+'", '+fun+', false);');return true;}
}
return xajax.events.addHandler(element,sEvent,fun);}
xajax.events.removeHandler=function(element,sEvent,fun){if(window.removeEventListener){xajax.events.removeHandler=function(command){command.fullName='removeHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element)
element=xajax.$(element);sEvent=xajax.tools.stripOnPrefix(sEvent);eval('element.removeEventListener("'+sEvent+'", '+fun+', false);');return true;}
}else{xajax.events.removeHandler=function(command){command.fullName='removeHandler';var element=command.id;var sEvent=command.prop;var fun=command.data;if('string'==typeof element)
element=xajax.$(element);sEvent=xajax.tools.addOnPrefix(sEvent);eval('element.detachEvent("'+sEvent+'", '+fun+', false);');return true;}
}
return xajax.events.removeHandler(element,sEvent,fun);}
xajax.callback={}
xajax.callback.create=function(){var xx=xajax;var xc=xx.config;var xcb=xx.callback;var oCB={}
oCB.timers={};oCB.timers.onResponseDelay=xcb.setupTimer(
(arguments.length > 0)
? arguments[0]
:xc.defaultResponseDelayTime);oCB.timers.onExpiration=xcb.setupTimer(
(arguments.length > 1)
? arguments[1]
:xc.defaultExpirationTime);oCB.onRequest=null;oCB.onResponseDelay=null;oCB.onExpiration=null;oCB.beforeResponseProcessing=null;oCB.onFailure=null;oCB.onRedirect=null;oCB.onSuccess=null;oCB.onComplete=null;return oCB;}
xajax.callback.setupTimer=function(iDelay){return{timer:null,delay:iDelay};}
xajax.callback.clearTimer=function(oCallback,sFunction){if('undefined'!=typeof oCallback.timers){if('undefined'!=typeof oCallback.timers[sFunction]){clearTimeout(oCallback.timers[sFunction].timer);}
}else if('object'==typeof oCallback){var iLen=oCallback.length;for(var i=0;i < iLen;++i)
xajax.callback.clearTimer(oCallback[i],sFunction);}
}
xajax.callback.execute=function(oCallback,sFunction,args){if('undefined'!=typeof oCallback[sFunction]){var func=oCallback[sFunction];if('function'==typeof func){if('undefined'!=typeof oCallback.timers[sFunction]){oCallback.timers[sFunction].timer=setTimeout(function(){func(args);},oCallback.timers[sFunction].delay);}
else{func(args);}
}
}else if('object'==typeof oCallback){var iLen=oCallback.length;for(var i=0;i < iLen;++i)
xajax.callback.execute(oCallback[i],sFunction,args);}
}
xajax.callback.global=xajax.callback.create();xajax.response=xajax.tools.queue.create(1000);xajax.responseSuccessCodes=['0','200'];xajax.responseErrorsForAlert=['400','401','402','403','404','500','501','502','503'];xajax.responseRedirectCodes=['301','302','307'];if('undefined'==typeof xajax.command)
xajax.command={};xajax.command.create=function(sequence,request,context){var newCmd={};newCmd.cmd='*';newCmd.fullName='* unknown command name *';newCmd.sequence=sequence;newCmd.request=request;newCmd.context=context;return newCmd;}
if('undefined'==typeof xajax.command.handler)
xajax.command.handler={};if('undefined'==typeof xajax.command.handler.handlers)
xajax.command.handler.handlers=[];xajax.command.handler.register=function(shortName,func){xajax.command.handler.handlers[shortName]=func;}
xajax.command.handler.unregister=function(shortName){var func=xajax.command.handler.handlers[shortName];delete xajax.command.handler.handlers[shortName];return func;}
xajax.command.handler.isRegistered=function(command){var shortName=command.cmd;if(xajax.command.handler.handlers[shortName])
return true;return false;}
xajax.command.handler.call=function(command){var shortName=command.cmd;return xajax.command.handler.handlers[shortName](command);}
xajax.command.handler.register('rcmplt',function(args){xajax.completeResponse(args.request);return true;});xajax.command.handler.register('css',function(args){args.fullName='includeCSS';return xajax.css.add(args.data);});xajax.command.handler.register('rcss',function(args){args.fullName='removeCSS';return xajax.css.remove(args.data);});xajax.command.handler.register('wcss',function(args){args.fullName='waitForCSS';return xajax.css.waitForCSS(args);});xajax.command.handler.register('as',function(args){args.fullName='assign/clear';try{return xajax.dom.assign(args.target,args.prop,args.data);}catch(e){}
return true;});xajax.command.handler.register('ap',function(args){args.fullName='append';return xajax.dom.append(args.target,args.prop,args.data);});xajax.command.handler.register('pp',function(args){args.fullName='prepend';return xajax.dom.prepend(args.target,args.prop,args.data);});xajax.command.handler.register('rp',function(args){args.fullName='replace';return xajax.dom.replace(args.id,args.prop,args.data);});xajax.command.handler.register('rm',function(args){args.fullName='remove';return xajax.dom.remove(args.id);});xajax.command.handler.register('ce',function(args){args.fullName='create';return xajax.dom.create(args.id,args.data,args.prop);});xajax.command.handler.register('ie',function(args){args.fullName='insert';return xajax.dom.insert(args.id,args.data,args.prop);});xajax.command.handler.register('ia',function(args){args.fullName='insertAfter';return xajax.dom.insertAfter(args.id,args.data,args.prop);});xajax.command.handler.register('c:as',xajax.dom.contextAssign);xajax.command.handler.register('c:ap',xajax.dom.contextAppend);xajax.command.handler.register('c:pp',xajax.dom.contextPrepend);xajax.command.handler.register('s',xajax.js.sleep);xajax.command.handler.register('ino',xajax.js.includeScriptOnce);xajax.command.handler.register('in',xajax.js.includeScript);xajax.command.handler.register('rjs',xajax.js.removeScript);xajax.command.handler.register('wf',xajax.js.waitFor);xajax.command.handler.register('js',xajax.js.execute);xajax.command.handler.register('jc',xajax.js.call);xajax.command.handler.register('sf',xajax.js.setFunction);xajax.command.handler.register('wpf',xajax.js.wrapFunction);xajax.command.handler.register('al',function(args){args.fullName='alert';alert(args.data);return true;});xajax.command.handler.register('cc',xajax.js.confirmCommands);xajax.command.handler.register('ci',xajax.forms.createInput);xajax.command.handler.register('ii',xajax.forms.insertInput);xajax.command.handler.register('iia',xajax.forms.insertInputAfter);xajax.command.handler.register('ev',xajax.events.setEvent);xajax.command.handler.register('ah',xajax.events.addHandler);xajax.command.handler.register('rh',xajax.events.removeHandler);xajax.command.handler.register('dbg',function(args){args.fullName='debug message';return true;});xajax.initializeRequest=function(oRequest){var xx=xajax;var xc=xx.config;oRequest.append=function(opt,def){if('undefined'!=typeof this[opt]){for(var itmName in def)
if('undefined'==typeof this[opt][itmName])
this[opt][itmName]=def[itmName];}else this[opt]=def;}
oRequest.append('commonHeaders',xc.commonHeaders);oRequest.append('postHeaders',xc.postHeaders);oRequest.append('getHeaders',xc.getHeaders);oRequest.set=function(option,defaultValue){if('undefined'==typeof this[option])
this[option]=defaultValue;}
oRequest.set('statusMessages',xc.statusMessages);oRequest.set('waitCursor',xc.waitCursor);oRequest.set('mode',xc.defaultMode);oRequest.set('method',xc.defaultMethod);oRequest.set('URI',xc.requestURI);oRequest.set('httpVersion',xc.defaultHttpVersion);oRequest.set('contentType',xc.defaultContentType);oRequest.set('retry',xc.defaultRetry);oRequest.set('returnValue',xc.defaultReturnValue);oRequest.set('maxObjectDepth',xc.maxObjectDepth);oRequest.set('maxObjectSize',xc.maxObjectSize);oRequest.set('context',window);var xcb=xx.callback;var gcb=xcb.global;var lcb=xcb.create();lcb.take=function(frm,opt){if('undefined'!=typeof frm[opt]){lcb[opt]=frm[opt];lcb.hasEvents=true;}
delete frm[opt];}
lcb.take(oRequest,'onRequest');lcb.take(oRequest,'onResponseDelay');lcb.take(oRequest,'onExpiration');lcb.take(oRequest,'beforeResponseProcessing');lcb.take(oRequest,'onFailure');lcb.take(oRequest,'onRedirect');lcb.take(oRequest,'onSuccess');lcb.take(oRequest,'onComplete');if('undefined'!=typeof oRequest.callback){if(lcb.hasEvents)
oRequest.callback=[oRequest.callback,lcb];}else
oRequest.callback=lcb;oRequest.status=(oRequest.statusMessages)
? xc.status.update()
:xc.status.dontUpdate();oRequest.cursor=(oRequest.waitCursor)
? xc.cursor.update()
:xc.cursor.dontUpdate();oRequest.method=oRequest.method.toUpperCase();if('GET'!=oRequest.method)
oRequest.method='POST';oRequest.requestRetry=oRequest.retry;oRequest.append('postHeaders',{'content-type':oRequest.contentType
});delete oRequest['append'];delete oRequest['set'];delete oRequest['take'];if('undefined'==typeof oRequest.URI)
throw{code:10005}
}
xajax.processParameters=function(oRequest){var xx=xajax;var xt=xx.tools;var rd=[];var separator='';for(var sCommand in oRequest.functionName){if('constructor'!=sCommand){rd.push(separator);rd.push(sCommand);rd.push('=');rd.push(encodeURIComponent(oRequest.functionName[sCommand]));separator='&';}
}
var dNow=new Date();rd.push('&xjxr=');rd.push(dNow.getTime());delete dNow;if(oRequest.parameters){var i=0;var iLen=oRequest.parameters.length;while(i < iLen){var oVal=oRequest.parameters[i];if('object'==typeof oVal&&null!=oVal){try{var oGuard={};oGuard.depth=0;oGuard.maxDepth=oRequest.maxObjectDepth;oGuard.size=0;oGuard.maxSize=oRequest.maxObjectSize;oVal=xt._objectToXML(oVal,oGuard);}catch(e){oVal='';}
rd.push('&xjxargs[]=');oVal=encodeURIComponent(oVal);rd.push(oVal);++i;}else{rd.push('&xjxargs[]=');oVal=xt._escape(oVal);if('undefined'==typeof oVal||null==oVal){rd.push('*');}else{var sType=typeof oVal;if('string'==sType)
rd.push('S');else if('boolean'==sType)
rd.push('B');else if('number'==sType)
rd.push('N');oVal=encodeURIComponent(oVal);rd.push(oVal);}
++i;}
}
}
oRequest.requestURI=oRequest.URI;if('GET'==oRequest.method){oRequest.requestURI+=oRequest.requestURI.indexOf('?')==-1 ? '?':'&';oRequest.requestURI+=rd.join('');rd=[];}
oRequest.requestData=rd.join('');}
xajax.prepareRequest=function(oRequest){var xx=xajax;var xt=xx.tools;oRequest.request=xt.getRequestObject();oRequest.setRequestHeaders=function(headers){if('object'==typeof headers){for(var optionName in headers)
this.request.setRequestHeader(optionName,headers[optionName]);}
}
oRequest.setCommonRequestHeaders=function(){this.setRequestHeaders(this.commonHeaders);}
oRequest.setPostRequestHeaders=function(){this.setRequestHeaders(this.postHeaders);}
oRequest.setGetRequestHeaders=function(){this.setRequestHeaders(this.getHeaders);}
if('asynchronous'==oRequest.mode){oRequest.request.onreadystatechange=function(){if(oRequest.request.readyState!=4)
return;xajax.responseReceived(oRequest);}
oRequest.finishRequest=function(){return this.returnValue;}
}else{oRequest.finishRequest=function(){return xajax.responseReceived(oRequest);}
}
if('undefined'!=typeof oRequest.userName&&'undefined'!=typeof oRequest.password){oRequest.open=function(){this.request.open(
this.method,
this.requestURI,
'asynchronous'==this.mode,
oRequest.userName,
oRequest.password);}
}else{oRequest.open=function(){this.request.open(
this.method,
this.requestURI,
'asynchronous'==this.mode);}
}
if('POST'==oRequest.method){oRequest.applyRequestHeaders=function(){this.setCommonRequestHeaders();try{this.setPostRequestHeaders();}catch(e){this.method='GET';this.requestURI+=this.requestURI.indexOf('?')==-1 ? '?':'&';this.requestURI+=this.requestData;this.requestData='';if(0==this.requestRetry)this.requestRetry=1;throw e;}
}
}else{oRequest.applyRequestHeaders=function(){this.setCommonRequestHeaders();this.setGetRequestHeaders();}
}
}
xajax.request=function(){var numArgs=arguments.length;if(0==numArgs)
return false;var oRequest={}
if(1 < numArgs)
oRequest=arguments[1];oRequest.functionName=arguments[0];var xx=xajax;xx.initializeRequest(oRequest);xx.processParameters(oRequest);while(0 < oRequest.requestRetry){try{--oRequest.requestRetry;xx.prepareRequest(oRequest);return xx.submitRequest(oRequest);}catch(e){xajax.callback.execute(
[xajax.callback.global,oRequest.callback],
'onFailure',oRequest);if(0==oRequest.requestRetry)
throw e;}
}
}
xajax.call=function(){var numArgs=arguments.length;if(0==numArgs)
return false;var oRequest={}
if(1 < numArgs)
oRequest=arguments[1];oRequest.functionName={xjxfun:arguments[0]};var xx=xajax;xx.initializeRequest(oRequest);xx.processParameters(oRequest);while(0 < oRequest.requestRetry){try{--oRequest.requestRetry;xx.prepareRequest(oRequest);return xx.submitRequest(oRequest);}catch(e){xajax.callback.execute(
[xajax.callback.global,oRequest.callback],
'onFailure',oRequest);if(0==oRequest.requestRetry)
throw e;}
}
}
xajax.submitRequest=function(oRequest){oRequest.status.onRequest();var xcb=xajax.callback;var gcb=xcb.global;var lcb=oRequest.callback;xcb.execute([gcb,lcb],'onResponseDelay',oRequest);xcb.execute([gcb,lcb],'onExpiration',oRequest);xcb.execute([gcb,lcb],'onRequest',oRequest);oRequest.open();oRequest.applyRequestHeaders();oRequest.cursor.onWaiting();oRequest.status.onWaiting();xajax._internalSend(oRequest);return oRequest.finishRequest();}
xajax._internalSend=function(oRequest){oRequest.request.send(oRequest.requestData);}
xajax.abortRequest=function(oRequest){oRequest.aborted=true;oRequest.request.abort();xajax.completeResponse(oRequest);}
xajax.responseReceived=function(oRequest){var xx=xajax;var xcb=xx.callback;var gcb=xcb.global;var lcb=oRequest.callback;if(oRequest.aborted)
return;xcb.clearTimer([gcb,lcb],'onExpiration');xcb.clearTimer([gcb,lcb],'onResponseDelay');xcb.execute([gcb,lcb],'beforeResponseProcessing',oRequest);var fProc=xx.getResponseProcessor(oRequest);if('undefined'==typeof fProc){xcb.execute([gcb,lcb],'onFailure',oRequest);xx.completeResponse(oRequest);return;}
return fProc(oRequest);}
xajax.getResponseProcessor=function(oRequest){var fProc;if('undefined'==typeof oRequest.responseProcessor){var cTyp=oRequest.request.getResponseHeader('content-type');if(cTyp){if(0 <=cTyp.indexOf('text/xml')){fProc=xajax.responseProcessor.xml;}
}
}else fProc=oRequest.responseProcessor;return fProc;}
xajax.executeCommand=function(command){if(xajax.command.handler.isRegistered(command)){if(command.id)
command.target=xajax.$(command.id);if(false==xajax.command.handler.call(command)){xajax.tools.queue.pushFront(xajax.response,command);return false;}
}
return true;}
xajax.completeResponse=function(oRequest){xajax.callback.execute(
[xajax.callback.global,oRequest.callback],
'onComplete',oRequest);oRequest.cursor.onComplete();oRequest.status.onComplete();delete oRequest['functionName'];delete oRequest['requestURI'];delete oRequest['requestData'];delete oRequest['requestRetry'];delete oRequest['request'];delete oRequest['set'];delete oRequest['open'];delete oRequest['setRequestHeaders'];delete oRequest['setCommonRequestHeaders'];delete oRequest['setPostRequestHeaders'];delete oRequest['setGetRequestHeaders'];delete oRequest['applyRequestHeaders'];delete oRequest['finishRequest'];delete oRequest['status'];delete oRequest['cursor'];}
xajax.$=xajax.tools.$;xajax.getFormValues=xajax.tools.getFormValues;xajax.isLoaded=true;xjx={}
xjx.$=xajax.tools.$;xjx.getFormValues=xajax.tools.getFormValues;xjx.call=xajax.call;xjx.request=xajax.request;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,856 @@
/*
File: xajax_debug.js
This optional file contains the debugging module for use with xajax. If
you include this module after the standard <xajax_core.js> module, you
will receive debugging messages, including errors, that occur during
the processing of your xajax requests.
Title: xajax debugging module
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajax_debug_uncompressed.js 327 2007-02-28 16:55:26Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajax.debug
This object contains the variables and functions used to display process state
messages and to trap error conditions and report them to the user via
a secondary browser window or alert messages as necessary.
*/
try {
if ('undefined' == typeof xajax.debug)
xajax.debug = {}
} catch (e) {
alert('An internal error has occurred: the xajax_core has not been loaded prior to xajax_debug.');
}
/*
String: workId
Stores a 'unique' identifier for this session so that an existing debugging
window can be detected, else one will be created.
*/
xajax.debug.workId = 'xajaxWork'+ new Date().getTime();
/*
String: windowSource
The default URL that is given to the debugging window upon creation.
*/
xajax.debug.windowSource = 'about:blank';
/*
String: windowID
A 'unique' name used to identify the debugging window that is attached
to this xajax session.
*/
xajax.debug.windowID = 'xajax_debug_'+xajax.debug.workId;
/*
String: windowStyle
The parameters that will be used to create the debugging window.
*/
if ('undefined' == typeof xajax.debug.windowStyle)
xajax.debug.windowStyle =
'width=800,' +
'height=600,' +
'scrollbars=yes,' +
'resizable=yes,' +
'status=yes';
/*
String: windowTemplate
The HTML template and CSS style information used to populate the
debugging window upon creation.
*/
if ('undefined' == typeof xajax.debug.windowTemplate)
xajax.debug.windowTemplate =
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' +
'<html><head>' +
'<title>xajax debug output</title>' +
'<style type="text/css">' +
'/* <![CDATA[ */' +
'.debugEntry { margin: 3px; padding: 3px; border-top: 1px solid #999999; } ' +
'.debugDate { font-weight: bold; margin: 2px; } ' +
'.debugText { margin: 2px; } ' +
'.warningText { margin: 2px; font-weight: bold; } ' +
'.errorText { margin: 2px; font-weight: bold; color: #ff7777; }' +
'/* ]]> */' +
'</style>' +
'</head><body>' +
'<h2>xajax debug output</h2>' +
'<div id="debugTag"></div>' +
'</body></html>';
/*
Object: window
A reference to the debugging window, once constructed, where messages will
be displayed throughout the request process. This is constructed internally
as needed.
*/
/*
Array: text
*/
xajax.debug.text = [];
xajax.debug.text[100] = 'WARNING: ';
xajax.debug.text[101] = 'ERROR: ';
xajax.debug.text[102] = 'XAJAX DEBUG MESSAGE:\n';
xajax.debug.text[103] = '...\n[LONG RESPONSE]\n...';
xajax.debug.text[104] = 'SENDING REQUEST';
xajax.debug.text[105] = 'SENT [';
xajax.debug.text[106] = ' bytes]';
xajax.debug.text[107] = 'CALLING: ';
xajax.debug.text[108] = 'URI: ';
xajax.debug.text[109] = 'INITIALIZING REQUEST';
xajax.debug.text[110] = 'PROCESSING PARAMETERS [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'NO PARAMETERS TO PROCESS';
xajax.debug.text[113] = 'PREPARING REQUEST';
xajax.debug.text[114] = 'STARTING XAJAX CALL (deprecated: use xajax.request instead)';
xajax.debug.text[115] = 'STARTING XAJAX REQUEST';
xajax.debug.text[116] = 'No response processor is available to process the response from the server.\n';
xajax.debug.text[117] = '.\nCheck for error messages from the server.';
xajax.debug.text[118] = 'RECEIVED [status: ';
xajax.debug.text[119] = ', size: ';
xajax.debug.text[120] = ' bytes, time: ';
xajax.debug.text[121] = 'ms]:\n';
xajax.debug.text[122] = 'The server returned the following HTTP status: ';
xajax.debug.text[123] = '\nRECEIVED:\n';
xajax.debug.text[124] = 'The server returned a redirect to:<br />';
xajax.debug.text[125] = 'DONE [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'INITIALIZING REQUEST OBJECT';
/*
Array: exceptions
*/
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'Invalid response XML: The response contains an unknown tag: {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest is not available, xajax is disabled.';
xajax.debug.exceptions[10003] = 'Queue overflow: Cannot push object onto queue because it is full.';
xajax.debug.exceptions[10004] = 'Invalid response XML: The response contains an unexpected tag or text: {data}.';
xajax.debug.exceptions[10005] = 'Invalid request URI: Invalid or missing URI; autodetection failed; please specify a one explicitly.';
xajax.debug.exceptions[10006] = 'Invalid response command: Malformed response command received.';
xajax.debug.exceptions[10007] = 'Invalid response command: Command [{data}] is not a known command.';
xajax.debug.exceptions[10008] = 'Element with ID [{data}] not found in the document.';
xajax.debug.exceptions[10009] = 'Invalid request: Missing function name parameter.';
xajax.debug.exceptions[10010] = 'Invalid request: Missing function object parameter.';
/*
Function: getExceptionText
*/
xajax.debug.getExceptionText = function(e) {
if ('undefined' != typeof e.code) {
if ('undefined' != typeof xajax.debug.exceptions[e.code]) {
var msg = xajax.debug.exceptions[e.code];
if ('undefined' != typeof e.data) {
msg.replace('{data}', e.data);
}
return msg;
}
} else if ('undefined' != typeof e.name) {
var msg = e.name;
if ('undefined' != typeof e.message) {
msg += ': ';
msg += e.message;
}
return msg;
}
return 'An unknown error has occurred.';
}
/*
Function: writeMessage
Output a debug message to the debug window if available or send to an
alert box. If the debug window has not been created, attempt to
create it.
text - (string): The text to output.
prefix - (string): The prefix to use; this is prepended onto the
message; it should indicate the type of message (warning, error)
cls - (stirng): The className that will be applied to the message;
invoking a style from the CSS provided in
<xajax.debug.windowTemplate>. Should be one of the following:
- warningText
- errorText
*/
xajax.debug.writeMessage = function(text, prefix, cls) {
try {
var xd = xajax.debug;
if ('undefined' == typeof xd.window || true == xd.window.closed) {
xd.window = window.open(xd.windowSource, xd.windowID, xd.windowStyle);
if ("about:blank" == xd.windowSource)
xd.window.document.write(xd.windowTemplate);
}
var xdw = xd.window;
var xdwd = xdw.document;
if ('undefined' == typeof prefix)
prefix = '';
if ('undefined' == typeof cls)
cls = 'debugText';
text = xajax.debug.prepareDebugText(text);
var debugTag = xdwd.getElementById('debugTag');
var debugEntry = xdwd.createElement('div');
var debugDate = xdwd.createElement('span');
var debugText = xdwd.createElement('pre');
debugDate.innerHTML = new Date().toString();
debugText.innerHTML = prefix + text;
debugEntry.appendChild(debugDate);
debugEntry.appendChild(debugText);
debugTag.insertBefore(debugEntry, debugTag.firstChild);
// don't allow 'style' issues to hinder the debug output
try {
debugEntry.className = 'debugEntry';
debugDate.className = 'debugDate';
debugText.className = cls;
} catch (e) {
}
} catch (e) {
if (text.length > 1000) text = text.substr(0,1000) + xajax.debug.text[102];
alert(xajax.debug.text[102] + text);
}
}
/*
Function: prepareDebugText
Convert special characters to their HTML equivellents so they
will show up in the <xajax.debug.window>.
*/
xajax.debug.prepareDebugText = function(text) {
try {
text = text.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\n/g, '<br />');
return text;
} catch (e) {
xajax.debug.stringReplace = function(haystack, needle, newNeedle) {
var segments = haystack.split(needle);
haystack = '';
for (var i = 0; i < segments.length; ++i) {
if (0 != i)
haystack += newNeedle;
haystack += segments[i];
}
return haystack;
}
xajax.debug.prepareDebugText = function(text) {
text = xajax.debug.stringReplace(text, '&', '&amp;');
text = xajax.debug.stringReplace(text, '<', '&lt;');
text = xajax.debug.stringReplace(text, '>', '&gt;');
text = xajax.debug.stringReplace(text, '\n', '<br />');
return text;
}
xajax.debug.prepareDebugText(text);
}
}
/*
Function: executeCommand
Catch any exceptions that are thrown by a response command handler
and display a message in the debugger.
This is a wrapper function which surrounds the standard
<xajax.executeCommand> function.
*/
xajax.debug.executeCommand = xajax.executeCommand;
xajax.executeCommand = function(args) {
try {
if ('undefined' == typeof args.cmd)
throw { code: 10006 };
if (false == xajax.command.handler.isRegistered(args))
throw { code: 10007, data: args.cmd };
return xajax.debug.executeCommand(args);
} catch(e) {
var msg = 'ExecuteCommand (';
if ('undefined' != typeof args.sequence) {
msg += '#';
msg += args.sequence;
msg += ', ';
}
if ('undefined' != typeof args.cmdFullName) {
msg += '"';
msg += args.cmdFullName;
msg += '"';
}
msg += '):\n';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return true;
}
/*
Function: parseAttributes
Catch any exception thrown during the parsing of response
command attributes and display an appropriate debug message.
This is a wrapper around the standard <xajax.parseAttributes>
function.
*/
xajax.debug.parseAttributes = xajax.parseAttributes;
xajax.parseAttributes = function(child, obj) {
try {
xajax.debug.parseAttributes(child, obj);
} catch(e) {
var msg = 'ParseAttributes:\n';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
}
xajax.debug.commandHandler = xajax.command.handler.unregister('dbg');
xajax.command.handler.register('dbg', function(args) {
args.cmdFullName = 'debug message';
xajax.debug.writeMessage(args.data, xajax.debug.text[100], 'warningText');
return xajax.debug.commandHandler(args);
});
/*
Function: $
Catch any exceptions thrown while attempting to locate an
HTML element by it's unique name.
This is a wrapper around the standard <xajax.tools.$> function.
*/
xajax.debug.$ = xajax.tools.$;
xajax.tools.$ = function(sId) {
try {
var returnValue = xajax.debug.$(sId);
if ('object' != typeof returnValue)
throw { code: 10008 };
}
catch (e) {
var msg = '$:';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[100], 'warningText');
}
return returnValue;
}
/*
Function: _objectToXML
Generate a message indicating that a javascript object is
being converted to xml. Indicate the max depth and size. Then
display the size of the object upon completion. Catch any
exceptions thrown during the conversion process.
This is a wrapper around the standard <xajax.tools._objectToXML>
function.
*/
xajax.debug._objectToXML = xajax.tools._objectToXML;
xajax.tools._objectToXML = function(obj, guard) {
try {
if (0 == guard.size) {
var msg = 'OBJECT TO XML: maxDepth = ';
msg += guard.maxDepth;
msg += ', maxSize = ';
msg += guard.maxSize;
xajax.debug.writeMessage(msg);
}
var r = xajax.debug._objectToXML(obj, guard);
if (0 == guard.depth) {
var msg = 'OBJECT TO XML: size = ';
msg += guard.size;
xajax.debug.writeMessage(msg);
}
return r;
} catch(e) {
var msg = 'ObjectToXML: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return '';
}
/*
Function: _internalSend
Generate a message indicating that the xajax request is
about the be sent to the server.
This is a wrapper around the standard <xajax._internalSend>
function.
*/
xajax.debug._internalSend = xajax._internalSend;
xajax._internalSend = function(oRequest) {
try {
xajax.debug.writeMessage(xajax.debug.text[104]);
xajax.debug.writeMessage(
xajax.debug.text[105] +
oRequest.requestData.length +
xajax.debug.text[106]
);
oRequest.beginDate = new Date();
xajax.debug._internalSend(oRequest);
} catch (e) {
var msg = 'InternalSend: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: submitRequest
Generate a message indicating that a request is ready to be
submitted; providing the URL and the function being invoked.
Catch any exceptions thrown and display a message.
This is a wrapper around the standard <xajax.submitRequest>
function.
*/
xajax.debug.submitRequest = xajax.submitRequest;
xajax.submitRequest = function(oRequest) {
var msg = oRequest.method;
msg += ': ';
text = decodeURIComponent(oRequest.requestData);
text = text.replace(new RegExp('&xjx', 'g'), '\n&xjx');
text = text.replace(new RegExp('<xjxobj>', 'g'), '\n<xjxobj>');
text = text.replace(new RegExp('<e>', 'g'), '\n<e>');
text = text.replace(new RegExp('</xjxobj>', 'g'), '\n</xjxobj>\n');
msg += text;
xajax.debug.writeMessage(msg);
msg = xajax.debug.text[107];
var separator = '\n';
for (var mbr in oRequest.functionName) {
msg += separator;
msg += mbr;
msg += ': ';
msg += oRequest.functionName[mbr];
separator = '\n';
}
msg += separator;
msg += xajax.debug.text[108];
msg += separator;
msg += oRequest.URI;
xajax.debug.writeMessage(msg);
try {
return xajax.debug.submitRequest(oRequest);
} catch (e) {
xajax.debug.writeMessage(e.message);
if (0 < oRequest.retry)
throw e;
}
}
/*
Function: initializeRequest
Generate a message indicating that the request object is
being initialized.
This is a wrapper around the standard <xajax.initializeRequest>
function.
*/
xajax.debug.initializeRequest = xajax.initializeRequest;
xajax.initializeRequest = function(oRequest) {
try {
var msg = xajax.debug.text[109];
xajax.debug.writeMessage(msg);
return xajax.debug.initializeRequest(oRequest);
} catch (e) {
var msg = 'InitializeRequest: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: processParameters
Generate a message indicating that the request object is
being populated with the parameters provided.
This is a wrapper around the standard <xajax.processParameters>
function.
*/
xajax.debug.processParameters = xajax.processParameters;
xajax.processParameters = function(oRequest) {
try {
if ('undefined' != typeof oRequest.parameters) {
var msg = xajax.debug.text[110];
msg += oRequest.parameters.length;
msg += xajax.debug.text[111];
xajax.debug.writeMessage(msg);
} else {
var msg = xajax.debug.text[112];
xajax.debug.writeMessage(msg);
}
return xajax.debug.processParameters(oRequest);
} catch (e) {
var msg = 'ProcessParameters: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: prepareRequest
Generate a message indicating that the request is being
prepared. This may occur more than once for a request
if it errors and a retry is attempted.
This is a wrapper around the standard <xajax.prepareRequest>
*/
xajax.debug.prepareRequest = xajax.prepareRequest;
xajax.prepareRequest = function(oRequest) {
try {
var msg = xajax.debug.text[113];
xajax.debug.writeMessage(msg);
return xajax.debug.prepareRequest(oRequest);
} catch (e) {
var msg = 'PrepareRequest: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: call
Validates that a function name was provided, generates a message
indicating that a xajax call is starting and sets a flag in the
request object indicating that debugging is enabled for this call.
This is a wrapper around the standard <xajax.call> function.
*/
xajax.debug.call = xajax.call;
xajax.call = function() {
try {
xajax.debug.writeMessage(xajax.debug.text[114]);
var numArgs = arguments.length;
if (0 == numArgs)
throw { code: 10009 };
var functionName = arguments[0];
var oOptions = {}
if (1 < numArgs)
oOptions = arguments[1];
oOptions.debugging = true;
return xajax.debug.call(functionName, oOptions);
} catch (e) {
var msg = 'Call: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: request
Validates that a function name was provided, generates a message
indicating that a xajax request is starting and sets a flag in the
request object indicating that debugging is enabled for this request.
This is a wrapper around the standard <xajax.request> function.
*/
xajax.debug.request = xajax.request;
xajax.request = function() {
try {
xajax.debug.writeMessage(xajax.debug.text[115]);
var numArgs = arguments.length;
if (0 == numArgs)
throw { code: 10010 };
var oFunction = arguments[0];
var oOptions = {}
if (1 < numArgs)
oOptions = arguments[1];
oOptions.debugging = true;
return xajax.debug.request(oFunction, oOptions);
} catch (e) {
var msg = 'Request: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: getResponseProcessor
Generate an error message when no reponse processor is available
to process the type of response returned from the server.
This is a wrapper around the standard <xajax.getResponseProcessor>
function.
*/
xajax.debug.getResponseProcessor = xajax.getResponseProcessor;
xajax.getResponseProcessor = function(oRequest) {
try {
var fProc = xajax.debug.getResponseProcessor(oRequest);
if ('undefined' == typeof fProc) {
var msg = xajax.debug.text[116];
try {
var contentType = oRequest.request.getResponseHeader('content-type');
msg += "Content-Type: ";
msg += contentType;
if ('text/html' == contentType) {
msg += xajax.debug.text[117];
}
} catch (e) {
}
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return fProc;
} catch (e) {
var msg = 'GetResponseProcessor: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: responseReceived
Generate a message indicating that a response has been received
from the server; provide some statistical data regarding the
response and the response time.
Catch any exceptions that are thrown during the processing of
the response and generate a message.
This is a wrapper around the standard <xajax.responseReceived>
function.
*/
xajax.debug.responseReceived = xajax.responseReceived;
xajax.responseReceived = function(oRequest) {
var xx = xajax;
var xt = xx.tools;
var xd = xx.debug;
var oRet;
try {
var status = oRequest.request.status;
if (xt.arrayContainsValue(xx.responseSuccessCodes, status)) {
var packet = oRequest.request.responseText;
packet = packet.replace(new RegExp('<cmd', 'g'), '\n<cmd');
packet = packet.replace(new RegExp('<xjx>', 'g'), '\n<xjx>');
packet = packet.replace(new RegExp('<xjxobj>', 'g'), '\n<xjxobj>');
packet = packet.replace(new RegExp('<e>', 'g'), '\n<e>');
packet = packet.replace(new RegExp('</xjxobj>', 'g'), '\n</xjxobj>\n');
packet = packet.replace(new RegExp('</xjx>', 'g'), '\n</xjx>');
oRequest.midDate = new Date();
var msg = xajax.debug.text[118];
msg += oRequest.request.status;
msg += xajax.debug.text[119];
msg += packet.length;
msg += xajax.debug.text[120];
msg += (oRequest.midDate - oRequest.beginDate);
msg += xajax.debug.text[121];
msg += packet;
xd.writeMessage(msg);
} else if (xt.arrayContainsValue(xx.responseErrorsForAlert, status)) {
var msg = xajax.debug.text[122];
msg += status;
msg += xajax.debug.text[123];
msg += oRequest.request.responseText;
xd.writeMessage(msg, xajax.debug.text[101], 'errorText');
} else if (xt.arrayContainsValue(xx.responseRedirectCodes, status)) {
var msg = xajax.debug.text[124];
msg += oRequest.request.getResponseHeader('location');
xd.writeMessage(msg);
}
oRet = xd.responseReceived(oRequest);
} catch (e) {
var msg = 'ResponseReceived: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xd.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return oRet;
}
/*
Function: completeRequest
Generate a message indicating that the request has completed
and provide some statistics regarding the request and response.
This is a wrapper around the standard <xajax.completeResponse>
function.
*/
xajax.debug.completeResponse = xajax.completeResponse;
xajax.completeResponse = function(oRequest) {
try {
var returnValue = xajax.debug.completeResponse(oRequest);
oRequest.endDate = new Date();
var msg = xajax.debug.text[125];
msg += (oRequest.endDate - oRequest.beginDate);
msg += xajax.debug.text[126];
xajax.debug.writeMessage(msg);
return returnValue;
} catch (e) {
var msg = 'CompleteResponse: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: getRequestObject
Generate a message indicating that the request object is
being initialized.
Catch any exceptions that are thrown during the process or
initializing a new request object.
This is a wrapper around the standard <xajax.getRequestObject>
function.
*/
xajax.debug.getRequestObject = xajax.tools.getRequestObject;
xajax.tools.getRequestObject = function() {
try {
xajax.debug.writeMessage(xajax.debug.text[127]);
return xajax.debug.getRequestObject();
} catch (e) {
var msg = 'GetRequestObject: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: assign
Catch any exceptions thrown during the assignment and
display an error message.
This is a wrapper around the standard <xajax.dom.assign>
function.
*/
if (xajax.dom.assign) {
xajax.debug.assign = xajax.dom.assign;
xajax.dom.assign = function(element, id, property, data) {
try {
return xajax.debug.assign(element, id, property, data);
} catch (e) {
var msg = 'xajax.dom.assign: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
msg += 'Eval: element.';
msg += property;
msg += ' = data;\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return true;
}
}
/*
Function: xajax.tools.queue.retry
*/
if (xajax.tools) {
if (xajax.tools.queue) {
if (xajax.tools.queue.retry) {
if ('undefined' == typeof xajax.debug.tools)
xajax.debug.tools = {};
if ('undefined' == typeof xajax.debug.tools.queue)
xajax.debug.tools.queue = {};
xajax.debug.tools.queue.retry = xajax.tools.queue.retry;
xajax.tools.queue.retry = function(obj, count) {
if (xajax.debug.tools.queue.retry(obj, count))
return true;
// no 'exceeded' message for sleep command
if (obj.cmd && 's' == obj.cmd)
return false;
xajax.debug.writeMessage('Retry count exceeded.');
return false;
}
}
}
}
/*
Boolean: isLoaded
true - indicates that the debugging module is loaded
*/
xajax.debug.isLoaded = true;
/*
Section: Redefine shortcuts.
Must redefine these shortcuts so they point to the new debug (wrapper) versions:
- <xjx.$>
- <xjx.getFormValues>
- <xjx.call>
Must redefine these shortcuts as well:
- <xajax.$>
- <xajax.getFormValues>
*/
xjx = {}
xjx.$ = xajax.tools.$;
xjx.getFormValues = xajax.tools.getFormValues;
xjx.call = xajax.call;
xjx.request = xajax.request;
xajax.$ = xajax.tools.$;
xajax.getFormValues = xajax.tools.getFormValues;

View File

@@ -0,0 +1,856 @@
/*
File: xajax_debug.js
This optional file contains the debugging module for use with xajax. If
you include this module after the standard <xajax_core.js> module, you
will receive debugging messages, including errors, that occur during
the processing of your xajax requests.
Title: xajax debugging module
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajax_debug_uncompressed.js 327 2007-02-28 16:55:26Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajax.debug
This object contains the variables and functions used to display process state
messages and to trap error conditions and report them to the user via
a secondary browser window or alert messages as necessary.
*/
try {
if ('undefined' == typeof xajax.debug)
xajax.debug = {}
} catch (e) {
alert('An internal error has occurred: the xajax_core has not been loaded prior to xajax_debug.');
}
/*
String: workId
Stores a 'unique' identifier for this session so that an existing debugging
window can be detected, else one will be created.
*/
xajax.debug.workId = 'xajaxWork'+ new Date().getTime();
/*
String: windowSource
The default URL that is given to the debugging window upon creation.
*/
xajax.debug.windowSource = 'about:blank';
/*
String: windowID
A 'unique' name used to identify the debugging window that is attached
to this xajax session.
*/
xajax.debug.windowID = 'xajax_debug_'+xajax.debug.workId;
/*
String: windowStyle
The parameters that will be used to create the debugging window.
*/
if ('undefined' == typeof xajax.debug.windowStyle)
xajax.debug.windowStyle =
'width=800,' +
'height=600,' +
'scrollbars=yes,' +
'resizable=yes,' +
'status=yes';
/*
String: windowTemplate
The HTML template and CSS style information used to populate the
debugging window upon creation.
*/
if ('undefined' == typeof xajax.debug.windowTemplate)
xajax.debug.windowTemplate =
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' +
'<html><head>' +
'<title>xajax debug output</title>' +
'<style type="text/css">' +
'/* <![CDATA[ */' +
'.debugEntry { margin: 3px; padding: 3px; border-top: 1px solid #999999; } ' +
'.debugDate { font-weight: bold; margin: 2px; } ' +
'.debugText { margin: 2px; } ' +
'.warningText { margin: 2px; font-weight: bold; } ' +
'.errorText { margin: 2px; font-weight: bold; color: #ff7777; }' +
'/* ]]> */' +
'</style>' +
'</head><body>' +
'<h2>xajax debug output</h2>' +
'<div id="debugTag"></div>' +
'</body></html>';
/*
Object: window
A reference to the debugging window, once constructed, where messages will
be displayed throughout the request process. This is constructed internally
as needed.
*/
/*
Array: text
*/
xajax.debug.text = [];
xajax.debug.text[100] = 'WARNING: ';
xajax.debug.text[101] = 'ERROR: ';
xajax.debug.text[102] = 'XAJAX DEBUG MESSAGE:\n';
xajax.debug.text[103] = '...\n[LONG RESPONSE]\n...';
xajax.debug.text[104] = 'SENDING REQUEST';
xajax.debug.text[105] = 'SENT [';
xajax.debug.text[106] = ' bytes]';
xajax.debug.text[107] = 'CALLING: ';
xajax.debug.text[108] = 'URI: ';
xajax.debug.text[109] = 'INITIALIZING REQUEST';
xajax.debug.text[110] = 'PROCESSING PARAMETERS [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'NO PARAMETERS TO PROCESS';
xajax.debug.text[113] = 'PREPARING REQUEST';
xajax.debug.text[114] = 'STARTING XAJAX CALL (deprecated: use xajax.request instead)';
xajax.debug.text[115] = 'STARTING XAJAX REQUEST';
xajax.debug.text[116] = 'No response processor is available to process the response from the server.\n';
xajax.debug.text[117] = '.\nCheck for error messages from the server.';
xajax.debug.text[118] = 'RECEIVED [status: ';
xajax.debug.text[119] = ', size: ';
xajax.debug.text[120] = ' bytes, time: ';
xajax.debug.text[121] = 'ms]:\n';
xajax.debug.text[122] = 'The server returned the following HTTP status: ';
xajax.debug.text[123] = '\nRECEIVED:\n';
xajax.debug.text[124] = 'The server returned a redirect to:<br />';
xajax.debug.text[125] = 'DONE [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'INITIALIZING REQUEST OBJECT';
/*
Array: exceptions
*/
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'Invalid response XML: The response contains an unknown tag: {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest is not available, xajax is disabled.';
xajax.debug.exceptions[10003] = 'Queue overflow: Cannot push object onto queue because it is full.';
xajax.debug.exceptions[10004] = 'Invalid response XML: The response contains an unexpected tag or text: {data}.';
xajax.debug.exceptions[10005] = 'Invalid request URI: Invalid or missing URI; autodetection failed; please specify a one explicitly.';
xajax.debug.exceptions[10006] = 'Invalid response command: Malformed response command received.';
xajax.debug.exceptions[10007] = 'Invalid response command: Command [{data}] is not a known command.';
xajax.debug.exceptions[10008] = 'Element with ID [{data}] not found in the document.';
xajax.debug.exceptions[10009] = 'Invalid request: Missing function name parameter.';
xajax.debug.exceptions[10010] = 'Invalid request: Missing function object parameter.';
/*
Function: getExceptionText
*/
xajax.debug.getExceptionText = function(e) {
if ('undefined' != typeof e.code) {
if ('undefined' != typeof xajax.debug.exceptions[e.code]) {
var msg = xajax.debug.exceptions[e.code];
if ('undefined' != typeof e.data) {
msg.replace('{data}', e.data);
}
return msg;
}
} else if ('undefined' != typeof e.name) {
var msg = e.name;
if ('undefined' != typeof e.message) {
msg += ': ';
msg += e.message;
}
return msg;
}
return 'An unknown error has occurred.';
}
/*
Function: writeMessage
Output a debug message to the debug window if available or send to an
alert box. If the debug window has not been created, attempt to
create it.
text - (string): The text to output.
prefix - (string): The prefix to use; this is prepended onto the
message; it should indicate the type of message (warning, error)
cls - (stirng): The className that will be applied to the message;
invoking a style from the CSS provided in
<xajax.debug.windowTemplate>. Should be one of the following:
- warningText
- errorText
*/
xajax.debug.writeMessage = function(text, prefix, cls) {
try {
var xd = xajax.debug;
if ('undefined' == typeof xd.window || true == xd.window.closed) {
xd.window = window.open(xd.windowSource, xd.windowID, xd.windowStyle);
if ("about:blank" == xd.windowSource)
xd.window.document.write(xd.windowTemplate);
}
var xdw = xd.window;
var xdwd = xdw.document;
if ('undefined' == typeof prefix)
prefix = '';
if ('undefined' == typeof cls)
cls = 'debugText';
text = xajax.debug.prepareDebugText(text);
var debugTag = xdwd.getElementById('debugTag');
var debugEntry = xdwd.createElement('div');
var debugDate = xdwd.createElement('span');
var debugText = xdwd.createElement('pre');
debugDate.innerHTML = new Date().toString();
debugText.innerHTML = prefix + text;
debugEntry.appendChild(debugDate);
debugEntry.appendChild(debugText);
debugTag.insertBefore(debugEntry, debugTag.firstChild);
// don't allow 'style' issues to hinder the debug output
try {
debugEntry.className = 'debugEntry';
debugDate.className = 'debugDate';
debugText.className = cls;
} catch (e) {
}
} catch (e) {
if (text.length > 1000) text = text.substr(0,1000) + xajax.debug.text[102];
alert(xajax.debug.text[102] + text);
}
}
/*
Function: prepareDebugText
Convert special characters to their HTML equivellents so they
will show up in the <xajax.debug.window>.
*/
xajax.debug.prepareDebugText = function(text) {
try {
text = text.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/\n/g, '<br />');
return text;
} catch (e) {
xajax.debug.stringReplace = function(haystack, needle, newNeedle) {
var segments = haystack.split(needle);
haystack = '';
for (var i = 0; i < segments.length; ++i) {
if (0 != i)
haystack += newNeedle;
haystack += segments[i];
}
return haystack;
}
xajax.debug.prepareDebugText = function(text) {
text = xajax.debug.stringReplace(text, '&', '&amp;');
text = xajax.debug.stringReplace(text, '<', '&lt;');
text = xajax.debug.stringReplace(text, '>', '&gt;');
text = xajax.debug.stringReplace(text, '\n', '<br />');
return text;
}
xajax.debug.prepareDebugText(text);
}
}
/*
Function: executeCommand
Catch any exceptions that are thrown by a response command handler
and display a message in the debugger.
This is a wrapper function which surrounds the standard
<xajax.executeCommand> function.
*/
xajax.debug.executeCommand = xajax.executeCommand;
xajax.executeCommand = function(args) {
try {
if ('undefined' == typeof args.cmd)
throw { code: 10006 };
if (false == xajax.command.handler.isRegistered(args))
throw { code: 10007, data: args.cmd };
return xajax.debug.executeCommand(args);
} catch(e) {
var msg = 'ExecuteCommand (';
if ('undefined' != typeof args.sequence) {
msg += '#';
msg += args.sequence;
msg += ', ';
}
if ('undefined' != typeof args.cmdFullName) {
msg += '"';
msg += args.cmdFullName;
msg += '"';
}
msg += '):\n';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return true;
}
/*
Function: parseAttributes
Catch any exception thrown during the parsing of response
command attributes and display an appropriate debug message.
This is a wrapper around the standard <xajax.parseAttributes>
function.
*/
xajax.debug.parseAttributes = xajax.parseAttributes;
xajax.parseAttributes = function(child, obj) {
try {
xajax.debug.parseAttributes(child, obj);
} catch(e) {
var msg = 'ParseAttributes:\n';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
}
xajax.debug.commandHandler = xajax.command.handler.unregister('dbg');
xajax.command.handler.register('dbg', function(args) {
args.cmdFullName = 'debug message';
xajax.debug.writeMessage(args.data, xajax.debug.text[100], 'warningText');
return xajax.debug.commandHandler(args);
});
/*
Function: $
Catch any exceptions thrown while attempting to locate an
HTML element by it's unique name.
This is a wrapper around the standard <xajax.tools.$> function.
*/
xajax.debug.$ = xajax.tools.$;
xajax.tools.$ = function(sId) {
try {
var returnValue = xajax.debug.$(sId);
if ('object' != typeof returnValue)
throw { code: 10008 };
}
catch (e) {
var msg = '$:';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[100], 'warningText');
}
return returnValue;
}
/*
Function: _objectToXML
Generate a message indicating that a javascript object is
being converted to xml. Indicate the max depth and size. Then
display the size of the object upon completion. Catch any
exceptions thrown during the conversion process.
This is a wrapper around the standard <xajax.tools._objectToXML>
function.
*/
xajax.debug._objectToXML = xajax.tools._objectToXML;
xajax.tools._objectToXML = function(obj, guard) {
try {
if (0 == guard.size) {
var msg = 'OBJECT TO XML: maxDepth = ';
msg += guard.maxDepth;
msg += ', maxSize = ';
msg += guard.maxSize;
xajax.debug.writeMessage(msg);
}
var r = xajax.debug._objectToXML(obj, guard);
if (0 == guard.depth) {
var msg = 'OBJECT TO XML: size = ';
msg += guard.size;
xajax.debug.writeMessage(msg);
}
return r;
} catch(e) {
var msg = 'ObjectToXML: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return '';
}
/*
Function: _internalSend
Generate a message indicating that the xajax request is
about the be sent to the server.
This is a wrapper around the standard <xajax._internalSend>
function.
*/
xajax.debug._internalSend = xajax._internalSend;
xajax._internalSend = function(oRequest) {
try {
xajax.debug.writeMessage(xajax.debug.text[104]);
xajax.debug.writeMessage(
xajax.debug.text[105] +
oRequest.requestData.length +
xajax.debug.text[106]
);
oRequest.beginDate = new Date();
xajax.debug._internalSend(oRequest);
} catch (e) {
var msg = 'InternalSend: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: submitRequest
Generate a message indicating that a request is ready to be
submitted; providing the URL and the function being invoked.
Catch any exceptions thrown and display a message.
This is a wrapper around the standard <xajax.submitRequest>
function.
*/
xajax.debug.submitRequest = xajax.submitRequest;
xajax.submitRequest = function(oRequest) {
var msg = oRequest.method;
msg += ': ';
text = decodeURIComponent(oRequest.requestData);
text = text.replace(new RegExp('&xjx', 'g'), '\n&xjx');
text = text.replace(new RegExp('<xjxobj>', 'g'), '\n<xjxobj>');
text = text.replace(new RegExp('<e>', 'g'), '\n<e>');
text = text.replace(new RegExp('</xjxobj>', 'g'), '\n</xjxobj>\n');
msg += text;
xajax.debug.writeMessage(msg);
msg = xajax.debug.text[107];
var separator = '\n';
for (var mbr in oRequest.functionName) {
msg += separator;
msg += mbr;
msg += ': ';
msg += oRequest.functionName[mbr];
separator = '\n';
}
msg += separator;
msg += xajax.debug.text[108];
msg += separator;
msg += oRequest.URI;
xajax.debug.writeMessage(msg);
try {
return xajax.debug.submitRequest(oRequest);
} catch (e) {
xajax.debug.writeMessage(e.message);
if (0 < oRequest.retry)
throw e;
}
}
/*
Function: initializeRequest
Generate a message indicating that the request object is
being initialized.
This is a wrapper around the standard <xajax.initializeRequest>
function.
*/
xajax.debug.initializeRequest = xajax.initializeRequest;
xajax.initializeRequest = function(oRequest) {
try {
var msg = xajax.debug.text[109];
xajax.debug.writeMessage(msg);
return xajax.debug.initializeRequest(oRequest);
} catch (e) {
var msg = 'InitializeRequest: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: processParameters
Generate a message indicating that the request object is
being populated with the parameters provided.
This is a wrapper around the standard <xajax.processParameters>
function.
*/
xajax.debug.processParameters = xajax.processParameters;
xajax.processParameters = function(oRequest) {
try {
if ('undefined' != typeof oRequest.parameters) {
var msg = xajax.debug.text[110];
msg += oRequest.parameters.length;
msg += xajax.debug.text[111];
xajax.debug.writeMessage(msg);
} else {
var msg = xajax.debug.text[112];
xajax.debug.writeMessage(msg);
}
return xajax.debug.processParameters(oRequest);
} catch (e) {
var msg = 'ProcessParameters: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: prepareRequest
Generate a message indicating that the request is being
prepared. This may occur more than once for a request
if it errors and a retry is attempted.
This is a wrapper around the standard <xajax.prepareRequest>
*/
xajax.debug.prepareRequest = xajax.prepareRequest;
xajax.prepareRequest = function(oRequest) {
try {
var msg = xajax.debug.text[113];
xajax.debug.writeMessage(msg);
return xajax.debug.prepareRequest(oRequest);
} catch (e) {
var msg = 'PrepareRequest: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: call
Validates that a function name was provided, generates a message
indicating that a xajax call is starting and sets a flag in the
request object indicating that debugging is enabled for this call.
This is a wrapper around the standard <xajax.call> function.
*/
xajax.debug.call = xajax.call;
xajax.call = function() {
try {
xajax.debug.writeMessage(xajax.debug.text[114]);
var numArgs = arguments.length;
if (0 == numArgs)
throw { code: 10009 };
var functionName = arguments[0];
var oOptions = {}
if (1 < numArgs)
oOptions = arguments[1];
oOptions.debugging = true;
return xajax.debug.call(functionName, oOptions);
} catch (e) {
var msg = 'Call: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: request
Validates that a function name was provided, generates a message
indicating that a xajax request is starting and sets a flag in the
request object indicating that debugging is enabled for this request.
This is a wrapper around the standard <xajax.request> function.
*/
xajax.debug.request = xajax.request;
xajax.request = function() {
try {
xajax.debug.writeMessage(xajax.debug.text[115]);
var numArgs = arguments.length;
if (0 == numArgs)
throw { code: 10010 };
var oFunction = arguments[0];
var oOptions = {}
if (1 < numArgs)
oOptions = arguments[1];
oOptions.debugging = true;
return xajax.debug.request(oFunction, oOptions);
} catch (e) {
var msg = 'Request: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: getResponseProcessor
Generate an error message when no reponse processor is available
to process the type of response returned from the server.
This is a wrapper around the standard <xajax.getResponseProcessor>
function.
*/
xajax.debug.getResponseProcessor = xajax.getResponseProcessor;
xajax.getResponseProcessor = function(oRequest) {
try {
var fProc = xajax.debug.getResponseProcessor(oRequest);
if ('undefined' == typeof fProc) {
var msg = xajax.debug.text[116];
try {
var contentType = oRequest.request.getResponseHeader('content-type');
msg += "Content-Type: ";
msg += contentType;
if ('text/html' == contentType) {
msg += xajax.debug.text[117];
}
} catch (e) {
}
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return fProc;
} catch (e) {
var msg = 'GetResponseProcessor: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: responseReceived
Generate a message indicating that a response has been received
from the server; provide some statistical data regarding the
response and the response time.
Catch any exceptions that are thrown during the processing of
the response and generate a message.
This is a wrapper around the standard <xajax.responseReceived>
function.
*/
xajax.debug.responseReceived = xajax.responseReceived;
xajax.responseReceived = function(oRequest) {
var xx = xajax;
var xt = xx.tools;
var xd = xx.debug;
var oRet;
try {
var status = oRequest.request.status;
if (xt.arrayContainsValue(xx.responseSuccessCodes, status)) {
var packet = oRequest.request.responseText;
packet = packet.replace(new RegExp('<cmd', 'g'), '\n<cmd');
packet = packet.replace(new RegExp('<xjx>', 'g'), '\n<xjx>');
packet = packet.replace(new RegExp('<xjxobj>', 'g'), '\n<xjxobj>');
packet = packet.replace(new RegExp('<e>', 'g'), '\n<e>');
packet = packet.replace(new RegExp('</xjxobj>', 'g'), '\n</xjxobj>\n');
packet = packet.replace(new RegExp('</xjx>', 'g'), '\n</xjx>');
oRequest.midDate = new Date();
var msg = xajax.debug.text[118];
msg += oRequest.request.status;
msg += xajax.debug.text[119];
msg += packet.length;
msg += xajax.debug.text[120];
msg += (oRequest.midDate - oRequest.beginDate);
msg += xajax.debug.text[121];
msg += packet;
xd.writeMessage(msg);
} else if (xt.arrayContainsValue(xx.responseErrorsForAlert, status)) {
var msg = xajax.debug.text[122];
msg += status;
msg += xajax.debug.text[123];
msg += oRequest.request.responseText;
xd.writeMessage(msg, xajax.debug.text[101], 'errorText');
} else if (xt.arrayContainsValue(xx.responseRedirectCodes, status)) {
var msg = xajax.debug.text[124];
msg += oRequest.request.getResponseHeader('location');
xd.writeMessage(msg);
}
oRet = xd.responseReceived(oRequest);
} catch (e) {
var msg = 'ResponseReceived: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xd.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return oRet;
}
/*
Function: completeRequest
Generate a message indicating that the request has completed
and provide some statistics regarding the request and response.
This is a wrapper around the standard <xajax.completeResponse>
function.
*/
xajax.debug.completeResponse = xajax.completeResponse;
xajax.completeResponse = function(oRequest) {
try {
var returnValue = xajax.debug.completeResponse(oRequest);
oRequest.endDate = new Date();
var msg = xajax.debug.text[125];
msg += (oRequest.endDate - oRequest.beginDate);
msg += xajax.debug.text[126];
xajax.debug.writeMessage(msg);
return returnValue;
} catch (e) {
var msg = 'CompleteResponse: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: getRequestObject
Generate a message indicating that the request object is
being initialized.
Catch any exceptions that are thrown during the process or
initializing a new request object.
This is a wrapper around the standard <xajax.getRequestObject>
function.
*/
xajax.debug.getRequestObject = xajax.tools.getRequestObject;
xajax.tools.getRequestObject = function() {
try {
xajax.debug.writeMessage(xajax.debug.text[127]);
return xajax.debug.getRequestObject();
} catch (e) {
var msg = 'GetRequestObject: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
throw e;
}
}
/*
Function: assign
Catch any exceptions thrown during the assignment and
display an error message.
This is a wrapper around the standard <xajax.dom.assign>
function.
*/
if (xajax.dom.assign) {
xajax.debug.assign = xajax.dom.assign;
xajax.dom.assign = function(element, id, property, data) {
try {
return xajax.debug.assign(element, id, property, data);
} catch (e) {
var msg = 'xajax.dom.assign: ';
msg += xajax.debug.getExceptionText(e);
msg += '\n';
msg += 'Eval: element.';
msg += property;
msg += ' = data;\n';
xajax.debug.writeMessage(msg, xajax.debug.text[101], 'errorText');
}
return true;
}
}
/*
Function: xajax.tools.queue.retry
*/
if (xajax.tools) {
if (xajax.tools.queue) {
if (xajax.tools.queue.retry) {
if ('undefined' == typeof xajax.debug.tools)
xajax.debug.tools = {};
if ('undefined' == typeof xajax.debug.tools.queue)
xajax.debug.tools.queue = {};
xajax.debug.tools.queue.retry = xajax.tools.queue.retry;
xajax.tools.queue.retry = function(obj, count) {
if (xajax.debug.tools.queue.retry(obj, count))
return true;
// no 'exceeded' message for sleep command
if (obj.cmd && 's' == obj.cmd)
return false;
xajax.debug.writeMessage('Retry count exceeded.');
return false;
}
}
}
}
/*
Boolean: isLoaded
true - indicates that the debugging module is loaded
*/
xajax.debug.isLoaded = true;
/*
Section: Redefine shortcuts.
Must redefine these shortcuts so they point to the new debug (wrapper) versions:
- <xjx.$>
- <xjx.getFormValues>
- <xjx.call>
Must redefine these shortcuts as well:
- <xajax.$>
- <xajax.getFormValues>
*/
xjx = {}
xjx.$ = xajax.tools.$;
xjx.getFormValues = xajax.tools.getFormValues;
xjx.call = xajax.call;
xjx.request = xajax.request;
xajax.$ = xajax.tools.$;
xajax.getFormValues = xajax.tools.getFormValues;

View File

@@ -0,0 +1,10 @@

if('undefined'!=typeof xajax.debug){xajax.debug.text=[];xajax.debug.text[100]='WARNUNG: ';xajax.debug.text[101]='FEHLER: ';xajax.debug.text[102]='XAJAX FEHLERSUCHE NACHRICHT:\n';xajax.debug.text[103]='...\n[UMGFANGREICHE ANTWORT]\n...';xajax.debug.text[104]='SENDE ANFRAGE';xajax.debug.text[105]='GESENDET [';xajax.debug.text[106]=' bytes]';xajax.debug.text[107]='RUFE AUF: ';xajax.debug.text[108]='URI: ';xajax.debug.text[109]='BEGINNE ANFRAGE';xajax.debug.text[110]='PARAMETER IN BEARBEITUNG [';xajax.debug.text[111]=']';xajax.debug.text[112]='KEINE PARAMETER ZU VERARBEITEN';xajax.debug.text[113]='BEREITE REQUEST VOR';xajax.debug.text[114]='BEGINNE XAJAX CALL (veraltet: verwendet stattdessen xajax.request)';xajax.debug.text[115]='BEGINNE XAJAX ANFRAGE';xajax.debug.text[116]='Die vom Server erhaltenen Daten konnten nicht verarbeitet werden.\n';xajax.debug.text[117]='.\nPrüfe auf Fehlermeldungen des Servers.';xajax.debug.text[118]='ERHALTEN [status: ';xajax.debug.text[119]=', Größe: ';xajax.debug.text[120]=' bytes, Zeit: ';xajax.debug.text[121]='ms]:\n';xajax.debug.text[122]='Der Server hat folgenden HTTP-Status zurück gesendet: ';xajax.debug.text[123]='\nERHALTEN:\n';xajax.debug.text[124]='Der Server lieferte einen Redirect nach:<br />';xajax.debug.text[125]='ERLEDIGT [';xajax.debug.text[126]='ms]';xajax.debug.text[127]='INITIALISIERE REQUEST OBJEKT';xajax.debug.exceptions=[];xajax.debug.exceptions[10001]='Ungültige XML-Antwort: die Antwort enthält ein ungültiges Tag: {data}.';xajax.debug.exceptions[10002]='GetRequestObject: XMLHttpRequest ist nicht verfügbar, XajaX ist nicht verfügbar.';xajax.debug.exceptions[10003]='Warteschleife-Überlauf: kann Objekt nicht an Warteschleife übergeben da diese voll ist.';xajax.debug.exceptions[10004]='Ungültige XML-Antwort: die Antwort enthält einen unerwarteten Tag oder Text: {data}.';xajax.debug.exceptions[10005]='Ungültige Request-URI: Ungültige oder Fehlende URI; Autoerkennung fehlgeschlagen; bitte nur eine einzige URI angeben.';xajax.debug.exceptions[10006]='Ungültiges Antwort-Befehl: Unvollständiges Objekt zurück erhalten.';xajax.debug.exceptions[10007]='Ungültiges Antwort-Befehl: Befehl [{data}] ist nicht bekannt.';xajax.debug.exceptions[10008]='Es konnte kein Element mit der ID [{data}] konnte im Dokument gefunden werden.';xajax.debug.exceptions[10009]='Ungültige Anfrage: Fehlender Funktionsparameter - name.';xajax.debug.exceptions[10010]='Ungültige Anfrage: Fehlender Funktionsparameter - object.';}
if('undefined'!=typeof xajax.config){if('undefined'!=typeof xajax.config.status){xajax.config.status.update=function(){return{onRequest:function(){window.status="Sende Anfrage...";},
onWaiting:function(){window.status="Warten auf Antwort...";},
onProcessing:function(){window.status="Verarbeitung...";},
onComplete:function(){window.status="Abgeschlossen.";}
}
}
}
}

View File

@@ -0,0 +1,84 @@
/**
* translation for: xajax v.x.x
* @version: 1.0.0
* @author: mic <info@joomx.com>
* @copyright xajax project
* @license GNU/GPL
* @package xajax x.x.x
* @since v.x.x.x
* save as UTF-8
*/
if ('undefined' != typeof xajax.debug) {
/*
Array: text
*/
xajax.debug.text = [];
xajax.debug.text[100] = 'WARNUNG: ';
xajax.debug.text[101] = 'FEHLER: ';
xajax.debug.text[102] = 'XAJAX FEHLERSUCHE NACHRICHT:\n';
xajax.debug.text[103] = '...\n[UMGFANGREICHE ANTWORT]\n...';
xajax.debug.text[104] = 'SENDE ANFRAGE';
xajax.debug.text[105] = 'GESENDET [';
xajax.debug.text[106] = ' bytes]';
xajax.debug.text[107] = 'RUFE AUF: ';
xajax.debug.text[108] = 'URI: ';
xajax.debug.text[109] = 'BEGINNE ANFRAGE';
xajax.debug.text[110] = 'PARAMETER IN BEARBEITUNG [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'KEINE PARAMETER ZU VERARBEITEN';
xajax.debug.text[113] = 'BEREITE REQUEST VOR';
xajax.debug.text[114] = 'BEGINNE XAJAX CALL (veraltet: verwendet stattdessen xajax.request)';
xajax.debug.text[115] = 'BEGINNE XAJAX ANFRAGE';
xajax.debug.text[116] = 'Die vom Server erhaltenen Daten konnten nicht verarbeitet werden.\n';
xajax.debug.text[117] = '.\nPrüfe auf Fehlermeldungen des Servers.';
xajax.debug.text[118] = 'ERHALTEN [status: ';
xajax.debug.text[119] = ', Größe: ';
xajax.debug.text[120] = ' bytes, Zeit: ';
xajax.debug.text[121] = 'ms]:\n';
xajax.debug.text[122] = 'Der Server hat folgenden HTTP-Status zurück gesendet: ';
xajax.debug.text[123] = '\nERHALTEN:\n';
xajax.debug.text[124] = 'Der Server lieferte einen Redirect nach:<br />';
xajax.debug.text[125] = 'ERLEDIGT [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'INITIALISIERE REQUEST OBJEKT';
/*
Array: exceptions
*/
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'Ungültige XML-Antwort: die Antwort enthält ein ungültiges Tag: {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest ist nicht verfügbar, XajaX ist nicht verfügbar.';
xajax.debug.exceptions[10003] = 'Warteschleife-Überlauf: kann Objekt nicht an Warteschleife übergeben da diese voll ist.';
xajax.debug.exceptions[10004] = 'Ungültige XML-Antwort: die Antwort enthält einen unerwarteten Tag oder Text: {data}.';
xajax.debug.exceptions[10005] = 'Ungültige Request-URI: Ungültige oder Fehlende URI; Autoerkennung fehlgeschlagen; bitte nur eine einzige URI angeben.';
xajax.debug.exceptions[10006] = 'Ungültiges Antwort-Befehl: Unvollständiges Objekt zurück erhalten.';
xajax.debug.exceptions[10007] = 'Ungültiges Antwort-Befehl: Befehl [{data}] ist nicht bekannt.';
xajax.debug.exceptions[10008] = 'Es konnte kein Element mit der ID [{data}] konnte im Dokument gefunden werden.';
xajax.debug.exceptions[10009] = 'Ungültige Anfrage: Fehlender Funktionsparameter - name.';
xajax.debug.exceptions[10010] = 'Ungültige Anfrage: Fehlender Funktionsparameter - object.';
}
if ('undefined' != typeof xajax.config) {
if ('undefined' != typeof xajax.config.status) {
/*
Object: update
*/
xajax.config.status.update = function() {
return {
onRequest: function() {
window.status = 'Sending Request...';
},
onWaiting: function() {
window.status = 'Waiting for Response...';
},
onProcessing: function() {
window.status = 'Processing...';
},
onComplete: function() {
window.status = 'Done.';
}
}
}
}
}

View File

@@ -0,0 +1,81 @@
/**
* translation for: xajax v.x.x
* @version: 1.0.0
* @author: mic <info@joomx.com>
* @copyright xajax project
* @license GNU/GPL
* @package xajax x.x.x
* @since v.x.x.x
* save as UTF-8
*/
if ('undefined' != typeof xajax.debug) {
/*
Array: text
*/
xajax.debug.text = [];
xajax.debug.text[100] = 'ALERTA: ';
xajax.debug.text[101] = 'ERROR: ';
xajax.debug.text[102] = 'MENSAJE XAJAX DEBUG:\n';
xajax.debug.text[103] = '...\n[RESPUESTA LARGA]\n...';
xajax.debug.text[104] = 'ENVIANDO PETICION';
xajax.debug.text[105] = 'ENVIADO [';
xajax.debug.text[106] = ' bytes]';
xajax.debug.text[107] = 'LLAMADA: ';
xajax.debug.text[108] = 'URI: ';
xajax.debug.text[109] = 'INICIALIZANDO PETICION';
xajax.debug.text[110] = 'PROCESANDO PARAMETROS [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'NO HAY PARAMETROS A PROCESAR';
xajax.debug.text[113] = 'PREPARANDO PETICION';
xajax.debug.text[114] = 'INICIANDO XAJAX CALL (En desuso: use xajax.request)';
xajax.debug.text[115] = 'INICIANDO XAJAX REQUEST';
xajax.debug.text[116] = 'Ning<6E>n procesador de respuesta esta disponible para tratar la respuesta del servidor.\n';
xajax.debug.text[117] = '.\nRevisa mensajes de error del servidor.';
xajax.debug.text[118] = 'RECIBIDO [status: ';
xajax.debug.text[119] = ', size: ';
xajax.debug.text[120] = ' bytes, time: ';
xajax.debug.text[121] = 'ms]:\n';
xajax.debug.text[122] = 'El servidor retorno el siguiente estado HTTP: ';
xajax.debug.text[123] = '\nRECIBIDO:\n';
xajax.debug.text[124] = 'El servidor retorno una redireccion a:<br />';
xajax.debug.text[125] = 'HECHO [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'INICIALIZANDO PETICION OBJETO';
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'Invalid response XML: La respuesta contiene una etiqueta desconocida: {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest no disponible, xajax esta deshabilitado.';
xajax.debug.exceptions[10003] = 'Queue overflow: No se puede colocar objeto en cola porque esta llena.';
xajax.debug.exceptions[10004] = 'Invalid response XML: La respuesta contiene una etiqueta o texto inesperado: {data}.';
xajax.debug.exceptions[10005] = 'Invalid request URI: URI invalida o perdida; autodeteccion fallida; por favor especifica una explicitamente.';
xajax.debug.exceptions[10006] = 'Invalid response command: Orden de respuesta mal formado recibido.';
xajax.debug.exceptions[10007] = 'Invalid response command: Comando [{data}] no es un comando conocido.';
xajax.debug.exceptions[10008] = 'Elemento con ID [{data}] no encontrado en el documento.';
xajax.debug.exceptions[10009] = 'Invalid request: Nombre parametro de funcion perdido.';
xajax.debug.exceptions[10010] = 'Invalid request: Objeto parametro de funcion perdido.';
}
if ('undefined' != typeof xajax.config) {
if ('undefined' != typeof xajax.config.status) {
/*
Object: update
*/
xajax.config.status.update = function() {
return {
onRequest: function() {
window.status = 'Enviando Peticion...';
},
onWaiting: function() {
window.status = 'Esperando Respuesta...';
},
onProcessing: function() {
window.status = 'Procesando...';
},
onComplete: function() {
window.status = 'Hecho.';
}
}
}
}
}

View File

@@ -0,0 +1,65 @@
xajax.debug.text = [];
xajax.debug.text[100] = 'ATTENTION : ';
xajax.debug.text[101] = 'ERREUR : ';
xajax.debug.text[102] = 'MESSAGE DE DEBUG XAJAX :\n';
xajax.debug.text[103] = '...\n[R<>PONSE LONGUE]\n...';
xajax.debug.text[104] = 'ENVOI DE LA REQU<51>TE';
xajax.debug.text[105] = 'ENVOY<4F> [';
xajax.debug.text[106] = ' octets]';
xajax.debug.text[107] = 'APPEL : ';
xajax.debug.text[108] = 'URI : ';
xajax.debug.text[109] = 'INITIALISATION DE LA REQU<51>TE';
xajax.debug.text[110] = 'TRAITEMENT DES PARAM<41>TRES [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'AUCUN PARAM<41>TRE <20> TRAITER';
xajax.debug.text[113] = 'PR<50>PARATION DE LA REQU<51>TE';
xajax.debug.text[114] = 'D<>BUT DE L\'APPEL XAJAX (d<>pr<70>ci<63>: utilisez plut<75>t xajax.request)';
xajax.debug.text[115] = 'D<>BUT DE LA REQU<51>TE';
xajax.debug.text[116] = 'Aucun traitement disponible pour traiter la r<>ponse du serveur.\n';
xajax.debug.text[117] = '.\nV<6E>rifie s\'il existe des messages d\'erreur du serveur.';
xajax.debug.text[118] = 'RE<52>US [statut : ';
xajax.debug.text[119] = ', taille: ';
xajax.debug.text[120] = ' octets, temps: ';
xajax.debug.text[121] = 'ms] :\n';
xajax.debug.text[122] = 'Le serveur a retourn<72> la statut HTTP suivant : ';
xajax.debug.text[123] = '\nRE<52>US :\n';
xajax.debug.text[124] = 'Le serveur a indiqu<71> une redirection vers :<br />';
xajax.debug.text[125] = 'FAIT [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'INITIALISATION DE L\'OBJET REQU<51>TE';
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'R<>ponse XML non valide : La r<>ponse contient une balise inconnue : {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject : XMLHttpRequest n\'est pas disponible, xajax est d<>sactiv<69>.';
xajax.debug.exceptions[10003] = 'File pleine : Ne peut ajouter un objet <20> la file car elle est pleine.';
xajax.debug.exceptions[10004] = 'R<>ponse XML non valide : La r<>ponse contient une balise ou un texte inattendu : {data}.';
xajax.debug.exceptions[10005] = 'URI de la requ<71>te non valide : URI non valide ou manquante; auto-d<>tection <20>chou<6F>e; veuillez en sp<73>cifier une explicitement.';
xajax.debug.exceptions[10006] = 'R<>ponse de commande invalide : Commande de r<>ponse re<72>ue mal form<72>e.';
xajax.debug.exceptions[10007] = 'R<>ponse de commande invalide : Commande [{data}] est inconnue.';
xajax.debug.exceptions[10008] = 'L\'<27>l<EFBFBD>ment d\'ID [{data}] est introuvable dans le document.';
xajax.debug.exceptions[10009] = 'Requ<71>te invalide : Aucun nom de fonction indiqu<71> en param<61>tre.';
xajax.debug.exceptions[10010] = 'Requ<71>te invalide : Aucun objet indiqu<71> en param<61>tre pour la fonction.';
if ('undefined' != typeof xajax.config) {
if ('undefined' != typeof xajax.config.status) {
/*
Object: mise <20> jour
*/
xajax.config.status.update = function() {
return {
onRequest: function() {
window.status = 'Envoi de la requ<71>te...';
},
onWaiting: function() {
window.status = 'Attente de la r<>ponse...';
},
onProcessing: function() {
window.status = 'En cours de traitement...';
},
onComplete: function() {
window.status = 'Fait.';
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
/**
* translation for: xajax v.x.x
* @version: 1.0.0
* @author: jeffrey <walkingsoul@gmail.com>
* @copyright xajax project
* @license GNU/GPL
* @package xajax x.x.x
* @since v.x.x.x
* save as UTF-8
*/
if ('undefined' != typeof xajax.debug) {
/*
Array: text
*/
xajax.debug.text = [];
xajax.debug.text[100] = 'FOUTMELDING: ';
xajax.debug.text[101] = 'FOUT: ';
xajax.debug.text[102] = 'XAJAX FOUTMELDINGS BERICHT:\n';
xajax.debug.text[103] = '...\n[LANG ANTWOORD]\n...';
xajax.debug.text[104] = 'VERZENDING AANVRAAG';
xajax.debug.text[105] = 'VERZONDEN [';
xajax.debug.text[106] = ' bytes]';
xajax.debug.text[107] = 'AANROEPING: ';
xajax.debug.text[108] = 'URI: ';
xajax.debug.text[109] = 'INITIALISATIE AANVRAAG';
xajax.debug.text[110] = 'VERWERKING PARAMETERS [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'GEEN PARAMETERS OM TE VERWERKEN';
xajax.debug.text[113] = 'VOORBEREIDING AANVRAAG';
xajax.debug.text[114] = 'BEGIN XAJAX AANVRAAG (verouderd: gebruik xajax.request)';
xajax.debug.text[115] = 'BEGIN XAJAX AANVRAAG';
xajax.debug.text[116] = 'Er is geen verwerkingsbestand gespecificeerd om de aanvraag te verwerken.\n';
xajax.debug.text[117] = '.\nBekijk foutmeldingen van de server.';
xajax.debug.text[118] = 'ONTVANGEN [status: ';
xajax.debug.text[119] = ', omvang: ';
xajax.debug.text[120] = ' bytes, Zeit: ';
xajax.debug.text[121] = 'ms]:\n';
xajax.debug.text[122] = 'De server retourneert de volgende HTTP-status: ';
xajax.debug.text[123] = '\nONTVANGEN:\n';
xajax.debug.text[124] = 'De server retourneert een doorverwijzing naar:<br />';
xajax.debug.text[125] = 'KLAAR [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'INITIALISATIE OBJECT AANVRAAG';
/*
Array: exceptions
*/
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'Ongeldig XML-antwoord: het antwoord bevat een onbekende tag: {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest is niet beschikbaar, XajaX is uitgeschakeld.';
xajax.debug.exceptions[10003] = 'Wachtrij limiet overschreden: kan het object niet in de wachtrij plaatsen, omdat die vol is.';
xajax.debug.exceptions[10004] = 'Ongeldig XML-antwoord: het antwoord bevat een onverwachte tag of tekst: {data}.';
xajax.debug.exceptions[10005] = 'Ongeldige Request-URI: Ongeldige of ontbrekende URI; automatische detectie faalt; specificeer een URI expliciet.';
xajax.debug.exceptions[10006] = 'Ongeldig antwoord bevel: misvormd antwoord bevel ontvangen.';
xajax.debug.exceptions[10007] = 'Ongeldig antwoord bevel: Bevel [{data}] is niet bekend.';
xajax.debug.exceptions[10008] = 'Element met het ID [{data}] kon niet in het document worden gevonden.';
xajax.debug.exceptions[10009] = 'Ongeldige aanvraag: Missende functie parameter - naam.';
xajax.debug.exceptions[10010] = 'Ongeldige aanvraag: Missende functie parameter - object.';
}
if ('undefined' != typeof xajax.config) {
if ('undefined' != typeof xajax.config.status) {
/*
Object: update
*/
xajax.config.status.update = function() {
return {
onRequest: function() {
window.status = "Verzenden aanvraag...";
},
onWaiting: function() {
window.status = "Wachten op antwoord...";
},
onProcessing: function() {
window.status = "Verwerking...";
},
onComplete: function() {
window.status = "Afgesloten.";
}
}
}
}
}

View File

@@ -0,0 +1,81 @@
/**
* translation for: xajax v.x.x
* @version: 1.0.0
* @author: mic <info@joomx.com>
* @copyright xajax project
* @license GNU/GPL
* @package xajax x.x.x
* @since v.x.x.x
* save as UTF-8
*/
if ('undefined' != typeof xajax.debug) {
xajax.debug.text = [];
xajax.debug.text[100] = 'IKAZ: ';
xajax.debug.text[101] = 'HATA: ';
xajax.debug.text[102] = 'XAJAX DEBUG (HATA AYIKLAMASI) MESAJI:\n';
xajax.debug.text[103] = '...\n[UZUN YANIT]\n...';
xajax.debug.text[104] = 'ISTEK GÖNDERILIYOR';
xajax.debug.text[105] = 'GÖNDERILDI [';
xajax.debug.text[106] = ' byte]';
xajax.debug.text[107] = 'ÇAGIRILIYOR: ';
xajax.debug.text[108] = 'URI: ';
xajax.debug.text[109] = 'ISTEK BASLATILIYOR';
xajax.debug.text[110] = 'PARAMETRELER ISLENIYOR [';
xajax.debug.text[111] = ']';
xajax.debug.text[112] = 'ISLENECEK PARAMETRE YOK';
xajax.debug.text[113] = 'ISTEK HAZIRLANIYOR';
xajax.debug.text[114] = 'XAJAX ÇAGRISI BASLATILIYOR (kullanimi tavsiye edilmiyor: yerine xajax.request kullanin)';
xajax.debug.text[115] = 'XAJAX ISTEGI BASLATILIYOR';
xajax.debug.text[116] = 'Sunucudan gelen cevabi isleyecek cevap islemcisi yok.\n';
xajax.debug.text[117] = '.\nSunucudan gelen hata mesajlarini kontrol edin.';
xajax.debug.text[118] = 'ALINDI [durum: ';
xajax.debug.text[119] = ', boyut: ';
xajax.debug.text[120] = ' byte, süre: ';
xajax.debug.text[121] = 'ms]:\n';
xajax.debug.text[122] = 'Sunucu asagidaki HTTP durumunu gönderdi: ';
xajax.debug.text[123] = '\nALINDI:\n';
xajax.debug.text[124] = 'Sunucu su adrese yönlendirme istegi gönderdi :<br />';
xajax.debug.text[125] = 'TAMAMLANDI [';
xajax.debug.text[126] = 'ms]';
xajax.debug.text[127] = 'ISTEK NESNESI BASLATILIYOR';
/*
Array: exceptions
*/
xajax.debug.exceptions = [];
xajax.debug.exceptions[10001] = 'Geçersiz XML cevabi: Cevap bilinmeyen bir etiket tasiyor: {data}.';
xajax.debug.exceptions[10002] = 'GetRequestObject: XMLHttpRequest hazir degil, xajax nesnesi etkisizlestirildi.';
xajax.debug.exceptions[10003] = 'Islem kuyrugu fazla yüklendi: Kuyruk dolu oldugu için nesne kuyruga eklenemiyor.';
xajax.debug.exceptions[10004] = 'Geçersiz XML cevabi: Cevap bilinmeyen bir etiket veya metin tasiyor: {data}.';
xajax.debug.exceptions[10005] = 'Geçersiz istek URI: Geçersiz veya kayip URI; otomatik tespit yapilamadi; lütfen açikça bir tane belirleyiniz.';
xajax.debug.exceptions[10006] = 'Geçersiz cevap komutu: Bozulmus cevap komutu alindi.';
xajax.debug.exceptions[10007] = 'Geçersiz cevap komutu: [{data}] komutu bilinmiyor.';
xajax.debug.exceptions[10008] = '[{data}] ID li element dosya içinde bulunamadi.';
xajax.debug.exceptions[10009] = 'Geçersiz istek: Fonksiyon isim parametresi eksik.';
xajax.debug.exceptions[10010] = 'Geçersiz istek: Fonksiyon nesne parametresi eksik.';
}
if ('undefined' != typeof xajax.config) {
if ('undefined' != typeof xajax.config.status) {
/*
Object: update
*/
xajax.config.status.update = function() {
return {
onRequest: function() {
window.status = 'İstek Gönderiliyor...';
},
onWaiting: function() {
window.status = 'Cevap Bekleniyor...';
},
onProcessing: function() {
window.status = 'İşlem Devam Ediyor...';
},
onComplete: function() {
window.status = 'Tamamlandı.';
}
}
}
}
}

View File

@@ -0,0 +1,13 @@
try{if(undefined==xajax.legacy)
xajax.legacy={}
}catch(e){alert('An internal error has occurred: the xajax_core has not been loaded prior to xajax_legacy.');}
xajax.legacy.call=xajax.call;xajax.call=function(sFunction,objParameters){var oOpt={}
oOpt.parameters=objParameters;if(undefined!=xajax.loadingFunction){if(undefined==oOpt.callback)
oOpt.callback={}
oOpt.callback.onResponseDelay=xajax.loadingFunction;}
if(undefined!=xajax.doneLoadingFunction){if(undefined==oOpt.callback)
oOpt.callback={}
oOpt.callback.onComplete=xajax.doneLoadingFunction;}
return xajax.legacy.call(sFunction,oOpt);}
xajax.legacy.isLoaded=true;

View File

@@ -0,0 +1,60 @@
/*
File: xajax_legacy.js
Provides support for legacy scripts that have not been updated to the
latest syntax.
Title: xajax legacy support module
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajax_legacy_uncompressed.php 327 2007-02-28 16:55:26Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajax.legacy
*/
try {
if (undefined == xajax.legacy)
xajax.legacy = {}
} catch (e) {
alert('An internal error has occurred: the xajax_core has not been loaded prior to xajax_legacy.');
}
/*
Function: call
Convert call parameters from the 0.2.x syntax to the new *improved*
call format.
This is a wrapper function around the standard <xajax.call> function.
*/
xajax.legacy.call = xajax.call;
xajax.call = function(sFunction, objParameters) {
var oOpt = {}
oOpt.parameters = objParameters;
if (undefined != xajax.loadingFunction) {
if (undefined == oOpt.callback)
oOpt.callback = {}
oOpt.callback.onResponseDelay = xajax.loadingFunction;
}
if (undefined != xajax.doneLoadingFunction) {
if (undefined == oOpt.callback)
oOpt.callback = {}
oOpt.callback.onComplete = xajax.doneLoadingFunction;
}
return xajax.legacy.call(sFunction, oOpt);
}
/*
Boolean: isLoaded
true - Indicates that the <xajax.legacy> module is loaded.
*/
xajax.legacy.isLoaded = true;

View File

@@ -0,0 +1,168 @@
/*
File: xajax_verbose.js
The xajax verbose debugging module. This is an optional module, include in
your project with care. :)
Title: xajax verbose debugging module
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajax_verbose_uncompressed 327 2007-02-28 16:55:26Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
try {
if (undefined == xajax)
throw { name: 'SequenceError', message: 'Error: xajax was not detected, verbose module disabled.' }
if (undefined == xajax.debug)
throw { name: 'SequenceError', message: 'Error: xajax debugger was not detected, verbose module disabled.' }
/*
Class: xajax.debug.verbose
Provide a high level of detail which can be used to debug hard to find
problems.
*/
xajax.debug.verbose = {}
/*
Function: expandObject
Generate a debug message expanding all the first level
members found therein.
obj - (object): The object to be enumerated.
Returns:
string - The textual representation of all the first
level members.
*/
xajax.debug.verbose.expandObject = function(obj) {
var rec = true;
if (1 < arguments.length)
rec = arguments[1];
if ('function' == typeof (obj)) {
return '[Function]';
} else if ('object' == typeof (obj)) {
if (true == rec) {
var t = ' { ';
var separator = '';
for (var m in obj) {
t += separator;
t += m;
t += ': ';
try {
t += xajax.debug.verbose.expandObject(obj[m], false);
} catch (e) {
t += '[n/a]';
}
separator = ', ';
}
t += ' } ';
return t;
} else return '[Object]';
} else return '"' + obj + '"';
}
/*
Function: makeFunction
Generate a wrapper function around the specified function.
obj - (object): The object that contains the function to be
wrapped.
name - (string): The name of the function to be wrapped.
Returns:
function - The wrapper function.
*/
xajax.debug.verbose.makeFunction = function(obj, name) {
return function() {
var fun = name;
fun += '(';
var separator = '';
var pLen = arguments.length;
for (var p = 0; p < pLen; ++p) {
fun += separator;
fun += xajax.debug.verbose.expandObject(arguments[p]);
separator = ',';
}
fun += ');';
var msg = '--> ';
msg += fun;
xajax.debug.writeMessage(msg);
var returnValue = true;
var code = 'returnValue = obj(';
separator = '';
for (var p = 0; p < pLen; ++p) {
code += separator;
code += 'arguments[' + p + ']';
separator = ',';
}
code += ');';
eval(code);
msg = '<-- ';
msg += fun;
msg += ' returns ';
msg += xajax.debug.verbose.expandObject(returnValue);
xajax.debug.writeMessage(msg);
return returnValue;
}
}
/*
Function: hook
Generate a wrapper function around each of the functions
contained within the specified object.
x - (object): The object to be scanned.
base - (string): The base reference to be prepended to the
generated wrapper functions.
*/
xajax.debug.verbose.hook = function(x, base) {
for (var m in x) {
if ('function' == typeof (x[m])) {
x[m] = xajax.debug.verbose.makeFunction(x[m], base + m);
}
}
}
xajax.debug.verbose.hook(xajax, 'xajax.');
xajax.debug.verbose.hook(xajax.callback, 'xajax.callback.');
xajax.debug.verbose.hook(xajax.css, 'xajax.css.');
xajax.debug.verbose.hook(xajax.dom, 'xajax.dom.');
xajax.debug.verbose.hook(xajax.events, 'xajax.events.');
xajax.debug.verbose.hook(xajax.forms, 'xajax.forms.');
xajax.debug.verbose.hook(xajax.js, 'xajax.js.');
xajax.debug.verbose.hook(xajax.tools, 'xajax.tools.');
xajax.debug.verbose.hook(xajax.tools.queue, 'xajax.tools.queue.');
xajax.debug.verbose.hook(xajax.command, 'xajax.command.');
xajax.debug.verbose.hook(xajax.command.handler, 'xajax.command.handler.');
/*
Boolean: isLoaded
true - indicates that the verbose debugging module is loaded.
*/
xajax.debug.verbose.isLoaded = true;
} catch (e) {
alert(e.name + ': ' + e.message);
}

View File

@@ -0,0 +1,168 @@
/*
File: xajax_verbose.js
The xajax verbose debugging module. This is an optional module, include in
your project with care. :)
Title: xajax verbose debugging module
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajax_verbose_uncompressed 327 2007-02-28 16:55:26Z calltoconstruct $
@copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
try {
if (undefined == xajax)
throw { name: 'SequenceError', message: 'Error: xajax was not detected, verbose module disabled.' }
if (undefined == xajax.debug)
throw { name: 'SequenceError', message: 'Error: xajax debugger was not detected, verbose module disabled.' }
/*
Class: xajax.debug.verbose
Provide a high level of detail which can be used to debug hard to find
problems.
*/
xajax.debug.verbose = {}
/*
Function: expandObject
Generate a debug message expanding all the first level
members found therein.
obj - (object): The object to be enumerated.
Returns:
string - The textual representation of all the first
level members.
*/
xajax.debug.verbose.expandObject = function(obj) {
var rec = true;
if (1 < arguments.length)
rec = arguments[1];
if ('function' == typeof (obj)) {
return '[Function]';
} else if ('object' == typeof (obj)) {
if (true == rec) {
var t = ' { ';
var separator = '';
for (var m in obj) {
t += separator;
t += m;
t += ': ';
try {
t += xajax.debug.verbose.expandObject(obj[m], false);
} catch (e) {
t += '[n/a]';
}
separator = ', ';
}
t += ' } ';
return t;
} else return '[Object]';
} else return '"' + obj + '"';
}
/*
Function: makeFunction
Generate a wrapper function around the specified function.
obj - (object): The object that contains the function to be
wrapped.
name - (string): The name of the function to be wrapped.
Returns:
function - The wrapper function.
*/
xajax.debug.verbose.makeFunction = function(obj, name) {
return function() {
var fun = name;
fun += '(';
var separator = '';
var pLen = arguments.length;
for (var p = 0; p < pLen; ++p) {
fun += separator;
fun += xajax.debug.verbose.expandObject(arguments[p]);
separator = ',';
}
fun += ');';
var msg = '--> ';
msg += fun;
xajax.debug.writeMessage(msg);
var returnValue = true;
var code = 'returnValue = obj(';
separator = '';
for (var p = 0; p < pLen; ++p) {
code += separator;
code += 'arguments[' + p + ']';
separator = ',';
}
code += ');';
eval(code);
msg = '<-- ';
msg += fun;
msg += ' returns ';
msg += xajax.debug.verbose.expandObject(returnValue);
xajax.debug.writeMessage(msg);
return returnValue;
}
}
/*
Function: hook
Generate a wrapper function around each of the functions
contained within the specified object.
x - (object): The object to be scanned.
base - (string): The base reference to be prepended to the
generated wrapper functions.
*/
xajax.debug.verbose.hook = function(x, base) {
for (var m in x) {
if ('function' == typeof (x[m])) {
x[m] = xajax.debug.verbose.makeFunction(x[m], base + m);
}
}
}
xajax.debug.verbose.hook(xajax, 'xajax.');
xajax.debug.verbose.hook(xajax.callback, 'xajax.callback.');
xajax.debug.verbose.hook(xajax.css, 'xajax.css.');
xajax.debug.verbose.hook(xajax.dom, 'xajax.dom.');
xajax.debug.verbose.hook(xajax.events, 'xajax.events.');
xajax.debug.verbose.hook(xajax.forms, 'xajax.forms.');
xajax.debug.verbose.hook(xajax.js, 'xajax.js.');
xajax.debug.verbose.hook(xajax.tools, 'xajax.tools.');
xajax.debug.verbose.hook(xajax.tools.queue, 'xajax.tools.queue.');
xajax.debug.verbose.hook(xajax.command, 'xajax.command.');
xajax.debug.verbose.hook(xajax.command.handler, 'xajax.command.handler.');
/*
Boolean: isLoaded
true - indicates that the verbose debugging module is loaded.
*/
xajax.debug.verbose.isLoaded = true;
} catch (e) {
alert(e.name + ': ' + e.message);
}