dbc7d6bb2237141fdbea01fff6c265ade6738c57
chmalee
  Fri Oct 6 13:03:41 2023 -0700
Start on trackHubWizard module

diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index eb98dc0..6a99796 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -19,30 +19,31 @@
 #include "dbDb.h"
 #include "web.h"
 #include "trackHub.h"
 #include "hubConnect.h"
 #include "dystring.h"
 #include "hPrint.h"
 #include "jsHelper.h"
 #include "obscure.h"
 #include "hgConfig.h"
 #include "trix.h"
 #include "net.h"
 #include "hubSearchText.h"
 #include "pipeline.h"
 #include "hubPublic.h"
 #include "wikiLink.h"
+#include "hgHubConnect.h"
 
 static boolean measureTiming;
 
 struct cart *cart;	/* The user's ui state. */
 struct hash *oldVars = NULL;
 
 static char *pageTitle = "Track Data Hubs";
 char *database = NULL;
 char *organism = NULL;
 
 struct hubOutputStructure
     {
     struct hubOutputStructure *next;
     struct dyString *metaTags;
     struct dyString *descriptionMatch;
@@ -1516,30 +1517,36 @@
 jsIncludeFile("utils.js", NULL);
 jsIncludeFile("jquery-ui.js", NULL);
 webIncludeResourceFile("jquery-ui.css");
 jsIncludeFile("ajax.js", NULL);
 jsIncludeFile("hgHubConnect.js", NULL);
 webIncludeResourceFile("hgHubConnect.css");
 jsIncludeFile("jquery.cookie.js", NULL);
 jsIncludeFile("spectrum.min.js", NULL); // there is no color picker used anywhere on this page. why include this?
 }
 
 void blankWarn()
 /* Dummy warn handler used in the iframe for returning hubCheck output */
 {
 }
 
+void hgHubConnectOfferUpload()
+/* Make the tab that allows users to upload data files and create a hub on the fly */
+{
+doTrackHubWizard();
+}
+
 void doMiddle(struct cart *theCart)
 /* Write header and body of html page. */
 {
 cart = theCart;
 // hgHubConnect's own timing is tied to a special value of measureTiming, since now
 // our users use measureTiming a lot more, we need to keep a special mode for us
 measureTiming = sameString(cartUsualString(cart, "measureTiming", ""), "full");
 
 if(cgiIsOnWeb())
     checkForGeoMirrorRedirect(cart);
 
 if (cartVarExists(cart, hgHubDoClear))
     {
     doClearHub(cart);
     cartWebEnd();
@@ -1664,54 +1671,61 @@
 // this is the invisible form for the reset hub button - it's submitted via javascript
 printf("<FORM ACTION=\"%s\" NAME=\"resetHubForm\">\n",  "../cgi-bin/hgHubConnect");
 cgiMakeHiddenVar(hgHubCheckUrl, "");
 cartSaveSession(cart);
 puts("</FORM>");
 
 
 // ... and now the main form
 
 // we have three tabs for the public and unlisted hubs and hub development
 printf("<div id=\"tabs\">"
        "<ul> <li><a class=\"defaultDesc\" href=\"#publicHubs\">Public Hubs</a></li>"
        "<li><a class=\"defaultDesc\" href=\"#unlistedHubs\">Connected Hubs</a></li> ");
 if (cfgOptionBooleanDefault("hgHubConnect.validateHub", TRUE))
     printf("<li><a class=\"hubDeveloperDesc\" href=\"#hubDeveloper\">Hub Development</a></li>");
+if (cfgOptionBooleanDefault("storeUserFiles", TRUE))
+    printf("<li><a class=\"hubUpload\" href=\"#hubUpload\">Hub Upload</a></li>");
 printf("</ul> ");
 
 // The public hubs table is getting big and takes a while to download.
 // Jquery UI's tabs() command will layout the page, but because of
 // jsInlining, it will only be called at the end of the page. This can lead to the page "jumping".
 // To make the inline code run now, let's flush JS inlines.
 // I'm not sure that this makes a visible difference, but it doesn't do any harm either
 jsInlineFinish();
 jsInlineReset();
 
 struct hash *publicHash = hgHubConnectPublic();
 
 hgHubConnectUnlisted(hubList, publicHash);
 
 if (cfgOptionBooleanDefault("hgHubConnect.validateHub", TRUE))
     hgHubConnectDeveloperMode();
+if (cfgOptionBooleanDefault("storeUserFiles", TRUE))
+    hgHubConnectOfferUpload();
 
 printf("</div>"); // #tabs
 
 
 cartWebEnd();
 }
 
 char *excludeVars[] = {"Submit", "submit", "hc_one_url", hgHubDoHubCheck,
     hgHubCheckUrl, hgHubDoClear, hgHubDoRefresh, hgHubDoDisconnect,hgHubDoRedirect, hgHubDataText, 
-    hgHubConnectRemakeTrackHub, NULL};
+    hgHubConnectRemakeTrackHub, hgHubCreate, NULL};
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 long enteredMainTime = clock1000();
 
 oldVars = hashNew(10);
 cgiSpoof(&argc, argv);
+if (cgiOptionalString(hgHubCreate))
+    cartEmptyShellNoContent(doCreateHub, hUserCookie(), excludeVars, oldVars);
+else
     cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
 cgiExitTime("hgHubConnect", enteredMainTime);
 return 0;
 }