eb8f9cd9e8dddf195e6d48f5d2bb27da27214326
larrym
  Tue May 29 15:59:03 2012 -0700
use hgFixed.trackVersion.version (if available) for 'Data Version' (#8032)
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 4dcccbf..4fcd6ca 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -224,30 +224,31 @@
 #include "pcrResult.h"
 #include "twoBit.h"
 #include "itemConf.h"
 #include "chromInfo.h"
 #include "gbWarn.h"
 #include "lsSnpPdbChimera.h"
 #include "mammalPsg.h"
 #include "net.h"
 #include "jsHelper.h"
 #include "virusClick.h"
 #include "gwasCatalog.h"
 #include "parClick.h"
 #include "mdb.h"
 #include "yaleGencodeAssoc.h"
 #include "itemDetailsHtml.h"
+#include "trackVersion.h"
 
 static char *rootDir = "hgcData";
 
 #define LINESIZE 70  /* size of lines in comp seq feature */
 
 struct cart *cart;	/* User's settings. */
 char *seqName;		/* Name of sequence we're working on. */
 int winStart, winEnd;   /* Bounds of sequence. */
 char *database;		/* Name of mySQL database. */
 char *organism;		/* Colloquial name of organism. */
 char *genome;		/* common name, e.g. Mouse, Human */
 char *scientificName;	/* Scientific name of organism. */
 
 struct hash *trackHash;	/* A hash of all tracks - trackDb valued */
 
@@ -2873,39 +2874,35 @@
 {
 char *trackName = getParentTrackName(tdb);
 struct trackDb *parentTdb = tdb;
 if (!sameString(trackName, tdb->track))
     parentTdb = hTrackDbForTrack(database, trackName);
 printf("<P><A HREF=\"../cgi-bin/hgTrackUi?g=%s&%s\">"
        "Go to %s track controls</A></P>\n",
        trackName, cartSidUrlString(cart), parentTdb->shortLabel);
 }
 
 static void printDataVersion(struct trackDb *tdb)
 /* If this annotation has a dataVersion trackDb setting, print it */
 {
 metadataForTable(database,tdb,NULL);
 const char *version = metadataFindValue(tdb,"dataVersion");
-if(version != NULL)
-    printf("<B>Data version:</B> %s <BR>\n", version);
-else
-    {
+if(version == NULL)
     version = trackDbSetting(tdb,"dataVersion");
     if (version != NULL)
         printf("<B>Data version:</B> %s <BR>\n", version);
     }
-}
 
 void printDataRestrictionDate(struct trackDb *tdb)
 /* If this annotation has a dateUnrestricted trackDb setting, print it */
 {
 char *restrictionDate = encodeRestrictionDateDisplay(database,tdb);
 if (restrictionDate != NULL)
     {
     printf("<A HREF=\"/ENCODE/terms.html\" TARGET=_BLANK><B>Restricted until</A>:</B> %s <BR>\n",
                 restrictionDate);
     freeMem(restrictionDate);
     }
 }
 
 static void printOrigAssembly(struct trackDb *tdb)
 /* If this annotation has been lifted, print the original
@@ -2922,31 +2919,35 @@
     if (tdb->html != NULL && tdb->html[0] != 0)
         return tdb->html;
     }
 return NULL;
 }
 
 void printTrackHtml(struct trackDb *tdb)
 /* If there's some html associated with track print it out. Also print
  * last update time for data table and make a link
  * to the TB table schema page for this table. */
 {
 if (!isCustomTrack(tdb->track))
     {
     extraUiLinks(database,tdb);
     printTrackUiLink(tdb);
+    struct trackVersion *trackVersion = getTrackVersion(database, tdb->track);
+    if(trackVersion == NULL)
     printDataVersion(tdb);
+    else
+        printf("<B>Data version:</B> %s <BR>\n", trackVersion->version);
     printOrigAssembly(tdb);
     printUpdateTime(database, tdb, NULL);
     printDataRestrictionDate(tdb);
     }
 char *html = getHtmlFromSelfOrParent(tdb);
 if (html != NULL && html[0] != 0)
     {
     htmlHorizontalLine();
 
     // Add pennantIcon
     printPennantIconNote(tdb);
 
     puts(html);
     }
 hPrintf("<BR>\n");