58017171c4c59e5bfb783aebafeb7ec41bd3bae8 larrym Thu Dec 22 13:50:47 2011 -0800 add euronode redirect code (#3104); mostly written by galt with some minor changes by me. Has some debug stuff which will be taken out as I work on this. Currently only on in larrym's tree and on euronode machine diff --git src/hg/lib/web.c src/hg/lib/web.c index eff04c6..fd3cbb1 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -374,30 +374,80 @@ 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"); } } printf("<TD style='width:95%%'> </TD></TR></TABLE>\n"); // last column squeezes other columns left puts("</TD></TR>\n"); #endif +#ifdef SUPPORT_EURONODE + +if (endsWith(scriptName, "hgGateway")) // DEBUG + { + char *source = cgiOptionalString("source"); + if (source) + { + char *domain = cgiServerName(); + char *port = cgiServerPort(); + char *uri = cgiRequestUri(); + // /cgi-bin/test.cgi?x=15&y=youdog + int newUriSize = strlen(uri)+1024; + char *newUri = needMem(newUriSize); + // TODO what about https? + safef(newUri, newUriSize, "http://%s:%s%s", source, port, uri); + char *zTerm = rStringIn("&source=", newUri); + if (zTerm) + *zTerm = 0; + + //empty TD disappears + /* + printf("<TR><TD COLSPAN=3 id='redirectTd' onclick=\"javascript:document.getElementById('redirectTd').innerHTML='';\">" + "<center>" + "You've been redirected to your nearest mirror - %s<br>" + "<a href=\"%s\">Take me back to %s</a>" + "</center>" + "</TD></TR>\n" + , domain, newUri, source ); + "<h3 style=\"background-color: #2636d1; text-align: center; color:#E0F0F0; margin-top:0px;\">" + */ + + printf("<TR><TD COLSPAN=3 id='redirectTd' onclick=\"javascript:document.getElementById('redirectTd').innerHTML='';\">" + "<div style=\"margin: 10px 25%%; border-style:solid; border-width:thin; border-color:#97D897;\">" + "<h3 style=\"background-color: #97D897; text-align: left; margin-top:0px; margin-bottom:0px;\">" + "<img style=\"float:left; margin-top:4px; margin-left:3px; margin-right:4px;\" src=\"http://uswest.ensembl.org/i/info_blue_13.png\">" + "You've been redirected to your nearest mirror - %s" + "<img title=\"Hide hint panel\" alt=\"Hide hint panel\" style=\"float:right; margin-top:3px; margin-right:3px\" src=\"http://uswest.ensembl.org/i/close.gif\">" + "</h3> " + "<ul style=\"margin:5px;\">" + "<li>Take me back to <a href=\"%s\">%s</a>" + "</li>" + "</ul>" + "</div>" + "</TD></TR>\n" + , domain, newUri, source ); + } + } + +#endif + if(!skipSectionHeader) /* this HTML must be in calling code if skipSectionHeader is TRUE */ { puts( // TODO: Replace nested tables with CSS (difficulty is that tables are closed elsewhere) "<!-- +++++++++++++++++++++ CONTENT TABLES +++++++++++++++++++ -->" "\n" "<TR><TD COLSPAN=3>\n" " <!--outer table is for border purposes-->\n" " <TABLE WIDTH='100%' BGCOLOR='#" HG_COL_BORDER "' BORDER='0' CELLSPACING='0' CELLPADDING='1'><TR><TD>\n" " <TABLE BGCOLOR='#" HG_COL_INSIDE "' WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR><TD>\n" " <div class='subheadingBar'><div class='windowSize' id='sectTtl'>" ); htmlTextOut(textOutBuf); puts( " </div></div>\n"