4c15f3e254d1e9c7cb3c4dca17f2808c07dbdb4f
tdreszer
  Thu Jul 7 17:52:25 2011 -0700
Moved all ddcl extension code into a ddcl object in ddcl.js.  Reworked filterComp code to be more like filterTable code since IE was getting timeouts on HAIB TFBS.
diff --git src/hg/lib/hui.c src/hg/lib/hui.c
index 3cb02f1..e3ffd74 100644
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@ -3505,46 +3505,49 @@
 /* Does the UI for a list of filterBy structure */
 {
 if(filterBySet == NULL)
     return;
 
 #define FILTERBY_HELP_LINK  "<A HREF=\"../goldenPath/help/multiView.html\" TARGET=ucscHelp>help</A>"
 int count = slCount(filterBySet);
 if(count == 1)
     puts("<TABLE cellpadding=3><TR valign='top'>");
 else
     printf("<B>Filter items by:</B> (select multiple categories and items - %s)<TABLE cellpadding=3><TR valign='top'>\n",FILTERBY_HELP_LINK);
 
 filterBy_t *filterBy = NULL;
 webIncludeResourceFile("ui.dropdownchecklist.css");
 jsIncludeFile("ui.dropdownchecklist.js",NULL);
+#ifdef NEW_JQUERY
+jsIncludeFile("ddcl.js",NULL);
+#endif///def NEW_JQUERY
 
 int ix=0;
 for(filterBy = filterBySet;filterBy != NULL; filterBy = filterBy->next)
     {
     puts("<TD>");
     if(count == 1)
         printf("<B>Filter by %s</B> (select multiple items - %s)",filterBy->title,FILTERBY_HELP_LINK);
     else
         printf("<B>%s</B>",filterBy->title);
     printf("<BR>\n");
 
     // TODO: columnCount (Number of filterBoxes per row) should be configurable through tdb setting
     #ifdef NEW_JQUERY
-        #define FILTER_BY_FORMAT "<SELECT id='fbc%d' name='%s.filterBy.%s' multiple style='display: none; font-size:.9em;' class='filterComp filterBy'><BR>\n"
+        #define FILTER_BY_FORMAT "<SELECT id='fbc%d' name='%s.filterBy.%s' multiple style='display: none; font-size:.9em;' class='filterBy'><BR>\n"
     #else///ifndef NEW_JQUERY
-        #define FILTER_BY_FORMAT "<SELECT id='fbc%d' name='%s.filterBy.%s' multiple style='display: none;' class='filterComp filterBy'><BR>\n"
+        #define FILTER_BY_FORMAT "<SELECT id='fbc%d' name='%s.filterBy.%s' multiple style='display: none;' class='filterBy'><BR>\n"
     #endif///ndef NEW_JQUERY
     printf(FILTER_BY_FORMAT,ix,tdb->track,filterBy->column);
     ix++;
     printf("<OPTION%s>All</OPTION>\n",(filterBy->slChoices == NULL || slNameInList(filterBy->slChoices,"All")?" SELECTED":""));
     struct slName *slValue;
 
     int ix=1;
     for(slValue=filterBy->slValues;slValue!=NULL;slValue=slValue->next,ix++)
         {
         char varName[32];
         char *label = NULL;
         char *name = NULL;
         if (filterBy->useIndex)
             {
             safef(varName, sizeof(varName), "%d",ix);
@@ -3565,32 +3568,34 @@
             {
             char *styler = label + strlen(label)+1;
             if (*styler != '\0')
                 {
                 if (*styler == '#') // Legacy: just the color that follows
                     printf(" style='color: %s;'",styler);
                 else
                     printf(" style='%s'",styler);
                 }
             }
         printf(">%s</OPTION>\n",label);
         }
     }
     printf("</SELECT>\n");
 
+#ifndef NEW_JQUERY
     // The following is needed to make msie scroll to selected option.
     printf("<script type='text/javascript'>onload=function(){ if( $.browser.msie ) { $(\"select[name^='%s.filterBy.']\").children('option[selected]').each( function(i) { $(this).attr('selected',true); }); }}</script>\n",tdb->track);
+#endif///ndef NEW_JQUERY
 puts("</TR></TABLE>");
 
 return;
 }
 
 #define COLOR_BG_DEFAULT_IX     0
 #define COLOR_BG_ALTDEFAULT_IX  1
 #define DIVIDING_LINE "<TR valign=\"CENTER\" line-height=\"1\" BGCOLOR=\"%s\"><TH colspan=\"5\" align=\"CENTER\"><hr noshade color=\"%s\" width=\"100%%\"></TD></TR>\n"
 #define DIVIDER_PRINT(color) printf(DIVIDING_LINE,COLOR_BG_DEFAULT,(color))
 
 static char *checkBoxIdMakeForTrack(struct trackDb *tdb,members_t** dims,int dimMax,membership_t *membership)
 /* Creates an 'id' string for subtrack checkbox in style that matrix understand: "cb_dimX_dimY_view_cb" */
 {
 int ix;
 #define CHECKBOX_ID_SZ 128
@@ -6420,37 +6425,35 @@
             }
         }
     }
 dyStringPrintf(dyLink,VOCAB_MULTILINK_END,members->groupTitle,members->groupTitle);
 freeMem(vocab);
 return dyStringCannibalize(&dyLink);
 }
 
 static boolean compositeUiByFilter(char *db, struct cart *cart, struct trackDb *parentTdb, char *formName)
 /* UI for composite tracks: filter subgroups by multiselects to select subtracks. */
 {
 membersForAll_t* membersForAll = membersForAllSubGroupsGet(parentTdb,cart);
 if(membersForAll == NULL || membersForAll->filters == FALSE) // Not Matrix or filters
     return FALSE;
 jsIncludeFile("ui.core.js",NULL);
-jsIncludeFile("ui.dropdownchecklist.js",NULL);
 webIncludeResourceFile("ui.dropdownchecklist.css");
-
-// TODO:
-// 1) Scroll long lists should be configurable through tdb setting
-//    #define FILTER_COMPOSITE_OPEN_SIZE 16
-// 2) columnCount (Number of filterBoxes per row) should be configurable through tdb setting
+jsIncludeFile("ui.dropdownchecklist.js",NULL);
+#ifdef NEW_JQUERY
+jsIncludeFile("ddcl.js",NULL);
+#endif///def NEW_JQUERY
 
 cgiDown(0.7);
 printf("<B>Filter subtracks %sby:</B> (select multiple %sitems - %s)<BR>\n",
        (membersForAll->members[dimX] != NULL || membersForAll->members[dimY] != NULL ? "further ":""),
        (membersForAll->dimMax == dimA?"":"categories and "),FILTERBY_HELP_LINK);
 printf("<TABLE><TR valign='top'>\n");
 
 // Do All [+][-] buttons
 if(membersForAll->members[dimX] == NULL && membersForAll->members[dimY] == NULL) // No matrix
     {
     #define PM_BUTTON_FILTER_COMP "<input type='button' class='inOutButton' onclick=\"waitOnFunction(filterCompositeSet,this,%s); return false;\" id='btn_%s' value='%c'>"
     printf("<TD align='left' width='50px'><B>All:</B><BR>");
     printf(PM_BUTTON_FILTER_COMP,"true",  "plus_fc",'+');
     printf(PM_BUTTON_FILTER_COMP,"false","minus_fc",'-');
     //#define PM_BUTTON2_FILTER_COMP "<IMG height=18 width=18 onclick=\"filterCompositeSet(%s);\" id='btn_%s' src='../images/%s'>"