diff options
author | Derrell Lipman <derrell@samba.org> | 2007-01-03 19:57:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:36:06 -0500 |
commit | 2e7c59c24470766e37309c7a8bfa4c7b81c57614 (patch) | |
tree | c44c89911868c52f25ca66bdefa68e13248db8e6 /webapps/scripting/forms.js | |
parent | 57f5bf78fa9fc9d190c3cb25251e686a1488f790 (diff) | |
download | samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.tar.gz samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.tar.bz2 samba-2e7c59c24470766e37309c7a8bfa4c7b81c57614.zip |
r20515: Continued work on the Web Application Framework. Until we get all of the
functionality of the old scripts incorporated into the new framework, the old
scripts need to still be available. I've reverted to having the old scripts
be the default pages, and added an option to access the preview of the new
SWAT.
(This used to be commit b43620d4b8eff815f4a6dc02522a8dfc9fdcaef4)
Diffstat (limited to 'webapps/scripting/forms.js')
-rw-r--r-- | webapps/scripting/forms.js | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/webapps/scripting/forms.js b/webapps/scripting/forms.js deleted file mode 100644 index 2de9e34462..0000000000 --- a/webapps/scripting/forms.js +++ /dev/null @@ -1,112 +0,0 @@ -/* - js functions for forms -*/ - - -/* - display a simple form from a ejs Form object - caller should fill in - f.name = form name - f.action = action to be taken on submit (optional, defaults to current page) - f.class = css class (optional, defaults to 'form') - f.submit = an array of submit labels - f.add(name, label, [type], [value]) = - Add another element - f.element[i].label = element label - f.element[i].name = element name (defaults to label) - f.element[i].type = element type (defaults to text) - f.element[i].value = current value (optional, defaults to "") - */ -function form_display() { - var f = this; - var i, size = 20; - write('<form name="' + f.name + - '" method="post" action="' + f.action + - '" class="' + f.class + '">\n'); - if (f.element.length > 0) { - write("<table>\n"); - } - for (i in f.element) { - var e = f.element[i]; - if (e.name == undefined) { - e.name = e.label; - } - 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") { - write('<td><select name="' + e.name + '">\n'); - for (s in e.list) { - if (e.value == e.list[s]) { - write('<option selected=selected>' + e.list[s] + '</option>\n'); - } else { - write('<option>' + e.list[s] + '</option>\n'); - } - } - write('</select></td>\n'); - } else { - 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>"); - } - if (f.element.length > 0) { - write("</table>\n"); - } - for (i in f.submit) { - write('<input name="submit" type="submit" value="' + f.submit[i] + '" />\n'); - } - write("</form>\n"); -} - -function __addMethod(name, label) -{ - var f = this; - var i = f.element.length; - f.element[i] = new Object(); - f.element[i].name = name; - f.element[i].label = label; - f.element[i].type = "text"; - f.element[i].value = ""; - if (arguments.length > 2) { - f.element[i].type = arguments[2]; - } - if (arguments.length > 3) { - f.element[i].value = arguments[3]; - } -} - -/* - create a Form object with the defaults filled in, ready for display() - */ -function FormObj(name, num_elements, num_submits) -{ - var f = new Object(); - f.name = name; - f.element = new Array(num_elements); - f.submit = new Array(num_submits); - f.action = session_uri(request.REQUEST_URI); - f.class = "defaultform"; - f.add = __addMethod; - for (i in f.element) { - f.element[i] = new Object(); - f.element[i].type = "text"; - f.element[i].value = ""; - } - f.display = form_display; - - return f; -} - |