3a88c02326aadbb1df3436cd519f7b8a4df6ae5b
chmalee
  Thu Jun 6 15:32:15 2024 -0700
Work in progress using the mysql table for hubSpace on client side

diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index 46e92d4..ffc80df 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -1611,30 +1611,33 @@
                 "chmod a+x hubCheck\n"
                 "hubCheck https://genome.ucsc.edu/goldenPath/help/examples/hubDirectory/hub.txt</pre></p>");
         puts("<p>You can use the 'Esc' key to close this window.</p>");
         }
     puts("</div>"); // margin 10px
     puts("</div>"); // ui-dialog-titlebar
     puts("</div>"); // ui-dialog
     cartWebEnd();
     return;
     }
 
 cartWebStart(cart, NULL, "%s", pageTitle);
 
 printIncludes();
 
+// need the hgsid:
+//jsInlineF("var hgsid = \"%s\";\n", cartSessionId(cart));
+
 // this variable is used by hub search and hub validate, initialize here so we don't
 // overwrite it unintentionally depending on which path the CGI takes
 jsInline("trackData = [];\n");
 
 getDbAndGenome(cart, &database, &organism, oldVars);
 
 char *survey = cfgOptionEnv("HGDB_HUB_SURVEY", "hubSurvey");
 char *surveyLabel = cfgOptionEnv("HGDB_HUB_SURVEY_LABEL", "hubSurveyLabel");
 
 if (survey && differentWord(survey, "off"))
     hPrintf("<span style='background-color:yellow;'><A HREF='%s' TARGET=_BLANK><EM><B>%s</EM></B></A></span>\n", survey, surveyLabel ? surveyLabel : "Take survey");
 hPutc('\n');
 
 // grab all the hubs that are listed in the cart
 struct hubConnectStatus *hubList =  hubConnectStatusListFromCartAll(cart);
@@ -1699,51 +1702,45 @@
 struct hash *publicHash = hgHubConnectPublic();
 
 hgHubConnectUnlisted(hubList, publicHash);
 
 if (cfgOptionBooleanDefault("hgHubConnect.validateHub", TRUE))
     hgHubConnectDeveloperMode();
 if (cfgOptionBooleanDefault("storeUserFiles", TRUE))
     hgHubConnectOfferUpload();
 
 printf("</div>"); // #tabs
 
 
 cartWebEnd();
 }
 
-void doAsync()
+void doAsync(struct cart *theCart)
 /* Execute the async request */
 {
+cart = theCart;
 struct cartJson *cj = cartJsonNew(cart);
 cartJsonRegisterHandler(cj, hgHubDeleteFile, doRemoveFile);
 cartJsonRegisterHandler(cj, hgHubCreateHub, doCreateHub);
+cartJsonRegisterHandler(cj, hgHubMoveFile, doMoveFile);
 cartJsonExecute(cj);
 }
 
-boolean isAsyncRequest()
-/* Do the CGI arguments indicate this request is async? */
-{
-if (cgiOptionalString(hgHubDeleteFile) || cgiOptionalString(hgHubCreateHub))
-    return TRUE;
-return FALSE;
-}
-
 char *excludeVars[] = {"Submit", "submit", "hc_one_url", hgHubDoHubCheck,
     hgHubCheckUrl, hgHubDoClear, hgHubDoRefresh, hgHubDoDisconnect,hgHubDoRedirect, hgHubDataText, 
-    hgHubConnectRemakeTrackHub, hgHubDeleteFile, NULL};
+    hgHubConnectRemakeTrackHub, NULL};
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 long enteredMainTime = clock1000();
 
 oldVars = hashNew(10);
 cgiSpoof(&argc, argv);
-if (isAsyncRequest())
-    doAsync();
+if (cgiOptionalString(CARTJSON_COMMAND))
+    cartEmptyShellNoContent(doAsync, hUserCookie(), excludeVars, oldVars);
 else
     cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
 cgiExitTime("hgHubConnect", enteredMainTime);
 return 0;
 }