From ac92b5979cbd15305fccc9cd9a0522d953e868d2 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 30 Jun 2023 08:35:37 +0200 Subject: [PATCH] #10563 Move menu item Links from Management to Operation. Add button in setup to global disable the Feedback functionality --- pandora_console/general/header.php | 2 +- .../godmode/agentes/module_manager.php | 77 ++++++++++++++++++- pandora_console/godmode/menu.php | 18 +++-- .../godmode/setup/setup_general.php | 13 ++++ pandora_console/include/functions_config.php | 8 ++ pandora_console/operation/menu.php | 19 +++++ 6 files changed, 124 insertions(+), 13 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 2c311f33ec..6129fcebb4 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -352,7 +352,7 @@ echo sprintf('
', $menuTypeClass); } // Button for feedback pandora. - if (enterprise_installed()) { + if (enterprise_installed() && $config['activate_feedback'] !== false) { $header_feedback = '
'; $header_feedback .= ''; $header_feedback .= ''; diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index b8b3789228..5c21fa71a0 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -47,8 +47,74 @@ if (isset($policy_page) === false) { $policy_page = false; } -$checked = (bool) get_parameter('checked'); +$checked = (bool) get_parameter('status_hierachy_mode'); +$status_hierachy_mode = (bool) get_parameter('status_hierachy_mode'); $sec2 = (string) get_parameter('sec2'); +// Table for filter bar. +$filterTable = new stdClass(); +$filterTable->class = 'filter-table-adv w100p'; +$filterTable->size[0] = '20%'; +$filterTable->size[1] = '20%'; +$filterTable->size[2] = '20%'; +$filterTable->size[3] = '20%'; +$filterTable->size[4] = '20%'; +$filterTable->data = []; +$filterTable->cellstyle[0][0] = 'width:0'; +$filterTable->data[0][0] = __('Search'); +$filterTable->data[1][0] .= html_print_input_text( + 'search_string', + $search_string, + '', + 30, + 255, + true, + false, + false, + '', + '' +); + +$filterTable->data[0][0] .= html_print_input_hidden('search', 1, true); + +if ((bool) $policy_page === false) { + $filterTable->data[0][1] = __('Show in hierachy mode'); + $filterTable->data[1][1] = html_print_checkbox_switch( + 'status_hierachy_mode', + ((string) $checked), + ((string) $checked), + true, + false, + 'onChange=change_mod_filter();' + ); +} + +$filterTable->data[1][2] = html_print_submit_button( + __('Filter'), + 'filter', + false, + [ + 'icon' => 'search', + 'class' => 'float-right', + 'mode' => 'secondary mini', + ], + true +); + +// Print filter table. +echo '
'; +ui_toggle( + html_print_table($filterTable, true).'
', + ''.__('Filter').'', + __('Filter'), + 'filter', + true, + false, + '', + 'white-box-content no_border', + 'filter-datatable-main box-flat white_table_graph fixed_filter_bar' +); +echo ''; + if (isset($id_agente) === false) { return; @@ -1215,14 +1281,17 @@ html_print_div( if (/checked/.test(window.location)) { var url = window.location.toString(); if (checked) { - window.location = url.replace("checked=false", "checked=true"); + //window.location = url.replace("checked=0", "checked=1"); + $("#checkbox-status_hierachy_mode").val('1'); } else { - window.location = url.replace("checked=true", "checked=false"); + //window.location = url.replace("checked=1", "checked=0"); + $("#checkbox-status_hierachy_mode").val('0'); } } else { - window.location = window.location + "&checked=true"; + //window.location = window.location + "&checked=1"; + $("#checkbox-status_hierachy_mode").val('1'); } } diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index a8450250aa..4a0daaeed3 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -551,21 +551,23 @@ if ($access_console_node === true) { } } - $menu_godmode['links']['text'] = __('Links'); - $menu_godmode['links']['sec2'] = ''; - $menu_godmode['links']['id'] = 'god-links'; + /* + $menu_godmode['links']['text'] = __('Links'); + $menu_godmode['links']['sec2'] = ''; + $menu_godmode['links']['id'] = 'god-links'; - $sub = []; - $rows = db_get_all_rows_in_table('tlink', 'name'); - foreach ($rows as $row) { + $sub = []; + $rows = db_get_all_rows_in_table('tlink', 'name'); + foreach ($rows as $row) { // Audit //meter en extensiones. $sub[$row['link']]['text'] = $row['name']; $sub[$row['link']]['id'] = $row['name']; $sub[$row['link']]['type'] = 'direct'; $sub[$row['link']]['subtype'] = 'new_blank'; - } + } - $menu_godmode['links']['sub'] = $sub; + $menu_godmode['links']['sub'] = $sub; + */ } // Warp Manager. diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index c3ad98fc5f..ed351317dd 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -429,6 +429,19 @@ $table->data[$i++][] = html_print_label_input_block( ) ); +$table->data[$i++][] = html_print_label_input_block( + __('Enable Feedback'), + html_print_checkbox_switch_extended( + 'activate_feedback', + 1, + $config['activate_feedback'], + false, + '', + '', + true + ) +); + $table->colspan[$i][] = 2; $table->data[$i++][] = html_print_label_input_block( __('Server timezone setup'), diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 18ddd0ffb0..63c0b611b5 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -264,6 +264,10 @@ function config_update_config() $error_update[] = __('Enable Sflow'); } + if (config_update_value('activate_feedback', (bool) get_parameter('activate_feedback'), true) === false) { + $error_update[] = __('Enable Feedback'); + } + if (config_update_value('general_network_path', get_parameter('general_network_path'), true) === false) { $error_update[] = __('General network path'); } else { @@ -3358,6 +3362,10 @@ function config_process_config() config_update_value('autoupdate', 1); } + if (!isset($config['activate_feedback'])) { + config_update_value('activate_feedback', true); + } + if (!isset($config['api_password'])) { config_update_value('api_password', ''); } diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 351fd17c9b..6d3dd90585 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -629,6 +629,25 @@ if ($favorite_menu !== false) { +// Links. +$rows = db_get_all_rows_in_table('tlink', 'name'); +// $rows = []; +if (!empty($rows)) { + $menu_operation['links']['text'] = __('Links'); + $menu_operation['links']['sec2'] = ''; + $menu_operation['links']['id'] = 'god-links'; + + $sub = []; + foreach ($rows as $row) { + // Audit //meter en extensiones. + $sub[$row['link']]['text'] = $row['name']; + $sub[$row['link']]['id'] = $row['name']; + $sub[$row['link']]['type'] = 'direct'; + $sub[$row['link']]['subtype'] = 'new_blank'; + } + + $menu_operation['links']['sub'] = $sub; +} // Workspace. $menu_operation['workspace']['text'] = __('Workspace');