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

META-INF.resources.publish_portlet.jsp Maven / Gradle / Ivy

There is a newer version: 5.0.96
Show newest version
<%--
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */
--%>

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



<%
String tabs3 = ParamUtil.getString(request, "tabs3", "new-publish-process");

String errorMessageKey = StringPool.BLANK;

Layout targetLayout = null;

if (!layout.isTypeControlPanel()) {
	long remoteLayoutPlid = 0;

	if ((liveGroup == null) || (stagingGroup == null) || (group.isLayout() && (stagingGroup.getLiveGroupId() == 0))) {
		errorMessageKey = "this-widget-is-placed-in-a-page-that-does-not-exist-in-the-live-site-publish-the-page-first";
	}
	else {
		try {
			if (stagingGroup.isLayout()) {
				targetLayout = LayoutLocalServiceUtil.getLayout(liveGroup.getClassPK());
			}
			else if (stagingGroup.isStagedRemotely()) {
				remoteLayoutPlid = StagingUtil.getRemoteLayoutPlid(user.getUserId(), stagingGroup.getGroupId(), layout.getPlid());
			}
			else {
				targetLayout = LayoutLocalServiceUtil.getLayoutByUuidAndGroupId(layout.getUuid(), liveGroup.getGroupId(), layout.isPrivateLayout());
			}
		}
		catch (PortalException portalException) {
			errorMessageKey = "this-widget-is-placed-in-a-page-that-does-not-exist-in-the-live-site-publish-the-page-first";
		}

		if (targetLayout != null) {
			LayoutType layoutType = targetLayout.getLayoutType();

			LayoutTypePortlet targetLayoutTypePortlet = (LayoutTypePortlet)layoutType;

			if (!(layoutType instanceof LayoutTypePortlet) || !targetLayoutTypePortlet.hasPortletId(selPortlet.getPortletId())) {
				errorMessageKey = "this-widget-has-not-been-added-to-the-live-page-publish-the-page-first";
			}
		}
		else if (stagingGroup.isStagedRemotely() && (remoteLayoutPlid > 0)) {
			boolean remoteLayoutHasPortletId = StagingUtil.isRemoteLayoutHasPortletId(user.getUserId(), stagingGroup.getGroupId(), remoteLayoutPlid, selPortlet.getPortletId());

			if (!remoteLayoutHasPortletId) {
				errorMessageKey = "this-widget-has-not-been-added-to-the-live-page-publish-the-page-first";
			}
		}
		else if (stagingGroup.isStagedRemotely() && (remoteLayoutPlid == 0)) {
			errorMessageKey = "this-widget-is-placed-in-a-page-that-does-not-exist-in-the-live-site-publish-the-page-first";
		}
	}
}
else if (group.isLayout()) {
	if ((liveGroup == null) || (stagingGroup == null) || (stagingGroup.getLiveGroupId() == 0)) {
		errorMessageKey = "a-widget-is-placed-in-this-page-of-scope-that-does-not-exist-in-the-live-site-publish-the-page-first";
	}
	else {
		try {
			targetLayout = LayoutLocalServiceUtil.getLayout(liveGroup.getClassPK());
		}
		catch (NoSuchLayoutException nsle) {
			errorMessageKey = "a-portlet-is-placed-in-this-page-of-scope-that-does-not-exist-in-the-live-site-publish-the-page-first";
		}
	}
}

if (!GroupPermissionUtil.contains(permissionChecker, themeDisplay.getScopeGroup(), ActionKeys.PUBLISH_PORTLET_INFO)) {
	errorMessageKey = "you-do-not-have-permission-to-access-the-requested-resource";
}
%>



var exportImport = new Liferay.ExportImport({ commentsNode: '#<%= PortletDataHandlerKeys.COMMENTS %>', deletionsNode: '#<%= PortletDataHandlerKeys.DELETIONS %>', form: document.fm1, incompleteProcessMessageNode: '#incompleteProcessMessage', locale: '<%= locale.toLanguageTag() %>', namespace: '', processesNode: '#publishProcesses', processesResourceURL: '<%= HtmlUtil.escapeJS(publishProcessesURL.toString()) %>', rangeAllNode: '#rangeAll', rangeDateRangeNode: '#rangeDateRange', rangeLastNode: '#rangeLast', rangeLastPublishNode: '#rangeLastPublish', ratingsNode: '#<%= PortletDataHandlerKeys.RATINGS %>', timeZoneOffset: <%= timeZoneOffset %>, }); Liferay.component('ExportImportComponent', exportImport); function copyFromLive() { var exportImport = Liferay.component( 'ExportImportComponent' ); var dateChecker = exportImport.getDateRangeChecker(); if (dateChecker.validRange) { Liferay.Util.openConfirmModal({ message: '<%= UnicodeLanguageUtil.get(request, "are-you-sure-you-want-to-copy-from-live-and-update-the-existing-staging-widget-information") %>', onConfirm: (isConfirmed) => { if (isConfirmed) { document.fm1.<%= Constants.CMD %>.value = 'copy_from_live'; submitForm(document.fm1); } }, }); } else { exportImport.showNotification(dateChecker); } } function publishToLive() { var exportImport = Liferay.component( 'ExportImportComponent' ); var dateChecker = exportImport.getDateRangeChecker(); if (dateChecker.validRange) { Liferay.Util.openConfirmModal({ message: '<%= UnicodeLanguageUtil.get(request, "are-you-sure-you-want-to-publish-to-live-and-update-the-existing-application-data") %>', onConfirm: (isConfirmed) => { if (isConfirmed) { submitForm(document.fm1); } }, }); } else { exportImport.showNotification(dateChecker); } } Liferay.Util.toggleRadio( 'portletMetaDataFilter', 'portletMetaDataList' ); Liferay.Util.toggleRadio('portletMetaDataAll', '', [ 'portletMetaDataList', ]); Liferay.Util.toggleRadio('rangeAll', '', [ 'startEndDate', 'rangeLastInputs', ]); Liferay.Util.toggleRadio( 'rangeDateRange', 'startEndDate', 'rangeLastInputs' ); Liferay.Util.toggleRadio('rangeLastPublish', '', [ 'startEndDate', 'rangeLastInputs', ]); Liferay.Util.toggleRadio( 'rangeLast', 'rangeLastInputs', ['startEndDate'] );




© 2015 - 2024 Weber Informatics LLC | Privacy Policy