r6999: - renamed our html files to esp
authorAndrew Tridgell <tridge@samba.org>
Fri, 27 May 2005 00:31:41 +0000 (00:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:17:04 +0000 (13:17 -0500)
- added a favicon.ico so bookmarks show a samba icon

- added a session.esp demonstration of session variables

swat/esptest/formtest.esp [moved from swat/esptest/formtest.html with 97% similarity]
swat/esptest/include.esp [moved from swat/esptest/include.html with 88% similarity]
swat/esptest/index.esp [new file with mode: 0644]
swat/esptest/session.esp [new file with mode: 0644]
swat/esptest/showvars.esp [moved from swat/esptest/showvars.html with 68% similarity]
swat/favicon.ico [new file with mode: 0644]
swat/index.esp [moved from swat/index.html with 75% similarity]

similarity index 97%
rename from swat/esptest/formtest.html
rename to swat/esptest/formtest.esp
index 8de25f76a5d26d188a8046af99867f58a550efb6..7996900eb210bd53c6754e4256dc499c4abc17a6 100644 (file)
@@ -20,7 +20,7 @@ Samba4 ESP test
 
   /* if they cancelled then take them back to the list of tests */
   if (form['submit'] == "Cancel") {
-     redirect("index.html");
+     redirect("index.esp");
   }
 %>
   You chose firstName=@@form['firstName'] lastName=@@form['lastName']
similarity index 88%
rename from swat/esptest/include.html
rename to swat/esptest/include.esp
index 59322cc9fa6de393ad5c97188f8745b6d24f2357..9b67a768da50967b99d08850ebf901ee8e3b79d7 100644 (file)
@@ -14,7 +14,7 @@ calling a function from test.esp ...<p>
 <% res = testfn('foo'); %>
 result is: @@res
 
-<form name="Cancel" method="POST" action="index.html"> 
+<form name="Cancel" method="POST" action="index.esp"> 
     <input name="submit" type="submit" value="Cancel"><br>
 </form>
 
diff --git a/swat/esptest/index.esp b/swat/esptest/index.esp
new file mode 100644 (file)
index 0000000..f229732
--- /dev/null
@@ -0,0 +1,23 @@
+<%
+  var tests = new Array("formtest", "showvars", "include", "session");
+%>
+
+<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>
+</BODY>
+</HTML>
diff --git a/swat/esptest/session.esp b/swat/esptest/session.esp
new file mode 100644 (file)
index 0000000..e1d6a63
--- /dev/null
@@ -0,0 +1,65 @@
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+<h1>Samba4 session test</h1>
+
+<form name="SessionTest" method="POST" action="@@request['SCRIPT_NAME']"> 
+    Name:   <input name="Name"  type="text" value=""><br>
+    Value:  <input name="Value" type="text" value=""><br>
+    Timeout: <input name="Timeout" type="text" value=""><br>
+    <input name="submit" type="submit" value="Append">
+    <input name="submit" type="submit" value="Reset">
+    <input name="submit" type="submit" value="Destroy">
+    <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.esp");
+       }
+       
+       name  = form['Name'];
+       value = form['Value'];
+       timeout = form['Timeout'];
+       
+       if (timeout) {
+               useSession(timeout);
+       }
+       
+       if (form['submit'] == "Reset" && name) {
+               session[name] = null;
+       }
+       
+       if (form['submit'] == "Append" && name) {
+               session[name] = "" + session[name] + value;
+       }
+       
+       if (form['submit'] == "Destroy") {
+               destroySession();
+       }
+}
+
+function showArray(name, array) {
+       write("<h3>Array: " + name + "</h3>\n");
+       if (array == undefined) {
+               write("undefined<br>\n");
+               return;
+       }
+       for (v in array) {
+               write(name + "[" + v + "]=" + array[v] + "<br>\n");
+       }
+}
+
+showArray("session", session);
+write("SessionId=" + request['SESSION_ID'] + "<br>\n");
+%>
+
+</BODY>
+</HTML>
similarity index 68%
rename from swat/esptest/showvars.html
rename to swat/esptest/showvars.esp
index 4c4a5b93f44b59c58954de17836d06c19f2d46f6..04bfb7b1f629c7735145c142ec0e09aab82d9ee9 100644 (file)
@@ -8,12 +8,15 @@ Samba4 ESP test
 <%
    function showArray(name, array) {
       write("<h3>Array: " + name + "</h3>\n");
-      for (v in array) {
-            write(name + "[" + v + "]=" + array[v] + "<br>\n");
+      if (array == undefined) {
+        write("undefined<br>\n");
+      } else {
+            for (v in array) {
+                 write(name + "[" + v + "]=" + array[v] + "<br>\n");
+           }
       }
    }
 
-   showArray("form",    form);
    showArray("headers", headers);
    showArray("application", application);
    showArray("cookies", cookies);
@@ -23,7 +26,7 @@ Samba4 ESP test
    showArray("session", session);
 %>
 
-<form name="Cancel" method="POST" action="index.html"> 
+<form name="Cancel" method="POST" action="index.esp"> 
     <input name="submit" type="submit" value="Cancel"><br>
 </form>
 
diff --git a/swat/favicon.ico b/swat/favicon.ico
new file mode 100644 (file)
index 0000000..ef903ba
Binary files /dev/null and b/swat/favicon.ico differ
similarity index 75%
rename from swat/index.html
rename to swat/index.esp
index 644eeebd6198e4254126ac0f7ceba16b9dd1db61..7023a9e102e7c15e11a664996e8ab2319c3b8e53 100644 (file)
@@ -5,7 +5,7 @@ Samba4 ESP test
 <BODY>
 redirecting you to the test pages ...
 <%
-  redirect("esptest/index.html");
+  redirect("esptest/index.esp");
 %>
 </BODY>
 </HTML>