15746316e92290a4aee220a757cb35293176d6e8
max
  Tue Feb 7 05:29:10 2023 -0800
adding file download links directly to the table browser "schema / data format" button, refs #30491

diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c
index cf08e35..c6b42a2 100644
--- src/hg/hgTables/hgTables.c
+++ src/hg/hgTables/hgTables.c
@@ -222,30 +222,67 @@
     return curTrack->shortLabel;
 else
     return curTable;
 }
 
 char *getScriptName()
 /* returns script name from environment or hardcoded for command line */
 {
 char *script = cgiScriptName();
 if (script != NULL)
     return script;
 else
     return hgTablesName();
 }
 
+void printDownloadLink(char *typeLabel, char *fileName)
+/* print a link to the file, so the user can download it right here */
+{
+char *downPrefix = "";
+if (startsWith("/gbdb", fileName))
+    downPrefix = "https://hgdownload.soe.ucsc.edu";
+
+hPrintf("<B>%s File Download:</B> <A HREF='%s%s'>%s</A>", typeLabel, downPrefix, fileName, fileName);
+}
+
+boolean printTypeHelpDesc(char *type)
+/* print a little link to our help docs given a track type. Return true if file type is a big* file format. */
+{
+boolean isBig = FALSE;
+
+if (startsWith("vcf", type))
+    {
+    hPrintf("See the <A HREF=\"%s\" target=_blank>Variant Call Format specification</A> for  more details<BR>\n",
+            "http://www.1000genomes.org/wiki/analysis/vcf4.0");
+    }
+else if (startsWithWord("bigWig", type))
+    {
+    printf("<BR>The data is stored in the binary "
+           "<A HREF=\"/goldenPath/help/bigWig.html\" TARGET=_BLANK>"
+           "BigWig</A> format.\n");
+    isBig = TRUE;
+    }
+else if (startsWith("big", type))
+    {
+    printf("<BR>The data is stored in the binary "
+           "<A HREF=\"/goldenPath/help/bigBed.html\" TARGET=_BLANK>"
+           "BigBed</A> format.<BR>\n");
+    isBig = TRUE;
+    }
+
+return isBig;
+}
 
 void textOpen()
 /* Start up page in text format. (No need to close this).
  *	In case of pipeline output to a compressor, it is closed
  *	at main() exit.
  */
 {
 
 // hgBotDelay function is now in earlyBotCheck() at the start of main(), and in
 // this case, the issueBotWarning flag is ignored to avoid any output here
 // hgBotDelayNoWarn();  // delay but suppress warning at 10-20 sec delay level because this is not html output.
 char *fileName = textOutSanitizeHttpFileName(cartUsualString(cart, hgtaOutFileName, ""));
 char *compressType = cartUsualString(cart, hgtaCompressType,
 				     textOutCompressNone);