52d621decb92c2355c57a02e042d2c7691978b13
tdreszer
  Wed Nov 24 10:53:29 2010 -0800
Small corrections to when 'view in browser' is seen and vis that composites get set to.  Also removed unused and unworking function
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index af1741c..a554dad 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2316,57 +2316,57 @@
         var selCb = $("input#"+trackName+"_sel_id");
         $(selCb).attr('checked',false);  // Can't set it to [] because that means default setting is used.  However, we are explicitly hiding this!
         $(seenVis).attr('disabled',true);  // Can't set it to [] because that means default setting is used.  However, we are explicitly hiding this!
         var needSel = (tdb.parentTrack != undefined);
         if (needSel) {
             var hiddenSel = $("input[name='"+trackName+"_sel']");
             $(hiddenSel).val('0');  // Can't set it to [] because that means default setting is used.  However, we are explicitly hiding this!
             $(hiddenSel).attr('disabled',false);
         }
         if(tdbIsSubtrack(tdb))
             $(hiddenVis).val("[]");
         else
             $(hiddenVis).val("hide");
     }
     $(hiddenVis).attr('disabled',false);
+
+    $('input.viewBtn').val('View in Browser');
     //warn("Changed "+trackName+" to "+$(hiddenVis).val())
 }
 
 function findTracksClickedOne(selCb,justClicked)
 { // called by on click of CB and findTracksCheckAll()
     var selName = $(selCb).attr('id');
     var trackName = selName.substring(0,selName.length - "_sel_id".length)
     var hiddenSel = $("input[name='"+trackName+"_sel']");
     var seenVis = $('select#' + trackName + "_id");
     var hiddenVis = $("input[name='"+trackName+"']");
     var tr = $(selCb).parents('tr.found');
     var tdb = tdbGetJsonRecord(trackName);
     var needSel = (tdb.parentTrack != undefined);
-    var shouldPack = tdb.canPack;
+    var shouldPack = tdb.canPack && tdb.kindOfParent == 0; // If parent then not pack but full
     if (shouldPack && tdb.shouldPack != undefined && !tdb.shouldPack)
         shouldPack = false;
     var checked = $(selCb).attr('checked');
     //warn(trackName +" selName:"+selName +" justClicked:"+justClicked +" hiddenSel:"+$(hiddenSel).attr('name') +" seenVis:"+$(seenVis).attr('id') +" hiddenVis:"+$(hiddenVis).attr('name') +" needSel:"+needSel +" shouldPack:"+shouldPack);
 
     // First deal with seenVis control
     if(checked) {
         $(seenVis).attr('disabled', false);
         if($(seenVis).attr('selectedIndex') == 0) {
-            if(tdbIsFolder(tdb))
-                $(seenVis).attr('selectedIndex',1);  // show
-            else if(shouldPack)
-                $(seenVis).attr('selectedIndex',3);  // packed  // FIXME: Must be a better way to select pack/full
+            if(shouldPack)
+                $(seenVis).attr('selectedIndex',3);  // packed
             else
                 $(seenVis).attr('selectedIndex',$(seenVis).attr('length') - 1);
         }
     } else {
         $(seenVis).attr('selectedIndex',0);  // hide
         $(seenVis).attr('disabled', true );
     }
 
     // Deal with hiddenSel and hiddenVis so that submit does the right thing
     // Setting these requires justClicked OR seen vs. hidden to be different
     var setHiddenInputs = justClicked;
     if(!justClicked) {
         if(needSel)
             setHiddenInputs = (checked != ($(hiddenSel).val() == '1'));
         else if (checked)
@@ -2435,42 +2435,32 @@
 }
 
 function findTracksSearchButtonsEnable(enable)
 { // Displays visible and checked track count
     var searchButton = $('input[name="hgt_tSearch"]'); // NOTE: must match TRACK_SEARCH in hg/inc/searchTracks.h
     var clearButton  = $('input.clear');
     if(enable) {
         $(searchButton).attr('disabled',false);
         $(clearButton).attr('disabled',false);
     } else {
         $(searchButton).attr('disabled',true);
         $(clearButton).attr('disabled',true);
     }
 }
 
-function findTracksViewButtoneText()
-{ // Update View in Browser buttn text
-    var inputs = $('table#foundTracks').find('input:hidden:enabled');  // Doesn't work!!!
-    if( $(inputs).length == 0)
-        $('input.viewBtn').val('return to browser');
-    else
-        $('input.viewBtn').val('view in browser');
-}
-
 function findTracksCounts()
 {// Displays visible and checked track count
-    //findTracksViewButtoneText();   // Doesn't work!!!
     var counter = $('.selCbCount');
     if(counter != undefined) {
         var selCbs =  $("input.selCb");
         $(counter).text("("+$(selCbs).filter(":enabled:checked").length + " of " +$(selCbs).length+ " selected)");
     }
 }
 
 function findTracksClear()
 {// Clear found tracks and all input controls
     var foundTracks = $('div#found');
     if(foundTracks != undefined)
         $(foundTracks).remove();
     $('input[type="text"]').val(''); // This will always be found
     //$('select.mdbVar').attr('selectedIndex',0); // Do we want to set the first two to cell/antibody?
     $('select.mdbVal').attr('selectedIndex',0); // Should be 'Any'
