[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/cluster fence_device.js



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	kupcevic sourceware org	2006-12-12 13:37:25

Added files:
	luci/cluster   : fence_device.js 

Log message:
	Forgotten file

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence_device.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.2.2.1

/cvs/cluster/conga/luci/cluster/fence_device.js,v  -->  standard output
revision 1.2.2.1
--- conga/luci/cluster/fence_device.js
+++ -	2006-12-12 13:37:26.695843000 +0000
@@ -0,0 +1,95 @@
+function swap_fence_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) {
+		if (container_element.firstChild)
+			container_element.removeChild(container_element.firstChild);
+		return (-1);
+	}
+
+	if (container_element.firstChild)
+		container_element.removeChild(container_element.firstChild);
+	var target = child_element.cloneNode(1);
+	target.id = null;
+	container_element.appendChild(target);
+}
+
+function swap_node_fence_div(container_id, fence_opt) {
+	var container_element = document.getElementById(container_id);
+	if (!container_element || !fence_opt || !fence_opt.value)
+		return (-1);
+
+	var fence_id = fence_opt.value;
+	var child_element = document.getElementById(fence_id);
+	if (container_element.firstChild)
+		container_element.removeChild(container_element.firstChild);
+
+	if (!child_element)
+		return (-1);
+
+	var target = child_element.cloneNode(1);
+	target.id = null;
+
+	var fence_type = fence_id;
+	if (fence_opt.className.match(/shared_fencedev/)) {
+		var input_tags = target.getElementsByTagName('input');
+		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')
+					fence_type = input_tags[i].value;
+			}
+		}	
+	}
+
+	var fi_form = document.getElementById(fence_type + '_instance');
+	if (fi_form)
+		target.appendChild(fi_form.cloneNode(1));
+	container_element.appendChild(target);
+}
+
+var num_fences_level = Array(0, 0)
+
+function add_node_fence_device(fence_level) {
+	var cont_name = 'fence_list_level' + fence_level;
+	var container = document.getElementById(cont_name);
+	if (!container)
+		return (-1);
+
+	var chooser_elem = document.getElementById('fence_selection_block');
+	if (!chooser_elem)
+		return (-1);
+
+	var div_elem = document.createElement('div');
+	if (!div_elem)
+		return (-1);
+	var level_num_fences = num_fences_level[fence_level];
+
+	div_elem.id = 'fence' + fence_level + '_' + level_num_fences;
+	chooser_elem = chooser_elem.cloneNode(1);
+	chooser_elem.id = null;
+	chooser_elem.className = null;
+
+	var input_elems = chooser_elem.getElementsByTagName('input');
+	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')
+			input_elems[i].value = fence_level;
+		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)
+		return (-1);
+	select_elem[0].setAttribute('onChange', "swap_node_fence_div('" + div_elem.id + "', this.options[this.selectedIndex])");
+
+	div_elem.appendChild(chooser_elem);
+	container.appendChild(div_elem);
+	num_fences_level[fence_level]++;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]