List of usage examples for com.liferay.portal.kernel.util PortalUtil getLayoutURL
public static String getLayoutURL(Layout layout, ThemeDisplay themeDisplay) throws PortalException
From source file:com.liferay.journal.web.asset.JournalArticleAssetRenderer.java
License:Open Source License
protected String getHitLayoutURL(boolean privateLayout, String noSuchEntryRedirect, ThemeDisplay themeDisplay) throws PortalException { List<Long> hitLayoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(_article.getGroupId(), privateLayout, _article.getArticleId()); for (Long hitLayoutId : hitLayoutIds) { Layout hitLayout = LayoutLocalServiceUtil.getLayout(_article.getGroupId(), privateLayout, hitLayoutId.longValue()); if (LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), hitLayout, ActionKeys.VIEW)) { return PortalUtil.getLayoutURL(hitLayout, themeDisplay); }/*from ww w. j ava 2 s .c om*/ } return noSuchEntryRedirect; }
From source file:com.liferay.layout.admin.web.internal.asset.LayoutRevisionAssetRenderer.java
License:Open Source License
@Override public String getURLViewInContext(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse, String noSuchEntryRedirect) { try {/*from w ww .jav a2s . co m*/ ThemeDisplay themeDisplay = (ThemeDisplay) liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = LayoutLocalServiceUtil.getLayout(_layoutRevision.getPlid()); String layoutURL = PortalUtil.getLayoutURL(layout, themeDisplay); layoutURL = HttpUtil.addParameter(layoutURL, "layoutSetBranchId", _layoutRevision.getLayoutSetBranchId()); layoutURL = HttpUtil.addParameter(layoutURL, "layoutRevisionId", _layoutRevision.getLayoutRevisionId()); return layoutURL; } catch (Exception e) { return StringPool.BLANK; } }
From source file:com.liferay.layout.item.selector.web.internal.display.context.LayoutItemSelectorViewDisplayContext.java
License:Open Source License
private JSONArray _getLayoutsJSONArray(long groupId, boolean privateLayout, long parentLayoutId, String selectedLayoutUuid) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, privateLayout, parentLayoutId); for (Layout layout : layouts) { if (StagingUtil.isIncomplete(layout)) { continue; }//from w w w . j a v a 2 s .c o m JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONArray childrenJSONArray = _getLayoutsJSONArray(groupId, privateLayout, layout.getLayoutId(), selectedLayoutUuid); if (childrenJSONArray.length() > 0) { jsonObject.put("children", childrenJSONArray); } if ((_layoutItemSelectorCriterion.isCheckDisplayPage() && !layout.isContentDisplayPage()) || (!_layoutItemSelectorCriterion.isEnableCurrentPage() && (layout.getPlid() == _getSelPlid()))) { jsonObject.put("disabled", true); } jsonObject.put("groupId", layout.getGroupId()); jsonObject.put("icon", "page"); jsonObject.put("id", layout.getUuid()); jsonObject.put("layoutId", layout.getLayoutId()); jsonObject.put("name", layout.getName(themeDisplay.getLocale())); jsonObject.put("privateLayout", layout.isPrivateLayout()); jsonObject.put("url", PortalUtil.getLayoutURL(layout, themeDisplay)); if (Objects.equals(layout.getUuid(), selectedLayoutUuid)) { jsonObject.put("selected", true); } jsonObject.put("value", _getLayoutBreadcrumb(layout)); jsonArray.put(jsonObject); } return jsonArray; }
From source file:com.liferay.site.navigation.site.map.web.internal.display.context.SiteNavigationSiteMapDisplayContext.java
License:Open Source License
private void _buildLayoutView(Layout layout, String cssClass, boolean useHtmlTitle, ThemeDisplay themeDisplay, StringBundler sb) throws Exception { String layoutURL = PortalUtil.getLayoutURL(layout, themeDisplay); String target = PortalUtil.getLayoutTarget(layout); sb.append("<a"); LayoutType layoutType = layout.getLayoutType(); if (layoutType.isBrowsable()) { sb.append(" href=\""); sb.append(layoutURL);/*from w w w. j av a2 s . c om*/ sb.append("\" "); sb.append(target); } if (Validator.isNotNull(cssClass)) { sb.append(" class=\""); sb.append(cssClass); sb.append("\" "); } sb.append("> "); String layoutName = HtmlUtil.escape(layout.getName(themeDisplay.getLocale())); if (useHtmlTitle) { layoutName = HtmlUtil.escape(layout.getHTMLTitle(themeDisplay.getLocale())); } sb.append(layoutName); sb.append("</a>"); }