META-INF.resources.article.display_page.jsp Maven / Gradle / Ivy
<%--
/**
* 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" %>
<%
EditArticleDisplayPageDisplayContext editArticleDisplayPageDisplayContext = new EditArticleDisplayPageDisplayContext(request, liferayPortletRequest, liferayPortletResponse);
JournalArticle article = editArticleDisplayPageDisplayContext.getArticle();
long groupId = BeanParamUtil.getLong(article, request, "groupId", scopeGroupId);
Group group = GroupLocalServiceUtil.fetchGroup(groupId);
%>
<%
String defaultAssetDisplayPageName = editArticleDisplayPageDisplayContext.getDefaultAssetDisplayPageName(journalDisplayContext.getDDMStructureKey());
String taglibLabelTypeDefault = LanguageUtil.format(request, "use-default-display-page-for-x-x", new Object[] {journalDisplayContext.getDDMStructureName(), Validator.isNotNull(defaultAssetDisplayPageName) ? defaultAssetDisplayPageName : LanguageUtil.get(request, "none")}, false);
if (Validator.isNull(defaultAssetDisplayPageName)) {
taglibLabelTypeDefault += " " + LanguageUtil.get(request, "this-content-will-not-be-referenceable-with-an-url") + "";
}
%>
" id=" displayPageContainer">
" id=" displayPageItemRemove" role="button">
<%= editArticleDisplayPageDisplayContext.getDisplayPageName() %>
<%
Layout defaultDisplayLayout = LayoutLocalServiceUtil.fetchLayoutByUuidAndGroupId(editArticleDisplayPageDisplayContext.getLayoutUuid(), themeDisplay.getScopeGroupId(), false);
if (defaultDisplayLayout == null) {
defaultDisplayLayout = LayoutLocalServiceUtil.fetchLayoutByUuidAndGroupId(editArticleDisplayPageDisplayContext.getLayoutUuid(), themeDisplay.getScopeGroupId(), true);
}
%>
<%
String taglibLabelTypeNone = LanguageUtil.get(request, "none") + " " + LanguageUtil.get(request, "this-content-will-not-be-referenceable-with-an-url") + "";
%>
var assetDisplayPageIdInput = $('# assetDisplayPageIdInput');
var displayPageContainer = $('# displayPageContainer');
var displayPageItemContainer = $('# displayPageItemContainer');
var displayPageItemRemove = $('# displayPageItemRemove');
var displayPageNameInput = $('# displayPageNameInput');
var pagesContainerInput = $('# pagesContainerInput');
$('# chooseDisplayPage').on(
'click',
function(event) {
var itemSelectorDialog = new A.LiferayItemSelectorDialog(
{
eventName: '<%= liferayPortletResponse.getNamespace() + "selectDisplayPage" %>',
on: {
selectedItemChange: function(event) {
var selectedItem = event.newVal;
assetDisplayPageIdInput.val('');
pagesContainerInput.val('');
if (selectedItem) {
if (selectedItem.type === "asset-display-page") {
assetDisplayPageIdInput.val(selectedItem.id);
}
else {
pagesContainerInput.val(selectedItem.id);
}
displayPageNameInput.html(selectedItem.name);
displayPageItemRemove.removeClass('hide');
}
}
},
'strings.add': ' ',
title: ' ',
url: '<%= editArticleDisplayPageDisplayContext.getDisplayPageItemSelectorURL() %>'
}
);
itemSelectorDialog.open();
}
);
displayPageItemRemove.on(
'click',
function(event) {
displayPageNameInput.html(' ');
pagesContainerInput.val('');
displayPageItemRemove.addClass('hide');
}
);
$('# eventsContainer').on(
'change',
function(event) {
var target = event.target;
if (target && target.value === '<%= AssetDisplayPageConstants.TYPE_SPECIFIC %>') {
displayPageContainer.removeClass('hide');
}
else {
displayPageContainer.addClass('hide');
}
}
);