META-INF.resources.view.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.staging.configuration.web
Show all versions of com.liferay.staging.configuration.web
Liferay Staging Configuration Web
<%--
/**
* 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" %>
<%
GroupDisplayContextHelper groupDisplayContextHelper = new GroupDisplayContextHelper(request);
liveGroup = groupDisplayContextHelper.getLiveGroup();
liveGroupId = groupDisplayContextHelper.getLiveGroupId();
UnicodeProperties liveGroupTypeSettingsUnicodeProperties = liveGroup.getTypeSettingsProperties();
LayoutSet privateLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet(liveGroup.getGroupId(), true);
LayoutSet publicLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet(liveGroup.getGroupId(), false);
boolean liveGroupRemoteStaging = liveGroup.hasRemoteStagingGroup() && PropsValues.STAGING_LIVE_GROUP_REMOTE_STAGING_ENABLED;
boolean stagedLocally = liveGroup.isStaged() && !liveGroup.isStagedRemotely();
boolean stagedRemotely = liveGroup.isStaged() && !stagedLocally;
if (stagedLocally) {
stagingGroup = liveGroup.getStagingGroup();
stagingGroupId = stagingGroup.getGroupId();
}
BackgroundTask lastCompletedInitialPublicationBackgroundTask = BackgroundTaskManagerUtil.fetchFirstBackgroundTask(liveGroupId, BackgroundTaskExecutorNames.LAYOUT_STAGING_BACKGROUND_TASK_EXECUTOR, true, BackgroundTaskCreateDateComparator.getInstance(false));
%>
<%@ include file="/staging_configuration_exceptions.jspf" %>
<%@ include file="/staging_configuration_select_staging_type.jspf" %>
<%@ include file="/staging_configuration_remote_options.jspf" %>
<%@ include file="/staging_configuration_staged_portlets.jspf" %>
var pwcWarning = document.getElementById(' pwcWarning');
var remoteStagingOptions = document.getElementById(
' remoteStagingOptions'
);
var stagedPortlets = document.getElementById(
' stagedPortlets'
);
var trashWarning = document.getElementById(' trashWarning');
var stagingTypes = document.getElementById(' stagingTypes');
if (
stagingTypes &&
pwcWarning &&
stagedPortlets &&
remoteStagingOptions &&
trashWarning
) {
Liferay.Util.delegate(stagingTypes, 'click', 'input', (event) => {
var value = event.target.closest('input').value;
if (value != '<%= StagingConstants.TYPE_LOCAL_STAGING %>') {
pwcWarning.classList.add('hide');
}
else {
pwcWarning.classList.remove('hide');
}
if (value == '<%= StagingConstants.TYPE_NOT_STAGED %>') {
stagedPortlets.classList.add('hide');
}
else {
stagedPortlets.classList.remove('hide');
}
if (value != '<%= StagingConstants.TYPE_REMOTE_STAGING %>') {
remoteStagingOptions.classList.add('hide');
}
else {
remoteStagingOptions.classList.remove('hide');
}
if (value != '<%= StagingConstants.TYPE_LOCAL_STAGING %>') {
trashWarning.classList.add('hide');
}
else {
trashWarning.classList.remove('hide');
}
});
}
function saveGroup(forceDisable) {
var form = document. fm;
var ok = true;
function doSubmit() {
if (forceDisable) {
form.elements[' forceDisable'].value = true;
form.elements[' stagingType'].value =
<%= StagingConstants.TYPE_NOT_STAGED %>;
}
submitForm(form);
}
var oldValue;
oldValue = <%= StagingConstants.TYPE_LOCAL_STAGING %>;
oldValue = <%= StagingConstants.TYPE_REMOTE_STAGING %>;
oldValue = <%= StagingConstants.TYPE_NOT_STAGED %>;
var selectedStagingTypeInput = document.querySelector(
'input[name= stagingType]:checked'
);
if (forceDisable || selectedStagingTypeInput) {
var currentValue = selectedStagingTypeInput.value;
if (forceDisable) {
currentValue = <%= StagingConstants.TYPE_NOT_STAGED %>;
}
if (currentValue != oldValue) {
if (currentValue == <%= StagingConstants.TYPE_NOT_STAGED %>) {
Liferay.Util.openConfirmModal({
message:
'<%= UnicodeLanguageUtil.format(request, "are-you-sure-you-want-to-deactivate-staging-for-x", liveGroup.getDescriptiveName(locale), false) %>',
onConfirm: (isConfirmed) => {
if (isConfirmed) {
doSubmit();
}
},
});
}
else if (
currentValue == <%= StagingConstants.TYPE_LOCAL_STAGING %>
) {
Liferay.Util.openConfirmModal({
message:
'<%= UnicodeLanguageUtil.format(request, "are-you-sure-you-want-to-activate-local-staging-for-x", liveGroup.getDescriptiveName(locale), false) %>',
onConfirm: (isConfirmed) => {
if (isConfirmed) {
doSubmit();
}
},
});
}
else if (
currentValue == <%= StagingConstants.TYPE_REMOTE_STAGING %>
) {
Liferay.Util.openConfirmModal({
message:
'<%= UnicodeLanguageUtil.format(request, "are-you-sure-you-want-to-activate-remote-staging-for-x", liveGroup.getDescriptiveName(locale), false) %>',
onConfirm: (isConfirmed) => {
if (isConfirmed) {
doSubmit();
}
},
});
}
}
}
}
(function () {
var allCheckboxes = document.querySelectorAll(
'#stagingConfigurationControls input[type=checkbox]'
);
var selectAllCheckbox = document.getElementById(
' selectAllCheckbox'
);
if (selectAllCheckbox) {
selectAllCheckbox.addEventListener('change', () => {
Array.prototype.forEach.call(allCheckboxes, (checkbox) => {
checkbox.checked = selectAllCheckbox.checked;
});
});
}
})();