diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php
index 01cd04d509..9d5db4e80d 100644
--- a/pandora_console/include/class/CalendarManager.class.php
+++ b/pandora_console/include/class/CalendarManager.class.php
@@ -153,7 +153,7 @@ class CalendarManager
$buttons['list'] = [
'active' => false,
'text' => ''.html_print_image(
'images/list.png',
true,
@@ -175,7 +175,7 @@ class CalendarManager
$buttons['list_edit'] = [
'active' => false,
'text' => ''.html_print_image(
'images/pencil.png',
true,
@@ -189,7 +189,7 @@ class CalendarManager
$buttons['special_days'] = [
'active' => false,
'text' => ''.html_print_image(
'images/templates.png',
true,
@@ -220,7 +220,7 @@ class CalendarManager
{
\ui_require_css_file('alert');
$op = get_parameter('op');
- $tab = get_parameter('tab');
+ $tab = get_parameter('tab_calendar');
switch ($tab) {
case 'special_days':
if ($op === 'edit') {
@@ -544,7 +544,7 @@ class CalendarManager
'calendar/edit',
[
'ajax_url' => $this->ajaxUrl,
- 'url' => $this->url.'&op=edit&tab=list',
+ 'url' => $this->url.'&op=edit&tab_calendar=list',
'tabs' => $this->getTabs('list'),
'calendar' => $calendar,
'message' => $this->message,
@@ -601,6 +601,8 @@ class CalendarManager
true
)['count'];
+ $is_management_allowed = \is_management_allowed();
+
if ((bool) $data === true) {
$manage = check_acl(
$config['id_user'],
@@ -611,7 +613,7 @@ class CalendarManager
$data = array_reduce(
$data,
- function ($carry, $item) use ($manage) {
+ function ($carry, $item) use ($manage, $is_management_allowed) {
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// Transforms array of arrays $data into an array
// of objects, making a post-process of certain fields.
@@ -620,7 +622,7 @@ class CalendarManager
if ((bool) $manage === true) {
$name = '';
$name .= $tmp->name;
@@ -636,26 +638,28 @@ class CalendarManager
// Options. View.
$tmp->options = '';
if ((bool) $manage === true) {
- // Options. Edit.
- $tmp->options .= '';
- $tmp->options .= html_print_image(
- 'images/config.png',
- true,
- [
- 'title' => __('Edit'),
- 'class' => 'invert_filter',
- ]
- );
- $tmp->options .= '';
+ if ($is_management_allowed === true) {
+ // Options. Edit.
+ $tmp->options .= '';
+ $tmp->options .= html_print_image(
+ 'images/config.png',
+ true,
+ [
+ 'title' => __('Edit'),
+ 'class' => 'invert_filter',
+ ]
+ );
+ $tmp->options .= '';
+ }
// Options. Especial days.
$tmp->options .= '';
$tmp->options .= html_print_image(
@@ -668,7 +672,7 @@ class CalendarManager
);
$tmp->options .= '';
- if ($tmp->id != 1) {
+ if ($is_management_allowed === true && $tmp->id != 1) {
// Options. Delete.
$tmp->options .= '';
+ $url_link .= __('metaconsole');
+ $url_link .= '';
+ } else {
+ $url_link = __('any node');
+ }
+
+ \ui_print_warning_message(
+ __(
+ 'This node is configured with centralized mode. All alert calendar information is read only. Go to %s to manage it.',
+ $url_link
+ )
+ );
+}
if (empty($message) === false) {
echo $message;
@@ -88,15 +112,17 @@ $inputs[] = [
];
-// Submit.
-$inputs[] = [
- 'arguments' => [
- 'name' => 'button',
- 'label' => (($create === true) ? __('Create') : __('Update')),
- 'type' => 'submit',
- 'attributes' => 'class="sub next"',
- ],
-];
+if ($is_management_allowed === true) {
+ // Submit.
+ $inputs[] = [
+ 'arguments' => [
+ 'name' => 'button',
+ 'label' => (($create === true) ? __('Create') : __('Update')),
+ 'type' => 'submit',
+ 'attributes' => 'class="sub next"',
+ ],
+ ];
+}
// Print form.
HTML::printForm(
@@ -110,3 +136,5 @@ HTML::printForm(
false,
true
);
+
+\enterprise_hook('close_meta_frame');
diff --git a/pandora_console/views/calendar/list.php b/pandora_console/views/calendar/list.php
index 90d445f1ef..80a1811b8f 100644
--- a/pandora_console/views/calendar/list.php
+++ b/pandora_console/views/calendar/list.php
@@ -26,21 +26,47 @@
* ============================================================================
*/
-// Header.
-\ui_print_page_header(
- // Title.
- __('Calendars'),
- // Icon.
- 'images/gm_alerts.png',
- // Return.
- false,
- // Help.
- 'alert_special_days',
- // Godmode.
- true,
- // Options.
- $tabs
-);
+\ui_require_css_file('wizard');
+\enterprise_include_once('meta/include/functions_alerts_meta.php');
+\enterprise_hook('open_meta_frame');
+
+if (\is_metaconsole() === true) {
+ \alerts_meta_print_header($tabs);
+} else {
+ // Header.
+ \ui_print_page_header(
+ // Title.
+ __('Calendars'),
+ // Icon.
+ 'images/gm_alerts.png',
+ // Return.
+ false,
+ // Help.
+ 'alert_special_days',
+ // Godmode.
+ true,
+ // Options.
+ $tabs
+ );
+}
+
+$is_management_allowed = \is_management_allowed();
+if ($is_management_allowed === false) {
+ if (\is_metaconsole() === false) {
+ $url_link = '';
+ $url_link .= __('metaconsole');
+ $url_link .= '';
+ } else {
+ $url_link = __('any node');
+ }
+
+ \ui_print_warning_message(
+ __(
+ 'This node is configured with centralized mode. All alert calendar information is read only. Go to %s to manage it.',
+ $url_link
+ )
+ );
+}
if (empty($message) === false) {
echo $message;
@@ -124,3 +150,5 @@ if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
]
);
}
+
+\enterprise_hook('close_meta_frame');
diff --git a/pandora_console/views/calendar/special_days.php b/pandora_console/views/calendar/special_days.php
index f61ac7da1b..4c50485d67 100644
--- a/pandora_console/views/calendar/special_days.php
+++ b/pandora_console/views/calendar/special_days.php
@@ -28,21 +28,47 @@
global $config;
-// Header.
-\ui_print_page_header(
- // Title.
- __('Special days'),
- // Icon.
- 'images/gm_alerts.png',
- // Return.
- false,
- // Help.
- 'alert_special_days',
- // Godmode.
- true,
- // Options.
- $tabs
-);
+\ui_require_css_file('wizard');
+\enterprise_include_once('meta/include/functions_alerts_meta.php');
+\enterprise_hook('open_meta_frame');
+
+if (\is_metaconsole() === true) {
+ \alerts_meta_print_header($tabs);
+} else {
+ // Header.
+ \ui_print_page_header(
+ // Title.
+ __('Special days'),
+ // Icon.
+ 'images/gm_alerts.png',
+ // Return.
+ false,
+ // Help.
+ 'alert_special_days',
+ // Godmode.
+ true,
+ // Options.
+ $tabs
+ );
+}
+
+$is_management_allowed = \is_management_allowed();
+if ($is_management_allowed === false) {
+ if (\is_metaconsole() === false) {
+ $url_link = '';
+ $url_link .= __('metaconsole');
+ $url_link .= '';
+ } else {
+ $url_link = __('any node');
+ }
+
+ \ui_print_warning_message(
+ __(
+ 'This node is configured with centralized mode. All alert calendar information is read only. Go to %s to manage it.',
+ $url_link
+ )
+ );
+}
if (empty($message) === false) {
echo $message;
@@ -115,19 +141,21 @@ $inputs[] = [
],
];
-// Print form.
-HTML::printForm(
- [
- 'form' => [
- 'action' => $url.'&op=upload_ical&id='.$id_calendar,
- 'method' => 'POST',
- 'id' => 'icalendar-special-days',
- 'enctype' => 'multipart/form-data',
+if ($is_management_allowed === true) {
+ // Print form.
+ HTML::printForm(
+ [
+ 'form' => [
+ 'action' => $url.'&op=upload_ical&id='.$id_calendar,
+ 'method' => 'POST',
+ 'id' => 'icalendar-special-days',
+ 'enctype' => 'multipart/form-data',
+ ],
+ 'inputs' => $inputs,
],
- 'inputs' => $inputs,
- ],
- false
-);
+ false
+ );
+}
$this_year = date('Y');
@@ -290,13 +318,15 @@ for ($month = 1; $month <= 12; $month++) {
$cal_table->cellstyle[$cal_line][$week] .= 'font-size: 18px;';
$cal_table->data[$cal_line][$week] = $day.' ';
- $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image(
- 'images/add_mc.png',
- true,
- ['class' => 'invert_filter']
- ).'';
+ if ($is_management_allowed === true) {
+ $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image(
+ 'images/add_mc.png',
+ true,
+ ['class' => 'invert_filter']
+ ).'';
+ }
if (empty($specialDays) === false && isset($specialDays[$display_year][$display_month][$day]) === true) {
$cal_table->data[$cal_line][$week] .= '
';
@@ -395,25 +425,28 @@ for ($month = 1; $month <= 12; $month++) {
true,
['class' => 'invert_filter']
).'';
- $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image(
- 'images/config.png',
- true,
- ['class' => 'invert_filter']
- ).' ';
- $url_delete = $url.'&op=delete&id='.$special_day['id'];
- $script_delete = 'if (!confirm(\''.__('Are you sure?').'\')) return false;';
- $cal_table->data[$cal_line][$week] .= '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] .= '">';
- $cal_table->data[$cal_line][$week] .= html_print_image(
- 'images/cross.png',
- true,
- ['class' => 'invert_filter']
- ).'';
+
+ if ($is_management_allowed === true) {
+ $cal_table->data[$cal_line][$week] .= 'data[$cal_line][$week] .= '>'.html_print_image(
+ 'images/config.png',
+ true,
+ ['class' => 'invert_filter']
+ ).' ';
+ $url_delete = $url.'&op=delete&id='.$special_day['id'];
+ $script_delete = 'if (!confirm(\''.__('Are you sure?').'\')) return false;';
+ $cal_table->data[$cal_line][$week] .= '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] .= '">';
+ $cal_table->data[$cal_line][$week] .= html_print_image(
+ 'images/cross.png',
+ true,
+ ['class' => 'invert_filter']
+ ).'';
+ }
}
$cal_table->data[$cal_line][$week] .= '';
@@ -457,6 +490,8 @@ if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
echo '