diff options
author | Derrell Lipman <derrell@samba.org> | 2006-12-31 20:12:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:35:23 -0500 |
commit | d1e09e2e6f9db62bbab84abb53e23ee73764178a (patch) | |
tree | 18e57f756611c9d3e10fb41bf7c09eeb795028dd /swat/scripting/client/call.js | |
parent | 710dfce70ca9024d2f026518638bb193e914f4a0 (diff) | |
download | samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.gz samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.tar.bz2 samba-d1e09e2e6f9db62bbab84abb53e23ee73764178a.zip |
r20446: rename swat directory to swat.obsolete; keeping it around since there is lots of useful info in it.
(This used to be commit 5f9f72a9cfab80561b23284001b67c4ea961757b)
Diffstat (limited to 'swat/scripting/client/call.js')
-rw-r--r-- | swat/scripting/client/call.js | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/swat/scripting/client/call.js b/swat/scripting/client/call.js deleted file mode 100644 index 2886471db2..0000000000 --- a/swat/scripting/client/call.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - client side js functions for remote calls into the server - - Copyright Andrew Tridgell 2005 - 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: - - vserver_call(url, func, callback, args); - - 'func' is a function name to call on the server - any additional arguments are passed to func() on the server - - The callback() function is called with the returned - object. 'callback' may be null. -*/ -function vserver_call_url(url, func, callback, args) { - var args2 = new Object(); - args2.length = args.length; - var i; - for (i=0;i<args.length;i++) { - args2[i] = args[i]; - } - var req = __http_object(); - req.open("POST", url, true); - req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - req.send("ajaj_func=" + func + "&ajaj_args=" + encodeObject(args2)); - req.onreadystatechange = function() { - if (4 == req.readyState && callback != null) { - var o = decodeObject(req.responseText); - callback(o.res); - } - } -} - - -/* - usage: - - server_call_url(url, func, callback, ...); - - 'func' is a function name to call on the server - any additional arguments are passed to func() on the server - - The callback() function is called with the returned - object. 'callback' may be null. -*/ -function server_call_url(url, func, callback) { - var args = new Object(); - var i; - for (i=3;i<arguments.length;i++) { - args[i-3] = arguments[i]; - } - args.length = i-3; - vserver_call_url(url, func, callback, args); -} - - -/* - call printf on the server -*/ -function srv_printf() { - vserver_call_url('/scripting/general_calls.esp', 'srv_printf', null, arguments); -} - -/* - usage: - - server_call(func, callback, ...); - - 'func' is a function name to call on the server - any additional arguments are passed to func() on the server - - The callback() function is called with the returned - object. 'callback' may be null. -*/ -function server_call(func, callback) { - var args = new Array(arguments.length-2); - var i; - for (i=0;i<args.length;i++) { - args[i] = arguments[i+1]; - } - vserver_call_url("@request.REQUEST_URI", func, callback, args); -} |