conga/luci/homebase form-macros index_html val ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-06-30 18:06:10
Modified files:
luci/homebase : form-macros index_html
Added files:
luci/homebase : validate_cluster_add.js validate_perm.js
validate_sys_add.js validate_sys_remove.js validate_user_add.js validate_user_del.js
Log message:
move javascript validate functions into their own files
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_perm.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_add.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_remove.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_add.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_del.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&r1=1.9&r2=1.10
/cvs/cluster/conga/luci/homebase/validate_cluster_add.js,v --> standard output revision 1.1
- renamed from luci/homebase/validate_cluster_add.js +23 -0
@@ -0,0 +1,23 @@ +function validateForm(form) { + var errors = new Array(); + + if (!form || !form.clusterName || + str_is_blank(form.clusterName.value)) + { + errors.push('No cluster name was given.'); + } else { + var invalid_chars = str_is_valid(form.clusterName.value, '/[0-9A-Za-z_. -]/g'); + if (invalid_chars) + errors.push('The cluster name you gave contains the following invalid characters: "' + invalid_chars + '".'); + } + + var added_storage = validate_systems(form, errors); + + if (error_dialog(errors)) + return (-1); + + if (confirm("Submit form?")) + form.submit(); + + return (0); +}
/cvs/cluster/conga/luci/homebase/validate_perm.js,v --> standard output revision 1.1
- renamed from luci/homebase/validate_perm.js +45 -0
45 lines not on this page · raw message
/cvs/cluster/conga/luci/homebase/validate_sys_add.js,v --> standard output revision 1.1
- renamed from luci/homebase/validate_sys_add.js +18 -0
@@ -0,0 +1,18 @@ +function validateForm(form) { + var errors = new Array(); + + if (!form) + return (-1); + + var added_storage = validate_systems(form, errors); + if (error_dialog(errors)) + return (-1); + + if (added_storage.length > 0 && + confirm("Do you really want to add the following Storage Systems:\n" + added_storage.join('\n'))) + { + form.submit(); + } + + return (0); +}
/cvs/cluster/conga/luci/homebase/validate_sys_remove.js,v --> standard output revision 1.1
- renamed from luci/homebase/validate_sys_remove.js +45 -0
45 lines not on this page · raw message
/cvs/cluster/conga/luci/homebase/validate_user_add.js,v --> standard output revision 1.1
- renamed from luci/homebase/validate_user_add.js +31 -0
@@ -0,0 +1,31 @@ +function validateForm(form) { + var errors = new Array() + + if (!form) + return (-1); + + if (!form.newUserName || !form.newUserName.value) + errors.push('You did not enter a user name.'); + if (!form.newPassword || !form.newPassword.value) + errors.push('You did not enter a password.'); + if (error_dialog(errors)) + return (-1); + + var invalid = str_is_valid(form.newUserName.value, '/[0-9A-Za-z_]/g'); + if (invalid) + errors.push('The user name you specified contains the following invalid characters: "' + invalid + '"'); + + if (str_is_blank(form.newPassword.value)) + errors.push('Passwords may not be blank.'); + else if (form.newPassword.value.length < 5) + errors.push('Passwords must be@least five characters long.'); + else if (form.newPassword.value != form.newPasswordConfirm.value) + errors.push('The passwords you entered do not match.'); + + if (error_dialog(errors)) + return (-1); + + if (confirm('Do you really want to add the user \"' + form.newUserName.value + '\"?')) + form.submit(); + return (0); +}
/cvs/cluster/conga/luci/homebase/validate_user_del.js,v --> standard output revision 1.1
- renamed from luci/homebase/validate_user_del.js +26 -0
@@ -0,0 +1,26 @@ +function validateForm(form) { + var errors = new Array(); + + if (!form || !form.deluserId) + return (-1); + + var userIdx = form.deluserId.selectedIndex; + if (userIdx <= 0 || + !form.deluserId.options[userIdx] || + !form.deluserId.options[userIdx].value) + { + errors.push('You have not selected a valid user.'); + return (-1); + } + + 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); +}
luci/homebase/form-macros +7 -195
244 lines not on this page · raw message
luci/homebase/index_html +6 -2
@@ -15,7 +15,7 @@ xml:lang language"> <tal:comment replace="nothing"> - $Id: index_html,v 1.9 2006/06/30 17:45:20 rmccabe Exp $ + $Id: index_html,v 1.10 2006/06/30 18:06:10 rmccabe Exp $ </tal:comment> <head metal:use-macro="here/header/macros/html_header">
@@ -55,13 +55,16 @@ </metal:cssslot> <metal:javascriptslot fill-slot="javascript_head_slot"> + <script type="text/javascript" + src="/luci/homebase/homebase_common.js"> + </script> <tal:comment replace="nothing"> A slot where you can insert javascript in the header from a template </tal:comment> <metal:javascriptslot define-slot="javascript_head_slot" /> </metal:javascriptslot> -<script type="text/javascript" src="/luci/homebase/homebase_common.js" /> </head> + <body tal:attributes="class here/getSectionFromURL; dir python:test(isRTL, 'rtl', 'ltr')"> <div id="visual-portal-wrapper">
@@ -94,6 +97,7 @@ <div class="visualClear"><!-- --></div> + <table id="portal-columns"> <tbody> <tr>