e46da004a1ed5fdf64eb24662bf94e0eee2f3bf3
chmalee
  Tue Aug 22 10:15:31 2023 -0700
Make hgTracks tutorial start automatically with special url variable startTutorial=true, refs #32004

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index aac2ea6..25e6bee 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -11159,30 +11159,39 @@
         webIncludeResourceFile("jquery.contextmenu.css");
         jsIncludeFile("jquery.contextmenu.js", NULL);
         webIncludeResourceFile("ui.dropdownchecklist.css");
         jsIncludeFile("ui.dropdownchecklist.js", NULL);
         jsIncludeFile("ddcl.js", NULL);
         if (cfgOptionBooleanDefault("showTutorial", FALSE))
             {
             puts("<script src=\"https://cdn.jsdelivr.net/npm/shepherd.js@11.0.1/dist/js/shepherd.min.js\"></script>");
             puts("<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/shepherd.js@11.0.1/dist/css/shepherd.css\"/>");
             jsIncludeFile("tutorial.js",NULL);
             // if the user is logged in, we won't show the notification
             // that a tutorial is available, just leave the link in the
             // blue bar under "Help"
             if (wikiLinkUserName())
                 jsInline("var userLoggedIn = true;");
+            // if the CGI variable startTutorial=true is present (in that exact
+            // spelling/case), immediately start the tutorial, for example
+            // when the user clicks a link from a help page. Note that this
+            // means it is a one time link that won't work on refresh because
+            // the variable isn't saved onto the URL
+            if (sameOk(cgiOptionalString("startTutorial"), "true"))
+                {
+                jsInline("var startTutorialOnLoad = true;");
+                }
             }
         }
 
     hPrintf("<div id='hgTrackUiDialog' style='display: none'></div>\n");
     hPrintf("<div id='hgTracksDialog' style='display: none'></div>\n");
 
     cartFlushHubWarnings();
     }
 
 
 if (cartVarExists(cart, "chromInfoPage"))
     {
     cartRemove(cart, "chromInfoPage");
     chromInfoPage();
     }