summaryrefslogtreecommitdiff
path: root/swat
diff options
context:
space:
mode:
Diffstat (limited to 'swat')
-rw-r--r--swat/cldap_server/index.esp2
-rw-r--r--swat/docs/menu.js24
-rw-r--r--swat/esptest/exception.esp2
-rw-r--r--swat/esptest/formtest.esp2
-rw-r--r--swat/esptest/include.esp2
-rw-r--r--swat/esptest/index.esp2
-rw-r--r--swat/esptest/ldb.esp2
-rw-r--r--swat/esptest/loadparm.esp2
-rw-r--r--swat/esptest/menu.js12
-rw-r--r--swat/esptest/samr.esp2
-rw-r--r--swat/esptest/session.esp2
-rw-r--r--swat/esptest/showvars.esp2
-rw-r--r--swat/index.esp2
-rw-r--r--swat/install/index.esp2
-rw-r--r--swat/install/menu.js5
-rw-r--r--swat/install/newuser.esp2
-rw-r--r--swat/install/provision.esp2
-rw-r--r--swat/kdc_server/index.esp2
-rw-r--r--swat/ldap_server/index.esp2
-rw-r--r--swat/menu.js59
-rw-r--r--swat/nbt_server/index.esp2
-rw-r--r--swat/nbt_server/menu.js4
-rw-r--r--swat/rpc_server/index.esp2
-rw-r--r--swat/scripting/common.js42
-rw-r--r--swat/scripting/header_columns.esp18
-rw-r--r--swat/scripting/menus.js53
-rw-r--r--swat/smb_server/index.esp2
-rw-r--r--swat/wins_server/index.esp2
28 files changed, 135 insertions, 122 deletions
diff --git a/swat/cldap_server/index.esp b/swat/cldap_server/index.esp
index 253effd55a..1ede088705 100644
--- a/swat/cldap_server/index.esp
+++ b/swat/cldap_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "CLDAP Server", "");
+<% page_header("columns", "CLDAP Server", "servers");
libinclude("base.js");
libinclude("management.js");
diff --git a/swat/docs/menu.js b/swat/docs/menu.js
deleted file mode 100644
index 82ab02aeb8..0000000000
--- a/swat/docs/menu.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* show a menu for the docs directory */
-var m = MenuObj("Samba Information", 9);
-
-m.element[0].label = "Samba4 development";
-m.element[0].link = "http://devel.samba.org/";
-m.element[1].label = "Recent Checkins";
-m.element[1].link = "http://build.samba.org/?tree=samba4;function=Recent+Checkins";
-m.element[2].label = "Recent Builds";
-m.element[2].link = "http://build.samba.org/?tree=samba4;function=Recent+Builds";
-m.element[3].label = "EJS Information";
-m.element[3].link = "http://www.appwebserver.org/products/ejs/ejs.html";
-m.element[4].label = "ESP Information";
-m.element[4].link = "http://www.appwebserver.org/products/esp/esp.html";
-m.element[5].label = "XHTML Spec";
-m.element[5].link = "http://www.w3.org/TR/xhtml1/";
-m.element[6].label = "JavaScript Spec";
-m.element[6].link = "http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf";
-m.element[7].label = "CSS Specs";
-m.element[7].link = "http://www.w3.org/Style/CSS/#specs";
-m.element[8].label = "CSS1/2 Reference";
-m.element[8].link = "http://www.w3schools.com/css/css_reference.asp";
-
-display_menu(m);
-
diff --git a/swat/esptest/exception.esp b/swat/esptest/exception.esp
index f32aaeb610..ff28d6318e 100644
--- a/swat/esptest/exception.esp
+++ b/swat/esptest/exception.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP Exception test", "/esptest/menu.js");
+<% page_header("columns", "ESP Exception test", "esptest");
include("/scripting/forms.js");
%>
diff --git a/swat/esptest/formtest.esp b/swat/esptest/formtest.esp
index 32ad4a04b2..2310849895 100644
--- a/swat/esptest/formtest.esp
+++ b/swat/esptest/formtest.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP Form Test", "/esptest/menu.js");
+<% page_header("columns", "ESP Form Test", "esptest");
include("/scripting/forms.js");
%>
diff --git a/swat/esptest/include.esp b/swat/esptest/include.esp
index fc53a9b1f4..5d558d59dc 100644
--- a/swat/esptest/include.esp
+++ b/swat/esptest/include.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP Include Test", "/esptest/menu.js"); %>
+<% page_header("columns", "ESP Include Test", "esptest"); %>
including /scripting/test.ejs<p/>
<% include("/scripting/test.ejs"); %>
diff --git a/swat/esptest/index.esp b/swat/esptest/index.esp
index fbbed9b3c4..663f82c599 100644
--- a/swat/esptest/index.esp
+++ b/swat/esptest/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP Tests", "/esptest/menu.js"); %>
+<% page_header("columns", "ESP Tests", "esptest"); %>
<h1>ESP Test functions</h1>
diff --git a/swat/esptest/ldb.esp b/swat/esptest/ldb.esp
index 1b1e7cd669..93bc9e0d81 100644
--- a/swat/esptest/ldb.esp
+++ b/swat/esptest/ldb.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP ldb test", "/esptest/menu.js"); %>
+<% page_header("columns", "ESP ldb test", "esptest"); %>
<h1>Samba4 ldb test</h1>
diff --git a/swat/esptest/loadparm.esp b/swat/esptest/loadparm.esp
index 2783c8e647..9581af0262 100644
--- a/swat/esptest/loadparm.esp
+++ b/swat/esptest/loadparm.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP loadparm test", "/esptest/menu.js" );
+<% page_header("columns", "ESP loadparm test", "esptest" );
include("/scripting/forms.js");
%>
diff --git a/swat/esptest/menu.js b/swat/esptest/menu.js
deleted file mode 100644
index d46561f311..0000000000
--- a/swat/esptest/menu.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* show a menu for the esp test pages */
-simple_menu(
- "ESP Tests",
- "ldb database", session_uri("/esptest/ldb.esp"),
- "samr calls", session_uri("/esptest/samr.esp"),
- "html forms", session_uri("/esptest/formtest.esp"),
- "esp includes", session_uri("/esptest/include.esp"),
- "session variables", session_uri("/esptest/session.esp"),
- "loadparm access", session_uri("/esptest/loadparm.esp"),
- "exception handling", session_uri("/esptest/exception.esp"),
- "environment variables", session_uri("/esptest/showvars.esp"));
-
diff --git a/swat/esptest/samr.esp b/swat/esptest/samr.esp
index 53e20a23ab..65902e0ce4 100644
--- a/swat/esptest/samr.esp
+++ b/swat/esptest/samr.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP samr test", "/esptest/menu.js");
+<% page_header("columns", "ESP samr test", "esptest");
libinclude("base.js");
libinclude("samr.js");
diff --git a/swat/esptest/session.esp b/swat/esptest/session.esp
index 6637c782c0..6213dde62f 100644
--- a/swat/esptest/session.esp
+++ b/swat/esptest/session.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP session test", "/esptest/menu.js");
+<% page_header("columns", "ESP session test", "esptest");
include("/scripting/forms.js");
%>
diff --git a/swat/esptest/showvars.esp b/swat/esptest/showvars.esp
index 6763f2b6dd..dc55b1e58b 100644
--- a/swat/esptest/showvars.esp
+++ b/swat/esptest/showvars.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "ESP standard variables test", "/esptest/menu.js"); %>
+<% page_header("columns", "ESP standard variables test", "esptest"); %>
<h1>Samba4 showvars test</h1>
diff --git a/swat/index.esp b/swat/index.esp
index 2e43d3f9cf..566c7f8fae 100644
--- a/swat/index.esp
+++ b/swat/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "Server Status", "");
+<% page_header("columns", "Server Status", "main");
libinclude("base.js");
libinclude("management.js");
libinclude("provision.js");
diff --git a/swat/install/index.esp b/swat/install/index.esp
index ee16bec34a..6e35a98fd4 100644
--- a/swat/install/index.esp
+++ b/swat/install/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "Server Installation", "/install/menu.js");
+<% page_header("columns", "Server Installation", "install");
%>
<h1>Installation</h1>
diff --git a/swat/install/menu.js b/swat/install/menu.js
deleted file mode 100644
index e8f99f7cac..0000000000
--- a/swat/install/menu.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/* show a menu for the esp test pages */
-simple_menu(
- "Installation",
- "Provisioning", session_uri("/install/provision.esp"),
- "New User", session_uri("/install/newuser.esp"));
diff --git a/swat/install/newuser.esp b/swat/install/newuser.esp
index afcd9e4d55..9baba7c6f4 100644
--- a/swat/install/newuser.esp
+++ b/swat/install/newuser.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "Add a user", "/install/menu.js");
+<% page_header("columns", "Add a user", "install");
include("/scripting/forms.js");
libinclude("base.js");
diff --git a/swat/install/provision.esp b/swat/install/provision.esp
index 12e378475a..d941fa0e61 100644
--- a/swat/install/provision.esp
+++ b/swat/install/provision.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "Provisioning", "/install/menu.js");
+<% page_header("columns", "Provisioning", "install");
include("/scripting/forms.js");
libinclude("base.js");
diff --git a/swat/kdc_server/index.esp b/swat/kdc_server/index.esp
index ed70f7ff46..69a8b0736b 100644
--- a/swat/kdc_server/index.esp
+++ b/swat/kdc_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "Kerberos Server", "");
+<% page_header("columns", "Kerberos Server", "servers");
libinclude("base.js");
libinclude("management.js");
diff --git a/swat/ldap_server/index.esp b/swat/ldap_server/index.esp
index 57f259c3b6..c4ed146b18 100644
--- a/swat/ldap_server/index.esp
+++ b/swat/ldap_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "LDAP Server", "");
+<% page_header("columns", "LDAP Server", "servers");
libinclude("base.js");
libinclude("management.js");
diff --git a/swat/menu.js b/swat/menu.js
index 3f926dc7a2..17a2952e04 100644
--- a/swat/menu.js
+++ b/swat/menu.js
@@ -1,12 +1,59 @@
-/* show a menu for the esp test pages */
-simple_menu(
+/*
+ the menu hierarchy for SWAT
+*/
+
+include("/scripting/menus.js");
+
+swat_menus = new Object();
+
+swat_menus.main = simple_menu(
"Main Menu",
- "File Server", session_uri("/smb_server/"),
+ "Servers", session_uri("/?menu=servers"),
+ "Installation", session_uri("/install/"),
+ "ESP Tests", session_uri("/esptest/"));
+
+swat_menus.servers = simple_menu(
+ "Servers",
"LDAP Server", session_uri("/ldap_server/"),
"CLDAP Server", session_uri("/cldap_server/"),
"RPC Server", session_uri("/rpc_server/"),
"NBT Server", session_uri("/nbt_server/"),
"WINS Server", session_uri("/wins_server/"),
- "Kerberos Server", session_uri("/kdc_server/"),
- "Installation", session_uri("/install/"),
- "ESP Tests", session_uri("/esptest/"));
+ "Kerberos Server", session_uri("/kdc_server/"));
+
+swat_menus.esptests = simple_menu(
+ "ESP Tests",
+ "ldb database", session_uri("/esptest/ldb.esp"),
+ "samr calls", session_uri("/esptest/samr.esp"),
+ "html forms", session_uri("/esptest/formtest.esp"),
+ "esp includes", session_uri("/esptest/include.esp"),
+ "session variables", session_uri("/esptest/session.esp"),
+ "loadparm access", session_uri("/esptest/loadparm.esp"),
+ "exception handling", session_uri("/esptest/exception.esp"),
+ "environment variables", session_uri("/esptest/showvars.esp"));
+
+
+swat_menus.install = simple_menu(
+ "Installation",
+ "Provisioning", session_uri("/install/provision.esp"),
+ "New User", session_uri("/install/newuser.esp"));
+
+
+swat_menus.nbt_server = simple_menu(
+ "NBT Server",
+ "Statistics", session_uri("/nbt_server/index.esp"));
+
+
+swat_menus.docs = simple_menu(
+ "Links",
+ "Samba4 development", "http://devel.samba.org/",
+ "Recent Checkins", "http://build.samba.org/?tree=samba4;function=Recent+Checkins",
+ "Recent Builds", "http://build.samba.org/?tree=samba4;function=Recent+Builds",
+ "EJS Information", "http://www.appwebserver.org/products/ejs/ejs.html",
+ "ESP Information", "http://www.appwebserver.org/products/esp/esp.html",
+ "XHTML Spec", "http://www.w3.org/TR/xhtml1/",
+ "JavaScript Spec", "http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf",
+ "CSS Specs", "http://www.w3.org/Style/CSS/#specs",
+ "CSS1/2 Reference", "http://www.w3schools.com/css/css_reference.asp");
+
+
diff --git a/swat/nbt_server/index.esp b/swat/nbt_server/index.esp
index 133615c52c..1928f12d1b 100644
--- a/swat/nbt_server/index.esp
+++ b/swat/nbt_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "NBT Server", "/nbt_server/menu.js");
+<% page_header("columns", "NBT Server", "nbt_server");
libinclude("base.js");
libinclude("management.js");
diff --git a/swat/nbt_server/menu.js b/swat/nbt_server/menu.js
deleted file mode 100644
index fd445bf861..0000000000
--- a/swat/nbt_server/menu.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* show a menu for the esp test pages */
-simple_menu(
- "NBT Server",
- "Statistics", session_uri("/nbt_server/index.esp"));
diff --git a/swat/rpc_server/index.esp b/swat/rpc_server/index.esp
index 5c42907783..46c8c8a7a7 100644
--- a/swat/rpc_server/index.esp
+++ b/swat/rpc_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "RPC Server", "");
+<% page_header("columns", "RPC Server", "servers");
libinclude("base.js");
libinclude("management.js");
diff --git a/swat/scripting/common.js b/swat/scripting/common.js
index 84a1421603..dde40c8e38 100644
--- a/swat/scripting/common.js
+++ b/swat/scripting/common.js
@@ -89,48 +89,6 @@ function always_allowed(uri) {
}
/*
- create a menu object with the defaults filled in, ready for display_menu()
- */
-function MenuObj(name, num_elements)
-{
- var o = new Object();
- o.name = name;
- o.class = "menu";
- o.style = "simple";
- o.orientation = "vertical"
- o.element = new Array(num_elements);
- for (i in o.element) {
- o.element[i] = new Object();
- }
- return o;
-}
-
-/*
- display a menu object. Currently only the "simple", "vertical" menu style
- is supported
-*/
-function display_menu(m) {
- assert(m.style == "simple" && m.orientation == "vertical");
- write('<div class="' + m.class + '">\n');
- write("<i>" + m.name + "</i><br /><ul>\n");
- for (i = 0; i < m.element.length; i++) {
- var e = m.element[i];
- write("<li><a href=\"" + e.link + "\">" + e.label + "</a></li>\n");
- }
- write("</ul></div>\n");
-}
-
-function simple_menu() {
- var i, m = MenuObj(arguments[0], (arguments.length-1)/2);
- for (i=0;i<m.element.length;i++) {
- var ndx = i*2;
- m.element[i].label = arguments[ndx+1];
- m.element[i].link = arguments[ndx+2];
- }
- display_menu(m);
-}
-
-/*
display a table element
*/
function table_element(i, o) {
diff --git a/swat/scripting/header_columns.esp b/swat/scripting/header_columns.esp
index 0320e66283..20238b588e 100644
--- a/swat/scripting/header_columns.esp
+++ b/swat/scripting/header_columns.esp
@@ -62,20 +62,20 @@ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/logo.png'
<div id="nav">
<%
- if (global.page.menu) {
- include(global.page.menu);
- write('<a href="/">Main Menu</a>');
- } else {
- include("/menu.js");
- }
+ 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">
<div class="related">
- <%
- include("/docs/menu.js");
- %>
+ <% swat_menus.docs.display(); %>
</div>
</div>
diff --git a/swat/scripting/menus.js b/swat/scripting/menus.js
new file mode 100644
index 0000000000..ddd97c4ca3
--- /dev/null
+++ b/swat/scripting/menus.js
@@ -0,0 +1,53 @@
+/*
+ menu object for SWAT
+*/
+
+/*
+ display a menu object. Currently only the "simple", "vertical" menu style
+ is supported
+*/
+function menu_display() {
+ var i, m = this;
+ assert(m.style == "simple" && m.orientation == "vertical");
+ write('<div class="' + m.class + '">\n');
+ write("<i>" + m.name + "</i><br /><ul>\n");
+ for (i = 0; i < m.element.length; i++) {
+ var e = m.element[i];
+ write("<li><a href=\"" + e.link + "\">" + e.label + "</a></li>\n");
+ }
+ write("</ul></div>\n");
+}
+
+
+/*
+ create a menu object with the defaults filled in, ready for display_menu()
+ */
+function MenuObj(name, num_elements)
+{
+ var i, o = new Object();
+ o.name = name;
+ o.class = "menu";
+ o.style = "simple";
+ o.orientation = "vertical"
+ o.element = new Array(num_elements);
+ for (i in o.element) {
+ o.element[i] = new Object();
+ }
+ o.display = menu_display;
+ return o;
+}
+
+/*
+ return a menu object created using a title, followed by
+ a set of label/link pairs
+*/
+function simple_menu() {
+ var i, m = MenuObj(arguments[0], (arguments.length-1)/2);
+ for (i=0;i<m.element.length;i++) {
+ var ndx = i*2;
+ m.element[i].label = arguments[ndx+1];
+ m.element[i].link = arguments[ndx+2];
+ }
+ return m;
+}
+
diff --git a/swat/smb_server/index.esp b/swat/smb_server/index.esp
index 8ca34e3dc3..f0f4620492 100644
--- a/swat/smb_server/index.esp
+++ b/swat/smb_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "SMB Server", "");
+<% page_header("columns", "SMB Server", "servers");
libinclude("base.js");
libinclude("management.js");
diff --git a/swat/wins_server/index.esp b/swat/wins_server/index.esp
index d24fa3410d..b91ef6fc24 100644
--- a/swat/wins_server/index.esp
+++ b/swat/wins_server/index.esp
@@ -1,4 +1,4 @@
-<% page_header("columns", "WINS Server", "");
+<% page_header("columns", "WINS Server", "servers");
libinclude("base.js");
libinclude("management.js");