37a331259beee4fa8ebe7aa7f4d5b9d765a14c7f kent Thu Jan 6 15:45:34 2011 -0800 Starting to make hgHubConnect talk with hgTracks and hgTrackUi. Right now the tracks appear on the track list, but are not displaying properly. diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index fb4a710..c368772 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -1,141 +1,142 @@ /* hgHubConnect - the CGI web-based program to select track data hubs to connect with. */ #include "common.h" #include "hash.h" #include "linefile.h" #include "errabort.h" #include "errCatch.h" #include "hCommon.h" #include "dystring.h" #include "jksql.h" #include "cheapcgi.h" #include "htmshell.h" #include "hdb.h" #include "hui.h" #include "cart.h" #include "dbDb.h" #include "web.h" #include "trackHub.h" #include "hubConnect.h" static char const rcsid[] = "$Id: hgPcr.c,v 1.29 2009/09/23 18:42:17 angie Exp $"; struct cart *cart; /* The user's ui state. */ struct hash *oldVars = NULL; static char *destUrl = "../cgi-bin/hgTracks"; static char *pageTitle = "UCSC Track Hub Connect"; char *database = NULL; char *organism = NULL; boolean nameInCommaList(char *name, char *commaList) /* Return TRUE if name is in comma separated list. */ { if (commaList == NULL) return FALSE; int nameLen = strlen(name); for (;;) { char c = *commaList; if (c == 0) return FALSE; if (memcmp(name, commaList, nameLen) == 0) { c = commaList[nameLen]; if (c == 0 || c == ',') return TRUE; } commaList = strchr(commaList, ','); if (commaList == NULL) return FALSE; commaList += 1; } } void hgHubConnect() /* Put up the list of hubs and other controls for the page. */ { destUrl = cartUsualString(cart, hgHubConnectCgiDestUrl, destUrl); printf("
\n", destUrl); cartSaveSession(cart); +cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); printf( "

Track hubs are collections of tracks from outside of UCSC that can be imported into the " "Genome Browser. To import a hub check the box in the list below. " "After import the hub will show up as a group of tracks with it's own blue " "bar and label underneath the main browser graphic, and in the configure page. To arrange " "for your own track 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("
"); 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)) { if (gotAnyRows) webPrintLinkTableNewRow(); else { webPrintLinkTableStart(); gotAnyRows = TRUE; } - if (errorMessage) - webPrintLinkCell("error"); - else + if (isEmpty(errorMessage)) { webPrintLinkCellStart(); char hubName[32]; - safef(hubName, sizeof(hubName), "hub_%s", id); + safef(hubName, sizeof(hubName), "%s%s", hgHubConnectHubVarPrefix, id); cartMakeCheckBox(cart, hubName, FALSE); webPrintLinkCellEnd(); } - webPrintLinkCell(shortLabel); - if (errorMessage) - webPrintLinkCell(errorMessage); else + webPrintLinkCell("error"); + webPrintLinkCell(shortLabel); + if (isEmpty(errorMessage)) webPrintLinkCell(longLabel); + else + webPrintLinkCell(errorMessage); webPrintLinkCell(url); } } sqlFreeResult(&sr); if (gotAnyRows) webPrintLinkTableEnd(); else printf("No Track Hubs for this genome assembly"); printf("
\n"); hDisconnectCentral(&conn); } void doMiddle(struct cart *theCart) /* Write header and body of html page. */ { cart = theCart; setUdcCacheDir(); cartWebStart(cart, NULL, pageTitle); hgHubConnect(); cartWebEnd(); } char *excludeVars[] = {"Submit", "submit", "hc_one_url", hgHubConnectCgiDestUrl, NULL}; int main(int argc, char *argv[]) /* Process command line. */ { oldVars = hashNew(10); cgiSpoof(&argc, argv); cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars); return 0; }