4a030195664cbdd1d3c1a4b81b1ed41dbf6d9bc5 angie Fri Feb 15 14:02:58 2019 -0800 Prevent hgFind lib (specifically genomePos -> hgPositionsHtml) from opening a web page; instead, pass up results and warning messages to the calling CGI so it can open the page its own way. refs #22945 hgTracks, hgTables and hgVai used to call findGenomePos{,Web} to resolve positions; hgTables and hgVai had to detect after the fact whether an HTML page had been started (with warnings and/or multiple results). In fact, hgPositionsHtml called webEnd which could cause conflicts with what the CGI was doing afterwards. Now, instead of findGenomePos{,Web} there is hgFindSearch which returns hgp and also warning messages, if any, via a dyString parameter. The calling CGI decides how to open the page if necessary (for hgTracks, it's already open) and displays warnings/multiple results -- or just proceeds as usual with the single position result. diff --git src/hg/inc/hgFind.h src/hg/inc/hgFind.h index dfea4dd..f932597 100644 --- src/hg/inc/hgFind.h +++ src/hg/inc/hgFind.h @@ -4,47 +4,41 @@ * See README in this or parent directory for licensing information. */ #ifndef HGFIND_H #define HGFIND_H #ifndef CART_H #include "cart.h" #endif #ifndef HGFINDSPEC_H #include "hgFindSpec.h" #endif struct hgPositions *hgPositionsFind(char *db, char *query, char *extraCgi, char *hgAppName, struct cart *cart, boolean multiTerm); -/* Return table of positions that match query or NULL if none such. */ - -struct hgPositions *findGenomePos(char *db, char *spec, char **retChromName, int *retWinStart, int *retWinEnd, struct cart *cart); -/* Search for positions in genome that match user query. - * Return an hgp if the query results in a unique position. - * Otherwise display list of positions, put # of positions in retWinStart, - * and return NULL. */ - -struct hgPositions *findGenomePosWeb(char *db, char *spec, char **retChromName, - int *retWinStart, int *retWinEnd, struct cart *cart, - boolean useWeb, char *hgAppName); -/* Search for positions in genome that match user query. - * Use the web library to print out HTML headers if necessary, and use - * hgAppName when forming URLs (instead of "hgTracks"). - * Return an hgp if the query results in a unique position. - * Otherwise display list of positions, put # of positions in retWinStart, - * and return NULL. */ +/* Return container of tracks and positions (if any) that match term. */ + +struct hgPositions *hgFindSearch(struct cart *cart, char **pPosition, + char **retChrom, int *retStart, int *retEnd, + char *hgAppName, struct dyString *dyWarn); +/* If *pPosition is a search term, then try to resolve it to genomic position(s). + * If unable to find a unique position then revert pPosition to lastPosition (or default position). + * Return a container of matching tables and positions. Warnings/errors are appended to dyWarn. */ + +void hgPositionsHtml(char *db, struct hgPositions *hgp, char *hgAppName, struct cart *cart); +/* Write multiple search results as HTML. */ struct hgPositions /* A bunch of positions in genome. */ { struct hgPositions *next; /* Next in list. */ char *query; /* Query string that led to positions. */ char *database; /* Name of database. Not allocated here. */ struct hgPosTable *tableList; /* List of tables. */ int posCount; /* Number of positions in all tables. */ struct hgPos *singlePos; /* If resolves to a single position, reference to that here. */ char *extraCgi; /* Extra info to embed in CGI requests to browser. */ boolean useAlias; /* Set if an alias is used */ };