5c213974bb28e98d1b10ad9a86063101e684e5e3
braney
  Mon Oct 31 12:16:52 2022 -0700
add Jim's track duplication code

diff --git src/hg/lib/web.c src/hg/lib/web.c
index a4e758a..c05f8e2 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -1,26 +1,27 @@
 /* Copyright (C) 2014 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #include "common.h"
 #include <regex.h>
 #include "hCommon.h"
 #include "obscure.h"
 #include "dnautil.h"
 #include "errAbort.h"
 #include "htmshell.h"
 #include "web.h"
+#include "dupTrack.h"
 #include "hPrint.h"
 #include "hdb.h"
 #include "hui.h"
 #include "hgConfig.h"
 #include "hVarSubst.h"
 #include "cheapcgi.h"
 #include "dbDb.h"
 #include "hgColors.h"
 #include "hubConnect.h"
 #include "search.h"
 #include "geoMirror.h"
 #include "trackHub.h"
 #include "versionInfo.h"
 
 #ifndef GBROWSE
@@ -1437,33 +1438,34 @@
     {
     // Provide hgTables options for some CGIs.
     char hgTablesOptions[1024] = "";
     char *track = (cart == NULL ? NULL :
                    (endsWith(scriptName, "hgGene") ?
                     cartOptionalString(cart, "hgg_type") :
                     cartOptionalString(cart, "g")));
     if (track && cart && db &&
         (endsWith(scriptName, "hgc") || endsWith(scriptName, "hgTrackUi") ||
          endsWith(scriptName, "hgGtexTrackSettings") || endsWith(scriptName, "hgGene")))
         {
         struct trackDb *tdb = hTrackDbForTrack(db, track);
         if (tdb)
 	    {
 	    struct trackDb *topLevel = trackDbTopLevelSelfOrParent(tdb); 
+	    char *undupedTrack = dupTrackSkipToSourceName(topLevel->track);
 	    safef(hgTablesOptions, sizeof  hgTablesOptions, 
 		    "../cgi-bin/hgTables?hgta_doMainPage=1&hgta_group=%s&hgta_track=%s&hgta_table=%s&", 
-		    topLevel->grp, topLevel->track, tdb->table);
+		    topLevel->grp, undupedTrack, tdb->table);
 	    menuStr = replaceChars(menuStr, "../cgi-bin/hgTables?", hgTablesOptions);
 	    trackDbFree(&tdb);
 	    }
         }
     }
 
 if(!loginSystemEnabled())
     stripRegEx(menuStr, "<\\!-- LOGIN_START -->.*<\\!-- LOGIN_END -->", REG_ICASE);
 
 if(scriptName)
     {  // Provide optional official mirror servers menu items
     char *geoMenu = geoMirrorMenu();
     char *pattern = "<!-- OPTIONAL_MIRROR_MENU -->";
     char *newMenuStr = replaceChars(menuStr, pattern, geoMenu);
     freez(&menuStr);