091248e1bd8c94faa0d5a732a9949616c1a7e50d galt Wed Jul 27 11:34:51 2016 -0700 Wanted to make sure important information about hgc and substitutable url settings for item coordinates was not lost. diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 895664f..ff31a2b 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -8466,31 +8466,32 @@ { fflush(stdout); if (out[i]==NULL) continue; d = dyStringSub(s->string, in[i], out[i]); dyStringFree(&s); s = d; d = NULL; } return s; } char *replaceInUrl(char* url, char *idInUrl, struct cart* cart, char *db, char* seqName, int winStart, \ int winEnd, char *track, boolean encode) /* replace $$ in url with idInUrl. Supports many other wildchards - * XX Do we have readable docs for these parameters somewhere? */ + * XX Do we have readable docs for these parameters somewhere? + * Look at http://genome.ucsc.edu/goldenpath/help/trackDb/trackDbHub.html */ { struct dyString *uUrl = NULL; struct dyString *eUrl = NULL; char startString[64], endString[64]; char begItem[64], endItem[64]; char *ins[13], *outs[13]; char *eItem = (encode ? cgiEncode(idInUrl) : cloneString(idInUrl)); char *scName = NULL; // try to avoid the mysql query it not necessary if (stringIn("$n", url)) { char *tmp = hScientificName(db); scName = replaceChars(tmp, " ", "_"); freeMem(tmp); @@ -8535,30 +8536,36 @@ if (nextColon) /* terminate suffixClone suffix */ *nextColon = '\0'; /* when next colon is present */ *suffix = '\0'; /* terminate itemClone prefix */ outs[7] = itemClone; outs[8] = suffixClone; /* small memory leak here for these cloned strings */ /* not important for a one-time operation in a CGI that will exit */ } else { outs[7] = idInUrl; /* otherwise, these are not expected */ outs[8] = idInUrl; /* to be used */ } // URL may now contain item boundaries ins[9] = "${"; ins[10] = "$}"; +// This code is using l and r which are the coordinates of the window, +// so it does not work right for hgc item boundaries at this time. +// For hgc, it should use cart vars o and t. +// For hgGene (in future?) it should use hgg_start and hgg_end. +// For hgTracks, I do not know if it needs this feature or which cart vars it should use. +// Can somebody (maybe Max) review and fix this? if (cartOptionalString(cart, "l") && cartOptionalString(cart, "r")) { int itemBeg = cartIntExp(cart, "l"); // Should strip any unexpected commas int itemEnd = cartIntExp(cart, "r"); safef(begItem, sizeof begItem, "%d", itemBeg); safef(endItem, sizeof endItem, "%d", itemEnd); outs[9] = begItem; outs[10] = endItem; } else // should never be but I am unwilling to bet the farm { outs[9] = startString; outs[10] = endString; }