special days template alerts
This commit is contained in:
parent
dfede4de78
commit
c2cce3990a
|
@ -1,18 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Special days.
|
||||||
|
*
|
||||||
|
* @category Alerts
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
// Load global vars.
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Copyright (c) 2012-2016 Junichi Satoh
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once 'include/functions_alerts.php';
|
require_once 'include/functions_alerts.php';
|
||||||
|
@ -29,18 +43,198 @@ if (! check_acl($config['id_user'], 0, 'LM')) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax() === true) {
|
||||||
$get_alert_command = (bool) get_parameter('get_alert_command');
|
$get_alert_command = (bool) get_parameter('get_alert_command');
|
||||||
if ($get_alert_command) {
|
if ($get_alert_command === true) {
|
||||||
$id = (int) get_parameter('id');
|
$id = (int) get_parameter('id');
|
||||||
$command = alerts_get_alert_command($id);
|
$command = alerts_get_alert_command($id);
|
||||||
echo json_encode($command);
|
echo json_encode($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$get_template_alerts = (bool) get_parameter('get_template_alerts');
|
||||||
|
if ($get_template_alerts === true) {
|
||||||
|
$filter['special_day'] = 1;
|
||||||
|
$templates = alerts_get_alert_templates($filter);
|
||||||
|
$date = get_parameter('date', '');
|
||||||
|
$id_group = get_parameter('id_group', 0);
|
||||||
|
$same_day = get_parameter('same_day', '');
|
||||||
|
|
||||||
|
echo '<h4>'.__('Same as %s', ucfirst($same_day));
|
||||||
|
echo ' » ';
|
||||||
|
echo __('Templates not being fired');
|
||||||
|
echo '</h4>';
|
||||||
|
|
||||||
|
$columns = [
|
||||||
|
'name',
|
||||||
|
'id_group',
|
||||||
|
'type',
|
||||||
|
'monday',
|
||||||
|
'tuesday',
|
||||||
|
'wednesday',
|
||||||
|
'thursday',
|
||||||
|
'friday',
|
||||||
|
'saturday',
|
||||||
|
'sunday',
|
||||||
|
];
|
||||||
|
|
||||||
|
$column_names = [
|
||||||
|
__('Name'),
|
||||||
|
__('Group'),
|
||||||
|
__('Type'),
|
||||||
|
__('Mon'),
|
||||||
|
__('Tue'),
|
||||||
|
__('Wed'),
|
||||||
|
__('Thu'),
|
||||||
|
__('Fri'),
|
||||||
|
__('Sat'),
|
||||||
|
__('Sun'),
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
ui_print_datatable(
|
||||||
|
[
|
||||||
|
'id' => 'templates_alerts_special_days',
|
||||||
|
'return' => false,
|
||||||
|
'class' => 'info_table',
|
||||||
|
'style' => 'width: 100%',
|
||||||
|
'columns' => $columns,
|
||||||
|
'column_names' => $column_names,
|
||||||
|
'ajax_url' => 'godmode/alerts/alert_special_days',
|
||||||
|
'ajax_data' => [
|
||||||
|
'get_template_alerts_data' => 1,
|
||||||
|
'same_day' => $same_day,
|
||||||
|
],
|
||||||
|
'no_sortable_columns' => [-1],
|
||||||
|
'order' => [
|
||||||
|
'field' => 'name',
|
||||||
|
'direction' => 'asc',
|
||||||
|
],
|
||||||
|
'search_button_class' => 'sub filter float-right',
|
||||||
|
'form' => [
|
||||||
|
'inputs' => [
|
||||||
|
[
|
||||||
|
'label' => __('Type'),
|
||||||
|
'type' => 'select',
|
||||||
|
'name' => 'type',
|
||||||
|
'fields' => alerts_get_alert_templates_types(),
|
||||||
|
'selected' => 0,
|
||||||
|
'nothing' => 'None',
|
||||||
|
'nothing_value' => 0,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => __('Search'),
|
||||||
|
'type' => 'text',
|
||||||
|
'class' => 'mw250px',
|
||||||
|
'id' => 'name',
|
||||||
|
'name' => 'name',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$get_template_alerts_data = (bool) get_parameter('get_template_alerts_data');
|
||||||
|
if ($get_template_alerts_data === true) {
|
||||||
|
$filters = get_parameter('filter', []);
|
||||||
|
if (empty($filters['type']) === false) {
|
||||||
|
$filter['type'] = $filters['type'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($filters['name']) === false) {
|
||||||
|
$filter[] = "name LIKE '%".$filters['name']."%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$filter['special_day'] = 1;
|
||||||
|
|
||||||
|
$templates = alerts_get_alert_templates($filter);
|
||||||
|
$count = alerts_get_alert_templates($filter, ['COUNT(*) AS total']);
|
||||||
|
|
||||||
|
$same_day = get_parameter('same_day', '');
|
||||||
|
$data = [];
|
||||||
|
if (empty($templates) === false) {
|
||||||
|
foreach ($templates as $template) {
|
||||||
|
if ((bool) $template[$same_day] === true) {
|
||||||
|
$data[] = [
|
||||||
|
'name' => $template['name'],
|
||||||
|
'id_group' => ui_print_group_icon(
|
||||||
|
$template['id_group'],
|
||||||
|
true
|
||||||
|
),
|
||||||
|
'type' => $template['type'],
|
||||||
|
'monday' => (bool) $template['monday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
'tuesday' => (bool) $template['tuesday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
'wednesday' => (bool) $template['wednesday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
'thursday' => (bool) $template['thursday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
'friday' => (bool) $template['friday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
'saturday' => (bool) $template['saturday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
'sunday' => (bool) $template['sunday'] === true
|
||||||
|
? html_print_image(
|
||||||
|
'images/tick.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
)
|
||||||
|
: '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode(
|
||||||
|
[
|
||||||
|
'data' => $data,
|
||||||
|
'recordsTotal' => $count[0]['total'],
|
||||||
|
'recordsFiltered' => count($data),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header
|
// Header.
|
||||||
ui_print_page_header(
|
ui_print_page_header(
|
||||||
__('Alerts').' » '.__('Special days list'),
|
__('Alerts').' » '.__('Special days list'),
|
||||||
'images/gm_alerts.png',
|
'images/gm_alerts.png',
|
||||||
|
@ -55,7 +249,11 @@ $delete_special_day = (bool) get_parameter('delete_special_day');
|
||||||
$upload_ical = (bool) get_parameter('upload_ical', 0);
|
$upload_ical = (bool) get_parameter('upload_ical', 0);
|
||||||
$display_range = (int) get_parameter('display_range');
|
$display_range = (int) get_parameter('display_range');
|
||||||
|
|
||||||
if ($upload_ical) {
|
$url = 'index.php?sec=galertas&sec2=godmode/alerts/alert_special_days';
|
||||||
|
$url_alert = 'index.php?sec=galertas&sec2=';
|
||||||
|
$url_alert .= 'godmode/alerts/configure_alert_special_days';
|
||||||
|
|
||||||
|
if ($upload_ical === true) {
|
||||||
$same_day = (string) get_parameter('same_day');
|
$same_day = (string) get_parameter('same_day');
|
||||||
$overwrite = (bool) get_parameter('overwrite', 0);
|
$overwrite = (bool) get_parameter('overwrite', 0);
|
||||||
$values = [];
|
$values = [];
|
||||||
|
@ -67,7 +265,6 @@ if ($upload_ical) {
|
||||||
|
|
||||||
if ($error == 0 && strcasecmp($extension, 'ics') == 0) {
|
if ($error == 0 && strcasecmp($extension, 'ics') == 0) {
|
||||||
$skipped_dates = '';
|
$skipped_dates = '';
|
||||||
// $today = date ('Ymd');
|
|
||||||
$this_month = date('Ym');
|
$this_month = date('Ym');
|
||||||
$ical = new ICal($_FILES['ical_file']['tmp_name']);
|
$ical = new ICal($_FILES['ical_file']['tmp_name']);
|
||||||
$events = $ical->events();
|
$events = $ical->events();
|
||||||
|
@ -81,11 +278,22 @@ if ($upload_ical) {
|
||||||
$date_check = '';
|
$date_check = '';
|
||||||
$filter['id_group'] = $values['id_group'];
|
$filter['id_group'] = $values['id_group'];
|
||||||
$filter['date'] = $date;
|
$filter['date'] = $date;
|
||||||
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
|
$date_check = db_get_value_filter(
|
||||||
|
'date',
|
||||||
|
'talert_special_days',
|
||||||
|
$filter
|
||||||
|
);
|
||||||
if ($date_check == $date) {
|
if ($date_check == $date) {
|
||||||
if ($overwrite) {
|
if ($overwrite) {
|
||||||
$id_special_day = db_get_value_filter('id', 'talert_special_days', $filter);
|
$id_special_day = db_get_value_filter(
|
||||||
alerts_update_alert_special_day($id_special_day, $values);
|
'id',
|
||||||
|
'talert_special_days',
|
||||||
|
$filter
|
||||||
|
);
|
||||||
|
alerts_update_alert_special_day(
|
||||||
|
$id_special_day,
|
||||||
|
$values
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($skipped_dates == '') {
|
if ($skipped_dates == '') {
|
||||||
$skipped_dates = __('Skipped dates: ');
|
$skipped_dates = __('Skipped dates: ');
|
||||||
|
@ -104,19 +312,28 @@ if ($upload_ical) {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result === true) {
|
||||||
db_pandora_audit('Special days list', 'Upload iCalendar '.$_FILES['ical_file']['name']);
|
db_pandora_audit(
|
||||||
|
'Special days list',
|
||||||
|
'Upload iCalendar '.$_FILES['ical_file']['name']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message($result, __('Success to upload iCalendar').'<br />'.$skipped_dates, __('Fail to upload iCalendar'));
|
ui_print_result_message(
|
||||||
|
$result,
|
||||||
|
__('Success to upload iCalendar').'<br />'.$skipped_dates,
|
||||||
|
__('Fail to upload iCalendar')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($create_special_day) {
|
if ($create_special_day === true) {
|
||||||
$date = (string) get_parameter('date');
|
$date = (string) get_parameter('date');
|
||||||
$same_day = (string) get_parameter('same_day');
|
$same_day = (string) get_parameter('same_day');
|
||||||
$values = [];
|
$values = [];
|
||||||
$values['id_group'] = (string) get_parameter('id_group');
|
$values['id_group'] = (string) get_parameter('id_group');
|
||||||
$values['description'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
|
$values['description'] = io_safe_input(
|
||||||
|
strip_tags(io_safe_output((string) get_parameter('description')))
|
||||||
|
);
|
||||||
|
|
||||||
$aviable_description = true;
|
$aviable_description = true;
|
||||||
if (preg_match('/script/i', $values['description'])) {
|
if (preg_match('/script/i', $values['description'])) {
|
||||||
|
@ -130,7 +347,6 @@ if ($create_special_day) {
|
||||||
$day = $array_date[2];
|
$day = $array_date[2];
|
||||||
|
|
||||||
if ($year == '*') {
|
if ($year == '*') {
|
||||||
// '0001' means every year.
|
|
||||||
$year = '0001';
|
$year = '0001';
|
||||||
$date = $year.'-'.$month.'-'.$day;
|
$date = $year.'-'.$month.'-'.$day;
|
||||||
}
|
}
|
||||||
|
@ -138,17 +354,28 @@ if ($create_special_day) {
|
||||||
if (!checkdate($month, $day, $year)) {
|
if (!checkdate($month, $day, $year)) {
|
||||||
$result = '';
|
$result = '';
|
||||||
} else {
|
} else {
|
||||||
$date_check = '';
|
|
||||||
$filter['id_group'] = $values['id_group'];
|
$filter['id_group'] = $values['id_group'];
|
||||||
|
$filter['same_day'] = $same_day;
|
||||||
$filter['date'] = $date;
|
$filter['date'] = $date;
|
||||||
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
|
$date_check = db_get_value_filter(
|
||||||
|
'date',
|
||||||
|
'talert_special_days',
|
||||||
|
$filter
|
||||||
|
);
|
||||||
|
|
||||||
if ($date_check == $date) {
|
if ($date_check == $date) {
|
||||||
$result = '';
|
$result = '';
|
||||||
$messageAction = __('Could not be created, it already exists');
|
$messageAction = __('Could not be created, it already exists');
|
||||||
} else {
|
} else {
|
||||||
if ($aviable_description) {
|
if ($aviable_description === true) {
|
||||||
$result = alerts_create_alert_special_day($date, $same_day, $values);
|
$result = alerts_create_alert_special_day(
|
||||||
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$values['description'].'"}';
|
$date,
|
||||||
|
$same_day,
|
||||||
|
$values
|
||||||
|
);
|
||||||
|
$info = '{"Date":"'.$date;
|
||||||
|
$info .= '","Same day of the week":"'.$same_day;
|
||||||
|
$info .= '","Description":"'.$values['description'].'"}';
|
||||||
} else {
|
} else {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
|
@ -156,14 +383,24 @@ if ($create_special_day) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Command management', 'Create special day '.$result, false, false, $info);
|
db_pandora_audit(
|
||||||
|
'Command management',
|
||||||
|
'Create special day '.$result,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Command management', 'Fail try to create special day', false, false);
|
db_pandora_audit(
|
||||||
|
'Command management',
|
||||||
|
'Fail try to create special day',
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show errors.
|
||||||
// Show errors
|
if (isset($messageAction) === false) {
|
||||||
if (!isset($messageAction)) {
|
|
||||||
$messageAction = __('Could not be created');
|
$messageAction = __('Could not be created');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +411,7 @@ if ($create_special_day) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update_special_day) {
|
if ($update_special_day === true) {
|
||||||
$id = (int) get_parameter('id');
|
$id = (int) get_parameter('id');
|
||||||
$alert = alerts_get_alert_special_day($id);
|
$alert = alerts_get_alert_special_day($id);
|
||||||
$date = (string) get_parameter('date');
|
$date = (string) get_parameter('date');
|
||||||
|
@ -210,37 +447,43 @@ if ($update_special_day) {
|
||||||
if (!checkdate($month, $day, $year)) {
|
if (!checkdate($month, $day, $year)) {
|
||||||
$result = '';
|
$result = '';
|
||||||
} else {
|
} else {
|
||||||
if ($id_group != $id_group_orig || $date != $date_orig) {
|
$filter['id_group'] = $id_group;
|
||||||
$date_check = '';
|
$filter['date'] = $date;
|
||||||
$filter['id_group'] = $id_group;
|
$filter['same_day'] = $same_day;
|
||||||
$filter['date'] = $date;
|
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
|
||||||
$date_check = db_get_value_filter('date', 'talert_special_days', $filter);
|
if ($date_check == $date) {
|
||||||
if ($date_check == $date) {
|
$result = '';
|
||||||
$result = '';
|
$messageAction = __('Could not be updated, it already exists');
|
||||||
$messageAction = __('Could not be updated, it already exists');
|
|
||||||
} else {
|
|
||||||
if ($aviable_description !== false) {
|
|
||||||
$result = alerts_update_alert_special_day($id, $values);
|
|
||||||
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($aviable_description !== false) {
|
if ($aviable_description !== false) {
|
||||||
$result = alerts_update_alert_special_day($id, $values);
|
$result = alerts_update_alert_special_day($id, $values);
|
||||||
$info = '{"Date":"'.$date.'","Same day of the week":"'.$same_day.'","Description":"'.$description.'"}';
|
$info = '{"Date":"'.$date;
|
||||||
|
$info .= '","Same day of the week":"'.$same_day;
|
||||||
|
$info .= '","Description":"'.$description.'"}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Command management', 'Update special day '.$id, false, false, $info);
|
db_pandora_audit(
|
||||||
|
'Command management',
|
||||||
|
'Update special day '.$id,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$info
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Command management', 'Fail to update special day '.$id, false, false);
|
db_pandora_audit(
|
||||||
|
'Command management',
|
||||||
|
'Fail to update special day '.$id,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Show errors
|
// Show errors.
|
||||||
if (!isset($messageAction)) {
|
if (isset($messageAction) === false) {
|
||||||
$messageAction = __('Could not be updated');
|
$messageAction = __('Could not be updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,15 +494,21 @@ if ($update_special_day) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($delete_special_day) {
|
if ($delete_special_day === true) {
|
||||||
$id = (int) get_parameter('id');
|
$id = (int) get_parameter('id');
|
||||||
|
|
||||||
$result = alerts_delete_alert_special_day($id);
|
$result = alerts_delete_alert_special_day($id);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit('Command management', 'Delete special day '.$id);
|
db_pandora_audit(
|
||||||
|
'Command management',
|
||||||
|
'Delete special day '.$id
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
db_pandora_audit('Command management', 'Fail to delete special day '.$id);
|
db_pandora_audit(
|
||||||
|
'Command management',
|
||||||
|
'Fail to delete special day '.$id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message(
|
ui_print_result_message(
|
||||||
|
@ -272,7 +521,7 @@ if ($delete_special_day) {
|
||||||
|
|
||||||
echo "<table cellpadding='4' cellspacing='4' class='databox upload bolder margin-bottom-10' width='100%
|
echo "<table cellpadding='4' cellspacing='4' class='databox upload bolder margin-bottom-10' width='100%
|
||||||
'><tr>";
|
'><tr>";
|
||||||
echo "<form method='post' enctype='multipart/form-data' action='index.php?sec=gagente&sec2=godmode/alerts/alert_special_days'>";
|
echo "<form id='icalendar-special-days' method='post' enctype='multipart/form-data' action='index.php?sec=gagente&sec2=godmode/alerts/alert_special_days'>";
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo __('iCalendar(.ics) file').' ';
|
echo __('iCalendar(.ics) file').' ';
|
||||||
html_print_input_file('ical_file', false, false);
|
html_print_input_file('ical_file', false, false);
|
||||||
|
@ -297,16 +546,34 @@ if (!users_can_manage_group_all('LM')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="inline w250px">';
|
echo '<div class="inline w250px">';
|
||||||
html_print_select_groups(false, 'LM', $can_manage_group_all, 'id_group', $id_group, false, '', 0, false, false, true, '', false, 'width:100px;');
|
html_print_select_groups(
|
||||||
|
false,
|
||||||
|
'LM',
|
||||||
|
$can_manage_group_all,
|
||||||
|
'id_group',
|
||||||
|
$id_group,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
'width:100px;'
|
||||||
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</td><td>';
|
echo '</td><td>';
|
||||||
echo __('Overwrite');
|
echo __('Overwrite');
|
||||||
ui_print_help_tip(__('Check this box, if you want to overwrite existing same days.'), false);
|
ui_print_help_tip(
|
||||||
|
__('Check this box, if you want to overwrite existing same days.'),
|
||||||
|
false
|
||||||
|
);
|
||||||
echo ' ';
|
echo ' ';
|
||||||
html_print_checkbox('overwrite', 1, $overwrite, false, false, false, true);
|
html_print_checkbox('overwrite', 1, $overwrite, false, false, false, true);
|
||||||
echo '</td><td>';
|
echo '</td><td>';
|
||||||
html_print_input_hidden('upload_ical', 1);
|
html_print_input_hidden('upload_ical', 1);
|
||||||
echo "<input name='srcbutton' type='submit' class='sub next' value='".__('Upload')."'>";
|
echo "<input id='srcbutton' name='srcbutton' type='submit' class='sub next' value='".__('Upload')."'>";
|
||||||
echo '</td></form>';
|
echo '</td></form>';
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
|
|
||||||
|
@ -322,28 +589,28 @@ if (!is_user_admin($config['id_user'])) {
|
||||||
// Show display range.
|
// Show display range.
|
||||||
$html = "<table cellpadding='4' cellspacing='4' width='100%' margin-bottom: 10px;'><tr><td>".__('Display range: ');
|
$html = "<table cellpadding='4' cellspacing='4' width='100%' margin-bottom: 10px;'><tr><td>".__('Display range: ');
|
||||||
if ($display_range) {
|
if ($display_range) {
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">['.__('Default').']</a> ';
|
$html .= '<a href="'.$url.'">['.__('Default').']</a> ';
|
||||||
if ($display_range > 1970) {
|
if ($display_range > 1970) {
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
|
$html .= '<a href="'.$url.'&display_range=';
|
||||||
$html .= ($display_range - 1);
|
$html .= ($display_range - 1);
|
||||||
$html .= '"><< </a>';
|
$html .= '"><< </a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range='.$display_range.'" class="bolder">['.$display_range.']</a>';
|
$html .= '<a href="'.$url.'&display_range='.$display_range.'" class="bolder">['.$display_range.']</a>';
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
|
$html .= '<a href="'.$url.'&display_range=';
|
||||||
$html .= ($display_range + 1);
|
$html .= ($display_range + 1);
|
||||||
$html .= '"> >></a>';
|
$html .= '"> >></a>';
|
||||||
} else {
|
} else {
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days" class="bolder">['.__('Default').']</a> ';
|
$html .= '<a href="'.$url.'" class="bolder">['.__('Default').']</a> ';
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
|
$html .= '<a href="'.$url.'&display_range=';
|
||||||
$html .= ($this_year - 1);
|
$html .= ($this_year - 1);
|
||||||
$html .= '"><< </a>';
|
$html .= '"><< </a>';
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
|
$html .= '<a href="'.$url.'&display_range=';
|
||||||
$html .= $this_year;
|
$html .= $this_year;
|
||||||
$html .= '">[';
|
$html .= '">[';
|
||||||
$html .= $this_year;
|
$html .= $this_year;
|
||||||
$html .= ']</a>';
|
$html .= ']</a>';
|
||||||
$html .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&display_range=';
|
$html .= '<a href="'.$url.'&display_range=';
|
||||||
$html .= ($this_year + 1);
|
$html .= ($this_year + 1);
|
||||||
$html .= '"> >></a>';
|
$html .= '"> >></a>';
|
||||||
}
|
}
|
||||||
|
@ -351,7 +618,7 @@ if ($display_range) {
|
||||||
$html .= '</td></tr>';
|
$html .= '</td></tr>';
|
||||||
echo $html;
|
echo $html;
|
||||||
|
|
||||||
// Show calendar
|
// Show calendar.
|
||||||
for ($month = 1; $month <= 12; $month++) {
|
for ($month = 1; $month <= 12; $month++) {
|
||||||
if ($display_range) {
|
if ($display_range) {
|
||||||
$display_month = $month;
|
$display_month = $month;
|
||||||
|
@ -363,7 +630,7 @@ for ($month = 1; $month <= 12; $month++) {
|
||||||
|
|
||||||
if ($display_month > 12) {
|
if ($display_month > 12) {
|
||||||
$display_month -= 12;
|
$display_month -= 12;
|
||||||
$display_year += 1;
|
$display_year++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cal_table = new stdClass();
|
$cal_table = new stdClass();
|
||||||
|
@ -439,6 +706,10 @@ for ($month = 1; $month <= 12; $month++) {
|
||||||
case 12:
|
case 12:
|
||||||
$cal_table->title = __('December');
|
$cal_table->title = __('December');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Not possible.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cal_table->title .= ' / '.$display_year;
|
$cal_table->title .= ' / '.$display_year;
|
||||||
|
@ -470,23 +741,42 @@ for ($month = 1; $month <= 12; $month++) {
|
||||||
$filter['order']['order'] = 'DESC';
|
$filter['order']['order'] = 'DESC';
|
||||||
$special_days = db_get_all_rows_filter('talert_special_days', $filter);
|
$special_days = db_get_all_rows_filter('talert_special_days', $filter);
|
||||||
|
|
||||||
if ($special_days != '') {
|
$cal_table->cellstyle[$cal_line][$week] .= 'font-size: 18px;';
|
||||||
foreach ($special_days as $special_day) {
|
$cal_table->data[$cal_line][$week] = $day.' ';
|
||||||
$cal_table->data[$cal_line][$week] .= '<div class="font_18px" style="';
|
|
||||||
if ($special_day['same_day'] == 'sunday' || $special_day['same_day'] == 'saturday') {
|
|
||||||
$cal_table->data[$cal_line][$week] .= 'color: red;';
|
|
||||||
}
|
|
||||||
|
|
||||||
$cal_table->data[$cal_line][$week] .= '">';
|
$cal_table->data[$cal_line][$week] .= '<a href="'.$url_alert.'&create_special_day=1&date='.$date.'" title=';
|
||||||
$cal_table->data[$cal_line][$week] .= $day;
|
$cal_table->data[$cal_line][$week] .= __('Create');
|
||||||
$cal_table->data[$cal_line][$week] .= '</div>';
|
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
||||||
$cal_table->data[$cal_line][$week] .= ui_print_group_icon($special_day['id_group'], true);
|
'images/add_mc.png',
|
||||||
|
true,
|
||||||
|
['class' => 'invert_filter']
|
||||||
|
).'</a>';
|
||||||
|
|
||||||
|
if (empty($special_days) === false) {
|
||||||
|
$cal_table->data[$cal_line][$week] .= '<br>';
|
||||||
|
foreach ($special_days as $special_day) {
|
||||||
|
// Only show description if is filled.
|
||||||
|
$cal_table->data[$cal_line][$week] .= '<div class="note-special-day">';
|
||||||
|
$cal_table->data[$cal_line][$week] .= '<div>';
|
||||||
|
$cal_table->data[$cal_line][$week] .= ui_print_group_icon(
|
||||||
|
$special_day['id_group'],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
if (empty($special_day['description']) === false) {
|
||||||
|
$cal_table->data[$cal_line][$week] .= ui_print_help_tip($special_day['description'], true);
|
||||||
|
}
|
||||||
|
|
||||||
if ($special_day['date'] == $date_wildcard) {
|
if ($special_day['date'] == $date_wildcard) {
|
||||||
$cal_table->data[$cal_line][$week] .= '('.ui_print_help_tip('This is valid every year. However, this will be ignored if indivisual setting for the same group is available.', true).') ';
|
$cal_table->data[$cal_line][$week] .= '(';
|
||||||
|
$cal_table->data[$cal_line][$week] .= ui_print_help_tip(
|
||||||
|
'This is valid every year. However, this will be ignored if indivisual setting for the same group is available.',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$cal_table->data[$cal_line][$week] .= ') ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$cal_table->data[$cal_line][$week] .= __('Same as ');
|
$cal_table->data[$cal_line][$week] .= __('As ');
|
||||||
switch ($special_day['same_day']) {
|
switch ($special_day['same_day']) {
|
||||||
case 'monday':
|
case 'monday':
|
||||||
$cal_table->data[$cal_line][$week] .= __('Monday');
|
$cal_table->data[$cal_line][$week] .= __('Monday');
|
||||||
|
@ -515,47 +805,41 @@ for ($month = 1; $month <= 12; $month++) {
|
||||||
case 'sunday':
|
case 'sunday':
|
||||||
$cal_table->data[$cal_line][$week] .= __('Sunday');
|
$cal_table->data[$cal_line][$week] .= __('Sunday');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Not possible.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show description if is filled.
|
$cal_table->data[$cal_line][$week] .= '</div>';
|
||||||
if (empty($special_day['description']) === false) {
|
$cal_table->data[$cal_line][$week] .= '<div>';
|
||||||
$cal_table->data[$cal_line][$week] .= ui_print_help_tip($special_day['description'], true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
|
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
|
||||||
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&id='.$special_day['id'].'" title=';
|
$cal_table->data[$cal_line][$week] .= '<a href="'.$url_alert.'&id='.$special_day['id'].'" title=';
|
||||||
$cal_table->data[$cal_line][$week] .= __('Edit');
|
$cal_table->data[$cal_line][$week] .= __('Edit');
|
||||||
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
||||||
'images/config.png',
|
'images/config.png',
|
||||||
true,
|
true,
|
||||||
['class' => 'invert_filter']
|
['class' => 'invert_filter']
|
||||||
).'</a> ';
|
).'</a> ';
|
||||||
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days&delete_special_day=1&id='.$special_day['id'].'"onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;" title=';
|
$url_delete = $url.'&delete_special_day=1&id='.$special_day['id'];
|
||||||
|
$script_delete = 'if (!confirm(\''.__('Are you sure?').'\')) return false;';
|
||||||
|
$cal_table->data[$cal_line][$week] .= '<a href="'.$url_delete.'"';
|
||||||
|
$cal_table->data[$cal_line][$week] .= ' onClick="'.$script_delete.'"';
|
||||||
|
$cal_table->data[$cal_line][$week] .= 'title="';
|
||||||
$cal_table->data[$cal_line][$week] .= __('Remove');
|
$cal_table->data[$cal_line][$week] .= __('Remove');
|
||||||
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
$cal_table->data[$cal_line][$week] .= '">';
|
||||||
|
$cal_table->data[$cal_line][$week] .= html_print_image(
|
||||||
'images/cross.png',
|
'images/cross.png',
|
||||||
true,
|
true,
|
||||||
['class' => 'invert_filter']
|
['class' => 'invert_filter']
|
||||||
).'</a>';
|
).'</a>';
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cal_table->data[$cal_line][$week] .= '<br>';
|
$cal_table->data[$cal_line][$week] .= '</div>';
|
||||||
$cal_table->cellstyle[$cal_line][$week] = 'font-weight: bold;';
|
$cal_table->data[$cal_line][$week] .= '</div>';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$cal_table->cellstyle[$cal_line][$week] .= 'font-size: 18px;';
|
|
||||||
$cal_table->data[$cal_line][$week] = $day.' ';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&create_special_day=1&date='.$date.'" title=';
|
|
||||||
$cal_table->data[$cal_line][$week] .= __('Create');
|
|
||||||
$cal_table->data[$cal_line][$week] .= '>'.html_print_image(
|
|
||||||
'images/add_mc.png',
|
|
||||||
true,
|
|
||||||
['class' => 'invert_filter']
|
|
||||||
).'</a>';
|
|
||||||
|
|
||||||
if ($week == 6) {
|
if ($week == 6) {
|
||||||
$cal_line++;
|
$cal_line++;
|
||||||
}
|
}
|
||||||
|
@ -570,8 +854,30 @@ for ($month = 1; $month <= 12; $month++) {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days">';
|
echo '<form method="post" action="'.$url_alert.'">';
|
||||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||||
html_print_input_hidden('create_special_day', 1);
|
html_print_input_hidden('create_special_day', 1);
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
echo '<div id="modal-alert-templates" class="invisible"></div>';
|
||||||
|
ui_require_javascript_file('pandora_alerts');
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready (function () {
|
||||||
|
$("#srcbutton").click (function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
load_templates_alerts_special_days({
|
||||||
|
date: '',
|
||||||
|
id_group: $("#id_group").val(),
|
||||||
|
same_day: $("#same_day").val(),
|
||||||
|
btn_ok_text: '<?php echo __('Create'); ?>',
|
||||||
|
btn_cancel_text: '<?php echo __('Cancel'); ?>',
|
||||||
|
title: '<?php echo __('Load calendar'); ?>',
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
page: "godmode/alerts/alert_special_days",
|
||||||
|
loading: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
||||||
|
name_form: 'icalendar-special-days'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -1,17 +1,31 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Special days.
|
||||||
|
*
|
||||||
|
* @category Alerts
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
// Pandora FMS - http://pandorafms.com
|
|
||||||
// ==================================================
|
|
||||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
|
||||||
// Copyright (c) 2012-2013 Junichi Satoh
|
|
||||||
// Please see http://pandorafms.org for full contribution list
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation for version 2.
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
// Load global vars.
|
// Load global vars.
|
||||||
global $config;
|
global $config;
|
||||||
require_once 'include/functions_alerts.php';
|
require_once 'include/functions_alerts.php';
|
||||||
|
@ -35,9 +49,9 @@ $date = (string) get_parameter('date');
|
||||||
$name = '';
|
$name = '';
|
||||||
$command = '';
|
$command = '';
|
||||||
$description = '';
|
$description = '';
|
||||||
$same_day = '';
|
$same_day = 'monday';
|
||||||
$id_group = 0;
|
$id_group = 0;
|
||||||
if ($id) {
|
if (empty($id) === false) {
|
||||||
$special_day = alerts_get_alert_special_day($id);
|
$special_day = alerts_get_alert_special_day($id);
|
||||||
$date = str_replace('0001', '*', $special_day['date']);
|
$date = str_replace('0001', '*', $special_day['date']);
|
||||||
$date_orig = $date;
|
$date_orig = $date;
|
||||||
|
@ -47,7 +61,7 @@ if ($id) {
|
||||||
$id_group_orig = $id_group;
|
$id_group_orig = $id_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($date == '') {
|
if (empty($date) === true) {
|
||||||
$date = date('Y-m-d', get_system_time());
|
$date = date('Y-m-d', get_system_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +105,7 @@ $table->data[1][0] = __('Group');
|
||||||
$groups = users_get_groups();
|
$groups = users_get_groups();
|
||||||
$own_info = get_user_info($config['id_user']);
|
$own_info = get_user_info($config['id_user']);
|
||||||
// Only display group "All" if user is administrator or has "LM" privileges.
|
// Only display group "All" if user is administrator or has "LM" privileges.
|
||||||
if (users_can_manage_group_all('LM')) {
|
if (users_can_manage_group_all('LM') === true) {
|
||||||
$display_all_group = true;
|
$display_all_group = true;
|
||||||
} else {
|
} else {
|
||||||
$display_all_group = false;
|
$display_all_group = false;
|
||||||
|
@ -140,11 +154,11 @@ $table->data[3][1] = html_print_textarea(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">';
|
echo '<form method="post" id="form-special-days" action="index.php?sec=galertas&sec2=godmode/alerts/alert_special_days">';
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
if ($id) {
|
if (empty($id) === false) {
|
||||||
html_print_input_hidden('id', $id);
|
html_print_input_hidden('id', $id);
|
||||||
html_print_input_hidden('update_special_day', 1);
|
html_print_input_hidden('update_special_day', 1);
|
||||||
html_print_input_hidden('id_group_orig', $id_group_orig);
|
html_print_input_hidden('id_group_orig', $id_group_orig);
|
||||||
|
@ -157,3 +171,25 @@ if ($id) {
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
echo '<div id="modal-alert-templates" class="invisible"></div>';
|
||||||
|
ui_require_javascript_file('pandora_alerts');
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready (function () {
|
||||||
|
$("#submit-create").click (function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
load_templates_alerts_special_days({
|
||||||
|
date: $("#text-date").val(),
|
||||||
|
id_group: $("#id_group").val(),
|
||||||
|
same_day: $("#same_day").val(),
|
||||||
|
btn_ok_text: '<?php echo __('Create'); ?>',
|
||||||
|
btn_cancel_text: '<?php echo __('Cancel'); ?>',
|
||||||
|
title: $("#text-date").val(),
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
page: "godmode/alerts/alert_special_days",
|
||||||
|
loading: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
||||||
|
name_form: 'form-special-days'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -1,5 +1,4 @@
|
||||||
/* globals $ */
|
/* globals $ confirmDialog uniqId showMsg*/
|
||||||
|
|
||||||
function parse_alert_command(command, classs) {
|
function parse_alert_command(command, classs) {
|
||||||
if (classs == "recovery") {
|
if (classs == "recovery") {
|
||||||
classs = "fields_recovery";
|
classs = "fields_recovery";
|
||||||
|
@ -36,21 +35,64 @@ function parse_alert_command(command, classs) {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
function render_command_preview(original_command) {
|
function render_command_preview(original_command) {
|
||||||
$("#textarea_command_preview").html(
|
$("#textarea_command_preview").html(
|
||||||
parse_alert_command(original_command, "")
|
parse_alert_command(original_command, "")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
function render_command_recovery_preview(original_command) {
|
function render_command_recovery_preview(original_command) {
|
||||||
$("#textarea_command_recovery_preview").html(
|
$("#textarea_command_recovery_preview").html(
|
||||||
parse_alert_command(original_command, "recovery")
|
parse_alert_command(original_command, "recovery")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
function render_command_description(command_description) {
|
function render_command_description(command_description) {
|
||||||
if (command_description != "") {
|
if (command_description != "") {
|
||||||
command_description = "<br>" + command_description;
|
command_description = "<br>" + command_description;
|
||||||
}
|
}
|
||||||
$("#command_description").html(command_description);
|
$("#command_description").html(command_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function load_templates_alerts_special_days(settings) {
|
||||||
|
confirmDialog({
|
||||||
|
title: settings.title,
|
||||||
|
message: function() {
|
||||||
|
var id = "div-" + uniqId();
|
||||||
|
$.ajax({
|
||||||
|
method: "post",
|
||||||
|
url: settings.url,
|
||||||
|
data: {
|
||||||
|
page: settings.page,
|
||||||
|
get_template_alerts: 1,
|
||||||
|
date: settings.date,
|
||||||
|
id_group: settings.id_group,
|
||||||
|
same_day: settings.same_day
|
||||||
|
},
|
||||||
|
datatype: "html",
|
||||||
|
success: function(data) {
|
||||||
|
console.log(data);
|
||||||
|
$("#" + id)
|
||||||
|
.empty()
|
||||||
|
.append(data);
|
||||||
|
},
|
||||||
|
error: function(e) {
|
||||||
|
showMsg(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return "<div id ='" + id + "'>" + settings.loading + "</div>";
|
||||||
|
},
|
||||||
|
ok: settings.btn_ok_text,
|
||||||
|
cancel: settings.btn_cancel_text,
|
||||||
|
onAccept: function() {
|
||||||
|
$("#" + settings.name_form).submit();
|
||||||
|
},
|
||||||
|
size: 750,
|
||||||
|
maxHeight: 500
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -8309,6 +8309,31 @@ div.stat-win-spinner img {
|
||||||
min-width: 50px;
|
min-width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.note-special-day {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.note-special-day div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
align-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.note-special-day div a.tip {
|
||||||
|
margin: 0px;
|
||||||
|
margin-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.note-special-day div a.tip > img {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.lign_right {
|
.lign_right {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue