All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.article.display_page.jsp Maven / Gradle / Ivy

There is a newer version: 5.0.177
Show newest version
<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
--%>

<%@ include file="/init.jsp" %>

<%
JournalArticle article = journalDisplayContext.getArticle();

long groupId = BeanParamUtil.getLong(article, request, "groupId", scopeGroupId);

Group group = GroupLocalServiceUtil.fetchGroup(groupId);

boolean changeStructure = GetterUtil.getBoolean(request.getAttribute("edit_article.jsp-changeStructure"));
%>


	
		

<% String layoutUuid = BeanParamUtil.getString(article, request, "layoutUuid"); if (changeStructure && (article != null)) { layoutUuid = article.getLayoutUuid(); } String layoutBreadcrumb = StringPool.BLANK; if (Validator.isNotNull(layoutUuid)) { Layout selLayout = LayoutLocalServiceUtil.fetchLayoutByUuidAndGroupId(layoutUuid, themeDisplay.getSiteGroupId(), false); if (selLayout == null) { selLayout = LayoutLocalServiceUtil.fetchLayoutByUuidAndGroupId(layoutUuid, themeDisplay.getSiteGroupId(), true); } if (selLayout != null) { layoutBreadcrumb = _getLayoutBreadcrumb(request, selLayout, locale); } } %>

" id="displayPageItemRemove" role="button"> <%= layoutBreadcrumb %>

<% Layout defaultDisplayLayout = LayoutLocalServiceUtil.fetchLayoutByUuidAndGroupId(layoutUuid, scopeGroupId, false); if (defaultDisplayLayout == null) { defaultDisplayLayout = LayoutLocalServiceUtil.fetchLayoutByUuidAndGroupId(layoutUuid, scopeGroupId, true); } AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClass(JournalArticle.class); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(article.getResourcePrimKey()); String urlViewInContext = assetRenderer.getURLViewInContext(liferayPortletRequest, liferayPortletResponse, currentURL); %> <% String eventName = liferayPortletResponse.getNamespace() + "selectDisplayPage"; ItemSelector itemSelector = (ItemSelector)request.getAttribute(JournalWebKeys.ITEM_SELECTOR); LayoutItemSelectorCriterion layoutItemSelectorCriterion = new LayoutItemSelectorCriterion(); layoutItemSelectorCriterion.setCheckDisplayPage(true); List desiredItemSelectorReturnTypes = new ArrayList(); desiredItemSelectorReturnTypes.add(new UUIDItemSelectorReturnType()); layoutItemSelectorCriterion.setDesiredItemSelectorReturnTypes(desiredItemSelectorReturnTypes); PortletURL itemSelectorURL = itemSelector.getItemSelectorURL(RequestBackedPortletURLFactoryUtil.create(liferayPortletRequest), eventName, layoutItemSelectorCriterion); %> var displayPageItemContainer = $('#displayPageItemContainer'); var displayPageItemRemove = $('#displayPageItemRemove'); var displayPageNameInput = $('#displayPageNameInput'); var pagesContainerInput = $('#pagesContainerInput'); $('#chooseDisplayPage').on( 'click', function(event) { var itemSelectorDialog = new A.LiferayItemSelectorDialog( { eventName: '<%= eventName %>', on: { selectedItemChange: function(event) { var selectedItem = event.newVal; if (selectedItem) { pagesContainerInput.val(selectedItem.value); displayPageNameInput.html(selectedItem.layoutpath); displayPageItemRemove.removeClass('hide'); } } }, 'strings.add': '', title: '', url: '<%= itemSelectorURL.toString() %>' } ); itemSelectorDialog.open(); } ); displayPageItemRemove.on( 'click', function(event) { displayPageNameInput.html(''); pagesContainerInput.val(''); displayPageItemRemove.addClass('hide'); } );
<%! private String _getLayoutBreadcrumb(HttpServletRequest request, Layout layout, Locale locale) throws Exception { List ancestors = layout.getAncestors(); StringBundler sb = new StringBundler(4 * ancestors.size() + 5); if (layout.isPrivateLayout()) { sb.append(LanguageUtil.get(request, "private-pages")); } else { sb.append(LanguageUtil.get(request, "public-pages")); } sb.append(StringPool.SPACE); sb.append(StringPool.GREATER_THAN); sb.append(StringPool.SPACE); Collections.reverse(ancestors); for (Layout ancestor : ancestors) { sb.append(HtmlUtil.escape(ancestor.getName(locale))); sb.append(StringPool.SPACE); sb.append(StringPool.GREATER_THAN); sb.append(StringPool.SPACE); } sb.append(HtmlUtil.escape(layout.getName(locale))); return sb.toString(); } %>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy