70d8c69d81dc54e30098322d24402f13daf5ecde galt Wed Jan 16 17:00:53 2013 -0800 added support for database-based GUI menu items in Mirror menu. also added support for hg.conf browser.geoSuffix for testing. got rid of unneeded javascript in globalNav.inc and put C code instead into geoMirror.c diff --git src/hg/lib/web.c src/hg/lib/web.c index 05afb3f..6961361 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -9,31 +9,31 @@ #include "hPrint.h" #include "hdb.h" #include "hui.h" #include "hgConfig.h" #include "cheapcgi.h" #include "dbDb.h" #include "hgColors.h" #include "hubConnect.h" #include "search.h" #ifndef GBROWSE #include "axtInfo.h" #include "wikiLink.h" #include "googleAnalytics.h" #include "jsHelper.h" #endif /* GBROWSE */ -#include "errabort.h" // FIXME tmp hack to try to find source of popWarnHandler underflows in browse +#include "errabort.h" // FIXME tmp hack to try to find source of popWarnHandler underflows in browser /* phoneHome business */ #include #include #include #include "geoMirror.h" #include /* phoneHome business */ /* flag that tell if the CGI header has already been outputed */ boolean webHeadAlreadyOutputed = FALSE; /* flag that tell if text CGI header hsa been outputed */ boolean webInTextMode = FALSE; static char *dbCgiName = "db"; static char *orgCgiName = "org"; @@ -211,41 +211,30 @@ puts("\"ENCODE"); } else { puts(""); } puts("" "\n" "" "\n" ); } /* Put up the hot links bar. */ char *menuStr = menuBar(theCart); if(menuStr) { - // NOTE: this jsInclude may be gratuitous (menuBar does it already). - jsIncludeFile("jquery.js", NULL); - if (geoMirrorEnabled()) - { - // notify client to provide Geo mirror functionality (e.g. in nav bar) - printf("\n", - sqlUnsigned(geoMirrorNode())); - /* TODO: consider dumping hgcentral.gbNode table here as well so UI - can share w/ browser GEO mirror redirect code - */ - } puts(menuStr); } 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); @@ -1371,30 +1360,40 @@ dyStringAppendN(dy, menuStr + offset, match[0].rm_eo); if(match[1].rm_so == match[1].rm_eo) dyStringAppend(dy, "?"); dyStringAppend(dy, uiVars); if(match[1].rm_so != match[1].rm_eo) dyStringAppend(dy, "&"); } if(offset < len) dyStringAppend(dy, menuStr + offset); freez(&menuStr); menuStr = dyStringCannibalize(&dy); if(!loginSystemEnabled()) stripRegEx(menuStr, "<\\!-- LOGIN_START -->.*<\\!-- LOGIN_END -->", REG_ICASE); if(scriptName) + { // Provide optional official mirror servers menu items + char *geoMenu = geoMirrorMenu(); + char *pattern = ""; + char *newMenuStr = replaceChars(menuStr, pattern, geoMenu); + freez(&menuStr); + menuStr = newMenuStr; + } + + +if(scriptName) { // Provide view menu for some CGIs. struct dyString *viewItems = dyStringCreate(""); boolean hasViewMenu = TRUE; if (endsWith(scriptName, "hgGenome")) { safef(buf, sizeof(buf), "../cgi-bin/hgGenome?%s&hgGenome_doPsOutput=1", uiVars); dyStringPrintf(viewItems, "
  • %s
  • \n", buf, "pdfLink", "PDF/PS"); } else { hasViewMenu = FALSE; } if (hasViewMenu) {