c5191435ce373ab16a040f480a9439598b257515
galt
  Thu Oct 4 17:09:28 2012 -0700
fixing problem with mising PDF/PS link in hgGenome, fixes #9263
diff --git src/hg/lib/web.c src/hg/lib/web.c
index 743a501..75c5ca5 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -1362,30 +1362,50 @@
     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 view menu for some CGIs.
+    struct dyString *viewMenu = dyStringCreate("<li class='menuparent' id='view'><span>View</span>\n<ul style='display: none; visibility: hidden;'>\n");
+    boolean hasViewMenu = TRUE;
+    if (endsWith(scriptName, "hgGenome"))
+        {
+	safef(buf, sizeof(buf), "../cgi-bin/hgGenome?%s&hgGenome_doPsOutput=1", uiVars);
+    	dyStringPrintf(viewMenu, "<li><a href='%s' id='%s'>%s</a></li>\n", buf, "pdfLink", "PDF/PS");
+        }
+    else
+	{
+	hasViewMenu = FALSE;
+	}
+    dyStringAppend(viewMenu, "</ul>\n</li>\n");
+    if (hasViewMenu)
+    	menuStr = replaceChars(menuStr, "<!-- OPTIONAL_VIEW_MENU -->", dyStringCannibalize(&viewMenu));
+    }
+
+
+if(scriptName)
+    {
     // Provide context sensitive help links for some CGIs.
     char *link = NULL;
     char *label = NULL;
     if (endsWith(scriptName, "hgBlat"))
         {
         link = "../goldenPath/help/hgTracksHelp.html#BLATAlign";
         label = "Help on Blat";
         }
     else if (endsWith(scriptName, "hgHubConnect"))
         {
         link = "../goldenPath/help/hgTrackHubHelp.html";
         label = "Help on Track Hubs";
         }
     else if (endsWith(scriptName, "hgNear"))
         {