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

META-INF.resources.edit_feed.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" %>

<%
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("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(); if (ddmFormFieldType.equals("radio") || ddmFormFieldType.equals("select")) { DDMFormFieldOptions ddmFormFieldOptions = ddmFormField.getDDMFormFieldOptions(); for (String optionValue : ddmFormFieldOptions.getOptionsValues()) { LocalizedValue optionLabels = ddmFormFieldOptions.getOptionLabels(optionValue); optionValue = ddmFormField.getName() + StringPool.UNDERLINE + optionValue; %> <% } } else if (!ddmFormFieldType.equals("checkbox")) { %> <% } } %> <% 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 openStructureSelector() { Liferay.Util.openDDMPortlet( { basePortletURL: '<%= PortletURLFactoryUtil.create(request, PortletProviderUtil.getPortletId(DDMStructure.class.getName(), PortletProvider.Action.VIEW), PortletRequest.RENDER_PHASE) %>', classPK: <%= (ddmStructure != null) ? ddmStructure.getPrimaryKey(): 0 %>, dialog: { destroyOnHide: true }, eventName: 'selectStructure', groupId: <%= themeDisplay.getSiteGroupId() %>, mvcPath: '/select_structure.jsp', navigationStartsOn: '<%= DDMNavigationHelper.SELECT_STRUCTURE %>', refererPortletName: '<%= JournalPortletKeys.JOURNAL + ".selectStructureFeed" %>', <% Portlet portlet = PortletLocalServiceUtil.getPortletById(portletDisplay.getId()); %> refererWebDAVToken: '<%= HtmlUtil.escapeJS(WebDAVUtil.getStorageToken(portlet)) %>', showAncestorScopes: true, title: '<%= UnicodeLanguageUtil.get(request, "structures") %>' }, function(event) { if (confirm('<%= UnicodeLanguageUtil.get(request, "selecting-a-new-structure-changes-the-available-templates-and-available-feed-item-content") %>') && (document.fm.ddmStructureKey.value != event.structurekey)) { document.fm.ddmStructureKey.value = event.ddmstructurekey; document.fm.ddmTemplateKey.value = ''; document.fm.ddmRendererTemplateKey.value = ''; document.fm.contentField.value = '<%= JournalFeedConstants.WEB_CONTENT_DESCRIPTION %>'; submitForm(document.fm, null, false, false); } } ); } function removeStructure() { 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) ? "addFeed" : "updateFeed" %>'; document.fm.feedId.value = document.fm.newFeedId.value; submitForm(document.fm); } Liferay.Util.disableToggleBoxes('autoFeedId', 'newFeedId', true); var form = $(document.fm); var contentFieldSelector = form.fm('contentFieldSelector'); contentFieldSelector.on( 'change', function() { var ddmRendererTemplateKeyValue = ''; var selectedFeedItemOption = contentFieldSelector.find(':selected'); var contentFieldValue = selectedFeedItemOption.val(); var renderedWebContent = '<%= JournalFeedConstants.RENDERED_WEB_CONTENT %>'; if (selectedFeedItemOption.data('contentfield') === renderedWebContent) { ddmRendererTemplateKeyValue = contentFieldValue; contentFieldValue = renderedWebContent; } form.fm('contentField').val(contentFieldValue); form.fm('ddmRendererTemplateKey').val(ddmRendererTemplateKeyValue); } );




© 2015 - 2024 Weber Informatics LLC | Privacy Policy