Example usage for com.liferay.portal.kernel.util SessionClicks get

List of usage examples for com.liferay.portal.kernel.util SessionClicks get

Introduction

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

Prototype

public static String get(HttpSession session, String key, String defaultValue) 

Source Link

Usage

From source file:com.liferay.application.list.taglib.servlet.taglib.PanelCategoryTag.java

License:Open Source License

protected boolean isActive(List<PanelApp> panelApps, PanelCategoryHelper panelCategoryHelper, Group group) {

    if (_showOpen) {
        return true;
    }//from w  w w  .j a  v a  2s  .co m

    if (isPersistState()) {
        String state = SessionClicks.get(request, PanelCategory.class.getName() + getId(), "closed");

        if (Objects.equals(state, "open")) {
            return true;
        }
    }

    if (panelApps.isEmpty()) {
        return false;
    }

    return _panelCategory.isActive(request, panelCategoryHelper, group);
}

From source file:com.liferay.layout.admin.web.internal.control.menu.ToggleControlsProductNavigationControlMenuEntry.java

License:Open Source License

@Override
public String getIcon(HttpServletRequest request) {
    String stateCss = null;//from  w  w  w. j  a  va  2s  . c om

    String toggleControls = GetterUtil
            .getString(SessionClicks.get(request, "com.liferay.frontend.js.web_toggleControls", "visible"));

    if (toggleControls.equals("visible")) {
        stateCss = "view";
    } else {
        stateCss = "hidden";
    }

    return stateCss;
}

From source file:com.liferay.layout.admin.web.internal.theme.contributor.ToggleControlsTemplateContextContributor.java

License:Open Source License

@Override
public void prepare(Map<String, Object> contextObjects, HttpServletRequest request) {

    String liferayToggleControls = SessionClicks.get(request, "com.liferay.frontend.js.web_toggleControls",
            "visible");

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = themeDisplay.getLayout();

    if (layout.isTypeControlPanel()) {
        liferayToggleControls = "visible";
    }/* w w w  . j  ava2 s .c  o  m*/

    String cssClass = GetterUtil.getString(contextObjects.get("bodyCssClass"));

    if (Objects.equals(liferayToggleControls, "visible")) {
        cssClass += " controls-visible";
    } else {
        cssClass += " controls-hidden";
    }

    contextObjects.put("bodyCssClass", cssClass);

    contextObjects.put("liferay_toggle_controls", liferayToggleControls);
    contextObjects.put("show_toggle_controls", themeDisplay.isSignedIn());

    if (themeDisplay.isSignedIn()) {
        ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language",
                themeDisplay.getLocale(), getClass());

        contextObjects.put("toggle_controls_text", LanguageUtil.get(resourceBundle, "toggle-controls"));

        contextObjects.put("toggle_controls_url", "javascript:;");
    }
}

From source file:com.liferay.layout.internal.util.LayoutsTreeImpl.java

License:Open Source License

private int _getLoadedLayoutsCount(HttpSession session, long groupId, boolean privateLayout, long layoutId,
        String treeId) throws Exception {

    StringBundler sb = new StringBundler(7);

    sb.append(treeId);/*from   ww  w .ja  va2s. co m*/
    sb.append(StringPool.COLON);
    sb.append(groupId);
    sb.append(StringPool.COLON);
    sb.append(privateLayout);
    sb.append(StringPool.COLON);
    sb.append("Pagination");

    String key = sb.toString();

    String paginationJSON = SessionClicks.get(session, key, JSONFactoryUtil.getNullJSON());

    JSONObject paginationJSONObject = JSONFactoryUtil.createJSONObject(paginationJSON);

    if (_log.isDebugEnabled()) {
        sb = new StringBundler(9);

        sb.append("_getLoadedLayoutsCount(key=");
        sb.append(key);
        sb.append(", layoutId=");
        sb.append(layoutId);
        sb.append(", paginationJSON=");
        sb.append(paginationJSON);
        sb.append(", paginationJSONObject");
        sb.append(paginationJSONObject);
        sb.append(StringPool.CLOSE_PARENTHESIS);

        _log.debug(sb.toString());
    }

    return paginationJSONObject.getInt(String.valueOf(layoutId), 0);
}

From source file:com.liferay.product.navigation.product.menu.theme.contributor.internal.ProductMenuTemplateContextContributor.java

License:Open Source License

