[Cluster-devel] conga/luci/cluster form-macros resource-form-m ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Wed Sep 6 22:13:34 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-06 22:13:33
Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
validate_config_qdisk.js
Log message:
more UI and JS validation bits
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_config_qdisk.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
--- conga/luci/cluster/form-macros 2006/09/05 21:25:44 1.55
+++ conga/luci/cluster/form-macros 2006/09/06 22:13:33 1.56
@@ -551,15 +551,18 @@
<th class="systemsTable">
<div class="systemsTableTop">Score</div>
</th>
+ <th>
+
+ </th>
</tr>
</thead>
- <tbody class="systemsTable" id='heuristicList'
+ <tbody class="systemsTable" id="heuristicList"
tal:define="global heuristics clusterinfo/hlist">
<tal:block tal:condition="python: not len(heuristics)">
<input type="hidden" name="num_heuristics" id="num_heuristics" value="0">
- <tr class="systemsTable">
+ <tr class="systemsTable" id="heuristic0">
<td class="systemsTable">
<input class="qdname qdisk" type="text" name="heuristic0:hname" id="heuristic0:hname" value="">
</td>
@@ -572,6 +575,12 @@
<td class="systemsTable">
<input class="qdscore qdisk" type="text" name="heuristic0:hscore" id="heuristic0:hscore" value="">
</td>
+ <td class="systemsTable">
+ <img class="qdscore qdisk qdel_img"
+ id="heuristic0:hdel" name="heuristic0:hdel"
+ src="/luci/homebase/x.png"
+ onClick="delete_qdisk_heur(this, document.quorum_partition);">
+ </td>
</tr>
</tal:block>
@@ -584,6 +593,7 @@
<tr class="systemsTable"
tal:repeat="heuristic heuristics"
+ tal:attributes="id python: 'heuristic' + str(curHeur)"
tal:define="global curHeur python: curHeur + 1">
<td class="systemsTable">
@@ -614,6 +624,14 @@
id python: 'heuristic' + str(curHeur) + ':hscore';
name python: 'heuristic' + str(curHeur) + ':hscore';"/>
</td>
+ <td class="systemsTable">
+ <img class="qdscore qdisk qdel_img"
+ src="/luci/homebase/x.png"
+ onClick="delete_qdisk_heur(this, document.quorum_partition);"
+ tal:attributes="
+ id python: 'heuristic' + str(curHeur) + ':hdel';
+ name python: 'heuristic' + str(curHeur) + ':hdel';"/>
+ </td>
</tr>
</tal:block>
</tbody>
--- conga/luci/cluster/resource-form-macros 2006/09/05 21:25:44 1.6
+++ conga/luci/cluster/resource-form-macros 2006/09/06 22:13:33 1.7
@@ -265,8 +265,15 @@
</tr>
</table>
- <input class="hbSubmit" name="submit" type="button" value="Submit"
- onClick="validate(this.form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
+
</form>
</div>
@@ -369,7 +376,7 @@
</td>
<td class="systemsTable">
<input type="text" size="20" id="options" name="options"
- tal:attributes="value opt | nothing"/>
+ tal:attributes="value opt | nothing" />
</td>
</tr>
@@ -379,7 +386,7 @@
</td>
<td class="systemsTable">
<input type="text" size="20" id="fsid" name="fsid"
- tal:attributes="value fsid | nothing"/>
+ tal:attributes="value fsid | nothing" />
</td>
</tr>
@@ -416,8 +423,14 @@
</tr>
</table>
- <input class="hbSubmit" type="button" value="Submit"
- onClick="validate(this.form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
@@ -527,8 +540,14 @@
</tr>
</table>
- <input type="button" value="Submit" class="hbSubmit"
- onclick="validate(gfs_form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
@@ -651,8 +670,14 @@
</tr>
</table>
- <input type="button" value="Submit" class="hbSubmit"
- onclick="validate(this.form);"/>
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
@@ -726,8 +751,14 @@
</tr>
</table>
- <input type="button" value="Submit" class="hbSubmit"
- onclick="validate(this.form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
@@ -776,8 +807,14 @@
</tr>
</table>
- <input type="button" value="Submit" class="hbSubmit"
- onClick="validate(this.form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
@@ -837,8 +874,14 @@
</tr>
</table>
- <input type="button" value="Submit" class="hbSubmit"
- onClick="validate(scr_form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
@@ -900,8 +943,14 @@
</tr>
</table>
- <input type="button" value="Submit" class="hbSubmit"
- onClick="validate(smb_form);" />
+ <div class="hbSubmit">
+ <input class="hbSubmit" type="button" value="Submit"
+ onClick="validate(this.form);" />
+ <input class="hbSubmit" type="button" value="Add a child resource"
+ onClick="add_child_resource(this.form)" />
+ <input class="hbSubmit" value="Delete this resource"
+ onClick="delete_resource(this.form)" />
+ </div>
</form>
</div>
--- conga/luci/cluster/resource_form_handlers.js 2006/08/10 23:06:20 1.3
+++ conga/luci/cluster/resource_form_handlers.js 2006/09/06 22:13:33 1.4
@@ -1,164 +1,129 @@
-/*swap_div switches between types of forms
- * based on a chooser within the document */
-function swap_div(container_id, element_id){
- container_element = document.getElementById(container_id);
- if (!container_element) {
- alert('Can\'t find element with id = ' + container_id);
- return (-1)
- }
- child_element = document.getElementById(element_id);
- if (!child_element) {
- alert('Can\'t find element with id = ' + element_id);
- return (-1)
- }
- for(child in child_element.children){
- alert(child);
- }
- temp = container_element.firstChild;
- container_element.replaceChild(child_element, container_element.firstChild);
-
- invisible_div = document.getElementById('invisible');
- if (!invisible_div) {
- alert('No invisible div');
- return (-1)
- }
-
- invisible_div.appendChild(temp);
-}
-
-/*In order to val a new resource type,
- *create a form within the resource-form-macros
- *with 'resource-name'_form as the 'name'
- *attribute, and use:
- * onSubmit="valResource('resource-name'_form)"
- *val handler functions here and further
- *down within actual cluster code.*/
-
-function validate(form){
- if(form.type.value != 'ip'){
- if(form.resourceName.value.length == 0){
- alert("Please enter a name for this resource. \n");
- return;
- }
- }
- /*Get the type of form from the first
- *part of the name string*/
- type = form.type.value;
- /*use eval to access proper resource
- *valer function as defined below*/
- eval("val"+(type.toUpperCase())+"(form);");
- /*TODO: val error checking!!!*/
-}
-
-/*Val an IP Resource*/
-function valIP(form){
- /*first, check to make sure all input
- *fields have values*/
- if (isNaN(parseInt(form.ip1.value)) ||
- isNaN(parseInt(form.ip2.value)) ||
- isNaN(parseInt(form.ip3.value)) ||
- isNaN(parseInt(form.ip4.value)) ) {
- error = "The IP Address contains illegal characters. \n";
- alert(error);
- }
- else{
- form.submit();
- }
-}
-
-/*Val an NFS Mount Resource*/
-function valNFSM(form){
- error = ""
- /*check to make sure all input
- *fields have values*/
- if(form.mountpoint.value == "")
- error += "Please enter a mount point.\n";
- if(form.host.value == "")
- error += "Please enter a host.\n";
- if(form.exportpath.value == "")
- error += "Please enter an export path.\n";
- if(error != "")
- alert(error);
- else
- form.submit();
-}
-
-/*Validate an NFS Export Resource*/
-function valNFSX(form){
- form.submit();
-}
-
-/*Validate an NFS Client Resource*/
-function valNFSC(form){
- error = ""
- /*check to make sure all input
- *fields have values*/
- if(form.target.value == "")
- error += "Please enter a target.\n";
- if(error != "")
- alert(error);
- else
- form.submit();
-}
-
-/*Validate an FS Resource*/
-function valFS(form){
- error = ""
- /*check to make sure all input
- *fields have values*/
- if(form.fsTypeSelect.value == "")
- error += "Please Select a file system type.\n";
- if(form.mountpoint.value == "")
- error += "Please enter a mount point.\n";
- if(form.device.value == "")
- error += "Please enter a device.\n";
- if(form.fsid.value == "")
- error += "Please enter a file system id.\n";
- if(error != "")
- alert(error);
- else
- form.submit();
-}
-
-/*Validate a GFS Resource*/
-function valGFS(form){
- error = ""
- /*check to make sure all input
- *fields have values*/
- if(form.mountpoint.value == "")
- error += "Please enter a mount point.\n";
- if(form.device.value == "")
- error += "Please enter a device.\n";
- if(form.fsid.value == "")
- error += "Please enter a file system id.\n";
- if(error != "")
- alert(error);
- else
- form.submit();
-}
-
-/*Validate a Script Resource*/
-function valSCR(form){
- error = ""
- /*check to make sure all input
- *fields have values*/
- if(form.file.value == "")
- error += "Please enter a filename.\n";
- if(error != "")
- alert(error);
- else
- form.submit();
-}
-
-/*Validate a Samba Resource*/
-function valSMB(form){
- error = ""
- /*check to make sure all input
- *fields have values*/
- if(form.workgroup.value == "")
- error += "Please enter a workgroup.\n";
- if(error != "")
- alert(error);
- else
- form.submit();
+function swap_div(container_id, element_id) {
+ var container_element = document.getElementById(container_id);
+ if (!container_element)
+ return (-1);
+
+ var child_element = document.getElementById(element_id);
+ if (!child_element)
+ return (-1);
+
+ var invisible_div = document.getElementById('invisible');
+ if (!invisible_div)
+ return (-1);
+
+ var temp = container_element.firstChild;
+ container_element.replaceChild(child_element, container_element.firstChild);
+ invisible_div.appendChild(temp);
+}
+
+function validate_ip(form) {
+ var errors = new Array();
+ var ipstr = form.ip1.value + '.' + form.ip2.value + '.' +
+ form.ip3.value + '.' + form.ip4.value;
+
+ if (!isValidHost(ipstr))
+ errors.push('\"' + ipstr '\" is an invalid IP address.');
+ return (errors);
+}
+
+function validate_nfs_mount(form) {
+ var errors = new Array();
+
+ if (!form.mountpoint || str_is_blank(form.mounpoint.value))
+ errors.push('No mount point was given.');
+
+ if (!form.host || str_is_blank(form.host.value))
+ errors.push('No NFS server host was given.');
+
+ if (!form.exportpath || str_is_blank(form.exportpath.value))
+ errors.push('No NFS export path was given.');
+ return (errors);
+}
+
+function validate_nfs_export(form) {
+ var errors = new Array();
+ return (errors);
+}
+
+function validate_nfs_client(form) {
+ var errors = new Array();
+
+ if (!form.target || str_is_blank(form.target.value))
+ errors.push('No NFS client target was given.');
+ return (errors);
+}
+
+function validate_filesystem(form) {
+ var errors = new Array();
+
+ if (!form.fsTypeSelect || str_is_blank(form.fsTypeSelect.value))
+ errors.push('No file system type was given.');
+
+ if (!form.mountpoint || str_is_blank(form.mountpoint.value))
+ errors.push('No file system mount point was given.');
+
+ if (!form.device || str_is_blank(form.device.value))
+ errors.push('No device containing the file system was given.');
+
+ if (!form.fsid || str_is_blank(form.fsid.value))
+ errors.push('No file system ID was given.');
+ return (errors);
+}
+
+function validate_gfs(form) {
+ my errors = new Array();
+
+ if (!form.mountpoint || str_is_blank(form.mountpoint.value))
+ errors.push('No file system mount point was given.');
+
+ if (!form.device || str_is_blank(form.device.value))
+ errors.push('No device containing file system was given.');
+
+ if (!form.fsid || str_is_blank(form.fsid.value))
+ errors.push('No file system ID was given.');
+ return (errors);
+}
+
+function validate_script(form) {
+ var errors = new Array();
+
+ if (!form.file || str_is_blank(form.file.value))
+ errors.push('No path to the script file was given.');
+ return (errors);
+}
+
+function validate_samba(form) {
+ var errors = new Array();
+
+ if (!form.workgroup || str_is_blank(form.workgroup.value))
+ errors.push('No workgroup was given');
+ return (errors);
+}
+
+var form_validators = new Array();
+form_validators['ip'] = validate_ip;
+form_validators['nfsm'] = validate_nfs_mount;
+form_validators['nfsx'] = validate_nfs_export;
+form_validators['nfsc'] = validate_nfs_client;
+form_validators['fs'] = validate_filesystem;
+form_validators['gfs'] = validate_gfs;
+form_validators['scr'] = validate_script;
+form_validators['smb'] = validate_samba;
+
+function validate(form) {
+ var valfn = form_validators[form.type.value];
+ if (!valfn)
+ return (-1);
+
+ if (error_dialog(valfn(form)))
+ return (-1);
+ form.submit();
+}
+
+function delete_resource(form) {
+ return (-1);
+}
+
+function add_child_resource(form) {
+ return (-1);
}
--- conga/luci/cluster/validate_config_qdisk.js 2006/08/17 16:22:41 1.1
+++ conga/luci/cluster/validate_config_qdisk.js 2006/09/06 22:13:33 1.2
@@ -1,3 +1,74 @@
+var heuristic_names = [ ':hname', ':hprog', ':hinterval', ':hscore', ':hdel' ];
+
+function clear_heuristic(form, heur_num) {
+ var str_prefix = 'heuristic' + heur_num;
+ for (var i = 0 ; i < heuristic_names.length - 1 ; i++) {
+ var id = str_prefix + heuristic_names[i];
+ var elem = document.getElementById(id);
+ if (!elem)
+ continue;
+ elem.value = '';
+ }
+
+ return (0);
+}
+
+function delete_qdisk_heur(field, form) {
+ if (!field)
+ return (-1);
+
+ if (!form)
+ return (-1);
+
+ var num_heur = form.num_heuristics;
+ if (!num_heur)
+ return (-1);
+ num_heur = Number(num_heur.value);
+
+ var id = field.id;
+ var hnum = id.split(':')[0].substr(9);
+ if (!is_valid_int(hnum, 0, 9))
+ return (-1);
+ hnum = Number(hnum);
+
+ if (num_heur < 1) {
+ if (!confirm('Delete this qurorum disk heuristic?'))
+ return (-1);
+
+ return (clear_heuristic(form, hnum));
+ }
+
+ var heur_body = document.getElementById('heuristicList');
+ if (!heur_body)
+ return (-1);
+
+ if (!confirm('Delete qurorum disk heuristic ' + (hnum + 1) + '?'))
+ return (-1);
+
+ heur_body.deleteRow(hnum)
+
+ for (var i = hnum + 1 ; i <= num_heur ; i++) {
+ var tr = document.getElementById('heuristic' + i);
+ if (!tr)
+ continue;
+ var prefix_str = 'heuristic' + (i - 1);
+
+ tr.setAttribute('id', prefix_str);
+ tr.setAttribute('name', prefix_str);
+
+ for (var n = 0 ; n < heuristic_names.length ; n++) {
+ var elem = document.getElementById('heuristic' + i + heuristic_names[n]);
+ if (!elem)
+ continue;
+
+ elem.setAttribute('id', prefix_str + heuristic_names[n]);
+ elem.setAttribute('name', prefix_str + heuristic_names[n]);
+ }
+ }
+
+ form.num_heuristics.value = num_heur - 1;
+}
+
function check_heuristic(hnum, form) {
var errors = new Array();
@@ -9,27 +80,27 @@
if (errors.length > 0)
return (errors);
- hstr = 'heuristic' + hnum + ':';
+ var hstr = 'heuristic' + hnum;
- hname = document.getElementById(hstr + 'hname');
+ var hname = document.getElementById(hstr + ':hname');
if (!hname || str_is_blank(hname.value))
errors.push('No name was given for heuristic ' + (hnum + 1));
else
hname = hname.value;
- hpath = document.getElementById(hstr + 'hpath');
+ var hpath = document.getElementById(hstr + ':hpath');
if (!hpath || str_is_blank(hpath.value))
errors.push('No path was given for heuristic ' + (hnum + 1));
else
hpath = hpath.value;
- hint = document.getElementById(hstr + 'hinterval');
+ var hint = document.getElementById(hstr + ':hinterval');
if (!hint || str_is_blank(hint.value))
errors.push('No interval was given for heuristic ' + (hnum + 1));
else
hint = hint.value;
- hscore = document.getElementById(hstr + 'hscore');
+ var hscore = document.getElementById(hstr + ':hscore');
if (!hscore || str_is_blank(hscore.value))
errors.push('No score was given for heuristic ' + (hnum + 1));
else
@@ -60,12 +131,13 @@
return (error_dialog(errors));
}
+ var qpart = null;
if (form.quorumd[0].checked)
qpart = 0
else if (form.quorumd[1].checked)
qpart = 1;
else {
- errors.push('You submitted an invalid value while specifying whether or not to use a quorum partition: ' + qpart + '.');
+ errors.push('You submitted an invalid value while specifying whether or not to use a quorum partition.');
return (error_dialog(errors));
}
@@ -102,17 +174,17 @@
errors.push('No device setting was given.');
else {
/* TODO: check this */
- device = form.device.value;
+ var device = form.device.value;
}
if (!form.label || str_is_blank(form.label.value))
errors.push('No label setting was given.');
else {
/* TODO: check this */
- label = form.device.label;
+ var label = form.device.label;
}
- hnum = document.getElementById('num_heuristics');
+ var hnum = document.getElementById('num_heuristics');
if (hnum) {
hnum = Number(hnum.value);
if (hnum == 0)
@@ -135,10 +207,11 @@
var oldInput = null;
function addHeuristic(parent_name) {
- parent = document.getElementById(parent_name);
- if (!parent)
+ var parente = document.getElementById(parent_name);
+ if (!parente)
return;
- hnum = document.getElementById('num_heuristics');
+
+ var hnum = document.getElementById('num_heuristics');
if (!hnum)
return;
@@ -147,69 +220,86 @@
alert('There is a maximum of 10 heuristics.');
return;
}
- hstr = 'heuristic' + cur_hnum + ':';
- name_td = document.createElement('td');
+ var hstr = 'heuristic' + cur_hnum;
+
+ var name_td = document.createElement('td');
name_td.className = 'systemsTable';
- name_input = document.createElement('input');
+ var name_input = document.createElement('input');
name_input.className = 'qdname qdisk';
- name_input.setAttribute('name', hstr + 'hname');
- name_input.setAttribute('id', hstr + 'hname');
+ name_input.setAttribute('name', hstr + ':hname');
+ name_input.setAttribute('id', hstr + ':hname');
name_input.setAttribute('type', 'text');
name_td.appendChild(name_input);
- path_td = document.createElement('td');
+ var path_td = document.createElement('td');
path_td.className = 'systemsTable';
- path_input = document.createElement('input');
+ var path_input = document.createElement('input');
path_input.className = 'qdpath qdisk';
- path_input.setAttribute('name', hstr + 'hprog');
- path_input.setAttribute('id', hstr + 'hprog');
+ path_input.setAttribute('name', hstr + ':hprog');
+ path_input.setAttribute('id', hstr + ':hprog');
path_input.setAttribute('type', 'text');
path_td.appendChild(path_input);
- interval_td = document.createElement('td');
+ var interval_td = document.createElement('td');
interval_td.className = 'systemsTable';
- interval_input = document.createElement('input');
+ var interval_input = document.createElement('input');
interval_input.className = 'qdint qdisk';
- interval_input.setAttribute('name', hstr + 'hinterval');
- interval_input.setAttribute('id', hstr + 'hinterval');
+ interval_input.setAttribute('name', hstr + ':hinterval');
+ interval_input.setAttribute('id', hstr + ':hinterval');
interval_input.setAttribute('type', 'text');
interval_td.appendChild(interval_input);
- score_td = document.createElement('td');
+ var score_td = document.createElement('td');
score_td.className = 'systemsTable';
- score_input = document.createElement('input');
+ var score_input = document.createElement('input');
score_input.className = 'qdscore qdisk';
- score_input.setAttribute('name', hstr + 'hscore');
- score_input.setAttribute('id', hstr + 'hscore');
+ score_input.setAttribute('name', hstr + ':hscore');
+ score_input.setAttribute('id', hstr + ':hscore');
score_input.setAttribute('type', 'input');
score_td.appendChild(score_input);
- tr = document.createElement('tr');
+ var del_td = document.createElement('td');
+ del_td.className = 'systemsTable';
+ var del_img = document.createElement('img');
+ del_img.className = 'qdscore qdisk qdel_img';
+ del_img.setAttribute('name', hstr + ':hdel');
+ del_img.setAttribute('id', hstr + ':hdel');
+ del_img.setAttribute('src', '/luci/homebase/x.png');
+ del_img.setAttribute('onClick', 'delete_qdisk_heur(this, document.quorum_partition)');
+ del_td.appendChild(del_img);
+
+ var tr = document.createElement('tr');
tr.className = 'systemsTable';
+ tr.setAttribute('id', 'heuristic' + cur_hnum);
tr.appendChild(name_td);
tr.appendChild(path_td);
tr.appendChild(interval_td);
tr.appendChild(score_td);
- parent.appendChild(tr);
- hnum.value++;
+ tr.appendChild(del_td);
+ parente.appendChild(tr);
+ hnum.value = cur_hnum;
}
function disableChildrenInput(parent_name) {
- parent = document.getElementById(parent_name);
- if (!parent)
+ var parente = document.getElementById(parent_name);
+ if (!parente)
return;
- inputElem = parent.getElementsByTagName('input');
+ var inputElem = parente.getElementsByTagName('input');
if (!inputElem || inputElem.length < 1) {
oldInput = null;
return;
}
+
if (inputElem[0].disabled)
return;
+
oldInput = new Array(inputElem.length);
for (var i = 0 ; i < inputElem.length ; i++) {
- e = inputElem[i];
+ var e = inputElem[i];
+ if (e.type == 'hidden')
+ continue;
e.disabled = true;
if (e.type == 'button')
@@ -220,22 +310,18 @@
}
function enableChildrenInput(parent_name) {
- parent = document.getElementById(parent_name);
- if (!parent)
+ var parente = document.getElementById(parent_name);
+ if (!parente)
return;
- inputElem = parent.getElementsByTagName('input');
- if (!inputElem || inputElem.length < 1) {
- return;
- }
-
- if (!inputElem[0].disabled)
+ var inputElem = parente.getElementsByTagName('input');
+ if (!inputElem || inputElem.length < 1 || !inputElem[0].disabled)
return;
for (var i = 0 ; i < inputElem.length ; i++) {
- e = inputElem[i];
+ var e = inputElem[i];
e.disabled = false;
- if (e.type == 'button')
+ if (e.type == 'button' || e.type == 'hidden')
continue;
if (oldInput && oldInput[e.name])
e.value = oldInput[e.name];
More information about the Cluster-devel
mailing list