a4ed1e0d2c39286d95a53d98db4b0bdc51836260 Merge parents 7ab9bea 3c4e793 larrym Wed Jul 25 15:20:22 2012 -0700 resolve merge conflict with master diff --cc src/hg/lib/web.c index 0f5afc7,1939350..c4d617f --- src/hg/lib/web.c +++ src/hg/lib/web.c @@@ -173,71 -180,243 +173,71 @@@ for(ptr1=newString, ptr2=textOutBuf; *ptr2 ; ptr2++) { if (*ptr2 == '<') { for(; *ptr2 && (*ptr2 != '>'); ptr2++) ; } else *ptr1++ = *ptr2; } *ptr1 = 0; htmlTextOut(newString); printf(" </TITLE>\n "); if (endsWith(scriptName, "qaPushQ")) // Tired of failed stylesheet versioning that messes up RR releaseLog.html (regular and ENCODE) - printf(" <LINK rel='STYLESHEET' href='../style/HGStyle.css' TYPE='text/css' />\n"); + printf(" <LINK rel='STYLESHEET' href='../style/HGStyle.css' TYPE='text/css' />\n"); else webIncludeResourceFile("HGStyle.css"); if (extraStyle != NULL) puts(extraStyle); - printf("</HEAD>" "\n" - "<BODY BGCOLOR=\"#%s\" LINK=\"#0000CC\" VLINK=\"#330066\" ALINK=\"#6600FF\">", - hgColOutside()); + printf("</HEAD>\n"); + printBodyTag(stdout); htmlWarnBoxSetup(stdout);// Sets up a warning box which can be filled with errors as they occur puts(commonCssStyles()); } puts( "<A NAME=\"TOP\"></A>" "\n" "" "\n" "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=\"100%\">" "\n"); if (withLogo) { puts("<TR><TH COLSPAN=1 ALIGN=\"left\">"); if (isEncode) { puts("<A HREF=\"http://www.genome.gov/10005107\" TARGET=\"_BLANK\">" "<IMG SRC=\"../images/ENCODE_scaleup_logo.png\" height=50 ALT=\"ENCODE Project at NHGRI\">" "</A>"); puts("<IMG SRC=\"../images/encodeDcc.jpg\" ALT=\"ENCODE Project at UCSC\">"); } else { puts("<IMG SRC=\"../images/title.jpg\">"); } puts("</TH></TR>" "\n" - "" "\n" ); + "" "\n" ); } /* Put up the hot links bar. */ -#ifdef NEW_MENUS - - char *docRoot = hDocumentRoot(); - jsIncludeFile("jquery.js", NULL); - if(docRoot != NULL) - { - struct dyString *file = dyStringCreate("%s/%s", docRoot, "NavBar.html"); - FILE *fd = fopen(dyStringContents(file), "r"); - if(fd == NULL) - // fail some other way (e.g. HTTP 500)? - errAbort("Couldn't open header file '%s' for reading", dyStringContents(file)); - else - { - char buf[4096]; - while(TRUE) - { - size_t n = fread(buf, 1, sizeof(buf), fd); - if(n) - fwrite(buf, 1, n, stdout); - else - break; - } - fclose(fd); - printf("<base href='http://hgwdev-larrym.cse.ucsc.edu/'>\n"); - } - } - else - { - // tolerate missing docRoot (i.e. when running from command line) - // XXXX ???? - } - -#else - -if (isGisaid) - { - printf("<TABLE WIDTH='100%%' class='topBlueBar' BORDER='0' CELLSPACING='0' " - "CELLPADDING='2'><TR>\n"); - printf("<TD><A HREF='../index.html' class='topbar'>Home</A></TD>\n"); - if (haveBlat) - printf("<TD><A HREF='../cgi-bin/hgBlat?command=start' class='topbar'>Blat</A></TD>\n"); - printf("<TD><A HREF='../cgi-bin/gisaidSample' class='topbar'>Sample View</A></TD>\n"); - printf("<TD><A HREF='../cgi-bin/hgTracks%s' class='topbar'>Sequence View</A></TD>\n",uiState); - printf("<TD><A HREF='../cgi-bin/gisaidTable' class='topbar'>Table View</A></TD>\n"); - printf("<TD style='width:95%%'> </TD></TR></TABLE>\n"); - // last column squeezes other columns left - } -else if (isGsid) - { - printf("<TABLE class='topBlueBar' BORDER='0' CELLSPACING='0' CELLPADDING='2'><TR>\n"); - printf("<TD><A HREF='../index.html' class='topbar'>Home</A></TD>\n"); - if (haveBlat) - printf("<TD ALIGN=CENTER><A HREF='../cgi-bin/hgBlat?command=start' " - "class='topbar'>Blat</A></TD>\n"); - printf("<TD><A HREF='../cgi-bin/gsidSubj' class='topbar'>Subject View</A></TD>\n"); - printf("<TD><A HREF='../cgi-bin/hgTracks%s' class='topbar'>Sequence View</A></TD>\n",uiState); - printf("<TD><A HREF='../cgi-bin/gsidTable' class='topbar'>Table View</A></TD>\n"); - if (endsWith(scriptName, "hgBlat")) - printf("<TD><A HREF='/goldenPath/help/gsidTutorial.html#BLAT' TARGET=_blank " - "class='topbar'>Help</A></TD>\n"); - else - printf("<TD><A HREF='/goldenPath/help/sequenceViewHelp.html' TARGET=_blank " - "class='topbar'>Help</A></TD>\n"); - printf("<TD style='width:95%%'> </TD></TR></TABLE>\n"); - // last column squeezes other columns left - } -else if (dbIsFound) +char *menuStr = menuBar(theCart); +if(menuStr) { - puts("<!-- +++++++++++++++++++++ HOTLINKS BAR +++++++++++++++++++ -->\n" - "<TR><TD COLSPAN=3 HEIGHT=40>"); - puts("<TABLE class='topBlueBar' BORDER='0' CELLSPACING='0' CELLPADDING='2'><TR>"); - - if (isEncode) - printf("<TD><A HREF='../encode/' class='topbar'>Home</A></TD>\n"); - else - { - printf("<TD><A HREF='../index.html%s' class='topbar'>Home</A></TD>\n", uiState); - if (isGsid) - printf("<TD><A HREF='../cgi-bin/gsidSubj%s' class='topbar'>Subject View</A></TD>\n", - uiState); - else - printf("<TD><A HREF='../cgi-bin/hgGateway%s' class='topbar'>Genomes</A></TD>\n", - uiState); - - if (endsWith(scriptName, "hgTracks") || endsWith(scriptName, "hgGene") || - endsWith(scriptName, "hgTables") || endsWith(scriptName, "hgTrackUi") || - endsWith(scriptName, "hgSession") || endsWith(scriptName, "hgCustom") || - endsWith(scriptName, "hgHubConnect") || - endsWith(scriptName, "hgc") || endsWith(scriptName, "hgPal")) - printf("<TD><A HREF='../cgi-bin/hgTracks%s&hgTracksConfigPage=notSet&%s=0' " - "class='topbar'>Genome Browser</A></TD>\n",uiState,TRACK_SEARCH); - - if (haveBlat && !endsWith(scriptName, "hgBlat")) - printf("<TD><A HREF='../cgi-bin/hgBlat?command=start%s%s' " - "class='topbar'>Blat</A></TD>\n",theCart ? "&" : "", uiState+1 ); - } - - if (!isGsid && !hIsCgbServer()) // disable TB for both GSID and CGB servers - { - char *table = (theCart == NULL ? NULL : - (endsWith(scriptName, "hgGene") ? - cartOptionalString(theCart, "hgg_type") : - cartOptionalString(theCart, "g"))); - if (table && theCart && - (endsWith(scriptName, "hgc") || endsWith(scriptName, "hgTrackUi") || - endsWith(scriptName, "hgGene"))) - { - struct trackDb *tdb = hTrackDbForTrack(db, table); - if (tdb != NULL) - printf("<TD><A HREF='../cgi-bin/hgTables%s&hgta_doMainPage=1&hgta_group=%s" - "&hgta_track=%s&hgta_table=%s' class='topbar'>", - uiState, tdb->grp, tdb->track, tdb->table); - else - printf("<TD><A HREF='../cgi-bin/hgTables%s&hgta_doMainPage=1' class='topbar'>", - uiState); - trackDbFree(&tdb); - } - else - printf("<TD><A HREF='../cgi-bin/hgTables%s%shgta_doMainPage=1' class='topbar'>", - uiState, theCart ? "&" : "?" ); - printf("Tables</A></TD>\n"); - } - - if (!endsWith(scriptName, "hgNear") && db != NULL && hgNearOk(db)) - { - if (isGsid) - printf("<TD><A HREF='../cgi-bin/gsidTable%s' class='topbar'>Table View</A></TD>\n", - uiState); - else - printf("<TD><A HREF='../cgi-bin/hgNear%s' class='topbar'>Gene Sorter</A></TD>\n", - uiState); - } - if ((!endsWith(scriptName, "hgPcr")) && (db == NULL || hgPcrOk(db))) - printf("<TD><A HREF='../cgi-bin/hgPcr%s' class='topbar'>PCR</A></TD>\n",uiState); - if (endsWith(scriptName, "hgGenome")) - printf("<TD><A HREF='../cgi-bin/hgGenome%s&hgGenome_doPsOutput=on' class='topbar'>" - "PDF/PS</A></TD>\n",uiState); - if (endsWith(scriptName, "hgHeatmap")) - printf("<TD><A HREF='../cgi-bin/hgHeatmap%s&hgHeatmap_doPsOutput=on' class='topbar'>" - "PDF/PS</A></TD>\n",uiState); -#ifndef GBROWSE - if (wikiLinkEnabled() && !endsWith(scriptName, "hgSession")) - printf("<TD><A HREF='../cgi-bin/hgSession%s%shgS_doMainPage=1' class='topbar'>" - "Session</A></TD>\n",uiState, theCart ? "&" : "?" ); -#endif /* GBROWSE */ - if (!isGsid) - printf("<TD><A HREF='../FAQ/' class='topbar'>FAQ</A></TD>"); - if (!isGsid) - { - if (endsWith(scriptName, "hgBlat")) - printf("<TD><A HREF='../goldenPath/help/hgTracksHelp.html#BLATAlign'"); - else if (endsWith(scriptName, "hgHubConnect")) - printf("<TD><A HREF='../goldenPath/help/hgTrackHubHelp.html'"); - else if (endsWith(scriptName, "hgText")) - printf("<TD><A HREF='../goldenPath/help/hgTextHelp.html'"); - else if (endsWith(scriptName, "hgNear")) - printf("<TD><A HREF='../goldenPath/help/hgNearHelp.html'"); - else if (endsWith(scriptName, "hgTables")) - printf("<TD><A HREF='../goldenPath/help/hgTablesHelp.html'"); - else if (endsWith(scriptName, "hgGenome")) - printf("<TD><A HREF='../goldenPath/help/hgGenomeHelp.html'"); - else if (endsWith(scriptName, "hgSession")) - printf("<TD><A HREF='../goldenPath/help/hgSessionHelp.html'"); - else if (endsWith(scriptName, "pbGateway")) - printf("<TD><A HREF='../goldenPath/help/pbTracksHelpFiles/pbTracksHelp.shtml'"); - else if (endsWith(scriptName, "hgVisiGene")) - printf("<TD><A HREF='../goldenPath/help/hgTracksHelp.html#VisiGeneHelp'"); - else - printf("<TD><A HREF='../goldenPath/help/hgTracksHelp.html'"); - printf(" class='topbar'>Help</A></TD>\n"); - } + jsIncludeFile("jquery.js", NULL); + puts(menuStr); } - printf("<TD style='width:95%%'> </TD></TR></TABLE>\n"); - // last column squeezes other columns left - puts("</TD></TR>\n"); - -#endif if (endsWith(scriptName, "hgGateway") && geoMirrorEnabled()) { // Show an opt-out alert if user is on a host to which user has been automatically redirected (just once, right after they have been redirected) char *source = cgiOptionalString("source"); char *redirect = cgiOptionalString("redirect"); if (source != NULL && redirect != NULL && sameString(redirect, "auto")) { char *domain = cgiServerName(); char *port = cgiServerPort(); // We don't bother maintaining stuff in request URI, because it may contain items like hgsid and other host specific values int newUriSize = 2048; char *newUri = needMem(newUriSize); // TODO what about https? safef(newUri, newUriSize, "http://%s:%s/cgi-bin/hgGateway?redirect=manual&source=%s", source, port, domain);