b274662adfb195dd49ab8de8bb3d5d92f2fb7ca9 braney Sat Aug 6 11:27:33 2011 -0700 add soft-reset button to hgHubConnect (#4815) diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 839775c..563095d 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -14,30 +14,31 @@ #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" #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" struct cart *cart; /* The user's ui state. */ struct hash *oldVars = NULL; static char *destUrl = "../cgi-bin/hgTracks"; static char *pageTitle = "Import Tracks from Data Hubs"; char *database = NULL; char *organism = NULL; static void ourCellStart() { puts("
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");
@@ -260,43 +288,49 @@
char buffer[1024];
safef(buffer, sizeof buffer, "hgHubConnect.hub.%s", id);
cartRemove(cart, buffer);
}
cartRemove(theCart, "hubId");
}
void doMiddle(struct cart *theCart)
/* Write header and body of html page. */
{
boolean gotDisconnect = FALSE;
cart = theCart;
setUdcCacheDir();
+
if (cartVarExists(cart, hgHubDoClear))
{
doClearHub(cart);
cartWebEnd();
return;
}
if (cartVarExists(cart, hgHubDoDisconnect))
{
gotDisconnect = TRUE;
doDisconnectHub(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);
webIncludeResourceFile("hgHubConnect.css");
printf(" \n");
printf(
"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 "
@@ -316,30 +350,38 @@
boolean gotNew = hubCheckForNew(database, cart);
// here's a little form for the add new hub button
printf("
");
// this the form for the disconnect hub button
printf("");
+// this the form for the reset hub button
+printf("");
+
+
// ... and now the main form
if (cartVarExists(cart, hgHubConnectCgiDestUrl))
destUrl = cartOptionalString(cart, hgHubConnectCgiDestUrl);
printf("\n");
puts("");
cartWebEnd();
}
char *excludeVars[] = {"Submit", "submit", "hc_one_url",
- hgHubDoClear, hgHubDoDisconnect, hgHubDataText,
+ hgHubDoReset, hgHubDoClear, hgHubDoDisconnect, hgHubDataText,
hgHubConnectRemakeTrackHub, NULL};
int main(int argc, char *argv[])
/* Process command line. */
{
oldVars = hashNew(10);
cgiSpoof(&argc, argv);
cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
return 0;
}