dd11167c43c5d46b3d38f41be75324f9c895cbab
Merge parents 7df46c5 ff60f50
tdreszer
  Thu Jun 23 14:53:13 2011 -0700
Merge conflict resolution
diff --cc src/hg/lib/hui.c
index 2cea010,580209b..7777f2b
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@@ -3485,80 -3500,132 +3500,78 @@@
  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);
  
  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");
  
-     //if (onOneLine && count > 1) // NOTE: onOneLine doesn't work because filterBy with multiple selected will align above title!
-         printf("<BR>\n");
-     //else
-     //    printf(":\n");
-     // TODO: Scroll long lists
-     //#define FILTER_COMPOSITE_OPEN_SIZE 16
      // TODO: columnCount (Number of filterBoxes per row) should be configurable through tdb setting
 -    //#define FILTER_BY_FORMAT "<SELECT id='fbc%d' name='%s.filterBy.%s' multiple><BR>\n"
 -    #define FILTER_BY_FORMAT "<SELECT id='fbc%d' name='%s.filterBy.%s' multiple style='display: none;' class='filterComp filterBy'><BR>\n"
 +    #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"
 +    #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"
 +    #endif///ndef NEW_JQUERY
      printf(FILTER_BY_FORMAT,ix,tdb->track,filterBy->column);
      ix++;
-     printf("<OPTION%s%s>All</OPTION>\n",(filterBy->slChoices == NULL || slNameInList(filterBy->slChoices,"All")?" SELECTED":""),(filterBy->colorFollows?" style='color: #000000;'":"") );
 -    //printf("<OPTION%s%s>All</OPTION>\n",(filterBy->slChoices == NULL || slNameInList(filterBy->slChoices,"All")?" SELECTED":""),(filterBy->styleFollows?" style='color: #000000;'":"") );
+     printf("<OPTION%s>All</OPTION>\n",(filterBy->slChoices == NULL || slNameInList(filterBy->slChoices,"All")?" SELECTED":""));
      struct slName *slValue;
-     if(filterBy->useIndex)
+ 
+     int ix=1;
+     for(slValue=filterBy->slValues;slValue!=NULL;slValue=slValue->next,ix++)
          {
-         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)
              {
-             char varName[32];
              safef(varName, sizeof(varName), "%d",ix);
-             char *name = strSwapChar(cloneString(slValue->name),'_',' ');
-             printf("<OPTION");
-             if (filterBy->slChoices != NULL && slNameInList(filterBy->slChoices,varName))
-                 printf(" SELECTED");
-             printf(" value='%s'",varName);
-             if (filterBy->colorFollows)
-                 printf(" style='color: %s;'",slValue->name + strlen(slValue->name)+1);
-             printf(">%s</OPTION>\n",name);
-             freeMem(name);
+             name = varName;
+             label = slValue->name;
              }
-         }
-     else
-         {
-         for(slValue=filterBy->slValues;slValue!=NULL;slValue=slValue->next)
+         else
+             {
+             label = (filterBy->valueAndLabel? slValue->name + strlen(slValue->name)+1: slValue->name);
+             name = slValue->name;
+             }
+         printf("<OPTION");
+         if (filterBy->slChoices != NULL && slNameInList(filterBy->slChoices,name))
+             printf(" SELECTED");
+         if (filterBy->useIndex || filterBy->valueAndLabel)
+             printf(" value='%s'",name);
+         if (filterBy->styleFollows)
              {
-             char *label = (filterBy->valueAndLabel? slValue->name + strlen(slValue->name)+1: slValue->name);
-             printf("<OPTION");
-             if (filterBy->slChoices != NULL && slNameInList(filterBy->slChoices,slValue->name))
-                 printf(" SELECTED");
-             if (filterBy->valueAndLabel)
-                 printf(" value='%s'",slValue->name);
-             if (filterBy->colorFollows)
-                 printf(" style='color: %s;'",label + strlen(label)+1);
-             printf(">%s</OPTION>\n",label);
+             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);
 -        //freeMem(name);
          }
 -
 -     /*
 -    if(filterBy->useIndex)
 -        {
 -        int ix=1;
 -        for(slValue=filterBy->slValues;slValue!=NULL;slValue=slValue->next,ix++)
 -            {
 -            char varName[32];
 -            safef(varName, sizeof(varName), "%d",ix);
 -            char *name = strSwapChar(cloneString(slValue->name),'_',' ');
 -            printf("<OPTION");
 -            if (filterBy->slChoices != NULL && slNameInList(filterBy->slChoices,varName))
 -                printf(" SELECTED");
 -            printf(" value='%s'",varName);
 -            if (filterBy->styleFollows)
 -                {
 -                char *styler = slValue->name + strlen(slValue->name)+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",name);
 -            freeMem(name);
 -            }
 -        }
 -    else
 -        {
 -        for(slValue=filterBy->slValues;slValue!=NULL;slValue=slValue->next)
 -            {
 -            char *label = (filterBy->valueAndLabel? slValue->name + strlen(slValue->name)+1: slValue->name);
 -            printf("<OPTION");
 -            if (filterBy->slChoices != NULL && slNameInList(filterBy->slChoices,slValue->name))
 -                printf(" SELECTED");
 -            if (filterBy->valueAndLabel)
 -                printf(" value='%s'",slValue->name);
 -            // Style could follow a label
 -            if (filterBy->styleFollows)
 -                {
 -                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");
  
      // 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);
  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))