0f349359a8bebbd67c7bd7bb732285dee71905fc
chmalee
  Tue May 7 08:43:51 2024 -0700
Start of requiring hub,genome,and file type with each file submission

diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index fe0b251..46e92d4 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -20,30 +20,31 @@
 #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"
+#include "cartJson.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;
@@ -1698,34 +1699,51 @@
 struct hash *publicHash = hgHubConnectPublic();
 
 hgHubConnectUnlisted(hubList, publicHash);
 
 if (cfgOptionBooleanDefault("hgHubConnect.validateHub", TRUE))
     hgHubConnectDeveloperMode();
 if (cfgOptionBooleanDefault("storeUserFiles", TRUE))
     hgHubConnectOfferUpload();
 
 printf("</div>"); // #tabs
 
 
 cartWebEnd();
 }
 
+void doAsync()
+/* Execute the async request */
+{
+struct cartJson *cj = cartJsonNew(cart);
+cartJsonRegisterHandler(cj, hgHubDeleteFile, doRemoveFile);
+cartJsonRegisterHandler(cj, hgHubCreateHub, doCreateHub);
+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};
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 long enteredMainTime = clock1000();
 
 oldVars = hashNew(10);
 cgiSpoof(&argc, argv);
-if (cgiOptionalString(hgHubDeleteFile))
-    cartEmptyShellNoContent(doRemoveFile, hUserCookie(), excludeVars, oldVars);
+if (isAsyncRequest())
+    doAsync();
 else
     cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
 cgiExitTime("hgHubConnect", enteredMainTime);
 return 0;
 }