Example usage for com.liferay.portal.kernel.security.permission ActionKeys MANAGE_LAYOUTS

List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys MANAGE_LAYOUTS

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission ActionKeys MANAGE_LAYOUTS.

Prototype

String MANAGE_LAYOUTS

To view the source code for com.liferay.portal.kernel.security.permission ActionKeys MANAGE_LAYOUTS.

Click Source Link

Usage

From source file:com.liferay.layout.admin.web.internal.portlet.configuration.icon.EditPrivatePagesPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    LiferayPortletRequest liferayPortletRequest = _portal.getLiferayPortletRequest(portletRequest);

    LayoutsAdminDisplayContext layoutsAdminDisplayContext = new LayoutsAdminDisplayContext(
            liferayPortletRequest, null);

    if (layoutsAdminDisplayContext.isPageTemplates() || layoutsAdminDisplayContext.isPublicPages()) {

        return false;
    }/*from  www. ja  v a  2  s.c o  m*/

    try {
        return GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(),
                layoutsAdminDisplayContext.getSelGroupId(), ActionKeys.MANAGE_LAYOUTS);
    } catch (Exception e) {
    }

    return false;
}

From source file:com.liferay.layout.admin.web.internal.portlet.configuration.icon.EditPublicPagesPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    LiferayPortletRequest liferayPortletRequest = _portal.getLiferayPortletRequest(portletRequest);

    LayoutsAdminDisplayContext layoutsAdminDisplayContext = new LayoutsAdminDisplayContext(
            liferayPortletRequest, null);

    if (layoutsAdminDisplayContext.isPageTemplates() || layoutsAdminDisplayContext.isPrivatePages()
            || !layoutsAdminDisplayContext.isShowPublicPages()) {

        return false;
    }/*from   w  w  w. j av  a 2s  . com*/

    try {
        return GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(),
                layoutsAdminDisplayContext.getSelGroupId(), ActionKeys.MANAGE_LAYOUTS);
    } catch (Exception e) {
    }

    return false;
}

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

License:Open Source License

@Override
protected boolean hasPermissionImplicitlyGranted(PermissionChecker permissionChecker, Group group,
        Portlet portlet) throws Exception {

    if (GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.MANAGE_LAYOUTS)) {

        return true;
    }//from www.ja va2 s  .c  om

    return super.hasPermissionImplicitlyGranted(permissionChecker, group, portlet);
}

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

License:Open Source License

