svn commit: samba r7132 - in branches/SAMBA_4_0/swat: . docs
esptest scripting
tridge at samba.org
tridge at samba.org
Tue May 31 02:57:21 GMT 2005
Author: tridge
Date: 2005-05-31 02:57:21 +0000 (Tue, 31 May 2005)
New Revision: 7132
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7132
Log:
- start a convention of making object constructors end in Obj, so we
now have FormObj(). This follows the style in the ejs manual
- make a new MenuObj object type, with a display_menu() to display
it. This will make it easier to make different types of
menus. Currently only veritical simple menus are supported.
Modified:
branches/SAMBA_4_0/swat/docs/menu.js
branches/SAMBA_4_0/swat/esptest/exception.esp
branches/SAMBA_4_0/swat/esptest/formtest.esp
branches/SAMBA_4_0/swat/esptest/loadparm.esp
branches/SAMBA_4_0/swat/esptest/session.esp
branches/SAMBA_4_0/swat/login.esp
branches/SAMBA_4_0/swat/scripting/common.js
Changeset:
Modified: branches/SAMBA_4_0/swat/docs/menu.js
===================================================================
--- branches/SAMBA_4_0/swat/docs/menu.js 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/docs/menu.js 2005-05-31 02:57:21 UTC (rev 7132)
@@ -1,9 +1,22 @@
/* show a menu for the docs directory */
-simple_menu(
- "Samba Information",
- "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",
- "HTML 4.01 Spec", "http://www.w3.org/TR/html401/");
+var m = MenuObj("Samba Information", 8);
+
+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 = "HTML 4.01 Spec";
+m.element[5].link = "http://www.w3.org/TR/html401/";
+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 = "CSS2 Reference";
+m.element[7].link = "http://www.w3schools.com/css/css_reference.asp";
+
+display_menu(m);
+
Modified: branches/SAMBA_4_0/swat/esptest/exception.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/exception.esp 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/esptest/exception.esp 2005-05-31 02:57:21 UTC (rev 7132)
@@ -4,7 +4,7 @@
<%
-var f = Form("ExceptionTest", 0, 2);
+var f = FormObj("ExceptionTest", 0, 2);
f.submit[0] = "Generate Exception";
f.submit[1] = "No Exception";
Modified: branches/SAMBA_4_0/swat/esptest/formtest.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/formtest.esp 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/esptest/formtest.esp 2005-05-31 02:57:21 UTC (rev 7132)
@@ -1,7 +1,7 @@
<% page_header("columns", "ESP Form Test"); %>
<%
-var f = Form("FormTest", 3, 2);
+var f = FormObj("FormTest", 3, 2);
f.element[0].label = "First Name";
f.element[0].name = "firstName";
f.element[0].value = form['firstName'];
Modified: branches/SAMBA_4_0/swat/esptest/loadparm.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/loadparm.esp 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/esptest/loadparm.esp 2005-05-31 02:57:21 UTC (rev 7132)
@@ -3,7 +3,7 @@
<h1>Samba4 loadparm test</h1>
<%
-var f = Form("LoadparmTest", 2, 1);
+var f = FormObj("LoadparmTest", 2, 1);
f.element[0].label = "Share";
f.element[1].label = "Parameter";
f.submit[0] = "OK";
Modified: branches/SAMBA_4_0/swat/esptest/session.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/session.esp 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/esptest/session.esp 2005-05-31 02:57:21 UTC (rev 7132)
@@ -3,7 +3,7 @@
<h1>Samba4 session test</h1>
<%
-var f = Form("SessionTest", 3, 4);
+var f = FormObj("SessionTest", 3, 4);
f.element[0].label = "Name";
f.element[1].label = "Value";
f.element[2].label = "Timeout";
Modified: branches/SAMBA_4_0/swat/login.esp
===================================================================
--- branches/SAMBA_4_0/swat/login.esp 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/login.esp 2005-05-31 02:57:21 UTC (rev 7132)
@@ -6,7 +6,7 @@
write("<b>Your session has expired - please authenticate again<br>\n");
}
-var f = Form("login", 2, 1);
+var f = FormObj("login", 2, 1);
f.element[0].label = "Username";
f.element[0].value = form['Username'];
f.element[1].label = "Password";
Modified: branches/SAMBA_4_0/swat/scripting/common.js
===================================================================
--- branches/SAMBA_4_0/swat/scripting/common.js 2005-05-31 02:24:50 UTC (rev 7131)
+++ branches/SAMBA_4_0/swat/scripting/common.js 2005-05-31 02:57:21 UTC (rev 7132)
@@ -69,18 +69,46 @@
}
/*
- display a simple menu. First argument is menu title, followed by
- pairs of menu item name and link
+ 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() {
- write("<i>" + arguments[0] + "</i><br /><ul>\n");
- for (i = 1; i < arguments.length; i = i + 2) {
- write("<li><a href=\"" + arguments[i+1] + "\">" + arguments[i] + "</a></li>\n");
+ var m = MenuObj(arguments[0], (arguments.length-1)/2);
+ for (i=0;i<m.element.length;i++) {
+ m.element[i].label = arguments[1+(i*2)];
+ m.element[i].link = arguments[2+(i*2)];
}
- write("</ul>\n");
+ display_menu(m);
}
-
/*
display a table element
*/
@@ -133,7 +161,7 @@
/*
create a Form object with the defaults filled in, ready for display_form()
*/
-function Form(name, num_elements, num_submits)
+function FormObj(name, num_elements, num_submits)
{
var f = new Object();
f.name = name;
More information about the samba-cvs
mailing list