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

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

Introduction

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

Prototype

@JSON(include = false)
    public PortletDisplay getPortletDisplay() 

Source Link

Usage

From source file:com.liferay.staging.configuration.web.internal.portlet.configuration.icon.StagingPortletConfigurationIcon.java

License:Open Source License

@Override
public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) {

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

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getURLStaging();
}

From source file:com.liferay.staging.configuration.web.internal.portlet.configuration.icon.StagingPortletConfigurationIcon.java

License:Open Source License

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

    Group group = themeDisplay.getSiteGroup();

    if (group.isStagedRemotely() || group.hasLocalOrRemoteStagingGroup()) {
        return false;
    }/* w ww .  j  a v  a2 s .  c  om*/

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String rootPortletId = portletDisplay.getRootPortletId();

    if (rootPortletId.equals(ExportImportPortletKeys.EXPORT)
            || rootPortletId.equals(ExportImportPortletKeys.EXPORT_IMPORT)
            || rootPortletId.equals(ExportImportPortletKeys.IMPORT)
            || rootPortletId.equals(StagingConfigurationPortletKeys.STAGING_CONFIGURATION)
            || rootPortletId.equals(StagingProcessesPortletKeys.STAGING_PROCESSES)) {

        return false;
    }

    if (!portletDisplay.isShowStagingIcon()) {
        return false;
    }

    try {
        return GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroup(),
                ActionKeys.PUBLISH_PORTLET_INFO);
    } catch (PortalException pe) {

        // LPS-52675

        if (_log.isDebugEnabled()) {
            _log.debug(pe, pe);
        }

        return false;
    }
}

From source file:com.liferay.trash.taglib.servlet.taglib.UndoTag.java

License:Open Source License

private Map<String, Object> _getData() {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    PortletRequest portletRequest = (PortletRequest) request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String key = portletDisplay.getId() + SessionMessages.KEY_SUFFIX_DELETE_SUCCESS_DATA;

    if (!SessionMessages.contains(portletRequest, key)) {
        return null;
    }/*from w  ww .ja v  a 2 s  .  c o m*/

    return (HashMap<String, Object>) SessionMessages.get(portletRequest, key);
}

From source file:com.liferay.user.groups.admin.web.internal.portlet.configuration.icon.DeleteUserGroupPortletConfigurationIcon.java

License:Open Source License

@Override
public String getOnClick(PortletRequest portletRequest, PortletResponse portletResponse) {

    StringBundler sb = new StringBundler(6);

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

    try {//from w ww  . j a v  a2 s . c o  m
        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        sb.append(portletDisplay.getNamespace());

        sb.append("doDeleteUserGroup('");
        sb.append(UserGroup.class.getName());
        sb.append("','");

        UserGroup userGroup = ActionUtil.getUserGroup(portletRequest);

        sb.append(userGroup.getUserGroupId());

        sb.append("');");
    } catch (Exception e) {
    }

    return sb.toString();
}

From source file:com.liferay.users.admin.web.internal.portlet.configuration.icon.DeleteOrganizationPortletConfigurationIcon.java

License:Open Source License

@Override
public String getOnClick(PortletRequest portletRequest, PortletResponse portletResponse) {

    StringBundler sb = new StringBundler(4);

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

    try {//  w w  w  . ja  v  a2 s .co m
        PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

        sb.append(portletDisplay.getNamespace());

        sb.append("deleteOrganization('");

        Organization organization = ActionUtil.getOrganization(portletRequest);

        sb.append(organization.getOrganizationId());

        sb.append("');");
    } catch (Exception e) {
    }

    return sb.toString();
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.navigation.user.entry.UserOrganizationsScreenNavigationEntry.java

License:Open Source License

@Override
public boolean isEditable(HttpServletRequest request, HttpServletResponse response) {

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String myAccountPortletId = PortletProviderUtil
            .getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME, PortletProvider.Action.VIEW);

    if (myAccountPortletId.equals(portletDisplay.getPortletName())) {
        return false;
    }//  w  ww. ja  v a 2 s .com

    return true;
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.navigation.user.entry.UserProfileAndPrivateAreaScreenNavigationEntry.java

License:Open Source License

@Override
public boolean isVisible(User user, User selUser) {
    if (selUser == null) {
        return false;
    }/*from w  ww . ja v a 2 s . c om*/

    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String myAccountPortletId = PortletProviderUtil
            .getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME, PortletProvider.Action.VIEW);

    if (myAccountPortletId.equals(portletDisplay.getPortletName())) {
        return false;
    }

    return true;
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.UserPersonalSiteFormNavigatorEntry.java

License:Open Source License

@Override
public boolean isVisible(User user, User selUser) {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    String portletId = PortletProviderUtil.getPortletId(PortalMyAccountApplicationType.MyAccount.CLASS_NAME,
            PortletProvider.Action.VIEW);

    if ((selUser != null) && portletId.equals(portletDisplay.getPortletName())) {

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

    return true;
}

From source file:com.liferay.users.admin.web.internal.servlet.taglib.ui.UsersFormNavigatorContextProvider.java

License:Open Source License

private String _getPortletName() {
    ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();

    ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    return portletDisplay.getPortletName();
}

From source file:com.liferay.wiki.editor.configuration.internal.WikiAttachmentEditorOptionsContributor.java

License:Open Source License

@Override
public void populateEditorOptions(EditorOptions editorOptions, Map<String, Object> inputEditorTaglibAttributes,
        ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) {

    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();

    if (Validator.isNull(portletDisplay.getId())) {
        return;//from   www. jav  a  2  s. c  o  m
    }

    Map<String, String> fileBrowserParamsMap = (Map<String, String>) inputEditorTaglibAttributes
            .get("liferay-ui:input-editor:fileBrowserParams");

    long wikiPageResourcePrimKey = 0;

    if (fileBrowserParamsMap != null) {
        wikiPageResourcePrimKey = GetterUtil.getLong(fileBrowserParamsMap.get("wikiPageResourcePrimKey"));
    }

    if (wikiPageResourcePrimKey == 0) {
        return;
    }

    PortletURL portletURL = requestBackedPortletURLFactory.createActionURL(WikiPortletKeys.WIKI);

    portletURL.setParameter(ActionRequest.ACTION_NAME, "/wiki/upload_page_attachment");
    portletURL.setParameter("resourcePrimKey", String.valueOf(wikiPageResourcePrimKey));
    portletURL.setParameter("mimeTypes", PropsValues.DL_FILE_ENTRY_PREVIEW_IMAGE_MIME_TYPES);

    editorOptions.setUploadURL(portletURL.toString());
}