Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
META-INF.resources.edit_feed.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");
JournalFeed feed = ActionUtil.getFeed(request);
long groupId = BeanParamUtil.getLong(feed, request, "groupId", scopeGroupId);
String feedId = BeanParamUtil.getString(feed, request, "feedId");
String newFeedId = ParamUtil.getString(request, "newFeedId");
String ddmStructureKey = ParamUtil.getString(request, "ddmStructureKey");
if (Validator.isNull(ddmStructureKey) && (feed != null)) {
ddmStructureKey = feed.getDDMStructureKey();
}
DDMStructure ddmStructure = null;
String ddmStructureName = StringPool.BLANK;
if (Validator.isNotNull(ddmStructureKey)) {
ddmStructure = DDMStructureLocalServiceUtil.fetchStructure(themeDisplay.getSiteGroupId(), PortalUtil.getClassNameId(JournalArticle.class), ddmStructureKey, true);
if (ddmStructure != null) {
ddmStructureName = ddmStructure.getName(locale);
}
}
List ddmTemplates = new ArrayList();
if (ddmStructure != null) {
ddmTemplates = DDMTemplateLocalServiceUtil.getTemplates(themeDisplay.getScopeGroupId(), PortalUtil.getClassNameId(DDMStructure.class), ddmStructure.getStructureId(), true);
}
String ddmTemplateKey = ParamUtil.getString(request, "ddmTemplateKey");
if (Validator.isNull(ddmTemplateKey) && (feed != null)) {
ddmTemplateKey = feed.getDDMTemplateKey();
}
if ((ddmStructure == null) && Validator.isNotNull(ddmTemplateKey)) {
DDMTemplate ddmTemplate = DDMTemplateLocalServiceUtil.fetchTemplate(themeDisplay.getSiteGroupId(), PortalUtil.getClassNameId(DDMStructure.class), ddmTemplateKey, true);
if (ddmTemplate != null) {
ddmStructure = DDMStructureLocalServiceUtil.fetchStructure(ddmTemplate.getClassPK());
if (ddmStructure != null) {
ddmStructureKey = ddmStructure.getStructureKey();
ddmStructureName = ddmStructure.getName(locale);
ddmTemplates = DDMTemplateLocalServiceUtil.getTemplates(themeDisplay.getSiteGroupId(), PortalUtil.getClassNameId(DDMStructure.class), ddmTemplate.getClassPK());
}
}
}
String ddmRendererTemplateKey = ParamUtil.getString(request, "ddmRendererTemplateKey");
if (Validator.isNull(ddmRendererTemplateKey) && (feed != null)) {
ddmRendererTemplateKey = feed.getDDMRendererTemplateKey();
}
String contentField = BeanParamUtil.getString(feed, request, "contentField");
if (Validator.isNull(contentField) || ((ddmStructure == null) && !contentField.equals(JournalFeedConstants.WEB_CONTENT_DESCRIPTION) && !contentField.equals(JournalFeedConstants.RENDERED_WEB_CONTENT))) {
contentField = JournalFeedConstants.WEB_CONTENT_DESCRIPTION;
}
String feedFormat = BeanParamUtil.getString(feed, request, "feedFormat", RSSUtil.FORMAT_DEFAULT);
double feedVersion = BeanParamUtil.getDouble(feed, request, "feedVersion", RSSUtil.VERSION_DEFAULT);
String feedType = RSSUtil.getFeedType(feedFormat, feedVersion);
ResourceURL feedURL = null;
if (feed != null) {
long targetLayoutPlid = PortalUtil.getPlidFromFriendlyURL(feed.getCompanyId(), feed.getTargetLayoutFriendlyUrl());
feedURL = PortletURLFactoryUtil.create(request, JournalPortletKeys.JOURNAL, targetLayoutPlid, PortletRequest.RESOURCE_PHASE);
feedURL.setCacheability(ResourceURL.FULL);
feedURL.setParameter("groupId", String.valueOf(groupId));
feedURL.setParameter("feedId", String.valueOf(feedId));
feedURL.setResourceID("/journal/rss");
}
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(redirect);
renderResponse.setTitle((feed == null) ? LanguageUtil.get(request, "new-feed") : feed.getName());
%>
<%
for (DDMTemplate ddTemplate : ddmTemplates) {
%>
<%
}
%>
" />">
<%
for (DDMTemplate curTemplate : ddmTemplates) {
%>
<%
}
%>
">
<%
DDMForm ddmForm = ddmStructure.getDDMForm();
Map ddmFormFieldsMap = ddmForm.getDDMFormFieldsMap(true);
for (DDMFormField ddmFormField : ddmFormFieldsMap.values()) {
String ddmFormFieldType = ddmFormField.getType();
%>
<%
DDMFormFieldOptions ddmFormFieldOptions = ddmFormField.getDDMFormFieldOptions();
for (String optionValue : ddmFormFieldOptions.getOptionsValues()) {
LocalizedValue optionLabels = ddmFormFieldOptions.getOptionLabels(optionValue);
optionValue = ddmFormField.getName() + StringPool.UNDERLINE + optionValue;
%>
<%
}
%>
<%
}
%>
<%
for (String curFeedType : RSSUtil.FEED_TYPES) {
%>
<%
}
%>
<%
boolean hasSavePermission = false;
if (feed != null) {
hasSavePermission = JournalFeedPermission.contains(permissionChecker, feed, ActionKeys.UPDATE);
}
else {
hasSavePermission = JournalPermission.contains(permissionChecker, scopeGroupId, ActionKeys.ADD_FEED);
}
%>
function openDDMStructureSelector() {
Liferay.Util.openSelectionModal({
onSelect: function (selectedItem) {
if (
document. fm
. ddmStructureKey.value !=
selectedItem.ddmstructurekey
) {
if (
confirm(
'<%= UnicodeLanguageUtil.get(request, "selecting-a-new-structure-changes-the-available-templates-and-available-feed-item-content") %>'
)
) {
document. fm. ddmStructureKey.value =
selectedItem.ddmstructurekey;
document. fm. ddmTemplateKey.value =
'';
document. fm. ddmRendererTemplateKey.value =
'';
document. fm. contentField.value =
'<%= JournalFeedConstants.WEB_CONTENT_DESCRIPTION %>';
submitForm(
document. fm,
null,
false,
false
);
}
}
},
selectEventName: ' selectDDMStructure',
title: '<%= UnicodeLanguageUtil.get(request, "structures") %>',
url:
' ',
});
}
function removeDDMStructure() {
document. fm. ddmStructureKey.value =
'';
document. fm. ddmTemplateKey.value =
'';
document. fm. ddmRendererTemplateKey.value =
'';
document. fm. contentField.value =
'<%= JournalFeedConstants.WEB_CONTENT_DESCRIPTION %>';
submitForm(document. fm, null, false, false);
}
function saveFeed() {
document. fm[
' javax-portlet-action'
].value =
'<%= (feed == null) ? "/journal/add_feed" : "/journal/update_feed" %>';
document. fm. feedId.value =
document. fm. newFeedId.value;
submitForm(document. fm);
}
Liferay.Util.disableToggleBoxes(
' autoFeedId',
' newFeedId',
true
);
var form = document. fm;
var renderedWebContent = '<%= JournalFeedConstants.RENDERED_WEB_CONTENT %>';
var contentFieldSelector = Liferay.Util.getFormElement(
form,
'contentFieldSelector'
);
if (contentFieldSelector) {
contentFieldSelector.addEventListener('change', () => {
var contentFieldValue = '';
var ddmRendererTemplateKeyValue = '';
var selectedFeedItemOption =
contentFieldSelector.options[contentFieldSelector.selectedIndex];
if (selectedFeedItemOption) {
contentFieldValue = selectedFeedItemOption.value || '';
if (
selectedFeedItemOption.dataset.contentfield ===
renderedWebContent
) {
ddmRendererTemplateKeyValue = contentFieldValue;
contentFieldValue = renderedWebContent;
}
}
Liferay.Util.setFormValues(form, {
contentField: contentFieldValue,
ddmRendererTemplateKey: ddmRendererTemplateKeyValue,
});
});
}