gecko-dev/webtools/litmus/js/SubGroup.js
ccooper%deadsquid.com 113123bc48 b=323768
- remove Navigation.js (moved to help text in templates)
- remove Percentages js (moved to help text in templates)
- add extra sanity check when repopulating form fields with FormPersist.js
- disable testgroup/subgroup select boxes -> interim step until test runs since we have no UI to change them yet

b=322607
- add hideAll, and simple toggle functions to moo.fx
2006-06-05 01:22:25 +00:00

67 lines
1.8 KiB
JavaScript
Executable File

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function showsubgroup() {
var groupselect = MM_findObj("group");
var selnum;
if (groupselect instanceof NodeList) {
for (var i=0; i<groupselect.length; i++) {
if (groupselect[i].checked) {
selnum = groupselect[i].value;
}
}
} else {
selnum = groupselect.value;
}
// no selection yet so just keep everything as-is:
if (! selnum) {
return;
}
// object to show
var obj = MM_findObj("divsubgroup_"+selnum);
// disable all of them
for (var i=0; i<groupselect.length; i++) {
var gnum = groupselect[i].value;
var disableobj = MM_findObj("divsubgroup_"+gnum);
disableobj.style.display = "none";
}
MM_findObj("divsubgroup_null").style.display = "none";
var num_subgroups_enabled = 0;
var subgroupselect = MM_findObj("subgroup_"+selnum);
if (subgroupselect instanceof NodeList) {
for (var i=0; i<subgroupselect.length; i++) {
if (!subgroupselect[i].disabled) {
num_subgroups_enabled++;
}
}
} else if (subgroupselect instanceof HTMLInputElement) {
num_subgroups_enabled=1;
}
obj.style.display = "";
if (num_subgroups_enabled == 0) {
MM_findObj("Submit").disabled = true;
} else {
MM_findObj("Submit").disabled = false;
}
}
function group_init() {
testConfigHeight = new fx.Height('testconfig', {duration: 400});
testConfigHeight.hide();
}