7864ddf3a6d058dbe29f706519921cd55ccc4c67 chmalee Thu May 2 09:04:45 2024 -0700 Work in progress on building form for choosing db and hub along with files to submit diff --git src/hg/hgHubConnect/trackHubWizard.c src/hg/hgHubConnect/trackHubWizard.c index 8375640..ad39379 100644 --- src/hg/hgHubConnect/trackHubWizard.c +++ src/hg/hgHubConnect/trackHubWizard.c @@ -38,42 +38,48 @@ fprintf(stdout, "Status: 404 Not Found\n\n"); fflush(stdout); exit(0); } static void outFilesForUser() /* List out the currently stored files for the user and their sizes */ { char *userName = getUserName(); struct jsonWrite *jw = jsonWriteNew(); // the JSON to return for the client javascript jsonWriteObjectStart(jw, NULL); if (userName) { // the url for this user: jsonWriteString(jw, "userUrl", webDataDir(userName)); - // any previously uploaded files - struct fileInfo *file; - struct userFiles *uf = listFilesForUser(userName); + struct userHubs *hub, *hubList = listHubsForUser(userName); + // unpack hub directories into a flat list of files jsonWriteListStart(jw, "fileList"); - for (file = uf->file; file != NULL; file = file->next) + for (hub = hubList; hub != NULL; hub = hub->next) + { + struct fileInfo *file; + struct userFiles *uf = listFilesForUserHub(userName, hub->hubName); + for (file = uf->fileList; file != NULL; file = file->next) { jsonWriteObjectStart(jw, NULL); jsonWriteString(jw, "name", file->name); jsonWriteNumber(jw, "size", file->size); + jsonWriteString(jw, "hub", hub->hubName); + jsonWriteString(jw, "genome", hub->genome); jsonWriteDateFromUnix(jw, "createTime", file->creationTime); jsonWriteObjectEnd(jw); } + } jsonWriteListEnd(jw); } jsonWriteObjectEnd(jw); jsInlineF("var userFiles = %s;\n", dyStringCannibalize(&jw->dy)); jsonWriteFree(&jw); } void doTrackHubWizard() /* Offer an upload form so users can upload all their hub files */ { jsIncludeFile("utils.js", NULL); jsIncludeFile("ajax.js", NULL); jsIncludeFile("lodash.3.10.0.compat.min.js", NULL); jsIncludeFile("cart.js", NULL); jsIncludeFile("tus.js", NULL);