78dd4284dde94c28b93f17cf3dc74dc2d1d53170
Merge parents f9ca738 f740a7a
kate
  Mon Mar 20 13:25:00 2017 -0700
Merge branch 'master' into barchart

diff --cc src/hg/lib/hui.c
index b60de25,fadedf0..25843c1
--- src/hg/lib/hui.c
+++ src/hg/lib/hui.c
@@@ -35,60 -35,56 +35,57 @@@
  #include "snakeUi.h"
  #include "vcfUi.h"
  #include "vcf.h"
  #include "errCatch.h"
  #include "samAlignment.h"
  #include "makeItemsItem.h"
  #include "bedDetail.h"
  #include "pgSnp.h"
  #include "memgfx.h"
  #include "trackHub.h"
  #include "gtexUi.h"
  #include "genbank.h"
  #include "htmlPage.h"
  #include "longRange.h"
  #include "tagRepo.h"
 +#include "barChartUi.h"
  
  #define SMALLBUF 256
  #define MAX_SUBGROUP 9
  #define ADD_BUTTON_LABEL        "add"
  #define CLEAR_BUTTON_LABEL      "clear"
  #define JBUFSIZE 2048
  
  
  #define DEF_BUTTON "<IMG id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\">\n"
  #define DEF_BUTTON_JS "setCheckBoxesThatContain('%s',true,false,'%s','','%s');" \
  	       "setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s');" 
  #define DEFAULT_BUTTON(nameOrId,anc,beg,contains) \
      printf(DEF_BUTTON,(anc),"defaults_sm.png","default"); \
      safef(id, sizeof id, "btn_%s", (anc)); \
-     safef(javascript, sizeof javascript, DEF_BUTTON_JS,(nameOrId),(beg),(contains),(nameOrId),(beg),(contains)); \
-     jsOnEventById("click", id, javascript);
+     jsOnEventByIdF("click", id, DEF_BUTTON_JS,(nameOrId),(beg),(contains),(nameOrId),(beg),(contains)); 
  
  #define PM_BUTTON  "<IMG height=18 width=18 id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\">\n"
  #define PM_BUTTON_JS  "setCheckBoxesThatContain('%s',%s,true,'%s','','%s');"
  #define PLUS_BUTTON(nameOrId,anc,beg,contains) \
      printf(PM_BUTTON, (anc), "add_sm.gif",   "+"); \
      safef(id, sizeof id, "btn_%s", (anc)); \
-     safef(javascript, sizeof javascript, PM_BUTTON_JS, (nameOrId),"true", (beg),(contains)); \
-     jsOnEventById("click", id, javascript);
+     jsOnEventByIdF("click", id, PM_BUTTON_JS, (nameOrId),"true", (beg),(contains)); 
  #define MINUS_BUTTON(nameOrId,anc,beg,contains) \
      printf(PM_BUTTON, (anc), "remove_sm.gif", "-"); \
      safef(id, sizeof id, "btn_%s", (anc)); \
-     safef(javascript, sizeof javascript, PM_BUTTON_JS, (nameOrId),"false", (beg),(contains)); \
-     jsOnEventById("click", id, javascript);
+     jsOnEventByIdF("click", id, PM_BUTTON_JS, (nameOrId),"false", (beg),(contains)); 
  
  boolean isEncode2(char *database)
  // Return true for ENCODE2 assemblies
  {
  return (sameString(database, "hg18") || sameString(database, "hg19") || sameString(database, "mm9"));
  }
  
  static char *htmlStringForDownloadsLink(char *database, struct trackDb *tdb,
  				    char *name,boolean nameIsFile)
  // Returns an HTML string for a downloads link
  {
  // If has fileSortOrder, then link to new hgFileUi
  if (!nameIsFile && trackDbSetting(tdb, FILE_SORT_ORDER) != NULL)
      {
      char * link = needMem(PATH_LEN); // 512 should be enough