alert template schedule pandora_enterprise#3943

This commit is contained in:
Daniel Barbero Martin 2022-02-01 16:50:53 +01:00
parent a7da2faa32
commit b62566af49
2 changed files with 66 additions and 5 deletions

View File

@ -58,6 +58,52 @@ if (defined('LAST_STEP') === false) {
define('LAST_STEP', 3);
}
// Default events calendar.
$default_events_calendar = [
'monday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
'tuesday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
'wednesday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
'thursday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
'friday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
'saturday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
'sunday' => [
[
'start' => '00:00:00',
'end' => '00:00:00',
],
],
];
if ($duplicate_template === true) {
$source_id = (int) get_parameter('source_id');
$a_template = alerts_get_alert_template($source_id);
@ -417,7 +463,9 @@ $value = '';
$max = '';
$min = '';
$schedule = null;
$schedule = json_encode(
$default_events_calendar
);
$special_day = 0;
$default_action = 0;
$fields = [];
@ -463,6 +511,7 @@ if ($create_template) {
'matches_value' => $matches,
'priority' => $priority,
'wizard_level' => $wizard_level,
'schedule' => $schedule,
];
if ($config['dbtype'] == 'oracle') {
@ -1442,6 +1491,11 @@ if ($step == 2) {
});
var eventsBBDD = $("#hidden-schedule").val();
if(eventsBBDD === '') {
eventsBBDD = '<?php echo json_encode($default_events_calendar); ?>';
}
console.log(eventsBBDD);
var events = loadEventBBDD(eventsBBDD);
var calendarEl = document.getElementById('calendar_map');
var settings = {
@ -1458,6 +1512,8 @@ if ($step == 2) {
userLanguage: '<?php echo get_user_language(); ?>',
loadingText: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
tooltipText: '<?php echo __('Drag out to remove'); ?>',
simple: '<?php echo __('Simple'); ?>',
detailed: '<?php echo __('Detailed'); ?>',
}
var calendar = fullCalendarPandora(calendarEl, settings, events);

View File

@ -2,14 +2,19 @@
// eslint-disable-next-line no-unused-vars
function fullCalendarPandora(calendarEl, settings, initialEvents) {
var calendar = new FullCalendar.Calendar(calendarEl, {
height: 625,
//height: 200,
contentHeight: "auto",
headerToolbar: {
left: "",
center: "",
right: ""
right: "timeGridWeek,dayGridWeek"
},
buttonText: {
dayGridWeek: settings.simple,
timeGridWeek: settings.detailed
},
dayHeaderFormat: { weekday: "short" },
initialView: "timeGridWeek",
initialView: "dayGridWeek",
navLinks: false,
selectable: true,
selectMirror: true,
@ -34,7 +39,7 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
},
eventColor: "#82b92e",
editable: true,
dayMaxEvents: false,
dayMaxEvents: 3,
events: initialEvents,
defaultAllDay: false,
select: function(info) {