diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-27 00:31:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:04 -0500 |
commit | 26a8394ee92443ce2a9688bc01a02df4c2ad74fa (patch) | |
tree | b31846a79fa577cf2f370ab62d7baae3cdad22ad /swat/esptest | |
parent | fc45b63e478f6f891f0d04bf49423be30a63617d (diff) | |
download | samba-26a8394ee92443ce2a9688bc01a02df4c2ad74fa.tar.gz samba-26a8394ee92443ce2a9688bc01a02df4c2ad74fa.tar.bz2 samba-26a8394ee92443ce2a9688bc01a02df4c2ad74fa.zip |
r6999: - renamed our html files to esp
- added a favicon.ico so bookmarks show a samba icon
- added a session.esp demonstration of session variables
(This used to be commit 092ffc733916f8091c8ff1e7a1306810e516d613)
Diffstat (limited to 'swat/esptest')
-rw-r--r-- | swat/esptest/formtest.esp (renamed from swat/esptest/formtest.html) | 2 | ||||
-rw-r--r-- | swat/esptest/include.esp (renamed from swat/esptest/include.html) | 2 | ||||
-rw-r--r-- | swat/esptest/index.esp | 23 | ||||
-rw-r--r-- | swat/esptest/session.esp | 65 | ||||
-rw-r--r-- | swat/esptest/showvars.esp (renamed from swat/esptest/showvars.html) | 11 |
5 files changed, 97 insertions, 6 deletions
diff --git a/swat/esptest/formtest.html b/swat/esptest/formtest.esp index 8de25f76a5..7996900eb2 100644 --- a/swat/esptest/formtest.html +++ b/swat/esptest/formtest.esp @@ -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'] diff --git a/swat/esptest/include.html b/swat/esptest/include.esp index 59322cc9fa..9b67a768da 100644 --- a/swat/esptest/include.html +++ b/swat/esptest/include.esp @@ -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 index 0000000000..f229732e3e --- /dev/null +++ b/swat/esptest/index.esp @@ -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 index 0000000000..e1d6a6370d --- /dev/null +++ b/swat/esptest/session.esp @@ -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> diff --git a/swat/esptest/showvars.html b/swat/esptest/showvars.esp index 4c4a5b93f4..04bfb7b1f6 100644 --- a/swat/esptest/showvars.html +++ b/swat/esptest/showvars.esp @@ -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> |