* [Cluster-devel] conga/luci/homebase form-macros homebase_commo ...
@ 2006-09-27 22:49 rmccabe
0 siblings, 0 replies; 2+ messages in thread
From: rmccabe @ 2006-09-27 22:49 UTC (permalink / raw)
To: cluster-devel.redhat.com
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);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Cluster-devel] conga/luci/homebase form-macros homebase_commo ...
@ 2007-09-25 3:51 rmccabe
0 siblings, 0 replies; 2+ messages in thread
From: rmccabe @ 2007-09-25 3:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-09-25 03:51:21
Modified files:
luci/homebase : form-macros homebase_common.js
luci_homebase.css validate_cluster_add.js
validate_cluster_add_initial.js
validate_perm.js validate_sys_add.js
validate_sys_remove.js validate_user_add.js
validate_user_del.js
Removed files:
luci/homebase : x.png
Log message:
- Move all images into the site custom directory so they can be cached by the server
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add_initial.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_perm.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_add.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_remove.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_add.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_del.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/x.png.diff?cvsroot=cluster&r1=1.2&r2=NONE
--- conga/luci/homebase/form-macros 2007/09/11 16:04:33 1.60
+++ conga/luci/homebase/form-macros 2007/09/25 03:51:21 1.61
@@ -323,7 +323,7 @@
onchange="pwd0Change(this.form)" />
</td>
<td class="systemsTable">
- <img src="/luci/delete-row.png" class="deleteRow"
+ <img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_0')" />
</td>
@@ -372,7 +372,7 @@
<td class="systemsTable">
<img
tal:attributes="
- src python: 'trusted' in sys and '/luci/lock-ok.png' or ('fp' in sys and '/luci/lock-closed.png' or '/luci/lock-open.png');
+ src python: 'trusted' in sys and 'lock-ok.png' or ('fp' in sys and 'lock-closed.png' or 'lock-open.png');
title sys/fp | string:no key fingerprint available"
/>
<input type="hidden"
@@ -390,7 +390,7 @@
/>
</td>
<td class="systemsTable">
- <img src="/luci/delete-row.png" class="deleteRow"
+ <img src="delete-row.png" class="deleteRow"
title="delete this row"
tal:attributes="onclick python:'delete_element_id(\'__SYSTEM_ROW_%d\')' % cur_sysnum" />
</td>
@@ -620,7 +620,7 @@
onchange="pwd0Change(this.form)" />
</td>
<td class="systemsTable">
- <img src="/luci/delete-row.png" class="deleteRow"
+ <img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_0')" />
</td>
@@ -670,7 +670,7 @@
<td class="systemsTable">
<img
tal:attributes="
- src python: 'trusted' in sys and '/luci/lock-ok.png' or ('fp' in sys and '/luci/lock-closed.png' or '/luci/lock-open.png');
+ src python: 'trusted' in sys and 'lock-ok.png' or ('fp' in sys and 'lock-closed.png' or 'lock-open.png');
title sys/fp | string:no key fingerprint available"
/>
<input type="hidden"
@@ -688,7 +688,7 @@
/>
</td>
<td class="systemsTable">
- <img src="/luci/delete-row.png" class="deleteRow"
+ <img src="delete-row.png" class="deleteRow"
title="delete this row"
tal:attributes="onclick python:'delete_element_id(\'__SYSTEM_ROW_%d\')' % cur_sysnum" />
</td>
@@ -866,7 +866,7 @@
<td class="systemsTable">
<img
tal:attributes="
- src python: 'trusted' in sys and '/luci/lock-ok.png' or ('fp' in sys and '/luci/lock-closed.png' or '/luci/lock-open.png');
+ src python: 'trusted' in sys and 'lock-ok.png' or ('fp' in sys and 'lock-closed.png' or 'lock-open.png');
title sys/fp | string:no key fingerprint available" />
<input type="hidden"
tal:condition="exists: sys/fp"
@@ -983,7 +983,7 @@
<td class="systemsTable">
<img tal:attributes="
title sys/fp | string:no key fingerprint available;
- src python: 'trusted' in cur_sys and '/luci/lock-ok.png' or ('fp' in cur_sys and '/luci/lock-closed.png' or '/luci/lock-open.png')"
+ src python: 'trusted' in cur_sys and 'lock-ok.png' or ('fp' in cur_sys and 'lock-closed.png' or 'lock-open.png')"
/>
</td>
<td class="systemsTable">
--- conga/luci/homebase/homebase_common.js 2007/07/12 22:35:39 1.20
+++ conga/luci/homebase/homebase_common.js 2007/09/25 03:51:21 1.21
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function set_form_err(ielem) {
if (ielem) {
ielem.className += ' formerror';
@@ -268,7 +277,7 @@
var dcol = document.createElement('td');
dcol.className = 'systemsTable';
var del_img = document.createElement('img');
- del_img.src = '/luci/delete-row.png';
+ del_img.src = 'delete-row.png';
del_img.title = 'delete this row';
del_img.className = 'deleteRow';
del_img.onclick = new Function('delete_element_id(\'' + newrow.id + '\')');
--- conga/luci/homebase/luci_homebase.css 2007/08/09 21:05:28 1.42
+++ conga/luci/homebase/luci_homebase.css 2007/09/25 03:51:21 1.43
@@ -318,23 +318,23 @@
}
li.node_fdom {
- list-style-image: url(/luci/cluster/small_fdom.png);
+ list-style-image: url(small_fdom.png);
}
li.node_active {
- list-style-image: url(/luci/cluster/small_node_active.png);
+ list-style-image: url(small_node_active.png);
}
li.node_inactive {
- list-style-image: url(/luci/cluster/small_node_inactive.png);
+ list-style-image: url(small_node_inactive.png);
}
li.node_unknown {
- list-style-image: url(/luci/cluster/small_node_unknown.png);
+ list-style-image: url(small_node_unknown.png);
}
li.cluster_service {
- list-style-image:url(/luci/cluster/small_svc.png);
+ list-style-image:url(small_svc.png);
}
strong.node,
--- conga/luci/homebase/validate_cluster_add.js 2007/07/27 16:43:47 1.11
+++ conga/luci/homebase/validate_cluster_add.js 2007/09/25 03:51:21 1.12
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
--- conga/luci/homebase/validate_cluster_add_initial.js 2007/07/11 22:47:07 1.2
+++ conga/luci/homebase/validate_cluster_add_initial.js 2007/09/25 03:51:21 1.3
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
--- conga/luci/homebase/validate_perm.js 2007/07/11 22:47:07 1.3
+++ conga/luci/homebase/validate_perm.js 2007/09/25 03:51:21 1.4
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
--- conga/luci/homebase/validate_sys_add.js 2007/07/11 22:47:07 1.2
+++ conga/luci/homebase/validate_sys_add.js 2007/09/25 03:51:21 1.3
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
--- conga/luci/homebase/validate_sys_remove.js 2007/07/11 22:47:07 1.4
+++ conga/luci/homebase/validate_sys_remove.js 2007/09/25 03:51:21 1.5
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
var selected_clusters = [];
--- conga/luci/homebase/validate_user_add.js 2007/07/11 22:47:07 1.4
+++ conga/luci/homebase/validate_user_add.js 2007/09/25 03:51:21 1.5
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
--- conga/luci/homebase/validate_user_del.js 2007/07/11 22:47:07 1.3
+++ conga/luci/homebase/validate_user_del.js 2007/09/25 03:51:21 1.4
@@ -1,3 +1,12 @@
+/*
+** Copyright (C) 2006-2007 Red Hat, Inc.
+**
+** This program is free software; you can redistribute
+** it and/or modify it under the terms of version 2 of the
+** GNU General Public License as published by the
+** Free Software Foundation.
+*/
+
function validateForm(form) {
var errors = [];
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-25 3:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-25 3:51 [Cluster-devel] conga/luci/homebase form-macros homebase_commo rmccabe
-- strict thread matches above, loose matches on Subject: below --
2006-09-27 22:49 rmccabe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).