1e764da505c90a8f0a99d8ce79d3b225f0d6eb55
braney
  Mon Jul 18 18:23:06 2011 -0700
fixes to problems in #4627
diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index 48c883f..47a83bf 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -70,41 +70,41 @@
     "</tr></thead> ");
 
 // 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><th>No Track Hubs for this genome assembly</th></tr>"
+	"<tr><td>No Track Hubs for this genome assembly</td></tr>"
 	"</td></table>");
     cgiMakeButton("Submit", "Return to Genome Browser");
     printf("</div>");
     return;
     }
 
 // time to output the big table.  First the header
 printf(
     "<tr> "
-	"<th>Active?</th> "
+	"<th>Display</th> "
 	"<th>Hub Name</th> "
 	"<th>Description</th> "
 	"<th>URL</th> "
 	"<th>Disconnect</th> "
     "</tr>\n");
 
 // start first row
 printf("<tbody><tr>");
 
 count = 0;
 for(hub = hubList; hub; hub = hub->next)
     {
     /* if the hub is public, then don't list it here */
     if (!isHubUnlisted(hub))
 	continue;
@@ -174,31 +174,31 @@
 boolean gotAnyRows = FALSE;
 while ((row = sqlNextRow(sr)) != NULL)
     {
     char *url = row[0], *shortLabel = row[1], *longLabel = row[2], 
     	  *dbList = row[3];
     if (nameInCommaList(database, dbList))
 	{
 	if (gotAnyRows)
 	    webPrintLinkTableNewRow();
 	else
 	    {
 	    /* output header */
 	    printf("<div id=\"publicHubs\" class=\"hubList\"> \n");
 	    printf("<table id=\"publicHubsTable\"> "
 		"<thead><tr> "
-		    "<th>Active?</th> "
+		    "<th>Display</th> "
 		    "<th>Hub Name</th> "
 		    "<th>Description</th> "
 		    "<th>URL</th> "
 		"</tr></thead>\n");
 
 	    // start first row
 	    printf("<tbody> <tr>");
 	    gotAnyRows = TRUE;
 	    }
 
 	char *errorMessage = NULL;
 	// get an id for this hub
 	unsigned id = hubFindOrAddUrlInStatusTable(database, cart, 
 	    url, &errorMessage);
 
@@ -298,59 +298,67 @@
 printf("<div id=\"hgHubConnectUI\"> <div id=\"description\"> \n");
 printf(
    "<P>Track data hubs are collections of tracks from outside of UCSC that "
    "can be imported into the Genome Browser.  To import a public hub check "
    "the box in the list below. "
    "After import the hub will show up as a group of tracks with its own blue "
    "bar and label underneath the main browser graphic, and in the "
    "configure page. </P>\n"
    );
 printf("</div>\n");
 
 // figure out and print out genome name
 makeGenomePrint();
 
 // check to see if we have any new hubs
-hubCheckForNew(database, cart);
+boolean gotNew = hubCheckForNew(database, cart);
 
 // 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("hubUrl", "");
 cgiMakeHiddenVar(hgHubDoDisconnect, "on");
 cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on");
 puts("</FORM>");
 
 // ... and now the main form
 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>");
 
+if (gotNew) // 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, 
     hgHubConnectRemakeTrackHub, NULL};
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 oldVars = hashNew(10);