304a53cda44a5731304b57ef46d4b6d228649f97
angie
  Tue Sep 25 11:56:02 2012 -0700
hgTables schema page was using hub (sub)trackDb's without ->html;refactored html-fetching code out of hubConnectAddHubForTrackAndFindTdb
and into new hubConnectAddDescription. Also fixed the code to work
for subtracks (instead of assigning tdb->html to parents, if tdb->html
is empty, recurse up parents until we find a non-empty ->html and assign
that to tdb).

diff --git src/hg/hgTables/schema.c src/hg/hgTables/schema.c
index 933f7b7..7fbbf72 100644
--- src/hg/hgTables/schema.c
+++ src/hg/hgTables/schema.c
@@ -603,64 +603,67 @@
     }
 else if (sameWord("pgSnp", type))
     {
     struct asObject *asObj = pgSnpAsObj();
     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);
+hubConnectAddDescription(db, tdb);
 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, tdb);
 else if (sameString(type, "bam"))
     showSchemaBam(table, tdb);
 else if (sameString(type, "vcfTabix"))
     showSchemaVcf(table, tdb);
 else
+    {
+    hPrintf("Binary file of type %s stored at %s<BR>\n",
+	    type, trackDbSetting(tdb, "bigDataUrl"));
     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))
+if (isHubTrack(table))
+    showSchemaHub(db, table);
+else if (isBigBed(database, table, curTrack, ctLookupName))
     showSchemaBigBed(table, tdb);
 else if (isBamTable(table))
     showSchemaBam(table, tdb);
 else if (isVcfTable(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];
 dbOverrideFromTable(parseBuf, &db, &table);
 htmlOpen("Schema for %s", table);
 tdb = hTrackDbForTrack(database, table);
 showSchema(db, tdb, table);