r6983: add some sample esp pages to demonstrate the use of some of the features of...
authorAndrew Tridgell <tridge@samba.org>
Thu, 26 May 2005 02:08:12 +0000 (02:08 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:02 +0000 (13:17 -0500)
side scripting language

swat/html/esptest/formtest.html [new file with mode: 0644]
swat/html/esptest/index.html [new file with mode: 0644]
swat/html/esptest/showvars.html [new file with mode: 0644]
swat/html/images/logo.png [new file with mode: 0644]
swat/html/index.html [new file with mode: 0644]
swat/scripting/test.ejs [new file with mode: 0644]

diff --git a/swat/html/esptest/formtest.html b/swat/html/esptest/formtest.html
new file mode 100644 (file)
index 0000000..8de25f7
--- /dev/null
@@ -0,0 +1,41 @@
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+<h1>Samba4 form test</h1>
+
+<form name="FormTest" method="POST" action="@@request['SCRIPT_NAME']"> 
+    firstName: <input name="firstName" type="text" value=""><br>
+    lastName:  <input name="lastName"  type="text" value=""><br>
+    <input name="submit" type="submit" value="OK">
+    <input name="submit" type="submit" value="Cancel"><br>
+</form>
+
+<%
+  /* if its a post then the user has filled in the form, so
+     report the values 
+  */
+  if (request['REQUEST_METHOD'] == "POST") {
+
+  /* if they cancelled then take them back to the list of tests */
+  if (form['submit'] == "Cancel") {
+     redirect("index.html");
+  }
+%>
+  You chose firstName=@@form['firstName'] lastName=@@form['lastName']
+<%
+
+   function showArray(name, array) {
+      write("<h3>Array: " + name + "</h3>\n");
+      for (v in array) {
+            write(name + "[" + v + "]=" + array[v] + "<br>\n");
+      }
+   }
+
+   showArray("form",    form);
+  }
+%>
+
+</BODY>
+</HTML>
diff --git a/swat/html/esptest/index.html b/swat/html/esptest/index.html
new file mode 100644 (file)
index 0000000..957e7d9
--- /dev/null
@@ -0,0 +1,23 @@
+<%
+  var tests = new Array("formtest", "showvars");
+%>
+
+<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/html/esptest/showvars.html b/swat/html/esptest/showvars.html
new file mode 100644 (file)
index 0000000..4c4a5b9
--- /dev/null
@@ -0,0 +1,32 @@
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+<h1>Samba4 showvars test</h1>
+
+<%
+   function showArray(name, array) {
+      write("<h3>Array: " + name + "</h3>\n");
+      for (v in array) {
+            write(name + "[" + v + "]=" + array[v] + "<br>\n");
+      }
+   }
+
+   showArray("form",    form);
+   showArray("headers", headers);
+   showArray("application", application);
+   showArray("cookies", cookies);
+   showArray("files", files);
+   showArray("request", request);
+   showArray("server", server);
+   showArray("session", session);
+%>
+
+<form name="Cancel" method="POST" action="index.html"> 
+    <input name="submit" type="submit" value="Cancel"><br>
+</form>
+
+</ul>
+</BODY>
+</HTML>
diff --git a/swat/html/images/logo.png b/swat/html/images/logo.png
new file mode 100644 (file)
index 0000000..6df4ace
Binary files /dev/null and b/swat/html/images/logo.png differ
diff --git a/swat/html/index.html b/swat/html/index.html
new file mode 100644 (file)
index 0000000..644eeeb
--- /dev/null
@@ -0,0 +1,11 @@
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+redirecting you to the test pages ...
+<%
+  redirect("esptest/index.html");
+%>
+</BODY>
+</HTML>
diff --git a/swat/scripting/test.ejs b/swat/scripting/test.ejs
new file mode 100644 (file)
index 0000000..e69df92
--- /dev/null
@@ -0,0 +1,10 @@
+
+/*
+       some test ejs code 
+*/
+function showArray(name, array) {
+    write("<h3>Array: " + name + "</h3>\n");
+    for (v in array) {
+          write(name + "[" + v + "]=" + array[v] + "<br>\n");
+    }
+}