c3cfea15ba73bd1b365f50f31d37ed0f8bfe7239 larrym Thu Jul 5 10:54:40 2012 -0700 restore context specific help for some CGIs diff --git src/hg/lib/web.c src/hg/lib/web.c index 995b9ec..5b5da1b 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -1293,30 +1293,33 @@ return FALSE; } char *menuBar(struct cart *cart) // Return HTML for the menu bar (read from a configuration file); // we fixup internal CGI's to add hgsid's and include the appropriate js and css files. { char *docRoot = hDocumentRoot(); char *menuStr, buf[4096], uiVars[128]; FILE *fd; int len, offset, err; char *navBarFile = "inc/globalNavBar.inc"; struct stat statBuf; regex_t re; regmatch_t match[2]; +char *scriptName = cgiScriptName(); +char *contextSpecificHelp = NULL; +char *contextSpecificHelpLabel = NULL; safef(uiVars, sizeof(uiVars), "%s=%u", cartSessionVarName(), cartSessionId(cart)); if(docRoot == NULL) // tolerate missing docRoot (i.e. don't bother with menu when running from command line) return NULL; jsIncludeFile("jquery.js", NULL); jsIncludeFile("jquery.plugins.js", NULL); webIncludeResourceFile("nice_menu.css"); // Read in menu bar html safef(buf, sizeof(buf), "%s/%s", docRoot, navBarFile); fd = mustOpen(buf, "r"); fstat(fileno(fd), &statBuf); len = statBuf.st_size; @@ -1334,17 +1337,68 @@ for(offset = 0; offset < len && !regexec(&re, menuStr + offset, ArraySize(match), match, 0); offset += match[0].rm_eo) { 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) + { + if (endsWith(scriptName, "hgBlat")) + { + contextSpecificHelp = "../goldenPath/help/hgTracksHelp.html#BLATAlign"; + contextSpecificHelpLabel = "Help on Blat"; + } + else if (endsWith(scriptName, "hgHubConnect")) + { + contextSpecificHelp = "../goldenPath/help/hgTrackHubHelp.html"; + contextSpecificHelpLabel = "Help on Track Hubs"; + } + else if (endsWith(scriptName, "hgNear")) + { + contextSpecificHelp = "../goldenPath/help/hgNearHelp.html"; + contextSpecificHelpLabel = "Help on Gene Sorter"; + } + else if (endsWith(scriptName, "hgTables")) + { + contextSpecificHelp = "../goldenPath/help/hgTablesHelp.html"; + contextSpecificHelpLabel = "Help on Table Browser"; + } + else if (endsWith(scriptName, "hgGenome")) + { + contextSpecificHelp = "../goldenPath/help/hgGenomeHelp.html"; + contextSpecificHelpLabel = "Help on Genome Graphs"; + } + else if (endsWith(scriptName, "hgSession")) + { + contextSpecificHelp = "../goldenPath/help/hgSessionHelp.html"; + contextSpecificHelpLabel = "Help on Sessions"; + } + else if (endsWith(scriptName, "pbGateway")) + { + contextSpecificHelp = "../goldenPath/help/pbTracksHelpFiles/pbTracksHelp.shtml"; + contextSpecificHelpLabel = "Help on Proteome Browser"; + } + else if (endsWith(scriptName, "hgVisiGene")) + { + contextSpecificHelp = "../goldenPath/help/hgTracksHelp.html#VisiGeneHelp"; + contextSpecificHelpLabel = "Help on VisiGene"; + } + } +if(contextSpecificHelp) + { + char buf[1024]; + safef(buf, sizeof(buf), "
  • %s
  • ", contextSpecificHelp, contextSpecificHelpLabel); + menuStr = replaceChars(menuStr, "", buf); + fprintf(stderr, "contextSpecificHelp: %s\n", buf); + } return menuStr; }