137316d9d42ac5424b83ae974a6b239d1f295ffb braney Mon Jul 11 15:00:15 2011 -0700 stop using library routines which were hardcoding BGCOLOR. diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 6396db8..bf1e369 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -22,30 +22,47 @@ #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" 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("<TD>"); +} + +static void ourCellEnd() +{ +puts("</TD>"); +} + +static void ourPrintCell(char *str) +{ +ourCellStart(); +puts(str); +ourCellEnd(); +} + static void hgHubConnectUnlisted() /* Put up the list of unlisted hubs and other controls for the page. */ { // put out the top of our page printf("<div id=\"unlistedHubs\" class=\"hubList\"> " "<table id=\"unlistedHubsTable\"> " "<thead><tr> " "<th colspan=\"5\" id=\"addHubBar\"><label>URL:</label> " "<input name=\"hubText\" id=\"hubUrl\" class=\"hubField\"" "type=\"text\" size=\"65\"> " "<input name=\"hubAddButton\"" "onClick=\"document.addHubForm.elements['hubUrl'].value=hubText.value;" "document.addHubForm.submit();return true;\" " "class=\"hubField\" type=\"button\" value=\"Add Hub\">" "</th> " @@ -86,61 +103,62 @@ count = 0; for(hub = hubList; hub; hub = hub->next) { /* if the hub is public, then don't list it here */ if (!isHubUnlisted(hub)) continue; if (count) webPrintLinkTableNewRow(); // ends last row and starts a new one count++; // if there's an error message, we don't let people select it // these error messages are cleared by the hubDaemon if (isEmpty(hub->errorMessage)) { - webPrintLinkCellStart(); + ourCellStart(); char hubName[32]; safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, hub->id); cartMakeCheckBox(cart, hubName, FALSE); - webPrintLinkCellEnd(); + ourCellEnd(); } else - webPrintLinkCell("error"); - webPrintLinkCell(hub->shortLabel); + ourPrintCell("error"); + ourPrintCell(hub->shortLabel); if (isEmpty(hub->errorMessage)) - webPrintLinkCell(hub->longLabel); + ourPrintCell(hub->longLabel); else - webPrintLinkCell(hub->errorMessage); - webPrintLinkCell(hub->hubUrl); + ourPrintCell(hub->errorMessage); + ourPrintCell(hub->hubUrl); } printf("</TR></tbody></TABLE>\n"); cgiMakeButton("Submit", "Display Selected Hubs"); printf("</div>"); } static void makeGenomePrint() /* print out the name of the current database etc. */ { getDbAndGenome(cart, &database, &organism, oldVars); printf("<div id=\"assemblyInfo\"> \n"); printf("<B>genome:</B> %s <B>assembly:</B> %s ", organism, hFreezeDate(database)); printf("</div>\n"); } + void hgHubConnectPublic() /* Put up the list of public hubs and other controls for the page. */ { struct sqlConnection *conn = hConnectCentral(); char query[512]; safef(query, sizeof(query), "select hubUrl,shortLabel,longLabel,dbList from %s", hubPublicTableName); struct sqlResult *sr = sqlGetResult(conn, query); char **row; boolean gotAnyRows = FALSE; while ((row = sqlNextRow(sr)) != NULL) { char *url = row[0], *shortLabel = row[1], *longLabel = row[2], *dbList = row[3]; @@ -160,51 +178,51 @@ "<th>URL</th> " "</tr></thead>\n"); // start first row printf("<tbody> <tr>"); gotAnyRows = TRUE; } char *errorMessage = NULL; // get an id for this hub unsigned id = hubFindOrAddUrlInStatusTable(database, cart, url, &errorMessage); if ((id != 0) && isEmpty(errorMessage)) { - webPrintLinkCellStart(); + ourCellStart(); char hubName[32]; safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, id); cartMakeCheckBox(cart, hubName, FALSE); - webPrintLinkCellEnd(); + ourCellEnd(); } else if (!isEmpty(errorMessage)) - webPrintLinkCell("error"); + ourPrintCell("error"); else errAbort("cannot get id for hub with url %s\n", url); - webPrintLinkCell(shortLabel); + ourPrintCell(shortLabel); if (isEmpty(errorMessage)) - webPrintLinkCell(longLabel); + ourPrintCell(longLabel); else { char errorBuf[4*1024]; safef(errorBuf, sizeof errorBuf, "Error: %s", errorMessage); - webPrintLinkCell(errorBuf); + ourPrintCell(errorBuf); } - webPrintLinkCell(url); + ourPrintCell(url); } } sqlFreeResult(&sr); if (gotAnyRows) { printf("</TR></tbody></TABLE>\n"); cgiMakeButton("Submit", "Display Selected Hubs"); } else { printf("<div id=\"publicHubs\" class=\"hubList\"> \n"); printf("No Public Track Hubs for this genome assembly<BR>"); cgiMakeButton("Submit", "Return to Genome Browser"); }