b0e2a9158cb1c7a90e60b8a79e2e27cbf6daa909 braney Wed Jul 27 13:36:48 2016 -0700 allow pennantIcons to have URLs to the image #17787 diff --git src/hg/lib/hui.c src/hg/lib/hui.c index 895664f..e0d50a7 100644 --- src/hg/lib/hui.c +++ src/hg/lib/hui.c @@ -8086,88 +8086,111 @@ } sqlFreeResult(&sr); webPrintLinkTableEnd(); printf("Total: %d\n", count); } boolean printPennantIconNote(struct trackDb *tdb) // Returns TRUE and prints out the "pennantIcon" and note when found. //This is used by hgTrackUi and hgc before printing out trackDb "html" { char * setting = trackDbSetting(tdb, "pennantIcon"); if (setting != NULL) { setting = cloneString(setting); char *icon = htmlEncodeText(nextWord(&setting),FALSE); + char buffer[4096]; + char *src = NULL; + + if (startsWith("http://", icon) || startsWith("ftp://", icon) || + startsWith("https://", icon)) + src = icon; + else + { + safef(buffer, sizeof buffer, "../images/%s", icon); + src = buffer; + } + char *url = NULL; if (setting != NULL) url = nextWord(&setting); char *hint = NULL; if (setting != NULL) hint = htmlEncodeText(stripEnclosingDoubleQuotes(setting),FALSE); if (!isEmpty(url)) { if (isEmpty(hint)) printf("
",url,icon);
+ "src='%s'>",url,src);
else
{
printf("
",hint,url,icon);
+ "src='%s'>",hint,url,src);
// Special case for liftOver from hg17 or hg18, but this should probably be generalized.
if (sameString(icon,"18.jpg") && startsWithWord("lifted",hint))
printf(" Note: these data have been converted via liftOver from the Mar. 2006 "
"(NCBI36/hg18) version of the track.");
else if (sameString(icon,"17.jpg") && startsWithWord("lifted",hint))
printf(" Note: these data have been converted via liftOver from the May 2004 "
"(NCBI35/hg17) version of the track.");
else
printf(" Note: %s.",hint);
printf("