@Override
public void prepare(Map<String, Object> contextObjects, HttpServletRequest request) {

    if (!isShowProductMenu(request)) {
        return;//from w w w. ja  va  2 s  .  co  m
    }

    String cssClass = GetterUtil.getString(contextObjects.get("bodyCssClass"));
    String productMenuState = SessionClicks.get(request,
            ProductNavigationProductMenuWebKeys.PRODUCT_NAVIGATION_PRODUCT_MENU_STATE, "closed");

    contextObjects.put("bodyCssClass", cssClass + StringPool.SPACE + productMenuState);

    contextObjects.put("liferay_product_menu_state", productMenuState);
}

From source file:com.liferay.product.navigation.product.menu.web.internal.product.navigation.control.menu.ProductMenuProductNavigationControlMenuEntry.java

License:Open Source License

@Override
public boolean includeIcon(HttpServletRequest request, HttpServletResponse response) throws IOException {

    Map<String, String> values = new HashMap<>();

    String portletNamespace = _portal
            .getPortletNamespace(ProductNavigationProductMenuPortletKeys.PRODUCT_NAVIGATION_PRODUCT_MENU);

    values.put("portletNamespace", portletNamespace);

    values.put("title", HtmlUtil.escape(LanguageUtil.get(request, "menu")));

    String productMenuState = SessionClicks.get(request,
            ProductNavigationProductMenuWebKeys.PRODUCT_NAVIGATION_PRODUCT_MENU_STATE, "closed");

    if (Objects.equals(productMenuState, "open")) {
        values.put("cssClass", "active");
        values.put("dataURL", StringPool.BLANK);
    } else {//from w w  w .  j a  v a  2  s.  c  o m
        values.put("cssClass", StringPool.BLANK);

        ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        PortletURL portletURL = PortletURLFactoryUtil.create(request,
                ProductNavigationProductMenuPortletKeys.PRODUCT_NAVIGATION_PRODUCT_MENU,
                RenderRequest.RENDER_PHASE);

        portletURL.setParameter("mvcPath", "/portlet/product_menu.jsp");
        portletURL.setParameter("selPpid", portletDisplay.getId());

        try {
            portletURL.setWindowState(LiferayWindowState.EXCLUSIVE);
        } catch (WindowStateException wse) {
            ReflectionUtil.throwException(wse);
        }

        values.put("dataURL", "data-url='" + portletURL.toString() + "'");
    }

    Writer writer = response.getWriter();

    writer.write(StringUtil.replace(_TMPL_CONTENT, "${", "}", values));

    return true;
}

From source file:com.liferay.product.navigation.product.menu.web.internal.product.navigation.control.menu.ProductMenuProductNavigationControlMenuEntry.java

License:Open Source License

private void _processBodyBottomContent(PageContext pageContext) {
    try {/*from ww  w .  j  av  a2 s  . c  o m*/
        JspWriter jspWriter = pageContext.getOut();

        jspWriter.write("<div class=\"");

        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

        String productMenuState = SessionClicks.get(request,
                ProductNavigationProductMenuWebKeys.PRODUCT_NAVIGATION_PRODUCT_MENU_STATE, "closed");

        jspWriter.write(productMenuState);

        jspWriter.write(" hidden-print lfr-product-menu-panel sidenav-fixed " + "sidenav-menu-slider\" id=\"");

        String portletNamespace = _portal
                .getPortletNamespace(ProductNavigationProductMenuPortletKeys.PRODUCT_NAVIGATION_PRODUCT_MENU);

        jspWriter.write(portletNamespace);

        jspWriter.write("sidenavSliderId\">");
        jspWriter.write("<div class=\"product-menu sidebar sidenav-menu\">");

        RuntimeTag runtimeTag = new RuntimeTag();

        runtimeTag.setPortletName(ProductNavigationProductMenuPortletKeys.PRODUCT_NAVIGATION_PRODUCT_MENU);

        runtimeTag.doTag(pageContext);

        jspWriter.write("</div></div>");
    } catch (Exception e) {
        ReflectionUtil.throwException(e);
    }
}

From source file:com.liferay.site.internal.application.list.LatentGroupProvider.java

License:Open Source License

@Override
public Group getGroup(HttpServletRequest request) {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Group group = themeDisplay.getScopeGroup();

    if (!group.isControlPanel()) {
        return group;
    }/*w  ww .j a va 2 s. c  om*/

    HttpServletRequest originalRequest = _portal.getOriginalServletRequest(request);

    long groupId = GetterUtil.getLong(SessionClicks.get(originalRequest.getSession(), _KEY_LATENT_GROUP, null));

    if (groupId > 0) {
        return _groupLocalService.fetchGroup(groupId);
    }

    return null;
}

From source file:com.liferay.site.util.RecentGroupManager.java

License:Open Source License

private String _getRecentGroupsValue(HttpServletRequest request) {
    return SessionClicks.get(request, _KEY_RECENT_GROUPS, null);
}