c432455b9bdc07ca22b2093c49fe6dc40d12a42a hiram Fri Feb 25 11:21:13 2011 -0800 per Mark's advice, move html printout from hdb to hui diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 1848fb8..324104b 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -14,30 +14,32 @@ #include "hgConfig.h" #include "chainCart.h" #include "chainDb.h" #include "netCart.h" #include "obscure.h" #include "wiggle.h" #include "phyloTree.h" #include "hgMaf.h" #include "udc.h" #include "customTrack.h" #include "encode/encodePeak.h" #include "mdb.h" #include "web.h" #include "hPrint.h" #include "fileUi.h" +#include "bigBed.h" +#include "bigWig.h" static char const rcsid[] = "$Id: hui.c,v 1.297 2010/06/02 19:27:51 tdreszer Exp $"; #define SMALLBUF 128 #define MAX_SUBGROUP 9 #define ADD_BUTTON_LABEL "add" #define CLEAR_BUTTON_LABEL "clear" #define JBUFSIZE 2048 //#define PM_BUTTON "<A NAME=\"%s\"></A><A HREF=\"#%s\"><IMG height=18 width=18 onclick=\"return (setCheckBoxesThatContain('%s',%s,true,'%s','','%s') == false);\" id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\"></A>\n" //#define DEF_BUTTON "<A NAME=\"%s\"></A><A HREF=\"#%s\"><IMG onclick=\"setCheckBoxesThatContain('%s',true,false,'%s','','%s'); return (setCheckBoxesThatContain('%s',false,false,'%s','_defOff','%s') == false);\" id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\"></A>\n" //#define DEFAULT_BUTTON(nameOrId,anc,beg,contains) printf(DEF_BUTTON,(anc),(anc),(nameOrId), (beg),(contains),(nameOrId),(beg),(contains),(anc),"defaults_sm.png","default") //#define PLUS_BUTTON(nameOrId,anc,beg,contains) printf(PM_BUTTON, (anc),(anc),(nameOrId),"true", (beg),(contains),(anc),"add_sm.gif", "+") //#define MINUS_BUTTON(nameOrId,anc,beg,contains) printf(PM_BUTTON, (anc),(anc),(nameOrId),"false",(beg),(contains),(anc),"remove_sm.gif","-") #define PM_BUTTON "<IMG height=18 width=18 onclick=\"setCheckBoxesThatContain('%s',%s,true,'%s','','%s');\" id=\"btn_%s\" src=\"../images/%s\" alt=\"%s\">\n" @@ -7265,15 +7267,72 @@ else hPrintf("<a href='%s' TARGET=ucscHelp><img height='16' width='16' src='../images/%s'></a>\n",url,icon); } else hPrintf("<img height='16' width='16' src='%s'>\n",icon); freeMem(icon); return TRUE; } else if(trackDbSetting(tdb, "wgEncode") != NULL) { hPrintf("<a title='encode project' href='../ENCODE'><img height='16' width='16' src='../images/encodeThumbnail.jpg'></a>\n"); return TRUE; } return FALSE; } + +void printUpdateTime(char *database, struct trackDb *tdb, + struct customTrack *ct) +/* display table update time */ +{ +/* have not decided what to do for a composite container */ +if (tdbIsComposite(tdb)) + return; +struct sqlConnection *conn = NULL; +char *tableName = NULL; +if (isCustomTrack(tdb->track)) + { + if (ct) + { + conn = hAllocConn(CUSTOM_TRASH); + tableName = ct->dbTableName; + } + } +else if (startsWith("big", tdb->type)) + { + char *tableName = hTableForTrack(database, tdb->table); + struct sqlConnection *conn = hAllocConnTrack(database, tdb); + char *bbiFileName = bbiNameFromSettingOrTable(tdb, conn, tableName); + hFreeConn(&conn); + struct bbiFile *bbi = NULL; + if (startsWith("bigBed", tdb->type)) + bbi = bigBedFileOpen(bbiFileName); + if (startsWith("bigWig", tdb->type)) + bbi = bigWigFileOpen(bbiFileName); + time_t timep = 0; + if (bbi) + { + timep = bbiUpdateTime(bbi); + bbiFileClose(&bbi); + } + printBbiUpdateTime(&timep); + } +else + { + tableName = hTableForTrack(database, tdb->table); + conn = hAllocConnTrack(database, tdb); + } +if (tableName) + { + char *date = firstWordInLine(sqlTableUpdate(conn, tableName)); + if (date != NULL) + printf("<B>Data last updated: </B>%s<BR>\n", date); + } +hFreeConn(&conn); +} + +void printBbiUpdateTime(time_t *timep) +/* for bbi files, print out the timep value */ +{ + printf ("<B>Data last updated: </B>%s<BR>\n", + sqlUnixTimeToDate(timep, FALSE)); +}