src/hg/js/hui.js 1.38
1.38 2009/10/20 23:24:43 tdreszer
Major changes to support the matrix 3-way CBs. Also some cleanup of old code.
Index: src/hg/js/hui.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hui.js,v
retrieving revision 1.37
retrieving revision 1.38
diff -b -B -U 4 -r1.37 -r1.38
--- src/hg/js/hui.js 9 Oct 2009 19:57:57 -0000 1.37
+++ src/hg/js/hui.js 20 Oct 2009 23:24:43 -0000 1.38
@@ -1,15 +1,8 @@
// JavaScript Especially for hui.c
// $Header$
-var debugLevel = 0;
-var viewDDtoSubCB = true;
-var viewDDtoSubCBhide = false;
var compositeName = "";
-//var viewDDtoMatCB = true; //true;
-//var matCBwithViewDD = true;
-//var subCBtoMatCB = true;
-//var matCBtoSubCB = true; // Always
//var now = new Date();
//var start = now.getTime();
//$(window).load(function () {
// if(start != null) {
@@ -22,61 +15,46 @@
// The 'mat*' functions are especially designed to support subtrack configuration by 2D matrix of controls
function matSelectViewForSubTracks(obj,view)
{
-// Handle any necessary changes to subtrack checkboxes when the view changes
+// viewDD:onchange Handle any necessary changes to subtrack checkboxes when the view changes
// views are "select" drop downs on a subtrack configuration page
if( obj.selectedIndex == 0) { // hide
- if(viewDDtoSubCBhide) {
- matSetSubtrackCheckBoxes(false,view);
- //if(viewDDtoMatCB)
- // $("input.matrixCB").filter(":checked").each( function (i) { matChkBoxNormalize(this); } );
- }
- matEnableSubtrackCheckBoxes(false,view);
+ matSubCBsEnable(false,view);
hideConfigControls(view);
- //enableViewCfgLink(false,view); // Could "disable" view cfg when hidden!
} else {
- //enableViewCfgLink(true,view); // Would need to reeanble view cfg when visible
-
// Make main display dropdown show full if currently hide
compositeName = obj.name.substring(0,obj.name.indexOf(".")); // {trackName}.{view}.vis
exposeComposite(compositeName);
// if matrix used then: essentially reclick all 'checked' matrix checkboxes
- if(viewDDtoSubCB) {
- var CBs = $("input.matrixCB").filter(":checked");
+ var CBs = $("input.matCB").filter(":checked");
if(CBs.length > 0) {
var classSets = new Array();
CBs.each( function (i) { classSets.push( $(this).attr("class") ); } );
if(classSets.length > 0) {
// Now it would be good to create a list of all subtrack CBs that match view,unchecked, and a class set (pair or triplet!)
- CBs = $("input.subtrackCB").filter("."+view).not(":checked");
+ CBs = $("input.subCB").filter("."+view).not(":checked");
if(CBs.length > 0) {
while(classSets.length > 0) {
var OneOrMoreClasses = classSets.pop();
var JustTheseCBs = CBs;
if(OneOrMoreClasses.length > 0) {
- OneOrMoreClasses = OneOrMoreClasses.replace("matrixCB ",""); // "matrixCB K562 CTCF" to "K562 CTCF"
+ OneOrMoreClasses = OneOrMoreClasses.replace("matCB ",""); // "matCB K562 CTCF" to "K562 CTCF"
var classes = OneOrMoreClasses.split(" ");
while(classes.length > 0) {
JustTheseCBs = JustTheseCBs.filter("."+classes.pop());
}
JustTheseCBs.each( function (i) {
this.checked = true;
- setCheckBoxShadow(this);
+ matSubCBsetShadow(this);
hideOrShowSubtrack(this);
});
}
}
}
}
}
- } else {
- matSetSubtrackCheckBoxes(true,view);
- }
- //if(viewDDtoMatCB)
- // matChkBoxesNormalized();
- // //$("input.matrixCB").not(":checked").each( function (i) { matChkBoxNormalize(this); } );
- matEnableSubtrackCheckBoxes(true,view);
+ matSubCBsEnable(true,view);
}
}
function exposeComposite(compositeName)
@@ -88,170 +66,367 @@
$(compositeDD).attr('selectedIndex',maxVis);
}
}
-// Obsolete because matCBwithViewDD is not true
-//function getViewNamesSelected(on)
-//{
-//// Returns an array of all views that are on or off (hide)
-//// views are "select" drop downs containing 'hide','dense',...
-//// To be clear, an array of strings with the view name is returned.
-// var views = new Array();
-// var list = $(".viewDd");
-// if(on)
-// list = $(list).filter("[selectedIndex!=0]")
-// else
-// list = $(list).filter("[selectedIndex=0]")
-// $(list).each( function (i) {
-// views.push(this.name.substring(this.name.indexOf('.') + 1, this.name.lastIndexOf('.')));
-// });
-// return( views );
-//}
-
-function checkBoxSet(CB,state)
+function matSubCbClick(subCB)
{
- CB.checked = state;
- setCheckBoxShadow(CB);
- hideOrShowSubtrack(CB);
+// subCB:onclick When a subtrack checkbox is clicked, it may result in
+// Clicking/unclicking the corresponding matrix CB. Also the
+// subtrack may be hidden as a result.
+ matSubCBsetShadow(subCB);
+ hideOrShowSubtrack(subCB);
+ // When subCBs are clicked, 3-state matCBs may need to be set
+ var classes = matViewClasses('hidden');
+ classes = classes.concat( matZeeCBclasses('unchecked') );
+ var matCB = matCbFindFromSubCb( subCB );
+ if( matCB != undefined ) {
+ matChkBoxNormalize( matCB, classes );
+ }
+ //var zeeCB = matZeeCbFindFromSubCb( subCB );
+ //if( zeeCB != undefined ) {
+ // matChkBoxNormalize( zeeCB, classes );
+ //}
}
-function matSetMatrixCheckBoxes(state)
+function matCbClick(matCB)
{
-// Set all Matrix checkboxes to state. If additional arguments are passed in, the list of CBs will be narrowed by the classes
- var CBs;
- if(state)
- CBs = $("input.matrixCB").not(":checked");
+// matCB:onclick When a matrix CB is clicked, the set of subtracks checked may change
+// Also called indirectly by matButton:onclick via matSetMatrixCheckBoxes
+
+ matCbComplete(matCB,true); // No longer partially checked
+ var classes = $( matCB ).attr("class");
+ var isZee = (classes.indexOf("dimZ") > 0);
+ classes = classes.replace("matCB ","");
+ if(isZee)
+ classes = classes.replace("dimZ ","");
else
- CBs = $("input.matrixCB").filter(":checked").not(".dimZ");// uncheck should not touch dimZ
- for(var vIx=1;vIx<arguments.length;vIx++) {
- CBs = $( CBs ).filter("."+arguments[vIx]); // Successively limit list by additional classes.
- }
- CBs.each( function (i) { this.checked = state;} )
- //CBs.each( function (i) { if(this.checked != state) this.click();} )
+ classes = classes.replace("halfVis","");
+ var classList = new Array;
+ if(classes.length > 0)
+ classList = classes.split(" ");
+ if(classList.length == 0 )
+ matSubCBsCheck(matCB.checked);
+ else if(classList.length == 1 )
+ matSubCBsCheck(matCB.checked,classList[0]);
+ else if(classList.length == 2 )
+ matSubCBsCheck(matCB.checked,classList[0],classList[1]);
+ else if(classList.length == 3 )
+ matSubCBsCheck(matCB.checked,classList[0],classList[1],classList[2]); // I don't think it will ever go beyond 4
+ else
+ matSubCBsCheck(matCB.checked,classList[0],classList[1],classList[2],classList[3]);
- if(state) {
- CBs = $("input.subtrackCB").not(":checked");
- // need to weed out non-checked dimZ if there are any
- var zCBs = $("input.matrixCB.dimZ").not(":checked");
- if( $( zCBs ).length > 0) {
- var classes = ""; // make string of classes
- $(zCBs).each( function (i) {
- classes += $( this ).attr("class").replace("matrixCB dimZ ",".");
- });
- CBs = $( CBs ).not(classes); // weed CBs
+ if(isZee) { // if dimZ then we may have just made indeterminate X and Ys determinate
+ if(matCB.checked == false) { // checking new dimZs cannot change indeterminate state.
+ var matCBs = matCBsWhichAreComplete(false);
+ if($("input.matCB.dimZ:checked").length == 0)
+ $( matCBs ).each( function (i) { matCbComplete( this, true ); });
+ else {
+ var classes = matViewClasses('hidden');
+ classes = classes.concat( matZeeCBclasses('unchecked') );
+ $( matCBs ).each( function (i) { matChkBoxNormalize( this, classes ); });
+ }
+ }
}
- } else
- CBs = $("input.subtrackCB").filter(":checked");
+}
+
+function matSetMatrixCheckBoxes(state)
+{
+// matButtons:onclick Set all Matrix checkboxes to state. If additional arguments are passed in, the list of CBs will be narrowed by the classes
+ var matCBs = $("input.matCB").not(".dimZ");
for(var vIx=1;vIx<arguments.length;vIx++) {
- CBs = CBs.filter("."+arguments[vIx]); // Successively limit list by additional classes.
+ matCBs = $( matCBs ).filter("."+arguments[vIx]); // Successively limit list by additional classes.
}
- CBs.each( function (i) { checkBoxSet(this,state); });
+ $( matCBs ).each( function (i) {
+ this.checked = state;
+ matCbComplete(this,true);
+ matCbClick(this); // If this is inefficient, then replace it with subCB iteration logic below
+ });
+
+ //var subCBs;
+ //if(state) {
+ // subCBs = $("input.subCB").not(":checked");
+ // var classes = matZeeCBclasses('unchecked'); // need to weed out non-checked dimZ if there are any
+ // subCBs = objsFilterByClasses(subCBs,false,classes);
+ //} else
+ // subCBs = $("input.subCB").filter(":checked");
+
+ //for(var vIx=1;vIx<arguments.length;vIx++) {
+ // subCBs = $( subCBs ).filter("."+arguments[vIx]); // Successively limit list by additional classes.
+ //}
+ //$( subCBs ).each( function (i) { matSubCBcheckOne(this,state); });
return true;
}
-function subtrackCBsSetAll(state)
+///////////// CB support routines ///////////////
+// Terms:
+// viewDD - view drop-down control
+// matButton: the [+][-] button controls associated with the matrix
+// matCB - matrix dimX and dimY CB controls (in some cases this set contains zeeCBs as well because they are part of the matrix)
+// zeeCB - matrix dimZ CB controls
+// subCB - subtrack CB controls
+// What does work
+// 1) 4 state subCBs: checked/unchecked enabled/disabled (which is visible/hidden)
+// 2) 3 state matCBs for dimX and Y but not for Z (checked,unchecked,indeterminate (incomplete set of subCBs for this matCB))
+// 3) cart vars for viewDD, zeeCBs and subCBs but matCBs set by the state of those 3
+// What is awkward or does not work
+// A) Awkward: matCB could be 5 state (all,none,subset,superset,excusive non-matching set)
+function matSubCBsCheck(state)
{
// Set all subtrack checkboxes to state. If additional arguments are passed in, the list of CBs will be narrowed by the classes
- var CBs;
- if(state)
- CBs = $("input.subtrackCB").not(":checked");
- else
- CBs = $("input.subtrackCB").filter(":checked");
+// called by matCB clicks (matCbClick()) !
+ var subCBs = $("input.subCB");
for(var vIx=1;vIx<arguments.length;vIx++) {
- CBs = CBs.filter("."+arguments[vIx]); // Successively limit list by additional classes.
+ subCBs = subCBs.filter("."+arguments[vIx]); // Successively limit list by additional classes.
+ }
+
+ if(state) { // If checking subCBs, then make sure up to 3 dimensions of matCBs agree with each other on subCB verdict
+ if(arguments.length == 3) { // Requested dimX&Y: check dimZ state
+ var classes = matZeeCBclasses('unchecked');
+ subCBs = objsFilterByClasses(subCBs,false,classes);
+ $( subCBs ).each( function (i) { matSubCBcheckOne(this,state); });
+ } else {//if(arguments.length == 2) { // Requested dimZ (or only 1 dimension so this code is harmless)
+ var matXY = $("input.matCB").not(".dimZ"); // check X&Y state
+ matXY = $( matXY ).filter(":checked");
+ for(var mIx=0;mIx<matXY.length;mIx++) {
+ var classes = $(matXY[mIx]).attr("class");
+ classes = classes.replace("matCB","");
+ classes = classes.replace("halfVis","");
+ classes = '.' + classes.split(' ').join(".");
+ $( subCBs ).filter(classes).each( function (i) { matSubCBcheckOne(this,state); });
+ }
}
- CBs.each( function (i) { checkBoxSet(this,state); });
+ } else // state not checked so no filtering by other matCBs needed
+ subCBs.each( function (i) { matSubCBcheckOne(this,state); });
return true;
}
-function matSetSubtrackCheckBoxes(state)
+function matSubCBsEnable(state)
{
-// Set all subtrack checkboxes to state. If additional arguments are passed in, the list of CBs will be narrowed by the classes
- var CBs = $("input.subtrackCB");
+// Enables/Disables subtracks checkboxes. If additional arguments are passed in, the list of CBs will be narrowed by the classes
+ var subCBs = $("input.subCB");
for(var vIx=1;vIx<arguments.length;vIx++) {
- CBs = CBs.filter("."+arguments[vIx]); // Successively limit list by additional classes.
+ if(arguments[vIx].length > 0)
+ subCBs = subCBs.filter("."+arguments[vIx]); // Successively limit list by additional classes.
}
- // This next block of code is needed to make dimZ work with dimsX&Y
+ subCBs.each( function (i) {
if(state) {
- var dimZ = $("input.matrixCB.dimZ");
- if(dimZ.length > 0) {
- if(arguments.length == 3) { // Requested dimX&Y
- dimZ = dimZ.filter(":checked");
- for(var dIx=0;dIx<dimZ.length;dIx++) {
- var classes = $(dimZ[dIx]).attr("class");
- classes = classes.replace("matrixCB ","");
- classes = classes.replace("dimZ","");
- classes = classes.replace(/ /g,".");
- CBs.filter(classes).each( function (i) { checkBoxSet(this,state); });
- }
- // Okay, that works for including dimZ when dimX&Y is clicked. What about including dimX&Y when dimZ is clicked?
- } if(arguments.length == 2) { // Requested dimZ
- var dimsXY = $("input.matrixCB").not(".dimZ");
- dimsXY = dimsXY.filter(":checked");
- for(var dIx=0;dIx<dimsXY.length;dIx++) {
- var classes = $(dimsXY[dIx]).attr("class");
- classes = classes.replace("matrixCB","");
- classes = classes.replace(/ /g,".");
- CBs.filter(classes).each( function (i) { checkBoxSet(this,state); });
- }
- }
- return true; // Notice if dimZ exists (regardless of checked state) then need to return
- }
+ $(this).parent().attr('title','');
+ $(this).parent().attr('cursor','pointer');
+ } else {
+ $(this).parent().attr('title','view is hidden');
+ $(this).parent().attr('cursor','pointer');
}
- // state uncheck or dimZ doesn't exist
- CBs.each( function (i) { checkBoxSet(this,state); });
+ this.disabled = !state;
+ matSubCBsetShadow(this);
+ hideOrShowSubtrack(this);
+ });
return true;
}
-function setCheckBoxShadow(CB)
+function matSubCBcheckOne(subCB,state)
+{
+// setting a single subCB may cause it to appear/disappear
+ subCB.checked = state;
+ matSubCBsetShadow(subCB);
+ hideOrShowSubtrack(subCB);
+}
+
+function matSubCBsetShadow(subCB)
{
// Since CBs only get into cart when enabled/checked, the shadow control enables cart to know other states
var shadowState = 0;
- if(CB.checked)
+ if(subCB.checked)
shadowState = 1;
- if(CB.disabled)
+ if(subCB.disabled)
shadowState -= 2;
- $("input[name='boolshad."+CB.name+"']").val(shadowState);
+ $("input[name='boolshad."+subCB.name+"']").val(shadowState);
}
-function matEnableSubtrackCheckBoxes(state)
+function matChkBoxNormalize(matCB)
{
-// Enables/Disables subtracks checkboxes. If additional arguments are passed in, the list of CBs will be narrowed by the classes
- var CBs = $("input.subtrackCB");
- for(var vIx=1;vIx<arguments.length;vIx++) {
- CBs = CBs.filter("."+arguments[vIx]); // Successively limit list by additional classes.
+// Makes sure matCBs are in one of 3 states (checked,unchecked,indeterminate) based on matching set of subCBs
+ var classes = $( matCB ).attr("class");
+ var isZee = (classes.indexOf("dimZ") > 0);
+ classes = classes.replace("matCB "," ");
+ if(isZee)
+ classes = classes.replace("dimZ ","");
+ else
+ classes = classes.replace("halfVis","");
+ classes = '.' + classes.split(' ').join(".");// created string filter of classes converting "matCB K562 H3K4me1" as ".K562.H3K4me1" (or "matCB rep1 dimZ" to "rep1")
+ var subCBs = $("input.subCB").filter(classes); // All subtrack CBs that match matrix CB
+ if(arguments.length > 1 && arguments[1].length > 0) { // dimZ NOT classes
+ subCBs = objsFilterByClasses(subCBs,false,arguments[1]);
+ }
+ if(subCBs.length > 0) {
+ var CBsChecked = subCBs.filter(":checked");
+ //if(isZee) {
+ // // dimZ CBs are indeterminate if checked and none are or not checked and some are
+ // if(($(matCB).is(':checked') && CBsChecked.length == 0)
+ // || ($(matCB).is(':checked') == false && CBsChecked.length > 0))
+ // matCbComplete(matCB,false);
+ // else
+ // matCbComplete(matCB,true);
+ //} else {
+ if(!isZee) {
+ if(CBsChecked.length == subCBs.length) {
+ matCbComplete(matCB,true);
+ $(matCB).attr('checked',true);
+ } else if(CBsChecked.length == 0) {
+ matCbComplete(matCB,true);
+ $(matCB).attr('checked',false);
+ } else {
+ matCbComplete(matCB,false);
+ $(matCB).attr('checked',true);
}
- //if(matCBwithViewDD) {
- // if(state) { // further filter by view
- // views = getViewNamesSelected(false); // get views (strings) that are off
- // for(var vIx=0;vIx<views.length;vIx++) {
- // CBs = CBs.filter(":not(."+views[vIx]+")"); // Successively limit list by additional classes.
- // }
- // }
- //}
- CBs.each( function (i) {
- this.disabled = !state;
- setCheckBoxShadow(this);
- hideOrShowSubtrack(this);
+ }
+ }
+}
+
+function matChkBoxesNormalizeAll()
+{
+// document:load Makes sure all matCBs are in one of 3 states (checked,unchecked,indeterminate) based on matching set of subCBs
+ var matCBs = $("input.matCB").not(".dimZ");
+ var zeeCBs = $("input.matCB.dimZ");
+ var classes = matViewClasses('hidden');
+ if( $(zeeCBs).length > 0) {
+ // Should do dimZ first, then go back and do non-dimZ with extra restrictions!
+ $(zeeCBs).each( function (i) {
+ // do not normaize dimZ. These are set only by cart variables
+ matChkBoxNormalize(this,classes); // checks dimZ matCBs which have any subtracks checked.
+ if( $(this).is(':checked') == false ) {
+ classes.push( $( this ).attr("class").replace("matCB ","").replace("dimZ ","") ); // builds classes string filter like ".rep2.rep3" which are those mat cbs that are not checed.
+ }
+ } );
+ }
+ $(matCBs).each( function (i) { matChkBoxNormalize(this,classes); } );
+
+ // For each viewDD not selected, disable associated subtracks
+ $('select.viewDD').not("[selectedIndex]").each( function (i) {
+ var viewClass = this.name.substring(this.name.indexOf(".") + 1,this.name.lastIndexOf("."));
+ matSubCBsEnable(false,viewClass);
});
+}
- return true;
+function matCbComplete(matCB,complete)
+{
+// Makes aore removes the 3rd (indeterminate) matCB state
+ // Too many options:
+ // 1) addClass()/removeClass() (which does not directly support title)
+ // 2) wrap div which could contain border, color, content. content is not on one line: size is difficult
+ // 3) wrap font which could contain border, color, content. content is on one line: size is difficult
+ // 4) *[ ]* ?[ ]? *[ ]* No text seems right; borders? colors? opacity? Yes, minimum
+ if(complete) {
+ $(matCB).css('opacity', '1'); // For some reason IE accepts direct change but isn't happy with simply adding class!
+ $(matCB).removeClass('halfVis');
+ $(matCB).parent().attr("title","");
+ } else {
+ $(matCB).css('opacity', '0.5');
+ $(matCB).addClass('halfVis');
+ $(matCB).parent().attr("title","Not all associated subtracks have been selected");
+ }
}
-function matSubtrackCbClick(subCb)
+function matCBsWhichAreComplete(complete)
{
-// When a subrtrack checkbox is clicked, it may result in
-// Clicking/unclicking the corresponding matrix CB. Also the
-// subtrack may be hidden as a result.
- //if(subCBtoMatCB)
- // matChkBoxNormalizeMatching(subCb);
- setCheckBoxShadow(subCb);
- hideOrShowSubtrack(subCb);
+// Returns a list of currently indeterminate matCBs. This is encapsulated to keep consistent with matCbComplete()
+ if(complete)
+ return $("input.matCB").not(".halfVis");
+ else
+ return $("input.matCB.halfVis");
}
+function matCbFindFromSubCb(subCB)
+{
+// returns the one matCB associated with a subCB (or undefined)
+ var classes = $( subCB ).attr("class");
+ classes = classes.replace("subCB ","");
+ // How to deal with dimZ and view? Assume view is at end and dimZ is penultimate
+ var classList = classes.split(" ");
+ var end=classList.length - 1; // Avoid last one
+ var zeeCBs = $("input.matCB.dimZ");
+ if( zeeCBs.length > 0 )
+ end--;
+ classes ='.' + classList.slice(0,end).join('.');
+ // At this point classes has been converted from "subCB 1GM12878 CTCF rep1 cHot" to ".1GM12878.CTCF"
+ var matCB = $("input.matCB"+classes); // NOte, this works for filtering multiple classes because we want AND
+ if(matCB.length == 1)
+ return matCB;
+ else
+ return undefined;
+}
+
+function matZeeCBfindFromSubCb(subCB)
+{
+// returns the one zeeCB associated with a subCB (or undefined)
+ var zeeCBs = $("input.matCB.dimZ");
+ if( zeeCBs.length > 0 ) {
+ var classes = $( subCB ).attr("class");
+ // How to deal with d1mZ and view? Assume view is at end and dimZ is penultimate
+ var classList = classes.split(" ");
+ var zIx=classList.length - 2;
+ if(zIx >= 0) {
+ zeeCB = $(zeeCBs).filter('.'+classList[zIx]);
+ if(zeeCB.length == 1)
+ return zeeCB;
+ }
+ }
+ return undefined;
+}
+
+function objsFilterByClasses(objs,keep,classes)
+{
+// Accepts an obj list and an array of classes, then filters successively by that list
+ if( classes != undefined && classes.length > 0 ) {
+ if(keep) {
+ objs = $( objs ).filter( '.' + classes.join('.') ); // filter('class1.class2') is same as filter('.class1').filter('.class2')
+ } else {
+ for(var cIx=classes.length-1;cIx>-1;cIx--) {
+ objs = $( objs ).not( '.' + classes[cIx] ); // not('class1.class2') is different from not('.class1').not('.class2')
+ }
+ }
+ }
+ return objs;
+}
+
+function matViewClasses(limitTo)
+{
+// returns an array of classes from the ViewDd: converts "viewDD normalText SIG"[]s to "SIG","zRAW"
+ var classes = new Array;
+ var viewDDs = $("select.viewDD");//.filter("[selectedIndex='0']");
+ if(limitTo == 'hidden') {
+ viewDDs = $(viewDDs).not("[selectedIndex]");
+ } else if(limitTo == 'visible') {
+ viewDDs = $(viewDDs).filter("[selectedIndex]");
+ }
+ $(viewDDs).each( function (i) {
+ classes.push( $( this ).attr("class").replace("viewDD ","").replace("normalText ","") );
+ });
+ return classes;
+}
+
+function matZeeCBclasses(limitTo)
+{
+// returns an array of classes from the dimZ CB classes: converts "matCB dimZ rep1"[]s to "rep1","rep2"
+ var classes = new Array;
+ var zeeCBs = $("input.matCB.dimZ");
+ if(zeeCBs.length > 0) {
+ if(limitTo == 'unchecked') {
+ zeeCBs = zeeCBs.not(":checked");
+ } else if(limitTo == 'checked') {
+ zeeCBs = zeeCBs.filter(":checked");
+ }
+ $(zeeCBs).each( function (i) {
+ classes.push( $( this ).attr("class").replace("matCB ","").replace("dimZ ","") );
+ });
+ }
+ return classes;
+}
+
+/////////////////// subtrack configuration support ////////////////
+
function compositeCfgUpdateSubtrackCfgs(inp)
{
// Updates all subtrack configuration values when the composite cfg is changed
var suffix = inp.name.substring(inp.name.indexOf(".")); // Includes '.'
@@ -347,9 +522,9 @@
}
function enableAllViewCfgLinks()
{
- $( ".viewDd").each( function (i) {
+ $( ".viewDD").each( function (i) {
var view = this.name.substring(this.name.indexOf(".") + 1,lastIndexOf(".vis"));
enableViewCfgLink((this.selectedIndex > 0),view);
});
}
@@ -364,9 +539,9 @@
function showConfigControls(name)
{
// Will show configuration controls for name= {tableName}.{view}
// Config controls not matching name will be hidden
- //if($( ".viewDd[name$='" + name + ".vis']").attr("selectedIndex") == 0) {
+ //if($( ".viewDD[name$='" + name + ".vis']").attr("selectedIndex") == 0) {
// $("input[name$='.showCfg']").val("off");
// $("tr[id^='tr_cfg_']").css('display','none'); // hide cfg controls when view is hide
// return true;
//}
@@ -420,10 +595,8 @@
curColor = bgColor1;
}
table.rows[trIx].bgColor = curColor;
}
- } else if(debugLevel>2) {
- alert("trAlternateColors is unimplemented for this browser)");
}
}
//////////// Sorting ////////////
@@ -492,10 +665,8 @@
var columns = new sortColumnsGetFromTable(table);
if(sortColumns.tags.length>1)
trAlternateColors(table,sortColumns.cellIxs[sortColumns.tags.length-2]);
- } else if(debugLevel>2) {
- alert("tableSortByColumns is unimplemented for this browser)");
}
}
function sortOrderFromColumns(sortColumns)
@@ -582,17 +753,8 @@
tbody = table.getElementsByTagName("tbody")[0];
tableSortByColumns(tbody,columns);
}
-function hintOverSortableColumnHeader(th)
-{// Upodates the sortColumns struct and sorts the table when a column headder has been pressed
- if(debugLevel>0) {
- var tr=th.parentNode;
- th.title = "Current Sort Order: " + sortOrderFromTr(tr);
- var sortColumns = new sortColumnsGetFromTr(tr);
- }
-}
-
function tableSortAtButtonPress(anchor,tagId)
{// Updates the sortColumns struct and sorts the table when a column header has been pressed
// If the current primary sort column is pressed, its direction is toggled then the table is sorted
// If a secondary sort column is pressed, it is moved to the primary spot and sorted in fwd direction
@@ -694,15 +856,8 @@
}
return "unknown";
}
-function hintForDraggableRow(tr)
-{
- if(debugLevel>0) {
- tr.title='Position:'+trFindPosition(tr)
- }
-}
-
function trComparePriority(tr1,tr2)
{
// Compare routine for sorting by *.priority
var priority1 = 999999;
@@ -756,56 +911,8 @@
}
}
}
-function matChkBoxNormalize(matCb)
-{
- var classes = $( matCb ).attr("class");
- var dimZ = (classes.indexOf("dimZ") > 0);
- classes = classes.replace("dimZ ","");
- classes = classes.replace("matrixCB "," ");
- classes = classes.replace(/ /g,".");
- var CBs = $("input.subtrackCB").filter(classes); // All subtrack CBs that match matrix CB
- if(arguments.length > 1) { // dimZ NOT classes
- CBs = $( CBs ).not(arguments[1]); // Removes the dimZ associated classes that are not checked
- }
- if(CBs.length > 0) {
- var CBsChecked = CBs.filter(":checked");
- if(CBsChecked.length == CBs.length)
- matCb.checked=true;
- else if(CBsChecked.length == 0)
- matCb.checked=false;
- else if(dimZ)
- matCb.checked=true; // Some are checked and this is dimZ. This is a best guess
- }
-}
-
-function matChkBoxesNormalized()
-{
-// check/unchecks matrix checkboxes based upon subtrack checkboxes
- var matCBs = $("input.matrixCB");
- var dimZCBs = $("input.matrixCB[name$='_dimZ_cb']");
- if( $(dimZCBs).length > 0) {
- // Should do dimZ first, then go back and do non-dimZ with extra restrictions!
- var classes = "";
- $(dimZCBs).each( function (i) {
- matChkBoxNormalize(this);
- if( $(this).is(':checked') == false ) {
- classes += $( this ).attr("class").replace("matrixCB dimZ ",".")
- }
- } );
- $("input.matrixCB").not("[name$='_dimZ_cb']").each( function (i) { matChkBoxNormalize(this,classes); } );
- } else {
- $("input.matrixCB").each( function (i) { matChkBoxNormalize(this); } );
- }
-
- // For each viewDD not selected, disable associated subtracks
- $('select.viewDd').not("[selectedIndex]").each( function (i) {
- var viewClass = this.name.substring(this.name.indexOf(".") + 1,this.name.lastIndexOf("."));
- matEnableSubtrackCheckBoxes(false,viewClass);
- });
-}
-
function showOrHideSelectedSubtracks(inp)
{
// Show or Hide subtracks based upon radio toggle
var showHide;
@@ -838,16 +945,12 @@
function matInitializeMatrix()
{
// Called at Onload to coordinate all subtracks with the matrix of check boxes
if (document.getElementsByTagName) {
- matChkBoxesNormalized(); // Note that this needs to be done when the page is first displayed. But ideally only on clean cart!
+ matChkBoxesNormalizeAll(); // Note that this needs to be done when the page is first displayed. But ideally only on clean cart!
showOrHideSelectedSubtracks();
//enableAllViewCfgLinks();
}
- else if(debugLevel>2) {
- alert("matInitializeMatrix is unimplemented for this browser)");
- }
- // alert("Time stamped ");
}
function multiSelectLoad(div,sizeWhenOpen)
{