diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-12 11:46:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:20:13 -0500 |
commit | adb7fd18e5e58bc466bdd31d68423e5f958a1d5d (patch) | |
tree | 1af5f5d9ca3223bc70eb6293f715e4ab3db329b6 /swat/scripting | |
parent | a4c614b01279e7f89ceea4b2dffccee6cefe37dc (diff) | |
download | samba-adb7fd18e5e58bc466bdd31d68423e5f958a1d5d.tar.gz samba-adb7fd18e5e58bc466bdd31d68423e5f958a1d5d.tar.bz2 samba-adb7fd18e5e58bc466bdd31d68423e5f958a1d5d.zip |
r8372: - split out provisioning logic into a separate ejs library
- added a provisioning web page
(This used to be commit 7476cb94132cf2849ec19360468904ca6fe8de2c)
Diffstat (limited to 'swat/scripting')
-rw-r--r-- | swat/scripting/common.js | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/swat/scripting/common.js b/swat/scripting/common.js index 2e90c1b469..0e297d7d99 100644 --- a/swat/scripting/common.js +++ b/swat/scripting/common.js @@ -23,6 +23,22 @@ function session_uri(uri) { return uri + global.SESSIONURI; } +/* + like printf, but to the web page +*/ +function writef() +{ + write(vsprintf(arguments)); +} + +/* + like writef with a <br> +*/ +function writefln() +{ + write(vsprintf(arguments)); + write("<br/>\n"); +} /* if the browser was too dumb to set the HOST header, then @@ -196,6 +212,7 @@ function FormObj(name, num_elements, num_submits) f.element[i].value = current value (optional, defaults to "") */ function display_form(f) { + var i, size = 20; write('<form name="' + f.name + '" method="post" action="' + f.action + '" class="' + f.class + '">\n'); @@ -210,6 +227,12 @@ function display_form(f) { if (e.value == undefined) { e.value = ""; } + if (strlen(e.value) > size) { + size = strlen(e.value) + 4; + } + } + for (i in f.element) { + var e = f.element[i]; write("<tr>"); write("<td>" + e.label + "</td>"); if (e.type == "select") { @@ -223,8 +246,12 @@ function display_form(f) { } write('</select></td>\n'); } else { - write('<td><input name="' + e.name + '" type="' + - e.type + '" value="' + e.value + '" /></td>\n'); + var sizestr = ""; + if (e.type == "text" || e.type == "password") { + sizestr = sprintf('size="%d"', size); + } + writef('<td><input name="%s" type="%s" value="%s" %s /></td>\n', + e.name, e.type, e.value, sizestr); } write("</tr>"); } |