summaryrefslogtreecommitdiff
path: root/webapps/scripting/client/encoder.js
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-09-10 03:44:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:50 -0500
commit15c1801a5c13479f1bf67e0e3c1ad7c0af8e3af7 (patch)
treec5bcb824e04cb1de4cccb07a148c113ff1831298 /webapps/scripting/client/encoder.js
parent37de963f67a1331b6402f901d2bda79b7119a155 (diff)
downloadsamba-15c1801a5c13479f1bf67e0e3c1ad7c0af8e3af7.tar.gz
samba-15c1801a5c13479f1bf67e0e3c1ad7c0af8e3af7.tar.bz2
samba-15c1801a5c13479f1bf67e0e3c1ad7c0af8e3af7.zip
r25051: Move SWAT back to the old-style form-submit modal.
The Web 2.0, async client tools were really interesting, but without developer backing they remain impossible to support into a release. The most interesting app was the LDB browser, and I intend to replace this with phpLdapAdmin, preconfigured for Apache during provision. This also removes the need to 'compile' SWAT on SVN checkouts. Andrew Bartlett (This used to be commit cda965e908055d45b1c05bc29cc791f7238d2fae)
Diffstat (limited to 'webapps/scripting/client/encoder.js')
-rw-r--r--webapps/scripting/client/encoder.js84
1 files changed, 0 insertions, 84 deletions
diff --git a/webapps/scripting/client/encoder.js b/webapps/scripting/client/encoder.js
deleted file mode 100644
index 4aa4cc0954..0000000000
--- a/webapps/scripting/client/encoder.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- client side js functions for encoding/decoding objects into linear strings
-
- Copyright Andrew Tridgell 2005
- released under the GNU GPL Version 2 or later
-*/
-/*
- usage:
-
- enc = encodeObject(obj);
- obj = decodeObject(enc);
-
- The encoded format of the object is a string that is safe to
- use in URLs
-
- Note that only data elements are encoded, not functions
-*/
-
-function count_members(o) {
- var i, count = 0;
- for (i in o) {
- count++;
- }
- return count;
-}
-
-function encodeObject(o) {
- var i, r = count_members(o) + ":";
- for (i in o) {
- var t = typeof(o[i]);
- if (t == 'object') {
- r = r + "" + i + ":" + t + ":" + encodeObject(o[i]);
- } else if (t == 'string') {
- var s = encodeURIComponent(o[i]).replace(/%/g,'#');
- r = r + "" + i + ":" + t + ":" + s + ":";
- } else if (t == 'boolean' || t == 'number') {
- r = r + "" + i + ":" + t + ":" + o[i] + ":";
- } else if (t == 'undefined' || t == 'null') {
- r = r + "" + i + ":" + t + ":";
- } else if (t != 'function') {
- alert("Unable to encode type " + t);
- }
- }
- return r;
-}
-
-function decodeObjectArray(a) {
- var o = new Object();
- var i, count = a[a.i]; a.i++;
- for (i=0;i<count;i++) {
- var name = a[a.i]; a.i++;
- var type = a[a.i]; a.i++;
- var value;
- if (type == 'object') {
- o[name] = decodeObjectArray(a);
- } else if (type == "string") {
- value = decodeURIComponent(a[a.i].replace(/#/g,'%')); a.i++;
- o[name] = value;
- } else if (type == "boolean") {
- value = a[a.i]; a.i++;
- if (value == 'true') {
- o[name] = true;
- } else {
- o[name] = false;
- }
- } else if (type == "undefined") {
- o[name] = undefined;
- } else if (type == "null") {
- o[name] = null;
- } else if (type == "number") {
- value = a[a.i]; a.i++;
- o[name] = value * 1;
- } else {
- alert("Unable to delinearise type " + type);
- }
- }
- return o;
-}
-
-function decodeObject(str) {
- var a = str.split(':');
- a.i = 0;
- return decodeObjectArray(a);
-}