/** * CPAINT - Cross-Platform Asynchronous INterface Toolkit * * http://cpaint.sourceforge.net * * released under the terms of the LGPL * see http://www.fsf.org/licensing/licenses/lgpl.txt for details * * @package CPAINT * @access public * @copyright Copyright (c) 2005 Paul Sullivan, Dominique Stender - http://cpaint.sourceforge.net * @author Paul Sullivan * @author Dominique Stender * @version 2.0.0 */ function cpaint(){var config=new Array();config['debugging']=0;config['proxy_url']='';config['transfer_mode']='GET';config['async']=true;config['response_type']='OBJECT';config['persistent_connection']=false;config['use_cpaint_api']=true;var stack_count=0;this.set_debug=function(){if(typeof arguments[0]=='boolean'){if(arguments[0]===true){config['debugging']=1;}else{config['debugging']=0;}}else if(typeof arguments[0]=='number'){config['debugging']=Math.round(arguments[0]);}} this.set_proxy_url=function(){if(typeof arguments[0]=='string'){config['proxy_url']=arguments[0];}} this.set_transfer_mode=function(){if(arguments[0].toUpperCase()=='GET'||arguments[0].toUpperCase()=='POST'){config['transfer_mode']=arguments[0].toUpperCase();}} this.set_async=function(){if(typeof arguments[0]=='boolean'){config['async']=arguments[0];}} this.set_response_type=function(){if(arguments[0].toUpperCase()=='TEXT'||arguments[0].toUpperCase()=='XML'||arguments[0].toUpperCase()=='OBJECT'){config['response_type']=arguments[0].toUpperCase();}} this.set_persistent_connection=function(){if(typeof arguments[0]=='boolean'){config['persistent_connection']=arguments[0];}} this.set_use_cpaint_api=function(){if(typeof arguments[0]=='boolean'){config['use_cpaint_api']=arguments[0];}} this.call=function(){var use_stack=-1;if(config['persistent_connection']==true&&typeof __cpaint_stack[0]=='object'){switch(__cpaint_stack[0].get_http_state()){case-1:use_stack=0;debug('no XMLHttpObject object to re-use for persistence, creating new one later',2);break;case 4:use_stack=0 debug('re-using the persistent connection',2);break;default:debug('the persistent connection is in use - skipping this request',2);}}else if(config['persistent_connection']==true){use_stack=0;__cpaint_stack[use_stack]=new cpaint_call(use_stack);debug('no cpaint_call object available for re-use, created new one',2);}else{use_stack=stack_count;__cpaint_stack[use_stack]=new cpaint_call(use_stack);debug('no cpaint_call object created new one',2);} if(use_stack!=-1){__cpaint_stack[use_stack].set_debug(config['debugging']);__cpaint_stack[use_stack].set_proxy_url(config['proxy_url']);__cpaint_stack[use_stack].set_transfer_mode(config['transfer_mode']);__cpaint_stack[use_stack].set_async(config['async']);__cpaint_stack[use_stack].set_response_type(config['response_type']);__cpaint_stack[use_stack].set_persistent_connection(config['persistent_connection']);__cpaint_stack[use_stack].set_use_cpaint_api(config['use_cpaint_api']);__cpaint_stack[use_stack].set_client_callback(arguments[2]);if(config['proxy_url']!=''){__cpaint_stack[use_stack].call_proxy(arguments);}else{__cpaint_stack[use_stack].call_direct(arguments);} stack_count++;debug('stack size: '+__cpaint_stack.length,2);}} var debug=function(message,debug_level){if(config['debugging']>=debug_level){if(config['debugging']==9){alert(config['debugging']);debugToConsole(message);}else{alert('[CPAINT Debug] '+message);}}}} var __cpaint_stack=new Array();var __cpaint_transformer=new cpaint_transformer();function cpaint_call(){var debugging=false;var httpobj=false;var proxy_url='';var transfer_mode='GET';var async=true;var response_type='OBJECT';var persistent_connection=false;var use_cpaint_api=true;var client_callback;var stack_id=arguments[0];this.set_debug=function(){if(typeof arguments[0]=='number'){debugging=Math.round(arguments[0]);}} this.set_proxy_url=function(){if(typeof arguments[0]=='string'){proxy_url=arguments[0];}} this.set_transfer_mode=function(){if(arguments[0].toUpperCase()=='GET'||arguments[0].toUpperCase()=='POST'){transfer_mode=arguments[0].toUpperCase();}} this.set_async=function(){if(typeof arguments[0]=='boolean'){async=arguments[0];}} this.set_response_type=function(){if(arguments[0].toUpperCase()=='TEXT'||arguments[0].toUpperCase()=='XML'||arguments[0].toUpperCase()=='OBJECT'){response_type=arguments[0].toUpperCase();}} this.set_persistent_connection=function(){if(typeof arguments[0]=='boolean'){persistent_connection=arguments[0];}} this.set_use_cpaint_api=function(){if(typeof arguments[0]=='boolean'){use_cpaint_api=arguments[0];}} this.set_client_callback=function(){if(typeof arguments[0]=='function'){client_callback=arguments[0];}} this.get_http_state=function(){var return_value=-1;if(typeof httpobj=='object'){return_value=httpobj.readyState;} return return_value;} this.call_direct=function(call_arguments){var url=call_arguments[0];var remote_method=call_arguments[1];var querystring='';var i=0;if(url=='SELF'){url=document.location.href;} if(use_cpaint_api==true){for(i=3;i=debug_level){alert('[CPAINT Debug] '+message);}}} function cpaint_transformer(){this.object_conversion=function(xml_document){var return_value=new cpaint_result_object();var i=0;var firstNodeName='';if(typeof xml_document=='object'&&xml_document!=null){for(i=0;i