mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r8722: make the menu handling considerably saner and easier to follow. The whole
menu hierarchy is now in /menu.js
(This used to be commit c2a450bb99
)
This commit is contained in:
parent
64f31e424b
commit
fdb322876d
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "CLDAP Server", "");
|
||||
<% page_header("columns", "CLDAP Server", "servers");
|
||||
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
|
@ -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);
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "ESP Exception test", "/esptest/menu.js");
|
||||
<% page_header("columns", "ESP Exception test", "esptest");
|
||||
include("/scripting/forms.js");
|
||||
%>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "ESP Form Test", "/esptest/menu.js");
|
||||
<% page_header("columns", "ESP Form Test", "esptest");
|
||||
include("/scripting/forms.js");
|
||||
%>
|
||||
|
||||
|
@ -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"); %>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "ESP Tests", "/esptest/menu.js"); %>
|
||||
<% page_header("columns", "ESP Tests", "esptest"); %>
|
||||
|
||||
<h1>ESP Test functions</h1>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "ESP loadparm test", "/esptest/menu.js" );
|
||||
<% page_header("columns", "ESP loadparm test", "esptest" );
|
||||
include("/scripting/forms.js");
|
||||
%>
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -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");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "ESP session test", "/esptest/menu.js");
|
||||
<% page_header("columns", "ESP session test", "esptest");
|
||||
include("/scripting/forms.js");
|
||||
%>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "Server Status", "");
|
||||
<% page_header("columns", "Server Status", "main");
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
libinclude("provision.js");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "Server Installation", "/install/menu.js");
|
||||
<% page_header("columns", "Server Installation", "install");
|
||||
%>
|
||||
|
||||
<h1>Installation</h1>
|
||||
|
@ -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"));
|
@ -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");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "Provisioning", "/install/menu.js");
|
||||
<% page_header("columns", "Provisioning", "install");
|
||||
|
||||
include("/scripting/forms.js");
|
||||
libinclude("base.js");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "Kerberos Server", "");
|
||||
<% page_header("columns", "Kerberos Server", "servers");
|
||||
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "LDAP Server", "");
|
||||
<% page_header("columns", "LDAP Server", "servers");
|
||||
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
|
59
swat/menu.js
59
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");
|
||||
|
||||
|
||||
|
@ -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");
|
||||
|
@ -1,4 +0,0 @@
|
||||
/* show a menu for the esp test pages */
|
||||
simple_menu(
|
||||
"NBT Server",
|
||||
"Statistics", session_uri("/nbt_server/index.esp"));
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "RPC Server", "");
|
||||
<% page_header("columns", "RPC Server", "servers");
|
||||
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
|
@ -88,48 +88,6 @@ function always_allowed(uri) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
@ -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>
|
||||
|
||||
|
53
swat/scripting/menus.js
Normal file
53
swat/scripting/menus.js
Normal file
@ -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;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "SMB Server", "");
|
||||
<% page_header("columns", "SMB Server", "servers");
|
||||
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<% page_header("columns", "WINS Server", "");
|
||||
<% page_header("columns", "WINS Server", "servers");
|
||||
|
||||
libinclude("base.js");
|
||||
libinclude("management.js");
|
||||
|
Loading…
Reference in New Issue
Block a user