Example usage for com.liferay.portal.kernel.theme ThemeDisplay getLayout

List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay getLayout

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.theme ThemeDisplay getLayout.

Prototype

public Layout getLayout() 

Source Link

Document

Returns the site's page.

Usage

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

License:Open Source License

@Override
public boolean isShow(HttpServletRequest request) throws PortalException {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = themeDisplay.getLayout();

    if (layout.isTypeControlPanel()) {
        return false;
    }/*w  w  w  . ja v a2 s  .com*/

    Group group = layout.getGroup();

    if (group.hasStagingGroup() && !group.isStagingGroup() && PropsValues.STAGING_LIVE_GROUP_LOCKING_ENABLED) {

        return false;
    }

    if (!(hasUpdateLayoutPermission(themeDisplay) || hasCustomizePermission(themeDisplay)
            || hasPortletConfigurationPermission(themeDisplay))) {

        return false;
    }

    return super.isShow(request);
}

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

License:Open Source License

protected boolean hasCustomizePermission(ThemeDisplay themeDisplay) throws PortalException {

    Layout layout = themeDisplay.getLayout();
    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if (!layout.isTypePortlet() || (layoutTypePortlet == null)) {
        return false;
    }/*from   w w w.j ava 2 s. c o m*/

    if (!layoutTypePortlet.isCustomizable() || !layoutTypePortlet.isCustomizedView()) {

        return false;
    }

    if (LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, ActionKeys.CUSTOMIZE)) {

        return true;
    }

    return false;
}

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

License:Open Source License

protected boolean hasPortletConfigurationPermission(ThemeDisplay themeDisplay) throws PortalException {

    return PortletPermissionUtil.hasConfigurationPermission(themeDisplay.getPermissionChecker(),
            themeDisplay.getSiteGroupId(), themeDisplay.getLayout(), ActionKeys.CONFIGURATION);
}

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

License:Open Source License

protected boolean hasUpdateLayoutPermission(ThemeDisplay themeDisplay) throws PortalException {

    return LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(),
            ActionKeys.UPDATE);//from  w  ww.  jav  a  2s  .  com
}

From source file:com.liferay.layout.admin.web.internal.portlet.action.ResetCustomizationViewMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

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

    if (!LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(),
            ActionKeys.CUSTOMIZE)) {/*from  w  w w  .  j  a v a2 s. com*/

        throw new PrincipalException();
    }

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if ((layoutTypePortlet != null) && layoutTypePortlet.isCustomizable()
            && layoutTypePortlet.isCustomizedView()) {

        layoutTypePortlet.resetUserPreferences();
    }

    MultiSessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + "requestProcessed");

    Layout layout = themeDisplay.getLayout();

    actionResponse.sendRedirect(layout.getRegularURL(_portal.getHttpServletRequest(actionRequest)));
}

From source file:com.liferay.layout.admin.web.internal.portlet.action.ResetPrototypeMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

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

    SitesUtil.resetPrototype(themeDisplay.getLayout());

    MultiSessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + "requestProcessed");
}

From source file:com.liferay.layout.admin.web.internal.portlet.action.ToggleCustomizedViewMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

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

    actionRequest.setAttribute(WebKeys.REDIRECT, _portal.getLayoutURL(themeDisplay.getLayout(), themeDisplay));
}

From source file:com.liferay.layout.admin.web.internal.product.navigation.control.menu.InformationMessagesProductNavigationControlMenuEntry.java

License:Open Source License

@Override
public boolean isShow(HttpServletRequest request) throws PortalException {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = themeDisplay.getLayout();

    if (layout.isTypeControlPanel()) {
        return false;
    }/*from  www  .ja v a 2s . c  o  m*/

    if (!isLinkedLayout(themeDisplay) && !isModifiedLayout(themeDisplay)) {
        return false;
    }

    return super.isShow(request);
}

From source file:com.liferay.layout.admin.web.internal.product.navigation.control.menu.InformationMessagesProductNavigationControlMenuEntry.java

License:Open Source License

protected boolean isLinkedLayout(ThemeDisplay themeDisplay) throws PortalException {

    Layout layout = themeDisplay.getLayout();

    Group group = layout.getGroup();

    if (!SitesUtil.isLayoutUpdateable(layout)
            || (layout.isLayoutPrototypeLinkActive() && !group.hasStagingGroup())) {

        if (!LayoutPermissionUtil.containsWithoutViewableGroup(themeDisplay.getPermissionChecker(), layout,
                false, ActionKeys.UPDATE)) {

            return false;
        }/*w  w w.  j a  v a 2  s.c o m*/

        return true;
    }

    return false;
}

From source file:com.liferay.layout.admin.web.internal.product.navigation.control.menu.InformationMessagesProductNavigationControlMenuEntry.java

License:Open Source License

protected boolean isModifiedLayout(ThemeDisplay themeDisplay) throws PortalException {

    Layout layout = themeDisplay.getLayout();

    LayoutSet layoutSet = layout.getLayoutSet();

    if (!layoutSet.isLayoutSetPrototypeLinkActive() || !SitesUtil.isLayoutModifiedSinceLastMerge(layout)) {

        return false;
    }//from ww  w .  j  ava 2s.  c o m

    if (!hasUpdateLayoutPermission(themeDisplay)) {
        return false;
    }

    return true;
}