diff options
author | Derrell Lipman <derrell@samba.org> | 2007-01-03 19:57:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:36:06 -0500 |
commit | 2e7c59c24470766e37309c7a8bfa4c7b81c57614 (patch) | |
tree | c44c89911868c52f25ca66bdefa68e13248db8e6 /webapps/scripting/common.js | |
parent | 57f5bf78fa9fc9d190c3cb25251e686a1488f790 (diff) | |
download | samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.tar.gz samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.tar.bz2 samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.zip |
r20515: Continued work on the Web Application Framework. Until we get all of the
functionality of the old scripts incorporated into the new framework, the old
scripts need to still be available. I've reverted to having the old scripts
be the default pages, and added an option to access the preview of the new
SWAT.
(This used to be commit b43620d4b8eff815f4a6dc02522a8dfc9fdcaef4)
Diffstat (limited to 'webapps/scripting/common.js')
-rw-r--r-- | webapps/scripting/common.js | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/webapps/scripting/common.js b/webapps/scripting/common.js deleted file mode 100644 index 523e6fed2f..0000000000 --- a/webapps/scripting/common.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - js functions and code common to static pages -*/ - -/* define some global variables for this request */ -global.page = new Object(); - -/* fill in some defaults */ -global.page.title = "Samba Web Administration Tool"; - -libinclude("base.js"); - -/* to cope with browsers that don't support cookies we append the sessionid - to the URI */ -global.SESSIONURI = ""; -if (request['COOKIE_SUPPORT'] != "True") { - global.SESSIONURI="?SwatSessionId=" + request['SESSION_ID']; -} - -/* - possibly adjust a local URI to have the session id appended - used for browsers that don't support cookies -*/ -function session_uri(uri) { - return uri + global.SESSIONURI; -} - -/* - like printf, but to the web page -*/ -function writef() -{ - write(vsprintf(arguments)); -} - -/* - like writef with a <br> -*/ -function writefln() -{ - write(vsprintf(arguments)); - write("<br/>\n"); -} - - -/* if the browser was too dumb to set the HOST header, then - set it now */ -if (headers['HOST'] == undefined) { - headers['HOST'] = server['SERVER_HOST'] + ":" + server['SERVER_PORT']; -} - -/* - show the page header. page types include "plain" and "column" -*/ -function page_header(pagetype, title, menu) { - global.page.pagetype = pagetype; - global.page.title = title; - global.page.menu = menu; - include("/scripting/header_" + pagetype + ".esp"); -} - -/* - show the page footer, getting the page type from page.pagetype - set in page_header() -*/ -function page_footer() { - include("/scripting/footer_" + global.page.pagetype + ".esp"); -} - - -/* - display a table element -*/ -function table_element(i, o) { - write("<tr><td>" + i + "</td><td>"); - if (typeof(o[i]) == "object") { - var j, first; - first = true; - for (j in o[i]) { - if (first == false) { - write("<br />"); - } - write(o[i][j]); - first = false; - } - } else { - write(o[i]); - } - write("</td></tr>\n"); -} - -/* - display a ejs object as a table. The header is optional -*/ -function simple_table(v) { - if (v.length == 0) { - return; - } - write("<table class=\"data\">\n"); - var r; - for (r in v) { - table_element(r, v); - } - write("</table>\n"); -} - -/* - display an array of objects, with the header for each element from the given - attribute -*/ -function multi_table(array, header) { - var i, n; - write("<table class=\"data\">\n"); - for (i=0;i<array.length;i++) { - var r, v = array[i]; - write('<tr><th colspan="2">' + v[header] + "</th></tr>\n"); - for (r in v) { - if (r != header) { - table_element(r, v); - } - } - } - write("</table>\n"); -} - |