From df8042abb1264d78f4a40ce9e32a14485b5bdeed Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 12 Feb 2019 17:45:25 +0100 Subject: [PATCH 01/61] Fixed the error message of the password recovery Former-commit-id: 3bc9b4044bbe56ec5a1c1f4cbdb3f56db5680abb --- pandora_console/general/login_page.php | 4 +- pandora_console/index.php | 92 +++++++++++--------------- 2 files changed, 42 insertions(+), 54 deletions(-) diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 198b5c3fc9..1a99e0d196 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -342,7 +342,7 @@ echo ''; echo '
'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '').'
'; echo ''; -if (!isset($process_error_message) && isset($mail)) { +if (empty($process_error_message) && isset($mail)) { echo '
'; echo '
'; echo '
'; @@ -359,7 +359,7 @@ if (!isset($process_error_message) && isset($mail)) { echo '
'; echo '
'; echo '
'; -} else if (isset($process_error_message)) { +} else if (isset($process_error_message) && !empty($process_error_message)) { echo '
'; echo '
'; echo '
'; diff --git a/pandora_console/index.php b/pandora_console/index.php index ad4b93465a..ae79d76f69 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -619,10 +619,9 @@ if (! isset($config['id_user'])) { header('Location: '.$config['homeurl'].'index.php'.$redirect_url); exit; - // Always exit after sending location headers - } - // Hash login process - else if (isset($_GET['loginhash'])) { + // Always exit after sending location headers. + } else if (isset($_GET['loginhash'])) { + // Hash login process $loginhash_data = get_parameter('loginhash_data', ''); $loginhash_user = str_rot13(get_parameter('loginhash_user', '')); @@ -638,9 +637,8 @@ if (! isset($config['id_user'])) { exit(''); } - } - // There is no user connected - else { + } else { + // There is no user connected. if ($config['enterprise_installed']) { enterprise_include_once('include/functions_reset_pass.php'); } @@ -722,64 +720,55 @@ if (! isset($config['id_user'])) { $show_error = false; if (!$first) { - if ($reset) { - if ($user_reset_pass == '') { + if ($user_reset_pass == '') { + $reset = false; + $error = __('Id user cannot be empty'); + $show_error = true; + } else { + $check_user = check_user_id($user_reset_pass); + + if (!$check_user) { $reset = false; - $error = __('Id user cannot be empty'); + register_pass_change_try($user_reset_pass, 0); + $error = __('Error in reset password request'); $show_error = true; } else { - $check_user = check_user_id($user_reset_pass); + $check_mail = check_user_have_mail($user_reset_pass); - if (!$check_user) { + if (!$check_mail) { $reset = false; register_pass_change_try($user_reset_pass, 0); - $error = __('Error in reset password request'); + $error = __('This user doesn\'t have a valid email address'); $show_error = true; } else { - $check_mail = check_user_have_mail($user_reset_pass); - - if (!$check_mail) { - $reset = false; - register_pass_change_try($user_reset_pass, 0); - $error = __('This user doesn\'t have a valid email address'); - $show_error = true; - } else { - $mail = $check_mail; - } + $mail = $check_mail; } } } - if (!$reset) { - if ($config['enterprise_installed']) { - include_once 'enterprise/include/reset_pass.php'; - } + $cod_hash = $user_reset_pass.'::::'.md5(rand(10, 1000000).rand(10, 1000000).rand(10, 1000000)); + + $subject = '['.io_safe_output(get_product_name()).'] '.__('Reset password'); + $body = __('This is an automatically sent message for user '); + $body .= ' "'.$user_reset_pass.'"'; + $body .= '

'; + $body .= __('Please click the link below to reset your password'); + $body .= '

'; + $body .= ''.__('Reset your password').''; + $body .= '

'; + $body .= get_product_name(); + $body .= '

'; + $body .= ''.__('Please do not reply to this email.').''; + + $result = send_email_to_user($mail, $body, $subject); + + if (!$result) { + $process_error_message = __('Error at sending the email'); } else { - $cod_hash = $user_reset_pass.'::::'.md5(rand(10, 1000000).rand(10, 1000000).rand(10, 1000000)); - - $subject = '['.get_product_name().'] '.__('Reset password'); - $body = __('This is an automatically sent message for user '); - $body .= ' "'.$user_reset_pass.'"'; - $body .= '

'; - $body .= __('Please click the link below to reset your password'); - $body .= '

'; - $body .= ''.__('Reset your password').''; - $body .= '

'; - $body .= get_product_name(); - $body .= '

'; - $body .= ''.__('Please do not reply to this email.').''; - - $result = send_email_to_user($mail, $body, $subject); - - $process_error_message = ''; - if (!$result) { - $process_error_message = __('Error at sending the email'); - } else { - send_token_to_db($user_reset_pass, $cod_hash); - } - - include_once 'general/login_page.php'; + send_token_to_db($user_reset_pass, $cod_hash); } + + include_once 'general/login_page.php'; } else { include_once 'enterprise/include/reset_pass.php'; } @@ -1363,4 +1352,3 @@ require 'include/php_to_js_values.php'; if (__PAN_XHPROF__ === 1) { pandora_xhprof_display_result('node_index'); } - From 36b58d0db83bceb77f7417487a8f543cc0613460 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 26 Feb 2019 16:45:54 +0100 Subject: [PATCH 02/61] ticket resolved Former-commit-id: 18e461d26d516a4b58f65ee916e3950b2e85d312 --- pandora_console/godmode/agentes/modificar_agente.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4673bf2f46..a751c06ea1 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -118,7 +118,7 @@ if ($enable_agent) { enterprise_include_once('include/functions_agents.php'); $values = ['disabled' => 0]; enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]); - + config_agents_update_config_token($enable_agent, 'standby', 0); db_pandora_audit('Agent management', 'Enable '.$alias); } else { db_pandora_audit('Agent management', 'Fail to enable '.$alias); @@ -140,6 +140,7 @@ if ($disable_agent) { enterprise_include_once('include/functions_agents.php'); $values = ['disabled' => 1]; enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]); + config_agents_update_config_token($disable_agent, 'standby', 1); db_pandora_audit('Agent management', 'Disable '.$alias); } else { From f6b6073a16d85207e7d4f26780e2dad5d65610d0 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 27 Feb 2019 17:23:59 +0100 Subject: [PATCH 03/61] Fixed ldap adv. perms continues apliying when autocreate remote is unselected by cheking it on user login Former-commit-id: ca6a8a1217ec41d7edadf971e935d506ad9e0cff --- pandora_console/include/auth/mysql.php | 61 ++++++++++++++------------ 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index aab0b4c9e4..c4b8fc9840 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -282,39 +282,42 @@ function process_user_login_remote($login, $pass, $api=false) } } } else if ($config['auth'] === 'ldap') { - if ($config['ldap_save_password']) { - $update_credentials = change_local_user_pass_ldap($login, $pass); + // Check if autocreate remote users is active. + if ($config['autocreate_remote_users'] == 1) { + if ($config['ldap_save_password']) { + $update_credentials = change_local_user_pass_ldap($login, $pass); - if ($update_credentials) { - $config['auth_error'] = __('Your permissions have changed. Please, login again.'); - return false; - } - } else { - delete_user_pass_ldap($login); - } - - $permissions = fill_permissions_ldap($sr); - if (empty($permissions)) { - $config['auth_error'] = __('User not found in database or incorrect password'); - return false; - } else { - // check permissions - $result = check_permission_ad( - $login, - $pass, - false, - $permissions, - defined('METACONSOLE') - ); - - if ($return === 'error_permissions') { - $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); - return false; - } else { - if ($return === 'permissions_changed') { + if ($update_credentials) { $config['auth_error'] = __('Your permissions have changed. Please, login again.'); return false; } + } else { + delete_user_pass_ldap($login); + } + + $permissions = fill_permissions_ldap($sr); + if (empty($permissions)) { + $config['auth_error'] = __('User not found in database or incorrect password'); + return false; + } else { + // check permissions + $result = check_permission_ad( + $login, + $pass, + false, + $permissions, + defined('METACONSOLE') + ); + + if ($return === 'error_permissions') { + $config['auth_error'] = __('Problems with configuration permissions. Please contact with Administrator'); + return false; + } else { + if ($return === 'permissions_changed') { + $config['auth_error'] = __('Your permissions have changed. Please, login again.'); + return false; + } + } } } } From 450eccee7fa4358a03ae9c9ee2c1bd6c42a48264 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Tue, 5 Mar 2019 13:17:21 +0100 Subject: [PATCH 04/61] ticket resolved, duplicated sentece Former-commit-id: bf419c14b79b633bb2894a34a91f74b32551549e --- pandora_console/godmode/setup/performance.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 666dd0b21c..1b514687ac 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -247,8 +247,7 @@ $table->style[0] = 'font-weight: bold'; $table->size[0] = '70%'; $table->size[1] = '30%'; -enterprise_hook('enterprise_warnings_history_days'); - +// enterprise_hook('enterprise_warnings_history_days'); $table->data[1][0] = __('Max. days before delete events'); $table->data[1][0] .= ui_print_help_tip( __('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), From f26593dc21920ff562ca2577a5e8224dfae24162 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 7 Mar 2019 12:34:09 +0100 Subject: [PATCH 05/61] Success Former-commit-id: 7920fc0927ddab510b2a9869a09fd7e0cf166182 --- pandora_console/include/functions_html.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 6d461350e9..0768014827 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -518,7 +518,7 @@ function html_print_select( $selected='', $script='', $nothing='', - $nothing_value=0, + $nothing_value=none, $return=false, $multiple=false, $sort=true, @@ -623,8 +623,6 @@ function html_print_select( $output .= 'selected '; } - $output .= 'value="'.$value.'"'; - if (is_array($selected) && in_array($value, $selected)) { $output .= ' selected="selected"'; } else if (is_numeric($value) && is_numeric($selected) @@ -644,7 +642,7 @@ function html_print_select( } if ($optlabel === '') { - $output .= '>'.$value.''; + $output .= '>None'; } else { $output .= '>'.$optlabel.''; } From 39974a1780d216cd4569cbb2dac19978e44652fb Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 7 Mar 2019 12:37:50 +0100 Subject: [PATCH 06/61] Arreglado Former-commit-id: a77d86dac7913a7f0f7bf7173eb67eb8609920ed --- pandora_console/include/functions_html.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 0768014827..6a0b3bf5ac 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -518,7 +518,7 @@ function html_print_select( $selected='', $script='', $nothing='', - $nothing_value=none, + $nothing_value=0, $return=false, $multiple=false, $sort=true, @@ -623,6 +623,8 @@ function html_print_select( $output .= 'selected '; } + $output .= 'value="'.$value.'"'; + if (is_array($selected) && in_array($value, $selected)) { $output .= ' selected="selected"'; } else if (is_numeric($value) && is_numeric($selected) From 57cfdcfbc4b9e91e8343ed6d2e4ca3028c418715 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 4 Apr 2019 18:06:48 +0200 Subject: [PATCH 07/61] Changed check value on JS Former-commit-id: 508cf9a75eedd4836720215451903c3951339ddf --- pandora_console/include/javascript/pandora_modules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index e835f87c24..604a778335 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -183,10 +183,10 @@ function configure_modules_form() { ); $("#text-unit").attr("value", data["unit"] == "" ? "" : data["unit"]); $("#checkbox-critical_inverse").prop( - "checked", + "uncheck", data["critical_inverse"] ); - $("#checkbox-warning_inverse").prop("checked", data["warning_inverse"]); + $("#checkbox-warning_inverse").prop("uncheck", data["warning_inverse"]); $("#component_loading").hide(); $("#id_module_type").change(); if ($("#id_category").is("select")) { From 86dabc6476a5d12c5ed7bcb4ef367695e1ae8610 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Fri, 17 May 2019 11:31:02 +0200 Subject: [PATCH 08/61] Variability event_storm_protection check is added with empty data --- pandora_console/include/functions_config.php | 2 +- pandora_server/lib/PandoraFMS/Core.pm | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index dc0e845afb..1747629920 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -270,7 +270,7 @@ function config_update_config() $error_update[] = __('Referer security'); } - if (!config_update_value('event_storm_protection', get_parameter('event_storm_protection'))) { + if (!config_update_value('event_storm_protection', get_parameter('event_storm_protection', 0))) { $error_update[] = __('Event storm protection'); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 296be928a4..536669afd2 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -360,9 +360,15 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) { my ($pa_config, $data, $status, $agent, $module, $utimestamp, $dbh, $timestamp, $extra_macros, $last_data_value, $alert_type) = @_; # No alerts when event storm protection is enabled - if ($EventStormProtection == 1) { + if(isnumber $EventStormProtection ){ + if ($EventStormProtection == 1) + { return; - } + } + }else{ + $EventStormProtection = 0; + return; + } # Warmup interval for alerts. if ($pa_config->{'warmup_alert_on'} == 1) { From e82916001bfe00ce764ef183b245c7ab8caca361 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 22 May 2019 10:18:44 +0200 Subject: [PATCH 09/61] allow fetching of event id in metaconsole event table when getting target of an event response in metaconsole having server_id=0 --- pandora_console/include/functions_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 52eb525bc1..5b2ee546a6 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2293,7 +2293,7 @@ function events_get_response_target( global $config; // If server_id > 0, it's a metaconsole query. - $meta = $server_id > 0; + $meta = $server_id > 0 || is_metaconsole(); $event_table = events_get_events_table($meta, $history); $event = db_get_row($event_table, 'id_evento', $event_id); From 7347324601fb7a241335e7eb659e13bab83bf893 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 13:19:08 +0200 Subject: [PATCH 10/61] Minor fixes - discovery styles --- pandora_console/godmode/wizards/Wizard.main.php | 6 +++--- pandora_console/include/styles/discovery.css | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 6468f1d2ac..f7f5e9a5c8 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -796,7 +796,7 @@ class Wizard $cb_function = $data['cb_function']; $cb_args = $data['cb_args']; - $output_head = '

'; if ($return === false) { @@ -868,7 +868,7 @@ class Wizard $cb_function = $data['cb_function']; $cb_args = $data['cb_args']; - $output_head = ''; if ($return === false) { @@ -963,7 +963,7 @@ class Wizard $cb_function = $data['cb_function']; $cb_args = $data['cb_args']; - $output_head = ''; if ($return === false) { diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css index 6df04ae736..fe8431a24a 100644 --- a/pandora_console/include/styles/discovery.css +++ b/pandora_console/include/styles/discovery.css @@ -27,6 +27,11 @@ li.discovery > a label { cursor: pointer; } +div.data_container > label { + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-weight: lighter; +} + div.data_container { width: 100%; height: 100%; @@ -160,6 +165,10 @@ span.breadcrumb_link { * Discovery forms structure */ +form.discovery * { + font-size: 10pt; +} + .edit_discovery_info { display: flex; align-items: flex-start; @@ -196,7 +205,9 @@ li > input[type="password"], background-color: transparent !important; border: none; border-radius: 0 !important; - border-bottom: 1px solid #343434; + border-bottom: 1px solid #ccc; + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-weight: lighter; padding: 0px 0px 2px 0px; box-sizing: border-box; margin-bottom: 4px; @@ -215,7 +226,7 @@ li > input[type="password"], } .discovery_list_input option { - text-align: center; + text-align: left; } .discovery_list_input option:checked { From 9eecc414dd3baeb34d58c5e66d5cc2e8a186c038 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 14:12:53 +0200 Subject: [PATCH 11/61] cps changes - switch core touched - test this commit carefully --- .../godmode/agentes/agent_manager.php | 34 +++++++++++-------- .../godmode/agentes/configurar_agente.php | 5 ++- pandora_console/include/functions.php | 5 +-- pandora_console/include/javascript/pandora.js | 2 +- pandora_console/include/styles/pandora.css | 4 ++- .../operation/agentes/ver_agente.php | 1 + 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index cee4cb2684..8b88d0737a 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -396,7 +396,7 @@ if (enterprise_installed()) { // CSS classnames (default) false, // Not disabled (default) - 'width:50%; min-width:170px; text-align:center', + 'width:50%; min-width:170px;', // Inline styles (default) false, // Option style select (default) @@ -457,7 +457,7 @@ if (enterprise_installed()) { // Class false, // Disabled - 'width:50%; min-width:170px; text-align:center' + 'width:50%; min-width:170px;' // Style ); @@ -510,21 +510,27 @@ if (enterprise_installed()) { $table_adv_remote .= '
'; - $cps_array[-1] = __('Disabled'); - if ($cps > 0) { - $cps_array[$cps] = __('Enabled'); - } else { - $cps_inc = 0; - if ($id_agente) { - $cps_inc = service_agents_cps($id_agente); - } - $cps_array[$cps_inc] = __('Enabled'); + // Calculate cps value - agents. + if ($id_agente) { + $cps_val = service_agents_cps($id_agente); + } else { + // No agent defined, use received cps as base value. + if ($cps >= 0) { + $cps_val = $cps; + } } - $table_adv_cascade = '

'.__('Cascade protection services').': '; - $table_adv_cascade .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true).'

'; - $table_adv_cascade .= html_print_select($cps_array, 'cps', $cps, '', '', 0, true).'
'; + $cps_html = '
'; + $cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true); + $cps_html .= __('Cascade protection services').' '.ui_print_help_icon('cascade_protection', true); + $cps_html .= ui_print_help_tip( + __('Alerts and events will be managed by the service joined by this agent.'), + true + ); + $cps_html .= '
'; + + $table_adv_cascade .= $cps_html; } // Custom ID diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 4e3b399e96..6a1d9404c5 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -194,7 +194,7 @@ if ($create_agent) { $update_gis_data = (int) get_parameter_post('update_gis_data', 0); $url_description = (string) get_parameter('url_description'); $quiet = (int) get_parameter('quiet', 0); - $cps = (int) get_parameter('cps', 0); + $cps = (int) get_parameter_switch('cps', -1); $secondary_groups = (string) get_parameter('secondary_hidden', ''); $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -829,8 +829,7 @@ if ($update_agent) { $update_gis_data = (int) get_parameter_post('update_gis_data', 0); $url_description = (string) get_parameter('url_description'); $quiet = (int) get_parameter('quiet', 0); - $cps = (int) get_parameter('cps', 0); - + $cps = get_parameter_switch('cps', -1); $old_values = db_get_row('tagente', 'id_agente', $id_agente); $fields = db_get_all_fields_in_table('tagent_custom_fields'); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 73b787ff99..a5f1d92a7a 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -871,12 +871,13 @@ function get_parameter_switch($name, $default='') $data = get_parameter($name, null); if ($data === null) { - return 0; + return (isset($default) ? $default : 0); } else if ($data == 'on') { return 1; } - return 0; + // Return value assigned to switch. + return $data; } diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index d5413e3c09..351531a5e9 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -1226,7 +1226,7 @@ function paint_qrcode(text, where, width, height) { text: text, width: width, height: height, - colorDark: "#3B6941", + colorDark: "#343434", colorLight: "#ffffff", correctLevel: QRCode.CorrectLevel.M }); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 86a461485e..e5114cadda 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -5588,7 +5588,9 @@ table.info_table.policy_sub_table { background-color: transparent !important; border: none; border-radius: 0 !important; - border-bottom: 1px solid #343434; + border-bottom: 1px solid #888; + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 10pt; padding: 2px 5px; box-sizing: border-box; background-repeat: no-repeat; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 46cfc69aec..43abb4602b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1435,6 +1435,7 @@ switch ($tab) { break; case 'main': + default: include 'estado_generalagente.php'; echo ""; include 'estado_monitores.php'; From 0280547465c0ca264dbc6cf47721ae2e274fd618 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 15:41:23 +0200 Subject: [PATCH 12/61] some changes --- .../godmode/agentes/agent_manager.php | 53 ++++++++++++++----- pandora_console/include/styles/pandora.css | 12 ++++- 2 files changed, 50 insertions(+), 15 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 8b88d0737a..213a07bf2d 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -167,13 +167,41 @@ if ($disk_conf_delete) { echo ''; +// Custom ID. +$custom_id_div = '
'; +$custom_id_div .= '

'.__('Custom ID').':

'; +$custom_id_div .= html_print_input_text( + 'custom_id', + $custom_id, + '', + 16, + 255, + true, + false, + false, + '', + 'agent_custom_id' +).'
'; + if (!$new_agent && $alias != '') { $table_agent_name = '

'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'

'; $table_agent_name .= '
'; $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; $table_agent_name .= '
'; - $table_qr_code = '

'.__('QR Code Agent view').':

'; + // QR code div. + $table_qr_code = '
'; + $table_qr_code .= '

'.__('QR Code Agent view').':

'; + $table_qr_code .= '
'; + if ($id_agente) { + $table_qr_code .= ""; + } + + // Add Custom id div. + $table_qr_code .= '
'; + $table_qr_code .= $custom_id_div; + $table_qr_code .= '
'; + if ($id_agente) { $table_agent_name .= ''.__('ID').' '.$id_agente.''; @@ -257,14 +285,6 @@ if ($id_agente) { } "; - } - - $table_qr_code .= '
'; -} - $groups = users_get_groups($config['id_user'], 'AR', false); $modules = db_get_all_rows_sql( @@ -354,7 +374,7 @@ $table_description .= html_print_input_text( true ).'
'; - +// QR code. echo '
'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'
@@ -533,9 +553,6 @@ if (enterprise_installed()) { $table_adv_cascade .= $cps_html; } -// Custom ID -$table_adv_custom_id = '

'.__('Custom ID').':

'; -$table_adv_custom_id .= html_print_input_text('custom_id', $custom_id, '', 16, 255, true).'
'; $table_adv_parent = '

'.__('Parent').':

'; $params = []; @@ -692,6 +709,7 @@ if ($config['activate_gis']) { +// General display distribution. $table_adv_options = $table_adv_secondary_groups.'
'.$table_adv_secondary_groups_left.' @@ -704,7 +722,14 @@ $table_adv_options = $table_adv_secondary_groups.'
-
'.$table_adv_parent.$table_adv_custom_id.$table_adv_module_mode.$table_adv_cascade.$table_adv_gis.'
+
'.$table_adv_parent.$table_adv_module_mode.$table_adv_cascade; + +if ($new_agent) { + // If agent is new, show custom id as old style format. + $table_adv_options .= $custom_id_div; +} + +$table_adv_options .= $table_adv_gis.'
'.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.'
'; diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index e5114cadda..3a0f47c4be 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -5588,7 +5588,7 @@ table.info_table.policy_sub_table { background-color: transparent !important; border: none; border-radius: 0 !important; - border-bottom: 1px solid #888; + border-bottom: 1px solid #ccc; font-family: "lato-bolder", "Open Sans", sans-serif !important; font-size: 10pt; padding: 2px 5px; @@ -5746,6 +5746,15 @@ a#qr_code_agent_view { margin-right: 5px; } +#text-comentarios, +.agent_custom_id { + padding-bottom: 2em; + background: #ececec !important; + display: inline-block; + border-radius: 5px !important; + border: 1px solid #ccc; +} + /* * --------------------------------------------------------------------- * - CLASSES FOR THE NEW TOGGLES - @@ -5760,6 +5769,7 @@ a#qr_code_agent_view { border: 1px solid #f3f3f3; border-top-left-radius: 4px; border-top-right-radius: 4px; + margin-bottom: -1px; padding: 5px; display: block; } From 556c07ad992d0a155d51bf2acc7d5e519768c960 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 17:12:35 +0200 Subject: [PATCH 13/61] Minor changes in configurar_agente --- .../godmode/agentes/agent_manager.php | 58 +++++++++++-------- .../godmode/agentes/configurar_agente.php | 7 ++- pandora_console/include/styles/pandora.css | 17 ++++-- 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 213a07bf2d..7707a2b944 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -165,7 +165,7 @@ if ($disk_conf_delete) { @unlink($filename['conf']); } -echo ''; +echo ''; // Custom ID. $custom_id_div = '
'; @@ -186,26 +186,12 @@ $custom_id_div .= html_print_input_text( if (!$new_agent && $alias != '') { $table_agent_name = '

'.__('Agent name').': '.ui_print_help_tip(__("The agent's name must be the same as the one defined at the console"), true).'

'; $table_agent_name .= '
'; - $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; - $table_agent_name .= '
'; - - // QR code div. - $table_qr_code = '
'; - $table_qr_code .= '

'.__('QR Code Agent view').':

'; - $table_qr_code .= '
'; - if ($id_agente) { - $table_qr_code .= ""; - } - - // Add Custom id div. - $table_qr_code .= '
'; - $table_qr_code .= $custom_id_div; - $table_qr_code .= '
'; - + $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; + $table_agent_name .= '
'; if ($id_agente) { - $table_agent_name .= ''.__('ID').' '.$id_agente.''; - $table_agent_name .= ''; + $table_agent_name .= ''; + $table_agent_name .= ''; $table_agent_name .= html_print_image( 'images/zoom.png', true, @@ -222,6 +208,14 @@ if (!$new_agent && $alias != '') { // Delete link from here. $table_agent_name .= "".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).''; + // Help link. + $table_agent_name .= ui_print_help_icon( + $help_header, + true, + '', + 'images/help_g.png' + ); + // Remote configuration available. if (isset($filename)) { if (file_exists($filename['md5'])) { @@ -229,7 +223,7 @@ if (!$new_agent && $alias != '') { $agent_name = io_safe_output($agent_name); $agent_md5 = md5($agent_name, false); - $table_agent_name .= ''; + $table_agent_name .= ''; $table_agent_name .= html_print_image( 'images/application_edit.png', true, @@ -246,6 +240,19 @@ if (!$new_agent && $alias != '') { } $table_agent_name .= '
'; + + // QR code div. + $table_qr_code = '
'; + $table_qr_code .= '

'.__('QR Code Agent view').':

'; + $table_qr_code .= '
'; + if ($id_agente) { + $table_qr_code .= "
"; + } + + // Add Custom id div. + $table_qr_code .= '
'; + $table_qr_code .= $custom_id_div; + $table_qr_code .= '
'; } if ($new_agent) { @@ -365,13 +372,14 @@ $table_server .= html_print_select( // Description. $table_description = '

'.__('Description').':

'; -$table_description .= html_print_input_text( +$table_description .= html_print_textarea( 'comentarios', + 3, + 10, $comentarios, '', - 45, - 200, - true + true, + 'agent_description' ).'
'; // QR code. @@ -511,7 +519,7 @@ if (enterprise_installed()) { if (!$new_agent && isset($filename) && file_exists($filename['md5'])) { $table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5'])); // Delete remote configuration - $table_adv_remote .= ''; + $table_adv_remote .= ''; $table_adv_remote .= html_print_image( 'images/cross.png', true, diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 6a1d9404c5..1ad8a09108 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -674,12 +674,15 @@ if ($id_agente) { agents_get_alias($id_agente), 'images/setup.png', false, - $help_header, + // Previous: $help_header. + '', true, $onheader, false, '', - $config['item_title_size_text'] + $config['item_title_size_text'], + '', + '' ); } else { // Create agent. diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 3a0f47c4be..2cf494c72a 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1283,7 +1283,6 @@ div.title_line { align-items: flex-end; justify-content: space-between; border-bottom: 2px solid #82b92e; - max-height: 50px; min-height: 50px; width: 100%; padding-right: 0px; @@ -1436,8 +1435,9 @@ div#agent_wizard_subtabs { #menu_tab_left li a, #menu_tab_left li span { color: #343434; - font-size: 16pt; - line-height: 16pt; + font-family: "lato-bolder", "Open Sans", sans-serif !important; + font-size: 20pt; + line-height: 20pt; } /* @@ -2422,6 +2422,8 @@ select { -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; + font-family: "lato-bolder", "Open Sans", sans-serif; + font-size: 10pt; } /* plugins */ @@ -5622,6 +5624,7 @@ table.info_table.policy_sub_table { .agent_options_column_right { width: 50%; box-sizing: border-box; + min-width: 400px; } .agent_options_column_left { @@ -5746,10 +5749,12 @@ a#qr_code_agent_view { margin-right: 5px; } -#text-comentarios, +.agent_description { + min-height: 4.8em !important; +} .agent_custom_id { - padding-bottom: 2em; - background: #ececec !important; + padding-bottom: 0.7em; + padding-top: 0.5em; display: inline-block; border-radius: 5px !important; border: 1px solid #ccc; From 91d388c8b3692fa4ff7ead15f23fcf3630731017 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Mon, 27 May 2019 17:47:45 +0200 Subject: [PATCH 14/61] Changed for create new user with advanced config enabled and forced automaticly disabled --- pandora_console/include/auth/mysql.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 1ab383b672..461f449184 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -1337,8 +1337,9 @@ function fill_permissions_ldap($sr) 'tags' => implode(',', $ldap_adv_perm['tags']), 'no_hierarchy' => (bool) $ldap_adv_perm['no_hierarchy'] ? 1 : 0, ]; - return $permissions; } + + return $permissions; } foreach ($result as $perms) { From f0fb6d7fd989a0196fbfaa17431d770d5c48ab67 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 18:03:56 +0200 Subject: [PATCH 15/61] wip styles --- .../godmode/agentes/agent_manager.php | 16 ++++++++- .../godmode/wizards/Wizard.main.php | 12 ++++--- pandora_console/include/functions_html.php | 4 +-- pandora_console/include/functions_ui.php | 26 +++++++++++++- pandora_console/include/styles/pandora.css | 35 +++++++++++++++++-- 5 files changed, 83 insertions(+), 10 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 7707a2b944..e764a1280c 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -322,7 +322,21 @@ $table_primary_group .= '
'; $table_interval = '

'.__('Interval').':

'; $table_interval .= '
'; -$table_interval .= html_print_extended_select_for_time('intervalo', $intervalo, '', '', '0', 10, true); +$table_interval .= html_print_extended_select_for_time( + 'intervalo', + $intervalo, + '', + '', + '0', + 10, + true, + false, + true, + 'w40p' +); + + + if ($intervalo < SECONDS_5MINUTES) { $table_interval .= clippy_context_help('interval_agent_min'); } diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index f7f5e9a5c8..f76678ffb6 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -783,13 +783,17 @@ class Wizard /** * Print a form. * - * @param array $data Definition of target form to be printed. - * @param boolean $return Return as string or direct output. + * @param array $data Definition of target form to be printed. + * @param boolean $return Return as string or direct output. + * @param boolean $print_white_box Print a white box. * * @return string HTML code. */ - public function printForm(array $data, bool $return=false, bool $print_white_box=false) - { + public function printForm( + array $data, + bool $return=false, + bool $print_white_box=false + ) { $form = $data['form']; $inputs = $data['inputs']; $js = $data['js']; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 6ce6a5d57c..53ab0bbb75 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1079,7 +1079,7 @@ function html_print_extended_select_for_time( 'class' => $uniq_name.'_toggler '.$class, 'alt' => __('Custom'), 'title' => __('Custom'), - 'style' => 'width: 18px;'.$style_icon, + 'style' => 'width: 18px; margin-bottom: -5px;'.$style_icon, ], false, false, @@ -1114,7 +1114,7 @@ function html_print_extended_select_for_time( 'class' => $uniq_name.'_toggler', 'alt' => __('List'), 'title' => __('List'), - 'style' => 'width: 18px;'.$style_icon, + 'style' => 'width: 18px;margin-bottom: -5px;'.$style_icon, ] ).''; echo '
'; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ce7d182e53..2f0eeeea09 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2795,7 +2795,31 @@ function ui_print_page_header( $buffer = '
'; if (!empty($breadcrumbs)) { - $buffer .= ''; + if (is_array($breadcrumbs)) { + $bc = []; + $i = 0; + foreach ($breadcrumbs as $content) { + if ($content['selected'] == 1) { + $class = 'selected'; + } else { + $class = ''; + } + + $bc[$i] = ''; + $bc[$i] .= ''; + $bc[$i] .= $content['label']; + $bc[$i] .= ''; + $bc[$i] .= ''; + $i++; + } + + $buffer .= implode( + ' / ', + $this->breadcrum + ); + } else { + $buffer .= ''; + } } $buffer .= '
'; -// Learn mode / Normal mode +// Learn mode / Normal mode. $table_adv_module_mode = '

'.__('Module definition').': '.ui_print_help_icon('module_definition', true).'

'; $table_adv_module_mode .= '
'; $table_adv_module_mode .= html_print_radio_button_extended( @@ -642,9 +655,14 @@ $table_adv_module_mode .= html_print_radio_button_extended( ); $table_adv_module_mode .= '
'; -// Status (Disabled / Enabled) +// Status (Disabled / Enabled). $table_adv_status = '

'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'

'; -$table_adv_status .= html_print_checkbox_switch('disabled', 1, $disabled, true).'
'; +$table_adv_status .= html_print_checkbox_switch( + 'disabled', + 1, + $disabled, + true +).'
'; // Url address. if (enterprise_installed()) { @@ -681,11 +699,11 @@ foreach ($listIcons as $index => $value) { } $path = 'images/gis_map/icons/'; -// TODO set better method the path +// TODO set better method the path. $table_adv_agent_icon = '

'.__('Agent icon').': '.ui_print_help_tip(__('Agent icon for GIS Maps.'), true).'

'; if ($icon_path == '') { $display_icons = 'none'; - // Hack to show no icon. Use any given image to fix not found image errors + // Hack to show no icon. Use any given image to fix not found image errors. $path_without = 'images/spinner.png'; $path_default = 'images/spinner.png'; $path_ok = 'images/spinner.png'; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index a1fd3f18bf..fb1c60bdd1 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2458,6 +2458,51 @@ function ui_print_status_image($type, $title='', $return=false, $options=false, } +/** + * Generates a progress bar CSS based. + * Requires css progress.css + * + * @param integer $progress Progress. + * @param string $width Width. + * @param string $height Height. + * @param string $color Color. + * @param boolean $return Return or paint (if false). + * + * @return string HTML code. + */ +function ui_progress( + $progress, + $width='100%', + $height='2em', + $color='#80ba27', + $return=true +) { + if (!$progress) { + $progress = 0; + } + + if ($progress > 100) { + $progress = 100; + } + + if ($progress < 0) { + $progress = 0; + } + + ui_require_css_file('progress'); + $output .= '
'; + $output .= ''.$progress.'%'; + $output .= '
'; + $output .= '
'; + + if (!$return) { + echo $output; + } + + return $output; +} + + /** * Print a code into a DIV and enable a toggle to show and hide it * diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 4a771b3017..f132c0db94 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -5945,6 +5945,43 @@ a#qr_code_agent_view { * --------------------------------------------------------------------- */ +.bullet_modules { + width: 15px; + height: 15px; + border-radius: 50%; + margin-right: 5px; + margin-top: -2px; +} + +div#bullets_modules { + display: inline-block; + margin-left: 2em; +} + +div#bullets_modules div { + display: inline-block; + margin: 0 0.5em; +} + +.orange_background { + background: #ffa631; +} +.red_background { + background: #fc4444; +} +.yellow_background { + background: #fad403; +} +.grey_background { + background: #b2b2b2; +} +.blue_background { + background: #3ba0ff; +} +.green_background { + background: #80ba27; +} + /* First row in agent view */ #agent_details_first_row { display: flex; @@ -5960,12 +5997,19 @@ a#qr_code_agent_view { } .agent_details_col_left { - width: 38%; + width: 40%; + min-width: 500px; +} + +.agent_details_content .agent_details_bullets { + position: relative; + left: -20%; } .agent_details_col_right { width: 62%; margin-left: 20px; + min-width: 670px; } .buttons_agent_view { @@ -5985,7 +6029,7 @@ a#qr_code_agent_view { /* Agent details in agent view */ .agent_details_header { display: flex; - justify-content: space-between; + justify-content: flex-end; align-items: center; border-bottom: 1px solid #e2e2e2; padding: 6px 20px; @@ -6005,6 +6049,7 @@ a#qr_code_agent_view { .agent_details_graph { width: 205px; text-align: center; + margin: 0 auto; } .agent_details_info { diff --git a/pandora_console/include/styles/progress.css b/pandora_console/include/styles/progress.css new file mode 100644 index 0000000000..0919269d37 --- /dev/null +++ b/pandora_console/include/styles/progress.css @@ -0,0 +1,18 @@ +span.progress_text { + position: absolute; + font-family: "lato-bolder", "Open Sans", sans-serif; + font-size: 2em; +} + +div.progress_main { + text-align: center; + height: 2.5em; + border: 1px solid #80ba27; +} + +div.progress { + width: 0%; + background: #80ba27; + height: 100%; + float: left; +} diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index d51057833f..c578259e60 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -1,17 +1,32 @@ '.' '.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').''; -} else if (($in_planned_downtime && !$agent['disabled']) || ($in_planned_downtime && !$agent['quiet'])) { - $agent_name .= ' '.ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png').''; + $agent_name .= ' '.ui_print_help_tip( + __('Agent in planned downtime'), + true, + 'images/minireloj-16.png' + ).''; +} else if (($in_planned_downtime && !$agent['disabled']) + || ($in_planned_downtime && !$agent['quiet']) +) { + $agent_name .= ' '.ui_print_help_tip( + __('Agent in planned downtime'), + true, + 'images/minireloj-16.png' + ).''; } $table_agent_header = '
'; if (!$config['show_group_name']) { - $table_agent_header .= ui_print_group_icon($agent['id_grupo'], true, 'groups_small', 'padding-right: 6px;'); + $table_agent_header .= ui_print_group_icon( + $agent['id_grupo'], + true, + 'groups_small', + 'padding-right: 6px;' + ); } -$table_agent_header .= $agent_name; $table_agent_header .= '
'; $status_img = agents_detail_view_status_img( @@ -109,16 +155,33 @@ $status_img = agents_detail_view_status_img( $table_agent_header .= '
'.$status_img.'
'; -// Fixed width non interactive charts +// Fixed width non interactive charts. $status_chart_width = 180; $graph_width = 180; $table_agent_graph = '
'; -$table_agent_graph .= graph_agent_status($id_agente, $graph_width, $graph_width, true, false, false, true); +$table_agent_graph .= graph_agent_status( + $id_agente, + $graph_width, + $graph_width, + true, + false, + false, + true +); $table_agent_graph .= '
'; -$table_agent_os = '

'.ui_print_os_icon($agent['id_os'], false, true, true, false, false, false, ['title' => __('OS').': '.get_os_name($agent['id_os'])]); -$table_agent_os .= empty($agent['os_version']) ? get_os_name((int) $agent['id_os']) : $agent['os_version'].'

'; +$table_agent_os = '

'.ui_print_os_icon( + $agent['id_os'], + false, + true, + true, + false, + false, + false, + ['title' => __('OS').': '.get_os_name($agent['id_os'])] +); +$table_agent_os .= (empty($agent['os_version'])) ? get_os_name((int) $agent['id_os']) : $agent['os_version'].'

'; $addresses = agents_get_addresses($id_agente); $address = agents_get_address($id_agente); @@ -158,8 +221,15 @@ $table_agent = '
'.$table_agent_header.'
'.$table_agent_count_modules.'
'.$table_agent_os.$table_agent_ip.$table_agent_version.$table_agent_description.'
'; -// END: TABLE AGENT BUILD -// START: TABLE CONTACT BUILD + +/* + * END: TABLE AGENT BUILD. + */ + +/* + *START: TABLE CONTACT BUILD. + */ + $table_contact = new stdClass(); $table_contact->id = 'agent_contact_main'; $table_contact->width = '100%'; @@ -168,7 +238,7 @@ $table_contact->cellpadding = 0; $table_contact->class = 'white_table white_table_no_border'; $table_contact->style[0] = 'width: 30%;'; $table_contact->style[1] = 'width: 70%;'; -$table_contact->headstyle[1] = 'padding-top:6px; padding-bottom:6px'; +$table_contact->headstyle[1] = 'padding-top:6px; padding-bottom:6px;padding-right: 10px;'; $table_contact->head[0] = ' '.__('Agent contact').''; @@ -210,8 +280,8 @@ $table_contact->data[] = $data; $data = []; $table_contact->colspan[3][0] = 2; -$data[0] = progress_bar($progress, 500, 30, '', 1, false, '#82b92e'); -// modo 1 para que muestre texto +$data[0] = ui_progress($progress); + if ($progress > 100) { $data[0] .= clippy_context_help('agent_out_of_limits'); } @@ -239,8 +309,14 @@ if (!$secondary_groups) { $table_contact->data[] = $data; -// END: TABLE CONTACT BUILD -// START: TABLE DATA BUILD +/* + * END: TABLE CONTACT BUILD + */ + +/* + * START: TABLE DATA BUILD + */ + $table_data = new stdClass(); $table_data->id = 'agent_data_main'; $table_data->width = '100%'; @@ -249,11 +325,18 @@ $table_data->cellpadding = 0; $table_data->class = 'white_table white_table_droppable'; $table_data->style = array_fill(0, 3, 'width: 25%;'); -$table_data->head[0] = html_print_image('images/arrow_down_green.png', true, $options); +$table_data->head[0] = html_print_image( + 'images/arrow_down_green.png', + true, + $options +); $table_data->head[0] .= ' '.__('Agent info').''; $table_data->head_colspan[0] = 4; -$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]); +$has_remote_conf = enterprise_hook( + 'config_agents_has_remote_configuration', + [$agent['id_agente']] +); if (enterprise_installed()) { $data = []; @@ -276,12 +359,14 @@ if (enterprise_installed()) { $table_data->data[] = $data; } -// Gis and url address +// Gis and url address. $data_opcional = []; -// Position Information +// Position Information. if ($config['activate_gis']) { $data_opcional[] = ''.__('Position (Long, Lat)').''; - $dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']); + $dataPositionAgent = gis_get_data_last_position_agent( + $agent['id_agente'] + ); if ($dataPositionAgent === false) { $data_opcional[] = __('There is no GIS data.'); @@ -299,7 +384,7 @@ if ($config['activate_gis']) { array_push($data_opcional); } -// If the url description is setted +// If the url description is set. if ($agent['url_address'] != '') { // $data_opcional = []; $data_opcional[] = ''.__('Url address').''; @@ -311,7 +396,7 @@ if ($agent['url_address'] != '') { } -// Other IP address and timezone offset +// Other IP address and timezone offset. if (!empty($addresses)) { // $data_opcional = []; $data_opcional[] = ''.__('Other IP addresses').''; @@ -322,7 +407,7 @@ if (!empty($addresses)) { array_push($data_opcional); } -// Timezone Offset +// Timezone Offset. if ($agent['timezone_offset'] != 0) { $data_opcional[] = ''.__('Timezone Offset').''; if ($agent['timezone_offset'] != 0) { @@ -339,7 +424,7 @@ foreach ($data_opcional as $key => $value) { } -// Custom fields +// Custom fields. $fields = db_get_all_rows_filter( 'tagent_custom_fields', ['display_on_front' => 1] @@ -392,28 +477,52 @@ for ($i = 0; $i <= $custom_fields_count; $i++) { $i++; } -// END: TABLE DATA BUILD -// START: ACCESS RATE GRAPH +/* + * END: TABLE DATA BUILD + */ + +/* + * START: ACCESS RATE GRAPH + */ + $access_agent = db_get_value_sql( 'SELECT COUNT(id_agent) FROM tagent_access WHERE id_agent = '.$id_agente ); + if ($config['agentaccess'] && $access_agent > 0) { $table_access_rate = '
-
'.html_print_image('images/arrow_down_green.png', true).''.__('Agent access rate (24h)').'
-
'.graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true).'
-
'; +
'.html_print_image( + 'images/arrow_down_green.png', + true + ).''.__('Agent access rate (24h)').'
+
'.graphic_agentaccess( + $id_agente, + '95%', + 100, + SECONDS_1DAY, + true + ).'
+
'; } -// END: ACCESS RATE GRAPH -// START: TABLE INCIDENTS +/* + * END: ACCESS RATE GRAPH + */ + +/* + * START: TABLE INCIDENTS + */ + $last_incident = db_get_row_sql( - " - SELECT * FROM tincidencia - WHERE estado IN (0,1) - AND id_agent = $id_agente - ORDER BY actualizacion DESC" + sprintf( + 'SELECT * FROM tincidencia + WHERE estado IN (0,1) + AND id_agent = %d + ORDER BY actualizacion DESC', + $id_agente + ) ); if ($last_incident != false) { @@ -424,7 +533,7 @@ if ($last_incident != false) { $table_incident->class = 'white_table'; $table_incident->style = array_fill(0, 3, 'width: 25%;'); - $table_incident->head[0] = ' '.__('Active incident on this agent').''.''; + $table_incident->head[0] = ' '.__('Active incident on this agent').''; $table_incident->head_colspan[0] = 4; $data = []; @@ -442,8 +551,14 @@ if ($last_incident != false) { $table_incident->data[] = $data; } -// END: TABLE INCIDENTS -// START: TABLE INTERFACES +/* + * END: TABLE INCIDENTS + */ + +/* + * START: TABLE INTERFACES + */ + $network_interfaces_by_agents = agents_get_network_interfaces([$agent]); $network_interfaces = []; @@ -476,7 +591,11 @@ if (!empty($network_interfaces)) { 'class' => 'closed', 'style' => 'cursor:pointer;', ]; - $table_interface->head[0] = html_print_image('images/arrow_down_green.png', true, $options).'  '; + $table_interface->head[0] = html_print_image( + 'images/arrow_down_green.png', + true, + $options + ).'  '; $table_interface->head[0] .= ''.__('Interface information').' (SNMP)'; $table_interface->head_colspan = []; $table_interface->head_colspan[0] = 8; @@ -497,7 +616,7 @@ if (!empty($network_interfaces)) { $params_json = json_encode($params); $params_encoded = base64_encode($params_json); $win_handle = dechex(crc32($interface['status_module_id'].$interface_name)); - $graph_link = "".html_print_image('images/chart_curve.png', true, ['title' => __('Interface traffic')]).''; + $graph_link = "".html_print_image('images/chart_curve.png', true, ['title' => __('Interface traffic')]).''; } else { $graph_link = ''; } @@ -520,9 +639,9 @@ if (!empty($network_interfaces)) { $status_condition = ' AND (estado = 0 OR estado = 1) '; $unixtime = (get_system_time() - SECONDS_1DAY); - // last hour + // Last hour. $time_condition = 'AND (utimestamp > '.$unixtime.')'; - // Tags ACLS + // Tags ACLs. if ($id_group > 0 && in_array(0, $user_groups_ids)) { $group_array = (array) $id_group; } else { @@ -545,18 +664,16 @@ if (!empty($network_interfaces)) { $id_modules_array[] = $interface['status_module_id']; $unixtime = (get_system_time() - SECONDS_1DAY); - // last hour + // Last hour. $time_condition = 'WHERE (te.utimestamp > '.$unixtime.')'; $sqlEvents = sprintf( - ' - SELECT * + 'SELECT * FROM tevento te INNER JOIN tagente_estado tae ON te.id_agentmodule = tae.id_agente_modulo AND tae.id_agente_modulo IN (%s) - %s - ', + %s', implode(',', $id_modules_array), $time_condition ); @@ -600,8 +717,12 @@ if (!empty($network_interfaces)) { } } -// END: TABLE INTERFACES - // This javascript piece of code is used to make expandible the body of the table +/* + * END: TABLE INTERFACES + */ + + // This javascript piece of code is used to make expandible + // the body of the table. ?> - -
'.html_print_image('images/arrow_down_green.png', true).''.__('Events (24h)').'
-
'.graph_graphic_agentevents($id_agente, 100, 45, SECONDS_1DAY, '', true, true).'
-
'; + +
'.html_print_image( + 'images/arrow_down_green.png', + true +).''.__('Events (24h)').'
+
'.graph_graphic_agentevents( + $id_agente, + 100, + 45, + SECONDS_1DAY, + '', + true, + true +).'
+
'; - $agent_contact = html_print_table($table_contact, true); +/* + * EVENTS TABLE END. + */ - $agent_info = empty($table_data->data) ? '' : html_print_table($table_data, true); +$agent_contact = html_print_table($table_contact, true); - $agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true); +$agent_info = empty($table_data->data) ? '' : html_print_table($table_data, true); - echo '
-
'.$table_agent.'
-
'.$agent_contact.'
-
'.$agent_info.'
'.$table_access_rate.$table_events.'
'.$agent_incidents; +$agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true); - if (isset($table_interface)) { - echo html_print_table($table_interface, true); - } +echo '
+
'.$table_agent.'
+
'.$agent_contact.'
+
'.$agent_info; + +// Show both graphs, events and access rate. +if ($table_access_rate) { + echo '
'.$table_access_rate.$table_events.'
'; +} else { + echo '
'.$table_events.'
'; +} + +echo $agent_incidents; + +if (isset($table_interface)) { + echo html_print_table($table_interface, true); +} diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index b311885acb..c387a437d7 100755 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -134,7 +134,12 @@ $sort = get_parameter('sort', 'up'); echo "

"; -echo ui_print_help_tip(__('To see the list of modules paginated, enable this option in the Styles Configuration.'), true).__('Full list of monitors').' '.reporting_tiny_stats($agent, true, 'modules'); +echo ui_print_help_tip( + __('To see the list of modules paginated, enable this option in the Styles Configuration.'), + true +); +echo ''.__('Full list of monitors').''; +echo reporting_tiny_stats($agent, true, 'modules'); $modules_not_init = agents_monitor_notinit($id_agente); if (!empty($modules_not_init)) { @@ -514,4 +519,3 @@ function print_form_filter_monitors( echo $form_text; } - From f57915285fd30c26d77ffff3c2adf219c2bc0710 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 22:36:55 +0200 Subject: [PATCH 19/61] review styles agent view --- pandora_console/include/ajax/events.php | 12 +- pandora_console/include/functions_events.php | 2 +- pandora_console/include/functions_html.php | 7 +- .../include/functions_reporting.php | 106 ++++++++++++------ pandora_console/include/functions_ui.php | 4 +- pandora_console/include/styles/pandora.css | 8 ++ pandora_console/include/styles/progress.css | 1 + .../agentes/estado_generalagente.php | 12 +- .../operation/agentes/estado_monitores.php | 63 +++++++++-- 9 files changed, 166 insertions(+), 49 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 6ba163c7ed..ef4bc1592b 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -717,9 +717,15 @@ if ($table_events) { 'event_condition', 'AND' ); - echo '
'; - echo ''; - echo html_print_checkbox('all_events_24h', $all_events_24h, $all_events_24h, true, false, '', true); + echo '
'; + echo ''; + echo html_print_switch( + [ + 'name' => 'all_events_24h', + 'value' => $all_events_24h, + 'id' => 'checkbox-all_events_24h', + ] + ); echo '
'; $date_subtract_day = (time() - (24 * 60 * 60)); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 52eb525bc1..4d2238f274 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -997,7 +997,7 @@ function events_print_event_table( $table->cellpadding = 0; $table->cellspacing = 0; $table->width = $width; - $table->class = 'databox data'; + $table->class = 'info_table'; if (!$tactical_view) { $table->title = __('Latest events'); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 53ab0bbb75..ca3eb3f971 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2989,6 +2989,7 @@ function html_print_switch($attributes=[]) 'class', 'name', 'onclick', + 'onchange', ]; foreach ($valid_attrs as $va) { if (!isset($attributes[$va])) { @@ -2998,7 +2999,11 @@ function html_print_switch($attributes=[]) $html_expand .= ' '.$va.'="'.$attributes[$va].'"'; } - return "