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 | |
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')
-rw-r--r-- | webapps/scripting/common.js | 125 | ||||
-rw-r--r-- | webapps/scripting/footer_columns.esp | 7 | ||||
-rw-r--r-- | webapps/scripting/footer_desktop.esp | 6 | ||||
-rw-r--r-- | webapps/scripting/footer_plain.esp | 7 | ||||
-rw-r--r-- | webapps/scripting/forms.js | 112 | ||||
-rw-r--r-- | webapps/scripting/header_columns.esp | 81 | ||||
-rw-r--r-- | webapps/scripting/header_desktop.esp | 20 | ||||
-rw-r--r-- | webapps/scripting/header_plain.esp | 25 | ||||
-rw-r--r-- | webapps/scripting/preauth.esp | 49 |
9 files changed, 0 insertions, 432 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"); -} - diff --git a/webapps/scripting/footer_columns.esp b/webapps/scripting/footer_columns.esp deleted file mode 100644 index 7b5baaf0c8..0000000000 --- a/webapps/scripting/footer_columns.esp +++ /dev/null @@ -1,7 +0,0 @@ -<% - /* footer for columns page type */ -%> -</div> -</div> -</body> -</html> diff --git a/webapps/scripting/footer_desktop.esp b/webapps/scripting/footer_desktop.esp deleted file mode 100644 index 5e563dab88..0000000000 --- a/webapps/scripting/footer_desktop.esp +++ /dev/null @@ -1,6 +0,0 @@ -<% - /* footer for desktop page type */ -%> - -</body> -</html> diff --git a/webapps/scripting/footer_plain.esp b/webapps/scripting/footer_plain.esp deleted file mode 100644 index 31ef8dd4ee..0000000000 --- a/webapps/scripting/footer_plain.esp +++ /dev/null @@ -1,7 +0,0 @@ -<% - /* footer for plain page type */ -%> -</div> -</div> -</body> -</html> diff --git a/webapps/scripting/forms.js b/webapps/scripting/forms.js deleted file mode 100644 index 2de9e34462..0000000000 --- a/webapps/scripting/forms.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - js functions for forms -*/ - - -/* - display a simple form from a ejs Form object - caller should fill in - f.name = form name - f.action = action to be taken on submit (optional, defaults to current page) - f.class = css class (optional, defaults to 'form') - f.submit = an array of submit labels - f.add(name, label, [type], [value]) = - Add another element - f.element[i].label = element label - f.element[i].name = element name (defaults to label) - f.element[i].type = element type (defaults to text) - f.element[i].value = current value (optional, defaults to "") - */ -function form_display() { - var f = this; - var i, size = 20; - write('<form name="' + f.name + - '" method="post" action="' + f.action + - '" class="' + f.class + '">\n'); - if (f.element.length > 0) { - write("<table>\n"); - } - for (i in f.element) { - var e = f.element[i]; - if (e.name == undefined) { - e.name = e.label; - } - if (e.value == undefined) { - e.value = ""; - } - if (strlen(e.value) > size) { - size = strlen(e.value) + 4; - } - } - for (i in f.element) { - var e = f.element[i]; - write("<tr>"); - write("<td>" + e.label + "</td>"); - if (e.type == "select") { - write('<td><select name="' + e.name + '">\n'); - for (s in e.list) { - if (e.value == e.list[s]) { - write('<option selected=selected>' + e.list[s] + '</option>\n'); - } else { - write('<option>' + e.list[s] + '</option>\n'); - } - } - write('</select></td>\n'); - } else { - var sizestr = ""; - if (e.type == "text" || e.type == "password") { - sizestr = sprintf('size="%d"', size); - } - writef('<td><input name="%s" type="%s" value="%s" %s /></td>\n', - e.name, e.type, e.value, sizestr); - } - write("</tr>"); - } - if (f.element.length > 0) { - write("</table>\n"); - } - for (i in f.submit) { - write('<input name="submit" type="submit" value="' + f.submit[i] + '" />\n'); - } - write("</form>\n"); -} - -function __addMethod(name, label) -{ - var f = this; - var i = f.element.length; - f.element[i] = new Object(); - f.element[i].name = name; - f.element[i].label = label; - f.element[i].type = "text"; - f.element[i].value = ""; - if (arguments.length > 2) { - f.element[i].type = arguments[2]; - } - if (arguments.length > 3) { - f.element[i].value = arguments[3]; - } -} - -/* - create a Form object with the defaults filled in, ready for display() - */ -function FormObj(name, num_elements, num_submits) -{ - var f = new Object(); - f.name = name; - f.element = new Array(num_elements); - f.submit = new Array(num_submits); - f.action = session_uri(request.REQUEST_URI); - f.class = "defaultform"; - f.add = __addMethod; - for (i in f.element) { - f.element[i] = new Object(); - f.element[i].type = "text"; - f.element[i].value = ""; - } - f.display = form_display; - - return f; -} - diff --git a/webapps/scripting/header_columns.esp b/webapps/scripting/header_columns.esp deleted file mode 100644 index a8ffed984e..0000000000 --- a/webapps/scripting/header_columns.esp +++ /dev/null @@ -1,81 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - - <title>@@global.page.title</title> - -<link rel="stylesheet" href="/style/common.css" type="text/css" media="all" /> -<link rel="stylesheet" href="/style/columns.css" type="text/css" media="all" /> -<link rel="stylesheet" href="/style/swat.css" type="text/css" media="all" /> - -<!--[if gte IE 5.5]> - <style type="text/css"> - /*<![CDATA[*/ - .logo_hack { -filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/logo.png',sizingMethod='scale'); - } - /*]]>*/ - </style> -<![endif]--> - -<!--[if lte IE 5]> - <style type="text/css"> - /*<![CDATA[*/ - .logo_hack { - background-image:url(/images/logo.gif); - background-position:center; - background-repeat:no-repeat; - top:23.5px; - left:-10px; - } - /*]]>*/ - </style> -<![endif]--> - -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta http-equiv="Content-Language" content="en-us" /> - -</head> - - -<body> - -<div id="banner"> - <div class="stripe"></div> - <div class="logout"> - <b>logged in as @@session.authinfo.username</b> - <form method="post" action="/logout.esp@@global.SESSIONURI"> - <input type="submit" value="Logout" /> - </form> - </div> -</div> - -<div id="logo"> - <div class="logo_hack"><a href="/@@global.SESSIONURI"><img src="/images/linkpad.gif" alt="SWAT" /></a></div> -</div> - -<div class="slogan"> - <h4>Samba Web Administration Tool</h4> -</div> - -<div id="nav"> - <% - include("/menu.js"); - if (form['menu']) { - global.page.menu = form['menu']; - } - swat_menus[global.page.menu].display(); - if (global.page.menu != "main") { - write('<a href="/">Main Menu</a>'); - } - %> -</div> - -<div id="links"> - <% swat_menus.docs.display(); %> -</div> - - -<div id="content"> - <div id="middle" class="center"> diff --git a/webapps/scripting/header_desktop.esp b/webapps/scripting/header_desktop.esp deleted file mode 100644 index cf8268f535..0000000000 --- a/webapps/scripting/header_desktop.esp +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - -<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta http-equiv="Content-Language" content="en-us" /> - - <title>@@global.page.title</title> - -<style type="text/css" media="screen"> -body { - background-color:#3A6EA5; -} -</style> - -</head> - -<body> - diff --git a/webapps/scripting/header_plain.esp b/webapps/scripting/header_plain.esp deleted file mode 100644 index ae11b6fc50..0000000000 --- a/webapps/scripting/header_plain.esp +++ /dev/null @@ -1,25 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - - <title>@@global.page.title</title> - -<link rel="stylesheet" href="/style/common.css" type="text/css" media="all" /> -<link rel="stylesheet" href="/style/columns.css" type="text/css" media="all" /> -<link rel="stylesheet" href="/style/swat.css" type="text/css" media="all" /> -</head> - - -<body> - -<div id="banner"> - <div class="stripe"></div> -</div> - -<div class="slogan"> - <h4>Samba Web Administration Tool</h4> -</div> - -<div id="content"> - <div class="center"> diff --git a/webapps/scripting/preauth.esp b/webapps/scripting/preauth.esp deleted file mode 100644 index 84534cacef..0000000000 --- a/webapps/scripting/preauth.esp +++ /dev/null @@ -1,49 +0,0 @@ -<% -include("/scripting/common.js"); - -/* - check if a uri is one of the 'always allowed' pages, even when not logged in - This allows the login page to use the same style sheets and images -*/ -function always_allowed(uri) { - var str = string_init(); - - /* allow the primary web application to do its own authentication */ - var s = str.split('/', uri); - if (s[0] == "" && (s.length == 1 || /* no path provided */ - s[1] == 'index.html' || - s[1] == "script" || - s[1] == "resource")) { - return true; - } - - var s = str.split('.', uri); - if (s.length < 2) { - return false; - } - - var ext = s[s.length-1]; - var allowed = new Array("ico", "gif", "png","css", "js"); - for (i in allowed) { - if (allowed[i] == ext) { - return true; - } - } - return false; -} - - -/* this script is called on every web request. If it produces any - output at all then that output is returned and the requested page - is not given or processed. -*/ -if (server['SERVER_PROTOCOL'] == "http" && - server['TLS_SUPPORT'] == "True") { - write("redirect to https"); - redirect("https://" + headers['HOST'] + request['REQUEST_URI']); -} else if (always_allowed(request['REQUEST_URI']) != true && - session['AUTHENTICATED'] == undefined) { - /* present the login page */ - include("/login.esp"); -} -%> |