alert template schedule pandora_enterprise#3943

This commit is contained in:
Daniel Barbero Martin 2022-02-02 10:09:31 +01:00
parent b91109d747
commit 5060d0b8f7
3 changed files with 62 additions and 23 deletions

View File

@ -37,7 +37,9 @@ enterprise_include_once('meta/include/functions_alerts_meta.php');
check_login();
enterprise_hook('open_meta_frame');
if (is_metaconsole() === true) {
enterprise_hook('open_meta_frame');
}
if (! check_acl($config['id_user'], 0, 'LM')) {
db_pandora_audit(
@ -48,11 +50,11 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
exit;
}
$duplicate_template = (bool) get_parameter('duplicate_template');
$id = (int) get_parameter('id');
$pure = get_parameter('pure', 0);
$step = (int) get_parameter('step', 1);
// We set here the number of steps.
if (defined('LAST_STEP') === false) {
define('LAST_STEP', 3);
@ -229,6 +231,14 @@ if ($duplicate_template) {
}
/**
* Build navbar steps.
*
* @param integer $step Step.
* @param integer $id Id template.
*
* @return void Html output.
*/
function print_alert_template_steps($step, $id)
{
echo '<ol class="steps">';
@ -307,13 +317,20 @@ function print_alert_template_steps($step, $id)
}
/**
* Update template
*
* @param integer $step Step.
*
* @return boolean result to update.
*/
function update_template($step)
{
global $config;
$id = (int) get_parameter('id');
if (empty($id)) {
if (empty($id) === true) {
return false;
}
@ -330,7 +347,7 @@ function update_template($step)
$priority = (int) get_parameter('priority');
$id_group = get_parameter('id_group');
// Only for Metaconsole. Save the previous name for synchronizing.
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$previous_name = db_get_value('name', 'talert_templates', 'id', $id);
} else {
$previous_name = '';
@ -391,7 +408,7 @@ function update_template($step)
$recovery_notify = (bool) get_parameter('recovery_notify');
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter('field'.$i);
$values['field'.$i.'_recovery'] = $recovery_notify ? (string) get_parameter('field'.$i.'_recovery') : '';
$values['field'.$i.'_recovery'] = ($recovery_notify) ? (string) get_parameter('field'.$i.'_recovery') : '';
}
$values['recovery_notify'] = $recovery_notify;
@ -1216,7 +1233,9 @@ if (!$disabled) {
echo '</div>';
echo '</form>';
enterprise_hook('close_meta_frame');
if (is_metaconsole() === true) {
enterprise_hook('close_meta_frame');
}
ui_require_javascript_file('pandora_alerts');
ui_include_time_picker();
@ -1495,7 +1514,6 @@ if ($step == 2) {
eventsBBDD = '<?php echo json_encode($default_events_calendar); ?>';
}
console.log(eventsBBDD);
var events = loadEventBBDD(eventsBBDD);
var calendarEl = document.getElementById('calendar_map');
var settings = {

View File

@ -21,11 +21,11 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
slotDuration: "01:00:00",
slotLabelInterval: "02:00:00",
snapDuration: "01:00:00",
slotLabelFormat: {
hour: "numeric",
minute: "2-digit",
hour12: false
},
//slotLabelFormat: {
// hour: "numeric",
// minute: "2-digit",
// hour12: false
//},
slotMinTime: "00:00:00",
slotMaxTime: "24:00:00",
scrollTime: "01:00:00",
@ -42,6 +42,8 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
dayMaxEvents: 3,
events: initialEvents,
defaultAllDay: false,
displayEventTime: true,
displayEventEnd: true,
select: function(info) {
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
if (
@ -322,9 +324,14 @@ function recalculate_events(calendar, newEvent, from, to, create) {
}
});
var title = "";
if (time_format(from) === "00:00:00" && time_format(to) === "00:00:00") {
title = "All day";
}
if (create === true) {
calendar.addEvent({
title: "",
title: title,
start: from,
end: to,
id: uniqId()
@ -413,6 +420,14 @@ function loadEventBBDD(events) {
if (event != null) {
var time_from = event.start.split(":");
var time_to = event.end.split(":");
var start = dates[day_string].setHours(
time_from[0],
time_from[1],
time_from[2],
0
);
var end = dates[day_string].setHours(
time_to[0],
time_to[1],
@ -427,14 +442,18 @@ function loadEventBBDD(events) {
0
);
}
var title = "";
if (
time_format(start) === "00:00:00" &&
time_format(end) === "00:00:00"
) {
title = "All day";
}
result.push({
title: "",
start: dates[day_string].setHours(
time_from[0],
time_from[1],
time_from[2],
0
),
title: title,
start: start,
end: end,
id: uniqId()
});

View File

@ -8475,15 +8475,17 @@ div#err_msg_centralised {
}
.tooltipevent {
width: 70px;
background: #fff;
position: absolute;
z-index: 10001;
top: 20px;
left: 20px;
top: 0px;
right: 0px;
border: 2px solid #82b92e;
border-radius: 5px;
padding: 5px;
width: 70px;
overflow-wrap: break-word;
white-space: pre-wrap;
}
#select_multiple_modules_filtered > div {