summaryrefslogtreecommitdiff
path: root/swat/scripting/common.js
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-30 12:21:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:17 -0500
commit419598e1d1043eb254e3c0af43c76d798fdb2b3b (patch)
treea2e783c9cd509019141a8389a12c17c0f38782c3 /swat/scripting/common.js
parent0d00eba376b1bfae6ecdad500d2cb23305f6a349 (diff)
downloadsamba-419598e1d1043eb254e3c0af43c76d798fdb2b3b.tar.gz
samba-419598e1d1043eb254e3c0af43c76d798fdb2b3b.tar.bz2
samba-419598e1d1043eb254e3c0af43c76d798fdb2b3b.zip
r7106: 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. (This used to be commit 104d47a7458ecf03c0d5f969eaf2a98346928679)
Diffstat (limited to 'swat/scripting/common.js')
-rw-r--r--swat/scripting/common.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/swat/scripting/common.js b/swat/scripting/common.js
index 8396a3adc2..13ed34346b 100644
--- a/swat/scripting/common.js
+++ b/swat/scripting/common.js
@@ -8,6 +8,22 @@ global.page = new Object();
/* 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 */
@@ -32,6 +48,7 @@ function page_footer() {
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 @@ function always_allowed(uri) {
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 @@ function Form(name, num_elements, num_submits)
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 @@ function display_form(f) {
}
write("</form>\n");
}
+