view inkscape/firefox/content/jqSOAPClient.pack.js @ 353:3d03451be435

Import the file specified in the mozplugger helper. This is the first step to handle the same file between inkscape and helper
author wycc
date Mon, 09 Mar 2009 01:28:56 +0800
parents 63aaf96209cd
children
line wrap: on
line source

/*
	This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
var SOAPClient={Proxy:"",SOAPServer:"",ContentType:"text/xml",CharSet:"utf-8",ResponseXML:null,ResponseText:"",Status:0,ContentLength:0,Namespace:function(a,b){return{"name":a,"uri":b}},SendRequest:function(c,d){if(!!SOAPClient.Proxy){SOAPClient.ResponseText="";SOAPClient.ResponseXML=null;SOAPClient.Status=0;var e=c.toString();SOAPClient.ContentLength=e.length;function getResponse(a){if(!!d){SOAPClient.Status=a.status;SOAPClient.ResponseText=a.responseText;SOAPClient.ResponseXML=a.responseXML;var b=$.xmlToJSON(a.responseXML);d(b)}}$.ajax({type:"POST",url:SOAPClient.Proxy,dataType:"xml",processData:false,data:e,complete:getResponse,contentType:SOAPClient.ContentType+"; charset=\""+SOAPClient.CharSet+"\"",beforeSend:function(a){a.setRequestHeader("Method","POST");a.setRequestHeader("Content-Length",SOAPClient.ContentLength);a.setRequestHeader("SOAPServer",SOAPClient.SOAPServer);a.setRequestHeader("SOAPAction",c.Action)}})}},ToXML:function(a){var b=[];var c=false;try{if(!!a&&typeof(a)==="object"&&a.typeOf==="SOAPObject"){if(!!a.ns){if(typeof(a.ns)==="object"){c=true;b.push("<"+a.ns.name+":"+a.name);b.push(" xmlns:"+a.ns.name+"=\""+a.ns.uri+"\"")}else{b.push("<"+a.name);b.push(" xmlns=\""+a.ns+"\"")}}else{b.push("<"+a.name)}if(a.attributes.length>0){var d;var f=a.attributes.length-1;do{d=a.attributes[f];if(c){b.push(" "+a.ns.name+":"+d.name+"=\""+d.value+"\"")}else{b.push(" "+d.name+"=\""+d.value+"\"")}}while(f--)}b.push(">");if(a.hasChildren()){var g,cObj;for(g in a.children){cObj=a.children[g];if(typeof(cObj)==="object"){b.push(SOAPClient.ToXML(cObj))}}}if(!!a.value){b.push(a.value)}if(c){b.push("</"+a.ns.name+":"+a.name+">")}else{b.push("</"+a.name+">")}return b.join("")}}catch(e){alert("Unable to process SOAPObject! Object must be an instance of SOAPObject")}}};var SOAPRequest=function(g,h){this.Action=g;var i=[];var j=[];var k=(!!h)?[h]:[];this.addNamespace=function(a,b){i.push(new SOAPClient.Namespace(a,b))};this.addHeader=function(a){j.push(a)};this.addBody=function(a){k.push(a)};this.toString=function(){var a=new SOAPObject("soapenv:Envelope");a.attr("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/");if(i.length>0){var b,tNo;for(b in i){if(!i.hasOwnProperty||i.hasOwnProperty(b)){tNo=i[b];if(typeof(tNo)==="object"){a.attr("xmlns:"+tNo.name,tNo.uri)}}}}if(j.length>0){var c=a.appendChild(new SOAPObject("soapenv:Header"));var d;for(d in j){if(!j.hasOwnProperty||j.hasOwnProperty(d)){c.appendChild(j[d])}}}if(k.length>0){var e=a.appendChild(new SOAPObject("soapenv:Body"));var f;for(f in k){if(!k.hasOwnProperty||k.hasOwnProperty(f)){e.appendChild(k[f])}}}return a.toString()}};var SOAPObject=function(c){this.typeOf="SOAPObject";this.ns=null;this.name=c;this.attributes=[];this.children=[];this.value=null;this.attr=function(a,b){this.attributes.push({"name":a,"value":b});return this};this.appendChild=function(a){this.children.push(a);return a};this.hasChildren=function(){return(this.children.length>0)?true:false};this.val=function(v){if(!v){return this.value}else{this.value=v;return this}};this.toString=function(){return SOAPClient.ToXML(this)}};