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/hgTracks/extTools.c src/hg/hgTracks/extTools.c
index 99cb7c5..f28eb44 100644
--- src/hg/hgTracks/extTools.c
+++ src/hg/hgTracks/extTools.c
@@ -190,31 +190,32 @@
generateCspMetaHeader(stdout);
printf("</head>\n<body>\n");
if (debug)
printf("Target URL: %s<p>", et->url);
char *chromName;
int winStart, winEnd;
char *db = cartString(cart, "db");
char *pos = cartString(cart, "position");
// Try to deal with virt chrom position used by hgTracks.
if (startsWith("virt:", cartUsualString(cart, "position", "")))
pos = cartString(cart, "nonVirtPosition");
-findGenomePos(db, pos, &chromName, &winStart, &winEnd, cart);
+if (!parsePosition(pos, &chromName, (uint *)&winStart, (uint *)&winEnd))
+ errAbort("Can't parse position '%s'", pos);
int len = winEnd-winStart;
char start1[255];
safef(start1, sizeof(start1), "%d", winStart+1);
char *url = replaceInUrl(et->url, "", cart, db, chromName, winStart, winEnd, NULL, TRUE, NULL);
char *method = "POST";
if (et->isHttpGet)
method = "GET";
printf("<form id=\"redirForm\" method=\"%s\" action=\"%s\">\n", method, url);
struct slPair *slp;