diff --git a/pandora_console/include/ajax/notifications.ajax.php b/pandora_console/include/ajax/notifications.ajax.php
new file mode 100644
index 0000000000..36ea95900d
--- /dev/null
+++ b/pandora_console/include/ajax/notifications.ajax.php
@@ -0,0 +1,57 @@
+ notifications_set_user_label_status(
+ $source,
+ $user,
+ $label,
+ $value
+ ),
+ ]
+ );
+
+ echo $json;
+ return;
+}
diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php
index 60a8e6bce0..b9393ce1c4 100644
--- a/pandora_console/include/functions_notifications.php
+++ b/pandora_console/include/functions_notifications.php
@@ -635,6 +635,12 @@ function notifications_get_user_label_status($source, $user, $label)
array_keys(users_get_groups($user)),
array_keys(notifications_get_group_sources_for_select($source['id']))
);
+
+ // Clean default common groups error for mesagges.
+ if ($common_groups[0] === 0) {
+ unset($common_groups[0]);
+ }
+
// No group found, return no permissions.
$value = empty($common_groups) ? false : $source[$label];
return notifications_build_user_enable_return($value, false);
@@ -760,9 +766,10 @@ function notifications_print_global_source_configuration($source)
}
// Generate the title.
- $html_title = "
";
+ $html_title = '
'.$source['description'].'
';
+ $html_title .= "
";
$html_title .= html_print_switch($switch_values);
- $html_title .= '
'.$source['description'].'
';
+ $html_title .= ''.__('Enable user configuration').'
';
$html_title .= '';
// Generate the html for title.
diff --git a/pandora_console/operation/users/user_edit_notifications.php b/pandora_console/operation/users/user_edit_notifications.php
index 309439dfe7..77ef1caebe 100644
--- a/pandora_console/operation/users/user_edit_notifications.php
+++ b/pandora_console/operation/users/user_edit_notifications.php
@@ -36,33 +36,11 @@ require_once $config['homedir'].'/include/functions_notifications.php';
$headerTitle = __('User notifications');
require $config['homedir'].'/operation/users/user_edit_header.php';
-if (get_parameter('change_label', 0)) {
- $label = get_parameter('label', '');
- $source = get_parameter('source', 0);
- $user = get_parameter('user', '');
- $value = get_parameter('value', 0) ? 1 : 0;
-
- // Update the label value.
- ob_clean();
- echo json_encode(
- [
- 'result' => notifications_set_user_label_status(
- $source,
- $user,
- $label,
- $value
- ),
- ]
- );
- return;
-}
-
-
echo '
-
'.__('Enable').'
-
'.__('Also receive an email').'
+
'.__('Console notifications').'
+
'.__('E-mail notifications').'
';
$sources = notifications_get_all_sources();
@@ -109,13 +87,12 @@ html_print_input_hidden('id_user', $id);
event.preventDefault();
var check = document.getElementById(event.target.id);
if (check === null) return;
-
var match = /notifications-user-([0-9]+)-label-(.*)/
.exec(event.target.id);
-
jQuery.post ("ajax.php",
{
- "page" : "operation/users/user_edit_notifications",
+ //"page" : "operation/users/user_edit_notifications",
+ "page" : 'include/ajax/notifications.ajax',
"change_label" : 1,
"label" : match[2],
"source" : match[1],
@@ -148,4 +125,5 @@ html_print_input_hidden('id_user', $id);
);
}
}());
+