diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index d9af328129..d746a6447b 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -3351,9 +3351,11 @@ function html_print_switch($attributes=[]) $attributes['style'] = ''; } + $disabled_class .= (bool) ($attributes['disabled']) ? ' p-slider-disabled' : ''; + return ""; } diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 66efd3d4a7..45e08dfcf6 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -916,7 +916,7 @@ function notifications_print_two_ways_select($info_selec, $users, $source_id) function notifications_print_user_switch($source, $user, $label) { $status = notifications_get_user_label_status($source, $user, $label); - return html_print_switch( + $switch = html_print_switch( [ 'name' => $label, 'value' => $status['status'], @@ -925,6 +925,13 @@ function notifications_print_user_switch($source, $user, $label) 'id' => 'notifications-user-'.$source['id'].'-label-'.$label, ] ); + + $data = [ + 'disabled' => !$status['enabled'], + 'switch' => $switch, + ]; + + return $data; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index c87b7ec26a..a081452390 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4656,6 +4656,10 @@ div#dialog_messages table th:last-child { border-radius: 34px; } +.p-slider-disabled { + background-color: #dfdfdf !important; +} + .p-slider:before { position: absolute; content: ""; diff --git a/pandora_console/operation/users/user_edit_notifications.php b/pandora_console/operation/users/user_edit_notifications.php index 03df1b9d22..c153b57bd5 100644 --- a/pandora_console/operation/users/user_edit_notifications.php +++ b/pandora_console/operation/users/user_edit_notifications.php @@ -64,7 +64,10 @@ echo '
'.__('Also receive an email').'
'; - $sources = notifications_get_all_sources(); +$sources = notifications_get_all_sources(); + +$disabled_flag = false; + foreach ($sources as $source) { echo '
'; $table_content = [ @@ -72,12 +75,24 @@ foreach ($sources as $source) { notifications_print_user_switch($source, $id, 'enabled'), notifications_print_user_switch($source, $id, 'also_mail'), ]; + + $notifications_enabled = notifications_print_user_switch($source, $id, 'enabled'); + $notifications_also_mail = notifications_print_user_switch($source, $id, 'also_mail'); + + if ($notifications_enabled['disabled'] == 1 || $notifications_also_mail['disabled'] == 1) { + $disabled_flag = true; + } + echo '
'.$source['description'].'
'; - echo '
'.notifications_print_user_switch($source, $id, 'enabled').'
'; - echo '
'.notifications_print_user_switch($source, $id, 'also_mail').'
'; + echo '
'.$notifications_enabled['switch'].'
'; + echo '
'.$notifications_also_mail['switch'].'
'; echo '
'; } +if ($disabled_flag) { + echo 'Disabled controls have been set by the system administrator'; +} + echo ''; // Print id user to handle it on js.