94b156304077582efe7374b25e54c8f9bd08b166 braney Tue Jul 26 10:46:04 2011 -0700 disconnects from myHub just delete the cart variable, not the line in the hubStaus table diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 72c5281..1401f46 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -123,34 +123,34 @@ cartMakeCheckBox(cart, hubName, FALSE); ourCellEnd(); } else ourPrintCell("error"); ourPrintCell(hub->shortLabel); if (isEmpty(hub->errorMessage)) ourPrintCell(hub->longLabel); else ourPrintCell(hub->errorMessage); ourPrintCell(hub->hubUrl); ourCellStart(); printf( "<input name=\"hubDisconnectButton\"" - "onClick=\"document.disconnectHubForm.elements['hubUrl'].value='%s';" + "onClick=\"document.disconnectHubForm.elements['hubId'].value='%d';" "document.disconnectHubForm.submit();return true;\" " "class=\"hubField\" type=\"button\" value=\"X\">" - , hub->hubUrl); + , hub->id); ourCellEnd(); } printf("</TR></tbody></TABLE>\n"); cgiMakeButton("Submit", "Display Selected Hubs"); printf("</div>"); } static void makeGenomePrint() /* print out the name of the current database etc. */ { getDbAndGenome(cart, &database, &organism, oldVars); printf("<div id=\"assemblyInfo\"> \n"); printf("<B>genome:</B> %s <B>assembly:</B> %s ", organism, hFreezeDate(database)); @@ -246,36 +246,40 @@ 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"); } static void doDisconnectHub(struct cart *theCart) { -char *url = cartOptionalString(cart, hgHubDataText); +char *id = cartOptionalString(cart, "hubId"); -if (url != NULL) - hubDisconnect(theCart, url); +if (id != NULL) + { + char buffer[1024]; + safef(buffer, sizeof buffer, "hgHubConnect.hub.%s", id); + cartRemove(cart, buffer); + } -cartRemove(theCart, hgHubDataText); +cartRemove(theCart, "hubId"); } void doMiddle(struct cart *theCart) /* Write header and body of html page. */ { cart = theCart; setUdcCacheDir(); if (cartVarExists(cart, hgHubDoClear)) { doClearHub(cart); cartWebEnd(); return; } if (cartVarExists(cart, hgHubDoDisconnect)) @@ -305,31 +309,31 @@ // figure out and print out genome name makeGenomePrint(); // check to see if we have any new hubs boolean gotNew = hubCheckForNew(database, cart); // 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("hubUrl", ""); +cgiMakeHiddenVar("hubId", ""); cgiMakeHiddenVar(hgHubDoDisconnect, "on"); cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); puts("</FORM>"); // ... and now the main form printf("<FORM ACTION=\"%s\" METHOD=\"POST\" NAME=\"mainForm\">\n", destUrl); cartSaveSession(cart); // 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();