diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-05 19:36:15 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:21 -0500 |
commit | baf66d862615086451da4e96f912c562a86d32db (patch) | |
tree | 9592598ab9e2f4e2f6db09f11716a0e1dbb0424e /swat/scripting | |
parent | a2810779352d40911880e84c91f85fe4ccb5d953 (diff) | |
download | samba-baf66d862615086451da4e96f912c562a86d32db.tar.gz samba-baf66d862615086451da4e96f912c562a86d32db.tar.bz2 samba-baf66d862615086451da4e96f912c562a86d32db.zip |
r9136: made the 'AJAJ' code portable to IE and Opera
(This used to be commit b6b531533e2c4d6d927df29905e49a775e92f3c1)
Diffstat (limited to 'swat/scripting')
-rw-r--r-- | swat/scripting/client/call.js | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/swat/scripting/client/call.js b/swat/scripting/client/call.js index bb89390e45..d1671ef70f 100644 --- a/swat/scripting/client/call.js +++ b/swat/scripting/client/call.js @@ -5,6 +5,37 @@ released under the GNU GPL Version 2 or later */ +var __call = new Object(); + +/* + we can't use the qooxdoo portability layer for this, as it assumes + you are using an XML transport, so instead replicate the portability + code for remote calls here. Don't look too closely or you will go + blind. +*/ +__call._activex = window.ActiveXObject && !(new QxClient).isOpera() ? true : false; +__call._activexobj = null; +__call._ok = QxXmlHttpLoader._http || QxXmlHttpLoader._activex; + +if (__call._activex) { + var servers = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; + for (var i=0; i<servers.length; i++) { + try { + var o = new ActiveXObject(servers[i] + ".XMLHTTP"); + __call._activexobj = servers[i]; + o = null; + } catch(ex) {}; + }; +}; + +/* + return a http object ready for a remote call +*/ +function __http_object() { + return __call._activex ? + new ActiveXObject(__call._activexobj + ".XMLHTTP") : + new XMLHttpRequest(); +} /* usage: @@ -18,7 +49,7 @@ object. 'callback' may be null. */ function server_call(url, func, callback) { - var req = new XMLHttpRequest(); + var req = __http_object(); req.open("POST", url, true); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); var args = new Object(); |