482e17639372073c44c32d26707a69b8132b3ba4
braney
  Fri Aug 5 18:05:55 2011 -0700
changes related to #4842
diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index 6400602..839775c 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -72,31 +72,30 @@
 // count up the number of unlisted hubs we currently have
 int count = 0;
 struct hubConnectStatus *hub, *hubList =  hubConnectStatusListFromCartAll(cart);
 for(hub = hubList; hub; hub = hub->next)
     {
     if (isHubUnlisted(hub))
 	count++;
     }
 
 if (count == 0)
     {
     // nothing to see here
     printf(
 	"<tr><td>No Track Hubs for this genome assembly</td></tr>"
 	"</td></table>");
-    cgiMakeButton("Submit", "Return to Genome Browser");
     printf("</thead></div>");
     return;
     }
 
 // time to output the big table.  First the header
 printf(
     "<tr> "
 	"<th>Display</th> "
 	"<th>Hub Name</th> "
 	"<th>Description</th> "
 	"<th>URL</th> "
 	"<th>Disconnect</th> "
     "</tr></thead>\n");
 
 // start first row
@@ -131,31 +130,30 @@
     else
 	ourPrintCell(hub->errorMessage);
     ourPrintCell(hub->hubUrl);
 
     ourCellStart();
     printf(
     "<input name=\"hubDisconnectButton\""
 	"onClick=\"document.disconnectHubForm.elements['hubId'].value='%d';"
 	    "document.disconnectHubForm.submit();return true;\" "
 	    "class=\"hubField\" type=\"button\" value=\"X\">"
 	    , hub->id);
     ourCellEnd();
     }
 
 printf("</TR></tbody></TABLE>\n");
-cgiMakeButton("Submit", "Display Selected Hubs");
 printf("</div>");
 }
 
 static void makeGenomePrint()
 /* print out the name of the current database etc. */
 {
 getDbAndGenome(cart, &database, &organism, oldVars);
 printf("<div id=\"assemblyInfo\"> \n");
 printf("<B>genome:</B> %s &nbsp;&nbsp;&nbsp;<B>assembly:</B> %s  ",
 	organism, hFreezeDate(database));
 printf("</div>\n");
 }
 
 
 void hgHubConnectPublic()
@@ -217,40 +215,37 @@
 	    ourPrintCell(longLabel);
 	else
 	    {
 	    char errorBuf[4*1024];
 	    safef(errorBuf, sizeof errorBuf, "Error: %s", errorMessage);
 	    ourPrintCell(errorBuf);
 	    }
 	ourPrintCell(url);
 	}
     }
 sqlFreeResult(&sr);
 
 if (gotAnyRows)
     {
     printf("</TR></tbody></TABLE>\n");
-    cgiMakeButton("Submit", "Display Selected Hubs");
     }
 else
     {
     printf("<div id=\"publicHubs\" class=\"hubList\"> \n");
     printf("No Public Track Hubs for this genome assembly<BR>");
-    cgiMakeButton("Submit", "Return to Genome Browser");
     }
 
-printf("<span class=\"small\">Contact <A HREF=\"mailto:genome@soe.ucsc.edu\">genome@soe.ucsc.edu</A> to add a public hub.</span>\n");
 printf("</div>");
 
 hDisconnectCentral(&conn);
 }
 
 static void doClearHub(struct cart *theCart)
 {
 char *url = cartOptionalString(cart, hgHubDataText);
 
 printf("<pre>clearing hub %s\n",url);
 if (url != NULL)
     hubClearStatus(url);
 else
     errAbort("must specify url in %s\n", hgHubDataText);
 printf("<pre>Completed\n");
@@ -322,56 +317,63 @@
 
 // here's a little form for the add new hub button
 printf("<FORM ACTION=\"%s\" NAME=\"addHubForm\">\n",  "../cgi-bin/hgHubConnect");
 cgiMakeHiddenVar("hubUrl", "");
 cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on");
 puts("</FORM>");
 
 // this the form for the disconnect hub button
 printf("<FORM ACTION=\"%s\" NAME=\"disconnectHubForm\">\n",  "../cgi-bin/hgHubConnect");
 cgiMakeHiddenVar("hubId", "");
 cgiMakeHiddenVar(hgHubDoDisconnect, "on");
 cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on");
 puts("</FORM>");
 
 // ... and now the main form
+if (cartVarExists(cart, hgHubConnectCgiDestUrl))
+    destUrl = cartOptionalString(cart, hgHubConnectCgiDestUrl);
 printf("<FORM ACTION=\"%s\" METHOD=\"POST\" NAME=\"mainForm\">\n", destUrl);
 cartSaveSession(cart);
 
 // we have two tabs for the public and unlisted hubs
 printf("<div id=\"tabs\">"
        "<ul> <li><a href=\"#publicHubs\">Public Hubs</a></li>"
        "<li><a href=\"#unlistedHubs\">My Hubs</a></li> "
        "</ul> ");
 
 hgHubConnectPublic();
 hgHubConnectUnlisted();
 printf("</div>");
 
+printf("<div class=\"tabFooter\">");
+cgiMakeButton("Submit", "Load Selected Hubs");
+printf("<span class=\"small\">Contact <A HREF=\"mailto:genome@soe.ucsc.edu\">genome@soe.ucsc.edu</A> to add a public hub.</span>\n");
+printf("</div>");
+
 if (gotNew || gotDisconnect) // make MyHubs the default tab
     {
     printf("<script type='text/javascript'>\n ");
     printf("var $tabs = $('#tabs').tabs();\n");
     printf(" $tabs.tabs('select',1);\n");
     printf("</script>\n");
     }
 
 cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on");
 
 printf("</div>\n");
 puts("</FORM>");
 cartWebEnd();
 }
 
 char *excludeVars[] = {"Submit", "submit", "hc_one_url", 
-    hgHubConnectCgiDestUrl,  hgHubDoClear, hgHubDoDisconnect, hgHubDataText, 
+    hgHubDoClear, hgHubDoDisconnect, hgHubDataText, 
     hgHubConnectRemakeTrackHub, NULL};
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 oldVars = hashNew(10);
 cgiSpoof(&argc, argv);
 cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
 return 0;
 }