
META-INF.resources.configuration.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" %>
<%
String redirect = ParamUtil.getString(request, "redirect");
JournalArticle article = journalContentDisplayContext.getArticle();
List ddmTemplates = journalContentDisplayContext.getDDMTemplates();
%>
">
configuration-options-container row">
var STR_HIDDEN = 'hidden';
var form = AUI.$(document. fm);
var articlePreviewNode = $('.article-preview');
var templatePreviewButtonNode = $('.template-preview-button');
var templatePreviewNode = $('.template-preview');
var showLoading = function(element) {
element.find('.loading-animation').removeClass(STR_HIDDEN);
};
var hideLoading = function(element) {
element.find('.loading-animation').addClass(STR_HIDDEN);
};
var showError = function(element) {
element.find('.alert').removeClass(STR_HIDDEN);
};
var hideError = function(element) {
element.find('.alert').addClass(STR_HIDDEN);
};
var showArticleError = function() {
showError(articlePreviewNode);
};
var showTemplateError = function() {
templatePreviewNode.removeClass(STR_HIDDEN);
showError(templatePreviewNode);
};
$('# webContentSelector').on(
'click',
function(event) {
event.preventDefault();
<%
PortletURL selectWebContentURL = PortletProviderUtil.getPortletURL(request, JournalArticle.class.getName(), PortletProvider.Action.BROWSE);
selectWebContentURL.setParameter("groupId", String.valueOf(scopeGroupId));
selectWebContentURL.setParameter("selectedGroupIds", StringUtil.merge(journalContentDisplayContext.getSelectedGroupIds()));
selectWebContentURL.setParameter("refererAssetEntryId", "[$ARTICLE_REFERER_ASSET_ENTRY_ID$]");
selectWebContentURL.setParameter("typeSelection", JournalArticle.class.getName());
selectWebContentURL.setParameter("showNonindexable", String.valueOf(Boolean.TRUE));
selectWebContentURL.setParameter("showScheduled", String.valueOf(Boolean.TRUE));
selectWebContentURL.setParameter("eventName", "selectContent");
selectWebContentURL.setWindowState(LiferayWindowState.POP_UP);
%>
var baseSelectWebContentURI = '<%= selectWebContentURL.toString() %>';
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
destroyOnHide: true,
modal: true
},
eventName: 'selectContent',
id: 'selectContent',
title: ' ',
uri: baseSelectWebContentURI.replace(encodeURIComponent('[$ARTICLE_REFERER_ASSET_ENTRY_ID$]'), form.fm('assetEntryId').val())
},
function(event) {
var baseJournalArticleResourceUrl = '<%= journalArticleResource.toString() %>';
form.fm('assetEntryId').val(event.assetentryid);
form.fm('ddmTemplateKey').val('');
hideError(articlePreviewNode);
showLoading(articlePreviewNode);
templatePreviewButtonNode.addClass(STR_HIDDEN);
templatePreviewNode.addClass(STR_HIDDEN);
articlePreviewNode.find('.article-preview-content-container').html('');
templatePreviewNode.find('.template-preview-content-container').html('');
articlePreviewNode.find('.web-content-selector').html(' ');
$.ajax(
baseJournalArticleResourceUrl.replace(encodeURIComponent('[$ARTICLE_RESOURCE_PRIMKEY$]'), event.assetclasspk),
{
error: function() {
hideLoading(articlePreviewNode);
showArticleError();
},
success: function(responseData) {
var responseDataNode = $(responseData);
var articlePreviewContent = responseDataNode.find('.article-preview-content');
var templatePreviewContent = responseDataNode.find('.template-preview-content');
hideLoading(articlePreviewNode);
articlePreviewNode.find('.article-preview-content-container').html(articlePreviewContent);
templatePreviewNode.find('.template-preview-content-container').html(templatePreviewContent);
if (articlePreviewContent.length > 0) {
$('.configuration-options-container').removeClass(STR_HIDDEN);
if (templatePreviewContent.length > 0) {
var templatePreviewContentNode = templatePreviewNode.find('.template-preview-content');
templatePreviewButtonNode.toggleClass(STR_HIDDEN, templatePreviewContentNode.attr('data-change-enabled') === 'false');
templatePreviewNode.removeClass(STR_HIDDEN);
form.fm('ddmTemplateKey').val(templatePreviewContentNode.attr('data-template-key'));
}
else {
showTemplateError();
}
}
else {
showArticleError();
}
}
}
);
}
);
}
);
$('# templateSelector').on(
'click',
function(event) {
event.preventDefault();
var templatePreviewContent = templatePreviewNode.find('.template-preview-content');
Liferay.Util.openDDMPortlet(
{
basePortletURL: '<%= PortalUtil.getControlPanelPortletURL(request, PortletProviderUtil.getPortletId(DDMStructure.class.getName(), PortletProvider.Action.VIEW), PortletRequest.RENDER_PHASE) %>',
classNameId: '<%= PortalUtil.getClassNameId(DDMStructure.class) %>',
classPK: templatePreviewContent.attr('data-structure-key'),
dialog: {
destroyOnHide: true
},
eventName: 'selectTemplate',
groupId: $('.template-preview-content').attr('data-group-id'),
mvcPath: '/select_template.jsp',
navigationStartsOn: '<%= DDMNavigationHelper.SELECT_TEMPLATE %>',
refererPortletName: '<%= JournalPortletKeys.JOURNAL %>',
resourceClassNameId: $('.template-preview-content').attr('data-structure-id'),
showAncestorScopes: true,
showCacheableInput: true,
templateId: $('.template-preview-content').attr('data-template-id'),
title: ' '
},
function(event) {
templatePreviewContent.attr('data-template-id', event.ddmtemplateid);
templatePreviewContent.attr('data-template-key', event.ddmtemplatekey);
templatePreviewContent.find('.template-title').html(event.name);
templatePreviewContent.find('.template-description').html(event.description);
var templateImage = templatePreviewContent.find('.template-image');
if (event.imageurl !== 'null') {
templateImage.attr('alt', event.name);
templateImage.attr('src', event.imageurl);
templateImage.removeClass('hidden');
}
else {
templateImage.attr('alt', '');
templateImage.attr('src', '');
templateImage.addClass('hidden');
}
form.fm('ddmTemplateKey').val(event.ddmtemplatekey);
}
);
}
);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy