All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/homebase form-macros homebase_commo ...
Date: 27 Sep 2006 22:49:10 -0000	[thread overview]
Message-ID: <20060927224910.8402.qmail@sourceware.org> (raw)

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

--- conga/luci/homebase/form-macros	2006/09/23 04:04:08	1.37
+++ conga/luci/homebase/form-macros	2006/09/27 22:49:09	1.38
@@ -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" />
 
--- conga/luci/homebase/homebase_common.js	2006/09/22 18:22:39	1.11
+++ conga/luci/homebase/homebase_common.js	2006/09/27 22:49:09	1.12
@@ -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);
 			}
 		}
 	}
--- conga/luci/homebase/index_html	2006/08/02 16:56:59	1.15
+++ conga/luci/homebase/index_html	2006/09/27 22:49:09	1.16
@@ -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" />
--- conga/luci/homebase/luci_homebase.css	2006/09/26 20:57:10	1.25
+++ conga/luci/homebase/luci_homebase.css	2006/09/27 22:49:09	1.26
@@ -230,6 +230,10 @@
 	margin-left: +1.5em;
 }
 
+*.formerror {
+	background: #f5f6be;
+}
+
 img.qdel_img {
 	height: 7px;
 	width: 7px;
--- conga/luci/homebase/validate_cluster_add.js	2006/07/18 19:25:20	1.3
+++ conga/luci/homebase/validate_cluster_add.js	2006/09/27 22:49:09	1.4
@@ -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);
--- conga/luci/homebase/validate_user_add.js	2006/06/30 18:06:10	1.1
+++ conga/luci/homebase/validate_user_add.js	2006/09/27 22:49:09	1.2
@@ -4,27 +4,47 @@
 	if (!form)
 		return (-1);
 
-	if (!form.newUserName || !form.newUserName.value)
+	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);
+		set_form_err(form.newUserName);
+	} else {
+		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 + '"');
+			set_form_err(form.newUserName);
+		} else
+			clr_form_err(form.newUserName);
+	}
 
-	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 (!form.newPassword || !form.newPassword.value) {
+		errors.push('You did not enter a password.');
+		set_form_err(form.newPassword);
+	} else {
+		if (str_is_blank(form.newPassword.value)) {
+			errors.push('Passwords may not be blank.');
+			set_form_err(form.newPassword);
+		} else if (form.newPassword.value.length < 5) {
+			errors.push('Passwords must be at least five characters long.');
+			set_form_err(form.newPassword);
+		}
 
-	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 (!form.newPasswordConfirm || !form.newPasswordConfirm.value) {
+			errors.push('You did not confirm your password.');
+			set_form_err(form.newPasswordConfirm);
+		} else {
+			else if (form.newPassword.value != form.newPasswordConfirm.value) {
+				errors.push('The passwords you entered do not match.');
+				set_form_err(form.newPassword);
+				set_form_err(form.newPasswordConfirm);
+			} else {
+				clr_form_err(form.newPassword);
+				clr_form_err(form.newPasswordConfirm);
+			}
+		}
+	}
 
 	if (error_dialog(errors))
 		return (-1);
-
 	if (confirm('Do you really want to add the user \"' + form.newUserName.value + '\"?'))
 		form.submit();
 	return (0);
--- conga/luci/homebase/validate_user_del.js	2006/06/30 18:06:10	1.1
+++ conga/luci/homebase/validate_user_del.js	2006/09/27 22:49:09	1.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);
 }



             reply	other threads:[~2006-09-27 22:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-27 22:49 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-25  3:51 [Cluster-devel] conga/luci/homebase form-macros homebase_commo rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060927224910.8402.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.