df0a2064d8b66546ba0ed154309ced09d5e3190d
braney
Thu Apr 14 16:37:52 2011 -0700
rearrange some things to make more sense
diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index 8ba1ecb..f647db2 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -108,46 +108,40 @@
if (count)
webPrintLinkTableEnd();
else
printf("No Private Track Hubs for this genome assembly
");
}
static void makeNewHubButton()
{
printf("
\n");
}
-void hgHubConnectPublic()
-/* Put up the list of external hubs and other controls for the page. */
+static void makeGenomePrint()
{
-//destUrl = cartUsualString(cart, hgHubConnectCgiDestUrl, destUrl);
-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 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. To arrange "
- "for your own track data hub to appear in this list, please contact genome@soe.ucsc.edu.
\n"
- );
getDbAndGenome(cart, &database, &organism, oldVars);
printf("genome: %s assembly: %s [%s] ",
organism, hFreezeDate(database), database);
-cgiMakeButton("submit", "submit");
-printf("
");
+}
+
+void hgHubConnectPublic()
+/* Put up the list of external hubs and other controls for the page. */
+{
printf("List of Public Hubs
");
struct sqlConnection *conn = hConnectCentral();
char query[512];
safef(query, sizeof(query), "select id,shortLabel,longLabel,errorMessage,hubUrl,dbList from %s",
hubConnectTableName);
struct sqlResult *sr = sqlGetResult(conn, query);
char **row;
boolean gotAnyRows = FALSE;
while ((row = sqlNextRow(sr)) != NULL)
{
char *id = row[0], *shortLabel = row[1], *longLabel = row[2], *errorMessage = row[3],
*url = row[4], *dbList = row[5];
if (nameInCommaList(database, dbList))
{
@@ -266,30 +260,31 @@
hub->id = -1;
}
else
{
struct lineFile *lf = lineFileOpen(oldHubTrashName, TRUE);
int lineSize;
char *line;
int count = 1;
while (lineFileNext(lf, &line, &lineSize))
{
count++;
fprintf(f, "%s\n", line);
}
lineFileClose(&lf);
+ unlink(oldHubTrashName);
hub->id = -count;
}
hubWriteToFile(f, hub);
carefulClose(&f);
safef(hubName, sizeof(hubName), "%s%d", hgHubConnectHubVarPrefix, hub->id);
cartSetString(cart, hubName, "1");
cartSetString(cart, hubFileVar(), hubTrashName);
}
void checkForNewHub(struct cart *cart)
{
char *url = cartOptionalString(cart, hgHubDataText);
@@ -307,53 +302,66 @@
warn(errCatch->message->string);
return;
}
errCatchFree(&errCatch);
AllocVar(hub);
hub->hubUrl = cloneString(url);
hub->errorMessage = "";
hub->shortLabel = tHub->shortLabel;
hub->longLabel = tHub->longLabel;
hub->dbCount = 0;
AllocArray(hub->dbArray, 1);
hub->dbArray[0] = database;
hubSaveInCart(cart, hub);
- cartRemove(cart, hgHubDataText);
}
}
void doMiddle(struct cart *theCart)
/* Write header and body of html page. */
{
cart = theCart;
setUdcCacheDir();
if (cartVarExists(cart, hgHubDoAdd))
doAddPrivateHub(cart, NULL);
else
{
cartWebStart(cart, NULL, pageTitle);
checkForNewHub(cart);
printf("");
makeNewHubButton();
}
cartWebEnd();
}
-char *excludeVars[] = {"Submit", "submit", "hc_one_url", hgHubConnectCgiDestUrl, hgHubDoAdd, NULL};
+char *excludeVars[] = {"Submit", "submit", "hc_one_url", hgHubConnectCgiDestUrl, hgHubDoAdd, hgHubDataText, NULL};
int main(int argc, char *argv[])
/* Process command line. */
{
oldVars = hashNew(10);
cgiSpoof(&argc, argv);
cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
return 0;
}