src/hg/js/hui.js 1.29

1.29 2009/06/02 19:12:17 tdreszer
Rearranged a little and added subtrackCBsSetAll() for 'allButtonPair' tdb setting
Index: src/hg/js/hui.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hui.js,v
retrieving revision 1.28
retrieving revision 1.29
diff -b -B -U 4 -r1.28 -r1.29
--- src/hg/js/hui.js	14 May 2009 19:31:02 -0000	1.28
+++ src/hg/js/hui.js	2 Jun 2009 19:12:17 -0000	1.29
@@ -107,8 +107,15 @@
 //    });
 //   return( views );
 //}
 
+function checkBoxSet(CB,state)
+{
+    CB.checked = state;
+    setCheckBoxShadow(CB);
+    hideOrShowSubtrack(CB);
+}
+
 function matSetMatrixCheckBoxes(state)
 {
 // Set all Matrix checkboxes to state.  If additional arguments are passed in, the list of CBs will be narrowed by the classes
     var CBs;
@@ -128,30 +135,27 @@
         CBs = $("input.subtrackCB").filter(":checked");
     for(var vIx=1;vIx<arguments.length;vIx++) {
         CBs = CBs.filter("."+arguments[vIx]);  // Successively limit list by additional classes.
     }
-    //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.not("."+views[vIx]);  // Successively limit list by additional classes.
-    //        }
-    //    }
-    //}
-    CBs.each( function (i) {
-        this.checked = state;
-        setCheckBoxShadow(this);
-        hideOrShowSubtrack(this);
-    });
+    CBs.each( function (i) { checkBoxSet(this,state); });
 
     return true;
 }
 
-function checkBoxSet(CB,state)
+function subtrackCBsSetAll(state)
 {
-    CB.checked = state;
-    setCheckBoxShadow(CB);
-    hideOrShowSubtrack(CB);
+// 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");
+    for(var vIx=1;vIx<arguments.length;vIx++) {
+        CBs = CBs.filter("."+arguments[vIx]);  // Successively limit list by additional classes.
+    }
+    CBs.each( function (i) { checkBoxSet(this,state); });
+
+    return true;
 }
 
 function matSetSubtrackCheckBoxes(state)
 {