private JSONObject _toJSONObject(HttpServletRequest request, long groupId, LayoutTreeNodes layoutTreeNodes,
        LayoutSetBranch layoutSetBranch) throws Exception {

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

        sb.append("_toJSON(groupId=");
        sb.append(groupId);// w w w  .  j av a 2s.c o  m
        sb.append(", layoutTreeNodes=");
        sb.append(layoutTreeNodes);
        sb.append(StringPool.CLOSE_PARENTHESIS);

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

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

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    boolean hasManageLayoutsPermission = GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(),
            groupId, ActionKeys.MANAGE_LAYOUTS);
    boolean mobile = BrowserSnifferUtil.isMobile(request);

    for (LayoutTreeNode layoutTreeNode : layoutTreeNodes) {
        JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

        JSONObject childrenJSONObject = _toJSONObject(request, groupId,
                layoutTreeNode.getChildLayoutTreeNodes(), layoutSetBranch);

        jsonObject.put("children", childrenJSONObject);

        Layout layout = layoutTreeNode.getLayout();

        jsonObject.put("contentDisplayPage", layout.isContentDisplayPage());
        jsonObject.put("deleteable", _isDeleteable(layout, themeDisplay, layoutSetBranch));
        jsonObject.put("friendlyURL", layout.getFriendlyURL());

        if (layout instanceof VirtualLayout) {
            VirtualLayout virtualLayout = (VirtualLayout) layout;

            jsonObject.put("groupId", virtualLayout.getSourceGroupId());
        } else {
            jsonObject.put("groupId", layout.getGroupId());
        }

        jsonObject.put("hasChildren", layout.hasChildren());
        jsonObject.put("layoutId", layout.getLayoutId());
        jsonObject.put("name", layout.getName(themeDisplay.getLocale()));
        jsonObject.put("parentable", LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout,
                ActionKeys.ADD_LAYOUT));
        jsonObject.put("parentLayoutId", layout.getParentLayoutId());
        jsonObject.put("plid", layout.getPlid());
        jsonObject.put("priority", layout.getPriority());
        jsonObject.put("privateLayout", layout.isPrivateLayout());
        jsonObject.put("regularURL", layout.getRegularURL(request));
        jsonObject.put("sortable", hasManageLayoutsPermission && !mobile && SitesUtil.isLayoutSortable(layout));
        jsonObject.put("type", layout.getType());
        jsonObject.put("updateable",
                LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, ActionKeys.UPDATE));
        jsonObject.put("uuid", layout.getUuid());

        LayoutRevision layoutRevision = LayoutStagingUtil.getLayoutRevision(layout);

        if (layoutRevision != null) {
            long layoutSetBranchId = layoutRevision.getLayoutSetBranchId();

            if (_staging.isIncomplete(layout, layoutSetBranchId)) {
                jsonObject.put("incomplete", true);
            }

            LayoutSetBranch boundLayoutSetBranch = _layoutSetBranchLocalService
                    .getLayoutSetBranch(layoutSetBranchId);

            LayoutBranch layoutBranch = layoutRevision.getLayoutBranch();

            if (!layoutBranch.isMaster()) {
                jsonObject.put("layoutBranchId", layoutBranch.getLayoutBranchId());
                jsonObject.put("layoutBranchName", layoutBranch.getName());
            }

            if (layoutRevision.isHead()) {
                jsonObject.put("layoutRevisionHead", true);
            }

            jsonObject.put("layoutRevisionId", layoutRevision.getLayoutRevisionId());
            jsonObject.put("layoutSetBranchId", layoutSetBranchId);
            jsonObject.put("layoutSetBranchName", boundLayoutSetBranch.getName());
        }

        jsonArray.put(jsonObject);
    }

    JSONObject responseJSONObject = JSONFactoryUtil.createJSONObject();

    responseJSONObject.put("layouts", jsonArray);
    responseJSONObject.put("total", layoutTreeNodes.getTotal());

    return responseJSONObject;
}

From source file:org.apache.jsp.html.themes.brochure.templates.myplaces_jsp.java

