a6177bc07e5dbb520e06cd0b341036efc2ecd3b3
angie
Tue Mar 6 14:23:29 2018 -0800
In hgFind, when adding a highlight via URL that the user clicks on, use a new cart variable addHighlight instead of appending to the current highlight string because that can get too long for a URL. refs #21056
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index c8c182a..8b9a6fa 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -9861,30 +9861,54 @@
hPrintf("
zoom out 10x | K | exon view | e then v |
\n");
hPrintf(" zoom out 100x | 0 | default view | d then v |
\n");
hPrintf(" zoom to ... | | view DNA | v then d |
\n");
hPrintf(" 50bp (1 zero) | 1 | Reset all User Settings | c then r |
\n");
hPrintf(" 500bp (2 zeros) | 2 | Tools - BLAT | t then b |
\n");
hPrintf(" 5000bp (3 zeros) | 3 | Tools - Table Browser | t then t |
\n");
hPrintf(" 50kbp (4 zeros) | 4 | Tools - PCR | t then i |
\n");
hPrintf(" 500kbp (5 zeros) | 5 | My Sessions | s then s |
\n");
hPrintf(" 5Mbp (6 zeros) | 6 | Public Sessions | p then s |
\n");
hPrintf("Highlight all (mark) | h then m | Clear all Highlights | h then c |
\n");
hPrintf("\n");
hPrintf("
");
hPrintf("\n");
}
+static void checkAddHighlight()
+/* If the cart variable addHighlight is set, merge it into the highlight variable. */
+{
+char *newHighlight = cartOptionalString(cart, "addHighlight");
+if (newHighlight)
+ {
+ char *existing = cartOptionalString(cart, "highlight");
+ if (isNotEmpty(existing))
+ {
+ // Add region only if it is not already in the existing highlight setting.
+ char *alreadyIn = strstr(existing, newHighlight);
+ int len = strlen(newHighlight);
+ if (! (alreadyIn && (alreadyIn[len] == '|' || alreadyIn[len] == '\0')))
+ {
+ struct dyString *dy = dyStringCreate("%s|%s", newHighlight, existing);
+ cartSetString(cart, "highlight", dy->string);
+ }
+ }
+ else
+ cartSetString(cart, "highlight", newHighlight);
+ cartRemove(cart, "addHighlight");
+ }
+}
+
void doMiddle(struct cart *theCart)
/* Print the body of an html file. */
{
cart = theCart;
measureTiming = hPrintStatus() && isNotEmpty(cartOptionalString(cart, "measureTiming"));
if (measureTiming)
measureTime("Startup");
hgBotDelayFrac(0.25); /* Impose a quarter of the standard CGI penalty */
if (measureTiming)
measureTime("Bottleneck delay");
char *debugTmp = NULL;
/* Uncomment this to see parameters for debugging. */
/* struct dyString *state = NULL; */
@@ -9916,30 +9940,32 @@
udcSetCacheTimeout(timeout);
// tell UDC where to put its statistics file
char *udcLogFile;
if ((udcLogFile = cfgOption("udcLog")) != NULL)
{
FILE *fp = mustOpen(udcLogFile, "a");
udcSetLog(fp);
}
initTl();
char *configPageCall = cartCgiUsualString(cart, "hgTracksConfigPage", "notSet");
char *configMultiRegionPageCall = cartCgiUsualString(cart, "hgTracksConfigMultiRegionPage", "notSet");
+checkAddHighlight();
+
/* Do main display. */
if (cartUsualBoolean(cart, "hgt.trackImgOnly", FALSE))
{
trackImgOnly = TRUE;
ideogramToo = cartUsualBoolean(cart, "hgt.ideogramToo", FALSE);
hideControls = TRUE;
withNextItemArrows = FALSE;
withNextExonArrows = FALSE;
hgFindMatches = NULL; // XXXX necessary ???
}
jsonForClient = newJsonObject(newHash(8));
jsonObjectAdd(jsonForClient, "cgiVersion", newJsonString(CGI_VERSION));
boolean searching = differentString(cartUsualString(cart, TRACK_SEARCH,"0"), "0");