[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL - xmlrpclib.pt:1.1.2.1
Christian Theune
ct@gocept.com
Sat, 18 May 2002 06:43:31 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL
In directory cvs.zope.org:/tmp/cvs-serv3493
Added Files:
Tag: ctheune-foldermove-branch
xmlrpclib.pt
Log Message:
Renamed xmlrpclib.pt to ../../../Content/Folder/Views/XUL//xmlrpclib.pt
=== Added File Zope3/lib/python/Zope/App/OFS/Content/Folder/Views/XUL/xmlrpclib.pt === (528/628 lines abridged)
//
// Copyright (C) 2000, 2001, 2002 Virtual Cowboys info@virtualcowboys.nl
//
// Author: Ruben Daniels <ruben@virtualcowboys.nl>
// Version: 0.91
// Date: 29-08-2001
// Site: www.vcdn.org/Public/XMLRPC/
//
// 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 2 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, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Object.prototype.toXMLRPC = function(){
var wo = this.valueOf();
if(wo.toXMLRPC == this.toXMLRPC){
retstr = "<struct>";
for(prop in this){
if(typeof wo[prop] != "function"){
retstr += "<member><name>" + prop + "</name><value>" + XMLRPC.getXML(wo[prop]) + "</value></member>";
}
}
retstr += "</struct>";
return retstr;
}
else{
return wo.toXMLRPC();
}
}
String.prototype.toXMLRPC = function(){
//<![CDATA[***your text here***]]>
return "<string><![CDATA[" + this.replace(/\]\]/g, "] ]") + "]]></string>";//.replace(/</g, "<").replace(/&/g, "&")
}
Number.prototype.toXMLRPC = function(){
if(this == parseInt(this)){
[-=- -=- -=- 528 lines omitted -=- -=- -=-]
},
processResult : function(http){
if(self.DEBUG) alert(http.responseText);
if(http.status == 200){
//getIncoming message
dom = http.responseXML;
if(dom){
var rpcErr, main;
//Check for XMLRPC Errors
rpcErr = dom.getElementsByTagName("fault");
if(rpcErr.length > 0){
rpcErr = this.toObject(rpcErr[0].firstChild);
this.handleError(new Error(rpcErr.faultCode, rpcErr.faultString));
return false
}
//handle method result
main = dom.getElementsByTagName("param");
if(main.length == 0) this.handleError(new Error("Malformed XMLRPC Message"));
data = this.toObject(this.getNode(main[0], [0]));
//handle receiving
if(this.onreceive) this.onreceive(data);
return data;
}
else{
this.handleError(new Error("Malformed XMLRPC Message"));
}
}
else{
this.handleError(new Error("HTTP Exception: (" + http.status + ") " + http.statusText + "\n\n" + http.responseText));
}
}
}
//Smell something
ver = navigator.appVersion;
app = navigator.appName;
isNS = Boolean(navigator.productSub)
//moz_can_do_http = (parseInt(navigator.productSub) >= 20010308)
isIE = (ver.indexOf("MSIE 5") != -1 || ver.indexOf("MSIE 6") != -1) ? 1 : 0;
isIE55 = (ver.indexOf("MSIE 5.5") != -1) ? 1 : 0;
isOTHER = (!isNS && !isIE) ? 1 : 0;
if(isOTHER) alert("Sorry your browser doesn't support the features of vcXMLRPC");