2ba572dc8bbe18b3398dcf17205dafdd52ab396a braney Sat May 24 10:01:21 2014 -0700 updates to hgHubConnect to interface to make it less confusing. Nowconnection and disconnection put you on the gateway page. diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 2b54555..8f9e737 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -12,42 +12,34 @@ #include "htmshell.h" #include "hdb.h" #include "hui.h" #include "cart.h" #include "dbDb.h" #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" -#define hgHub "hgHub_" /* prefix for all control variables */ -#define hgHubDo hgHub "do_" /* prefix for all commands */ -#define hgHubDoClear hgHubDo "clear" -#define hgHubDoDisconnect hgHubDo "disconnect" -#define hgHubDoReset hgHubDo "reset" -#define hgHubDoSearch hgHubDo "search" -#define hgHubDoDeleteSearch hgHubDo "deleteSearch" struct cart *cart; /* The user's ui state. */ struct hash *oldVars = NULL; -static char *destUrl = "../cgi-bin/hgTracks"; static char *pageTitle = "Track Data Hubs"; char *database = NULL; char *organism = NULL; static void ourCellStart() { fputs("
Display | " "Hub Name | " "Description | " "Assemblies | " - "URL | " "
---|---|---|---|---|
ERROR: %s " "Debug | ", errorMessage); - printGenomeList(slNameListFromComma(dbList), count); // Leaking a bit of memory - ourPrintCell(url); + printGenomeList(dbListNames, count); hashStore(publicHash, url); } sqlFreeResult(&sr); if (gotAnyRows) { printf("
clearing hub %s\n",url);
if (url != NULL)
hubClearStatus(url);
else
errAbort("must specify url in %s\n", hgHubDataText);
printf("Completed\n");
}
-static void doDisconnectHub(struct cart *theCart)
-{
-char *id = cartOptionalString(cart, "hubId");
-
-if (id != NULL)
- {
- char buffer[1024];
- safef(buffer, sizeof buffer, "hgHubConnect.hub.%s", id);
- cartRemove(cart, buffer);
- }
-
-cartRemove(theCart, "hubId");
-}
static void checkTrackDbs(struct hubConnectStatus *hubList)
{
struct hubConnectStatus *hub = hubList;
for(; hub; hub = hub->next)
{
struct errCatch *errCatch = errCatchNew();
if (errCatchStart(errCatch))
{
hubAddTracks(hub, database);
}
errCatchEnd(errCatch);
if (errCatch->gotError)
{
hub->errorMessage = cloneString(errCatch->message->string);
hubUpdateStatus( errCatch->message->string, hub);
}
else
hubUpdateStatus(NULL, hub);
}
}
void doMiddle(struct cart *theCart)
/* Write header and body of html page. */
{
-boolean gotDisconnect = FALSE;
-
cart = theCart;
if (cartVarExists(cart, hgHubDoClear))
{
doClearHub(cart);
cartWebEnd();
return;
}
-if (cartVarExists(cart, hgHubDoDisconnect))
- {
- gotDisconnect = TRUE;
- doDisconnectHub(cart);
-
- // now rebuild the cart variable ("trackHubs") that has which lists which
- // hubs are on.
- hubConnectHubsInCart(cart);
- }
-
if (cartVarExists(cart, hgHubDoReset))
{
doResetHub(cart);
}
cartWebStart(cart, NULL, "%s", pageTitle);
jsIncludeFile("jquery.js", NULL);
jsIncludeFile("utils.js", NULL);
jsIncludeFile("jquery-ui.js", NULL);
webIncludeResourceFile("jquery-ui.css");
jsIncludeFile("ajax.js", NULL);
jsIncludeFile("hgHubConnect.js", NULL);
jsIncludeFile("jquery.cookie.js", NULL);
@@ -606,88 +595,94 @@
char *surveyLabel = cfgOptionEnv("HGDB_HUB_SURVEY_LABEL", "hubSurveyLabel");
if (survey && differentWord(survey, "off"))
hPrintf("%s\n", survey, surveyLabel ? surveyLabel : "Take survey");
hPutc('\n');
// check to see if we have any new hubs
hubCheckForNew(cart);
// grab all the hubs that are listed in the cart
struct hubConnectStatus *hubList = hubConnectStatusListFromCartAll(cart);
checkTrackDbs(hubList);
// here's a little form for the add new hub button
-printf("
");
+
+// this is the form for the connect hub button
+printf("");
// this is the form for the disconnect hub button
-printf("");
// this is the form for the reset hub button
printf("");
// this is the form for the search hub button
printf("");
// ... and now the main form
-if (cartVarExists(cart, hgHubConnectCgiDestUrl))
- destUrl = cartOptionalString(cart, hgHubConnectCgiDestUrl);
-printf("");
cartWebEnd();
}
char *excludeVars[] = {"Submit", "submit", "hc_one_url",
- hgHubDoReset, hgHubDoClear, hgHubDoDisconnect, hgHubDataText,
+ hgHubDoReset, hgHubDoClear, hgHubDoDisconnect,hgHubDoConnect, hgHubDataText,
hgHubConnectRemakeTrackHub, NULL};
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
oldVars = hashNew(10);
setUdcCacheDir();
cgiSpoof(&argc, argv);
cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
cgiExitTime("hgHubConnect", enteredMainTime);
return 0;
}