3b6c7089dbb23dadedfce9b9bf75279bb2d1e6e2
tdreszer
  Mon Dec 20 16:08:44 2010 -0800
Added standardized preamble for the files downloads page.
diff --git src/hg/lib/fileUi.c src/hg/lib/fileUi.c
index b6ccda2..1af7aa7 100644
--- src/hg/lib/fileUi.c
+++ src/hg/lib/fileUi.c
@@ -252,47 +252,59 @@
                 oneFile->sortFields[sortOrder->order[ix] - 1] = field;
                 oneFile->reverse[   sortOrder->order[ix] - 1] = (sortOrder->forward[ix] == FALSE);
                 }
             else
                 {
                 oneFile->sortFields[sortOrder->order[ix] - 1] = NULL;
                 oneFile->reverse[   sortOrder->order[ix] - 1] = FALSE;
                 }
             oneFile->sortFields[sortOrder->count] = NULL;
             }
         }
     slSort(fileList,fileDbSortCmp);
     }
 }
 
+static void filesDownloadsPreamble(char *db, struct trackDb *tdb)
+{
+puts("<p><B>Data is <A HREF='http://genome.ucsc.edu/ENCODE/terms.html'>RESTRICTED FROM USE</a>");
+puts("in publication  until the restriction date noted for the given data file.</B></p");
+puts("<p>\nThere are two files within this directory that contain information about the downloads:");
+printf("<BR>&#149;&nbsp;<A HREF='http://%s/goldenPath/%s/%s/%s/files.txt'>files.txt</A> which is a tab-separated file with the name and metadata for each download.</LI>\n",
+                hDownloadsServer(),db,ENCODE_DCC_DOWNLOADS, tdb->track);
+printf("<BR>&#149;&nbsp;<A HREF='http://%s/goldenPath/%s/%s/%s/md5sum.txt'>md5sum.txt</A> which is a list of the md5sum output for each download.</LI>\n",
+                hDownloadsServer(),db,ENCODE_DCC_DOWNLOADS, tdb->track);
+puts("<P>");
+}
+
 void filesDownloadUi(char *db, struct cart *cart, struct trackDb *tdb)
 // UI for a "composite like" track: This will list downloadable files associated with
 // a single trackDb entry (composite or of type "downloadsOnly". The list of files
 // will have links to their download and have metadata information associated.
 // The list will be a sortable table and there may be filtering controls.
 {
     // The basic idea:
     // 1) tdb of composite or type=downloadsOnly tableless track
     // 2) All mdb Objs associated with "composite=tdb->track" and having fileName
     // 3) Verification of each file in its discovered location
-    // 4) Lookup of filters (tdb dimensions?) and filterComposite style controls
-    // 5) Presort of files list
-    // 6) make table class=sortable
-    // 7) Final file count
-    // Get preamble from dir ??
-    // Use trackDb settings to get at html description, long and short labels
-    // Recommend different color background to get the point across that these are files, not tracks
+    // 4) Lookup of 'fileSortOrder'
+    // 5) TODO: present filter controls
+    // 6) Presort of files list
+    // 7) make table class=sortable
+    // 8) Final file count
+    // 9) Use trackDb settings to get at html description
+    // Nice to have: Make filtering and sorting persistent (saved to cart)
 
 // FIXME: Trick while developing:
 if (tdb->table != NULL)
     tdb->track = tdb->table;
 
 boolean debug = cartUsualBoolean(cart,"debug",FALSE);
 int ix;
 
 struct sqlConnection *conn = sqlConnect(db);
 char *mdbTable = mdbTableName(conn,TRUE); // Look for sandBox name first
 if(mdbTable == NULL)
     errAbort("TABLE NOT FOUND: '%s.%s'.\n",db,MDB_DEFAULT_NAME);
 
 struct fileDb *fileList = NULL, *oneFile = NULL;
 
@@ -384,30 +396,33 @@
     // cart contents
     //boolean filterAble = dimensionsExist(tdb);
     //membersForAll_t* membersForAll = membersForAllSubGroupsGet(tdb,cart);
 
 // Now update all files with their sortable fields and sort the list
 sortOrder_t *sortOrder = fileSortOrderGet(cart,tdb);
 if (sortOrder != NULL)
     {
     // Fill in and sort fileList
     fileDbSortList(&fileList,sortOrder);
     }
 
 jsIncludeFile("hui.js",NULL);
 jsIncludeFile("ajax.js",NULL);
 
+// standard preamble
+filesDownloadsPreamble(db,tdb);
+
 // Table class=sortable
 int columnCount = 0;
 int restrictedColumn = 0;
 printf("<TABLE class='sortable' style='border: 2px outset #006600;'>\n");
 printf("<THEAD class='sortable'>\n");
 printf("<TR class='sortable' valign='bottom'>\n");
 printf("<TD align='center' valign='center'>&nbsp;");
 int filesCount = slCount(fileList);
 if (filesCount > 5)
     printf("<i>%d files</i>",filesCount);    //puts("<FONT class='subCBcount'></font>"); // Use this style when filterboxes are up and running
 //if (sortOrder) // NOTE: This could be done to preserve sort order   FIXME: However hgFileUi would need form OR changes would need to be ajaxed over AND hgsid would be needed.
 //    printf("<INPUT TYPE=HIDDEN NAME='%s' class='sortOrder' VALUE=\"%s\">",sortOrder->htmlId, sortOrder->sortOrder);
 printf("</TD>\n");
 columnCount++;