summaryrefslogtreecommitdiff
path: root/swat/esptest
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-30 06:15:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:14 -0500
commitca6b9f370bbd37b58dbec55c7b369d72a4684918 (patch)
tree0717452f97a0cb4a556a5c94b13e02949a52e84d /swat/esptest
parentbb2a811bf4c05013aa5b3dbe437d7caf1fea4974 (diff)
downloadsamba-ca6b9f370bbd37b58dbec55c7b369d72a4684918.tar.gz
samba-ca6b9f370bbd37b58dbec55c7b369d72a4684918.tar.bz2
samba-ca6b9f370bbd37b58dbec55c7b369d72a4684918.zip
r7088: start on some real structure for the SWAT web pages
- this imports the basic css pages from samba.org - i have created some useful ejs scripts in common.js that will be included by all pages - added a real login page, and a logout button showing who you are logged in as - added page_header() and page_footer() functions that take a page type, allowing for "plain" or "columms" pages - added some simple menus on the left of the columns page type, with links to the esp tests and some useful links for samba4 developers (This used to be commit 86d2ecf0f2a8de8abfdcc5f2aae7d4d969d19339)
Diffstat (limited to 'swat/esptest')
-rw-r--r--swat/esptest/auth.esp12
-rw-r--r--swat/esptest/exception.esp13
-rw-r--r--swat/esptest/formtest.esp12
-rw-r--r--swat/esptest/include.esp12
-rw-r--r--swat/esptest/index.esp32
-rw-r--r--swat/esptest/index.html23
-rw-r--r--swat/esptest/ldb.esp31
-rw-r--r--swat/esptest/loadparm.esp12
-rw-r--r--swat/esptest/menu.js11
-rw-r--r--swat/esptest/session.esp12
-rw-r--r--swat/esptest/showvars.esp13
11 files changed, 57 insertions, 126 deletions
diff --git a/swat/esptest/auth.esp b/swat/esptest/auth.esp
index ac85ddc026..35953dc7dc 100644
--- a/swat/esptest/auth.esp
+++ b/swat/esptest/auth.esp
@@ -1,8 +1,5 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP Authentication Test"); %>
+
<h1>Samba4 unixAuth test</h1>
<form name="AuthTest" method="POST" action="@@request['SCRIPT_NAME']">
@@ -22,7 +19,7 @@ Samba4 ESP test
if (request['REQUEST_METHOD'] == "POST") {
/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.esp");
+ redirect("/");
}
username = form['Username'];
@@ -48,5 +45,4 @@ write ("<br>PRIVILEGE = " + session['PRIVILEGE'] + "\n");
%>
-</BODY>
-</HTML>
+<% page_footer(); %>
diff --git a/swat/esptest/exception.esp b/swat/esptest/exception.esp
index d569fbe776..abea890d98 100644
--- a/swat/esptest/exception.esp
+++ b/swat/esptest/exception.esp
@@ -1,8 +1,5 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP Exception test"); %>
+
<h1>Samba4 exception test</h1>
<form name="ExceptionTest" method="POST" action="@@request['SCRIPT_NAME']">
@@ -15,7 +12,7 @@ Samba4 ESP test
if (request['REQUEST_METHOD'] == "POST") {
/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.esp");
+ redirect("/");
}
function TestFunction(arg1, arg2) {
@@ -33,5 +30,5 @@ if (request['REQUEST_METHOD'] == "POST") {
%>
and here is some filler text ...
-</BODY>
-</HTML>
+
+<% page_footer(); %>
diff --git a/swat/esptest/formtest.esp b/swat/esptest/formtest.esp
index 7996900eb2..89e542c552 100644
--- a/swat/esptest/formtest.esp
+++ b/swat/esptest/formtest.esp
@@ -1,9 +1,4 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
-<h1>Samba4 form test</h1>
+<% page_header("columns", "ESP Form Test"); %>
<form name="FormTest" method="POST" action="@@request['SCRIPT_NAME']">
firstName: <input name="firstName" type="text" value=""><br>
@@ -20,7 +15,7 @@ Samba4 ESP test
/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.esp");
+ redirect("/");
}
%>
You chose firstName=@@form['firstName'] lastName=@@form['lastName']
@@ -37,5 +32,4 @@ Samba4 ESP test
}
%>
-</BODY>
-</HTML>
+<% page_footer(); %>
diff --git a/swat/esptest/include.esp b/swat/esptest/include.esp
index 9b67a768da..f7fd5e0b91 100644
--- a/swat/esptest/include.esp
+++ b/swat/esptest/include.esp
@@ -1,8 +1,5 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP Include Test"); %>
+
including /scripting/test.ejs<p>
<% include("/scripting/test.ejs"); %>
calling a function from test.ejs ...<p>
@@ -14,9 +11,8 @@ calling a function from test.esp ...<p>
<% res = testfn('foo'); %>
result is: @@res
-<form name="Cancel" method="POST" action="index.esp">
+<form name="Cancel" method="POST" action="/">
<input name="submit" type="submit" value="Cancel"><br>
</form>
-</BODY>
-</HTML>
+<% page_footer(); %>
diff --git a/swat/esptest/index.esp b/swat/esptest/index.esp
deleted file mode 100644
index 40f6cbc38b..0000000000
--- a/swat/esptest/index.esp
+++ /dev/null
@@ -1,32 +0,0 @@
-<%
- var tests = new Array("formtest", "showvars", "include",
- "session", "loadparm", "exception",
- "ldb", "auth");
-%>
-
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
-<img src="/images/logo.png" alt="Samba">
-<h1>Samba4 ESP test</h1>
-
-Please choose one of the following tests:
-<ul>
-<%
- for (test in tests) {
- url = tests[test] + ".esp";
- write("<li> <a href=" + url + ">" + tests[test] + "</a>");
- }
-%>
-</ul>
-
-For more information on ejs see <a
-href="http://www.appwebserver.org/products/ejs/ejs.html">http://www.appwebserver.org/products/ejs/ejs.html</a><p>
-
-For more information on esp see <a
-href="http://www.appwebserver.org/products/esp/esp.html">http://www.appwebserver.org/products/esp/esp.html</a><p>
-
-</BODY>
-</HTML>
diff --git a/swat/esptest/index.html b/swat/esptest/index.html
deleted file mode 100644
index 0c64b4ffcf..0000000000
--- a/swat/esptest/index.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<%
- var tests = new Array("formtest", "showvars", "include");
-%>
-
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
-<img src="/images/logo.png" alt="Samba">
-<h1>Samba4 ESP test</h1>
-
-Please choose one of the following tests:
-<ul>
-<%
- for (test in tests) {
- url = tests[test] + ".html";
- write("<li> <a href=" + url + ">" + tests[test] + "</a>");
- }
-%>
-</ul>
-</BODY>
-</HTML>
diff --git a/swat/esptest/ldb.esp b/swat/esptest/ldb.esp
index 3285574bf2..1bc75bce73 100644
--- a/swat/esptest/ldb.esp
+++ b/swat/esptest/ldb.esp
@@ -1,19 +1,16 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP ldb test"); %>
+
<h1>Samba4 ldb test</h1>
-<form name="LdbTest" method="POST" action="@@request['SCRIPT_NAME']">
- <input name="submit" type="submit" value="Cancel"><br>
+<form name="LdbTest" method="post" action="@@request['SCRIPT_NAME']">
+ <input name="submit" type="submit" value="Cancel" /><br />
</form>
<%
if (request['REQUEST_METHOD'] == "POST") {
/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.esp");
+ redirect("/");
}
}
@@ -27,10 +24,10 @@ function showLdbRes(res) {
var a = r[j];
if (typeof(a) == "object") {
for (k in a) {
- write(j + "[" + k + "]=" + a[k] + "<br>\n");
+ write(j + "[" + k + "]=" + a[k] + "<br />\n");
}
} else {
- write(j + "=" + r[j] + "<br>\n");
+ write(j + "=" + r[j] + "<br />\n");
}
}
write("<p>");
@@ -43,7 +40,7 @@ Trying a attribute constrained search on samdb:<p>
<%
var dbfile = lpGet("sam database");
-var attrs = new Array("name", "dnsDomain", "objectSid");
+var attrs = new Array("name", "dnsDomain", "objectSid", "dn");
res = ldbSearch(dbfile, "(objectClass=domain)", attrs);
showLdbRes(res);
@@ -54,10 +51,16 @@ and now an unconstrained search:<p>
<%
var dbfile = lpGet("sam database");
-res = ldbSearch(dbfile, "(objectClass=domain)");
+res = ldbSearch(dbfile, "(objectClass=user)");
showLdbRes(res);
%>
+and a bad search<br>
+
+<%
+res = ldbSearch("foo");
+%>
+
+all done
-</BODY>
-</HTML>
+<% page_footer() %>
diff --git a/swat/esptest/loadparm.esp b/swat/esptest/loadparm.esp
index b9f2c54ec5..0ed69d939a 100644
--- a/swat/esptest/loadparm.esp
+++ b/swat/esptest/loadparm.esp
@@ -1,8 +1,5 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP loadparm test"); %>
+
<h1>Samba4 loadparm test</h1>
<form name="LoadparmTest" method="POST" action="@@request['SCRIPT_NAME']">
@@ -37,7 +34,7 @@ function showValue(name, v) {
if (request['REQUEST_METHOD'] == "POST") {
/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.esp");
+ redirect("/");
}
var v;
@@ -73,5 +70,4 @@ showParameter("server signing");
showParameter("interfaces");
%>
-</BODY>
-</HTML>
+<% page_footer(); %>
diff --git a/swat/esptest/menu.js b/swat/esptest/menu.js
new file mode 100644
index 0000000000..3b16824fad
--- /dev/null
+++ b/swat/esptest/menu.js
@@ -0,0 +1,11 @@
+/* show a menu for the esp test pages */
+simple_menu(
+ "ESP Tests",
+ "ldb database", "/esptest/ldb.esp",
+ "html forms", "/esptest/formtest.esp",
+ "esp includes", "/esptest/include.esp",
+ "session variables", "/esptest/session.esp",
+ "loadparm access", "/esptest/loadparm.esp",
+ "exception handling", "/esptest/exception.esp",
+ );
+
diff --git a/swat/esptest/session.esp b/swat/esptest/session.esp
index e1d6a6370d..3d787012c6 100644
--- a/swat/esptest/session.esp
+++ b/swat/esptest/session.esp
@@ -1,8 +1,5 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP session test"); %>
+
<h1>Samba4 session test</h1>
<form name="SessionTest" method="POST" action="@@request['SCRIPT_NAME']">
@@ -22,7 +19,7 @@ Samba4 ESP test
if (request['REQUEST_METHOD'] == "POST") {
/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.esp");
+ redirect("/");
}
name = form['Name'];
@@ -61,5 +58,4 @@ showArray("session", session);
write("SessionId=" + request['SESSION_ID'] + "<br>\n");
%>
-</BODY>
-</HTML>
+<% page_footer(); %>
diff --git a/swat/esptest/showvars.esp b/swat/esptest/showvars.esp
index 04bfb7b1f6..262a0962b7 100644
--- a/swat/esptest/showvars.esp
+++ b/swat/esptest/showvars.esp
@@ -1,8 +1,5 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
+<% page_header("columns", "ESP standard variables test"); %>
+
<h1>Samba4 showvars test</h1>
<%
@@ -26,10 +23,10 @@ Samba4 ESP test
showArray("session", session);
%>
-<form name="Cancel" method="POST" action="index.esp">
+<form name="Cancel" method="POST" action="/">
<input name="submit" type="submit" value="Cancel"><br>
</form>
</ul>
-</BODY>
-</HTML>
+
+<% page_footer(); %>