svn commit: samba r7106 - in branches/SAMBA_4_0/swat: . esptest
scripting
tridge at samba.org
tridge at samba.org
Mon May 30 12:21:33 GMT 2005
Author: tridge
Date: 2005-05-30 12:21:30 +0000 (Mon, 30 May 2005)
New Revision: 7106
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7106
Log:
the web interface now works completely with or without cookies. If you have cookies
they will be used, otherwise you will see URLs with ?SwatSessionId=XXX on the end.
Modified:
branches/SAMBA_4_0/swat/esptest/menu.js
branches/SAMBA_4_0/swat/login.esp
branches/SAMBA_4_0/swat/scripting/common.js
branches/SAMBA_4_0/swat/scripting/header_columns.esp
Changeset:
Modified: branches/SAMBA_4_0/swat/esptest/menu.js
===================================================================
--- branches/SAMBA_4_0/swat/esptest/menu.js 2005-05-30 12:18:49 UTC (rev 7105)
+++ branches/SAMBA_4_0/swat/esptest/menu.js 2005-05-30 12:21:30 UTC (rev 7106)
@@ -1,11 +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",
- "environment variables", "/esptest/showvars.esp");
+ "ldb database", session_uri("/esptest/ldb.esp"),
+ "html forms", session_uri("/esptest/formtest.esp"),
+ "esp includes", session_uri("/esptest/include.esp"),
+ "session variables", session_uri("/esptest/session.esp"),
+ "loadparm access", session_uri("/esptest/loadparm.esp"),
+ "exception handling", session_uri("/esptest/exception.esp"),
+ "environment variables", session_uri("/esptest/showvars.esp"));
Modified: branches/SAMBA_4_0/swat/login.esp
===================================================================
--- branches/SAMBA_4_0/swat/login.esp 2005-05-30 12:18:49 UTC (rev 7105)
+++ branches/SAMBA_4_0/swat/login.esp 2005-05-30 12:21:30 UTC (rev 7106)
@@ -3,7 +3,9 @@
<%
var f = Form("login", 2, 1);
f.element[0].label = "Username";
+f.element[0].value = form['Username'];
f.element[1].label = "Password";
+f.element[1].value = form['Password'];
f.element[1].type = "password";
f.submit[0] = "Login";
@@ -23,9 +25,9 @@
redirect them to the current page, which will now
show its true content */
if (request.REQUEST_URI == "/login.esp") {
- redirect("/");
+ redirect(session_uri("/"));
} else {
- redirect(request.REQUEST_URI);
+ redirect(session_uri(request.REQUEST_URI));
}
}
%>
Modified: branches/SAMBA_4_0/swat/scripting/common.js
===================================================================
--- branches/SAMBA_4_0/swat/scripting/common.js 2005-05-30 12:18:49 UTC (rev 7105)
+++ branches/SAMBA_4_0/swat/scripting/common.js 2005-05-30 12:21:30 UTC (rev 7106)
@@ -8,7 +8,23 @@
/* fill in some defaults */
global.page.title = "Samba Web Administration Tool";
+/* to cope with browsers that don't support cookies we append the sessionid
+ to the URI */
+global.SESSIONURI = "";
+if (request['COOKIE_SUPPORT'] != "True") {
+ global.SESSIONURI="?SwatSessionId=" + request['SESSION_ID'];
+}
+/*
+ possibly adjust a local URI to have the session id appended
+ used for browsers that don't support cookies
+*/
+function session_uri(uri) {
+ return uri + global.SESSIONURI;
+}
+
+
+
/* if the browser was too dumb to set the HOST header, then
set it now */
if (headers['HOST'] == undefined) {
@@ -32,6 +48,7 @@
include("/scripting/footer_" + global.page.pagetype + ".esp");
}
+
/*
check if a uri is one of the 'always allowed' pages, even when not logged in
This allows the login page to use the same style sheets and images
@@ -40,6 +57,7 @@
var allowed = new Array("/images/favicon.ico",
"/images/linkpad.gif",
"/images/logo.png",
+ "/images/logo.gif",
"/style/main.css",
"/style/common.css");
for (i in allowed) {
@@ -102,7 +120,7 @@
f.name = name;
f.element = new Array(num_elements);
f.submit = new Array(num_submits);
- f.action = request.REQUEST_URI;
+ f.action = session_uri(request.REQUEST_URI);
f.class = "form";
for (i in f.element) {
f.element[i] = new Object();
@@ -160,3 +178,4 @@
}
write("</form>\n");
}
+
Modified: branches/SAMBA_4_0/swat/scripting/header_columns.esp
===================================================================
--- branches/SAMBA_4_0/swat/scripting/header_columns.esp 2005-05-30 12:18:49 UTC (rev 7105)
+++ branches/SAMBA_4_0/swat/scripting/header_columns.esp 2005-05-30 12:21:30 UTC (rev 7106)
@@ -42,14 +42,14 @@
<div class="stripe"></div>
<div class="logout">
<b>logged in as @@session.authinfo.username</b>
- <form method="post" action="/logout.esp">
+ <form method="post" action="/logout.esp@@global.SESSIONURI">
<input type="submit" value="Logout" />
</form>
</div>
</div>
<div id="logo">
- <div class="logo_hack"><a href="/"><img src="/images/linkpad.gif" alt="SWAT" /></a></div>
+ <div class="logo_hack"><a href="/@@global.SESSIONURI"><img src="/images/linkpad.gif" alt="SWAT" /></a></div>
</div>
<div class="slogan">
More information about the samba-cvs
mailing list