a80b650af2368300e4fd69251ff9d47e83c235a3
tdreszer
Fri Dec 17 14:53:16 2010 -0800
New CFI 'hgFileUi' for composites with downloadable files
diff --git src/hg/hgFileUi/hgFileUi.c src/hg/hgFileUi/hgFileUi.c
new file mode 100644
index 0000000..c7e978a
--- /dev/null
+++ src/hg/hgFileUi/hgFileUi.c
@@ -0,0 +1,140 @@
+#include "common.h"
+#include "hash.h"
+#include "cheapcgi.h"
+#include "htmshell.h"
+#include "jsHelper.h"
+#include "trackDb.h"
+#include "hdb.h"
+#include "web.h"
+#include "mdb.h"
+#include "hCommon.h"
+#include "hui.h"
+#include "fileUi.h"
+
+#define MAIN_FORM "mainForm"
+#define WIGGLE_HELP_PAGE "../goldenPath/help/hgWiggleTrackHelp.html"
+
+struct hash *trackHash = NULL; /* Hash of all tracks in database. */
+
+void fileUi(struct cart *cart,struct trackDb *tdb, char *db, char *chrom, boolean ajax)
+// Downloadable Files UI
+{
+if (!ajax)
+ {
+ jsIncludeFile("jquery.js", NULL);
+ webIncludeResourceFile("jquery-ui.css");
+ jsIncludeFile("jquery-ui.js", NULL);
+ jsIncludeFile("utils.js",NULL);
+ }
+
+// QUESTION: Is this needed? Are we doing a submit on hgTrackUi to get here?? Probably not.
+//if(tdbIsContainer(tdb) && !ajax)
+// cartTdbTreeReshapeIfNeeded(cart,tdb);
+
+printf("%s\n", tdb->longLabel);
+
+// If Composite, link to the hgTrackUi. But if downloadsOnly then link to any superTrack.
+#define LINK_TO_PARENT "%s(%s)"
+if (tdbIsComposite(tdb))
+ {
+ char *encodedTrackName = cgiEncode(tdb->track);
+ printf(LINK_TO_PARENT," ", hgTrackUiName(), cartSessionVarName(), cartSessionId(cart), chrom, encodedTrackName,"Browser tracks");
+ freeMem(encodedTrackName);
+ }
+else if (tdb->parent) //Print link for parent track
+ {
+ char *encodedTrackName = cgiEncode(tdb->parent->track);
+ printf(LINK_TO_PARENT," ", hgTrackUiName(), cartSessionVarName(), cartSessionId(cart), chrom, encodedTrackName, tdb->parent->shortLabel);
+ freeMem(encodedTrackName);
+ }
+puts("
");
+
+filesDownloadUi(db,cart,tdb);
+
+// Print data version trackDB setting, if any */
+char *version = trackDbSetting(tdb, "dataVersion");
+if (version)
+ printf("
Data version: %s
\n", version);
+
+// Print lift information from trackDb, if any
+trackDbPrintOrigAssembly(tdb, db);
+
+if (tdb->html != NULL && tdb->html[0] != 0)
+ {
+ htmlHorizontalLine();
+ // include anchor for Description link
+ puts("");
+ printf("
"); + puts(tdb->html); + printf(" | "); + makeTopLink(tdb); + printf("  |
"); + makeTopLink(tdb); + printf("  |