META-INF.resources.publish.publish_layouts_scheduler.jspf Maven / Gradle / Ivy
<%--
/**
* 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
*/
--%>
-
function schedulePublishEvent() {
var exportImport = Liferay.component(
' ExportImportComponent'
);
var deletePortletDataBeforeImportingCheckbox = document.getElementById(
' <%= PortletDataHandlerKeys.DELETE_PORTLET_DATA %>'
);
var dateChecker = exportImport.getDateRangeChecker();
var rangeEndsLater = false;
var schedulerEndBy = document.getElementById(
' schedulerEndBy'
);
if (schedulerEndBy && schedulerEndBy.checked) {
var endDate = Liferay.component(
' schedulerEndDateDatePicker'
);
var endTime = Liferay.component(
' schedulerEndTimeTimePicker'
);
var startDate = Liferay.component(
' schedulerStartDateDatePicker'
);
var startTime = Liferay.component(
' schedulerStartTimeTimePicker'
);
if (endDate && endTime && startDate && startTime) {
if (
endDate.getDate().toISOString() <
startDate.getDate().toISOString()
) {
rangeEndsLater = true;
}
if (
endTime.getTime().toISOString() <
startTime.getTime().toISOString()
) {
rangeEndsLater = true;
}
}
}
if (!rangeEndsLater) {
if (
deletePortletDataBeforeImportingCheckbox &&
deletePortletDataBeforeImportingCheckbox.checked
) {
Liferay.Util.openConfirmModal({
message:
'<%= UnicodeLanguageUtil.get(request, "delete-application-data-before-importing-confirmation") %>',
onConfirm: (isConfirmed) => {
if (isConfirmed) {
Liferay.Util.postForm(
document. publishPagesFm,
{
data: {
<%= Constants.CMD %>: '<%= scheduleCMD %>',
redirect: '<%= scheduledEventsURL %>',
},
}
);
}
},
});
}
else {
Liferay.Util.postForm(
document. publishPagesFm,
{
data: {
<%= Constants.CMD %>: '<%= scheduleCMD %>',
redirect: '<%= scheduledEventsURL %>',
},
}
);
}
}
else {
exportImport.showNotification(dateChecker, rangeEndsLater);
}
}
function unschedulePublishEvent(jobName) {
Liferay.Util.openConfirmModal({
message:
'<%= UnicodeLanguageUtil.get(request, "are-you-sure-you-want-to-delete-the-scheduled-event") %>',
onConfirm: (isConfirmed) => {
if (isConfirmed) {
Liferay.Util.postForm(
document. exportPagesFm,
{
data: {
<%= Constants.CMD %>: '<%= unscheduleCMD %>',
jobName: jobName,
redirect: '<%= scheduledEventsURL %>',
},
}
);
}
},
});
}