List of usage examples for com.liferay.portal.kernel.util WebKeys THEME_DISPLAY
String THEME_DISPLAY
To view the source code for com.liferay.portal.kernel.util WebKeys THEME_DISPLAY.
Click Source Link
From source file:com.liferay.asset.taglib.internal.display.context.InputAssetLinksDisplayContext.java
License:Open Source License
public InputAssetLinksDisplayContext(PageContext pageContext) { _pageContext = pageContext;//from w ww. ja v a2 s . c om _request = (HttpServletRequest) pageContext.getRequest(); _assetEntryId = GetterUtil .getLong((String) _request.getAttribute("liferay-asset:input-asset-links:assetEntryId")); _portletRequest = (PortletRequest) _request.getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); _themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); }
From source file:com.liferay.asset.taglib.internal.util.AssetCategoryUtil.java
License:Open Source License
public static void addPortletBreadcrumbEntries(long assetCategoryId, HttpServletRequest request, PortletURL portletURL) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); boolean portletBreadcrumbEntry = false; if (Validator.isNotNull(portletDisplay.getId()) && !portletDisplay.isFocused()) { portletBreadcrumbEntry = true;/*w w w . jav a 2 s .c o m*/ } addPortletBreadcrumbEntries(assetCategoryId, request, portletURL, portletBreadcrumbEntry); }
From source file:com.liferay.asset.taglib.internal.util.AssetCategoryUtil.java
License:Open Source License
public static void addPortletBreadcrumbEntries(long assetCategoryId, HttpServletRequest request, PortletURL portletURL, boolean portletBreadcrumbEntry) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); AssetCategory assetCategory = AssetCategoryLocalServiceUtil.getCategory(assetCategoryId); List<AssetCategory> ancestorCategories = assetCategory.getAncestors(); Collections.reverse(ancestorCategories); for (AssetCategory ancestorCategory : ancestorCategories) { portletURL.setParameter("categoryId", String.valueOf(ancestorCategory.getCategoryId())); PortalUtil.addPortletBreadcrumbEntry(request, ancestorCategory.getTitle(themeDisplay.getLocale()), portletURL.toString(), null, portletBreadcrumbEntry); }//w ww . j a v a 2s . c o m portletURL.setParameter("categoryId", String.valueOf(assetCategoryId)); PortalUtil.addPortletBreadcrumbEntry(request, assetCategory.getTitle(themeDisplay.getLocale()), portletURL.toString(), null, portletBreadcrumbEntry); }
From source file:com.liferay.asset.taglib.servlet.taglib.AssetAddButtonTag.java
License:Open Source License
@Override protected void setAttributes(HttpServletRequest request) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); request.setAttribute("liferay-asset:asset-add-button:addDisplayPageParameter", _addDisplayPageParameter); request.setAttribute("liferay-asset:asset-add-button:allAssetCategoryIds", _allAssetCategoryIds); request.setAttribute("liferay-asset:asset-add-button:allAssetTagNames", _allAssetTagNames); long[] classNameIds = _classNameIds; if (classNameIds == null) { classNameIds = AssetRendererFactoryRegistryUtil.getClassNameIds(themeDisplay.getCompanyId()); }/*from ww w . j a va2 s .c om*/ request.setAttribute("liferay-asset:asset-add-button:classNameIds", classNameIds); request.setAttribute("liferay-asset:asset-add-button:classTypeIds", _classTypeIds); long[] groupIds = _groupIds; if (groupIds == null) { groupIds = new long[] { themeDisplay.getScopeGroupId() }; } request.setAttribute("liferay-asset:asset-add-button:groupIds", groupIds); request.setAttribute("liferay-asset:asset-add-button:redirect", _redirect); request.setAttribute("liferay-asset:asset-add-button:useDialog", _useDialog); }
From source file:com.liferay.asset.taglib.servlet.taglib.AssetCategoriesSelectorTag.java
License:Open Source License
protected List<String[]> getCategoryIdsTitles() { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); List<String[]> categoryIdsTitles = new ArrayList<>(); String categoryIds = StringPool.BLANK; if (Validator.isNotNull(_categoryIds)) { categoryIds = _categoryIds;/* w w w . ja v a 2 s . c om*/ } if (Validator.isNull(_className)) { if (!_ignoreRequestValue) { String categoryIdsParam = request.getParameter(_hiddenInput); if (categoryIdsParam != null) { categoryIds = categoryIdsParam; } } String[] categoryIdsTitle = AssetCategoryUtil.getCategoryIdsTitles(categoryIds, StringPool.BLANK, 0, themeDisplay); categoryIdsTitles.add(categoryIdsTitle); return categoryIdsTitles; } try { for (AssetVocabulary vocabulary : getVocabularies()) { String categoryNames = StringPool.BLANK; if (Validator.isNotNull(_className) && (_classPK > 0)) { List<AssetCategory> categories = AssetCategoryServiceUtil.getCategories(_className, _classPK); categoryIds = ListUtil.toString(categories, AssetCategory.CATEGORY_ID_ACCESSOR); categoryNames = ListUtil.toString(categories, AssetCategory.NAME_ACCESSOR); } if (!_ignoreRequestValue) { String categoryIdsParam = request .getParameter(_hiddenInput + StringPool.UNDERLINE + vocabulary.getVocabularyId()); if (Validator.isNotNull(categoryIdsParam)) { categoryIds = categoryIdsParam; } } String[] categoryIdsTitle = AssetCategoryUtil.getCategoryIdsTitles(categoryIds, categoryNames, vocabulary.getVocabularyId(), themeDisplay); categoryIdsTitles.add(categoryIdsTitle); } } catch (Exception e) { } return categoryIdsTitles; }
From source file:com.liferay.asset.taglib.servlet.taglib.AssetCategoriesSelectorTag.java
License:Open Source License
protected long[] getGroupIds() { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); try {/* w w w . ja v a 2 s .c o m*/ if (ArrayUtil.isEmpty(_groupIds)) { return PortalUtil.getCurrentAndAncestorSiteGroupIds(themeDisplay.getScopeGroupId()); } return PortalUtil.getCurrentAndAncestorSiteGroupIds(_groupIds); } catch (Exception e) { } return new long[0]; }
From source file:com.liferay.asset.taglib.servlet.taglib.AssetTagsSelectorTag.java
License:Open Source License
protected long[] getGroupIds() { if (_groupIds != null) { return _groupIds; }/*from ww w . jav a 2 s . c o m*/ ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); long[] groupIds = null; Group group = themeDisplay.getScopeGroup(); if (group.isLayout()) { groupIds = new long[] { group.getParentGroupId() }; } else { groupIds = new long[] { group.getGroupId() }; } if (group.getParentGroupId() != themeDisplay.getCompanyGroupId()) { groupIds = ArrayUtil.append(groupIds, themeDisplay.getCompanyGroupId()); } return groupIds; }
From source file:com.liferay.asset.tags.admin.web.internal.display.context.AssetTagsDisplayContext.java
License:Open Source License
public long getFullTagsCount(AssetTag tag) { int[] statuses = { WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_PENDING, WorkflowConstants.STATUS_SCHEDULED }; ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); return AssetEntryLocalServiceUtil.searchCount(tag.getCompanyId(), null, themeDisplay.getUserId(), null, 0, null, null, null, null, tag.getName(), true, true, statuses, false); }
From source file:com.liferay.asset.tags.admin.web.internal.display.context.AssetTagsDisplayContext.java
License:Open Source License
public SearchContainer getTagsSearchContainer() throws PortalException { if (_tagsSearchContainer != null) { return _tagsSearchContainer; }/*from w w w .j a v a2 s .co m*/ SearchContainer tagsSearchContainer = new SearchContainer(_renderRequest, _renderResponse.createRenderURL(), null, "there-are-no-tags"); String keywords = getKeywords(); if (Validator.isNull(keywords)) { if (isShowAddButton()) { tagsSearchContainer.setEmptyResultsMessage("there-are-no-tags.-you-can-add-a-tag-by-clicking-the-" + "plus-button-on-the-bottom-right-corner"); tagsSearchContainer .setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn"); } } else { tagsSearchContainer.setSearch(true); } tagsSearchContainer.setRowChecker(new EmptyOnClickRowChecker(_renderResponse)); ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); if (Validator.isNotNull(keywords)) { Sort sort = null; String orderByCol = getOrderByCol(); if (orderByCol.equals("name")) { sort = SortFactoryUtil.getSort(AssetTag.class, Sort.STRING_TYPE, Field.NAME, getOrderByType()); } else if (orderByCol.equals("usages")) { sort = SortFactoryUtil.getSort(AssetTag.class, Sort.INT_TYPE, "assetCount_Number", getOrderByType()); } BaseModelSearchResult<AssetTag> baseModelSearchResult = AssetTagLocalServiceUtil.searchTags( new long[] { themeDisplay.getScopeGroupId() }, keywords, tagsSearchContainer.getStart(), tagsSearchContainer.getEnd(), sort); tagsSearchContainer.setResults(baseModelSearchResult.getBaseModels()); tagsSearchContainer.setTotal(baseModelSearchResult.getLength()); } else { String orderByCol = getOrderByCol(); tagsSearchContainer.setOrderByCol(orderByCol); OrderByComparator<AssetTag> orderByComparator = null; boolean orderByAsc = false; String orderByType = getOrderByType(); if (orderByType.equals("asc")) { orderByAsc = true; } if (orderByCol.equals("name")) { orderByComparator = new AssetTagNameComparator(orderByAsc); } else if (orderByCol.equals("usages")) { orderByComparator = new AssetTagAssetCountComparator(orderByAsc); } tagsSearchContainer.setOrderByComparator(orderByComparator); tagsSearchContainer.setOrderByType(orderByType); long scopeGroupId = themeDisplay.getScopeGroupId(); int tagsCount = AssetTagServiceUtil.getTagsCount(scopeGroupId, keywords); tagsSearchContainer.setTotal(tagsCount); List<AssetTag> tags = AssetTagServiceUtil.getTags(scopeGroupId, StringPool.BLANK, tagsSearchContainer.getStart(), tagsSearchContainer.getEnd(), tagsSearchContainer.getOrderByComparator()); tagsSearchContainer.setResults(tags); } _tagsSearchContainer = tagsSearchContainer; return _tagsSearchContainer; }
From source file:com.liferay.asset.tags.admin.web.internal.display.context.AssetTagsDisplayContext.java
License:Open Source License
public boolean isShowAddButton() { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); if (AssetTagsPermission.contains(themeDisplay.getPermissionChecker(), AssetTagsPermission.RESOURCE_NAME, AssetTagsAdminPortletKeys.ASSET_TAGS_ADMIN, themeDisplay.getSiteGroupId(), ActionKeys.ADD_TAG)) { return true; }//from ww w . ja v a2 s . c om return false; }