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 index_html val ...
Date: 30 Jun 2006 18:06:11 -0000	[thread overview]
Message-ID: <20060630180611.26487.qmail@sourceware.org> (raw)

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
--- conga/luci/homebase/validate_cluster_add.js
+++ -	2006-06-30 18:06:11.143347000 +0000
@@ -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
--- conga/luci/homebase/validate_perm.js
+++ -	2006-06-30 18:06:11.243925000 +0000
@@ -0,0 +1,45 @@
+function validateForm(form) {
+	var errors = new Array();
+
+	if (!form || !form.userList)
+		return (-1);
+
+	var userIdx = form.userList.selectedIndex;
+	if (userIdx < 0 || !form.userList.options[userIdx].value)
+		errors.push('You have not selected a valid user.');
+
+	if (error_dialog(errors))
+		return (-1);
+
+	var selected_clusters = new Array();
+	var selected_storage = new Array();
+
+	if (!form)
+		return (-1);
+
+	var num_clusters = document.getElementById('numClusters').value;
+	for (var i = 0 ; i < num_clusters ; i++) {
+		var element = document.getElementById('__CLUSTER' + i);
+		if (!element || !element.value || !element.checked)
+			continue;
+		selected_clusters.push(element.value);
+	}
+
+	var num_storage = document.getElementById('numStorage').value;
+	for (var i = 0 ; i < num_storage ; i++) {
+		var element = document.getElementById('__SYSTEM' + i);
+		if (!element || !element.value || !element.checked)
+			continue;
+		selected_storage.push(element.value);
+	}
+
+	if (selected_clusters.length + selected_storage.length < 1)
+		return (0);
+
+	if (error_dialog(errors))
+		return (-1);
+
+	if (confirm('Modify permissions for ' + form.userList.options[userIdx].value + '?'))
+		form.submit();
+	return (0);
+}
/cvs/cluster/conga/luci/homebase/validate_sys_add.js,v  -->  standard output
revision 1.1
--- conga/luci/homebase/validate_sys_add.js
+++ -	2006-06-30 18:06:11.326319000 +0000
@@ -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
--- conga/luci/homebase/validate_sys_remove.js
+++ -	2006-06-30 18:06:11.406255000 +0000
@@ -0,0 +1,45 @@
+function validateForm(form) {
+	var errors = new Array();
+	var selected_clusters = new Array();
+	var selected_storage = new Array();
+
+	if (!form)
+		return (-1);
+
+	var num_clusters = document.getElementById('numClusters').value;
+	for (var i = 0 ; i < num_clusters ; i++) {
+		var element = document.getElementById('__CLUSTER' + i);
+		if (!element || !element.value || !element.checked)
+			continue;
+		selected_clusters.push(element.value);
+	}
+
+	var num_storage = document.getElementById('numStorage').value;
+	for (var i = 0 ; i < num_storage ; i++) {
+		var element = document.getElementById('__SYSTEM' + i);
+		if (!element || !element.value || !element.checked)
+			continue;
+		selected_storage.push(element.value);
+	}
+
+	if (selected_clusters.length + selected_storage.length < 1)
+		return (0);
+
+	if (error_dialog(errors))
+		return (-1);
+
+	var confirm_str = 'Do you really want to remove the following managed systems:';
+	if (selected_clusters.length > 0)
+		confirm_str += '\nClusters:\n-' + selected_clusters.join('\n-');
+
+	if (selected_storage.length > 0) {
+		if (selected_clusters.length > 0)
+			confirm_str += '\n';
+
+		confirm_str += '\nStorage Systems:\n-' + selected_storage.join('\n-');
+	}
+
+	if (confirm(confirm_str))
+		form.submit();
+	return (0);
+}
/cvs/cluster/conga/luci/homebase/validate_user_add.js,v  -->  standard output
revision 1.1
--- conga/luci/homebase/validate_user_add.js
+++ -	2006-06-30 18:06:11.485000000 +0000
@@ -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
--- conga/luci/homebase/validate_user_del.js
+++ -	2006-06-30 18:06:11.572831000 +0000
@@ -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);
+}
--- conga/luci/homebase/form-macros	2006/06/22 03:49:54	1.24
+++ conga/luci/homebase/form-macros	2006/06/30 18:06:10	1.25
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.24 2006/06/22 03:49:54 rmccabe Exp $
+	$Id: form-macros,v 1.25 2006/06/30 18:06:10 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -41,33 +41,7 @@
 			- selected index is valid
 	</tal:comment>
 
-	<script type="text/javascript">
-		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);
-		}
+	<script type="text/javascript" src="/luci/homebase/validate_user_del.js">
 	</script>
 
 	<span tal:omit-tag=""
