e5071fb49ba86bae0fc173976c576c2440e0fe6e braney Fri Jun 6 10:31:51 2014 -0700 oops... another tweak to get "no public hubs" message to come out diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index e546774..db4100b 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -285,31 +285,31 @@ /* find hubs that match search term in trixFile */ { struct hash *urlSearchHash = newHash(5); struct trix *trix = trixOpen(trixFile); int trixWordCount = chopString(hubSearchTerms, " ", NULL, 0); char *trixWords[trixWordCount]; trixWordCount = chopString(hubSearchTerms, " ", trixWords, trixWordCount); struct trixSearchResult *tsList = trixSearch(trix, trixWordCount, trixWords, TRUE); for ( ; tsList != NULL; tsList = tsList->next) hashStore(urlSearchHash, tsList->itemId); return urlSearchHash; } -static struct hash *outputPublicTable(struct sqlConnection *conn, char *publicTable, char *statusTable) +static boolean outputPublicTable(struct sqlConnection *conn, char *publicTable, char *statusTable, struct hash **pHash) /* Put up the list of public hubs and other controls for the page. */ { char *trixFile = cfgOptionEnvDefault("HUBSEARCHTRIXFILE", "hubSearchTrixFile", "/gbdb/hubs/public.ix"); char *hubSearchTerms = cartOptionalString(cart, hgHubSearchTerms); char *cleanSearchTerms = cloneString(hubSearchTerms); boolean haveTrixFile = fileExists(trixFile); struct hash *urlSearchHash = NULL; printf("
\n"); // if we have a trix file, draw the search box if (haveTrixFile) { puts("Enter search terms to find in public track hub description pages:
" "\n"); puts("

\n"); strLower(cleanSearchTerms); urlSearchHash = getUrlSearchHash(trixFile, cleanSearchTerms); } -puts("Clicking Connect redirects to the gateway page of the selected hub's default assembly.
"); // make sure all the public hubs are in the hubStatus table. addPublicHubsToHubStatus(conn, publicTable, statusTable); struct hash *publicHash = newHash(5); char query[512]; bool hasDescription = sqlColumnExists(conn, publicTable, "descriptionUrl"); if (hasDescription) sqlSafef(query, sizeof(query), "select p.hubUrl,p.shortLabel,p.longLabel,p.dbList,s.errorMessage,s.id,p.descriptionUrl from %s p,%s s where p.hubUrl = s.hubUrl", publicTable, statusTable); else sqlSafef(query, sizeof(query), "select p.hubUrl,p.shortLabel,p.longLabel,p.dbList,s.errorMessage,s.id from %s p,%s s where p.hubUrl = s.hubUrl", publicTable, statusTable); struct sqlResult *sr = sqlGetResult(conn, query); char **row; @@ -362,30 +361,31 @@ *dbList = row[3], *errorMessage = row[4], *descriptionUrl = row[6]; int id = atoi(row[5]); hashStore(publicHash, url); if ((urlSearchHash != NULL) && (hashLookup(urlSearchHash, url) == NULL)) continue; struct slName *dbListNames = slNameListFromComma(dbList); if (gotAnyRows) webPrintLinkTableNewRow(); else { /* output header */ + puts("Clicking Connect redirects to the gateway page of the selected hub's default assembly.
"); printf(" " " " " " " " " " " " "\n"); // start first row printf(""); gotAnyRows = TRUE; } if ((id != 0) && isEmpty(errorMessage)) { @@ -447,48 +447,49 @@ ourPrintCell(longLabel); } else printf("", errorMessage); printGenomeList(dbListNames, count); } sqlFreeResult(&sr); if (gotAnyRows) printf("
DisplayHub NameDescriptionAssemblies
ERROR: %s " "Debug
\n"); printf("
"); -return publicHash; +*pHash = publicHash; +return gotAnyRows; } struct hash *hgHubConnectPublic() /* Put up the list of public hubs and other controls for the page. */ { struct hash *retHash = NULL; struct sqlConnection *conn = hConnectCentral(); char *publicTable = cfgOptionEnvDefault("HGDB_HUB_PUBLIC_TABLE", hubPublicTableConfVariable, defaultHubPublicTableName); char *statusTable = cfgOptionEnvDefault("HGDB_HUB_STATUS_TABLE", hubStatusTableConfVariable, defaultHubStatusTableName); if (!(sqlTableExists(conn, publicTable) && - (retHash = outputPublicTable(conn, publicTable,statusTable)) != NULL )) + outputPublicTable(conn, publicTable,statusTable, &retHash)) ) { printf("
\n"); - printf("No Public Track Hubs
"); + printf("No Public Track Hubs found that match search criteria.
"); printf("
"); } hDisconnectCentral(&conn); return retHash; } static void tryHubOpen(unsigned id) /* try to open hub, leaks trackHub structure */ { /* try opening this again to reset error */ struct sqlConnection *conn = hConnectCentral(); struct errCatch *errCatch = errCatchNew(); struct hubConnectStatus *hub = NULL; if (errCatchStart(errCatch))