* [Cluster-devel] conga/luci homebase/form-macros homebase/homeb ...
@ 2007-07-11 22:47 rmccabe
0 siblings, 0 replies; 2+ messages in thread
From: rmccabe @ 2007-07-11 22:47 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-07-11 22:47:08
Modified files:
luci/homebase : form-macros homebase_common.js
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
luci/cluster : fence_device.js form-macros
resource-form-macros resource_form_handlers.js
validate_fence.js
Log message:
Fixes for MSIE support
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.57&r2=1.58
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add.js.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add_initial.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_perm.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_add.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_remove.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.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_user_del.js.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.200&r2=1.201
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
--- conga/luci/homebase/form-macros 2007/06/25 16:03:38 1.57
+++ conga/luci/homebase/form-macros 2007/07/11 22:47:07 1.58
@@ -69,7 +69,7 @@
<div class="hbSubmit" tal:condition="python:userList" id="hbSubmit">
<input name="Submit" type="button" value="Delete This User"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</form>
@@ -136,7 +136,7 @@
<div class="hbSubmit" id="hbSubmit">
<input name="Submit" type="button" value="Submit"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</form>
</div>
@@ -189,7 +189,7 @@
<span tal:content="string:Select a User" /><br/>
<select class="homebase" name="userList"
- onChange="document.location = '/luci/homebase/?pagetype=3&user=' + this.form.userList.options[this.form.userList.selectedIndex].text">
+ onchange="document.location = '/luci/homebase/?pagetype=3&user=' + this.form.userList.options[this.form.userList.selectedIndex].text">
<tal:block tal:define="userlist python: perms">
<tal:block tal:repeat="user userlist">
<option class="homebase"
@@ -247,7 +247,7 @@
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Update Permissions"
value="Update Permissions"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</tal:block>
@@ -308,7 +308,7 @@
</tr>
</thead>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable" id="__SYSTEM_ROW_0">
<td class="systemsTable">
<input class="hbInputSys" type="text"
@@ -320,7 +320,7 @@
id="__SYSTEM0:Passwd"
name="__SYSTEM0:Passwd"
class="hbInputPass"
- onChange="pwd0Change(this.form)" />
+ onchange="pwd0Change(this.form)" />
</td>
<td class="systemsTable">
<img src="/luci/delete-row.png" class="deleteRow"
@@ -343,7 +343,7 @@
</thead>
<tal:block tal:define="global cur_sysnum python: 0" />
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tal:block tal:repeat="cur_sys new_systems">
<tr class="systemsTable"
tal:attributes="
@@ -363,7 +363,7 @@
<input type="password"
autocomplete="off"
class="hbInputPass"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
tal:attributes="
id python: '__SYSTEM%d:Passwd' % cur_sysnum;
name python: '__SYSTEM%d:Passwd' % cur_sysnum;
@@ -414,7 +414,7 @@
<li class="vanilla"
tal:attributes="id python: cur_sysnum < 2 and 'allSameDiv' or ''">
<input type="checkbox" name="allSameCheckBox"
- id="allSameCheckBox" onClick="allPasswdsSame(this.form)" />
+ id="allSameCheckBox" onclick="allPasswdsSame(this.form)" />
Check if system passwords are identical.
</li>
</ul>
@@ -423,7 +423,7 @@
<tr class="systemsTable"><td class="systemsTable" colspan="2">
<div class="systemsTableEnd">
<input type="button" value="Add another entry"
- onClick="addSystem(this.form)" />
+ onclick="addSystem(this.form)" />
</div>
</td></tr>
</tfoot>
@@ -436,7 +436,7 @@
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Submit" value="Submit"
- onClick="validateAuth(this.form)" />
+ onclick="validateAuth(this.form)" />
</div>
<tal:block tal:condition="exists: request/SESSION/auth_status">
@@ -542,7 +542,7 @@
<div class="hbSubmit">
<input type="button" name="Submit" value="Remove selected entries"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</fieldset>
</form>
@@ -601,7 +601,7 @@
</tr>
</thead>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable" id="__SYSTEM_ROW_0">
<td class="systemsTable">
<input class="hbInputSys" type="text"
@@ -613,7 +613,7 @@
id="__SYSTEM0:Passwd"
name="__SYSTEM0:Passwd"
class="hbInputPass"
- onChange="pwd0Change(this.form)" />
+ onchange="pwd0Change(this.form)" />
</td>
<td class="systemsTable">
<img src="/luci/delete-row.png" class="deleteRow"
@@ -636,7 +636,7 @@
</thead>
<tal:block tal:define="global cur_sysnum python: 0" />
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tal:block tal:repeat="cur_sys new_systems">
<tr class="systemsTable"
tal:attributes="
@@ -656,7 +656,7 @@
<input type="password"
autocomplete="off"
class="hbInputPass"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
tal:attributes="
id python: '__SYSTEM%d:Passwd' % cur_sysnum;
name python: '__SYSTEM%d:Passwd' % cur_sysnum;
@@ -706,14 +706,14 @@
onchange="view_certs_only(this.form, this.checked)"
type="checkbox">View system certificates before sending any passwords.</li>
<li class="vanilla"
- tal:attributes="id python: cur_sysnum < 2 and 'allSameDiv' or ''"><input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" onClick="allPasswdsSame(this.form);"/>Check if storage system passwords are identical.</li>
+ tal:attributes="id python: cur_sysnum < 2 and 'allSameDiv' or ''"><input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" onclick="allPasswdsSame(this.form);"/>Check if storage system passwords are identical.</li>
</ul>
</td></tr>
<tr class="systemsTable"><td class="systemsTable" colspan="2">
<div class="systemsTableEnd">
<input type="button" value="Add another entry"
- onClick="addSystem(this.form)" />
+ onclick="addSystem(this.form)" />
</div>
</td></tr>
</tfoot>
@@ -724,7 +724,7 @@
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Submit" value="Submit"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</form>
</div>
@@ -805,7 +805,7 @@
<li class="vanilla" id="allSameDiv">
<li class="vanilla" tal:condition="not: exists: add_cluster/complete">
<input type="checkbox" name="allSameCheckBox"
- id="allSameCheckBox" onClick="allPasswdsSame(this.form)"
+ id="allSameCheckBox" onclick="allPasswdsSame(this.form)"
tal:attributes="checked python: add_cluster['identical_passwds'] and 'checked'"
/>
@@ -823,7 +823,8 @@
<tal:block tal:define="global cur_sysnum python:0" />
- <tbody class="systemsTable" tal:condition="add_cluster/nodes">
+ <tbody class="systemsTable" id="sys_tbody"
+ tal:condition="add_cluster/nodes">
<tal:block tal:repeat="cur_sys add_cluster/nodes">
<tr class="systemsTable"
tal:define="sys python: add_cluster['nodes'][cur_sys]">
@@ -841,7 +842,7 @@
<tal:block tal:condition="not: exists: sys/auth">
<input type="password"
autocomplete="off"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
tal:attributes="
value nothing;
class python: 'hbInputPass' + ('errors' in sys and ' error' or '');
@@ -850,7 +851,7 @@
</tal:block>
<tal:block tal:condition="exists: sys/auth">
- <input type="text" onChange="pwd0Change(this.form)"
+ <input type="text" onchange="pwd0Change(this.form)"
disabled="disabled" value="[authenticated]"
tal:attributes="
class python: 'hbInputPass' + ('errors' in sys and ' error' or '');
@@ -889,7 +890,7 @@
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Submit" value="Add This Cluster"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</form>
@@ -958,7 +959,7 @@
</td></tr>
</tfoot>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable">
<td class="systemsTable">
<input class="hbInputSys" type="text"
@@ -968,7 +969,7 @@
</td>
<td class="systemsTable">
<input class="hbInputPass" type="password"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
autocomplete="off"
id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd"
tal:attributes="
@@ -997,7 +998,7 @@
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Submit" value="Submit"
- onClick="validateForm(this.form)" />
+ onclick="validateForm(this.form)" />
</div>
</form>
</div>
--- conga/luci/homebase/homebase_common.js 2007/02/09 18:30:44 1.17
+++ conga/luci/homebase/homebase_common.js 2007/07/11 22:47:07 1.18
@@ -1,28 +1,34 @@
function set_form_err(ielem) {
- if (ielem)
+ if (ielem) {
ielem.className += ' formerror';
+ }
}
function clr_form_err(ielem) {
- if (ielem)
+ if (ielem) {
ielem.className = ielem.className.replace(/( )?formerror/, '');
+ }
}
function toggle_visible(img_obj, elem_id, label_id) {
- var elem = document.getElementById(elem_id)
- if (!elem)
+ var elem = document.getElementById(elem_id);
+ if (!elem) {
return (-1);
+ }
var old_state = !!!elem.className.match(/invisible/i);
if (label_id) {
- var label = document.getElementById(label_id);
- if (!label)
+ var label_obj = document.getElementById(label_id);
+ if (!label_obj) {
return (-1);
- if (old_state)
- label.innerHTML = 'Show';
- else
- label.innerHTML = 'Hide';
+ }
+
+ if (old_state) {
+ label_obj.innerHTML = 'Show';
+ } else {
+ label_obj.innerHTML = 'Hide';
+ }
}
if (old_state) {
@@ -38,21 +44,26 @@
}
function is_valid_int(str, min, max) {
- if (str.match(/[^0-9 -]/))
+ if (str.match(/[^0-9 -]/)) {
return (0);
+ }
var val = parseInt(str, 10);
- if (isNaN(val))
+ if (isNaN(val)) {
return (0);
- if (min !== null && val < min)
+ }
+ if (min !== null && val < min) {
return (0);
- if (max !== null && val > max)
+ }
+ if (max !== null && val > max) {
return (0);
+ }
return (1);
}
function error_dialog(errors) {
- if (!errors || errors.length < 1)
+ if (!errors || errors.length < 1) {
return (null);
+ }
alert('The following errors were found:\n\n' + errors.join('\n'));
return (-1);
}
@@ -62,32 +73,38 @@
}
function str_is_valid(str, valid_regex_str) {
- if (!str || !valid_regex_str)
+ if (!str || !valid_regex_str) {
return (null);
+ }
var re = eval(valid_regex_str);
var invalid = str.replace(re, '');
- if (!invalid)
+ if (!invalid) {
return (null);
+ }
return (invalid);
}
function checkAllBoxes(str, val) {
var i = 0;
var element;
- while ((element = document.getElementById(str + i++)))
+ while ((element = document.getElementById(str + i++))) {
element.checked = val;
+ }
}
function checkChildren(parent_cont, parent_input) {
- if (!parent_cont || !parent_input)
+ if (!parent_cont || !parent_input) {
return;
+ }
var parent = document.getElementById(parent_cont);
var children = parent.getElementsByTagName('input');
for (var i = 0 ; i < children.length ; i++) {
- if (children[i] == parent_input)
+ if (children[i] === parent_input) {
continue;
- if (children[i].type == 'checkbox')
+ }
+ if (children[i].type === 'checkbox') {
children[i].checked = parent_input.checked;
+ }
}
}
@@ -102,20 +119,21 @@
function isValidHost(str) {
var i = str.split('.');
- if (i.length == 1)
+ if (i.length === 1) {
return ('Hostnames must be fully qualified.');
+ }
- if (i.length == 4 && !isNaN(parseInt(i[3]))) {
+ if (i.length === 4 && !isNaN(parseInt(i[3]))) {
var o1 = parseInt(i[0]);
var o2 = parseInt(i[1]);
var o3 = parseInt(i[2]);
var o4 = parseInt(i[3]);
if (isNaN(o1) || isNaN(o2) || isNaN(o3) ||
- ((o1 & 0xff) != o1) ||
- ((o2 & 0xff) != o2) ||
- ((o3 & 0xff) != o3) ||
- ((o4 & 0xff) != o4))
+ ((o1 & 0xff) !== o1) ||
+ ((o2 & 0xff) !== o2) ||
+ ((o3 & 0xff) !== o3) ||
+ ((o4 & 0xff) !== o4))
{
return ('Invalid IP Address.');
}
@@ -123,24 +141,28 @@
return (null);
}
- if (!isNaN(parseInt(i[i.length - 1])))
+ if (!isNaN(parseInt(i[i.length - 1]))) {
return ('Invalid IP Address.');
+ }
- if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.-]*$/))
+ if (!str.match(/^[0-9A-Za-z][0-9A-Za-z.-]*$/)) {
return ('Hostnames can contain only alphanumeric characters and hyphens.');
+ }
return (null);
}
function view_certs_only(form, state) {
var num_systems = form.numStorage.value;
- if (!form.numStorage)
+ if (!form.numStorage) {
return (-1);
+ }
if (state) {
var cb = document.getElementById('allSameCheckBox');
- if (cb && cb.checked)
+ if (cb && cb.checked) {
cb.checked = false;
+ }
}
for (var i = 0 ; i < num_systems ; i++) {
@@ -154,8 +176,9 @@
function allPasswdsSame(form) {
var cb = document.getElementById('allSameCheckBox');
- if (!cb)
+ if (!cb) {
return (-1);
+ }
var num_systems = form.numStorage.value;
var state = cb.checked;
@@ -164,22 +187,25 @@
var first_system = 0;
for (var i = 0 ; i < num_systems ; i++) {
var passwd = document.getElementById('__SYSTEM' + i + ':Passwd');
- if (!passwd || passwd.type != 'password')
- continue
+ if (!passwd || passwd.type !== 'password') {
+ continue;
+ }
first_passwd = passwd.value;
first_system = i;
break;
}
- if (first_passwd === null)
+ if (first_passwd === null) {
return (-1);
+ }
- if (!first_passwd || !state)
+ if (!first_passwd || !state) {
first_passwd = '';
+ }
for (var i = first_system + 1 ; i < num_systems ; i++) {
var element = document.getElementById('__SYSTEM' + i + ':Passwd');
- if (element && element.type == 'password') {
+ if (element && element.type === 'password') {
element.value = first_passwd;
element.disabled = state;
}
@@ -188,21 +214,24 @@
function delete_element_id(id_str) {
var elem = document.getElementById(id_str);
- if (!elem || !elem.parentNode)
+ if (!elem || !elem.parentNode) {
return (-1);
+ }
elem.parentNode.removeChild(elem);
}
function pwd0Change(form) {
var element = document.getElementById('allSameCheckBox');
- if (element && element.checked)
+ if (element && element.checked) {
allPasswdsSame(form);
+ }
}
function addSystem(form) {
- var sltab = document.getElementById('systemsTable');
- if (!sltab)
+ var sltab = document.getElementById('sys_tbody');
+ if (!sltab) {
return;
+ }
var num_systems = form.numStorage.value;
var newsys = document.createElement('input');
@@ -223,8 +252,9 @@
var first_passwd = '';
for (var i = 0 ; i < num_systems - 1 ; i++) {
var pwd = document.getElementById('__SYSTEM' + i + ':Passwd');
- if (!pwd || pwd.type != 'password')
+ if (!pwd || pwd.type !== 'password') {
continue;
+ }
first_passwd = pwd.value;
break;
}
@@ -247,20 +277,20 @@
dcol.className = 'systemsTable';
var del_img = document.createElement('img');
del_img.src = '/luci/delete-row.png';
- del_img.title = 'delete this row'
- del_img.className = 'deleteRow'
- del_img.setAttribute('onClick', 'delete_element_id(\'' + newrow.id + '\')');
- dcol.appendChild(del_img);
+ del_img.title = 'delete this row';
+ del_img.className = 'deleteRow';
+ del_img.onclick = new Function('delete_element_id(\'' + newrow.id + '\')');
+ sltab.appendChild(newrow);
+ dcol.appendChild(del_img);
hcol.appendChild(newsys);
pcol.appendChild(newsysp);
newrow.appendChild(hcol);
newrow.appendChild(pcol);
newrow.appendChild(dcol);
- sltab.appendChild(newrow);
form.numStorage.value = ++num_systems;
- if (num_systems == 2) {
+ if (num_systems === 2) {
var temp = document.getElementById('allSameDiv');
temp.style.visibility = 'visible';
temp.style.display = 'block';
@@ -269,20 +299,22 @@
function validate_systems(form, errors) {
var allSameCB = document.getElementById('allSameCheckBox');
- var added_storage = new Array();
+ var added_storage = [];
var num_systems = form.numStorage.value;
var view_certs = document.getElementById('view_certs');
- if (view_certs)
+ if (view_certs) {
view_certs = view_certs.checked;
- else
+ } else {
view_certs = false;
+ }
for (var i = 0 ; i < num_systems ; i++) {
var element = document.getElementById('__SYSTEM' + i + ':Addr');
- if (!element)
+ if (!element) {
continue;
+ }
element.disabled = false;
var pwdElem = document.getElementById('__SYSTEM' + i + ':Passwd');
@@ -292,11 +324,13 @@
if (!allSameCB || !allSameCB.checked) {
errors.push('You entered a password, but no hostname for system ' + (i + 1));
clr_form_err(pwdElem);
- } else
+ } else {
pwdElem.value = '';
+ }
}
- if (pwdElem)
+ if (pwdElem) {
clr_form_err(pwdElem);
+ }
continue;
}
@@ -316,8 +350,9 @@
} else if (str_is_blank(pwdElem.value)) {
errors.push('The password entered for \"' + element.value + '\" is blank.');
set_form_err(pwdElem);
- } else
+ } else {
clr_form_err(pwdElem);
+ }
if (str_is_blank(element.value)) {
errors.push('You entered a blank hostname for system ' + (i + 1));
--- conga/luci/homebase/validate_cluster_add.js 2007/06/25 16:03:38 1.9
+++ conga/luci/homebase/validate_cluster_add.js 2007/07/11 22:47:07 1.10
@@ -1,8 +1,9 @@
function validateForm(form) {
- var errors = new Array();
+ var errors = [];
- if (!form)
+ if (!form) {
return (-1);
+ }
var clustername = form.clustername;
if (!clustername || str_is_blank(clustername.value)) {
@@ -18,34 +19,41 @@
if (invalid_chars) {
errors.push('The cluster name you gave contains the following invalid characters: "' + invalid_chars + '".');
set_form_err(form.clustername);
- } else
+ } else {
clr_form_err(form.clustername);
+ }
}
}
var added_storage = validate_systems(form, errors);
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
- if (!added_storage || added_storage.length < 1)
+ if (!added_storage || added_storage.length < 1) {
errors.push('You have not added any cluster nodes.');
+ }
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
var view_certs = document.getElementById('view_certs');
if (!view_certs || !view_certs.checked) {
var confirm_str = '';
- if (form.addnode)
+ if (form.addnode) {
confirm_str = 'Add ' + (added_storage.length > 1 ? 'these nodes' : 'this node') + ' to the \"' + clustername + '\" cluster?';
- else
+ } else {
confirm_str = 'Add the cluster \"' + clustername + '\" to the Luci management interface?';
+ }
- if (confirm(confirm_str))
+ if (confirm(confirm_str)) {
form.submit();
- } else
+ }
+ } else {
form.submit();
+ }
return (0);
}
--- conga/luci/homebase/validate_cluster_add_initial.js 2006/07/18 19:25:20 1.1
+++ conga/luci/homebase/validate_cluster_add_initial.js 2007/07/11 22:47:07 1.2
@@ -1,22 +1,28 @@
function validateForm(form) {
- var errors = new Array();
+ var errors = [];
- if (!form)
+ if (!form) {
return (-1);
+ }
var added_storage = validate_systems(form, errors);
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
- if (!added_storage || added_storage.length < 1)
+ if (!added_storage || added_storage.length < 1) {
errors.push('You have not added any cluster nodes.');
+ }
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
if (confirm('Retrieve cluster information from ' + added_storage[0] + '?'))
+ {
form.submit();
+ }
return (0);
}
--- conga/luci/homebase/validate_perm.js 2006/06/30 23:07:32 1.2
+++ conga/luci/homebase/validate_perm.js 2007/07/11 22:47:07 1.3
@@ -1,48 +1,58 @@
function validateForm(form) {
- var errors = new Array();
+ var errors = [];
- if (!form || !form.userList)
+ if (!form || !form.userList) {
return (-1);
+ }
var userIdx = form.userList.selectedIndex;
- if (userIdx < 0 || !form.userList.options[userIdx].value)
+ if (userIdx < 0 || !form.userList.options[userIdx].value) {
errors.push('You have not selected a valid user.');
+ }
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
var username = form.userList.options[userIdx].value;
- var selected_clusters = new Array();
- var selected_storage = new Array();
+ var selected_clusters = [];
+ var selected_storage = [];
- if (!form)
+ 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)
+ 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)
+ if (!element || !element.value || !element.checked) {
continue;
+ }
selected_storage.push(element.value);
}
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
- if (selected_clusters.length + selected_storage.length < 1)
+ var confirm_str = '';
+ if (selected_clusters.length + selected_storage.length < 1) {
confirm_str = 'Remove all permissions for ' + username + '?';
- else
+ } else {
confirm_str = 'Modify permissions for ' + username + '?';
+ }
- if (confirm(confirm_str))
+ if (confirm(confirm_str)) {
form.submit();
+ }
return (0);
}
--- conga/luci/homebase/validate_sys_add.js 2006/06/30 18:06:10 1.1
+++ conga/luci/homebase/validate_sys_add.js 2007/07/11 22:47:07 1.2
@@ -1,12 +1,14 @@
function validateForm(form) {
- var errors = new Array();
+ var errors = [];
- if (!form)
+ if (!form) {
return (-1);
+ }
var added_storage = validate_systems(form, errors);
- if (error_dialog(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')))
--- conga/luci/homebase/validate_sys_remove.js 2006/12/21 05:08:48 1.3
+++ conga/luci/homebase/validate_sys_remove.js 2007/07/11 22:47:07 1.4
@@ -1,65 +1,77 @@
function validateForm(form) {
- var errors = new Array();
- var selected_clusters = new Array();
- var selected_storage = new Array();
+ var errors = [];
+ var selected_clusters = [];
+ var selected_storage = [];
- if (!form)
+ if (!form) {
return (-1);
+ }
var num_clusters = document.getElementById('num_clusters').value;
for (var i = 0 ; i < num_clusters ; i++) {
var element = document.getElementById('__CLUSTER' + i);
- if (!element || !element.value || !element.checked)
+ if (!element || !element.value || !element.checked) {
continue;
+ }
selected_clusters.push(element.value);
}
var num_storage = document.getElementById('num_storage').value;
for (var i = 0 ; i < num_storage ; i++) {
var element = document.getElementById('__SYSTEM' + i);
- if (!element || !element.value || !element.checked)
+ if (!element || !element.value || !element.checked) {
continue;
+ }
selected_storage.push(element.value);
}
- if (selected_clusters.length + selected_storage.length < 1)
+ if (selected_clusters.length + selected_storage.length < 1) {
return (0);
+ }
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
var confirm_str = 'Do you really want to remove the following managed systems:';
- if (selected_clusters.length > 0)
+ if (selected_clusters.length > 0) {
confirm_str += '\nClusters:\n-' + selected_clusters.join('\n-');
+ }
if (selected_storage.length > 0) {
- if (selected_clusters.length > 0)
+ if (selected_clusters.length > 0) {
confirm_str += '\n';
+ }
confirm_str += '\nStorage Systems:\n-' + selected_storage.join('\n-');
}
- if (confirm(confirm_str))
+ if (confirm(confirm_str)) {
form.submit();
+ }
return (0);
}
function validateAuth(form) {
- var errors = new Array();
+ var errors = [];
- if (!form)
+ if (!form) {
return (-1);
+ }
var added_storage = validate_systems(form, errors);
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
- if (!added_storage || added_storage.length < 1)
+ if (!added_storage || added_storage.length < 1) {
errors.push('You have not specified any hosts.');
+ }
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
form.submit();
return (0);
--- conga/luci/homebase/validate_user_add.js 2006/10/04 16:39:07 1.3
+++ conga/luci/homebase/validate_user_add.js 2007/07/11 22:47:07 1.4
@@ -1,8 +1,9 @@
function validateForm(form) {
- var errors = new Array()
+ var errors = [];
- if (!form)
+ if (!form) {
return (-1);
+ }
if (!form.newUserName || !form.newUserName.value) {
errors.push('You did not enter a user name.');
@@ -12,8 +13,9 @@
if (invalid) {
errors.push('The user name you specified contains the following invalid characters: "' + invalid + '"');
set_form_err(form.newUserName);
- } else
+ } else {
clr_form_err(form.newUserName);
+ }
}
if (!form.newPassword || !form.newPassword.value) {
@@ -43,9 +45,13 @@
}
}
- if (error_dialog(errors))
+ 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/09/27 22:49:09 1.2
+++ conga/luci/homebase/validate_user_del.js 2007/07/11 22:47:07 1.3
@@ -1,8 +1,9 @@
function validateForm(form) {
- var errors = new Array();
+ var errors = [];
- if (!form || !form.deluserId)
+ if (!form || !form.deluserId) {
return (-1);
+ }
var userIdx = form.deluserId.selectedIndex;
if (userIdx <= 0 ||
@@ -13,8 +14,10 @@
return (-1);
}
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
+
if (confirm('Do you really want to remove the user \"' +
form.deluserId.options[userIdx].value + '\"?'))
{
--- conga/luci/cluster/fence_device.js 2007/01/25 21:03:46 1.11
+++ conga/luci/cluster/fence_device.js 2007/07/11 22:47:07 1.12
@@ -1,5 +1,5 @@
-var num_fences_level = Array(0, 0)
-var num_fence_instances = new Array()
+var num_fences_level = [ 0, 0 ];
+var num_fence_instances = [];
function del_fence_instance(fi_div_id) {
delete_element_id(fi_div_id);
@@ -11,8 +11,9 @@
function add_fence_instance(fi_cont_id, fence_type) {
var instance_div = document.getElementById(fi_cont_id + '_instances');
- if (!instance_div)
+ if (!instance_div) {
return (-1);
+ }
var fi_form = document.getElementById(fence_type + '_instance');
if (fi_form) {
@@ -49,13 +50,16 @@
var child_element = document.getElementById(element_id);
if (!child_element) {
- if (container_element.firstChild)
+ if (container_element.firstChild) {
container_element.removeChild(container_element.firstChild);
+ }
return (-1);
}
- if (container_element.firstChild)
+ if (container_element.firstChild) {
container_element.removeChild(container_element.firstChild);
+ }
+
var target = child_element.cloneNode(1);
target.id = null;
container_element.appendChild(target);
@@ -63,15 +67,21 @@
function swap_node_fence_div(container_id, fence_opt) {
var container_element = document.getElementById(container_id);
- if (!container_element || !fence_opt || !fence_opt.value)
+ if (!container_element) {
return (-1);
+ }
+ if (!container_element || !fence_opt || !fence_opt.value) {
+ return (-1);
+ }
var fence_id = fence_opt.value;
var child_element = document.getElementById(fence_id);
- if (!child_element)
+ if (!child_element) {
return (-1);
- if (container_element.firstChild)
+ }
+ if (container_element.firstChild) {
container_element.removeChild(container_element.firstChild);
+ }
var target = child_element.cloneNode(1);
target.id = '';
@@ -82,8 +92,9 @@
for (var i = 0 ; i < input_tags.length ; i++) {
if (input_tags[i].type != 'button') {
input_tags[i].disabled = true;
- if (input_tags[i].name == 'fence_type')
+ if (input_tags[i].name == 'fence_type') {
fence_type = input_tags[i].value;
+ }
}
}
}
@@ -144,8 +155,9 @@
var remove_form = document.createElement('form');
remove_form.appendChild(remove_button);
- if (sharable)
+ if (sharable) {
remove_form.appendChild(add_instance_button);
+ }
remove_div.appendChild(remove_form);
container_element.appendChild(remove_div);
}
@@ -153,38 +165,45 @@
function add_node_fence_device(fence_level) {
var cont_name = 'fence_list_level' + fence_level;
var container = document.getElementById(cont_name);
- if (!container)
+ if (!container) {
return (-1);
+ }
- var chooser_elem = document.getElementById('fence_selection_block');
- if (!chooser_elem)
+ var chooser_elem_orig = document.getElementById('fence_selection_block');
+ if (!chooser_elem_orig) {
return (-1);
+ }
var div_elem = document.createElement('div');
- if (!div_elem)
+ if (!div_elem) {
return (-1);
+ }
var level_num_fences = num_fences_level[fence_level - 1];
div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
div_elem.className = 'fence_level';
- chooser_elem = chooser_elem.cloneNode(1);
+
+ var chooser_elem = chooser_elem_orig.cloneNode(1);
chooser_elem.id = null;
chooser_elem.className = null;
var input_elems = chooser_elem.getElementsByTagName('input');
- if (!input_elems || input_elems.length < 2)
+ if (!input_elems || input_elems.length < 2) {
return (-1);
+ }
for (var i = 0 ; i < input_elems.length ; i++) {
- if (input_elems[i].name == 'fence_level')
+ if (input_elems[i].name == 'fence_level') {
input_elems[i].value = fence_level;
- else if (input_elems[i].name == 'fence_num')
+ } else if (input_elems[i].name == 'fence_num') {
input_elems[i].value = level_num_fences++;
+ }
}
-
var select_elem = chooser_elem.getElementsByTagName('select');
- if (!select_elem || select_elem.length != 1)
+ if (!select_elem || select_elem.length !== 1) {
return (-1);
- select_elem[0].setAttribute('onChange', "swap_node_fence_div('" + div_elem.id + "', this.options[this.selectedIndex])");
+ }
+ select_elem = select_elem[0];
+ select_elem.onchange = new Function("swap_node_fence_div('" + div_elem.id + "', this.options[this.selectedIndex])");
div_elem.appendChild(chooser_elem);
container.appendChild(div_elem);
--- conga/luci/cluster/form-macros 2007/06/25 16:11:30 1.200
+++ conga/luci/cluster/form-macros 2007/07/11 22:47:07 1.201
@@ -384,7 +384,7 @@
<tal:block tal:define="global cur_sysnum python:0" />
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tal:block
tal:condition="exists: add_cluster/nodes"
tal:repeat="cur_sys add_cluster/nodes">
@@ -404,7 +404,7 @@
<td class="systemsTable">
<tal:block tal:condition="not: exists: sys/auth">
<input type="password"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
autocomplete="off"
tal:attributes="
value nothing;
@@ -414,7 +414,7 @@
</tal:block>
<tal:block tal:condition="exists: sys/auth">
- <input type="text" onChange="pwd0Change(this.form)"
+ <input type="text" onchange="pwd0Change(this.form)"
disabled="disabled" value="[authenticated]"
tal:attributes="
class python: 'hbInputPass' + ('errors' in sys and ' error' or '');
@@ -461,9 +461,8 @@
</td>
<td class="systemsTable">
<input type="password"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
class="hbInputPass" autocomplete="off"
- onChange="pwd0Change(this.form)"
id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" />
</td>
<td class="systemsTable">
@@ -480,7 +479,7 @@
</td>
<td class="systemsTable">
<input type="password"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
class="hbInputPass" autocomplete="off"
id="__SYSTEM1:Passwd" name="__SYSTEM1:Passwd" />
</td>
@@ -498,7 +497,7 @@
</td>
<td class="systemsTable">
<input type="password"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
class="hbInputPass" autocomplete="off"
id="__SYSTEM2:Passwd" name="__SYSTEM2:Passwd" />
</td>
@@ -609,7 +608,7 @@
</td></tr>
</thead>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable">
<td class="systemsTable">Cluster Name</td>
<td class="systemsTable">
@@ -943,7 +942,7 @@
</td></tr>
</thead>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable">
<td class="systemsTable">Post Fail <span tal:attributes="onclick python:'window.location.assign(\'./?pagetype=80&clustername=' + request['clustername'] + '\')'">Delay</span>
</td>
@@ -1009,7 +1008,7 @@
</td></tr>
</thead>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable">
<td class="systemsTable">
<input type="radio" name="mcast" value="False"
@@ -1093,7 +1092,7 @@
</td></tr>
</thead>
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tr class="systemsTable" id="st_row"><td class="systemsTable" id="st_col">
<input type="radio" name="quorumd" value="False"
onClick="disableChildrenInput('quorumdisk');"
@@ -1314,7 +1313,7 @@
<th class="systemsTable">Lock Server</th>
</tr>
</thead>
- <tbody>
+ <tbody id="sys_tbody">
<tal:block tal:repeat="c clusterinfo/gulm_lockservers">
<tr class="systemsTable">
<td class="systemsTable">
@@ -3274,7 +3273,7 @@
<div id="fence_selection_block" class="invisible">
<form name="main_fence_form">
- <select name="select_div">
+ <select name="select_div" onchange="alert('ALERT')">
<option value="fence-form-new-device">------ Use an existing Fence Device ------</option>
<tal:block tal:repeat="f fencedevinfo/fencedevs">
<option class="shared_fencedev"
@@ -3731,7 +3730,7 @@
<tal:block tal:define="global cur_sysnum python:0" />
- <tbody class="systemsTable">
+ <tbody class="systemsTable" id="sys_tbody">
<tal:block
tal:condition="exists: add_cluster/nodes"
tal:repeat="cur_sys add_cluster/nodes">
@@ -3752,7 +3751,7 @@
<tal:block tal:condition="not: exists: sys/auth">
<input type="password"
autocomplete="off"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
tal:attributes="
value nothing;
class python: 'hbInputPass' + ('errors' in sys and ' error' or '');
@@ -3761,7 +3760,7 @@
</tal:block>
<tal:block tal:condition="exists: sys/auth">
- <input type="text" onChange="pwd0Change(this.form)"
+ <input type="text" onchange="pwd0Change(this.form)"
disabled="disabled" value="[authenticated]"
tal:attributes="
class python: 'hbInputPass' + ('errors' in sys and ' error' or '');
@@ -3808,9 +3807,8 @@
</td>
<td class="systemsTable">
<input type="password"
- onChange="pwd0Change(this.form)"
+ onchange="pwd0Change(this.form)"
class="hbInputPass" autocomplete="off"
- onChange="pwd0Change(this.form)"
id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" />
</td>
<td class="systemsTable">
@@ -4976,7 +4974,7 @@
<td class="cluster node fence_main fence">
<form name="main_fence_form">
<select name="select_div"
- onChange="swap_fence_div('fence_container',
+ onchange="swap_fence_div('fence_container',
this.options[this.selectedIndex].value)">
<tal:block metal:use-macro="here/form-macros/macros/shared-fence-option-list" />
</select>
--- conga/luci/cluster/resource-form-macros 2007/06/25 16:03:37 1.38
+++ conga/luci/cluster/resource-form-macros 2007/07/11 22:47:07 1.39
@@ -102,8 +102,7 @@
<strong class="reshdr">Select a Resource Type</strong>
</p>
- <p class="reshdr">
- <form>
+ <form>
<select onChange="swap_div_elem(this.form.parentNode,
this.options[this.selectedIndex].value);">
<option name="blank" value="blank" checked>
@@ -128,8 +127,7 @@
<option name="SAPDatabase" value="SAPDatabase">SAP Database</option>
<option name="SAPInstance" value="SAPInstance">SAP Instance</option>
</select>
- </form>
- </p>
+ </form>
<div name="invisible" class="invisible">
<div name="blank"> </div>
@@ -155,9 +153,10 @@
<div metal:define-macro="service-compose-macro">
<p class="reshdr">
<strong class="reshdr">Add a new local resource</strong>
- <form>
+ </p>
+ <form>
<select onChange="swap_div_elem(this.form.parentNode,
- this.options[this.selectedIndex].value);">
+ this.options[this.selectedIndex].value)">
<option checked="checked">Select a resource type</option>
<option name="IP" value="IP">IP address</option>
<option name="FS" value="FS">File system</option>
@@ -177,20 +176,21 @@
<option name="SAPDatabase" value="SAPDatabase">SAP Database</option>
<option name="SAPInstance" value="SAPInstance">SAP Instance</option>
</select>
- </form>
- </p>
+ </form>
<p style="margin-left: +5em;margin-top:1em;"><strong>or</strong></p>
<p class="reshdr">
<strong class="reshdr">Use an existing global resource</strong>
<br/>
- <form>
+ </p>
+
+ <form>
<input type="hidden" name="parent_uuid" value="" />
<input type="hidden" name="uuid" value="" />
<input type="hidden" name="tree_level" value="" />
<select id="gres_chooser"
onChange="swap_in_global_res('global_resources_block', this,
- this.form.parentNode, this.form);">
+ this.form.parentNode, this.form)">
<option checked="checked">Select a resource name</option>
<tal:block
tal:repeat="gres global_resources">
@@ -200,8 +200,7 @@
tal:content="python: gres['name'] + ' (' + gres['type'].split(':')[0] + ')'" />
</tal:block>
</select>
- </form>
- </p>
+ </form>
<div name="invisible" class="invisible">
<div name=""> </div>
--- conga/luci/cluster/resource_form_handlers.js 2007/06/25 16:11:30 1.36
+++ conga/luci/cluster/resource_form_handlers.js 2007/07/11 22:47:07 1.37
@@ -69,14 +69,14 @@
var divs = container.getElementsByTagName('div');
for (var i = 0 ; i < divs.length ; i++) {
- if (!swap_in_elem && divs[i].getAttribute('name') == swap_in_name) {
+ if (divs[i].getAttribute('name') == swap_in_name) {
swap_in_elem = divs[i];
break;
}
}
- if (!swap_in_elem)
+ if (!swap_in_elem) {
return (-1);
-
+ }
container.parentNode.replaceChild(swap_in_elem, container);
}
--- conga/luci/cluster/validate_fence.js 2007/06/25 16:11:30 1.7
+++ conga/luci/cluster/validate_fence.js 2007/07/11 22:47:07 1.8
@@ -1,4 +1,4 @@
-var fence_inst_validator = new Array();
+var fence_inst_validator = [];
fence_inst_validator['apc'] = [ 'port', 'switch' ];
fence_inst_validator['bladecenter'] = [ 'blade' ];
fence_inst_validator['brocade'] = [ 'port' ];
@@ -12,7 +12,7 @@
fence_inst_validator['wti'] = [ 'port' ];
fence_inst_validator['xvm'] = [ 'domain' ];
-var fence_validator = new Array();
+var fence_validator = [];
fence_validator['apc'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
fence_validator['bladecenter'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
fence_validator['brocade'] = [ 'ipaddr', 'login', 'passwd', 'passwd_script' ];
@@ -34,12 +34,12 @@
fence_validator['xvm'] = [];
function validate_field_str(form, form_elem) {
- var errors = new Array();
+ var errors = [];
if (!form_elem || str_is_blank(form_elem.value)) {
- if (!form_elem)
+ if (!form_elem) {
errors.push('No value was given for this field.');
- else {
+ } else {
set_form_err(form_elem);
errors.push(form_elem.name + ' values must not be blank.');
}
@@ -71,16 +71,18 @@
}
function validate_field_noop(form, form_elem) {
- if (form_elem)
+ if (form_elem) {
clr_form_err(form_elem);
+ }
return (null);
}
function validate_field_ipmilan_auth(form, form_elem) {
- var errors = new Array();
+ var errors = [];
- if (!form_elem || str_is_blank(form_elem.value))
+ if (!form_elem || str_is_blank(form_elem.value)) {
return (null);
+ }
var auth_type = form_elem.value;
if (auth_type != 'none' && auth_type != 'password' && auth_type != 'md5') {
@@ -93,7 +95,7 @@
return (null);
}
-var field_validator = new Array();
+var field_validator = [];
field_validator['ipaddr'] = validate_field_host;
field_validator['hostname'] = validate_field_host;
field_validator['login'] = validate_field_str;
@@ -119,37 +121,44 @@
field_validator['domain'] = validate_field_str;
function validate_fence(form) {
- var errors = new Array();
+ var errors = [];
- if (!form.fence_type || str_is_blank(form.fence_type.value))
+ if (!form.fence_type || str_is_blank(form.fence_type.value)) {
errors.push('No fence device was selected.');
+ }
- if (errors.length > 0)
+ if (errors.length > 0) {
return (errors);
+ }
if (!form.name || str_is_blank(form.name.value)) {
errors.push('A unique name must be given for all fence devices.');
set_form_err(form.name);
- } else
+ } else {
clr_form_err(form.name);
+ }
- if (errors.length > 0)
+ if (errors.length > 0) {
return (errors);
+ }
var fence_type = form.fence_type.value.replace(/^fence_/, '');
var fields = fence_validator[fence_type];
- if (!fields)
+ if (!fields) {
errors.push('An unknown fence device type was given: \"' + fence_type + '.\"');
+ }
- if (errors.length > 0)
+ if (errors.length > 0) {
return (errors);
+ }
for (var i = 0 ; i < fields.length ; i++) {
var field_name = fields[i];
if (form[field_name]) {
var err = field_validator[field_name](form, form[field_name]);
- if (err)
+ if (err) {
errors = errors.concat(err);
+ }
}
}
@@ -159,36 +168,43 @@
function validate_fence_form(form) {
var errors = validate_fence(form);
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
- if (confirm('Update fence device properties?'))
+ if (confirm('Update fence device properties?')) {
form.submit();
+ }
}
function validate_fence_instance(form) {
- var errors = new Array();
+ var errors = [];
- if (!form.fence_type || str_is_blank(form.fence_type.value))
+ if (!form.fence_type || str_is_blank(form.fence_type.value)) {
errors.push('The fence device associated with this instance could not be determined.');
+ }
- if (errors.length > 0)
+ if (errors.length > 0) {
return (errors);
+ }
var fence_type = form.fence_type.value.replace(/^fence_/, '');
var fields = fence_inst_validator[fence_type];
- if (!fields)
+ if (!fields) {
errors.push('An unknown fence device type was given: \"' + fence_type + '.\"');
+ }
- if (errors.length > 0)
+ if (errors.length > 0) {
return (errors);
+ }
for (var i = 0 ; i < fields.length ; i++) {
var field_name = fields[i];
if (form[field_name]) {
var err = field_validator[field_name](form, form[field_name]);
- if (err)
+ if (err) {
errors = errors.concat(err);
+ }
}
}
@@ -196,21 +212,25 @@
}
function validate_node_fence_form(master_form, container_id) {
- var errors = new Array();
+ var errors = [];
var div_elem = document.getElementById(container_id);
- if (!div_elem)
+ if (!div_elem) {
return (-1);
+ }
var form_xml = '';
var form = div_elem.getElementsByTagName('form');
for (var i = 0 ; i < form.length ; i++) {
var err = null;
- if (form[i].fence_instance)
+ if (form[i].fence_instance) {
err = validate_fence_instance(form[i]);
- else if (form[i].fence_type)
+ } else if (form[i].fence_type) {
err = validate_fence(form[i]);
- if (err)
+ }
+
+ if (err) {
errors = errors.concat(err);
+ }
var input_elem = form[i].getElementsByTagName('input');
var temp = '';
for (var j = 0 ; j < input_elem.length ; j++) {
@@ -222,10 +242,11 @@
} else if (res_type == 'checkbox' || res_type == 'radio') {
if (input_elem[j].checked) {
temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '"';
- if (res_type == 'checkbox')
+ if (res_type == 'checkbox') {
temp += ' value="1"';
- else if (res_type == 'radio')
+ } else if (res_type == 'radio') {
temp += ' value="' + escapeXML(input_elem[j].value) + '"';
+ }
temp += ' />';
} else if (res_type == 'checkbox') {
temp += '<input type="' + res_type + '" name="' + escapeXML(input_elem[j].name) + '" value="0" />';
@@ -243,9 +264,11 @@
master_form.fence_xml.value = '<formlist>' + form_xml + '</formlist>';
- if (error_dialog(errors))
+ if (error_dialog(errors)) {
return (-1);
+ }
- if (confirm('Update this node\'s fence configuration?'))
+ if (confirm('Update this node\'s fence configuration?')) {
master_form.submit();
+ }
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Cluster-devel] conga/luci homebase/form-macros homebase/homeb ...
@ 2008-01-22 15:02 rmccabe
0 siblings, 0 replies; 2+ messages in thread
From: rmccabe @ 2008-01-22 15:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2008-01-22 15:02:33
Modified files:
luci/homebase : form-macros homebase_common.js index_html
validate_cluster_add_initial.js
validate_sys_remove.js
luci/plone-custom: conga.js conga_ajax.js
luci/cluster : form-chooser form-macros index_html
Added files:
luci/plone-custom: update_hostinfo.js validate_auth.js
Log message:
sync up with my local tree
- fixes for 252348 and 230462
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/index_html.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_cluster_add_initial.js.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_sys_remove.js.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/update_hostinfo.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/validate_auth.js.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga.js.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga_ajax.js.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.218&r2=1.219
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.40&r2=1.41
--- conga/luci/homebase/form-macros 2008/01/03 16:27:49 1.64
+++ conga/luci/homebase/form-macros 2008/01/22 15:02:32 1.65
@@ -289,6 +289,9 @@
-> if yes, confirm again, showing list
</tal:comment>
+ <script type="text/javascript" src="conga_ajax.js"></script>
+ <script type="text/javascript" src="update_hostinfo.js"></script>
+ <script type="text/javascript" src="validate_auth.js"></script>
<script type="text/javascript" src="/luci/homebase/validate_sys_remove.js">
</script>
@@ -313,6 +316,7 @@
<tr class="systemsTable">
<th class="systemsTable">System Hostname</th>
<th class="systemsTable">Root Password</th>
+ <th class="systemsTable">Key ID</th>
<th class="systemsTable"></th>
</tr>
</thead>
@@ -321,6 +325,7 @@
<tr class="systemsTable" id="__SYSTEM_ROW_0">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
</td>
<td class="systemsTable">
@@ -332,6 +337,10 @@
onchange="pwd0Change(this.form)" />
</td>
<td class="systemsTable">
+ <img id="__SYSTEM0Fingerprint" src="lock-open.png"
+ title="no key fingerprint available" />
+ </td>
+ <td class="systemsTable">
<img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_0')" />
@@ -363,6 +372,7 @@
<input type="hidden" name="trust_shown" value="1" />
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
tal:attributes="
id python: '__SYSTEM%d:Addr' % cur_sysnum;
name python: '__SYSTEM%d:Addr' % cur_sysnum;
@@ -379,10 +389,10 @@
value nothing" />
</td>
<td class="systemsTable">
- <img
- tal:attributes="
- 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"
+ <img tal:attributes="
+ id python: '__SYSTEM%dFingerprint' % cur_sysnum;
+ 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"
@@ -416,10 +426,6 @@
<tfoot class="systemsTable">
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<ul class="vanilla">
- <li class="vanilla">
- <input name="check_certs" id="view_certs"
- onchange="view_certs_only(this.form, this.checked)"
- type="checkbox">View system certificates before sending any passwords.</li>
<li class="vanilla"
tal:attributes="id python: cur_sysnum < 2 and 'allSameDiv' or ''">
<input type="checkbox" name="allSameCheckBox"
@@ -441,38 +447,55 @@
<input name="numStorage" id="numStorage" type="hidden"
tal:attributes="value cur_sysnum | string:1" />
- <input type="hidden" name="pagetype" value="8" />
+ <input type="hidden" name="pagetype" value="1003" />
+
+ <div class="hbSubmit">
+ <div class="hbSubmit">
+ <input type="button" name="View SSL cert fingerprints"
+ value="View SSL cert fingerprints"
+ onclick="get_system_info('auth_retmsgsdiv', 'auth_errmsgsdiv')" />
+ </div>
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Submit" value="Submit"
onclick="validateAuth(this.form)" />
</div>
- <tal:block tal:condition="exists: request/SESSION/auth_status">
- <div class="retmsgs" id="auth_retmsgsdiv"
- tal:condition="exists: request/SESSION/auth_status/messages">
- <div class="hbclosebox">
- <a href="javascript:hide_element('auth_retmsgsdiv');"><img src="x.png" class="closeBox" title="dismiss"></a>
- </div>
- <p class="retmsgs">Status messages:</p>
- <ul class="statusmsg">
- <tal:block tal:repeat="e request/SESSION/auth_status/messages">
- <li class="statusmsg" tal:content="e" />
- </tal:block>
- </ul>
+ <tal:block tal:define="global have_retmsgs exists:request/SESSION/auth_status/messages" />
+ <tal:block tal:define="global have_errmsgs exists:request/SESSION/auth_status/errors" />
+
+ <div id="auth_retmsgsdiv"
+ tal:attributes="class python:'retmsgs' + (have_retmsgs and ' ' or ' invisible')">
+ <div class="hbclosebox">
+ <a href="javascript:hide_msgs('auth_retmsgsdiv')"><img src="x.png" class="closeBox" title="dismiss"></a>
</div>
- <div class="errmsgs" id="auth_errmsgsdiv"
- tal:condition="exists: request/SESSION/auth_status/errors">
- <div class="hbclosebox">
- <a href="javascript:hide_element('auth_errmsgsdiv');"><img src="x.png" class="closeBox" title="dismiss"></a>
- </div>
- <p class="errmsgs">The following errors occurred:</p>
- <ul class="statusmsg">
- <tal:block tal:repeat="e request/SESSION/auth_status/errors">
- <li class="statusmsg" tal:content="e" />
- </tal:block>
- </ul>
+
+ <p class="retmsgs">Status messages:</p>
+ <ul class="statusmsg">
+ <tal:block
+ tal:condition="exists:request/SESSION/auth_status/messages"
+ tal:repeat="e request/SESSION/auth_status/messages">
+ <li class="statusmsg" tal:content="e" />
+ </tal:block>
+ </ul>
+ </div>
+
+ <div id="auth_errmsgsdiv"
+ tal:attributes="class python:'errmsgs' + (have_errmsgs and ' ' or ' invisible')">
+ <div class="hbclosebox">
+ <a href="javascript:hide_msgs('auth_errmsgsdiv')"><img src="x.png" class="closeBox" title="dismiss"></a>
</div>
+ <p class="errmsgs">The following errors occurred:</p>
+ <ul class="statusmsg">
+ <tal:block
+ tal:condition="exists:request/SESSION/auth_status/errors"
+ tal:repeat="e request/SESSION/auth_status/errors">
+ <li class="statusmsg" tal:content="e" />
+ </tal:block>
+ </ul>
+ </div>
+
+ <tal:block tal:condition="exists:request/SESSION/auth_status">
<tal:block
tal:define="x python: request.SESSION.delete('auth_status')" />
<div class="padding"> </div>
@@ -589,6 +612,8 @@
<script type="text/javascript" src="/luci/homebase/validate_sys_add.js">
</script>
+ <script type="text/javascript" src="conga_ajax.js"></script>
+ <script type="text/javascript" src="update_hostinfo.js"></script>
<script type="text/javascript">
set_page_title('Luci ??? homebase ??? Add a storage system to be managed by Luci');
@@ -610,6 +635,7 @@
<tr class="systemsTable">
<th class="systemsTable">System Hostname</th>
<th class="systemsTable">Root Password</th>
+ <th class="systemsTable">Key ID</th>
<th class="systemsTable"></th>
</tr>
</thead>
@@ -618,6 +644,7 @@
<tr class="systemsTable" id="__SYSTEM_ROW_0">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
</td>
<td class="systemsTable">
@@ -629,6 +656,10 @@
onchange="pwd0Change(this.form)" />
</td>
<td class="systemsTable">
+ <img src="lock-open.png" id="__SYSTEM0Fingerprint"
+ title="no key fingerprint available" />
+ </td>
+ <td class="systemsTable">
<img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_0')" />
@@ -643,7 +674,6 @@
<th class="systemsTable">System Hostname</th>
<th class="systemsTable">Root Password</th>
<th class="systemsTable">Key ID</th>
- <th class="systemsTable">Trust</th>
<th class="systemsTable"></th>
</tr>
</thead>
@@ -660,6 +690,7 @@
<input type="hidden" name="trust_shown" value="1" />
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
tal:attributes="
id python: '__SYSTEM%d:Addr' % cur_sysnum;
name python: '__SYSTEM%d:Addr' % cur_sysnum;
@@ -677,17 +708,10 @@
</td>
<td class="systemsTable">
- <img
- tal:attributes="
- 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"
- tal:attributes="
- id python: '__SYSTEM%dFingerprint' % cur_sysnum;
- name python: '__SYSTEM%dFingerprint' % cur_sysnum;
- value sys/fp | nothing" />
+ <img tal:attributes="
+ id python: '__SYSTEM%dFingerprint' % cur_sysnum;
+ 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" />
</td>
<td class="systemsTable">
<input type="checkbox" checked tal:attributes="
@@ -714,12 +738,8 @@
<tfoot class="systemsTable">
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<ul class="vanilla">
- <li class="vanilla">
- <input name="check_certs" id="view_certs"
- onchange="view_certs_only(this.form, this.checked)"
- type="checkbox">View system certificates before sending any passwords.</li>
<li class="vanilla"
- tal:attributes="id python: cur_sysnum < 2 and 'allSameDiv' or ''"><input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" onclick="allPasswdsSame(this.form);"/>Check if storage system passwords are identical.</li>
+ tal:attributes="id python: cur_sysnum < 2 and 'allSameDiv' or ''"><input type="checkbox" name="allSameCheckBox" id="allSameCheckBox" onclick="allPasswdsSame(this.form);"/>Check if system passwords are identical.</li>
</ul>
</td></tr>
@@ -729,6 +749,15 @@
onclick="addSystem(this.form)" />
</div>
</td></tr>
+
+ <tr class="systemsTable"><td class="systemsTable" colspan="2">
+ <div class="systemsTableEnd">
+ <input type="button"
+ name="View SSL cert fingerprints"
+ value="View SSL cert fingerprints"
+ onclick="get_system_info('retmsgsdiv', 'errmsgsdiv')" />
+ </div>
+ </td></tr>
</tfoot>
</table>
@@ -801,8 +830,7 @@
<tr class="systemsTable">
<th class="systemsTable">Node Hostname</th>
<th class="systemsTable">Root Password</th>
- <th tal:condition="asked_for_certs" class="systemsTable">Key ID</th>
- <th tal:condition="asked_for_certs" class="systemsTable">Trust</th>
+ <th class="systemsTable">Key ID</th>
</tr>
</thead>
@@ -811,12 +839,6 @@
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<input type="hidden" name="trust_shown" value="1" />
<ul class="vanilla">
- <li class="vanilla">
- <input name="check_certs" type="checkbox"
- id="view_certs"
- onchange="view_certs_only(this.form, this.checked)" />
- View system certificates before sending any passwords.
- </li>
<li class="vanilla" id="allSameDiv">
<li class="vanilla" tal:condition="not: exists: add_cluster/complete">
<input type="checkbox" name="allSameCheckBox"
@@ -845,6 +867,7 @@
tal:define="sys python: add_cluster['nodes'][cur_sys]">
<td class="systemsTable">
<input type="text"
+ onchange="reset_system_info(this)"
tal:attributes="
value sys/host | nothing;
id python: '__SYSTEM%d:Addr' % cur_sysnum;
@@ -874,39 +897,12 @@
name python: '__SYSTEM%d:Passwd' % cur_sysnum" />
</tal:block>
</td>
- <td tal:condition="asked_for_certs" class="systemsTable">
- <img
- tal:attributes="
- 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"
- tal:attributes="
- id python: '__SYSTEM%dFingerprint' % cur_sysnum;
- name python: '__SYSTEM%dFingerprint' % cur_sysnum;
- value sys/fp | nothing" />
- </td>
- <td tal:condition="asked_for_certs" class="systemsTable">
- <input type="checkbox"
- tal:attributes="
- checked python: sys.has_key('fp') or sys.has_key('trusted');
- id python: '__SYSTEM%dTrusted' % cur_sysnum;
- name python: '__SYSTEM%dTrusted' % cur_sysnum;
- disabled python: sys.has_key('trusted')" />
+ <td class="systemsTable">
+ <img tal:attributes="
+ id python: '__SYSTEM%dFingerprint' % cur_sysnum;
+ 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" />
</td>
- <tal:block tal:condition="python:not asked_for_certs">
- <input type="hidden" value="1"
- tal:attributes="
- id python: '__SYSTEM%dTrusted' % cur_sysnum;
- name python: '__SYSTEM%dTrusted' % cur_sysnum"
- />
- <input type="hidden"
- tal:condition="exists: sys/fp"
- tal:attributes="
- id python: '__SYSTEM%dFingerprint' % cur_sysnum;
- name python: '__SYSTEM%dFingerprint' % cur_sysnum;
- value sys/fp | nothing" />
- </tal:block>
</tr>
<tal:block tal:define="global cur_sysnum python: cur_sysnum + 1" />
</tal:block>
@@ -944,14 +940,17 @@
- At least one node name/password are given and are valid
</tal:comment>
+ <script type="text/javascript" src="conga_ajax.js"></script>
+ <script type="text/javascript" src="update_hostinfo.js"></script>
<script type="text/javascript" src="/luci/homebase/validate_cluster_add_initial.js">
</script>
+
<script type="text/javascript">
set_page_title('Luci ??? homebase ??? Add a running cluster to be managed by Luci');
</script>
<form name="adminform" action="" method="post">
- <input name="pagetype" type="hidden"
+ <input name="pagetype" type="hidden" id="pagetype"
tal:attributes="value request/form/pagetype | request/pagetype | nothing" />
<h2 class="homebase">Add an Existing Cluster</h2>
@@ -962,26 +961,32 @@
tal:define="cur_sys request/SESSION/add_cluster_initial | nothing">
<thead class="systemsTable">
+ <tr class="systemsTable"><td class="systemsTable" colspan="2">
+ <div class="systemsTableTop">
+ <strong class="cluster_name invisible" id="cluname_elem">Cluster Name:
+ </strong>
+ <input type="hidden" id="clustername" name="clustername" value="" />
+ <input type="hidden" id="cluster_os" name="cluster_os" value="rhel5" />
+ </div>
+ </td></tr>
+
<tr class="systemsTable">
<th class="systemsTable">System Hostname</th>
<th class="systemsTable">Root Password</th>
- <tal:block tal:condition="cur_sys">
- <th>Key Id</th>
- <th>Trust</th>
- </tal:block>
+ <th>Key ID</th>
</tr>
</thead>
<tfoot class="systemsTable">
<tr class="systemsTable"><td colspan="2" class="systemsTable">
- <input type="hidden" name="trust_shown" value="1"
- tal:condition="cur_sys" />
-
+ <input type="hidden" name="trust_shown" value="1" />
+ </td></tr>
+ <tr class="systemsTable"><td colspan="2" class="systemsTable">
<ul class="vanilla">
- <li class="vanilla">
- <input name="check_certs" id="view_certs"
- onchange="view_certs_only(this.form, this.checked)"
- type="checkbox">View system certificates before sending any passwords.
+ <li class="vanilla" id="allSameDiv">
+ <input type="checkbox" name="allSameCheckBox"
+ id="allSameCheckBox" onclick="allPasswdsSame(this.form)" />
+ Check if system passwords are identical.
</li>
</ul>
</td></tr>
@@ -991,6 +996,7 @@
<tr class="systemsTable">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM0:Addr" name="__SYSTEM0:Addr"
tal:attributes="
value cur_sys/host | nothing" />
@@ -1003,26 +1009,28 @@
tal:attributes="
value nothing" />
</td>
- <tal:block tal:condition="cur_sys">
- <td class="systemsTable">
- <img tal:attributes="
+ <td class="systemsTable">
+ <img id="__SYSTEM0Fingerprint"
+ tal:attributes="
title sys/fp | string:no key fingerprint available;
- 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">
- <input type="checkbox" name="host_is_trusted" checked="checked" />
- </td>
- </tal:block>
+ src python: (cur_sys and cur_sys.has_key('trusted')) and 'lock-ok.png' or ((cur_sys and cur_sys.has_key('fp')) and 'lock-closed.png' or 'lock-open.png')"
+ />
+ </td>
</tr>
</tbody>
+
<tal:block tal:condition="cur_sys">
<tal:block
tal:define="x python: request.SESSION.delete('add_cluster_initial')" />
</tal:block>
</table>
- <input type="hidden" name="numStorage" value="1" />
+ <input type="hidden" id="numStorage" name="numStorage" value="1" />
+
+ <div class="hbSubmit">
+ <input type="button" name="View SSL cert fingerprints"
+ value="View SSL cert fingerprints" onclick="get_system_info('retmsgsdiv', 'errmsgsdiv')" />
+ </div>
<div class="hbSubmit" id="hbSubmit">
<input type="button" name="Submit" value="Submit"
--- conga/luci/homebase/homebase_common.js 2008/01/02 20:52:23 1.23
+++ conga/luci/homebase/homebase_common.js 2008/01/22 15:02:32 1.24
@@ -74,7 +74,7 @@
}
}
-function addSystem(form) {
+function addSystem(form, no_delete) {
var sltab = document.getElementById('sys_tbody');
if (!sltab) {
return;
@@ -87,6 +87,7 @@
newsys.setAttribute('id', '__SYSTEM' + num_systems + ':Addr');
newsys.setAttribute('type', 'text');
newsys.setAttribute('value', '');
+ newsys.onclick = new Function('reset_system_info(this)');
var newsysp = document.createElement('input');
newsysp.className = 'hbInputPass';
@@ -120,20 +121,34 @@
hcol.className = 'systemsTable';
var pcol = document.createElement('td');
pcol.className = 'systemsTable';
- var dcol = document.createElement('td');
- dcol.className = 'systemsTable';
- var del_img = document.createElement('img');
- 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 + '\')');
- dcol.appendChild(del_img);
+ var fpcol = document.createElement('td');
+ fpcol.className = 'systemsTable';
+ var fp_img = document.createElement('img');
+ fp_img.src = 'lock-open.png';
+ fp_img.title = 'no key fingerprint available';
+ fp_img.id = '__SYSTEM' + num_systems + 'Fingerprint';
+ fpcol.appendChild(fp_img);
+
+ if (!no_delete) {
+ var dcol = document.createElement('td');
+ dcol.className = 'systemsTable';
+ var del_img = document.createElement('img');
+ 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 + '\')');
+ dcol.appendChild(del_img);
+ }
+
hcol.appendChild(newsys);
pcol.appendChild(newsysp);
newrow.appendChild(hcol);
newrow.appendChild(pcol);
- newrow.appendChild(dcol);
+ newrow.appendChild(fpcol);
+ if (!no_delete) {
+ newrow.appendChild(dcol);
+ }
sltab.appendChild(newrow);
form.numStorage.value = ++num_systems;
@@ -142,6 +157,79 @@
temp.style.visibility = 'visible';
temp.style.display = 'block';
}
+ return (num_systems - 1);
+}
+
+function reset_system_info(obj) {
+ var offset = null;
+ if (!obj.id || obj.id.substr(0, 8) !== '__SYSTEM') {
+ return (-1);
+ }
+ offset = obj.id.substr(8, obj.id.indexOf(':') - 8);
+ if (offset === null || offset < 0) {
+ return (-1);
+ }
+ var pwd_elem = document.getElementById('__SYSTEM' + offset + ':Passwd');
+ if (pwd_elem) {
+ clr_form_err(pwd_elem);
+ }
+ var fp_elem = document.getElementById('__SYSTEM' + offset + 'Fingerprint');
+ if (fp_elem) {
+ fp_elem.src = 'lock-open.png';
+ fp_elem.title = 'no key fingerprint available';
+ }
+ clr_form_err(obj);
+
+}
+
+function get_systems_list(errors) {
+ var systems_entered = [];
+ var num_systems = 0;
+
+ try {
+ var num_elem = document.getElementById('numStorage');
+ num_systems = num_elem.value;
+ if (!is_valid_int(num_systems, null, null)) {
+ throw String(num_systems + ' is not a valid number of systems.');
+ }
+ } catch (e) {
+ errors.push(e);
+ }
+
+ for (var i = 0 ; i < num_systems ; i++) {
+ var element = document.getElementById('__SYSTEM' + i + ':Addr');
+
+ if (!element || str_is_blank(element.value)) {
+ continue;
+ }
+ systems_entered.push(element.value);
+ }
+ return (systems_entered);
+}
+
+function get_systems_list_offsets(errors) {
+ var systems_entered = [];
+ var num_systems = 0;
+
+ try {
+ var num_elem = document.getElementById('numStorage');
+ num_systems = num_elem.value;
+ if (!is_valid_int(num_systems, null, null)) {
+ throw String(num_systems + ' is not a valid number of systems.');
+ }
+ } catch (e) {
+ errors.append(e);
+ }
+
+ for (var i = 0 ; i < num_systems ; i++) {
+ var element = document.getElementById('__SYSTEM' + i + ':Addr');
+
+ if (!element || str_is_blank(element.value)) {
+ continue;
+ }
+ systems_entered.push([ element.value, i ]);
+ }
+ return (systems_entered);
}
function validate_systems(form, errors) {
--- conga/luci/homebase/index_html 2007/11/27 16:58:18 1.25
+++ conga/luci/homebase/index_html 2008/01/22 15:02:32 1.26
@@ -114,35 +114,38 @@
Homebase
</metal:main_form>
- <tal:block tal:condition="python: request.SESSION.has_key('checkRet')"
- tal:define="ret python: request.SESSION.get('checkRet')">
-
- <div class="retmsgs" id="retmsgsdiv" tal:condition="python:(ret and 'messages' in ret and len(ret['messages']))">
+ <tal:block tal:define="ret python: request.SESSION.get('checkRet')">
+ <div id="retmsgsdiv"
+ tal:attributes="class python:'retmsgs' + ((ret and ret.get('messages') and len(ret.get('messages')) > 0) and ' ' or ' invisible')">
<div class="hbclosebox">
- <img onclick="hide_element('retmsgsdiv')" src="x.png" class="closeBox" title="dismiss" />
+ <img onclick="hide_msgs('retmsgsdiv')"
+ src="x.png" class="closeBox" title="dismiss" />
</div>
<p class="retmsgs">Status messages:</p>
- <ul class="statusmsg">
- <tal:block tal:repeat="e python:ret['messages']">
- <li class="statusmsg" tal:content="python:e" />
+ <ul class="statusmsg" id="statusmsglist">
+ <tal:block tal:condition="exists:ret/messages"
+ tal:repeat="e ret/messages">
+ <li class="statusmsg" tal:content="e" />
</tal:block>
</ul>
</div>
- <div id="errmsgsdiv" class="errmsgs" tal:condition="python:(ret and 'errors' in ret and len(ret['errors']))">
+ <div id="errmsgsdiv"
+ tal:attributes="class python:'errmsgs' + ((ret and ret.get('errors') and len(ret.get('errors')) > 0) and ' ' or ' invisible')">
<div class="hbclosebox">
- <img onclick="hide_element('errmsgsdiv')" src="x.png" class="closeBox" title="dismiss">
+ <img onclick="hide_msgs('errmsgsdiv')"
+ src="x.png" class="closeBox" title="dismiss" />
</div>
<p class="errmsgs">The following errors occurred:</p>
- <ul class="statusmsg">
- <tal:block tal:repeat="e python:ret['errors']">
- <li class="statusmsg" tal:content="python:e" />
+ <ul class="statusmsg" id="errmsglist">
+ <tal:block tal:condition="exists:ret/errors"
+ tal:repeat="e ret/errors">
+ <li class="statusmsg" tal:content="e" />
</tal:block>
</ul>
</div>
</tal:block>
-
</div>
</div>
--- conga/luci/homebase/validate_cluster_add_initial.js 2008/01/02 20:52:23 1.4
+++ conga/luci/homebase/validate_cluster_add_initial.js 2008/01/22 15:02:32 1.5
@@ -7,9 +7,11 @@
** Free Software Foundation.
*/
+var form_elem = null;
function validateForm(form) {
var errors = [];
+ form_elem = form;
if (!form) {
return (-1);
}
@@ -28,10 +30,159 @@
return (-1);
}
- if (confirm('Retrieve cluster information from ' + added_storage[0] + '?'))
- {
- form.submit();
+ if (form.pagetype.value == 7) {
+ if (confirm('Retrieve cluster information from ' + added_storage[0] + '?')) {
+ get_cluster_members();
+ }
+ } else if (form.pagetype.value == 6) {
+ if (confirm('Add this cluster?')) {
+ form.submit();
+ }
}
return (0);
}
+
+function same_host(left, right) {
+ if (left === right) {
+ return (true);
+ }
+ left = left.toLowerCase();
+ right = right.toLowerCase();
+ if (left === right) {
+ return (true);
+ }
+ left = left.replace(/\.$/, '');
+ right = right.replace(/\.$/, '');
+ if (left.length > right.length) {
+ return (right === left.substr(0, right.length));
+ } else {
+ return (left === right.substr(0, left.length));
+ }
+ return false;
+}
+
+function get_cluster_members() {
+ var url = '/luci/cluster?pagetype=1000';
+ var node_num = 0;
+
+ var hclu_elem = document.getElementById('__SYSTEM0:Addr');
+ if (hclu_elem && hclu_elem.value) {
+ ++node_num;
+ url += '&node' + node_num + '=' + hclu_elem.value;
+ }
+
+ if (!node_num) {
+ alert('No node names were entered');
+ } else {
+ initiate_async_get(url, cluster_member_callback);
+ }
+}
+
+function cluster_member_callback() {
+ return check_ajax_xml(xmlHttp_object, cluster_member_check);
+}
+
+function cluster_member_check(ret_status, obj) {
+ if (ret_status === null) {
+ /* Not ready */
+ return;
+ }
+
+ if (ret_status !== true) {
+ /* A communication error occurred. */
+ alert(obj);
+ form_elem.submit();
+ return;
+ }
+
+ var err = get_ricci_response_status(obj.responseXML);
+ if (err !== null && err.length > 0) {
+ alert(err.join('\n'));
+ form_elem.submit();
+ return;
+ }
+
+ try {
+ obj = obj.responseXML.getElementsByTagName('dict')[0];
+ } catch (e) {
+ alert('Received a malformed response from the luci server.');
+ form_elem.submit();
+ return;
+ }
+
+ var query_host;
+ var query_host_elem = document.getElementById('__SYSTEM0:Addr');
+ if (!query_host_elem || str_is_blank(query_host_elem.value)) {
+ alert('No node was entered.');
+ form_elem.submit();
+ return;
+ }
+ query_host = query_host_elem.value;
+
+ var clusters = [];
+ var dict_tags = obj.getElementsByTagName('dict');
+ var num_errors = 0;
+ for (var i = 0 ; i < dict_tags.length ; i++) {
+ try {
+ var cnode_names = [];
+ var tag_name = dict_tags[i].getAttribute('name');
+ var cnodes = dict_tags[i].getElementsByTagName('clusternode');
+ var cur_node_name;
+
+ for (var j = 0 ; j < cnodes.length - 1 ; j++) {
+ addSystem(form_elem, 1);
+ }
+
+ var last_num = 0;
+ for (var j = 0 ; j < cnodes.length ; j++) {
+ cur_node_name = cnodes[j].getAttribute('value');
+ cnode_names.push(cur_node_name);
+ if (!same_host(cur_node_name, query_host)) {
+ var addr_elem = document.getElementById('__SYSTEM' + ++last_num + ':Addr');
+ addr_elem.value = cur_node_name;
+ } else {
+ query_host_elem.value = cur_node_name;
+ }
+ }
+ } catch (e) {
+ num_errors++;
+ alert(e);
+ }
+ }
+ var cluster_name = "[unknown]";
+ var var_tags = obj.getElementsByTagName('var');
+ for (var i = 0 ; i < var_tags.length ; i++) {
+ try {
+ if (var_tags[i].getAttribute('name') == 'cluster') {
+ cluster_name = var_tags[i].getAttribute('value');
+ break;
+ }
+ } catch (e) {
+ alert(e);
+ }
+ }
+ try {
+ var cn_elem = document.getElementById('cluname_elem');
+ cn_elem.className = cn_elem.className.replace(/invisible/gi, '');
+ try {
+ var tn = document.createTextNode(cluster_name);
+ cn_elem.appendChild(tn);
+ } catch (e1) {
+ var tn = document.createElement('span');
+ tn.innerHTML = cluster_name;
+ cn_elem.appendChild(tn);
+ }
+ var cn_elem = document.getElementById('clustername');
+ cn_elem.value = cluster_name;
+ } catch (e) {
+ num_errors++;
+ }
+
+ if (num_errors === 0) {
+ var pt_elem = document.getElementById('pagetype');
+ if (pt_elem) {
+ pt_elem.value = 6;
+ }
+ }
+}
--- conga/luci/homebase/validate_sys_remove.js 2008/01/02 20:52:23 1.6
+++ conga/luci/homebase/validate_sys_remove.js 2008/01/22 15:02:32 1.7
@@ -82,6 +82,5 @@
return (-1);
}
- form.submit();
- return (0);
+ validate_auth_form(form, 'auth_retmsgsdiv', 'auth_errmsgsdiv');
}
/cvs/cluster/conga/luci/plone-custom/update_hostinfo.js,v --> standard output
revision 1.1
--- conga/luci/plone-custom/update_hostinfo.js
+++ - 2008-01-22 15:02:34.876851000 +0000
@@ -0,0 +1,144 @@
+/*
+** Copyright (C) 2007-2008 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.
+*/
+
+var err_div_id = null;
+var msg_div_id = null;
+var err_if_clumember = false;
+
+function get_system_info(msgarea_id, errarea_id, err) {
+ var url = '/luci/cluster?pagetype=1002';
+ var errors = [];
+ var systems_list = get_systems_list(errors);
+
+ if (error_dialog(errors)) {
+ return (null);
+ }
+
+ if (systems_list.length < 1) {
+ alert('No system names were entered');
+ return (null);
+ }
+
+ try {
+ hide_msgs(errarea_id);
+ hide_msgs(msgarea_id);
+ } catch (e) {
+ }
+
+ for (var i = 0 ; i < systems_list.length ; i++) {
+ url += '&node' + i + '=' + systems_list[i];
+ }
+
+ msg_div_id = msgarea_id;
+ err_div_id = errarea_id;
+ err_if_clumember = err;
+ initiate_async_get(url, get_system_info_callback);
+}
+
+function get_system_info_callback() {
+ return check_ajax_xml(xmlHttp_object, system_info_check);
+}
+
+function system_info_check(ret_status, obj) {
+ if (ret_status === null) {
+ return;
+ }
+
+ if (ret_status !== true) {
+ /* A communication error occurred. */
+ alert(obj);
+ return;
+ }
+
+ var err = get_ricci_response_status(obj.responseXML);
+ if (err !== null && err.length > 0) {
+ alert(err.join('\n'));
+ return;
+ }
+
+ try {
+ obj = obj.responseXML.getElementsByTagName('dict')[0];
+ } catch (e) {
+ alert('Received a malformed response from the luci server.');
+ return;
+ }
+
+ var elem = obj.getElementsByTagName('dict');
+ var node_props = [];
+ for (var i = 0 ; i < elem.length ; i++) {
+ var elem_type = elem[i].getAttribute('name');
+ if (elem_type != 'clusternodes') {
+ continue;
+ }
+ var cur_node_props = [];
+ var var_elem = elem[i].getElementsByTagName('var');
+ for (var j = 0 ; j < var_elem.length ; j++) {
+ try {
+ var cur_name = var_elem[j].getAttribute('name');
+ var cur_value = var_elem[j].getAttribute('value');
+ cur_node_props[cur_name] = cur_value;
+ } catch (e) {
+ continue;
+ }
+ }
+ try {
+ node_props[cur_node_props['hostname']] = cur_node_props;
+ } catch (e) {
+ continue;
+ }
+ }
+
+ var errors = [];
+ var msgs = [];
+ var systems_list = get_systems_list_offsets(errors);
+
+ for (var i = 0 ; i < systems_list.length ; i++) {
+ var cur_node_props = node_props[systems_list[i][0]];
+ var cur_sys_name = systems_list[i][0];
+ var offset = systems_list[i][1];
+ try {
+ var addr_elem = document.getElementById('__SYSTEM' + offset + ':Addr');
+ var pwd_elem = document.getElementById('__SYSTEM' + offset + ':Passwd');
+ var fp_elem = document.getElementById('__SYSTEM' + offset + 'Fingerprint');
+
+ if (cur_node_props['available'] != 'True') {
+ errors.push(cur_node_props['err_msg']);
+ set_form_err(addr_elem);
+ set_form_err(pwd_elem);
+ } else if (cur_node_props['key_fp']) {
+ msgs.push('Host ' + cur_sys_name + ' has SSL key fingerprint ' + cur_node_props['key_fp']);
+ fp_elem.src = 'lock-closed.png';
+ fp_elem.title = cur_node_props['key_fp'];
+
+ try {
+ if (err_if_clumember && cur_node_props['cluname'] && !str_is_blank(cur_node_props['cluname'])) {
+ errors.push('Host ' + cur_sys_name + ' is already a member of the cluster named "' + cur_node_props['cluname'] + '"');
+ set_form_err(addr_elem);
+ clr_form_err(pwd_elem);
+ } else {
+ clr_form_err(addr_elem);
+ clr_form_err(pwd_elem);
+ }
+ } catch (e1) {
+ throw e1;
+ }
+ }
+ } catch (e) {
+ alert(e);
+ }
+ }
+
+ if (errors.length > 0) {
+ display_msgs(err_div_id, errors);
+ }
+
+ if (msgs.length > 0) {
+ display_msgs(msg_div_id, msgs);
+ }
+}
/cvs/cluster/conga/luci/plone-custom/validate_auth.js,v --> standard output
revision 1.1
--- conga/luci/plone-custom/validate_auth.js
+++ - 2008-01-22 15:02:34.959260000 +0000
@@ -0,0 +1,143 @@
+/*
+** Copyright (C) 2007-2008 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.
+*/
+
+var err_div_id = null;
+var msg_div_id = null;
+
+function validate_auth_form(form, msgarea_id, errarea_id) {
+ var url = '/luci/cluster?pagetype=1003';
+ var errors = [];
+ var systems_list = get_systems_list(errors);
+
+ if (error_dialog(errors)) {
+ return (null);
+ }
+
+ if (systems_list.length < 1) {
+ alert('No system names were entered');
+ return (null);
+ }
+
+ try {
+ hide_msgs(errarea_id);
+ hide_msgs(msgarea_id);
+ } catch (e) {
+ }
+
+ msg_div_id = msgarea_id;
+ err_div_id = errarea_id;
+ initiate_async_post(form, url, validate_auth_callback);
+}
+
+function validate_auth_callback() {
+ return check_ajax_xml(xmlHttp_object, validate_auth_check);
+}
+
+function validate_auth_check(ret_status, obj) {
+ if (ret_status === null) {
+ return;
+ }
+
+ if (ret_status !== true) {
+ /* A communication error occurred. */
+ alert(obj);
+ return;
+ }
+
+ var err = get_ricci_response_status(obj.responseXML);
+ if (err !== null && err.length > 0) {
+ alert(err.join('\n'));
+ return;
+ }
+
+ try {
+ obj = obj.responseXML.getElementsByTagName('dict')[0];
+ } catch (e) {
+ alert('Received a malformed response from the luci server.');
+ return;
+ }
+
+ var elem = obj.getElementsByTagName('dict');
+ var node_props = [];
+ for (var i = 0 ; i < elem.length ; i++) {
+ var elem_type = elem[i].getAttribute('name');
+ if (elem_type != 'clusternodes') {
+ continue;
+ }
+ var cur_node_props = [];
+ var var_elem = elem[i].getElementsByTagName('var');
+ for (var j = 0 ; j < var_elem.length ; j++) {
+ try {
+ var cur_name = var_elem[j].getAttribute('name');
+ var cur_value = var_elem[j].getAttribute('value');
+ cur_node_props[cur_name] = cur_value;
+ } catch (e) {
+ continue;
+ }
+ }
+ try {
+ node_props[cur_node_props['hostname']] = cur_node_props;
+ } catch (e) {
+ continue;
+ }
+ }
+
+ var errors = [];
+ var msgs = [];
+ var systems_list = get_systems_list_offsets(errors);
+
+ for (var i = 0 ; i < systems_list.length ; i++) {
+ var cur_node_props = node_props[systems_list[i][0]];
+ var cur_sys_name = systems_list[i][0];
+ var offset = systems_list[i][1];
+ try {
+ var addr_elem = document.getElementById('__SYSTEM' + offset + ':Addr');
+ var pwd_elem = document.getElementById('__SYSTEM' + offset + ':Passwd');
+ var fp_elem = document.getElementById('__SYSTEM' + offset + 'Fingerprint');
+
+ if (cur_node_props['available'] != 'True') {
+ set_form_err(addr_elem);
+ clr_form_err(pwd_elem);
+ errors.push('Unable to connect to host ' + cur_sys_name + ' to authenticate: ' + cur_node_props['err_msg']);
+ } else {
+ var has_valid_fp = false;
+
+ if (cur_node_props['key_fp']) {
+ fp_elem.src = 'lock-closed.png';
+ fp_elem.title = cur_node_props['key_fp'];
+ has_valid_fp = true;
+ }
+
+ if (cur_node_props['authed'] != 'True') {
+ errors.push('Authentication for host ' + cur_sys_name + ' failed.');
+ clr_form_err(addr_elem);
+ set_form_err(pwd_elem);
+ } else {
+ var success_msg = 'Host ' + cur_sys_name + ' was authenticated successfully';
+ if (has_valid_fp === true) {
+ success_msg += ' (SSL key fingerprint ' + cur_node_props['key_fp'] + ')';
+ }
+ msgs.push(success_msg);
+ clr_form_err(addr_elem);
+ clr_form_err(pwd_elem);
+ }
+ }
+ } catch (e) {
+ alert(e);
+ }
+ }
+
+ if (errors.length > 0) {
+ display_msgs(err_div_id, errors);
+ }
+
+ if (msgs.length > 0) {
+ display_msgs(msg_div_id, msgs);
+ }
+}
--- conga/luci/plone-custom/conga.js 2008/01/02 20:52:23 1.11
+++ conga/luci/plone-custom/conga.js 2008/01/22 15:02:33 1.12
@@ -28,6 +28,56 @@
}
}
+function hide_msgs(id) {
+ var elem = document.getElementById(id);
+ if (!elem) {
+ return (-1);
+ }
+ elem.className += ' invisible';
+
+ var ul_elem = elem.getElementsByTagName('ul');
+ if (ul_elem) {
+ var ul_elem = ul_elem[0];
+ while (ul_elem.firstChild) {
+ ul_elem.removeChild(ul_elem.firstChild);
+ }
+ }
+}
+
+function display_msgs(id, msg_list) {
+ if (!msg_list || msg_list.length < 1) {
+ return (-1);
+ }
+
+ var elem = document.getElementById(id);
+ if (!elem) {
+ return (-1);
+ }
+
+ var ul_elem = elem.getElementsByTagName('ul');
+ if (!ul_elem || ul_elem.length < 1) {
+ return (-1);
+ }
+
+ ul_elem = ul_elem[0];
+
+ for (var i = 0 ; i < msg_list.length ; i++) {
+ var li_elem = document.createElement('li');
+ li_elem.className = 'statusmsg';
+ try {
+ li_elem.appendChild(document.createTextElement(msg_list[i]));
+ } catch (e) {
+ li_elem.innerHTML = msg_list[i];
+ }
+ ul_elem.appendChild(li_elem);
+ }
+
+ try {
+ elem.className = elem.className.replace(/invisible/gi,'');
+ } catch (e) {
+ }
+}
+
function popup_window(url, width_percent, height_percent) {
var width = window.innerWidth * (width_percent / 100);
var height = window.innerHeight * (height_percent / 100);
--- conga/luci/plone-custom/conga_ajax.js 2008/01/02 20:52:23 1.7
+++ conga/luci/plone-custom/conga_ajax.js 2008/01/22 15:02:33 1.8
@@ -68,7 +68,7 @@
xmlHttp_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp_object.setRequestHeader("Content-length", form_data_str.length);
xmlHttp_object.setRequestHeader("Connection", "close");
- xmlHttp_object.send(form_data_str);
+ xmlHttp_object.send(form_data_str.substr(0, form_data_str.length - 1));
}
function get_ajax_msgs(obj, tag_name) {
--- conga/luci/cluster/form-chooser 2008/01/02 20:52:22 1.23
+++ conga/luci/cluster/form-chooser 2008/01/22 15:02:33 1.24
@@ -225,6 +225,10 @@
<tal:block tal:condition="python: ptype == '1000'">
<div metal:use-macro="here/form-macros/macros/get-cluster-members-form" />
</tal:block>
+
+ <tal:block tal:condition="python: ptype == '1002'">
+ <div metal:use-macro="here/form-macros/macros/get-system-info-form" />
+ </tal:block>
</tal:block>
</metal:choose-form>
--- conga/luci/cluster/form-macros 2008/01/02 20:52:22 1.218
+++ conga/luci/cluster/form-macros 2008/01/22 15:02:33 1.219
@@ -153,14 +153,12 @@
</div>
<div metal:define-macro="clusteradd-form">
- <script type="text/javascript"
- src="/luci/homebase/homebase_common.js">
- </script>
- <script type="text/javascript"
- src="/luci/homebase/validate_cluster_add.js">
- </script>
- <script type="text/javascript"
- src="validate_create_gulm.js">
+ <script type="text/javascript" src="/luci/homebase/homebase_common.js"></script>
+ <script type="text/javascript" src="/luci/homebase/validate_cluster_add.js"></script>
+ <script type="text/javascript" src="validate_create_gulm.js"></script>
+ <script type="text/javascript" src="conga_ajax.js"></script>
+ <script type="text/javascript" src="update_hostinfo.js"></script>
+
<script type="text/javascript">
set_page_title('Luci ??? cluster ??? Deploy a cluster');
</script>
@@ -193,10 +191,7 @@
<tr class="systemsTable">
<th class="systemsTable">Node Hostname</th>
<th class="systemsTable">Root Password</th>
- <tal:block tal:condition="add_cluster">
- <th class="systemsTable">Key ID</th>
- <th class="systemsTable">Trust</th>
- </tal:block>
+ <th class="systemsTable">Key ID</th>
<th></th>
</tr>
</thead>
@@ -227,18 +222,15 @@
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<input type="checkbox" name="enable_storage"
tal:attributes="
- checked add_cluster/shared_storage |string:checked" />
- Enable Shared Storage Support
+ checked add_cluster/shared_storage |string:checked" />Enable Shared Storage Support
+ </td></tr>
+ <tr class="systemsTable"><td colspan="2" class="systemsTable">
+ <input type="checkbox" name="reboot_nodes"
+ tal:attributes="checked python:(add_cluster and add_cluster.get('reboot_nodes')) and 'checked' or ''" />Reboot nodes before joining cluster
</td></tr>
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<ul class="vanilla">
<li class="vanilla">
- <input name="check_certs" type="checkbox"
- id="view_certs"
- onchange="view_certs_only(this.form, this.checked)" />
- View system certificates before sending any passwords.
- </li>
- <li class="vanilla">
<input type="checkbox"
name="allSameCheckBox" id="allSameCheckBox"
onClick="allPasswdsSame(this.form)"
@@ -349,7 +341,7 @@
tal:attributes="id python: '__SYSTEM_ROW_%d' % cur_sysnum"
tal:define="sys python: add_cluster['nodes'][cur_sys]">
<td class="systemsTable">
- <input type="text"
+ <input type="text" onchange="reset_system_info(this)"
tal:attributes="
value sys/host | nothing;
id python: '__SYSTEM%d:Addr' % cur_sysnum;
@@ -379,25 +371,12 @@
name python: '__SYSTEM%d:Passwd' % cur_sysnum" />
</tal:block>
</td>
- <td tal:condition="add_cluster" class="systemsTable">
+ <td class="systemsTable">
<img
tal:attributes="
+ id python: '__SYSTEM%dFingerprint' % cur_sysnum;
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"
- tal:attributes="
- id python: '__SYSTEM%dFingerprint' % cur_sysnum;
- name python: '__SYSTEM%dFingerprint' % cur_sysnum;
- value sys/fp | nothing" />
- </td>
- <td tal:condition="add_cluster" class="systemsTable">
- <input type="checkbox" tal:attributes="
- checked exists: sys/fp;
- id python: '__SYSTEM%dTrusted' % cur_sysnum;
- name python: '__SYSTEM%dTrusted' % cur_sysnum;
- disabled python: 'trusted' in sys"
- />
</td>
<td class="systemsTable">
<img src="delete-row.png" class="deleteRow"
@@ -408,12 +387,13 @@
</tr>
<tal:block
tal:define="global cur_sysnum python: cur_sysnum + 1" />
- </tal:block>
+ </tal:block>
<tr class="systemsTable" id="__SYSTEM_ROW_0"
tal:condition="not: add_cluster">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
</td>
<td class="systemsTable">
@@ -423,6 +403,10 @@
id="__SYSTEM0:Passwd" name="__SYSTEM0:Passwd" />
</td>
<td class="systemsTable">
+ <img id="__SYSTEM0Fingerprint" src="lock-open.png"
+ title="no key fingerprint available" />
+ </td>
+ <td class="systemsTable">
<img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_0')" />
@@ -432,6 +416,7 @@
tal:condition="not: add_cluster">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM1:Addr" name="__SYSTEM1:Addr" />
</td>
<td class="systemsTable">
@@ -441,6 +426,10 @@
id="__SYSTEM1:Passwd" name="__SYSTEM1:Passwd" />
</td>
<td class="systemsTable">
+ <img id="__SYSTEM1Fingerprint" src="lock-open.png"
+ title="no key fingerprint available" />
+ </td>
+ <td class="systemsTable">
<img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_1')" />
@@ -450,6 +439,7 @@
tal:condition="not: add_cluster">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM2:Addr" name="__SYSTEM2:Addr" />
</td>
<td class="systemsTable">
@@ -459,6 +449,10 @@
id="__SYSTEM2:Passwd" name="__SYSTEM2:Passwd" />
</td>
<td class="systemsTable">
+ <img id="__SYSTEM2Fingerprint" src="lock-open.png"
+ title="no key fingerprint available" />
+ </td>
+ <td class="systemsTable">
<img src="delete-row.png" class="deleteRow"
title="delete this row"
onclick="delete_element_id('__SYSTEM_ROW_2')" />
@@ -471,6 +465,12 @@
<input name="numStorage" id="numStorage" type="hidden"
tal:attributes="value cur_sysnum" />
+ <div class="hbSubmit">
+ <input type="button" name="View SSL cert fingerprints"
+ value="View SSL cert fingerprints"
+ onclick="get_system_info('retmsgsdiv', 'errmsgsdiv', 1)" />
+ </div>
+
<div class="hbSubmit" id="hbSubmit">
<input type="hidden" name="cluster_create" value="1" />
<input type="button" name="Submit" value="Submit"
@@ -1102,10 +1102,7 @@
<tr class="systemsTable">
<th class="systemsTable">Node Hostname</th>
<th class="systemsTable">Root Password</th>
- <tal:block tal:condition="add_cluster">
- <th class="systemsTable">Key ID</th>
- <th class="systemsTable">Trust</th>
- </tal:block>
+ <th class="systemsTable">Key ID</th>
<th></th>
</tr>
</thead>
@@ -1136,17 +1133,14 @@
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<input type="checkbox" name="enable_storage"
tal:attributes="
- checked add_cluster/shared_storage | string:checked" />
- Enable Shared Storage Support
+ checked add_cluster/shared_storage | string:checked" />Enable Shared Storage Support
+ </td></tr>
+ <tr class="systemsTable"><td colspan="2" class="systemsTable">
+ <input type="checkbox" name="reboot_nodes"
+ tal:attributes="checked python:(add_cluster and add_cluster.get('reboot_nodes')) and 'checked' or ''" />Reboot nodes before joining cluster
</td></tr>
<tr class="systemsTable"><td colspan="2" class="systemsTable">
<ul class="vanilla">
- <li class="vanilla">
- <input name="check_certs" type="checkbox"
- id="view_certs"
- onchange="view_certs_only(this.form, this.checked)" />
- View system certificates before sending any passwords.
- </li>
<li class="vanilla"
tal:attributes="id python: (not add_cluster or ('nodes' in add_cluster and len(add_cluster['nodes']) < 2)) and 'allSameDiv'">
<input type="checkbox"
@@ -1170,7 +1164,7 @@
tal:attributes="id python: '__SYSTEM_ROW_%d' % cur_sysnum"
tal:define="sys python: add_cluster['nodes'][cur_sys]">
<td class="systemsTable">
- <input type="text"
+ <input type="text" onchange="reset_system_info(this)"
tal:attributes="
value sys/host | nothing;
id python: '__SYSTEM%d:Addr' % cur_sysnum;
@@ -1214,10 +1208,10 @@
</td>
<td tal:condition="add_cluster" class="systemsTable">
<input type="checkbox" tal:attributes="
- checked exists: sys/fp;
+ checked python: sys.has_key('fp') or sys.has_key('trusted');
id python: '__SYSTEM%dTrusted' % cur_sysnum;
name python: '__SYSTEM%dTrusted' % cur_sysnum;
- disabled python: 'trusted' in sys"
+ disabled python: sys.has_key('trusted')"
/>
</td>
<td class="systemsTable">
@@ -1235,6 +1229,7 @@
tal:condition="not: add_cluster">
<td class="systemsTable">
<input class="hbInputSys" type="text"
+ onchange="reset_system_info(this)"
id="__SYSTEM0:Addr" name="__SYSTEM0:Addr" />
</td>
<td class="systemsTable">
@@ -1323,5 +1318,9 @@
<tal:block tal:define="ret python: here.get_cluster_nodes_async(request)" />
</div>
+<div metal:define-macro="get-system-info-form">
+ <tal:block tal:define="ret python: here.get_sysinfo_async(request)" />
+</div>
+
</body>
</html>
--- conga/luci/cluster/index_html 2007/11/27 16:58:19 1.40
+++ conga/luci/cluster/index_html 2008/01/22 15:02:33 1.41
@@ -214,35 +214,38 @@
</div>
</div>
- <tal:block tal:condition="python: request.SESSION.has_key('checkRet')">
- <tal:block tal:define="ret python: request.SESSION.get('checkRet')">
- <div class="retmsgs" id="retmsgsdiv" tal:condition="python:(ret and 'messages' in ret and len(ret['messages']))">
+ <tal:block tal:define="ret python: request.SESSION.get('checkRet')">
+ <div id="retmsgsdiv"
+ tal:attributes="class python:'retmsgs' + ((ret and ret.get('messages') and len(ret.get('messages')) > 0) and ' ' or ' invisible')">
<div class="hbclosebox">
- <img onclick="hide_element('retmsgsdiv')"
+ <img onclick="hide_msgs('retmsgsdiv')"
src="x.png" class="closeBox" title="dismiss" />
</div>
<p class="retmsgs">Status messages:</p>
- <ul class="statusmsg">
- <tal:block tal:repeat="e python:ret['messages']">
- <li class="statusmsg" tal:content="python:e" />
+ <ul class="statusmsg" id="statusmsglist">
+ <tal:block tal:condition="exists:ret/messages"
+ tal:repeat="e ret/messages">
+ <li class="statusmsg" tal:content="e" />
</tal:block>
</ul>
</div>
- <div id="errmsgsdiv" class="errmsgs" tal:condition="python:(ret and 'errors' in ret and len(ret['errors']))">
+ <div id="errmsgsdiv"
+ tal:attributes="class python:'errmsgs' + ((ret and ret.get('errors') and len(ret.get('errors')) > 0) and ' ' or ' invisible')">
<div class="hbclosebox">
- <img onclick="hide_element('errmsgsdiv')"
+ <img onclick="hide_msgs('errmsgsdiv')"
src="x.png" class="closeBox" title="dismiss" />
</div>
<p class="errmsgs">The following errors occurred:</p>
- <ul class="statusmsg">
- <tal:block tal:repeat="e python:ret['errors']">
- <li class="statusmsg" tal:content="python:e" />
+ <ul class="statusmsg" id="errmsglist">
+ <tal:block tal:condition="exists:ret/errors"
+ tal:repeat="e ret/errors">
+ <li class="statusmsg" tal:content="e" />
</tal:block>
</ul>
</div>
- </tal:block>
</tal:block>
+
</div>
</div>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-22 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 22:47 [Cluster-devel] conga/luci homebase/form-macros homebase/homeb rmccabe
-- strict thread matches above, loose matches on Subject: below --
2008-01-22 15:02 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).