47ea57080b515e5dad5f658c58feb8944a7e7d61 chmalee Thu Jan 29 15:30:26 2026 -0800 Replace clade/assembly dropdowns with a search bar on most CGIs. Add a recents list to hgGateway and to the species bar and to the 'Genomes' dropdown menu. Track recently selected species in localStorage. Add toGenome and fromGenome arguemnts to hubApi/liftOver in order to find appropriate liftover assemblies, refs #36232 diff --git src/hg/inc/web.h src/hg/inc/web.h index 139fa54a73e..0e8e29b58fe 100644 --- src/hg/inc/web.h +++ src/hg/inc/web.h @@ -1,395 +1,410 @@ /* web.c - some functions to output HTML code */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #ifndef WEB_H #define WEB_H #include "cart.h" #include "dbDb.h" void webSetStyle(char *style); /* set a style to add to the header */ void webStartText(); /* output the head for a text page */ void webStart(struct cart *theCart, char *db, char* format,...) /* output a CGI and HTML header with the given title in printf format */ #if defined(__GNUC__) __attribute__((format(printf, 3, 4))) #endif ; void webStartHeader(struct cart *theCart, char *db, char *header, char* format,...) /* output a CGI and HTML header with the given title in printf format */ #if defined(__GNUC__) __attribute__((format(printf, 4, 5))) #endif ; void webStartWrapper(struct cart *theCart, char *db, char *format, va_list args, boolean withHttpHeader, boolean withLogo); /* output a CGI and HTML header with the given title in printf format */ void webStartWrapperDetailedArgs(struct cart *theCart, char *db, char *headerText, char *format, va_list args, boolean withHttpHeader, boolean withLogo, boolean skipSectionHeader, boolean withHtmlHeader); /* output a CGI and HTML header with the given title in printf format with * quite a few options. See also next: */ void webStartWrapperDetailedNoArgs(struct cart *theCart, char *db, char *headerText, char *format, boolean withHttpHeader, boolean withLogo, boolean skipSectionHeader, boolean withHtmlHeader); /* output a CGI and HTML header with the given title in printf format with * quite a few options. Same as above without va_list args */ void webPragmasEtc(); /* Print out stuff that tells people not to cache us, and that we use the * usual character set and scripting langauge. (Normally done by webStartWrap) */ void webCirmPragmasEtc(); /* Print out stuff similar to webPragmasEtc (don't cache us, character set, etc.), but * use values appropriate for a more modern website (like CIRM). */ void webStartSectionTables(); /* Put up start of nepharious table layout stuff. (Normally done by webStartWrap). */ void webFirstSection(char *title); /* Put up the first section (normally done by webStartWrap). */ void webNewHiddenSection(char* format, ...) /* create a new hidden section on the web page */ #if defined(__GNUC__) __attribute__((format(printf, 1, 2))) #endif ; void webNewSection(char* format, ...) /* create a new section on the web page */ #if defined(__GNUC__) __attribute__((format(printf, 1, 2))) #endif ; void webNewEmptySection(); /* create a new section on the web page to maintain table layout */ void webNewSectionHeaderStart(); /* Start a new collapsible section on the web page, with +- control. Allows use of jsBeginCollapsibleSection() */ void webNewSectionHeaderEnd(); /* Properly close header of collapsible section on web page */ void webEnd(); /* output the footer of the HTML page */ void webEndExtra(char *footer); /* output the footer of the HTML page with extra endText as desired */ void webEndSection(); /* Close down a section */ void webEndSectionTables(); /* Finish with section tables (but don't do /BODY /HTML lik * webEnd does. */ void webStartGbNoBanner(struct cart *cart, char *db, char *title); /* Start HTML with new header and footer design by jWest, but no banner */ void webEndGb(); /* End HTML that was started with webStartJWest. */ void webStartJWest(struct cart *cart, char *db, char *title); /* Start HTML with new banner design by jWest (with modifications). */ void webEndJWest(); /* End HTML that was started with webStartJWest/ */ void webVaWarn(char *format, va_list args); /* Warning handler that closes off web page. */ boolean webGotWarnings(); /* Return TRUE if webVaWarn has been called. */ void webAbortNoHttpHeader(char* title, char* format, ...) /* an abort function that outputs a error page. No http header output. */ #if defined(__GNUC__) __attribute__((format(printf, 2, 3))) #endif ; void webAbort(char* title, char* format, ...) /* an abort function that outputs a error page */ #if defined(__GNUC__) __attribute__((format(printf, 2, 3))) #endif ; void printCladeListHtml(char *genome, char *event, char *javascript); /* Make an HTML select input listing the clades. */ void printGenomeListHtml(char *db, char *event, char *javascript); /* 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 event e.g. "change" * javascript - Optional (can be NULL) onEvent javascript. */ void printBlatGenomeListHtml(char *db, char *event, char *javascript); /* 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 event e.g. "change" * javascript - Optional (can be NULL) onEvent javascript. */ void printLiftOverGenomeList(char *customOrgCgiName, char *db, struct dbDb *dbList, char *event, char *javascript); /* Prints to stdout the HTML to render a dropdown list * containing a list of the possible genomes to choose from. * Databases in dbList do not have to exist. * param db - a database whose genome will be the default genome. * If NULL, no default selection. * param event e.g. "change" * javascript - Optional (can be NULL) onEvent javascript. */ void printSomeGenomeListHtmlNamed(char *customOrgCgiName, char *db, struct dbDb *dbList, char *event, char *javascript); /* 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 event e.g. "change" * javascript - Optional (can be NULL) onEvent javascript. */ void printSomeGenomeListHtml(char *db, struct dbDb *dbList, char *event, char *javascript); /* 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 event e.g. "change" * javascript - Optional (can be NULL) onEvent javascript. */ void printGenomeListForCladeHtml(char *db, char *event, char *javascript); /* Prints to stdout the HTML to render a dropdown list containing * a list of the possible genomes from selOrganism's clade to choose from. * selOrganism is the default for the select. */ void webPushErrHandlers(); /* Push warn and abort handler for errAbort(). */ void webPushErrHandlersCartDb(struct cart *cart, char *db); /* Push warn and abort handler for errAbort(); save cart and db for use in handlers. */ void webPopErrHandlers(); /* Pop warn and abort handler for errAbort(). */ void printAssemblyListHtml(char *db, char *event, char *javascript); /* 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. */ void printAssemblyListHtmlExtra(char *db, char *event, char *javascript); /* 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. param javascript - The javascript text for the select box */ void printSomeAssemblyListHtml(char *db, struct dbDb *dbList, char *event, char *javascript); /* Find all assemblies from the list that are active, and print * HTML to render dropdown list * param db - default assembly. If NULL, no default selection */ void printSomeAssemblyListHtmlNamed(char *name, char *db, struct dbDb *dbList, char *onChangeText); /* Find all assemblies from the list that are active, and print * HTML to render dropdown list * param db - default assembly. If NULL, no default selection */ void printAllAssemblyListHtmlParm(char *db, struct dbDb *dbList, char *dbCgi, bool allowInactive, char *event, char *javascript); /* Prints to stdout the HTML to render a dropdown list containing the list * 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 */ void printSomeAssemblyListHtmlParm(char *db, struct dbDb *dbList, char *dbCgi, char *event, char *javascript); /* Find all the assemblies from the list that are active. Prints to stdout the HTML to render a dropdown list containing the list of the possible assemblies to choose from. param db - The default assembly (the database name) to choose as selected. If NULL, no default selection. */ -void printOrgAssemblyListAxtInfo(char *dbCgi, char *javascript); -/* Find all the organisms/assemblies that are referenced in axtInfo, - * and print the dropdown list. */ - void printBlatAssemblyListHtml(char *curDb); /* Prints to stdout the HTML to render a dropdown list containing a list of the possible assemblies to choose from that have blat servers available. param curDb - The assembly (the database name) to choose as selected. If NULL, no default selection. */ +char *getCurrentGenomeLabel(char *db); +/* Construct a label from dbDb (or dbDb related for an assembly hub) for the currently + * selected genome */ + +void printGenomeSearchBar(char *id, char *placeholder, char *classStr, boolean withSearchButton, char *labelText, char *labelClassStr); +/* Prints an input text box that can be used to search for any genome. + * param withSearchButton - controls if there is a button next to the bar + * to manually fire the search + * param classStr - if desired, a custom class name or string can be used + * otherwise the default styling of 'genomeSearchBarDefault' is applied via HGStyle.css + * param labelText - If not empty, put up a