4a7a8a5cfc6cddef3873bdef663321bb4d78b5c5
kate
  Mon Apr 19 11:38:02 2021 -0700
First cut Ana's UI recs for TB main page. refs #27408

diff --git src/hg/hgTables/mainPage.c src/hg/hgTables/mainPage.c
index 93668e7..900ae87 100644
--- src/hg/hgTables/mainPage.c
+++ src/hg/hgTables/mainPage.c
@@ -537,44 +537,82 @@
     {
     slAddTail(&otList, &otAllFields);
     slAddTail(&otList, &otSelected);
     }
 showOutDropDown(otList, otDefault);
 }
 
 void nbSpaces(int count)
 /* Print some non-breaking spaces. */
 {
 int i;
 for (i=0; i<count; ++i)
     hPrintf("&nbsp;");
 }
 
+/* Stepwise instructions to guide users */
+
+#define STEP_MAX        4       // 1-based
+#define HELP_LABEL      "Help"
+
+static char *stepLabels[] = 
+{
+"Select dataset",
+"Define region of interest",
+"Define data attributes (optional)",
+"Retrieve and display data"
+};
+
+static char *stepHelpLinks[] =
+{
+"https://genome.ucsc.edu/goldenPath/help/hgTablesHelp.html#GettingStarted",
+"https://genome.ucsc.edu/goldenPath/help/hgTablesHelp.html#GettingStarted",
+"https://genome.ucsc.edu/goldenPath/help/hgTablesHelp.html#Filter",
+"https://genome.ucsc.edu/goldenPath/help/hgTablesHelp.html#OutputFormats"
+};
+
+static void printStep(int num)
+/* Print user guidance via steps */
+{
+if (num > STEP_MAX)
+    errAbort("Internal error: table browser help problem");
+hPrintf("<TR><TD>&nbsp;</TD></TR>");
+hPrintf("<TR><TD>");
+hPrintf("<B>Step %d: %s</B> &nbsp;&nbsp <A HREF='%s'TARGET='_BLANK'>%s</A>\n", 
+                num, stepLabels[num-1], stepHelpLinks[num-1], HELP_LABEL);
+hPrintf("</TD></TR>");
+hPrintf("<TR><TD>&nbsp;</TD></TR>");
+}
+
 void showMainControlTable(struct sqlConnection *conn)
 /* Put up table with main controls for main page. */
 {
 struct grp *selGroup;
 boolean isWig = FALSE, isPositional = FALSE, isMaf = FALSE, isBedGr = FALSE,
         isChromGraphCt = FALSE, isPal = FALSE, isArray = FALSE, isBam = FALSE, isVcf = FALSE, isHalSnake = FALSE,
         isLongTabix = FALSE, isHic = FALSE;
 boolean gotClade = hGotClade();
 struct hTableInfo *hti = NULL;
 
 hPrintf("<TABLE BORDER=0>\n");
 
+int stepNumber = 1;
+printStep(stepNumber++);
+
 /* Print clade, genome and assembly line. */
     {
+
     if (gotClade)
         {
         hPrintf("<TR><TD><B>clade:</B>\n");
         printCladeListHtml(hGenome(database), "change", onChangeClade());
         nbSpaces(3);
         hPrintf("<B>genome:</B>\n");
         printGenomeListForCladeHtml(database, "change", onChangeOrg());
         }
     else
         {
         hPrintf("<TR><TD><B>genome:</B>\n");
         printGenomeListHtml(database, "change", onChangeOrg());
         }
     nbSpaces(3);
     hPrintf("<B>assembly:</B>\n");
@@ -652,33 +690,34 @@
     else
         curTrack = tdb;
     isMaf = isMafTable(database, curTrack, curTable);
     }
 
 /* Table-specific options */
 if (isHicTable(curTable))
     hicMainPageConfig(cart, hTrackDbForTrack(database,curTable));
 
 hPrintf("<tr><td><DIV style='background-color: #faf2bb; display:none; opacity:0.9; border: 1px solid #EEE; margin: 2px; padding: 4px' id='snpTablesNote'>"
         "<b>Note:</b> Most dbSNP tables are huge. Trying to download them through the Table Browser "
         "usually leads to a timeout.<br> "
         "Please see our <a href='../FAQ/FAQdownloads.html#snp'>Data Access FAQ</a> "
         "on how to download dbSNP data.</DIV></td></tr>");
 
-
 /* Region line */
 {
+printStep(stepNumber++);
+
 char *regionType;
 if (cartVarExists(cart, "hgFind.matches")) // coming back from a search
     regionType = cartUsualString(cart, hgtaRegionType, hgtaRegionTypeRange);
 else
     regionType = cartUsualString(cart, hgtaRegionType, hgtaRegionTypeGenome);
 
 char *range = cartUsualString(cart, hgtaRange, "");
 
 if (isPositional)
     {
     boolean doEncode = FALSE; 
 
     if (!trackHubDatabase(database))
 	doEncode = sqlTableExists(conn, "encodeRegions");
 
@@ -759,30 +798,32 @@
     cgiMakeButton(hgtaDoPasteIdentifiers, "paste list");
     hPrintf(" ");
     cgiMakeButton(hgtaDoUploadIdentifiers, "upload list");
     if (identifierFileName() != NULL)
         {
 	hPrintf("&nbsp;");
 	cgiMakeButton(hgtaDoClearIdentifiers, "clear list");
 	}
     hPrintf("</TD></TR>\n");
     }
 }
 
 /* microarray options */
 /*   button for option page here (median/log-ratio, etc)  */
 
+printStep(stepNumber++);
+
 /* Filter line. */
 {
 hPrintf("<TR><TD><B>filter:</B>\n");
 if (anyFilter())
     {
     cgiMakeButton(hgtaDoFilterPage, "edit");
     hPrintf(" ");
     cgiMakeButton(hgtaDoClearFilter, "clear");
     if (isWig || isBedGr)
 	wigShowFilter(conn);
     }
 else
     {
     cgiMakeButton(hgtaDoFilterPage, "create");
     }
@@ -864,30 +905,32 @@
             {
             hPrintf("<BR>&nbsp;(debug:&nbsp;'%s',&nbsp;'%s(%s)')",
                     curTrack->type, tdb2->type, table2);
             }
         /* debugging 	debug	^^^^^	*/
 #endif
 
         }
     else
         cgiMakeButton(hgtaDoCorrelatePage, "create");
 
     hPrintf("</TD></TR>\n");
     }
 
 /* Print output type line. */
+
+printStep(stepNumber++);
 showOutputTypeRow(isWig, isBedGr, isPositional, isMaf, isChromGraphCt, isPal, isArray, isHalSnake);
 
 /* Print output destination line. */
     {
     char *compressType =
 	cartUsualString(cart, hgtaCompressType, textOutCompressNone);
     char *fileName = cartUsualString(cart, hgtaOutFileName, "");
     hPrintf("<TR><TD>\n");
     hPrintf("<B>output file:</B>&nbsp;");
     cgiMakeTextVar(hgtaOutFileName, fileName, 29);
     hPrintf("&nbsp;(leave blank to keep output in browser)</TD></TR>\n");
     hPrintf("<TR><TD>\n");
     hPrintf("<B>file type returned:&nbsp;</B>");
     cgiMakeRadioButton(hgtaCompressType, textOutCompressNone,
 	sameWord(textOutCompressNone, compressType));