';
html_print_submit_button (__('Delete'), 'delete_button', false,
- 'class="sub upd"');
+ 'class="sub delete"');
echo '
';
+ echo '
';
html_print_submit_button (__('Mark as not read'), 'not_read_button', false,
- 'class="sub upd"');
+ 'class="sub wand"');
echo '
';
echo '';
} else {
@@ -176,8 +184,10 @@ if ($total_messages){
$("#checkbox-all_selection").click( function() {
if ($("#checkbox-all_selection").is(':checked')) {
$(".check_selection").prop('checked', true);
+ $(".check_selection").parent().parent().css('background', "#FFFFEE");
} else {
$(".check_selection").prop('checked', false);
+ $(".check_selection").parent().parent().css('background', "inherit");
}
});
@@ -194,14 +204,14 @@ if ($total_messages){
var column = raw_position.replace(/.*-/ig, "");
// Delete and mark as not read column will do not open the message
- if (column > 2) return;
+ if (column == 0) return;
if (row%2 == 0) {
// Clicking a tittle
// Class where object will be displayed
var current_class = ".um_message_" + row/2;
- var message_id = $("#"+target).parent().find(":first-child").html();
+ var message_id = $("#"+target).parent().find(":nth-child(2)").html();
var div_id = 'um_individual_message' + row/2;
// Get the message via Ajax (only if it is not checked now
@@ -230,17 +240,77 @@ if ($total_messages){
"message_id": message_id},
function (data) {}
);
- $("#"+target).parent().find(".um_not_read_message").attr('class', 'um_read_message');
+
+ $("#"+target).parent().children().each(function(){
+ var full_class = $(this).attr('class');
+ console.log ("current_class: " + full_class);
+ full_class = full_class.replace (/um_not_read_message/g, "um_read_message");
+ console.log ("modified_class: " + full_class);
+ $(this).attr('class', full_class);
+ });
}
}
// Display message
$(current_class).toggle ();
- } else {
- // Clicking a message
- $(".um_message_" + Math.floor(row/2)).hide();
}
});
+
+ $(".check_selection").click(function (event) {
+ console.log(event.target.id);
+ if ($("#" + event.target.id).is(':checked')) {
+ $("#" + event.target.id).parent().parent().css('background', "#FFFFEE");
+ } else {
+ $("#" + event.target.id).parent().parent().css('background', 'inherit');
+ }
+ });
+
+ $(".um_individual_info, .um_individual_subject").hover(
+ function () {
+ $(this).parent().css('background', '#EFFFEF');
+ },
+ function () {
+ if ($(this).parent().find(":first-child").is(':checked')) {
+ $(this).parent().css('background', "#FFFFEE");
+ } else {
+ $(this).parent().css('background', 'inherit');
+ }
+ }
+ );
+
+
+
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index e5087c7569..9aacdadb65 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -201,6 +201,8 @@ function config_update_config () {
$error_update[] = __('Allow create planned downtimes in the past');
if (!config_update_value ('limit_parameters_massive', get_parameter('limit_parameters_massive')))
$error_update[] = __('Limit parameters massive');
+ if (!config_update_value ('identification_reminder', get_parameter('identification_reminder')))
+ $error_update[] = __('Identification_reminder');
break;
case 'enterprise':
if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) {
@@ -1516,7 +1518,7 @@ function config_check () {
//Registration advice
if (!isset ($config['instance_registered']) || ($config['instance_registered'] != 1)) {
set_pandora_error_for_header(
- __('Click
HERE to init the registration process'),
+ __('Click
here to init the registration process'),
__("This PandoraFMS instance is not registered"));
}
@@ -1524,7 +1526,7 @@ function config_check () {
$newsletter = db_get_value ('middlename', 'tusuario', 'id_user', $config['id_user']);
if ($newsletter != 1) {
set_pandora_error_for_header(
- __('Click
HERE to init the newsletter subscription process'),
+ __('Click
here to init the newsletter subscription process'),
__("Missing user in newsletter"));
}
}
diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php
index 6b4f50c3a4..e9fa663678 100755
--- a/pandora_console/include/functions_update_manager.php
+++ b/pandora_console/include/functions_update_manager.php
@@ -384,11 +384,9 @@ function update_manager_curl_request ($action, $additional_params = false) {
'build' => $um_config_values['build']
);
if ($additional_params !== false) {
- html_debug ($additional_params, true);
$params = array_merge ($params, $additional_params);
}
$params['action'] = $action;
- html_debug ($params, true);
$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $config['url_update_manager']);
@@ -455,38 +453,30 @@ function update_manager_curl_request ($action, $additional_params = false) {
}
-function update_manager_insert_newsletter () {
+function update_manager_insert_newsletter ($email) {
global $config;
- $email = db_get_value ('email', 'tusuario', 'id_user', $config['id_user']);
+ if ($email === '') return false;
+
$params = array(
'email' => $email,
'language' => $config['language']
);
- //For to test in the shell ?????????????????
- /*
- wget https://artica.es/pandoraupdate6/server.php -O- --no-check-certificate --post-data "action=new_newsletter&email=m@d.com&language=es"
- */
-
$result = update_manager_curl_request ('new_newsletter', $params);
if (!$result['success']) {
- html_debug ("FAIL update_manager_insert_newsletter", true);
- html_debug ($result, true);
- return ($result['update_message']);
+ return false;
}
- switch ($resul['http_status']) {
+ switch ($result['http_status']) {
case 200:
- //SUCESS
- break;
- case 201: //provisional
- //EMAIL ON DB
- break;
+ $message = json_decode($result['update_message'], true);
+ if ($message['success'] == 1) return true;
+ return false;
default:
- //FAILS
+ return false;
break;
}
}
@@ -497,39 +487,38 @@ function update_manager_register_instance () {
$email = db_get_value ('email', 'tusuario', 'id_user', $config['id_user']);
$params = array(
'language' => $config['language'],
- 'timezone' => $config['timezone']
+ 'timezone' => $config['timezone'],
+ 'email' => $email
);
- //For to test in the shell ??????????????
- /*
- wget https://artica.es/pandoraupdate6/server.php -O- --no-check-certificate --post-data "action=new_instance&language=es&timezone=Europe/Berlin"
- */
-
- $result = update_manager_curl_request ('new_instance', $params);
+ $result = update_manager_curl_request ('new_register', $params);
if (!$result['success']) {
- html_debug ("FAIL update_manager_register_instance", true);
- html_debug ($result, true);
- return ($result['update_message']);
+ return false;
}
- switch ($resul['http_status']) {
+ switch ($result['http_status']) {
case 200:
- //SUCESS
//Retrieve the PUID
- $update_message = json_decode($result['update_message'], true);
- $puid = $update_message[0]['pandora_uid'];
- config_update_value ('pandora_uid', $puid);
-
- //The tupdate table is reused to display messages. A specific entry to tupdate_package is required.
- //Then, this tupdate_package id is saved in tconfig
- db_process_sql_insert ('tupdate_package', array ('description' => '__UMMESSAGES__'));
- $id_um_package_messages = db_get_value('id', 'tupdate_package', 'description', '__UMMESSAGES__');
- config_update_config ('id_um_package_messages', $id_um_package_messages);
+ $message = json_decode($result['update_message'], true);
+ if ($message['success'] == 1) {
+ $puid = $message['pandora_uid'];
+ config_update_value ('pandora_uid', $puid);
+
+ //The tupdate table is reused to display messages. A specific entry to tupdate_package is required.
+ //Then, this tupdate_package id is saved in tconfig
+ db_process_sql_insert ('tupdate_package', array ('description' => '__UMMESSAGES__'));
+ $id_um_package_messages = db_get_value('id', 'tupdate_package', 'description', '__UMMESSAGES__');
+ config_update_value ('id_um_package_messages', $id_um_package_messages);
+ return true;
+ } else {
+ return false;
+ }
break;
default:
- //FAILS
+ return false;
+ break;
}
}
@@ -538,56 +527,66 @@ function update_manager_download_messages () {
// TODO: Delete old messages
- $email = db_get_value ('email', 'tusuario', 'id_user', $config['id_user']);
$params = array(
- 'pandora_uid' => $config['puid']
- );
+ 'pandora_uid' => $config['pandora_uid']
+ );
//For to test in the shell ??????????????
/*
wget https://artica.es/pandoraupdate6/server.php -O- --no-check-certificate --post-data "action=download_messages&language=es&timezone=Europe/Berlin"
*/
- $result = update_manager_curl_request ('download_messages', $params);
+ $result = update_manager_curl_request ('get_messages', $params);
+
+ //Do not ask in next 2 hours
+ config_update_value ('last_um_check', time() + 2 * SECONDS_1HOUR);
if (!$result['success']) {
- //Do not ask in next 2 hours
- //~ html_debug ("FAIL update_manager_download_messages", true);
- //~ html_debug ($result, true);
- config_update_value ('last_um_check', time() + 2 * SECONDS_1HOUR);
return ($result['update_message']);
}
- switch ($resul['http_status']) {
+ switch ($result['http_status']) {
case 200:
- //SUCESS
+ $message = json_decode($result['update_message'], true);
+
+ if ($message['success'] == 1) {
+ foreach ($message['messages'] as $single_message) {
+ // Convert subject -> db_field_value; message_html -> data; expiration -> filename; message_id -> svn_version
+ $single_message['db_field_value'] = $single_message['subject'];
+ unset ($single_message['subject']);
+ $single_message['data'] = $single_message['message_html'];
+ unset ($single_message['message_html']);
+ $single_message['filename'] = $single_message['expiration'];
+ unset ($single_message['expiration']);
+ $single_message['svn_version'] = $single_message['message_id'];
+ unset ($single_message['message_id']);
+
+ // Add common tconfig id_update_package
+ $single_message['id_update_package'] = $config['id_um_package_messages'];
+
+ $result = db_process_sql_insert('tupdate', $single_message);
+ }
+ }
break;
default:
- }
-
- //Do not ask in next 2 hours
- config_update_value ('last_um_check', time() + 2 * SECONDS_1HOUR);
- //FAILS
+ break;
+ }
}
function update_manager_remote_read_messages ($id_message) {
global $config;
- $email = db_get_value ('email', 'tusuario', 'id_user', $config['id_user']);
$params = array(
- 'pandora_uid' => $config['puid'],
- 'id_message' => $id_message
+ 'pandora_uid' => $config['pandora_uid'],
+ 'message_id' => $id_message
);
- //For to test in the shell ??????????????
- /*
- wget https://artica.es/pandoraupdate6/server.php -O- --no-check-certificate --post-data "action=download_messages&language=es&timezone=Europe/Berlin"
- */
+ $result = update_manager_curl_request ('mark_as_read', $params);
- $result = update_manager_curl_request ('read_message', $params);
+ //if (!$result['success']) {
+ // html_debug ($result['update_message'], true);
+ //}
- html_debug ("Update_manager_read_messages", true);
- html_debug ($result, true);
return $result['success'];
}
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 03c3c1d023..0a5506346d 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -3098,14 +3098,6 @@ table#policy_modules td * {
margin-left: 3%;
}
-.um_not_read_message{
- font-weight: 900;
-}
-.um_read_message{
- font-weight: 500;
- color: #bbbbbb;
-}
-
/* The items with the class 'spinner' will rotate */
/* Not supported on IE9 and below */
.spinner {
diff --git a/pandora_console/index.php b/pandora_console/index.php
index c899569099..a26186ed57 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -534,6 +534,14 @@ clear_pandora_error_for_header();
$config['logged'] = false;
extensions_load_extensions ($process_login);
+
+// Check for update manager messages
+if ($config['last_um_check'] > (time() + 2 * SECONDS_1HOUR)) {
+ require_once("include/functions_update_manager.php");
+
+ update_manager_download_messages ();
+}
+
if ($process_login) {
/* Call all extensions login function */
extensions_call_login_function ();
diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php
index 918082ea31..445371443c 100644
--- a/pandora_console/operation/users/user_edit.php
+++ b/pandora_console/operation/users/user_edit.php
@@ -362,10 +362,10 @@ if (license_free()) {
$data[1] = __('Newsletter Subscribed');
$data[1] .= $jump . ui_print_help_tip(__('Subs news'), true);
if ($user_info["middlename"]) {
- $data[1] .= $jump . __('You are subscribed to PandoraFMS newsletter');
+ $data[1] .= $jump . '
' . __('You are subscribed to PandoraFMS newsletter') . "";
}
else {
- $data[1] .= $jump . __('Click
HERE to init the newsletter subscription process');
+ $data[1] .= $jump . '
' . __('Click here to init the newsletter subscription process') . "";
}
$data[2] = __('Newsletter Reminder');