c77032e9e31a35b2e84a118cda035c41689a8be7 Merge parents 20fd536 623f2d9 larrym Mon Jun 11 16:05:51 2012 -0700 resolve merge conflict with master diff --cc src/hg/lib/cart.c index 6e89d2d,a714116..d63d23d --- src/hg/lib/cart.c +++ src/hg/lib/cart.c @@@ -1503,69 -1509,73 +1509,68 @@@ #endif /* GBROWSE */ htmlEnd(); /* because it is in a higher library */ } void cartHtmlEnd() /* Write out HTML footer and get rid or error handler. */ { if (inWeb) webEnd(); /* this does googleAnalytics for a lot of CGIs */ else cartFooter(); popWarnHandler(); } void setThemeFromCart(struct cart *cart) - /* If 'theme' variable is set in cart: overwrite background with the one - * defined for this theme in hg.conf. Also set the "styleTheme", with additional - * styles that can overwrite the main style settings - * config syntax in hg.conf is: - * browser.theme.= - * or: - * browser.theme.=, - * */ - { - // get theme from cart and use it to get style/background file from config + /* If 'theme' variable is set in cart: overwrite background with the one from + * defined for this theme Also set the "styleTheme", with additional styles + * that can overwrite the main style settings */ + { + // Get theme from cart and use it to get background file from config; + // format is browser.theme.=[,] + + char **options; + int optionCount; char *cartTheme = cartOptionalString(cart, "theme"); -if (cartTheme==NULL) - return; -char *themeKey = catTwoStrings("browser.theme.", cartTheme); -char *themeDefLine = cfgOption(themeKey); -freez(&themeKey); -if (themeDefLine == NULL) - return; +// XXXX which setting should take precedence? Currently browser.theme does. -sqlStringDynamicArray(themeDefLine, &options, &optionCount); -if(options == NULL) - return; +char *styleFile = cfgOption("browser.style"); +if(styleFile != NULL) + { + char buf[512]; + safef(buf, sizeof(buf), "", styleFile); + char *copy = cloneString(buf); + htmlSetStyleTheme(copy); // for htmshell.c, used by hgTracks + webSetStyle(copy); // for web.c, used by hgc + } -char *styleFile = options[0]; -if(isNotEmpty(styleFile)) +if(isNotEmpty(cartTheme)) { - char * link = webTimeStampedLinkToResourceOnFirstCall(styleFile,TRUE); // resource file link wrapped in html - if (link) + char *themeKey = catTwoStrings("browser.theme.", cartTheme); + styleFile = cfgOption(themeKey); + freeMem(themeKey); + if (isEmpty(styleFile)) + return; + + char * link = webTimeStampedLinkToResourceOnFirstCall(styleFile, TRUE); // resource file link wrapped in html + if (link != NULL) { htmlSetStyleTheme(link); // for htmshell.c, used by hgTracks webSetStyle(link); // for web.c, used by hgc } } - -if(optionCount >= 2) - { - char *background = options[1]; - if(isNotEmpty(background)) - htmlSetBackground(cloneString(background)); - } - -freeMem(options[0]); -freez(&options); } void cartHtmlShellWithHead(char *head, char *title, void (*doMiddle)(struct cart *cart), char *cookieName, char **exclude, struct hash *oldVars) /* Load cart from cookie and session cgi variable. Write web-page * preamble including head and title, call doMiddle with cart, and write end of web-page. * Exclude may be NULL. If it exists it's a comma-separated list of * variables that you don't want to save in the cart between * invocations of the cgi-script. */ { struct cart *cart; char *db, *org, *pos, *clade=NULL; char titlePlus[128]; char extra[128]; pushWarnHandler(cartEarlyWarningHandler);