Example usage for com.liferay.portal.kernel.util WebKeys PAGE_BODY_BOTTOM

List of usage examples for com.liferay.portal.kernel.util WebKeys PAGE_BODY_BOTTOM

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util WebKeys PAGE_BODY_BOTTOM.

Prototype

String PAGE_BODY_BOTTOM

To view the source code for com.liferay.portal.kernel.util WebKeys PAGE_BODY_BOTTOM.

Click Source Link

Usage

From source file:com.liferay.taglib.util.BodyBottomTag.java

License:Open Source License

public BodyBottomTag() {
    super(WebKeys.PAGE_BODY_BOTTOM);
}

From source file:com.slemarchand.pagecomposer.hook.events.ThemeParameterServicePreAction.java

License:Open Source License

private void switchThemeForRequest(String themeId, String colorSchemeId, ThemeDisplay themeDisplay)
        throws SystemException {

    HttpServletRequest request = themeDisplay.getRequest();

    boolean wapTheme = BrowserSnifferUtil.isWap(request);

    long companyId = themeDisplay.getCompanyId();

    Theme theme = ThemeLocalServiceUtil.getTheme(companyId, themeId, wapTheme);
    ColorScheme colorScheme = null;//  w  ww .  j a v  a2  s  .  co  m

    if (colorSchemeId != null) {
        colorScheme = ThemeLocalServiceUtil.getColorScheme(companyId, themeId, colorSchemeId, wapTheme);
    } else if (theme.hasColorSchemes()) {
        Iterator<ColorScheme> it = theme.getColorSchemes().iterator();
        do {
            colorScheme = it.next();
        } while (!colorScheme.isDefaultCs() && it.hasNext());
    }

    // Override current theme

    request.setAttribute(WebKeys.THEME, theme);
    request.setAttribute("COLOR_SCHEME", colorScheme); // Can't use constant located un portal-impl.jar

    themeDisplay.setLookAndFeel(theme, colorScheme);

    // Inject Javascript into page bottom

    String javascriptSrc = themeDisplay.getPortalURL() + _JAVASCRIPT_PATH + "?t="
            + _getJavascriptTimestamp(request);

    StringBundler sb = new StringBundler();

    sb.append("<script src=\"" + javascriptSrc + "\" type=\"text/javascript\"></script>");

    OutputData outputData = _getOutputData(request);

    String outputKey = this.getClass().getName();

    outputData.addData(outputKey, WebKeys.PAGE_BODY_BOTTOM, sb);
}