3846f517009c43abc65d227a4695645c9b5f3e8a
braney
  Fri Feb 15 18:31:21 2013 -0800
changes necessary to support assembly hubs (#8072)
diff --git src/hg/hgCustom/hgCustom.c src/hg/hgCustom/hgCustom.c
index 80a6ed4..39e5c5d 100644
--- src/hg/hgCustom/hgCustom.c
+++ src/hg/hgCustom/hgCustom.c
@@ -9,30 +9,31 @@
 #include "htmshell.h"
 #include "hdb.h"
 #include "hui.h"
 #include "hCommon.h"
 #include "customTrack.h"
 #include "customFactory.h"
 #include "portable.h"
 #include "errCatch.h"
 #if ((defined USE_BAM || defined USE_TABIX) && defined KNETFILE_HOOKS)
 #include "knetUdc.h"
 #include "udc.h"
 #endif//def (USE_BAM || USE_TABIX) && KNETFILE_HOOKS
 #include "net.h"
 #include "jsHelper.h"
 #include <signal.h>
+#include "trackHub.h"
 
 static long loadTime = 0;
 
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "hgCustom - Custom track management CGI\n"
   "usage:\n"
   "   hgCustom <CGI settings>\n"
   );
 }
 
 /* DON'T EDIT THIS -- use CGI param "&measureTiming=." */
@@ -203,31 +204,31 @@
         puts("&nbsp;&nbsp;&nbsp;");
         puts("genome\n");
         printGenomeListForCladeHtml(database, onChangeOrg);
         }
     else
         {
         puts("<TR><TD>genome\n");
         printGenomeListHtml(database, onChangeOrg);
         }
     puts("&nbsp;&nbsp;&nbsp;");
     puts("assembly\n");
     printAssemblyListHtml(database, onChangeDb);
     if (! stringIn(database, hFreezeFromDb(database)))
 	{
 	puts("&nbsp;&nbsp;&nbsp;");
-	printf("[%s]", database);
+	printf("[%s]", trackHubRemoveHubName(database));
 	}
     puts("</TD></TR></TABLE>\n");
     }
 
 /* intro text */
 puts("<P>");
 if (isUpdateForm)
     puts("Update your custom track configuration, data, and/or documentation.");
 else
     puts("Display your own data as custom annotation tracks in the browser.");
 addIntro();
 puts("<P>");
 
 /* row for error message */
 if (err)
@@ -1088,31 +1089,30 @@
 struct slName *browserLines = NULL;
 struct customTrack *replacedCts = NULL;
 char *err = NULL, *warn = NULL;
 char *selectedTable = NULL;
 struct customTrack *ct = NULL;
 boolean ctUpdated = FALSE;
 char *initialDb = NULL;
 
 long thisTime = clock1000();
 
 cart = theCart;
 measureTiming = isNotEmpty(cartOptionalString(cart, "measureTiming"));
 initialDb = cloneString(cartString(cart, "db"));
 getDbAndGenome(cart, &database, &organism, oldVars);
 
-setUdcCacheDir();
 customFactoryEnableExtraChecking(TRUE);
 
 #if ((defined USE_BAM || defined USE_TABIX) && defined KNETFILE_HOOKS)
 knetUdcInstall();
 if (udcCacheTimeout() < 300)
     udcSetCacheTimeout(300);
 #endif//def (USE_BAM || USE_TABIX) && KNETFILE_HOOKS
 
 if (sameString(initialDb, "0"))
     {
     /* when an organism is selected from the custom track management page,
      * set the database to be the default only if it has custom tracks.
      * Otherwise, pick an assembly for that organism that does have custom tracks. */
     struct dbDb *dbDb, *dbDbs = getCustomTrackDatabases();
     char *dbWithCts = NULL;
@@ -1326,19 +1326,20 @@
     else
         doAddCustom(NULL);
     }
 cartRemovePrefix(cart, hgCt);
 cartRemove(cart, CT_CUSTOM_TEXT_VAR);
 }
 
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 long enteredMainTime = clock1000();
 htmlPushEarlyHandlers();
 oldVars = hashNew(10);
 cgiSpoof(&argc, argv);
+setUdcCacheDir();
 cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
 cgiExitTime("hgCustom", enteredMainTime);
 return 0;
 }