23423baa6e295aed7d61b79534de38256fc1d1f8
tdreszer
  Thu Jan 26 11:44:52 2012 -0800
Fixed 2 bugs with filterBy's as seen on Encode Gencode V10.  First, subtrack filterby's were getting the wrong name in some circumstances.  Second, putting filterBy's inside a view cfg means they may have been hidden during setup.  But ddcl's require visible multi-selects to be sized properly.
diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index 8e52270..16ef068 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -3348,39 +3348,41 @@
                 strSwapChar(chipper,'_',' '); // Title does not have underscores
                 }
             else if (filterBy->valueAndLabel)
                 errAbort("filterBy values either all have labels in form of value|label or none do.");
         }
         }
 
     slAddTail(&filterBySet,filterBy); // Keep them in order (only a few)
 
     if(cart != NULL)
         {
         char suffix[256];
         safef(suffix, sizeof(suffix), "filterBy.%s", filterBy->column);
         boolean parentLevel = isNameAtParentLevel(tdb,name);
         if(cartLookUpVariableClosestToHome(cart,tdb,parentLevel,suffix,&(filterBy->htmlName)))
+            {
             filterBy->slChoices = cartOptionalSlNameList(cart,filterBy->htmlName);
+            freeMem(filterBy->htmlName);
         }
-    if(filterBy->htmlName == NULL)
-        {
+        }
+
+    // Note: cannot use found name above because that may be at a higher (composite/view) level
         int len = strlen(name) + strlen(filterBy->column) + 15;
         filterBy->htmlName = needMem(len);
         safef(filterBy->htmlName, len, "%s.filterBy.%s", name,filterBy->column);
         }
-    }
 freeMem(setting);
 
 return filterBySet;
 }
 
 void filterBySetFree(filterBy_t **filterBySet)
 /* Free a set of filterBy structs */
 {
 if(filterBySet != NULL)
     {
     while(*filterBySet != NULL)
         {
         filterBy_t *filterBy = slPopHead(filterBySet);
         if(filterBy->slValues != NULL)
             slNameFreeList(filterBy->slValues);
@@ -3728,30 +3730,31 @@
 	tdb->priority = atof(cartHas);
 	cartPriorities = TRUE;
 	}
     }
 slSort(tdbRefList, trackDbRefCmp);
 return cartPriorities;
 }
 
 void cfgByCfgType(eCfgType cType,char *db, struct cart *cart, struct trackDb *tdb,char *prefix, char *title, boolean boxed)
 // Methods for putting up type specific cfgs used by composites/subtracks in hui.c and exported for common use
 {
 #ifdef SUBTRACK_CFG
 // When only one subtrack, then show it's cfg settings instead of composite/view level settings
 // This simplifies the UI where hgTrackUi won't have 2 levels of cfg,
 // while hgTracks still supports rightClick cfg of the subtrack.
+
 if (configurableByAjax(tdb,cType) > 0) // Only if subtrack's configurable by ajax do we consider this option
     {
     if (tdbIsComposite(tdb)                       // called for the composite
     && !tdbIsCompositeView(tdb->subtracks)        // and there is no view level
     && slCount(tdb->subtracks) == 1)              // and there is only one subtrack
         {
         //warn("What do you mean by having a composite (%s) with only one subtrack (%s) ???",tdb->track,tdb->subtracks->track);
         tdb = tdb->subtracks; // show subtrack cfg instead
         prefix = tdb->track;
         }
     else if (tdbIsSubtrack(tdb)                   // called with subtrack
          && tdbIsCompositeView(tdb->parent)       // subtrack has view
          && differentString(prefix,tdb->track)    // and this has been called FOR the view
          && slCount(tdb->parent->subtracks) == 1) // and view has only one subtrack
         prefix = tdb->track; // removes reference to view level