conga/luci/homebase form-macros homebase_commo ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-27 22:49:10
Modified files:
luci/homebase : form-macros homebase_common.js index_html
luci_homebase.css validate_cluster_add.js validate_user_add.js validate_user_del.js
Log message:
more javascript validation stuff
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_add.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_del.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
luci/homebase/form-macros +3 -3
@@ -1,7 +1,7 @@ <html> <tal:comment replace="nothing"> - $Id: form-macros,v 1.37 2006/09/23 04:04:08 rmccabe Exp $ + $Id: form-macros,v 1.38 2006/09/27 22:49:09 rmccabe Exp $ </tal:comment> <head>
@@ -504,7 +504,7 @@ <tbody class="systemsTable"> <tal:block tal:repeat="node python: sessionObj['requestResults']['nodeList']"> <span tal:omit-tag="" - tal:define="global nodeAuth python: node['cur_auth']" /> + tal:define="global nodeAuth python: node['cur_auth']" /> <tr class="systemsTable"> <td class="systemsTable">
@@ -535,7 +535,7 @@ </tal:block> </tbody> </table> - + <input name="numStorage" id="numStorage" type="hidden" tal:attributes="value python: sysNum" />
luci/homebase/homebase_common.js +24 -6
@@ -1,3 +1,13 @@ +function set_form_err(ielem) { + if (ielem) + ielem.className += ' formerror'; +} + +function clr_form_err(ielem) { + if (ielem) + ielem.className = ielem.className.replace(/ formerror/, ''); +} + function is_valid_int(str, min, max) { if (str.match(/[^0-9 -]/)) return (0);
@@ -185,29 +195,37 @@ var pwdElem = document.getElementById('__SYSTEM' + i + ':Passwd'); if (!element.value) { if (pwdElem.value) { + set_form_err(element); if (!allSameCB.checked) { errors.push('You entered a password, but no hostname for system ' + (i + 1)); - continue; + clr_form_err(pwdElem); } else pwdElem.value = ''; } - + clr_form_err(pwdElem); continue; - } else if (!pwdElem || !pwdElem.value) + } else if (!pwdElem || !pwdElem.value) { errors.push('No password was given for \"' + element.value + '\"'); - else if (str_is_blank(pwdElem.value)) + set_form_err(pwdElem); + } else if (str_is_blank(pwdElem.value)) { errors.push('The password entered for \"' + element.value + '\" is blank.'); + set_form_err(pwdElem); + } else + clr_form_err(pwdElem); if (str_is_blank(element.value)) { errors.push('You entered a blank hostname for system ' + (i + 1)); element.value = ''; + set_form_err(element); } else { var errmsg; - if ((errmsg = isValidHost(element.value))) + if ((errmsg = isValidHost(element.value))) { errors.push('\"' + element.value + '\" is not a valid hostname: ' + errmsg); - else { + set_form_err(element); + } else { pwdElem.disabled = false; added_storage.push(element.value); + clr_form_err(element); } } }
luci/homebase/index_html +2 -2
@@ -15,7 +15,7 @@ xml:lang language"> <tal:comment replace="nothing"> - $Id: index_html,v 1.15 2006/08/02 16:56:59 rmccabe Exp $ + $Id: index_html,v 1.16 2006/09/27 22:49:09 rmccabe Exp $ </tal:comment> <head metal:use-macro="here/header/macros/html_header">
@@ -48,7 +48,7 @@ <!-- @import url(/luci/homebase/luci_homebase.css); --> </style> -<tal:block tal:omit-tag="" +<tal:block tal:omit-tag="" tal:define="global data python:here.homebaseControl(request)" /> <metal:cssslot define-slot="css_slot" />
luci/homebase/luci_homebase.css +4 -0
@@ -230,6 +230,10 @@ margin-left: +1.5em; } +*.formerror { + background: #f5f6be; +} + img.qdel_img { height: 7px; width: 7px;
luci/homebase/validate_cluster_add.js +5 -1
@@ -7,11 +7,15 @@ var clusterName = form.clusterName; if (!clusterName || str_is_blank(clusterName.value)) { errors.push('No cluster name was given.'); + set_form_err(form.clusterName); } else { clusterName = clusterName.value; var invalid_chars = str_is_valid(clusterName, '/[0-9A-Za-z_. -]/g'); - if (invalid_chars) + if (invalid_chars) { errors.push('The cluster name you gave contains the following invalid characters: "' + invalid_chars + '".'); + set_form_err(form.clusterName); + } else + clr_form_err(form.clusterName); } var added_storage = validate_systems(form, errors);
luci/homebase/validate_user_add.js +35 -15
62 lines not on this page · raw message
luci/homebase/validate_user_del.js +0 -2
@@ -15,12 +15,10 @@ if (error_dialog(errors)) return (-1); - if (confirm('Do you really want to remove the user \"' + form.deluserId.options[userIdx].value + '\"?')) { form.submit(); } - return (0); }