From 9eecc414dd3baeb34d58c5e66d5cc2e8a186c038 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 27 May 2019 14:12:53 +0200 Subject: [PATCH] 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';