09f26ed9a7dcc52b03b4d3e5b2f97c5177cd9334
max
  Mon Sep 21 06:00:40 2026 -0700
Drop the ${hgsid} trackDb variable; add session ids to links in the browser instead

A description page's links can carry the session id without the page itself holding
one.  addHgsidToLinks() in utils.js walks the rendered page and appends hgsid to every
<a href> that stays on this host and points into the same cgi-bin directory: a relative
CGI link gets one, a static .html, a link to another host, a mailto and a plain #anchor
do not, and a link that already names a session is left alone.  hgc and hgTrackUi call
it through a new jsAddHgsidToLinks(), and hgTracks.js calls it on the track description
popup once the ajax content is in.  A link written with a literal $hgsid is rewritten
rather than skipped, so the description pages already deployed in the GenArk hubs work
again.

hVarSubst no longer knows about hgsid: it is out of the trackDb variable list, so
hVarSubstTrackDbHtml is a hub-only pass again and needs no cart, and hVarSubstWithCart
and webIncludeHelpFileSubst, which existed only to resolve it, are gone.  The variable
is taken out of the trackDb README and out of the twenty-odd description pages that
used it.

refs #38380

diff --git src/hg/lib/web.c src/hg/lib/web.c
index 4691c7f63e4..d420f13065e 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -1154,70 +1154,48 @@
 cartSetString(cart, "db", *retDb);
 cartSetString(cart, "org", *retGenome);
 if (gotClade)
     cartSetString(cart, "clade", *retClade);
 }
 
 void getDbAndGenome(struct cart *cart, char **retDb, char **retGenome,
 		    struct hash *oldVars)
 /* Get just the db and genome. */
 {
 char *garbage = NULL;
 getDbGenomeClade(cart, retDb, retGenome, &garbage, oldVars);
 freeMem(garbage);
 }
 
-static void webIncludeFileSubst(char *file, struct cart *cart)
-/* Include an HTML file in a CGI.  If cart is non-null, invoke hVarSubstWithCart.
+void webIncludeFile(char *file)
+/* Include an HTML file in a CGI.
  *   The file path may begin with hDocumentRoot(); if it doesn't, it is
  *   assumed to be relative and hDocumentRoot() will be prepended. */
 {
 char *str = hFileContentsOrWarning(file);
-if (cart != NULL)
-    {
-    char *db = cartString(cart, "db");
-    hVarSubstWithCart("webIncludeFileSubst", cart, NULL, db, &str);
-    }
 puts(str);
 freeMem(str);
 }
 
-void webIncludeFile(char *file)
-/* Include an HTML file in a CGI.
- *   The file path may begin with hDocumentRoot(); if it doesn't, it is
- *   assumed to be relative and hDocumentRoot() will be prepended. */
-{
-return webIncludeFileSubst(file, NULL);
-}
-
-void webIncludeHelpFileSubst(char *fileRoot, struct cart *cart, boolean addHorizLine)
-/* Given a help file root name (e.g. "hgPcrResult" or "cutters"),
- * print out the contents of the file.  If cart is non-NULL, invoke hVarSubstWithCart
- * before printing.  If addHorizLine, print out an <HR> first. */
-{
-if (addHorizLine)
-    htmlHorizontalLine();
-char *file = hHelpFile(fileRoot);
-webIncludeFileSubst(file, cart);
-}
-
 void webIncludeHelpFile(char *fileRoot, boolean addHorizLine)
 /* Given a help file root name (e.g. "hgPcrResult" or "cutters"),
  * print out the contents of the file.  If addHorizLine, print out an
  * <HR> first. */
 {
-return webIncludeHelpFileSubst(fileRoot, NULL, addHorizLine);
+if (addHorizLine)
+    htmlHorizontalLine();
+webIncludeFile(hHelpFile(fileRoot));
 }
 
 void webPrintLinkTableStart()
 /* Print link table start in our colors. */
 {
 printf("<TABLE><TR><TD BGCOLOR='#" HG_COL_BORDER "'>\n");
 printf("<TABLE CELLSPACING=1 CELLPADDING=3><TR>\n");
 }
 
 void webPrintLinkTableEnd()
 /* Print link table end in our colors. */
 {
 printf("</TR></TABLE>\n");
 printf("</TD></TR></TABLE>\n");
 }