License:Open Source License

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;//from   w  w w  .  j a v a  2  s  .  com
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        _jspxFactory = JspFactory.getDefaultFactory();
        response.setContentType("text/html; charset=UTF-8");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //  liferay-theme:defineObjects
        com.liferay.taglib.theme.DefineObjectsTag _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 = (com.liferay.taglib.theme.DefineObjectsTag) _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.theme.DefineObjectsTag.class);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_liferay_002dtheme_005fdefineObjects_005f0 = _jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doStartTag();
        if (_jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
        com.liferay.portal.theme.ThemeDisplay themeDisplay = null;
        com.liferay.portal.model.Company company = null;
        com.liferay.portal.model.Account account = null;
        com.liferay.portal.model.User user = null;
        com.liferay.portal.model.User realUser = null;
        com.liferay.portal.model.Contact contact = null;
        com.liferay.portal.model.Layout layout = null;
        java.util.List layouts = null;
        java.lang.Long plid = null;
        com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet = null;
        java.lang.Long portletGroupId = null;
        com.liferay.portal.kernel.security.permission.PermissionChecker permissionChecker = null;
        java.util.Locale locale = null;
        java.util.TimeZone timeZone = null;
        com.liferay.portal.model.Theme theme = null;
        com.liferay.portal.model.ColorScheme colorScheme = null;
        com.liferay.portal.theme.PortletDisplay portletDisplay = null;
        themeDisplay = (com.liferay.portal.theme.ThemeDisplay) _jspx_page_context.findAttribute("themeDisplay");
        company = (com.liferay.portal.model.Company) _jspx_page_context.findAttribute("company");
        account = (com.liferay.portal.model.Account) _jspx_page_context.findAttribute("account");
        user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user");
        realUser = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("realUser");
        contact = (com.liferay.portal.model.Contact) _jspx_page_context.findAttribute("contact");
        layout = (com.liferay.portal.model.Layout) _jspx_page_context.findAttribute("layout");
        layouts = (java.util.List) _jspx_page_context.findAttribute("layouts");
        plid = (java.lang.Long) _jspx_page_context.findAttribute("plid");
        layoutTypePortlet = (com.liferay.portal.model.LayoutTypePortlet) _jspx_page_context
                .findAttribute("layoutTypePortlet");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        permissionChecker = (com.liferay.portal.kernel.security.permission.PermissionChecker) _jspx_page_context
                .findAttribute("permissionChecker");
        locale = (java.util.Locale) _jspx_page_context.findAttribute("locale");
        timeZone = (java.util.TimeZone) _jspx_page_context.findAttribute("timeZone");
        theme = (com.liferay.portal.model.Theme) _jspx_page_context.findAttribute("theme");
        colorScheme = (com.liferay.portal.model.ColorScheme) _jspx_page_context.findAttribute("colorScheme");
        portletDisplay = (com.liferay.portal.theme.PortletDisplay) _jspx_page_context
                .findAttribute("portletDisplay");
        out.write("\r\n");
        out.write("\r\n");

        /**
         * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //@ page import="com.liferay.portal.kernel.util.PortletExtKeys" 
        out.write("\r\n");
        out.write("\r\n");

        String contextPath = PropsUtil.get(PropsUtil.PORTAL_CTX);
        if (contextPath.equals("/")) {
            contextPath = "";
        }

        out.write('\r');
        out.write('\n');
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write('\n');
        out.write('\n');

        RenderRequest renderRequest = (RenderRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);

        RenderResponse renderResponse = (RenderResponse) request
                .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);

        String namespace = StringPool.BLANK;

        if (renderRequest != null) {
            namespace = renderResponse.getNamespace();
        }

        String currentURL = PortalUtil.getCurrentURL(request);

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\r\n");
        out.write("\r\n");
        //  c:if
        org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_005ftest
                .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
        _jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context);
        _jspx_th_c_005fif_005f0.setParent(null);
        _jspx_th_c_005fif_005f0.setTest(themeDisplay.isSignedIn());
        int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag();
        if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
            do {
                out.write("\r\n");
                out.write("\r\n");
                out.write("\t\t");

                PortletURL portletURL = new PortletURLImpl(request, PortletKeys.MY_PLACES, plid.longValue(),
                        true);

                portletURL.setWindowState(WindowState.NORMAL);
                portletURL.setPortletMode(PortletMode.VIEW);

                portletURL.setParameter("struts_action", "/my_places/view");

                LinkedHashMap groupParams = new LinkedHashMap();

                groupParams.put("usersGroups", new Long(user.getUserId()));
                //groupParams.put("pageCount", StringPool.BLANK);

                List communities = GroupLocalServiceUtil.search(company.getCompanyId(), null, null, groupParams,
                        QueryUtil.ALL_POS, QueryUtil.ALL_POS);

                Group locationGroup = user.getLocation().getGroup();

                if (locationGroup.getGroupId() > 0) {
                    communities.add(0, locationGroup);
                }

                Group organizationGroup = user.getOrganization().getGroup();

                if (organizationGroup.getGroupId() > 0) {
                    communities.add(0, organizationGroup);
                }

                if (user.isLayoutsRequired()) {
                    Group userGroup = user.getGroup();

                    communities.add(0, userGroup);
                }

                for (int i = 0; i < communities.size(); i++) {
                    Group community = (Group) communities.get(i);

                    boolean organizationCommunity = community.isOrganization();
                    boolean regularCommunity = community.isCommunity();
                    boolean userCommunity = community.isUser();
                    int publicLayoutsPageCount = community.getPublicLayoutsPageCount();
                    int privateLayoutsPageCount = community.getPrivateLayoutsPageCount();

                    Organization organization = null;

                    String publicAddPageHREF = null;
                    String privateAddPageHREF = null;

                    if (organizationCommunity) {
                        organization = OrganizationLocalServiceUtil.getOrganization(community.getClassPK());

                        if ((!organization.isLocation() && OrganizationPermissionUtil.contains(
                                permissionChecker, organization.getOrganizationId(), ActionKeys.UPDATE))
                                || (organization.isLocation()
                                        && LocationPermissionUtil.contains(permissionChecker,
                                                organization.getOrganizationId(), ActionKeys.UPDATE))) {

                            PortletURL addPageURL = new PortletURLImpl(request, PortletKeys.MY_PLACES,
                                    plid.longValue(), true);

                            addPageURL.setWindowState(WindowState.NORMAL);
                            addPageURL.setPortletMode(PortletMode.VIEW);

                            addPageURL.setParameter("struts_action", "/my_places/edit_pages");
                            addPageURL.setParameter("groupId", String.valueOf(community.getGroupId()));
                            addPageURL.setParameter("privateLayout", Boolean.FALSE.toString());

                            publicAddPageHREF = addPageURL.toString();

                            addPageURL.setParameter("privateLayout", Boolean.TRUE.toString());

                            privateAddPageHREF = addPageURL.toString();
                        }
                    } else if (regularCommunity) {
                        if (GroupPermissionUtil.contains(permissionChecker, community.getGroupId(),
                                ActionKeys.MANAGE_LAYOUTS)) {
                            PortletURL addPageURL = new PortletURLImpl(request, PortletKeys.MY_PLACES,
                                    plid.longValue(), true);

                            addPageURL.setWindowState(WindowState.NORMAL);
                            addPageURL.setPortletMode(PortletMode.VIEW);

                            addPageURL.setParameter("struts_action", "/my_places/edit_pages");
                            addPageURL.setParameter("groupId", String.valueOf(community.getGroupId()));
                            addPageURL.setParameter("privateLayout", Boolean.FALSE.toString());

                            publicAddPageHREF = addPageURL.toString();

                            addPageURL.setParameter("privateLayout", Boolean.TRUE.toString());

                            privateAddPageHREF = addPageURL.toString();
                        }
                    } else if (userCommunity) {
                        long publicAddPagePlid = community.getDefaultPublicPlid();

                        PortletURL publicAddPageURL = new PortletURLImpl(request, PortletKeys.LAYOUT_MANAGEMENT,
                                publicAddPagePlid, false);

                        publicAddPageURL.setWindowState(WindowState.MAXIMIZED);
                        publicAddPageURL.setPortletMode(PortletMode.VIEW);

                        publicAddPageURL.setParameter("struts_action", "/layout_management/edit_pages");
                        publicAddPageURL.setParameter("tabs2", "public");
                        publicAddPageURL.setParameter("groupId", String.valueOf(community.getGroupId()));

                        publicAddPageHREF = publicAddPageURL.toString();

                        long privateAddPagePlid = community.getDefaultPrivatePlid();

                        PortletURL privateAddPageURL = new PortletURLImpl(request,
                                PortletKeys.LAYOUT_MANAGEMENT, privateAddPagePlid, false);

                        privateAddPageURL.setWindowState(WindowState.MAXIMIZED);
                        privateAddPageURL.setPortletMode(PortletMode.VIEW);

                        privateAddPageURL.setParameter("struts_action", "/layout_management/edit_pages");
                        privateAddPageURL.setParameter("tabs2", "private");
                        privateAddPageURL.setParameter("groupId", String.valueOf(community.getGroupId()));

                        privateAddPageHREF = privateAddPageURL.toString();
                    }

                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");

                    String title = "";
                    if (organizationCommunity) {
                        title = organization.getName();
                    } else if (userCommunity) {
                        title = LanguageUtil.get(pageContext, "my-community");
                    } else {
                        title = community.getName();
                    }

                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");

                    portletURL.setParameter("groupId", String.valueOf(community.getGroupId()));
                    portletURL.setParameter("privateLayout", Boolean.FALSE.toString());

                    boolean selectedPlace = false;

                    if (layout != null) {
                        selectedPlace = !layout.isPrivateLayout()
                                && (layout.getGroupId() == community.getGroupId());
                    }

                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");
                    //  c:if
                    org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f1 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_005ftest
                            .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
                    _jspx_th_c_005fif_005f1.setPageContext(_jspx_page_context);
                    _jspx_th_c_005fif_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f0);
                    _jspx_th_c_005fif_005f1.setTest(publicLayoutsPageCount > 0);
                    int _jspx_eval_c_005fif_005f1 = _jspx_th_c_005fif_005f1.doStartTag();
                    if (_jspx_eval_c_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                        do {
                            out.write("\r\n");
                            out.write("\t\t\t\t<li class=\"public ");
                            out.print(selectedPlace ? "current" : "");
                            out.write("\">\r\n");
                            out.write("\t\t\t\t\t<a href='");
                            out.print(publicLayoutsPageCount > 0 ? portletURL.toString() : "javascript: ;");
                            out.write('\'');
                            out.write('>');
                            out.print(title);
                            out.write("</a>\r\n");
                            out.write("\t\t\t\t</li>\r\n");
                            out.write("\t\t\t\t");
                            int evalDoAfterBody = _jspx_th_c_005fif_005f1.doAfterBody();
                            if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                                break;
                        } while (true);
                    }
                    if (_jspx_th_c_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                        _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f1);
                        return;
                    }
                    _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f1);
                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");

                    portletURL.setParameter("groupId", String.valueOf(community.getGroupId()));
                    portletURL.setParameter("privateLayout", Boolean.TRUE.toString());

                    selectedPlace = false;

                    if (layout != null) {
                        selectedPlace = layout.isPrivateLayout()
                                && (layout.getGroupId() == community.getGroupId());
                    }

                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");
                    //  c:if
                    org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f2 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_005ftest
                            .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
                    _jspx_th_c_005fif_005f2.setPageContext(_jspx_page_context);
                    _jspx_th_c_005fif_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f0);
                    _jspx_th_c_005fif_005f2.setTest(privateLayoutsPageCount > 0);
                    int _jspx_eval_c_005fif_005f2 = _jspx_th_c_005fif_005f2.doStartTag();
                    if (_jspx_eval_c_005fif_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                        do {
                            out.write("\r\n");
                            out.write("\t\t\t\t<li class=\"private ");
                            out.print(selectedPlace ? "current" : "");
                            out.write("\">\r\n");
                            out.write("\t\t\t\t\t<a href='");
                            out.print(privateLayoutsPageCount > 0 ? portletURL.toString() : "javascript: ;");
                            out.write('\'');
                            out.write('>');
                            out.print(title);
                            out.write("</a>\r\n");
                            out.write("\t\t\t\t</li>\r\n");
                            out.write("\t\t\t\t");
                            int evalDoAfterBody = _jspx_th_c_005fif_005f2.doAfterBody();
                            if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                                break;
                        } while (true);
                    }
                    if (_jspx_th_c_005fif_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                        _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f2);
                        return;
                    }
                    _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f2);
                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t");

                }

                out.write('\r');
                out.write('\n');
                int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody();
                if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                    break;
            } while (true);
        }
        if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fc_005fif_005ftest.reuse(_jspx_th_c_005fif_005f0);
        out.write('\r');
        out.write('\n');
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        if (_jspxFactory != null)
            _jspxFactory.releasePageContext(_jspx_page_context);
    }
}