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 10xK exon viewe then v \n"); hPrintf(" zoom out 100x0 default viewd then v \n"); hPrintf(" zoom to ... view DNAv then d\n"); hPrintf("  50bp (1 zero)1Reset all User Settingsc then r\n"); hPrintf("  500bp (2 zeros)2Tools - BLATt then b\n"); hPrintf("  5000bp (3 zeros)3Tools - Table Browsert then t\n"); hPrintf("  50kbp (4 zeros)4Tools - PCRt then i\n"); hPrintf("  500kbp (5 zeros)5My Sessionss then s\n"); hPrintf("  5Mbp (6 zeros)6Public Sessionsp then s\n"); hPrintf("Highlight all (mark)h then mClear all Highlightsh 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");