250c1436761a3b38e4fcc5007b70d07d647285ce angie Mon Sep 24 12:41:47 2012 -0700 Pauline found that hgTable's 'describe table schema' page was not showingthe track description for bigDataUrl track types. Hooked those up, and restricted a whitespace tweak to only descriptions that start with <H2> so plain text descriptions don't get squashed up against the section title. diff --git src/hg/hgTables/schema.c src/hg/hgTables/schema.c index cbf39b6..933f7b7 100644 --- src/hg/hgTables/schema.c +++ src/hg/hgTables/schema.c @@ -321,42 +321,52 @@ if (sameString(jf->field, dtf->field)) if (slNameInList(jf->dbList, dtf->database)) { retVal = jf->indexOf; gotRetVal = TRUE; break; } } if (gotRetVal) break; } slFreeList(&chain); return retVal; } -static void printTrackHtml(struct trackDb *tdb) +void printTrackHtml(struct trackDb *tdb) /* If trackDb has html for table, print it out in a new section. */ { if (tdb != NULL && isNotEmpty(tdb->html)) { webNewSection("%s (%s) Track Description", tdb->shortLabel, tdb->track); char *browserVersion; if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8') puts(tdb->html); else + { + // H2 (as in "<H2>Description</H2>") has a big top margin, which adds to + // the 10px start-of-web-section <tr> (except for IE < 8, above). + // Tim's trick for moving the text back up in this case, to look like more + // like details pages in which HR's bottom margin melts into H2's top margin: + char *s = skipLeadingSpaces(tdb->html); + if (startsWith("<H2>", s) || startsWith("<h2>", s)) printf("<span style='position:relative; top:-1.2em; margin-bottom:0em;'>%s\n</span>", tdb->html); + else + puts(tdb->html); + } } } static void showSchemaDb(char *db, struct trackDb *tdb, char *table) /* Show schema to open html page. */ { struct trackDb *tdbForConn = tdb ? tdb : curTrack; struct sqlConnection *conn; if (tdbForConn == NULL) conn = hAllocConn(db); else conn = hAllocConnTrack(db, tdbForConn); struct joiner *joiner = allJoiner; struct joinerPair *jpList, *jp; @@ -429,37 +439,39 @@ } hPrintf("<BR>\n"); } } webNewSection("Sample Rows"); printSampleRows(10, conn, splitTable); printTrackHtml(tdb); hFreeConn(&conn); } static void showSchemaCtWiggle(char *table, struct customTrack *ct) /* Show schema on wiggle format custom track. */ { hPrintf("<B>Wiggle Custom Track ID:</B> %s<BR>\n", table); hPrintf("Wiggle custom tracks are stored in a dense binary format."); +printTrackHtml(ct->tdb); } static void showSchemaCtChromGraph(char *table, struct customTrack *ct) /* Show schema on wiggle format custom track. */ { hPrintf("<B>ChromGraph Custom Track ID:</B> %s<BR>\n", table); hPrintf("ChromGraph custom tracks are stored in a dense binary format."); +printTrackHtml(ct->tdb); } static void showSchemaCtMaf(char *table, struct customTrack *ct) /* Show schema on maf format custom track. */ { hPrintf("<B>MAF Custom Track ID:</B> %s<BR>\n", table); hPrintf("For formatting information see: "); hPrintf("<A HREF=\"../FAQ/FAQformat.html#format5\">MAF</A> "); hPrintf("format."); struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH); webNewSection("Sample Rows"); printSampleRows(10, conn, ct->dbTableName); printTrackHtml(ct->tdb); hFreeConn(&conn); @@ -595,53 +607,56 @@ showSchemaWithAsObj(db, table, ct, asObj); asObjectFree(&asObj); } else errAbort("Unrecognized customTrack type %s", type); } static void showSchemaHub(char *db, char *table) /* Show schema on a hub track. */ { struct trackDb *tdb = hashMustFindVal(fullTableToTdbHash, table); char *type = cloneFirstWord(tdb->type); hPrintf("Binary file of type %s stored at %s<BR>\n", type, trackDbSetting(tdb, "bigDataUrl")); if (sameString(type, "bigBed")) - showSchemaBigBed(table); + showSchemaBigBed(table, tdb); else if (sameString(type, "bam")) - showSchemaBam(table); + showSchemaBam(table, tdb); else if (sameString(type, "vcfTabix")) - showSchemaVcf(table); + showSchemaVcf(table, tdb); +else + printTrackHtml(tdb); } static void showSchemaWiki(struct trackDb *tdb, char *table) /* Show schema for the wikiTrack. */ { hPrintf("<B>User annotations to UCSC genes or genome regions</B><BR>\n"); showSchemaDb(wikiDbName(), tdb, table); +printTrackHtml(tdb); } static void showSchema(char *db, struct trackDb *tdb, char *table) /* Show schema to open html page. */ { if (isBigBed(database, table, curTrack, ctLookupName)) - showSchemaBigBed(table); + showSchemaBigBed(table, tdb); else if (isBamTable(table)) - showSchemaBam(table); + showSchemaBam(table, tdb); else if (isVcfTable(table)) - showSchemaVcf(table); + showSchemaVcf(table, tdb); else if (isCustomTrack(table)) showSchemaCt(db, table); else if (isHubTrack(table)) showSchemaHub(db, table); else if (sameWord(table, WIKI_TRACK_TABLE)) showSchemaWiki(tdb, table); else showSchemaDb(db, tdb, table); } void doTableSchema(char *db, char *table, struct sqlConnection *conn) /* Show schema around table (which is not described by curTrack). */ { struct trackDb *tdb = NULL; char parseBuf[256];