c4fe426d0936ce30c7fd65c63dd29a19abb830dc braney Sun Mar 15 15:22:12 2015 -0700 allow using different names for the following tables: dbDb, defaultDb, genomeClade, and clade. This will allow for testing of alternate versions of these tables on hgwdev. diff --git src/hg/lib/web.c src/hg/lib/web.c index 30de9e7..fd5a2fc 100644 --- src/hg/lib/web.c +++ src/hg/lib/web.c @@ -511,31 +511,33 @@ exit(0); } void printCladeListHtml(char *genome, char *onChangeText) /* Make an HTML select input listing the clades. */ { char **row = NULL; char *clades[128]; char *labels[128]; char *defaultClade = hClade(genome); char *defaultLabel = NULL; int numClades = 0; struct sqlConnection *conn = hConnectCentral(); // after hClade since it access hgcentral too // get only the clades that have actual active genomes -struct sqlResult *sr = sqlGetResult(conn, "NOSQLINJ SELECT DISTINCT(c.name), c.label FROM clade c, genomeClade g, dbDb d WHERE c.name=g.clade AND d.organism=g.genome AND d.active=1 ORDER BY c.priority"); +char query[4096]; +safef(query, sizeof query, "NOSQLINJ SELECT DISTINCT(c.name), c.label FROM %s c, %s g, %s d WHERE c.name=g.clade AND d.organism=g.genome AND d.active=1 ORDER BY c.priority", cladeTable(),genomeCladeTable(), dbDbTable()); +struct sqlResult *sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { clades[numClades] = cloneString(row[0]); labels[numClades] = cloneString(row[1]); if (sameWord(defaultClade, clades[numClades])) defaultLabel = clades[numClades]; numClades++; if (numClades >= ArraySize(clades)) internalErr(); } sqlFreeResult(&sr); hDisconnectCentral(&conn); struct slPair *names = trackHubGetCladeLabels(); @@ -555,31 +557,31 @@ } static void printSomeGenomeListHtmlNamedMaybeCheck(char *customOrgCgiName, char *db, struct dbDb *dbList, char *onChangeText, boolean doCheck) /* Prints to stdout the HTML to render a dropdown list * containing a list of the possible genomes to choose from. * param db - a database whose genome will be the default genome. * If NULL, no default selection. * param onChangeText - Optional (can be NULL) text to pass in * any onChange javascript. */ { char *orgList[1024]; int numGenomes = 0; struct dbDb *cur = NULL; struct hash *hash = hashNew(10); // 2^^10 entries = 1024 -char *selGenome = hGenomeOrArchive(db); +char *selGenome = hGenome(db); char *values [1024]; char *cgiName; for (cur = dbList; cur != NULL; cur = cur->next) { if (!hashFindVal(hash, cur->genome) && (!doCheck || hDbExists(cur->name))) { hashAdd(hash, cur->genome, cur); orgList[numGenomes] = trackHubSkipHubName(cur->genome); values[numGenomes] = cur->genome; numGenomes++; if (numGenomes >= ArraySize(orgList)) internalErr(); } @@ -661,31 +663,31 @@ * of assemblies for the current genome to choose from. By default, * this includes only active assemblies with a database (with the * exception of the default assembly, which will be included even * if it isn't active). * param db - The default assembly (the database name) to choose as selected. * If NULL, no default selection. * param allowInactive - if set, print all assemblies for this genome, * even if they're inactive or have no database */ { char *assemblyList[128]; char *values[128]; int numAssemblies = 0; struct dbDb *cur = NULL; -char *genome = hGenomeOrArchive(db); +char *genome = hGenome(db); char *selAssembly = NULL; if (genome == NULL) #ifdef LOWELAB genome = "Pyrococcus furiosus"; #else genome = "Human"; #endif for (cur = dbList; cur != NULL; cur = cur->next) { /* Only for this genome */ if (!sameWord(genome, cur->genome)) continue; /* Save a pointer to the current assembly */ @@ -753,66 +755,30 @@ } void printBlatAssemblyListHtml(char *db) { /* Find all the assemblies that pertain to the selected genome Prints to stdout the HTML to render a dropdown list containing a list of the possible assemblies to choose from. param curDb - The assembly (the database name) to choose as selected. If NULL, no default selection. */ struct dbDb *dbList = hGetBlatIndexedDatabases(); printSomeAssemblyListHtml(db, dbList, NULL); } -void printOrgAssemblyListAxtInfo(char *dbCgi, char *javascript) -/* Find all the organisms/assemblies that are referenced in axtInfo, - * and print the dropdown list. */ -{ -struct dbDb *dbList = hGetAxtInfoDbs(dbCgi); -char *assemblyList[128]; -char *values[128]; -int numAssemblies = 0; -struct dbDb *cur = NULL; -char *assembly = cgiOptionalString(dbCgi); -char orgAssembly[256]; - -for (cur = dbList; ((cur != NULL) && (numAssemblies < 128)); cur = cur->next) - { - safef(orgAssembly, sizeof(orgAssembly), "%s %s", - cur->organism, cur->description); - assemblyList[numAssemblies] = cloneString(orgAssembly); - values[numAssemblies] = cur->name; - numAssemblies++; - } - -#ifdef OLD -// Have to use the "menu" name, not the value, to mark selected: -if (assembly != NULL) - { - char *selOrg = hOrganism(assembly); - char *selFreeze = hFreezeFromDb(assembly); - safef(orgAssembly, sizeof(orgAssembly), "%s %s", selOrg, selFreeze); - assembly = cloneString(orgAssembly); - } -#endif /* OLD */ - -cgiMakeDropListFull(dbCgi, assemblyList, values, numAssemblies, assembly, - javascript); -} - static char *getDbForGenome(char *genome, struct cart *cart) /* Function to find the default database for the given Genome. It looks in the cart first and then, if that database's Genome matches the passed-in Genome, returns it. If the Genome does not match, it returns the default database that does match that Genome. param Genome - The Genome for which to find a database param cart - The cart to use to first search for a suitable database name return - The database matching this Genome type */ { char *retDb = cartUsualString(cart, dbCgiName, NULL);