97b899f21a0804a3f9e025fca3e1a785db9cb6fe
braney
  Wed Oct 19 17:18:31 2022 -0700
get the clade, org, and db dropdowns in hgTables to work with curated
hubs

diff --git src/hg/lib/hubConnect.c src/hg/lib/hubConnect.c
index 791af27..05ff98f 100644
--- src/hg/lib/hubConnect.c
+++ src/hg/lib/hubConnect.c
@@ -958,42 +958,60 @@
                 genome->name = cloneString(buffer);
     
                 // if our new database is an undecorated db, decorate it
                 if (*newDatabase && sameString(*newDatabase, name))
                     *newDatabase = cloneString(buffer);
                 }
 
             }
         }
     }
 
 hDisconnectCentral(&conn);
 return added;
 }
 
+
+boolean hubConnectIsCurated(char *db)
+/* Look in the dbDb table to see if this hub is curated. */
+{
+struct sqlConnection *conn = hConnectCentral();
+char query[4096];
+sqlSafef(query, sizeof query, "SELECT nibPath from %s where name = '%s' AND nibPath like '%s%%'",
+          dbDbTable(), db, hubCuratedPrefix);
+
+char *dir = sqlQuickString(conn, query);
+boolean ret = !isEmpty(dir);
+hDisconnectCentral(&conn);
+
+return ret;
+}
+
 char *dbOveride;  // communicate with the web front end if we load a hub to support db cgivar. */
 
 static int lookForCuratedHubs(struct cart *cart, char *db,  char *curatedHubPrefix)
 /* Check to see if db is a curated hub which will require the hub to be attached. 
  * The variable curatedHubPrefix has the release to use (alpha, beta, public, or a user name ) */
 {
 struct sqlConnection *conn = hConnectCentral();
 char query[4096];
 sqlSafef(query, sizeof query, "SELECT nibPath from %s where name = '%s' AND nibPath like '%s%%'",
           dbDbTable(), db, hubCuratedPrefix);
 
-char *dir = sqlQuickString(conn, query);
+char *dir = cloneString(sqlQuickString(conn, query));
+hDisconnectCentral(&conn);
+
 if (!isEmpty(dir))
     {
     char *path = &dir[sizeof hubCuratedPrefix - 1];
     char url[4096];
     safef(url, sizeof url, "%s/%s/hub.txt", path, curatedHubPrefix);
 
     struct hubConnectStatus *status = getAndSetHubStatus( cart, url, TRUE);
 
     if (status && isEmpty(status->errorMessage))
         {
         char buffer[4096];
         safef(buffer, sizeof buffer, "hub_%d_%s", status->id, db);
         dbOveride = cloneString(buffer);
 
         return status->id;