2e892c47ff9a4682a4f9868e52706f6e46b5b47b
chmalee
Tue Sep 27 13:22:09 2022 -0700
Make urlLabel setting support variable substitutions to allow for custom labels, useful when '336104' is not in the url, refs #29954
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 215b36a..7fbfb2f 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -964,40 +964,42 @@
// replace the $$ and other wildchards with the url given in tdb
char *url = getUrlSetting(tdb, urlSetting);
//char* eUrl = constructUrl(tdb, url, itemName, encode);
if (url==NULL || isEmpty(url))
return;
char *eUrl = replaceInUrl(url, itemName, cart, database, seqName, winStart, winEnd, tdb->track,
encode, fields);
if (eUrl==NULL)
return;
/* create the url label setting for trackDb from the url
setting prefix */
safef(urlLabelSetting, sizeof(urlLabelSetting), "%sLabel", urlSetting);
char *linkLabel = trackDbSettingOrDefault(tdb, urlLabelSetting, "Outside Link:");
+char *eLinkLabel = replaceInUrl(linkLabel, itemName, cart, database, seqName, winStart, winEnd, tdb->track,
+ encode, fields);
// if we got no item name from hgTracks or the item name does not appear in the URL
// there is no need to show the item name at all
if (isEmpty(itemName) || !stringIn("$$", url))
{
- printf("%s
",eUrl, linkLabel);
+ printf("%s
",eUrl, eLinkLabel);
return;
}
-printf("%s ",linkLabel);
+printf("%s ",eLinkLabel);
printf("", eUrl);
if (sameWord(tdb->table, "npredGene"))
{
printf("%s (%s)
\n", itemName, "NCBI MapView");
}
else
{
char *label = itemName;
if (isNotEmpty(itemLabel) && differentString(itemName, itemLabel))
label = itemLabel;
printf("%s
\n", label);
}
//freeMem(&eUrl); small memory leak