9661f8ba9e015aef34e09240d677ac7978ec0766
braney
  Wed May 18 12:33:41 2011 -0700
move hub connection stuff into hg/lib so hgTracks can add hubs on its own
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 2a53671..10e2537 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -5506,30 +5506,36 @@
 
 void resetVars()
 /* Reset vars except for position and database. */
 {
 static char *except[] = {"db", "position", NULL};
 char *cookieName = hUserCookie();
 int sessionId = cgiUsualInt(cartSessionVarName(), 0);
 char *hguidString = findCookieData(cookieName);
 int userId = (hguidString == NULL ? 0 : atoi(hguidString));
 struct cart *oldCart = cartNew(userId, sessionId, NULL, NULL);
 cartRemoveExcept(oldCart, except);
 cartCheckout(&oldCart);
 cgiVarExcludeExcept(except);
 }
 
+static void addDataHubs(struct cart *cart)
+{
+hubCheckForNew(database, cart);
+cartSetString(cart, hgHubConnectRemakeTrackHub, "on");
+}
+
 void doMiddle(struct cart *theCart)
 /* Print the body of an html file.   */
 {
 char *debugTmp = NULL;
 /* Uncomment this to see parameters for debugging. */
 /* struct dyString *state = NULL; */
 /* Initialize layout and database. */
 cart = theCart;
 
 /* #if 1 this to see parameters for debugging. */
 /* Be careful though, it breaks if custom track
  * is more than 4k */
 #if  0
 state = cgiUrlString();
 printf("State: %s\n", state->string);
@@ -5602,30 +5608,37 @@
         webIncludeResourceFile("ui.dropdownchecklist.css");
 #ifndef NEW_JQUERY
         jsIncludeFile("ui.core.js", NULL);
 #endif
         jsIncludeFile("ui.dropdownchecklist.js", NULL);
         }
     }
 jsIncludeFile("jquery-ui.js", NULL);
 
 //if (!trackImgOnly)
     {
 hPrintf("<div id='hgTrackUiDialog' style='display: none'></div>\n");
 // XXXX stole this and '.hidden' from bioInt.css - needs work
 hPrintf("<div id='warning' class='ui-state-error ui-corner-all hidden' style='font-size: 0.75em; display: none;' onclick='$(this).hide();'><p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: 0.3em;'></span><strong></strong><span id='warningText'></span> (click to hide)</p></div>\n");
     }
+
+/* check for new data hub */
+if (cartVarExists(cart, hgHubDataText))
+    {
+    addDataHubs(cart);
+    }
+
 if (cartVarExists(cart, "chromInfoPage"))
     {
     cartRemove(cart, "chromInfoPage");
     chromInfoPage();
     }
 else if (differentString(cartUsualString(cart, TRACK_SEARCH,"0"),"0"))
     {
     doSearchTracks(groupList);
     }
 else if (sameWord(configPageCall, "configure") ||
     sameWord(configPageCall, "configure tracks and display"))
     {
     cartRemove(cart, "hgTracksConfigPage");
     configPage();
     }
@@ -5673,24 +5686,15 @@
 else if (cartVarExists(cart, configShowEncodeGroups))
     {
     /* currently not used */
     cartRemove(cart, configShowEncodeGroups);
     struct grp *grp = NULL, *grps = hLoadGrps(database);
     for (grp = grps; grp != NULL; grp = grp->next)
         if (startsWith("encode", grp->name))
             collapseGroup(grp->name, FALSE);
     configPageSetTrackVis(-2);
     }
 else
     {
     tracksDisplay();
     }
 }
-
-void doDown(struct cart *cart)
-{
-printf("<H2>The Browser is Being Updated</H2>\n");
-printf("The browser is currently unavailable.  We are in the process of\n");
-printf("updating the database and the display software with a number of\n");
-printf("new tracks, including some gene predictions.  Please try again tomorrow.\n");
-}
-