0bfc44e10a7e52c9435a8be1aba871ce19cc509d braney Thu Aug 18 12:30:00 2011 -0700 check to see if hub is okay after adding a myHub #4679 diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 47c8793..a8a5656 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -247,52 +247,58 @@ if (gotAnyRows) { printf("</TR></tbody></TABLE>\n"); } else { printf("<div id=\"publicHubs\" class=\"hubList\"> \n"); printf("No Public Track Hubs for this genome assembly<BR>"); } printf("</div>"); hDisconnectCentral(&conn); } -static void doResetHub(struct cart *theCart) -{ -char *url = cartOptionalString(cart, hgHubDataText); - -if (url != NULL) +static void tryHubOpen(unsigned id) +/* try to open hub, leaks trackHub structure */ { - unsigned id = hubResetError(url); - /* try opening this again to reset error */ struct errCatch *errCatch = errCatchNew(); struct trackHub *tHub; if (errCatchStart(errCatch)) tHub = trackHubFromId(id); errCatchEnd(errCatch); if (errCatch->gotError) hubSetErrorMessage( errCatch->message->string, id); else hubSetErrorMessage(NULL, id); errCatchFree(&errCatch); tHub = NULL; } + + +static void doResetHub(struct cart *theCart) +{ +char *url = cartOptionalString(cart, hgHubDataText); + +if (url != NULL) + { + unsigned id = hubResetError(url); + tryHubOpen(id); + } else errAbort("must specify url in %s\n", hgHubDataText); } static void doClearHub(struct cart *theCart) { char *url = cartOptionalString(cart, hgHubDataText); printf("<pre>clearing hub %s\n",url); if (url != NULL) hubClearStatus(url); else errAbort("must specify url in %s\n", hgHubDataText); printf("<pre>Completed\n"); } @@ -353,31 +359,34 @@ "<P>Track data hubs are collections of tracks from outside of UCSC that " "can be imported into the Genome Browser. To import a public hub check " "the box in the list below. " "After import the hub will show up as a group of tracks with its own blue " "bar and label underneath the main browser graphic, and in the " "configure page. For more information, see the " "<A HREF=\"../goldenPath/help/hgTrackHubHelp.html\" TARGET=_blank>" "User's Guide</A>.</P>\n" ); printf("</div>\n"); // figure out and print out genome name makeGenomePrint(); // check to see if we have any new hubs -boolean gotNew = hubCheckForNew(database, cart); +unsigned newId = hubCheckForNew(database, cart); + +if (newId) + tryHubOpen(newId); // here's a little form for the add new hub button printf("<FORM ACTION=\"%s\" NAME=\"addHubForm\">\n", "../cgi-bin/hgHubConnect"); cgiMakeHiddenVar("hubUrl", ""); cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); puts("</FORM>"); // this the form for the disconnect hub button printf("<FORM ACTION=\"%s\" NAME=\"disconnectHubForm\">\n", "../cgi-bin/hgHubConnect"); cgiMakeHiddenVar("hubId", ""); cgiMakeHiddenVar(hgHubDoDisconnect, "on"); cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); puts("</FORM>"); // this the form for the reset hub button @@ -397,31 +406,31 @@ // we have two tabs for the public and unlisted hubs printf("<div id=\"tabs\">" "<ul> <li><a href=\"#publicHubs\">Public Hubs</a></li>" "<li><a href=\"#unlistedHubs\">My Hubs</a></li> " "</ul> "); hgHubConnectPublic(); hgHubConnectUnlisted(); printf("</div>"); printf("<div class=\"tabFooter\">"); cgiMakeButton("Submit", "Load Selected Hubs"); printf("<span class=\"small\">Contact <A HREF=\"mailto:genome@soe.ucsc.edu\">genome@soe.ucsc.edu</A> to add a public hub.</span>\n"); printf("</div>"); -if (gotNew || gotDisconnect) // make MyHubs the default tab +if ((newId != 0) || gotDisconnect) // make MyHubs the default tab { printf("<script type='text/javascript'>\n "); printf("var $tabs = $('#tabs').tabs();\n"); printf(" $tabs.tabs('select',1);\n"); printf("</script>\n"); } cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); printf("</div>\n"); puts("</FORM>"); cartWebEnd(); } char *excludeVars[] = {"Submit", "submit", "hc_one_url",