@@ -127,38 +101,7 @@
 		 - passwords match
 	</tal:comment>
 
-	<script type="text/javascript">
-		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);
-		}
+	<script type="text/javascript" src="/luci/homebase/validate_user_add.js">
 	</script>
 
 	<form name="adminform" method="post" action="">
@@ -216,52 +159,7 @@
 			- The rest is checked by the python form submit validator.
 	</tal:comment>
 
-	<script type="text/javascript">
-		function validateForm(form) {
-			var errors = new Array();
-
-			if (!form || !form.userList)
-				return (-1);
-
-			var userIdx = form.userList.selectedIndex;
-			if (userIdx < 0 || !form.userList.options[userIdx].value)
-				errors.push('You have not selected a valid user.');
-
-			if (error_dialog(errors))
-				return (-1);
-
-			var selected_clusters = new Array();
-			var selected_storage = new Array();
-
-			if (!form)
-				return (-1);
-
-			var num_clusters = document.getElementById('numClusters').value;
-			for (var i = 0 ; i < num_clusters ; i++) {
-				var element = document.getElementById('__CLUSTER' + i);
-				if (!element || !element.value || !element.checked)
-					continue;
-				selected_clusters.push(element.value);
-			}
-
-			var num_storage = document.getElementById('numStorage').value;
-			for (var i = 0 ; i < num_storage ; i++) {
-				var element = document.getElementById('__SYSTEM' + i);
-				if (!element || !element.value || !element.checked)
-					continue;
-				selected_storage.push(element.value);
-			}
-
-			if (selected_clusters.length + selected_storage.length < 1)
-				return (0);
-
-			if (error_dialog(errors))
-				return (-1);
-
-			if (confirm('Modify permissions for ' + form.userList.options[userIdx].value + '?'))
-				form.submit();
-			return (0);
-		}
+	<script type="text/javascript" src="/luci/homebase/validate_perm.js">
 	</script>
 
 	<span
@@ -389,52 +287,7 @@
 					-> if yes, confirm again, showing list
 	</tal:comment>
 
-	<script type="text/javascript">
-		function validateForm(form) {
-			var errors = new Array();
-			var selected_clusters = new Array();
-			var selected_storage = new Array();
-
-			if (!form)
-				return (-1);
-
-			var num_clusters = document.getElementById('numClusters').value;
-			for (var i = 0 ; i < num_clusters ; i++) {
-				var element = document.getElementById('__CLUSTER' + i);
-				if (!element || !element.value || !element.checked)
-					continue;
-				selected_clusters.push(element.value);
-			}
-
-			var num_storage = document.getElementById('numStorage').value;
-			for (var i = 0 ; i < num_storage ; i++) {
-				var element = document.getElementById('__SYSTEM' + i);
-				if (!element || !element.value || !element.checked)
-					continue;
-				selected_storage.push(element.value);
-			}
-
-			if (selected_clusters.length + selected_storage.length < 1)
-				return (0);
-
-			if (error_dialog(errors))
-				return (-1);
-
-			var confirm_str = 'Do you really want to remove the following managed systems:';
-			if (selected_clusters.length > 0)
-				confirm_str += '\nClusters:\n-' + selected_clusters.join('\n-');
-
-			if (selected_storage.length > 0) {
-				if (selected_clusters.length > 0)
-					confirm_str += '\n';
-
-				confirm_str += '\nStorage Systems:\n-' + selected_storage.join('\n-');
-			}
-
-			if (confirm(confirm_str))
-				form.submit();
-			return (0);
-		}
+	<script type="text/javascript" src="/luci/homebase/validate_sys_remove.js">
 	</script>
 
 	<span tal:omit-tag=""
@@ -559,25 +412,7 @@
 			- If not IP, make sure it's a FQDN with no invalid chars.
 	</tal:comment>
 
-	<script type="text/javascript">
-		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);
-		}
+	<script type="text/javascript" src="/luci/homebase/validate_sys_add.js">
 	</script>
 
 	<form name="adminform" method="post" action="">
@@ -650,30 +485,7 @@
 			- At least one node name/password are given and are valid
 	</tal:comment>
 
-	<script type="text/javascript">
-		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);
-		}
+	<script type="text/javascript" src="/luci/homebase/validate_cluster_add.js">
 	</script>
 
 	<form name="adminform" action="" method="post">
--- conga/luci/homebase/index_html	2006/06/30 17:45:20	1.9
+++ conga/luci/homebase/index_html	2006/06/30 18:06:10	1.10
@@ -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>



                 reply	other threads:[~2006-06-30 18:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060630180611.26487.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.