8fdc86ea29f656cf7efee9954fdae6b573190fb3
tdreszer
Fri May 6 17:23:22 2011 -0700
Standardized replacement for
with cgiDown and worked out more spacing issues in hgFileUi and hgTrackUi.
diff --git src/hg/hgFileUi/hgFileUi.c src/hg/hgFileUi/hgFileUi.c
index 7a4f1fb..8ee1896 100644
--- src/hg/hgFileUi/hgFileUi.c
+++ src/hg/hgFileUi/hgFileUi.c
@@ -1,164 +1,169 @@
+
#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)\n"
if (tdbIsComposite(tdb))
{
char *encodedTrackName = cgiEncode(tdb->track);
printf(LINK_TO_PARENT," ", hgTrackUiName(), cartSessionVarName(), cartSessionId(cart), chrom, encodedTrackName,tdb->shortLabel,"Track settings");
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, tdb->parent->shortLabel);
freeMem(encodedTrackName);
}
// NAVLINKS - Link to Description down below
if (tdb->html != NULL && tdb->html[0] != 0)
{
printf("");
// First put up a button to go to File Search
printf("File Search ",db);
// Now link to description
char *downArrow = "⇓";
enum browserType browser = cgiBrowser();
if (browser == btIE || browser == btFF)
downArrow = "↓";
printf("Description%s",downArrow);
printf("");
}
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);
+ {
+ cgiDown(0.7);
+ printf("Data version: %s
\n", version);
+ }
// Print lift information from trackDb, if any
(void) trackDbPrintOrigAssembly(tdb, db);
if (tdb->html != NULL && tdb->html[0] != 0)
{
char *browserVersion;
if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8')
htmlHorizontalLine();
else // Move line down, since Description (in ->html) is proceded by too much space
printf("
");
printf("
");
puts(""); // include anchor for Description link
// Add pennantIcon
printPennantIconNote(tdb);
puts(tdb->html);
- printf(" | "); // positions top link below line
+ printf(" | ");
+ cgiDown(0.7); // positions top link below line
makeTopLink(tdb);
printf("  |
");
makeTopLink(tdb);
printf("  |
");
}
}
void doMiddle(struct cart *cart)
/* Write body of web page. */
{
struct trackDb *tdbList = NULL;
struct trackDb *tdb = NULL;
char *track;
char *ignored;
char *db = NULL;
track = cartString(cart, "g"); // QUESTION: Should this be 'f' ??
getDbAndGenome(cart, &db, &ignored, NULL);
char *chrom = cartUsualString(cart, "c", hDefaultChrom(db));
// QUESTION: Do We need track list ??? trackHash ??? Can't we just get one track and no children
// ANSWER: The way the code is set up now you will get the whole list. This is just to put all
// the logic for resolving loading parents and children in one place. We do occassionally pay the
// price of a 200 millisecond delay because of it though - JK.
trackHash = trackHashMakeWithComposites(db,chrom,&tdbList,FALSE);
tdb = tdbForTrack(db, track,&tdbList);
if (tdb == NULL)
{
errAbort("Can't find %s in track database %s", track, db);
return;
}
cartWebStart(cart, db, "%s %s", tdb->shortLabel, DOWNLOADS_ONLY_TITLE);
if (!tdbIsComposite(tdb) && !tdbIsDownloadsOnly(tdb))
{
warn("Track '%s' of type %s is not supported by hgFileUi.",track, tdb->type);
return;
}
// QUESTION: Do we need superTrack? If we have lnk to superTrack, then yes.
// ANSWER: No, you shouldn't need to do this here. The call that generated the
// tdbList already took care of this. -JK
#ifdef UNNEEDED
char *super = trackDbGetSupertrackName(tdb);
if (super)
{
if (tdb->parent) // configured as a supertrack member in trackDb
{
tdbMarkAsSuperTrack(tdb->parent);
trackDbSuperMemberSettings(tdb);
}
}
#endif /* UNNEEDED */
fileUi(cart, tdb, db, chrom, FALSE);
printf("
\n");
webEnd();
}
char *excludeVars[] = { "submit", "Submit", "g", NULL, "ajax", NULL,}; // HOW IS 'ajax" going to be supported?
int main(int argc, char *argv[])
/* Process command line. */
{
cgiSpoof(&argc, argv);
htmlSetBackground(hBackgroundImage());
cartEmptyShell(doMiddle, hUserCookie(), excludeVars, NULL);
return 0;
}