From 5b7f7965101207e42118a2d5efd11c500ba7ee4c Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Fri, 28 Dec 2018 11:45:48 +0100 Subject: [PATCH 01/25] Changed popup windows by tooltips Former-commit-id: 478e63e4bf81bb663898bba1afa76c7ab02ac6d9 --- .../godmode/agentes/module_manager_editor_wmi.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_wmi.php b/pandora_console/godmode/agentes/module_manager_editor_wmi.php index c177db7790..d97f456d5b 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_wmi.php +++ b/pandora_console/godmode/agentes/module_manager_editor_wmi.php @@ -44,8 +44,8 @@ else { $data = array (); $data[0] = __('Target IP'); $data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true); -$data[2] = __('Namespace'); -$data[2] .= ui_print_help_icon ('wminamespace', true); +$data[2] = __('Namespace') . + ui_print_help_tip (__("Optional. WMI namespace. If unsure leave blank."), true); $data[3] = html_print_input_text ('tcp_send', $tcp_send, '', 5, 20, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); push_table_simple ($data, 'target_ip'); @@ -70,12 +70,12 @@ $table_simple->colspan['wmi_query'][1] = 3; push_table_simple ($data, 'wmi_query'); $data = array (); -$data[0] = __('Key string'); -$data[0] .= ui_print_help_icon ('wmikey', true); +$data[0] = __('Key string') . + ui_print_help_tip (__("Optional. Substring to look for in the WQL query result. The module returns 1 if found, 0 if not."), true); $data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 20, 60, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); -$data[2] = __('Field number'); -$data[2] .= ui_print_help_icon ('wmifield', true); +$data[2] = __('Field number'). + ui_print_help_tip (__("Column number to retrieve from the WQL query result (starting from zero)."), true); $data[3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); From 9212e6a8920785e4a217fd60c76429e940de484a Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Wed, 9 Jan 2019 16:06:08 +0100 Subject: [PATCH 02/25] Visual change in the data of general type reports Former-commit-id: fda11ae1c7233653728da7855fd010983a35d4fe --- .../include/functions_reporting_html.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 182977207d..2e4b2b521a 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2570,6 +2570,15 @@ function reporting_html_general(&$table, $item) { /* End - Order by agent */ foreach ($item['data'] as $row) { + $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $row['module']); + if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + $row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN); + } + if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 1){ + $row['formated_value'] = "Up"; + }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 0){ + $row['formated_value'] = "Down"; + } if ($item['date']['period'] != 0) { $table1->data[] = array( $row['agent'], @@ -2640,8 +2649,18 @@ function reporting_html_general(&$table, $item) { $row['agent'] = $agent; $table1->style['agent'] = 'text-align: center;'; foreach ($list_modules as $name) { + $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $name); + if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + $modules[$name] = round($modules[$name], 0, PHP_ROUND_HALF_DOWN); + } $table1->style[$name] = 'text-align: center;'; if (isset($modules[$name])) { + if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 1){ + $modules[$name] = "Up"; + }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 0){ + hd( $modules[$name], true); + $modules[$name] = "Down"; + } $row[$name] = $modules[$name]; } else { From 439f1db62055edd048425ac179d6c2ead9ba000e Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 9 Jan 2019 18:11:21 +0100 Subject: [PATCH 03/25] Fixed link in cron job and visual console manager Former-commit-id: 6533fcc628157231c7bd524d878c144faac02447 --- pandora_console/godmode/reporting/map_builder.php | 9 +++++++++ .../godmode/reporting/visual_console_favorite.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index a9df342750..cebc0b6c8a 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -43,6 +43,7 @@ else{ $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; + $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $pure = (int)get_parameter('pure', 0); @@ -74,6 +75,14 @@ if($is_enterprise && $vconsoles_manage){ 'text' => '' . html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'' ); + + if ($is_metaconsole) { + $buttons['visual_console_manager'] = array( + 'active' => false, + 'text' => '' . + html_print_image ("images/builder.png", true, array ("title" => __('Visual Console Manager'))) .'' + ); + } } if (!$is_metaconsole) { diff --git a/pandora_console/godmode/reporting/visual_console_favorite.php b/pandora_console/godmode/reporting/visual_console_favorite.php index a660a81007..0031879a32 100644 --- a/pandora_console/godmode/reporting/visual_console_favorite.php +++ b/pandora_console/godmode/reporting/visual_console_favorite.php @@ -42,6 +42,7 @@ else{ $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; + $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $buttons['visual_console'] = array( @@ -68,6 +69,14 @@ if($is_enterprise && $vconsoles_manage){ 'text' => '' . html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'' ); + + if ($is_metaconsole) { + $buttons['visual_console_manager'] = array( + 'active' => false, + 'text' => '' . + html_print_image ("images/builder.png", true, array ("title" => __('Visual Console Manager'))) .'' + ); + } } if (!$is_metaconsole) { From cc7e9e55375bdf5980784e0f1cab6aac28c11c87 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Thu, 10 Jan 2019 17:33:24 +0100 Subject: [PATCH 04/25] Visuals changes in the data of general type reports Former-commit-id: 15d0c6f67d2b1cafddd372c96807e8c4201c4f7f --- .../include/functions_reporting.php | 19 +++++++++++++---- .../include/functions_reporting_html.php | 21 ++++--------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3209a61492..9683fc5158 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6126,7 +6126,7 @@ function reporting_general($report, $content) { $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row['id_agent_module']); - + $id_module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $mod_name); if ($content['period'] == 0) { $data_res[$index] = modules_get_last_value($row['id_agent_module']); @@ -6167,9 +6167,21 @@ function reporting_general($report, $content) { $agent_name[$index] = $ag_name; $module_name[$index] = $mod_name; $units[$index] = $unit; + $id_module_types[$index] = $id_module_type; $operations[$index] = $row['operation']; break; case REPORT_GENERAL_GROUP_BY_AGENT: + $id_module_types[$index] = $id_module_type; + if($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18 ){ + $data_res[$index] = round($data_res[$index], 0, PHP_ROUND_HALF_DOWN); + } + if($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18 ){ + if($data_res[$index] == 1){ + $data_res[$index] = "Up"; + }elseif($data_res[$index] == 0){ + $data_res[$index] = "Down"; + } + } if ($data_res[$index] === false) { $return["data"][$ag_name][$mod_name] = null; } @@ -6178,6 +6190,7 @@ function reporting_general($report, $content) { $return["data"][$ag_name][$mod_name] = $data_res[$index]; } else { + hd($data_res[$index], true); $return["data"][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2) . " " . $unit; } @@ -6267,8 +6280,6 @@ function reporting_general($report, $content) { break; } - - $i = 0; foreach ($data_res as $d) { $data = array(); @@ -6276,7 +6287,7 @@ function reporting_general($report, $content) { $data['module'] = $module_name[$i]; $data['id_agent_module'] = $id_agent_module[$i]; $data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]); - + $data['id_module_type'] = $id_module_types[$i]; $data['operator'] = ""; if ($content['period'] != 0) { switch ($operations[$i]) { diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 2e4b2b521a..e9a3f41029 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2568,15 +2568,14 @@ function reporting_html_general(&$table, $item) { array_multisort($aux, SORT_ASC, $item['data']); /* End - Order by agent */ - + foreach ($item['data'] as $row) { - $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $row['module']); - if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + if($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2){ $row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN); } - if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 1){ + if(($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 1){ $row['formated_value'] = "Up"; - }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 0){ + }elseif(($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 0){ $row['formated_value'] = "Down"; } if ($item['date']['period'] != 0) { @@ -2639,28 +2638,16 @@ function reporting_html_general(&$table, $item) { } } $list_modules = array_keys($list_modules); - $table1->width = '99%'; $table1->data = array (); $table1->head = array_merge(array(__('Agent')), $list_modules); foreach ($item['data'] as $agent => $modules) { $row = array(); - $row['agent'] = $agent; $table1->style['agent'] = 'text-align: center;'; foreach ($list_modules as $name) { - $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $name); - if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ - $modules[$name] = round($modules[$name], 0, PHP_ROUND_HALF_DOWN); - } $table1->style[$name] = 'text-align: center;'; if (isset($modules[$name])) { - if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 1){ - $modules[$name] = "Up"; - }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 0){ - hd( $modules[$name], true); - $modules[$name] = "Down"; - } $row[$name] = $modules[$name]; } else { From 0d48b4573a66e0f51d63d05eba427d3bf938e14f Mon Sep 17 00:00:00 2001 From: samucarc Date: Mon, 14 Jan 2019 18:54:43 +0100 Subject: [PATCH 05/25] Fixed Label in the Console Menu Former-commit-id: eb73f14fa5631dd481b36711ea0bb62943ec43e5 --- pandora_console/general/main_menu.php | 19 +++++++++++++++++-- pandora_console/include/functions_menu.php | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index 8cb37fa2c4..3c82b4659f 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.php @@ -324,6 +324,23 @@ $(document).ready( function() { } else { $('div#title_menu').hide(); + if(!click_display){ + $('#menu').mouseenter(function() { + handsInMenu = 1; + openTimeMenu = new Date().getTime(); + $('ul.submenu').css('left', '44px'); + }).mouseleave(function() { + handsInMenu = 0; + setTimeout(function() { + openedMenu = new Date().getTime() - openTimeMenu; + if(openedMenu > 1000 && handsInMenu == 0) { + $('li.menu_icon').removeClass( " no_hidden_menu"); + $('li.menu_icon').find('li').removeClass( " no_hidden_menu" ); + $('ul.submenu').css('left', '44px'); + } + }, 2500); + }); + } } }); /* ]]> */ @@ -336,7 +353,6 @@ $(document).ready( function() { handsIn2 = 0; if(!click_display){ - if (autohidden_menu) { $('.menu_icon').mouseenter(function() { table_hover = $(this); handsIn = 1; @@ -356,7 +372,6 @@ $(document).ready( function() { } }, 2500); }); - } }else{ $(document).ready(function() { if (autohidden_menu) { diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index a07bde5528..3e80acfc9d 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -395,7 +395,7 @@ function menu_print_menu (&$menu) { $seleccionado = ''; //Print out the first level - $output .= '
  • '; + $output .= '
  • '; //onclick="location.href=\'index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'\'">'; $length = strlen(__($main["text"])); From fd2dcb3281f08a1c0b529c79aea6ccb65144e00d Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Thu, 17 Jan 2019 17:28:23 +0100 Subject: [PATCH 06/25] Changed radio buttons by toogle switch checkbox Former-commit-id: d4b46db05fa38e268e0c6f82979bca52fec36e78 --- pandora_console/godmode/setup/performance.php | 9 +-- pandora_console/godmode/setup/setup_auth.php | 15 +--- .../godmode/setup/setup_ehorus.php | 4 +- .../godmode/setup/setup_general.php | 65 ++++++++-------- .../godmode/setup/setup_visuals.php | 36 +++++---- pandora_console/include/functions_html.php | 77 +++++++++++++++++++ pandora_console/include/styles/pandora.css | 74 +++++++++++++----- 7 files changed, 190 insertions(+), 90 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index ceeae084c8..ae8777dfa6 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -115,22 +115,19 @@ $table_other->data[3][0] = __('Default hours for event view'); $table_other->data[3][1] = html_print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true); $table_other->data[5][0] = __('Use realtime statistics'); -$table_other->data[5][1] = __('Yes').' '.html_print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'  '; -$table_other->data[5][1] .= __('No').' '.html_print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true); +$table_other->data[5][1] = html_print_checkbox_toogle_switch ('realtimestats', 1, $config["realtimestats"], true); $table_other->data[6][0] = __('Batch statistics period (secs)') . ui_print_help_tip(__('If realtime statistics are disabled, statistics interval resfresh will be set here.'), true); $table_other->data[6][1] = html_print_input_text ('stats_interval', $config["stats_interval"], '', 5, 5, true); $table_other->data[7][0] = __('Use agent access graph') . ui_print_help_icon("agent_access", true); -$table_other->data[7][1] = __('Yes').' '.html_print_radio_button ('agentaccess', 1, '', $config["agentaccess"], true).'  '; -$table_other->data[7][1] .= __('No').' '.html_print_radio_button ('agentaccess', 0, '', $config["agentaccess"], true); +$table_other->data[7][1] = html_print_checkbox_toogle_switch ('agentaccess', 1, $config["agentaccess"], true); $table_other->data[8][0] = __('Max. recommended number of files in attachment directory') . ui_print_help_tip(__('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), true); $table_other->data[8][1] = html_print_input_text ('num_files_attachment', $config["num_files_attachment"], '', 5, 5, true); $table_other->data[9][0] = __('Delete not init modules'); -$table_other->data[9][1] = __('Yes').' '.html_print_radio_button ('delete_notinit', 1, '', $config["delete_notinit"], true).'  '; -$table_other->data[9][1] .= __('No').' '.html_print_radio_button ('delete_notinit', 0, '', $config["delete_notinit"], true); +$table_other->data[9][1] = html_print_checkbox_toogle_switch ('delete_notinit', 1, $config["delete_notinit"], true); $table_other->data[10][0] = __('Big Operation Step to purge old data') . ui_print_help_tip(__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), true); $table_other->data[10][1] = html_print_input_text ('big_operation_step_datos_purge', $config["big_operation_step_datos_purge"], '', 5, 5, true); diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 3adf8adf8a..d09449dd1a 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -48,16 +48,14 @@ if (is_ajax ()) { $row = array(); $row['name'] = __('Fallback to local authentication') . ui_print_help_tip(__("Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed."), true); - $row['control'] = __('Yes').' '.html_print_radio_button('fallback_local_auth', 1, '', $config['fallback_local_auth'], true).'  '; - $row['control'] .= __('No').' '.html_print_radio_button('fallback_local_auth', 0, '', $config['fallback_local_auth'], true); + $row['control'] = html_print_checkbox_toogle_switch ('fallback_local_auth', 1, $config['fallback_local_auth'], true); $table->data['fallback_local_auth'] = $row; if (enterprise_installed()) { // Autocreate remote users $row = array(); $row['name'] = __('Autocreate remote users'); - $row['control'] = __('Yes').' '.html_print_radio_button_extended('autocreate_remote_users', 1, '', $config['autocreate_remote_users'], false, '', '', true).'  '; - $row['control'] .= __('No').' '.html_print_radio_button_extended('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, '', '', true); + $row['control'] = html_print_checkbox_toogle_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).'  '; $table->data['autocreate_remote_users'] = $row; add_enterprise_auth_autocreate_profiles($table, $type_auth); @@ -91,8 +89,7 @@ if (is_ajax ()) { // Start TLS $row = array(); $row['name'] = __('Start TLS'); - $row['control'] = __('Yes').' '.html_print_radio_button ('ldap_start_tls', 1, '', $config['ldap_start_tls'], true).'  '; - $row['control'] .= __('No').' '.html_print_radio_button ('ldap_start_tls', 0, '', $config['ldap_start_tls'], true); + $row['control'] = html_print_checkbox_toogle_switch ('ldap_start_tls', 1, $config['ldap_start_tls'], true); $table->data['ldap_start_tls'] = $row; // Base DN @@ -138,11 +135,7 @@ if (is_ajax ()) { $row = array(); $row['name'] = __('Double authentication') . ui_print_help_tip(__("If this option is enabled, the users can use double authentication with their accounts"), true); - $row['control'] = __('Yes') . ' '; - $row['control'] .= html_print_radio_button('double_auth_enabled', 1, '', $config['double_auth_enabled'], true); - $row['control'] .= '  '; - $row['control'] .= __('No') .' '; - $row['control'] .= html_print_radio_button('double_auth_enabled', 0, '', $config['double_auth_enabled'], true); + $row['control'] = html_print_checkbox_toogle_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true); $table->data['double_auth_enabled'] = $row; // Session timeout diff --git a/pandora_console/godmode/setup/setup_ehorus.php b/pandora_console/godmode/setup/setup_ehorus.php index 14d4d35215..bc3a5c220e 100644 --- a/pandora_console/godmode/setup/setup_ehorus.php +++ b/pandora_console/godmode/setup/setup_ehorus.php @@ -52,8 +52,8 @@ $table_enable->style['name'] = 'font-weight: bold'; // Enable eHorus $row = array(); $row['name'] = __('Enable eHorus'); -$row['control'] = __('Yes').' '.html_print_radio_button ('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'  '; -$row['control'] .= __('No').' '.html_print_radio_button ('ehorus_enabled', 0, '', $config['ehorus_enabled'], true); +$row['control'] = __('Enabled').' '.html_print_radio_button ('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'  '; +$row['control'] .= __('Disabled').' '.html_print_radio_button ('ehorus_enabled', 0, '', $config['ehorus_enabled'], true); $row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true); $table_enable->data['ehorus_enabled'] = $row; diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index b935f4fc13..02bce13696 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -72,16 +72,17 @@ $sources["sql"] = __('Database'); $table->data[9][1] = html_print_select ($sources, 'timesource', $config["timesource"], '', '', '', true); $table->data[10][0] = __('Automatic check for updates'); -$table->data[10][1] = __('Yes').'   '.html_print_radio_button ('autoupdate', 1, '', $config["autoupdate"], true).'  '; -$table->data[10][1] .= __('No').'   '.html_print_radio_button ('autoupdate', 0, '', $config["autoupdate"], true); +$table->data[10][1] = html_print_checkbox_toogle_switch('autoupdate', 1, $config["autoupdate"], true); + +echo""; $table->data[11][0] = __('Enforce https'); -$table->data[11][1] = __('Yes').'   '.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to %s Console. Do you want to continue?', get_product_name()) . "')) return false", '', true) .'  '; -$table->data[11][1] .= __('No').'   '.html_print_radio_button ('https', 0, '', $config["https"], true); +$table->data[11][1] = html_print_checkbox_toogle_switch_extended ('https', 1, $config["https"], false, '', '', true) ; $table->data[12][0] = __('Use cert of SSL'); -$table->data[12][1] = __('Yes').'   '.html_print_radio_button_extended ('use_cert', 1, '', $config["use_cert"], false, '', '', true) .'  '; -$table->data[12][1] .= __('No').'   '.html_print_radio_button ('use_cert', 0, '', $config["use_cert"], true); +$table->data[12][1] = html_print_checkbox_toogle_switch_extended ('use_cert', 1, $config["use_cert"], false, '', '', true); $table->rowstyle[13] = 'display: none;'; $table->data[13][0] = __('Path of SSL Cert.') . ui_print_help_tip (__("Path where you put your cert and name of this cert. Remember your cert only in .pem extension."), true); @@ -104,8 +105,7 @@ $table->data[16][0] = __('API password') . $table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); $table->data[17][0] = __('Enable GIS features'); -$table->data[17][1] = __('Yes').'   '.html_print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'  '; -$table->data[17][1] .= __('No').'   '.html_print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true); +$table->data[17][1] = html_print_checkbox_toogle_switch ('activate_gis', 1, $config["activate_gis"], true); $table->data[19][0] = __('Enable Netflow'); $rbt_disabled = false; @@ -113,8 +113,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $rbt_disabled = true; $table->data[19][0] .= ui_print_help_tip (__('Not supported in Windows systems'), true); } -$table->data[19][1] = __('Yes').'   '.html_print_radio_button_extended ('activate_netflow', 1, '', $config["activate_netflow"], $rbt_disabled, '', '', true).'  '; -$table->data[19][1] .= __('No').'   '.html_print_radio_button_extended ('activate_netflow', 0, '', $config["activate_netflow"], $rbt_disabled, '', '', true); +$table->data[19][1] = html_print_checkbox_toogle_switch_extended ('activate_netflow', 1, $config["activate_netflow"], $rbt_disabled, '', '', true); $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarctica' => __('Antarctica'), 'Arctic' => __('Arctic'), 'Asia' => __('Asia'), 'Atlantic' => __('Atlantic'), 'Australia' => __('Australia'), 'Europe' => __('Europe'), 'Indian' => __('Indian'), 'Pacific' => __('Pacific'), 'UTC' => __('UTC')); @@ -168,25 +167,16 @@ $table->data[28][1] = html_print_input_text ('public_url', $config['public_url'] $table->data[29][0] = __('Referer security'); $table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true); -$table->data[29][1] = __('Yes') . '   ' . - html_print_radio_button ('referer_security', 1, '', $config["referer_security"], true) . - '  '; -$table->data[29][1] .= __('No') . '   ' . - html_print_radio_button ('referer_security', 0, '', $config["referer_security"], true); +$table->data[29][1] = html_print_checkbox_toogle_switch ('referer_security', 1, $config["referer_security"], true); $table->data[30][0] = __('Event storm protection'); $table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true); -$table->data[30][1] = __('Yes') . '   ' . - html_print_radio_button ('event_storm_protection', 1, '', $config["event_storm_protection"], true) . - '  '; -$table->data[30][1] .= __('No') . '   ' . - html_print_radio_button ('event_storm_protection', 0, '', $config["event_storm_protection"], true); +$table->data[30][1] = html_print_checkbox_toogle_switch ('event_storm_protection', 1, $config["event_storm_protection"], true); $table->data[31][0] = __('Command Snapshot') . ui_print_help_tip(__('The string modules with several lines show as command output'), true); -$table->data[31][1] = __('Yes').'   '.html_print_radio_button ('command_snapshot', 1, '', $config["command_snapshot"], true).'  '; -$table->data[31][1] .= __('No').'   '.html_print_radio_button ('command_snapshot', 0, '', $config["command_snapshot"], true); +$table->data[31][1] = html_print_checkbox_toogle_switch ('command_snapshot', 1, $config["command_snapshot"], true); $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Directory where the server logs are stored."), true); $table->data[32][1] = html_print_input_text ('server_log_dir', @@ -210,8 +200,7 @@ $table->data['tutorial_mode'][1] = $config["past_planned_downtimes"] = isset($config["past_planned_downtimes"]) ? $config["past_planned_downtimes"] : 1; $table->data[34][0] = __('Allow create planned downtimes in the past') . ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true); -$table->data[34][1] = __('Yes').'   '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'  '; -$table->data[34][1] .= __('No').'   '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true); +$table->data[34][1] =html_print_checkbox_toogle_switch ('past_planned_downtimes', 1, $config["past_planned_downtimes"], true); $table->data[35][0] = __('Limit for bulk operations') . ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get("max_input_vars")), true); @@ -219,17 +208,14 @@ $table->data[35][1] = html_print_input_text('limit_parameters_massive', $config['limit_parameters_massive'], '', 10, 10, true); $table->data[36][0] = __('Include agents manually disabled'); -$table->data[36][1] = __('Yes').'   '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).'  '; -$table->data[36][1] .= __('No').'   '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true); +$table->data[36][1] = html_print_checkbox_toogle_switch ('include_agents', 1, $config["include_agents"], true); $table->data[37][0] = __('Audit log directory') . ui_print_help_tip (__("Directory where audit log is stored."), true); $table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true); $table->data[38][0] = __('Set alias as name by default in agent creation'); -$table->data[38][1] = __('Yes').'   '.html_print_radio_button ('alias_as_name', 1, '', $config["alias_as_name"], true).'  '; -$table->data[38][1] .= __('No').'   '.html_print_radio_button ('alias_as_name', 0, '', $config["alias_as_name"], true); - +$table->data[38][1] = html_print_checkbox_toogle_switch ('alias_as_name', 1, $config["alias_as_name"], true); echo '
    '; echo "
    "; @@ -293,15 +279,24 @@ $(document).ready (function () { $("#timezone").attr("hidden", false); }); $("input[name=use_cert]").change(function () { - if( $(this).is(":checked") ){ - var val = $(this).val(); - if (val == 1) { + if( $(this).is(":checked") ) $('#setup_general-13').show(); - } else $('#setup_general-13').hide(); - } + }); + $("input[name=https]").change(function (){ + if($("input[name=https]").prop('checked')) { + $("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({ + modal: true, + buttons:{ + "": function(){ + $(this).dialog("close"); + } + } + }); + } + }) }); +?> \ No newline at end of file diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index d8902f2bc0..05b2c44da5 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -78,12 +78,12 @@ $table_behaviour->data[$row][1] = html_print_select ($values, 'vc_refr', $config $row++; $table_behaviour->data[$row][0] = __('Paginated module view'); -$table_behaviour->data[$row][1] = html_print_checkbox('paginate_module', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('paginate_module', 1, $config['paginate_module'], true); $row++; $table_behaviour->data[$row][0] = __('Display data of proc modules in other format'); -$table_behaviour->data[$row][1] = html_print_checkbox('render_proc', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('render_proc', 1, $config['render_proc'], true); $row++; @@ -98,7 +98,7 @@ $row++; //Daniel maya 02/06/2016 Display menu with click --INI $table_behaviour->data[$row][0] = __('Click to display lateral menus'). ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true); -$table_behaviour->data[$row][1] = html_print_checkbox('click_display', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('click_display', 1, $config['click_display'], true); $row++; //Daniel maya 02/06/2016 Display menu with click --END @@ -116,7 +116,7 @@ if (enterprise_installed()) { $table_behaviour->data[$row][0] = __('Classic menu mode'). ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true); -$table_behaviour->data[$row][1] = html_print_checkbox('classic_menu', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('classic_menu', 1, $config['classic_menu'], true); $row++; @@ -385,7 +385,7 @@ if(enterprise_installed()) { if (enterprise_installed()){ $table_styles->data[$row][0] = __('Disable logo in graphs'); - $table_styles->data[$row][1] = html_print_checkbox('fixed_graph', 1, + $table_styles->data[$row][1] = html_print_checkbox_toogle_switch('fixed_graph', 1, $config['fixed_graph'], true); $row++; } @@ -396,27 +396,27 @@ You can of course remove the warnings, that's why we include the source and do n */ $table_styles->data[$row][0] = __('Disable helps'); -$table_styles->data[$row][1] = html_print_checkbox('disable_help', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('disable_help', 1, $config['disable_help'], true); $row++; $table_styles->data[$row][0] = __('Fixed header'); -$table_styles->data[$row][1] = html_print_checkbox('fixed_header', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('fixed_header', 1, $config['fixed_header'], true); $row++; $table_styles->data[$row][0] = __('Fixed menu'); -$table_styles->data[$row][1] = html_print_checkbox('fixed_menu', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('fixed_menu', 1, $config['fixed_menu'], true); $row++; // For 5.1 Autohidden menu feature $table_styles->data['autohidden'][0] = __('Autohidden menu'); -$table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu', +$table_styles->data['autohidden'][1] = html_print_checkbox_toogle_switch('autohidden_menu', 1, $config['autohidden_menu'], true); $table_styles->data[$row][0] = __('Visual effects and animation'); -$table_styles->data[$row][1] = html_print_checkbox('visual_animation', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('visual_animation', 1, $config['visual_animation'], true); echo "
    "; @@ -437,7 +437,7 @@ $table_gis->data = array (); $table_gis->data[$row][0] = __('GIS Labels') . ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true); -$table_gis->data[$row][1] = html_print_checkbox('gis_label', 1, +$table_gis->data[$row][1] = html_print_checkbox_toogle_switch('gis_label', 1, $config['gis_label'], true); $row++; @@ -528,7 +528,7 @@ $row++; $table_font->data[$row][0] = __('Show unit along with value in reports') . ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true); -$table_font->data[$row][1] = html_print_checkbox('simple_module_value', 1, +$table_font->data[$row][1] = html_print_checkbox_toogle_switch('simple_module_value', 1, $config['simple_module_value'], true); $row++; @@ -615,7 +615,7 @@ $table_chars->data[$row][1] = html_print_input_text ('custom_graph_width', $row++; $table_chars->data[$row][0] = __('Use round corners'); -$table_chars->data[$row][1] = html_print_checkbox('round_corner', 1, +$table_chars->data[$row][1] = html_print_checkbox_toogle_switch('round_corner', 1, $config['round_corner'], true); $row++; @@ -765,7 +765,7 @@ $table_other->data = array (); $table_other->data[$row][0] = __('Show report info with description') . ui_print_help_tip( __('Custom report description info. It will be applied to all reports and templates by default.'), true); -$table_other->data[$row][1] = html_print_checkbox('custom_report_info', 1, +$table_other->data[$row][1] = html_print_checkbox_toogle_switch('custom_report_info', 1, $config['custom_report_info'], true); $row++; @@ -777,6 +777,7 @@ $table_other->data[$row][0] = __('Custom report front page') . __('Custom report front page. It will be applied to all reports and templates by default.'), true); $table_other->data[$row][1] = html_print_checkbox('custom_report_front', 1, $config['custom_report_front'], true); + $row++; //---------------------------------------------------------------------- @@ -844,7 +845,7 @@ $table_other->data['custom_report_front-footer'][1] = html_print_textarea('custo $table_other->data[$row][0] = __('Show QR Code icon in the header'); -$table_other->data[$row][1] = html_print_checkbox('show_qr_code_header', 1, +$table_other->data[$row][1] = html_print_checkbox_toogle_switch('show_qr_code_header', 1, $config['show_qr_code_header'], true); $row++; @@ -865,7 +866,7 @@ $row++; $table_other->data[$row][0] = __('Show only the group name'); $table_other->data[$row][0] .= ui_print_help_tip( __('Show the group name instead the group icon.'), true); -$table_other->data[$row][1] = html_print_checkbox('show_group_name', 1, +$table_other->data[$row][1] = html_print_checkbox_toogle_switch('show_group_name', 1, $config['show_group_name'], true); $row++; @@ -1184,6 +1185,7 @@ $(document).ready (function () { .prop('checked'); display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().attr('id')); }); + $(".databox.filters").css('margin-bottom','-10px'); }); // Change the favicon preview when is changed @@ -1353,4 +1355,4 @@ $("#button-status_set_preview").click (function (e) { } }); - + \ No newline at end of file diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 06257a5457..7f66131e86 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1956,6 +1956,83 @@ function html_print_checkbox ($name, $value, $checked = false, $return = false, return $output; } +/** + * Render a checkbox button input toogle switch type. Extended version, use html_print_checkbox_toogle_switch() to simplify. + * + * @param string Input name. + * @param string Input value. + * @param string Set the button to be marked (optional, unmarked by default). + * @param bool Disable the button (optional, button enabled by default). + * @param string Script to execute when onClick event is triggered (optional). + * @param string Optional HTML attributes. It's a free string which will be + inserted into the HTML tag, use it carefully (optional). + * @param bool Whether to return an output string or echo now (optional, echo by default). + * + * @return string HTML code if return parameter is true. + */ + +function html_print_checkbox_toogle_switch_extended ($name, $value, $checked, $disabled, $script, $attributes, $return = false, $id='') { + static $idcounter = array (); + + //If duplicate names exist, it will start numbering. Otherwise it won't + if (isset ($idcounter[$name])) { + $idcounter[$name]++; + } + else { + $idcounter[$name] = 0; + } + + $id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + + $output = '