1027c8e7702cdf5925a4db1fccdc81f9c64f8346
braney
  Wed Oct 11 18:44:52 2017 -0700
fix new collection button, keep old track name in table name in trackDb
for native tracks

diff --git src/hg/hgCollection/hgCollection.c src/hg/hgCollection/hgCollection.c
index 71706ee..b95c62c 100644
--- src/hg/hgCollection/hgCollection.c
+++ src/hg/hgCollection/hgCollection.c
@@ -477,38 +477,43 @@
 compositeTrack on\n\
 autoScale on\n\
 aggregate  none\n\
 longLabel %s\n\
 %s on\n\
 color %ld,%ld,%ld \n\
 type wig \n\
 visibility full\n\n", parent, shortLabel, longLabel, CUSTOM_COMPOSITE_SETTING,
  0xff& (collection->color >> 16),0xff& (collection->color >> 8),0xff& (collection->color));
 
 }
 
 static void modifyName(struct trackDb *tdb, char *hubName, struct hash  *collectionNameHash)
 /* If this is a new track in the collection we want to make sure
  * it gets a different name than the track in trackDb.
- * If it's a custom track, we want to squirrel away the original track name. */
+ * If it's a native track, we want to squirrel away the original track name. */
 {
 if ((tdb->grp == NULL) || differentString(tdb->grp, hubName))
     {
     hashStore(collectionNameHash,  tdb->track);
 
-    if (isCustomTrack(tdb->track))
-        hashAdd(tdb->settingsHash, "origTrackName", tdb->track);
+    char *bigDataUrl = trackDbSetting(tdb, "bigDataUrl");
+    if (bigDataUrl == NULL)
+        {
+        char *table = trackDbSetting(tdb, "table");
+        if (table == NULL)
+            hashAdd(tdb->settingsHash, "table", tdb->track);
+        }
     }
 }
 
 static int outView(FILE *f, struct sqlConnection *conn, char *db, struct track *view, char *parent, struct hash *nameHash, struct hash *collectionNameHash, int priority, char *hubName)
 // output a view to a trackhub
 {
 fprintf(f,"\ttrack %s\n\
 \tshortLabel %s\n\
 \tlongLabel %s\n\
 \tview %s \n\
 \tcontainer mathWig\n\
 \tautoScale on  \n\
 \tparent %s \n\
 \tcolor %ld,%ld,%ld \n\
 \tpriority %d\n\