From 1f45ee33b276eb1173ae3c864cb7dac5a3954b75 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 11:14:10 +0100 Subject: [PATCH 01/42] Header icon --- pandora_console/include/functions_ui.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 1e4556965b..dbaf0fee37 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1496,6 +1496,7 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri * @param string $image Image path. * @param boolean $is_relative Route is relative or not. * @param string $id Target id. + * @param string $isHeader If true, the view is header. * * @return string The help tip */ @@ -1505,10 +1506,17 @@ function ui_print_help_icon( $home_url='', $image='images/info@svg.svg', $is_relative=false, - $id='' + $id='', + $isHeader=false ) { global $config; + if (empty($image) === true) { + $image = 'images/info@svg.svg'; + } + + $iconClass = ($isHeader === true) ? 'header_help_icon' : 'main_menu_icon'; + // Do not display the help icon if help is disabled. if ((bool) $config['disable_help'] === true) { return ''; @@ -1533,7 +1541,7 @@ function ui_print_help_icon( $image, true, [ - 'class' => 'img_help main_menu_icon', + 'class' => 'img_help '.$iconClass, 'title' => __('Help'), 'onclick' => "open_help ('".ui_get_full_url($help_handler)."')", 'id' => $id, @@ -5053,7 +5061,7 @@ function ui_print_page_header( if (is_metaconsole() === false) { if ($help != '') { - $buffer .= "
".ui_print_help_icon($help, true, '', 'images/help_g.png').'
'; + $buffer .= "
".ui_print_help_icon($help, true, '', '', false, '', true).'
'; } } From b68fe38102c312c2996b860cb7d0bbc6f351c91b Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 11:15:01 +0100 Subject: [PATCH 02/42] Controls improve --- pandora_console/include/styles/pandora.css | 22 ++++++++++++++++++++-- pandora_console/include/styles/wizard.css | 6 ++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f837170673..eec5727f49 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11006,14 +11006,14 @@ pre.external_tools_output { .tag-editor .tag-editor-tag { padding: 5px !important; color: #fff !important; - background: #82b92e !important; + background: var(--primary-color) !important; border-radius: 0 2px 2px 0 !important; } .tag-editor .tag-editor-delete { padding: 5px !important; line-height: 16px !important; - background: #82b92e !important; + background: var(--primary-color) !important; border-radius: 2px 0 0 2px !important; } @@ -11187,6 +11187,10 @@ table.table_modal_alternate height: 20px; } +.header_help_icon { + width: 16px; + height: 16px; +} .main_menu_icon.arrow_up { transform: rotate(90deg); } @@ -11536,3 +11540,17 @@ table.alert-template-fields > tbody > tr > td > div > textarea { table.alert-template-fields > tbody > tr > td[id^="template-label_fields"] { text-align: center; } + +ul.tag-editor { + list-style-type: none; + padding: 0.5em !important; + margin: 0; + overflow: hidden; + border: 2px solid #c0ccdc; + border-radius: 6px; + cursor: text; + font: normal 14px sans-serif; + color: #333333; + background: #f6f7fb; + line-height: 20px; +} diff --git a/pandora_console/include/styles/wizard.css b/pandora_console/include/styles/wizard.css index ab5d011f70..fa91c6f2b9 100644 --- a/pandora_console/include/styles/wizard.css +++ b/pandora_console/include/styles/wizard.css @@ -130,6 +130,12 @@ ul.wizard li > textarea { background: #e63c52; } +.wizard .tag-editor li, +.wizard .tag-editor li:focus, +.wizard .tag-editor li:hover { + border: 0; + padding: 0; +} .wizard .time_selection_container { display: flex; align-items: baseline; From 70cf44cb8f1fa32ff5230c91dd28a2d594d2f8c0 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 11:15:58 +0100 Subject: [PATCH 03/42] Module Templates --- .../include/class/ModuleTemplates.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index fb1a496246..75e4bf7ade 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -708,7 +708,7 @@ class ModuleTemplates extends HTML 'action' => $this->baseUrl, 'id' => 'add_module_form', 'method' => 'POST', - 'class' => 'modal', + 'class' => 'modal filter-list-adv', 'extra' => '', ]; @@ -846,10 +846,10 @@ class ModuleTemplates extends HTML false ); // Create the table with Module Block list. - $table = new StdClasS(); + $table = new stdClass(); $table->class = 'databox data '; $table->width = '75%'; - $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;'; + $table->styleTable = 'border: 1px solid #ddd;'; $table->rowid = []; $table->data = []; @@ -1165,7 +1165,7 @@ class ModuleTemplates extends HTML $blockComponentList = chop($blockComponentList, ','); // Title of Block. - $blockTitle = '
'; + $blockTitle = '
'; $blockTitle .= $blockTable['name']; $blockTitle .= '
'; $blockTitle .= html_print_input_image( @@ -1186,7 +1186,7 @@ class ModuleTemplates extends HTML $table = new StdClasS(); $table->class = 'databox data border_bt'; $table->width = '75%'; - $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;'; + $table->styleTable = 'margin: 0; border: 1px solid #ddd;'; $table->rowid = []; $table->data = []; @@ -1220,7 +1220,7 @@ class ModuleTemplates extends HTML switch ($module['id_format']) { case MODULE_NETWORK: $formatInfo = html_print_image( - 'images/network.png', + 'images/network-server@os.svg', true, [ 'title' => __('Network module'), @@ -1231,7 +1231,7 @@ class ModuleTemplates extends HTML case MODULE_WMI: $formatInfo = html_print_image( - 'images/wmi.png', + 'images/WMI@svg.svg', true, [ 'title' => __('WMI module'), @@ -1242,7 +1242,7 @@ class ModuleTemplates extends HTML case MODULE_PLUGIN: $formatInfo = html_print_image( - 'images/plugin.png', + 'images/plugins@svg.svg', true, [ 'title' => __('Plug-in module'), From d6a461acb8a25d5cc85928d9632dd27ad0fa3590 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 7 Mar 2023 11:21:25 +0100 Subject: [PATCH 04/42] Graph container create styles --- .../godmode/reporting/create_container.php | 257 ++++++++++-------- .../godmode/reporting/graph_container.php | 21 +- .../include/functions_container.php | 4 +- 3 files changed, 166 insertions(+), 116 deletions(-) diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php index 26231fc107..a1361867b4 100644 --- a/pandora_console/godmode/reporting/create_container.php +++ b/pandora_console/godmode/reporting/create_container.php @@ -496,7 +496,7 @@ if ($edit_container) { $single_table .= ""; $single_table .= html_print_label_input_block( __('Type of graph'), - html_print_select($type_graphs, 'simple_type_graph', '', '', '', 0, true) + html_print_select($type_graphs, 'simple_type_graph2', '', '', '', 0, true, false, true, '', false, 'width:100%') ); $single_table .= ''; @@ -543,21 +543,22 @@ if ($edit_container) { $table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; - $table->class = 'dat'; + $table->class = 'filter-table-adv'; $table->styleTable = 'font-weight: bold;'; $table->style[0] = 'width: 13%'; $table->data = []; + $table->size[0] = '30%'; + $table->size[1] = '30%'; + $table->size[2] = '30%'; - $data = []; - $data[0] = __('Time lapse'); - $data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), true); - $data[1] = html_print_extended_select_for_time('period_custom', $period, '', '', '0', 10, true, false, true, '', false, $periods); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Custom graph'); + $table->data[0][0] = html_print_label_input_block( + __('Time lapse').ui_print_help_tip( + __('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), + true + ), + html_print_extended_select_for_time('period_custom', $period, '', '', '0', 10, true, 'width:100%', true, '', false, $periods) + ); $list_custom_graphs = custom_graphs_get_user($config['id_user'], false, true, 'RR'); @@ -566,29 +567,45 @@ if ($edit_container) { $graphs[$custom_graph['id_graph']] = $custom_graph['name']; } - $data[1] = html_print_select($graphs, 'id_custom_graph', $idCustomGraph, '', __('None'), 0, true); - $table->data[] = $data; - $table->rowclass[] = ''; + $table->data[0][1] = html_print_label_input_block( + __('Custom graph'), + html_print_select($graphs, 'id_custom_graph', $idCustomGraph, '', __('None'), 0, true, '', true, '', false, 'width:100%') + ); - $data = []; - $data[0] = __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true); - $data[1] = html_print_checkbox('fullscale_2', 1, false, true); - $table->data[] = $data; - $table->rowclass[] = ''; + $table->data[0][2] = html_print_label_input_block( + __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true), + html_print_checkbox('fullscale_2', 1, false, true) + ); - $data = []; - $data[0] = ''; - $data[1] = ""; - $table->data[] = $data; - $table->rowclass[] = ''; + $data_toggle = html_print_table($table, true); + $data_toggle .= html_print_div( + [ + 'class' => 'action-buttons-right-forced mrgn_right_10px', + 'content' => html_print_submit_button( + __('Add item'), + 'add_custom', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], + true + ); - echo ""; - echo ''; - echo ''; - echo ''; - echo '
'; - echo ui_toggle(html_print_table($table, true), 'Custom graph', '', '', true); - echo '
'; + ui_toggle( + $data_toggle, + ''.__('Custom graph').'', + 'container', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph' + ); unset($table); @@ -597,93 +614,113 @@ if ($edit_container) { $table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; - $table->class = 'dat'; + $table->class = 'filter-table-adv'; $table->styleTable = 'font-weight: bold;'; - $table->style[0] = 'width: 13%'; $table->data = []; + $table->size[0] = '30%'; + $table->size[1] = '30%'; + $table->size[2] = '30%'; - $data = []; - $data[0] = __('Time lapse'); - $data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), true); - $data[1] = html_print_extended_select_for_time('period_dynamic', $period, '', '', '0', 10, true, false, true, '', false, $periods); - $table->data[] = $data; - $table->rowclass[] = ''; - $data = []; - $data[0] = __('Group'); - $data[1] = '
'.html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true).'
'; - $table->data[] = $data; - $table->rowclass[] = ''; + $table->data[0][0] = html_print_label_input_block( + __('Time lapse').ui_print_help_tip( + __('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), + true + ), + html_print_extended_select_for_time('period_custom', $period, '', '', '0', 10, true, 'width:100%', true, '', false, $periods) + ); - $data = []; - $data[0] = __('Module group'); - $data[1] = html_print_select_from_sql( - 'SELECT * FROM tmodule_group ORDER BY name', - 'combo_modulegroup', - $modulegroup, - '', - __('All'), - false, + $table->data[0][1] = html_print_label_input_block( + __('Group'), + html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true) + ); + + $table->data[0][2] = html_print_label_input_block( + __('Module group'), + html_print_select_from_sql( + 'SELECT * FROM tmodule_group ORDER BY name', + 'combo_modulegroup', + $modulegroup, + '', + __('All'), + false, + true, + false, + true, + false, + 'width:100%' + ) + ); + + $table->data[1][0] = html_print_label_input_block( + __('Agent'), + html_print_input_text('text_agent', $textAgent, '', 30, 100, true) + ); + + $table->data[1][1] = html_print_label_input_block( + __('Module'), + html_print_input_text('text_agent_module', $textModule, '', 30, 100, true) + ); + + $select_tags = tags_search_tag(false, false, true); + $table->data[1][2] = html_print_label_input_block( + __('Tag'), + html_print_select( + $select_tags, + 'tag', + $tag, + '', + __('Any'), + 0, + true, + false, + false, + '', + false, + 'width:100%' + ) + ); + + $table->data[2][0] = html_print_label_input_block( + __('Type of graph'), + html_print_select($type_graphs, 'simple_type_graph2', '', '', '', 0, true, false, true, '', false, 'width:100%') + ); + + $table->data[2][1] = html_print_label_input_block( + __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true), + html_print_checkbox('fullscale_3', 1, false, true) + ); + + $data_toggle = html_print_table($table, true); + $data_toggle .= html_print_div( + [ + 'class' => 'action-buttons-right-forced mrgn_right_10px', + 'content' => html_print_submit_button( + __('Add item'), + 'add_dynamic', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], true ); - $table->data[] = $data; - $table->rowclass[] = ''; - $data = []; - $data[0] = __('Agent'); - $data[1] = html_print_input_text('text_agent', $textAgent, '', 30, 100, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Module'); - $data[1] = html_print_input_text('text_agent_module', $textModule, '', 30, 100, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Tag'); - $select_tags = tags_search_tag(false, false, true); - $data[1] = html_print_select( - $select_tags, - 'tag', - $tag, + ui_toggle( + $data_toggle, + ''.__('Dynamic rules for simple module graph').'', + 'container', '', - __('Any'), - 0, true, false, - false + '', + 'white-box-content', + 'box-flat white_table_graph' ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Type of graph'); - $data[1] = html_print_select($type_graphs, 'simple_type_graph2', '', '', '', 0, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true); - $data[1] = html_print_checkbox('fullscale_3', 1, false, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = ''; - $data[1] = ""; - $table->data[] = $data; - $table->rowclass[] = ''; - - echo ""; - echo ''; - echo ''; - echo ''; - echo '
'; - echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', '', true); - echo '
'; if ((bool) $id_container !== false) { $total_item = db_get_all_rows_sql('SELECT count(*) FROM tcontainer_item WHERE id_container = '.$id_container); @@ -696,7 +733,7 @@ if ($edit_container) { ui_pagination($total_item[0]['count(*)'], false, $offset, 10); $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->id = 'item_table'; $table->align = []; $table->head = []; @@ -710,7 +747,7 @@ if ($edit_container) { $table->head[7] = __('Delete'); $table->data = []; - + $i = 0; foreach ($result_item as $item) { $data = []; @@ -759,6 +796,8 @@ if ($edit_container) { break; } + $table->cellclass[$i][7] = 'table_action_buttons'; + $i++; $data[7] = ''.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']).''; @@ -801,7 +840,7 @@ echo html_print_input_hidden('id_agent', 0); } }); - $("input[name=add_custom]").click (function () { + $("#button-add_custom").click (function () { var id_custom = $("#id_custom_graph").val(); var fullscale = $("#checkbox-fullscale_2").prop("checked"); if (id_custom !== '0'){ @@ -824,7 +863,7 @@ echo html_print_input_hidden('id_agent', 0); } }); - $("input[name=add_dynamic]").click (function () { + $("#button-add_dynamic").click (function () { var agent_alias = $("#text-text_agent").val(); var module_name = $("#text-text_agent_module").val(); var time_lapse = $("#hidden-period_dynamic").attr('value'); diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index cbc947ef78..370285d7bf 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -129,11 +129,22 @@ $container = folder_get_folders(); $tree = folder_get_folders_tree_recursive($container); echo folder_togge_tree_folders($tree); if ($report_r && $report_w) { - echo "
"; - echo '
'; - html_print_submit_button(__('Create container'), 'create', false, 'class="sub next mrgn_right_5px mrgn_top_15px"'); - echo '
'; - echo '
'; + $ActionButtons[] = '
'; + $ActionButtons[] = '
'; + $ActionButtons[] = html_print_submit_button( + __('Create container'), + 'create', + false, + [ + 'class' => 'sub ok submitButton', + 'icon' => 'next', + ], + true + ); + $ActionButtons[] = '
'; + $ActionButtons[] = '
'; + + html_print_action_buttons(implode('', $ActionButtons), ['type' => 'form_action']); } ?> diff --git a/pandora_console/include/functions_container.php b/pandora_console/include/functions_container.php index 502db2b4ad..e9d034f431 100644 --- a/pandora_console/include/functions_container.php +++ b/pandora_console/include/functions_container.php @@ -316,13 +316,13 @@ function ui_toggle_container($code, $name, $title='', $hidden_default=true, $ret $data[0] = ''.html_print_image($original, true, ['title' => $title, 'id' => 'image_'.$uniqid, 'class' => 'invert_filter']).'  '.$name.''; $data[1] = ui_print_group_icon($group, true); if ($report_r && $report_w) { - $data[2] = ''.html_print_image('images/config.png', true, ['class' => 'invert_filter']).''; + $data[2] = ''.html_print_image('images/edit.svg', true, ['class' => 'invert_filter main_menu_icon']).''; } if ($report_r && $report_w && $report_m) { if ($id_container !== '1') { $data[2] .= '    '.''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter']).''; + return false;">'.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']).''; } } From 8f2a2f12c67936793f06dff247dc807610794d5a Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 11:48:14 +0100 Subject: [PATCH 05/42] Templates view --- .../modules/manage_network_components.php | 126 ++++++++++-------- .../include/class/ModuleTemplates.class.php | 4 +- pandora_console/include/functions_ui.php | 6 +- 3 files changed, 75 insertions(+), 61 deletions(-) diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 44d35d3f06..a3050f02e9 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -615,18 +615,6 @@ $url = ui_get_url_refresh( true, false ); -$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components'; -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; - -$table->style = []; -$table->style[0] = 'font-weight: bold'; -$table->style[2] = 'font-weight: bold'; - -$table->data = []; - -$table->data[0][0] = __('Group'); $component_groups = network_components_get_groups(); @@ -656,54 +644,81 @@ foreach ($component_groups as $component_group_key => $component_group_val) { } } -$table->data[0][1] = html_print_select( - $component_groups, - 'search_id_group', - $search_id_group, +$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components'; +$table = new stdClass(); +$table->width = '100%'; +$table->class = 'filter-table-adv'; + +$table->style = []; +$table->style[0] = 'font-weight: bold'; +$table->style[2] = 'font-weight: bold'; + +$table->data = []; + +$table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select( + $component_groups, + 'search_id_group', + $search_id_group, + '', + __('All'), + 0, + true, + false, + false, + '', + false, + 'width: 100%' + ) +); + +$table->data[0][] = html_print_label_input_block( + __('Free Search'), + html_print_input_text( + 'search_string', + $search_string, + '', + 25, + 255, + true + ).ui_print_input_placeholder( + __('Search by name, description, tcp send or tcp rcv, list matches.'), + true + ) +); + +$toggleFilters = '
'; +$toggleFilters .= html_print_table($table, true); +$toggleFilters .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true +); +$toggleFilters .= '
'; + +ui_toggle( + $toggleFilters, + ''.__('Filters').'', + 'filter_form', '', - __('All'), - 0, true, false, - false -); -$table->data[0][2] = __('Free Search').ui_print_help_tip( - __('Search by name, description, tcp send or tcp rcv, list matches.'), - true -); -$table->data[0][3] = html_print_input_text( - 'search_string', - $search_string, '', - 25, - 255, - true + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); -if (is_metaconsole() === true) { - $table->data[0][4] = '
'; -} else { - $table->data[0][4] = '
'; -} - -$table->data[0][4] .= html_print_submit_button( - __('Search'), - 'search', - false, - 'class="sub search"', - true -); -$table->data[0][4] .= '
'; - -if (is_metaconsole() === true) { - $filter = '
'; - $filter .= html_print_table($table, true); - $filter .= '
'; - ui_toggle($filter, __('Show Options')); -} else { - echo '
'; - html_print_table($table); - echo '
'; -} $filter = []; if ($search_id_group) { @@ -721,7 +736,6 @@ $total_components = network_components_get_network_components( ); $total_components = $total_components[0]['total']; $offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset; -ui_pagination($total_components, $name_url); $filter['offset'] = (int) get_parameter('offset'); $filter['limit'] = (int) $config['block_size']; $components = network_components_get_network_components( diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index 75e4bf7ade..e9a03a90b9 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -893,7 +893,7 @@ class ModuleTemplates extends HTML ); $data[3] .= html_print_input_image( 'export_profile', - 'images/csv.png', + 'images/file-csv.svg', $row['id_np'], '', true, @@ -914,7 +914,7 @@ class ModuleTemplates extends HTML $data[3] .= ''; $data[3] .= ''; $data[3] .= html_print_image( - 'images/csv.png', + 'images/file-csv.svg', true, [ 'title' => __('Export to CSV'), diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index dbaf0fee37..41091302fd 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -904,11 +904,11 @@ function ui_print_type_agent_icon( if ((int) $id_os === SATELLITE_OS_ID) { // Satellite. $options['title'] = __('Satellite'); - $output = html_print_image('images/satellite@svg.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); + $output = html_print_image('images/satellite@os.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); } else if ($remote_contact === $contact && $remote === 0 && empty($version) === true) { // Network. $options['title'] = __('Network'); - $output = html_print_image('images/network-server@svg.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); + $output = html_print_image('images/network-server@os.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); } else { // Software. $options['title'] = __('Software'); @@ -7162,7 +7162,7 @@ function ui_print_servertype_icon(int $id) case MODULE_NETWORK: $title = __('Network server'); - $image = 'images/network-server@svg.svg'; + $image = 'images/network-server@os.svg'; break; case MODULE_PLUGIN: From c3a297e0963403b6ba4a0ae63ee5f7b67bcd6045 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Mar 2023 12:18:51 +0100 Subject: [PATCH 06/42] fixed styles --- pandora_console/include/class/NetworkMap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index b1c5e84763..701eb4ecfb 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -3601,7 +3601,7 @@ class NetworkMap url_background_grid: url_background_grid, refresh_time: '.$this->mapOptions['refresh_time'].', font_size: '.$this->mapOptions['font_size'].', - method: '.$this->map['generation_method'].', + method: '.($this->map['generation_method'] ?? 3).', base_url_homedir: "'.ui_get_full_url(false).'" }); init_drag_and_drop(); From 28a003706bc668b8bb1f6fd9e60afbd5f4a3e982 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 12:50:09 +0100 Subject: [PATCH 07/42] Action messages in modals --- .../include/class/CredentialStore.class.php | 40 +++------------ .../include/class/ModuleTemplates.class.php | 26 ++-------- .../include/class/SatelliteAgent.class.php | 51 +++++++------------ .../class/SatelliteCollection.class.php | 26 ++-------- 4 files changed, 36 insertions(+), 107 deletions(-) diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index 8bdc200299..befc213a8c 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -103,42 +103,16 @@ class CredentialStore extends Wizard */ private function ajaxMsg($type, $msg, $delete=false) { - $msg_err = 'Failed while saving: %s'; - $msg_ok = 'Successfully saved into keystore '; - - if ($delete) { - $msg_err = 'Failed while removing: %s'; - $msg_ok = 'Successfully deleted '; - } - - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __( - $msg_err, - $msg - ), - '', - true - ), - ] - ); + if ($type === 'error') { + $msg_title = ($delete === true) ? 'Failed while removing' : 'Failed while saving'; } else { - echo json_encode( - [ - $type => ui_print_success_message( - __( - $msg_ok, - $msg - ), - '', - true - ), - ] - ); + $msg_title = ($delete === true) ? 'Successfully deleted' : 'Successfully saved into keystore'; } + echo json_encode( + [ $type => __($msg_title).':
'.$msg ] + ); + exit; } diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index e9a03a90b9..2e777bdf4c 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -264,27 +264,11 @@ class ModuleTemplates extends HTML */ private function ajaxMsg($type, $msg) { - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); - } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); - } + echo json_encode( + [ + $type => __($msg), + ] + ); exit; } diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php index 0d9111a24b..aa86f25e81 100644 --- a/pandora_console/include/class/SatelliteAgent.class.php +++ b/pandora_console/include/class/SatelliteAgent.class.php @@ -959,41 +959,28 @@ class SatelliteAgent extends HTML */ private function ajaxMsg($type, $msg, $delete=false, $disable=false) { - $msg_err = 'Failed while saving: %s'; - $msg_ok = 'Successfully saved agent '; - - if ($delete === true) { - $msg_err = 'Failed while removing: %s'; - $msg_ok = 'Successfully deleted '; - } - - if ($disable === true) { - $msg_err = 'Failed while disabling: %s'; - $msg_ok = 'Successfully disabled'; - } - - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); + if ($type === 'error') { + if ($delete === true) { + $msg_title = 'Failed while removing'; + } else if ($disable === true) { + $msg_title = 'Failed while disabling'; + } else { + $msg_title = 'Failed while saving'; + } } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); + if ($delete === true) { + $msg_title = 'Successfully deleted'; + } else if ($disable === true) { + $msg_title = 'Successfully disabled'; + } else { + $msg_title = 'Successfully saved agent'; + } } + echo json_encode( + [ $type => __($msg_title).':
'.$msg ] + ); + exit; } diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index aae0cb6780..6ef72c40c4 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -475,27 +475,11 @@ class SatelliteCollection extends HTML */ private function ajaxMsg(string $type, string $msg) { - if ($type === 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); - } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); - } + echo json_encode( + [ + $type => __($msg), + ] + ); exit; } From 1db803b8f635331b3a4e49d7c3504b46e5a2d5ff Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Mar 2023 12:59:34 +0100 Subject: [PATCH 08/42] fixed styles --- pandora_console/godmode/agentes/module_manager_editor.php | 2 +- .../godmode/agentes/module_manager_editor_network.php | 2 +- pandora_console/include/ajax/module.php | 4 ++-- pandora_console/include/functions_treeview.php | 2 +- pandora_console/include/functions_ui.php | 2 +- pandora_console/operation/agentes/estado_generalagente.php | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 66d75c98a7..c3d7563ef5 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -802,7 +802,7 @@ if ($id_agent_module) { __('Delete'), 'deleteModule', false, - 'window.location.assign(\'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.')', + 'window.location.assign("index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'")', [ 'icon' => 'delete', 'mode' => 'secondary', diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 6e0af65f83..be63ddfeef 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -524,7 +524,7 @@ $data[0] .= html_print_button( __('Manage credentials'), 'manage_credentials_button', false, - 'window.location.assign(\'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox\')', + 'window.location.assign("index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox")', [ 'mode' => 'link' ], true ); diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 086741d052..052f105eda 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1283,7 +1283,7 @@ if (check_login()) { $linkCaption, 'additional_action_for_'.$idAgenteModulo, false, - 'window.location.assign(\'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module['id_agente_modulo'].'&refr=60'.$addedLinkParams.'\')', + 'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module['id_agente_modulo'].'&refr=60'.$addedLinkParams.'")', [ 'mode' => 'link', 'style' => 'justify-content: flex-end;', @@ -1300,7 +1300,7 @@ if (check_login()) { __('Edit'), 'edit_module_'.$idAgenteModulo, false, - 'window.location.assign(\'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&id_agent_module='.$module['id_agente_modulo'].'&edit_module='.$module['id_modulo'].'\')', + 'window.location.assign("index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&id_agent_module='.$module['id_agente_modulo'].'&edit_module='.$module['id_modulo'].'")', [ 'mode' => 'link', 'style' => 'justify-content: flex-end;', diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index b43d6bba95..e86c728fa7 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -467,7 +467,7 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false) __('Go to alerts edition'), 'upd_button', false, - 'window.location.assign(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'\')', + 'window.location.assign("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'")', ['icon' => 'alert'], true ), diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 41091302fd..b9a347c1de 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1210,7 +1210,7 @@ function ui_format_alert_row( $forceTitle, 'force_execution_'.$alert['id'], false, - 'window.location.assign(\''.$url.'&id_alert='.$alert['id'].'&refr=60'.$additionUrl.'\');', + 'window.location.assign("'.$url.'&id_alert='.$alert['id'].'&refr=60'.$additionUrl.'");', [ 'mode' => 'link' ], true ); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 3e5584fe42..399ce94b24 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -396,7 +396,7 @@ $buttonsRefreshAgent = html_print_button( __('Refresh data'), 'refresh_data', false, - 'window.location.assign(\'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60\')', + 'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60")', [ 'mode' => 'link' ], true ); @@ -406,7 +406,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) { __('Force checks'), 'force_checks', false, - 'window.location.assign(\'index.php?sec=estado&sec2=operation/agentes/ver_agente&flag_agent=1&id_agente='.$id_agente.'\')', + 'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&flag_agent=1&id_agente='.$id_agente.'")', [ 'mode' => 'link' ], true ); From b31654204437d0908d5d57a0193cc0f2d3bc78ac Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Mar 2023 14:03:04 +0100 Subject: [PATCH 09/42] fixed styles --- .../modules/manage_inventory_modules.php | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/modules/manage_inventory_modules.php b/pandora_console/godmode/modules/manage_inventory_modules.php index 5422ae451b..cb06fb8933 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules.php +++ b/pandora_console/godmode/modules/manage_inventory_modules.php @@ -349,22 +349,51 @@ if ($result === false) { html_print_input_hidden('multiple_delete', 1); html_print_table($table); echo ''; - $tablePagination = ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset, 0, true, 'offset', false); - $actionButtons = []; + echo '
'; + echo html_print_input_hidden('create_module_inventory', 1); + echo ''; + + $tablePagination = ui_pagination( + $total_modules, + 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', + $offset, + 0, + true, + 'offset', + false + ); + + $actionButtons = ''; if ($management_allowed === true) { - $actionButtons[] = html_print_submit_button(__('Delete'), 'delete_btn', false, ['icon' => 'delete', 'mode' => 'secondary', 'form' => 'form_delete'], true); - $actionButtons[] = html_print_submit_button(__('Create'), 'crt', false, ['icon' => 'wand', 'form' => 'form_create'], true); + $actionButtons .= html_print_submit_button( + __('Delete'), + 'delete_btn', + false, + [ + 'icon' => 'delete', + 'mode' => 'secondary', + 'form' => 'form_delete', + ], + true + ); - $actionButtons[] = ''; - $actionButtons[] = html_print_input_hidden('create_module_inventory', 1, true); - $actionButtons[] = ''; + + $actionButtons .= html_print_submit_button( + __('Create'), + 'crt', + false, + [ + 'icon' => 'wand', + 'form' => 'form_create', + ], + true + ); } - html_print_action_buttons( - implode('', $actionButtons), + $actionButtons, [ 'type' => 'form_action', 'right_content' => $tablePagination, From d4f900d1a4ef4c39e69bc17b3d36f90e33d836d7 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 14:11:20 +0100 Subject: [PATCH 10/42] Manage inventory icons --- .../godmode/modules/manage_inventory_modules.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/modules/manage_inventory_modules.php b/pandora_console/godmode/modules/manage_inventory_modules.php index 5422ae451b..121b9e3b83 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules.php +++ b/pandora_console/godmode/modules/manage_inventory_modules.php @@ -332,14 +332,16 @@ if ($result === false) { if ($management_allowed === true) { // Update module. - $data[4] = ''; - $data[4] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']).''; + $data[4] = ''; } array_push($table->data, $data); From 8dbcffaa8bda7fde503e5f56256ea3b36d634c7a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 7 Mar 2023 14:15:02 +0100 Subject: [PATCH 11/42] Buttons and view report --- .../reporting_builder.item_editor.php | 29 ++++-- pandora_console/include/functions_html.php | 34 +++---- pandora_console/include/styles/pandora.css | 9 ++ .../operation/reporting/reporting_viewer.php | 98 ++++++------------- 4 files changed, 79 insertions(+), 91 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index ce755015ed..ec336eb290 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2229,7 +2229,7 @@ $class = 'databox filters'; - + 'link', + 'style' => 'display:none', + ]; + } else { + $style_create = [ 'mode' => 'link' ]; + } + + if (!empty($style_button_edit_custom_graph)) { + $style_edit = [ + 'mode' => 'link', + 'style' => 'display:none', + ]; + } else { + $style_edit = [ 'mode' => 'link' ]; + } + html_print_button( __('Create'), 'create_graph', false, - 'create_custom_graph();', - 'class="sub add" '.$style_button_create_custom_graph + 'create_custom_graph()', + $style_create ); html_print_button( __('Edit'), 'edit_graph', false, - 'edit_custom_graph();', - 'class="sub config" '.$style_button_edit_custom_graph + 'edit_custom_graph()', + $style_edit ); ?> diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 693a14adb7..e9e60f3418 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1361,29 +1361,27 @@ function html_print_select_multiple_filtered( $output .= '
'; - $output .= html_print_input( + $output .= html_print_image( + 'images/plus.svg', + true, [ - 'type' => 'image', - 'src' => 'images/darrowright.png', - 'return' => true, - 'options' => [ - 'title' => $texts['title-add'], - 'onclick' => $add, - 'class' => 'invert_filter', - ], + 'id' => 'right_autorefreshlist', + 'style' => 'width: 24px; margin: 10px 10px 0;', + 'alt' => __('Push selected pages into autorefresh list'), + 'title' => __('Push selected pages into autorefresh list'), + 'onclick' => $add, ] ); - $output .= html_print_input( + $output .= html_print_image( + 'images/minus.svg', + true, [ - 'type' => 'image', - 'src' => 'images/darrowleft.png', - 'return' => true, - 'options' => [ - 'title' => $texts['title-del'], - 'onclick' => $del, - 'class' => 'invert_filter', - ], + 'id' => 'left_autorefreshlist', + 'style' => 'width: 24px; margin: 10px 10px 0;', + 'alt' => __('Pop selected pages out of autorefresh list'), + 'title' => __('Pop selected pages out of autorefresh list'), + 'onclick' => $del, ] ); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index eec5727f49..ba7425f137 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11505,6 +11505,15 @@ div[role="dialog"] { /* font-weight: bold; */ } +.font-title-font { + font-size: 13px; + line-height: 16px; + color: #161628; + text-align: left; + margin-bottom: 10px; + font-weight: bold; +} + .preimage_container span { font-size: 11pt; line-height: 28px; diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 5c3ce7a73b..26e16c7f37 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -226,77 +226,52 @@ ui_print_standard_header( // ------------------- END HEADER --------------------------------------- // ------------------------ INIT FORM ----------------------------------- -$table = new stdClass(); -$table->id = 'controls_table'; -$table->width = '100%'; -$table->class = 'filter-table-adv'; +$table2 = new stdClass(); +$table2->id = 'controls_table'; +$table2->size[2] = '50%'; +$table2->size[3] = '50%'; +$table2->style[0] = 'text-align:center'; +$table2->style[1] = 'text-align:center'; +$table2->styleTable = 'border:none'; + if (defined('METACONSOLE')) { - $table->width = '100%'; - $table->class = 'databox filters'; + $table2->width = '100%'; + $table2->class = 'databox filters'; - $table->head[0] = __('View Report'); - $table->head_colspan[0] = 5; - $table->headstyle[0] = 'text-align: center'; + $table2->head[0] = __('View Report'); + $table2->head_colspan[0] = 5; + $table2->headstyle[0] = 'text-align: center'; } -$table->style = []; -$table->style[0] = 'vertical-align: middle'; -$table->rowspan[0][0] = 2; - // Set initial conditions for these controls, later will be modified by javascript if (!$enable_init_date) { - $table->style[1] = 'display: none'; - $table->style[2] = 'display: flex;align-items: baseline;'; $display_to = 'none'; $display_item = ''; } else { - $table->style[1] = 'display: "block"'; - $table->style[2] = 'display: flex;align-items: baseline;'; $display_to = ''; $display_item = 'none'; } -$table->size = []; -$table->colspan[0][1] = 2; -$table->data = []; -$table->data[0][0] = html_print_image( - 'images/reporting32.png', - true, - [ - 'width' => '32', - 'height' => '32', - ] -); - -if (reporting_get_description($id_report)) { - $table->data[0][1] = '
'.reporting_get_description($id_report).'
'; -} else { - $table->data[0][1] = '
'.reporting_get_name($id_report).'
'; -} - -$table->data[0][1] .= '
'.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true).'
'; - $html_menu_export = enterprise_hook('reporting_print_button_export'); if ($html_menu_export === ENTERPRISE_NOT_HOOK) { $html_menu_export = ''; } -$table->data[0][1] .= '
'; -$table->data[0][1] .= $html_menu_export; +$table2->data[0][2] = '
'.__('Set initial date').'
'.html_print_checkbox_switch('enable_init_date', 1, $enable_init_date, true).'

'; +$table2->data[0][2] .= '
'.__('From').':
'; +$table2->data[0][2] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; +$table2->data[0][2] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; +$table2->data[0][2] .= '
'.__('Items period before').':
'; +$table2->data[0][2] .= '
'.__('to').':
'; +$table2->data[0][2] .= html_print_input_text('date', $date, '', 12, 10, true).' '; +$table2->data[0][2] .= html_print_input_text('time', $time, '', 10, 7, true).' '; +$table2->data[0][3] = $html_menu_export; -$table->data[1][1] = '
'.__('From').':
'; -$table->data[1][1] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; -$table->data[1][1] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; -$table->data[1][2] = '
'.__('Items period before').':
'; -$table->data[1][2] .= '
'.__('to').':
'; -$table->data[1][2] .= html_print_input_text('date', $date, '', 12, 10, true).' '; -$table->data[1][2] .= html_print_input_text('time', $time, '', 10, 7, true).' '; - $searchForm = ''; -$searchForm .= html_print_table($table, true); +$searchForm .= html_print_table($table2, true); $searchForm .= html_print_input_hidden('id_report', $id_report, true); $Actionbuttons .= html_print_submit_button( @@ -354,10 +329,6 @@ for ($i = 0; $i < count($report['contents']); $i++) { reporting_html_print_report($report, false, $config['custom_report_info']); -// ---------------------------------------------------------------------- -// The rowspan of the first row is only 2 in controls table. Why is used the same code here and in the items?? -$table->rowspan[0][0] = 1; - echo '
'; echo html_print_image('images/wait.gif', true, ['border' => '0']); echo ''.__('Loading').'...'; @@ -387,16 +358,15 @@ $(document).ready (function () { secondText: '', currentText: '', closeText: ''}); - + $.datepicker.setDefaults($.datepicker.regional[ ""]); - + $("#text-date").datepicker({ dateFormat: "", changeMonth: true, changeYear: true, showAnim: "slideDown"}); - - + $('[id^=text-time_init]').timepicker({ showSecond: true, timeFormat: '', @@ -407,29 +377,23 @@ $(document).ready (function () { secondText: '', currentText: '', closeText: ''}); - + $('[id^=text-date_init]').datepicker ({ dateFormat: "", changeMonth: true, changeYear: true, showAnim: "slideDown"}); - - - $("*", "#controls_table-0").css("display", ""); //Re-show the first row of form. - + /* Show/hide begin date reports controls */ $("#checkbox-enable_init_date").click(function() { flag = $("#checkbox-enable_init_date").is(':checked'); if (flag == true) { - $("#controls_table-1-1").css("display", ""); - $("#controls_table-1-2").css("display", ""); $("#string_to").show(); + $('#string_from').show(); $("#string_items").hide(); - } - else { - $("#controls_table-1-1").css("display", "none"); - $("#controls_table-1-2").css("display", ""); + } else { $("#string_to").hide(); + $('#string_from').hide(); $("#string_items").show(); } }); From 845a63708271c9dd0329a0a0dc22b4c2fe3b912a Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 14:59:59 +0100 Subject: [PATCH 12/42] Inventory modules forms --- .../modules/manage_inventory_modules.php | 23 +- .../modules/manage_inventory_modules_form.php | 228 +++++++++++++----- 2 files changed, 172 insertions(+), 79 deletions(-) diff --git a/pandora_console/godmode/modules/manage_inventory_modules.php b/pandora_console/godmode/modules/manage_inventory_modules.php index 1b9d2aa71e..a8faa13a66 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules.php +++ b/pandora_console/godmode/modules/manage_inventory_modules.php @@ -369,6 +369,17 @@ if ($result === false) { $actionButtons = ''; if ($management_allowed === true) { + $actionButtons .= html_print_submit_button( + __('Create'), + 'crt', + false, + [ + 'icon' => 'wand', + 'form' => 'form_create', + ], + true + ); + $actionButtons .= html_print_submit_button( __('Delete'), 'delete_btn', @@ -380,18 +391,6 @@ if ($result === false) { ], true ); - - - $actionButtons .= html_print_submit_button( - __('Create'), - 'crt', - false, - [ - 'icon' => 'wand', - 'form' => 'form_create', - ], - true - ); } html_print_action_buttons( diff --git a/pandora_console/godmode/modules/manage_inventory_modules_form.php b/pandora_console/godmode/modules/manage_inventory_modules_form.php index 65597d7af1..32424b7f39 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules_form.php +++ b/pandora_console/godmode/modules/manage_inventory_modules_form.php @@ -26,22 +26,32 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], // Header -if (defined('METACONSOLE')) { +if (is_metaconsole() === true) { $sec = 'advanced'; enterprise_include_once('meta/include/functions_components_meta.php'); components_meta_print_header(); } else { $sec = 'gmodules'; - ui_print_page_header( - __('Module management').' » '.__('Inventory modules'), + ui_print_standard_header( + __('Module management'), 'images/op_inventory.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configuration'), + ], + [ + 'link' => '', + 'label' => __('Inventory modules'), + ], + ] ); } -// Header $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; if ($is_windows) { ui_print_error_message(__('Not supported in Windows systems')); @@ -95,82 +105,166 @@ if ($id_os == null) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; +$table->class = 'databox filter-table-adv'; $table->style = []; -$table->style[0] = 'font-weight: bold'; +$table->style[0] = 'width: 50%'; +$table->style[1] = 'width: 50%'; $table->data = []; -$table->data[0][0] = ''.__('Name').''; -$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled); -$table->data[1][0] = ''.__('Description').''; -$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true); -$table->data[2][0] = ''.__('OS').''; -$table->data[2][1] = html_print_select_from_sql( - 'SELECT id_os, name FROM tconfig_os ORDER BY name', - 'id_os', - $id_os, - '', - '', - '', - $return = true + +$table->data[0][] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, + '', + 45, + 100, + true, + $disabled + ) ); -$table->data[3][0] = ''.__('Interpreter').''; -$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true); -$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true); +$table->data[0][] = html_print_label_input_block( + __('Description'), + html_print_input_text( + 'description', + $description, + '', + 60, + 500, + true + ) +); -$table->data['block_mode'][0] = ''.__('Block Mode').''; -$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true); +$table->data[1][] = html_print_label_input_block( + __('OS'), + html_print_select_from_sql( + 'SELECT id_os, name FROM tconfig_os ORDER BY name', + 'id_os', + $id_os, + '', + '', + '', + $return = true + ) +); -$table->data[4][0] = ''.__('Format').''; -$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true); -$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true); +$table->data[1][] = html_print_label_input_block( + __('Interpreter'), + html_print_input_text( + 'interpreter', + $interpreter, + '', + 25, + 100, + true + ).ui_print_input_placeholder( + __('Left blank for the LOCAL inventory modules'), + true + ) +); -$table->data[5][0] = ''.__('Script mode').''; -$table->data[5][0] .= ui_print_help_tip(__(''), true); -$table->data[5][1] = __('Use script'); -$table->data[5][1] .= html_print_radio_button( - 'script_mode', - 1, - '', - $script_mode, - true -).'  '; -$table->data[5][1] .= '    '.__('Use inline code'); -$table->data[5][1] .= html_print_radio_button( - 'script_mode', - 2, - '', - $script_mode, - true -).'  '; +$table->data[2][] = html_print_label_input_block( + __('Format'), + html_print_input_text( + 'format', + $data_format, + '', + 50, + 100, + true + ).ui_print_input_placeholder( + __('separate fields with ').SEPARATOR_COLUMN, + true + ) +); -$table->data[6][0] = ''.__('Script path').''; -$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true); +$table->data[2][] = html_print_label_input_block( + __('Block Mode'), + html_print_checkbox_switch( + 'block_mode', + 1, + $block_mode, + true + ) +); -$table->data[7][0] = ''.__('Code').''; -$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true); +$radioButtons = []; +$radioButtons[] = html_print_radio_button('script_mode', 1, __('Script mode'), $script_mode, true); +$radioButtons[] = html_print_radio_button('script_mode', 2, __('Use inline code'), $script_mode, true); -$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true); +$table->data[3][] = html_print_label_input_block( + __('Script mode'), + html_print_div( + [ + 'class' => 'switch_radio_button', + 'content' => implode('', $radioButtons), + ], + true + ) +); -echo 'colspan[4][0] = 2; + +$table->data[4][0] = html_print_label_input_block( + __('Script path'), + html_print_input_text( + 'script_path', + $script_path, + '', + 50, + 1000, + true + ), + ['div_class' => 'script_path_inventory_modules'] +); + +$table->data[4][0] .= html_print_label_input_block( + __('Code'), + html_print_textarea( + 'code', + 25, + 80, + base64_decode($code), + '', + true + ).ui_print_input_placeholder( + __("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, + true + ), + ['div_class' => 'code_inventory_modules'] +); + +echo ''; html_print_table($table); if ($id_module_inventory) { html_print_input_hidden('update_module_inventory', 1); html_print_input_hidden('id_module_inventory', $id_module_inventory); + $buttonCaption = __('Update'); + $buttonIcon = 'update'; } else { html_print_input_hidden('create_module_inventory', 1); + $buttonCaption = __('Create'); + $buttonIcon = 'wand'; } -echo '
'; -if ($id_module_inventory) { - html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"'); -} else { - html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"'); -} +$actionButtons = ''; +$actionButtons = html_print_submit_button( + $buttonCaption, + 'submit', + false, + ['icon' => $buttonIcon], + true +); +$actionButtons .= html_print_go_back_button( + 'index.php?sec=gmodules&sec2=godmode/modules/manage_inventory_modules', + ['button_class' => ''], + true +); -echo '
'; +html_print_action_buttons($actionButtons); echo ''; ?> @@ -180,21 +274,21 @@ echo ''; var mode = ; if (mode == 1) { - $('#table1-6').show(); - $('#table1-7').hide(); + $('.script_path_inventory_modules').show(); + $('.code_inventory_modules').hide(); } else { - $('#table1-7').show(); - $('#table1-6').hide(); + $('.code_inventory_modules').show(); + $('.script_path_inventory_modules').hide(); } $('input[type=radio][name=script_mode]').change(function() { if (this.value == 1) { - $('#table1-6').show(); - $('#table1-7').hide(); + $('.script_path_inventory_modules').show(); + $('.code_inventory_modules').hide(); } else if (this.value == 2) { - $('#table1-7').show(); - $('#table1-6').hide(); + $('.code_inventory_modules').show(); + $('.script_path_inventory_modules').hide(); } }); }); From d4125be1b662818b0920d02769a855569325bdbb Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 15:00:34 +0100 Subject: [PATCH 13/42] Fix visual issue with radios --- pandora_console/include/styles/pandora.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index eec5727f49..abb6332c13 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -5803,10 +5803,10 @@ div.label_select_child_left > span { overflow: hidden; } -.switch_radio_button label { +div.switch_radio_button label { background-color: #fff; color: rgba(0, 0, 0, 0.6); - line-height: 9pt; + line-height: 6px !important; text-align: center; padding: 14px 10px; margin-right: -1px; @@ -5814,14 +5814,14 @@ div.label_select_child_left > span { transition: all 0.1s ease-in-out; } -.switch_radio_button label:first { - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; +div.switch_radio_button label:first-of-type { + border-top-left-radius: 4px !important; + border-bottom-left-radius: 4px !important; } -.switch_radio_button label:last-child { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; +div.switch_radio_button label:last-of-type { + border-top-right-radius: 4px !important; + border-bottom-right-radius: 4px !important; margin-right: 0px; } From 1b0fe3887f90b5bb10a4048def5eacbd78008f51 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 15:08:03 +0100 Subject: [PATCH 14/42] Fixed issue with spinner --- pandora_console/godmode/groups/group_list.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 268d91dd3a..576131a8c6 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -738,14 +738,7 @@ if ($tab == 'tree') { * Group tree view. */ - echo html_print_image( - 'images/spinner.gif', - true, - [ - 'class' => 'loading_tree', - 'style' => 'display: none;', - ] - ); + ui_print_spinner(__('Loading')); echo "
"; } else { /* @@ -1041,7 +1034,7 @@ $tab = 'group_edition'; if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0) treeController.recipient.empty(); - $(".loading_tree").show(); + showSpinner(); var parameters = {}; parameters['page'] = "include/ajax/tree.ajax"; @@ -1065,7 +1058,7 @@ $tab = 'group_edition'; data: parameters, success: function(data) { if (data.success) { - $(".loading_tree").hide(); + hideSpinner(); treeController.init({ recipient: $("div#tree-controller-recipient"), From 226b80b7c7bb399e1948ad400d6c09b3ddfdd973 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 15:59:10 +0100 Subject: [PATCH 15/42] Icon revision --- pandora_console/extensions/agents_modules.php | 10 ++-- pandora_console/include/functions_ui.php | 48 +++++++++---------- .../operation/agentes/estado_agente.php | 6 +-- .../operation/agentes/group_view.php | 4 +- pandora_console/operation/heatmap.php | 14 +++--- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 44d4bc64b6..d3467b846c 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -377,17 +377,17 @@ function mainAgentsModules() $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; + &full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else if ($full_modules_selected[0] && $full_agents_id[0]) { $full_modules = urlencode(implode(';', $full_modules_selected)); $full_agents = urlencode(implode(';', $full_agents_id)); $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; + &full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else { $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; + offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&show_type='.$show_type.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } } @@ -597,11 +597,11 @@ function mainAgentsModules() echo '
  • '; echo ''; echo html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Back to normal mode'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); echo ''; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index b9a347c1de..ba4e6bb219 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2444,35 +2444,35 @@ function ui_print_session_action_icon($action, $return=false) global $config; $key_icon = [ - 'acl' => 'images/delete.png', - 'agent' => 'images/agent.png', - 'module' => 'images/module.png', - 'alert' => 'images/bell.png', - 'incident' => 'images/default_list.png', - 'logon' => 'images/house.png', - 'logoff' => 'images/house.png', - 'massive' => 'images/config.png', - 'hack' => 'images/application_edit.png', - 'event' => 'images/lightning_go.png', - 'policy' => 'images/policies_mc.png', - 'report' => 'images/reporting.png', - 'file collection' => 'images/collection_col.png', - 'user' => 'images/user_green.png', - 'password' => 'images/lock.png', - 'session' => 'images/heart_col.png', - 'snmp' => 'images/snmp.png', - 'command' => 'images/bell.png', - 'category' => 'images/category_col.png', - 'dashboard' => 'images/dashboard_col.png', - 'api' => 'images/eye.png', - 'db' => 'images/database.png', - 'setup' => 'images/cog.png', + 'acl' => 'images/delete.svg', + 'agent' => 'images/agents@svg.svg', + 'module' => 'images/modules@svg.svg', + 'alert' => 'images/alerts.svg', + 'incident' => 'images/logs@svg.svg', + 'logon' => 'images/house@svg.svg', + 'logoff' => 'images/house@svg.svg', + 'massive' => 'images/configuration@svg.svg', + 'hack' => 'images/custom-input@svg.svg', + 'event' => 'images/event.svg', + 'policy' => 'images/policy@svg.svg', + 'report' => 'images/agent-fields.svg', + 'file collection' => 'images/file-collection@svg.svg', + 'user' => 'images/user.svg', + 'password' => 'images/password.svg', + 'session' => 'images/star@svg.svg', + 'snmp' => 'images/SNMP-network-numeric-data@svg.svg', + 'command' => 'images/external-tools@svg.svg', + 'category' => 'images/tag@svg.svg', + 'dashboard' => 'images/workstation@groups.svg', + 'api' => 'images/enable.svg', + 'db' => 'images/data-server@svg.svg', + 'setup' => 'images/configuration@svg.svg', ]; $output = ''; foreach ($key_icon as $key => $icon) { if (stristr($action, $key) !== false) { - $output = html_print_image($icon, true, ['title' => $action, 'class' => 'invert_filter'], false, false, false, true).' '; + $output = html_print_image($icon, true, ['title' => $action, 'class' => 'main_menu_icon invert_filter'], false, false, false, true).' '; break; } } diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index e96f6f6537..9898f4a290 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -1141,7 +1141,7 @@ foreach ($agents as $agent) { $data[0] .= ui_print_help_tip( __('Agent in scheduled downtime'), true, - 'images/minireloj-16.png' + 'images/clock.svg' ); $data[0] .= ''; } @@ -1254,12 +1254,12 @@ foreach ($agents as $agent) { $fb64 = base64_encode(json_encode($agent_event_filter)); $data[11] = ''.html_print_image( - 'images/lightning.png', + 'images/event.svg', true, [ 'align' => 'middle', 'title' => __('Agent events'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; diff --git a/pandora_console/operation/agentes/group_view.php b/pandora_console/operation/agentes/group_view.php index 3e602658df..f2ebbedbcf 100644 --- a/pandora_console/operation/agentes/group_view.php +++ b/pandora_console/operation/agentes/group_view.php @@ -289,12 +289,12 @@ if (empty($result_groups) === false) { echo ""; if (!isset($data['_is_tag_']) && check_acl($config['id_user'], $data['_id_'], 'AW')) { echo ''.html_print_image( - 'images/target.png', + 'images/change-active.svg', true, [ 'border' => '0', 'title' => __('Force'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; } diff --git a/pandora_console/operation/heatmap.php b/pandora_console/operation/heatmap.php index a9ab10ed47..1f7337aa39 100644 --- a/pandora_console/operation/heatmap.php +++ b/pandora_console/operation/heatmap.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -64,11 +64,11 @@ if ($group_sent === true) { $is_ajax = is_ajax(); if ($is_ajax === false && $pure === false) { $viewtab['config'] = ''.html_print_image( - 'images/setup.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Config'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; @@ -81,11 +81,11 @@ if ($is_ajax === false && $pure === false) { ); $viewtab['full_screen'] = ''.html_print_image( - 'images/full_screen.png', + 'images/fullscreen@svg.svg', true, [ 'title' => __('Full screen'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; @@ -208,11 +208,11 @@ if ($is_ajax === false && $pure === true) { echo ''; echo html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Back to normal mode'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); echo ''; From d529e6f38408f9cd3ce1f961e2196c1ba0d0ba26 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Tue, 7 Mar 2023 15:59:36 +0100 Subject: [PATCH 16/42] Alerts --- .../godmode/alerts/alert_commands.php | 45 ++- .../godmode/alerts/configure_alert_action.php | 124 +++++--- .../alerts/configure_alert_command.php | 295 +++++++++--------- .../include/class/CalendarManager.class.php | 4 +- pandora_console/include/styles/alert.css | 32 ++ pandora_console/include/styles/pandora.css | 12 + pandora_console/include/styles/wizard.css | 22 +- pandora_console/views/calendar/edit.php | 43 +-- pandora_console/views/calendar/list.php | 14 +- .../views/calendar/special_days.php | 56 +++- .../views/calendar/special_days_edit.php | 20 +- 11 files changed, 419 insertions(+), 248 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 610c503cdc..5369864105 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -171,7 +171,7 @@ if (is_ajax()) { $ffield = $editor_type_chkbx; $ffield .= html_print_textarea( 'field'.$i.'_value', - 1, + 5, 1, '', 'class="fields"', @@ -208,7 +208,7 @@ if (is_ajax()) { $rfield = $editor_type_chkbx; $rfield .= html_print_textarea( 'field'.$i.'_recovery_value', - 1, + 5, 1, '', 'class="fields_recovery"', @@ -329,7 +329,7 @@ if (is_ajax()) { $ffield .= html_print_textarea( 'field'.$i.'_value[]', - 1, + 5, 1, '', 'style="min-height:40px; '.$style.'" class="fields"', @@ -341,7 +341,7 @@ if (is_ajax()) { $rfield .= html_print_textarea( 'field'.$i.'_recovery_value[]', - 1, + 5, 1, '', 'style="min-height:40px; '.$style.'" class="fields_recovery', @@ -484,7 +484,7 @@ if (is_ajax()) { } else { $ffield = html_print_textarea( 'field'.$i.'_value', - 1, + 5, 1, $fv[0], 'style="'.$style.'" class="fields min-height-40px"', @@ -494,7 +494,7 @@ if (is_ajax()) { ); $rfield = html_print_textarea( 'field'.$i.'_recovery_value', - 1, + 5, 1, $fv[0], 'style="'.$style.'" class="fields_recovery min-height-40px', @@ -507,7 +507,7 @@ if (is_ajax()) { } else { $ffield = html_print_textarea( 'field'.$i.'_value', - 1, + 5, 1, '', 'style="'.$style.'" class="fields min-height-40px"', @@ -517,7 +517,7 @@ if (is_ajax()) { ); $rfield = html_print_textarea( 'field'.$i.'_recovery_value', - 1, + 5, 1, '', 'style="'.$style.'" class="fields_recovery min-height-40px"', @@ -533,7 +533,7 @@ if (is_ajax()) { $fields_rows[$i] = ''; } else { $fields_rows[$i] = ''; - $fields_rows[$i] .= ''.$fdesc.''; + $fields_rows[$i] .= ''.$fdesc.''; $fields_rows[$i] .= ''.$ffield.''; if ($get_recovery_fields) { $fields_rows[$i] .= ''.$rfield.''; @@ -575,12 +575,19 @@ if ($update_command) { if (defined('METACONSOLE')) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Alert commands'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Alert commands'), + ], + ] ); } @@ -811,10 +818,9 @@ foreach ($commands as $command) { array_push($table->data, $data); } -ui_pagination($total_commands, $url); if (isset($data) === true && count($table->data) > 0) { html_print_table($table); - ui_pagination($total_commands, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); + $pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, ''); } else { ui_print_info_message( [ @@ -826,12 +832,17 @@ if (isset($data) === true && count($table->data) > 0) { // Commands can only be created by the super administrator. if (users_is_admin() === true) { - echo '
    '; echo '
    '; - html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); + $buttonSubmit = html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'wand'], + true + ); html_print_input_hidden('create_alert', 1); + html_print_action_buttons($buttonSubmit, ['right_content' => $pagination]); echo '
    '; - echo '
    '; } ?> diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index eb1d6d32ee..de5d93a082 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -68,12 +68,19 @@ if ($al_action !== false) { if (defined('METACONSOLE')) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Configure alert action'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, - 'alert_config', - true + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configure alert action'), + ], + ] ); } } else { @@ -81,12 +88,19 @@ if ($al_action !== false) { if (defined('METACONSOLE')) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Configure alert action'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, - 'alert_config', - true + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configure alert action'), + ], + ] ); } @@ -290,73 +304,99 @@ $table->data[1][1] = html_print_label_input_block( ) ); -$table->data[2][0] = html_print_label_input_block( +$table_macros = new stdClass(); +$table_macros->id = 'table_macros'; +$table_macros->width = '100%'; +$table_macros->class = 'databox filters filter-table-adv'; +$table_macros->style = []; +$table_macros->size = []; +$table_macros->size[0] = '20%'; +$table_macros->size[1] = '40%'; +$table_macros->size[2] = '40%'; +$table_macros->data = []; + +$table_macros->data[0][0] = ''; +$table_macros->data[0][1] = html_print_label_input_block( + __('Triggering'), + '' +); + +$table_macros->data[0][2] = html_print_label_input_block( __('Recovery'), '' ); -$table->data[2][1] = html_print_label_input_block( - __('Recovery'), +$table_macros->data[1][0] = html_print_label_input_block( + __('Command preview'), '' ); -$table->data[5][0] = __('Command preview'); -$table->data[5][1] = html_print_textarea( - 'command_preview', - 5, - 30, +$table_macros->data[1][1] = html_print_label_input_block( '', - 'disabled="disabled"', - true + html_print_textarea( + 'command_preview', + 5, + 30, + '', + 'disabled="disabled"', + true + ) ); -$table->data[5][2] = html_print_textarea( - 'command_recovery_preview', - 5, - 30, + +$table_macros->data[1][2] = html_print_label_input_block( '', - 'disabled="disabled"', - true + html_print_textarea( + 'command_recovery_preview', + 5, + 30, + '', + 'disabled="disabled"', + true + ) ); // Selector will work only with Integria activated. $integriaIdName = 'integria_wu'; -$table->data[$integriaIdName][0] = __('Create workunit on recovery').ui_print_help_tip( - __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), - true -); -$table->data[$integriaIdName][1] = html_print_checkbox_switch_extended( - 'create_wu_integria', - 1, - $create_wu_integria, - false, - '', - $disabled_attr, - true +$table_macros->colspan[$integriaIdName][0] = 3; +$table_macros->data[$integriaIdName][0] = html_print_label_input_block( + __('Create workunit on recovery').ui_print_help_tip( + __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), + true + ), + html_print_checkbox_switch_extended( + 'create_wu_integria', + 1, + $create_wu_integria, + false, + '', + $disabled_attr, + true + ) ); for ($i = 1; $i <= $config['max_macro_fields']; $i++) { - $table->data['field'.$i][0] = html_print_image( + $table_macros->data['field'.$i][0] = html_print_image( 'images/spinner.gif', true ); - $table->data['field'.$i][1] = html_print_image( + $table_macros->data['field'.$i][1] = html_print_image( 'images/spinner.gif', true ); - $table->data['field'.$i][2] = html_print_image( + $table_macros->data['field'.$i][2] = html_print_image( 'images/spinner.gif', true ); // Store the value in a hidden to keep it on first execution - $table->data['field'.$i][1] .= html_print_input_hidden( + $table_macros->data['field'.$i][1] .= html_print_input_hidden( 'field'.$i.'_value', (!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '', true, '', $disabled_attr ); - $table->data['field'.$i][2] .= html_print_input_hidden( + $table_macros->data['field'.$i][2] .= html_print_input_hidden( 'field'.$i.'_recovery_value', (!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '', true, @@ -369,10 +409,12 @@ $offset = (int) get_parameter('offset', 0); echo '
    '; $table_html = html_print_table($table, true); +$table_html_macros = html_print_table($table_macros, true); $backButton = ''; $submitButton = ''; echo $table_html; +echo $table_html_macros; if ($is_management_allowed === true) { if ($id) { html_print_input_hidden('id', $id); diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 4316f4a881..1631f2f24e 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -54,12 +54,19 @@ $alert = []; if (is_metaconsole() === true) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Configure alert command'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configure alert command'), + ], + ] ); } @@ -199,112 +206,23 @@ if ($is_management_allowed === false) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; - -if (is_metaconsole() === true) { - $table->head[0] = ($id) ? __('Update Command') : __('Create Command'); - $table->head_colspan[0] = 4; - $table->headstyle[0] = 'text-align: center'; -} +$table->class = 'databox filters filter-table-adv'; $table->style = []; -if (is_metaconsole() === false) { - $table->style[0] = 'font-weight: bold'; - $table->style[2] = 'font-weight: bold'; - $table->style[4] = 'font-weight: bold'; -} $table->size = []; -$table->size[0] = '20%'; +$table->size[0] = '45%'; +$table->size[1] = '45%'; +$table->size[2] = '10%'; $table->data = []; -$table->colspan['name'][1] = 3; -$table->data['name'][0] = __('Name'); -$table->data['name'][2] = html_print_input_text( - 'name', - $name, - '', - 35, - 255, - true, - false, - false, - '', - '', - '', - '', - false, - '', - '', - '', - !$is_management_allowed -); - -$table->colspan['command'][1] = 3; -$table->data['command'][0] = __('Command'); -$table->data['command'][1] = html_print_textarea( - 'command', - 8, - 30, - $command, - '', - true, - '', - !$is_management_allowed -); - -$return_all_group = false; - -if (users_can_manage_group_all('LM') === true) { - $return_all_group = true; -} - -$table->colspan['group'][1] = 3; -$table->data['group'][0] = __('Group'); -$table->data['group'][1] = '
    '.html_print_select_groups( - false, - 'LM', - $return_all_group, - 'id_group', - $id_group, - false, - '', - 0, - true, - false, - true, - '', - !$is_management_allowed -).'
    '; - -$table->colspan['description'][1] = 3; -$table->data['description'][0] = __('Description'); -$table->data['description'][1] = html_print_textarea( - 'description', - 10, - 30, - $description, - '', - true, - '', - !$is_management_allowed -); - - -for ($i = 1; $i <= $config['max_macro_fields']; $i++) { - $table->data['field'.$i][0] = sprintf(__('Field %s description'), $i); - - if (empty($fields_descriptions) === false) { - $field_description = $fields_descriptions[($i - 1)]; - } else { - $field_description = ''; - } - - $table->data['field'.$i][1] = html_print_input_text( - 'field'.$i.'_description', - $field_description, +$table->data[0][0] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, '', - 30, + 35, 255, true, false, @@ -318,12 +236,91 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) { '', '', !$is_management_allowed - ); + ) +); - $table->data['field'.$i][2] = sprintf(__('Field %s values'), $i); - $table->data['field'.$i][2] .= ui_print_help_tip( - __('value1,tag1;value2,tag2;value3,tag3'), - true +if (users_can_manage_group_all('LM') === true) { + $return_all_group = true; +} + +$table->data[0][1] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + 'LM', + $return_all_group, + 'id_group', + $id_group, + false, + '', + 0, + true, + false, + true, + '', + !$is_management_allowed + ) +); + +$table->data[1][0] = html_print_label_input_block( + __('Command'), + html_print_textarea( + 'command', + 8, + 30, + $command, + '', + true, + '', + !$is_management_allowed + ) +); + +$return_all_group = false; + + +$table->data[1][1] = html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 8, + 30, + $description, + '', + true, + '', + !$is_management_allowed + ) +); + +for ($i = 1; $i <= $config['max_macro_fields']; $i++) { + if (empty($fields_descriptions) === false) { + $field_description = $fields_descriptions[($i - 1)]; + } else { + $field_description = ''; + } + + $table->data['field'.$i][0] = html_print_label_input_block( + sprintf(__('Field %s description'), $i), + html_print_input_text( + 'field'.$i.'_description', + $field_description, + '', + 30, + 255, + true, + false, + false, + '', + '', + '', + '', + false, + '', + '', + '', + !$is_management_allowed + ) ); if (empty($fields_values) === false) { @@ -338,54 +335,72 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) { $selected = false; } - $table->data['field'.$i][3] = html_print_input_text( - 'field'.$i.'_values', - $field_values, - '', - 55, - 1000, - true, - false, - false, - '', - 'field_value', - '', - '', - false, - '', - '', - '', - !$is_management_allowed + $table->data['field'.$i][1] = html_print_label_input_block( + sprintf(__('Field %s values'), $i).ui_print_help_tip( + __('value1,tag1;value2,tag2;value3,tag3'), + true + ), + html_print_input_text( + 'field'.$i.'_values', + $field_values, + '', + 55, + 1000, + true, + false, + false, + '', + 'field_value', + '', + '', + false, + '', + '', + '', + !$is_management_allowed + ) ); - $table->data['field'.$i][4] = __('Hide'); - - $table->data['field'.$i][5] = html_print_checkbox_extended( - 'field'.$i.'_hide', - 1, - $selected, - !$is_management_allowed, - 'cursor: \'pointer\'', - 'class="hide_inputs"', - true + $table->data['field'.$i][2] = html_print_label_input_block( + __('Hide'), + html_print_checkbox_extended( + 'field'.$i.'_hide', + 1, + $selected, + !$is_management_allowed, + 'cursor: \'pointer\'', + 'class="hide_inputs"', + true + ) ); } -echo ''; +echo ''; html_print_table($table); if ($is_management_allowed === true) { - echo '
    '; if ($id) { html_print_input_hidden('id', $id); html_print_input_hidden('update_command', 1); - html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"'); + $buttonSubmit = html_print_submit_button( + __('Update'), + 'create', + false, + ['icon' => 'wand'], + true + ); } else { html_print_input_hidden('create_command', 1); - html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"'); + $buttonSubmit = html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'wand'], + true + ); } - echo '
    '; + html_print_action_buttons($buttonSubmit); } echo '
    '; diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php index 989d921e88..033e8986bd 100644 --- a/pandora_console/include/class/CalendarManager.class.php +++ b/pandora_console/include/class/CalendarManager.class.php @@ -1040,7 +1040,7 @@ class CalendarManager 'id' => 'templates_alerts_special_days', 'return' => true, 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => 'godmode/alerts/alert_special_days', @@ -1075,7 +1075,9 @@ class CalendarManager 'name' => 'name', ], ], + 'class' => 'no_border', ], + 'filter_main_class' => 'box-flat white_table_graph', ] ); } catch (Exception $e) { diff --git a/pandora_console/include/styles/alert.css b/pandora_console/include/styles/alert.css index 24915928ab..8033a8a7fe 100644 --- a/pandora_console/include/styles/alert.css +++ b/pandora_console/include/styles/alert.css @@ -354,3 +354,35 @@ div#rules.show { .note-special-day div a.tip > img { margin: 0px; } + +form#icalendar-special-days.calendar-upload-form { + border: 0px; + padding: 0px; +} + +form#icalendar-special-days.calendar-upload-form > ul { + align-items: flex-start !important; +} + +form#icalendar-special-days.calendar-upload-form > ul > li > label { + font-size: 13px; + line-height: 16px; + margin-bottom: 10px; +} + +.special-days-thead > thead > tr > th:not(.header) { + border: 1px solid #e2e2e2; +} + +.special-days-thead > thead > tr > th.header { + border: 0px; + border-bottom: 1px solid #878787; +} + +.special-days-thead > thead > tr > th.c0 { + border-left: 1px solid #e2e2e2; +} + +.special-days-thead > thead > tr > th.c6 { + border-right: 1px solid #e2e2e2; +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f837170673..d819230098 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -671,6 +671,14 @@ select:-internal-list-box { width: 40%; } +.w45p { + width: 45%; +} + +.w48p { + width: 48%; +} + .w47p { width: 47%; } @@ -11536,3 +11544,7 @@ table.alert-template-fields > tbody > tr > td > div > textarea { table.alert-template-fields > tbody > tr > td[id^="template-label_fields"] { text-align: center; } + +.max-width-100p { + max-width: 100% !important; +} diff --git a/pandora_console/include/styles/wizard.css b/pandora_console/include/styles/wizard.css index ab5d011f70..92d40ccc33 100644 --- a/pandora_console/include/styles/wizard.css +++ b/pandora_console/include/styles/wizard.css @@ -46,7 +46,6 @@ ul.wizard li > label:not(.p-switch):first-of-type { } ul.wizard li > textarea { - width: 600px; height: 15em; display: inline-block; } @@ -200,6 +199,7 @@ li#textarea-create-site > textarea { width: 100%; } +form.alert-correlation > ul.wizard > li > label, form#create_site > ul.wizard > li > label { font-size: 13px; line-height: 16px; @@ -210,3 +210,23 @@ form#create_site > ul.wizard > li > label { select[multiple] { min-height: 20em; } + +form.alert-correlation > div > ul, +form.alert-correlation > ul { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +form.alert-correlation > div > ul > li.flex-flex-end { + display: flex; + align-items: flex-end; +} + +form.alert-correlation > div > ul > li.flex-flex-end > input { + width: 150px !important; +} + +form.alert-correlation > div > ul > li.flex-flex-end > label { + width: 50px !important; +} diff --git a/pandora_console/views/calendar/edit.php b/pandora_console/views/calendar/edit.php index 905c77801b..06d8b93d01 100644 --- a/pandora_console/views/calendar/edit.php +++ b/pandora_console/views/calendar/edit.php @@ -34,19 +34,19 @@ if (\is_metaconsole() === true) { \alerts_meta_print_header($tabs); } else { // Header. - \ui_print_page_header( - // Title. - __('Calendars Edit'), - // Icon. + \ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', - // Return. false, - // Help. 'alert_special_days', - // Godmode. true, - // Options. - $tabs + $tabs, + [ + [ + 'link' => '', + 'label' => __('Calendars Edit'), + ], + ] ); } @@ -114,19 +114,24 @@ $inputs[] = [ 'rows' => 50, 'columns' => 30, ], + 'class' => 'w100p', ]; - +$button_create = ''; if ($is_management_allowed === true) { // Submit. - $inputs[] = [ - 'arguments' => [ - 'name' => 'button', - 'label' => (($create === true) ? __('Create') : __('Update')), - 'type' => 'submit', - 'attributes' => 'class="sub next"', - ], - ]; + html_print_action_buttons( + html_print_submit_button( + (($create === true) ? __('Create') : __('Update')), + 'button', + false, + [ + 'icon' => 'wand', + 'form' => 'create_specia_days', + ], + true + ) + ); } // Print form. @@ -135,6 +140,8 @@ HTML::printForm( 'form' => [ 'action' => $url.'&op=edit&action=save&id='.$calendar->id(), 'method' => 'POST', + 'id' => 'create_specia_days', + 'class' => 'aaaa', ], 'inputs' => $inputs, ], diff --git a/pandora_console/views/calendar/list.php b/pandora_console/views/calendar/list.php index 25589ff15f..3e8e924a7d 100644 --- a/pandora_console/views/calendar/list.php +++ b/pandora_console/views/calendar/list.php @@ -101,7 +101,7 @@ try { [ 'id' => $tableId, 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => $ajax_url, @@ -117,12 +117,14 @@ try { [ 'label' => __('Free search'), 'type' => 'text', - 'class' => 'mw250px', + 'class' => 'w25p', 'id' => 'free_search', 'name' => 'free_search', ], ], ], + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar', + 'dom_elements' => 'lftpB', ] ); } catch (Exception $e) { @@ -130,7 +132,7 @@ try { } if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { - HTML::printForm( + $form_create = HTML::printForm( [ 'form' => [ 'action' => $url.'&op=edit', @@ -142,10 +144,12 @@ if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { 'name' => 'button', 'label' => __('Create'), 'type' => 'submit', - 'attributes' => 'class="sub next"', + 'attributes' => ['icon' => 'wand'], ], ], ], - ] + ], + true ); + html_print_action_buttons($form_create); } diff --git a/pandora_console/views/calendar/special_days.php b/pandora_console/views/calendar/special_days.php index 659eb7283a..905a057f05 100644 --- a/pandora_console/views/calendar/special_days.php +++ b/pandora_console/views/calendar/special_days.php @@ -35,19 +35,19 @@ if (\is_metaconsole() === true) { \alerts_meta_print_header($tabs); } else { // Header. - \ui_print_page_header( - // Title. - __('Special days'), - // Icon. + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', - // Return. false, - // Help. 'alert_special_days', - // Godmode. true, - // Options. - $tabs + $tabs, + [ + [ + 'link' => '', + 'label' => __('Special days'), + ], + ] ); } @@ -85,6 +85,7 @@ $inputs[] = [ 'rows' => 10, 'options' => ['required' => 1], ], + 'class' => 'flex flex_column', ]; $days = []; @@ -104,6 +105,7 @@ $inputs[] = [ 'type' => 'select', 'fields' => $days, ], + 'class' => 'mrgn_right_20px', ]; // Group. @@ -114,6 +116,7 @@ $inputs[] = [ 'returnAllGroup' => true, 'name' => 'id_group', ], + 'class' => 'mrgn_right_20px', ]; // Group. @@ -128,6 +131,7 @@ $inputs[] = [ 'id' => 'overwrite', 'disabled_hidden' => true, ], + 'class' => 'flex flex_column', ]; // Submit. @@ -136,23 +140,39 @@ $inputs[] = [ 'name' => 'button', 'label' => __('Upload'), 'type' => 'submit', - 'attributes' => 'class="sub next"', + 'attributes' => [ + 'icon' => 'wand', + 'class' => 'mini', + ], ], ]; if ($is_management_allowed === true) { // Print form. - HTML::printForm( + $form_upload = HTML::printForm( [ 'form' => [ 'action' => $url.'&op=upload_ical&id='.$id_calendar, 'method' => 'POST', 'id' => 'icalendar-special-days', 'enctype' => 'multipart/form-data', + 'class' => 'calendar-upload-form', ], 'inputs' => $inputs, ], - false + true + ); + + ui_toggle( + $form_upload, + ''.__('Upload').'', + __('Upload'), + 'upload', + true, + false, + '', + 'white-box-content no_border', + 'filter-datatable-main box-flat white_table_graph fixed_filter_bar ' ); } @@ -216,7 +236,7 @@ for ($month = 1; $month <= 12; $month++) { $cal_table = new stdClass(); $cal_table->width = '100%'; - $cal_table->class = 'databox data'; + $cal_table->class = 'databox data special-days-thead'; $cal_table->data = []; $cal_table->head = []; @@ -238,7 +258,7 @@ for ($month = 1; $month <= 12; $month++) { $cal_table->size[6] = '14%'; $cal_table->align = []; $cal_table->border = '1'; - $cal_table->titlestyle = 'text-align:center; font-weight: bold;'; + $cal_table->titlestyle = 'text-align:center;'; switch ($display_month) { case 1: $cal_table->title = __('January'); @@ -467,7 +487,7 @@ for ($month = 1; $month <= 12; $month++) { } if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { - HTML::printForm( + $form_create = HTML::printForm( [ 'form' => [ 'action' => $url.'&op=edit', @@ -479,12 +499,14 @@ if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { 'name' => 'button', 'label' => __('Create'), 'type' => 'submit', - 'attributes' => 'class="sub next"', + 'attributes' => ['icon' => 'wand'], ], ], ], - ] + ], + true ); + html_print_action_buttons($form_create); } echo ''; diff --git a/pandora_console/views/calendar/special_days_edit.php b/pandora_console/views/calendar/special_days_edit.php index 1e86a27466..09c7725ebf 100644 --- a/pandora_console/views/calendar/special_days_edit.php +++ b/pandora_console/views/calendar/special_days_edit.php @@ -156,14 +156,18 @@ $inputs[] = [ if ($is_management_allowed === true) { // Submit. - $inputs[] = [ - 'arguments' => [ - 'name' => 'button', - 'label' => (($create === true) ? __('Create') : __('Update')), - 'type' => 'submit', - 'attributes' => 'class="sub next"', - ], - ]; + html_print_action_buttons( + html_print_submit_button( + (($create === true) ? __('Create') : __('Update')), + 'button', + false, + [ + 'icon' => 'wand', + 'form' => 'form-special-days', + ], + true + ) + ); } // Print form. From 5a41c8b61c3f83a5a86f4a4212024f8f2f5dbdde Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Mar 2023 16:00:23 +0100 Subject: [PATCH 17/42] fixed styles --- .../modules/manage_network_components.php | 28 ++++------ .../manage_network_components_form.php | 52 +++++++++---------- 2 files changed, 35 insertions(+), 45 deletions(-) diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index a3050f02e9..7ef20ca385 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -949,30 +949,20 @@ html_print_action_buttons( ?> \ No newline at end of file diff --git a/pandora_console/godmode/modules/manage_inventory_modules.php b/pandora_console/godmode/modules/manage_inventory_modules.php index 5422ae451b..a8faa13a66 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules.php +++ b/pandora_console/godmode/modules/manage_inventory_modules.php @@ -332,14 +332,16 @@ if ($result === false) { if ($management_allowed === true) { // Update module. - $data[4] = ''; - $data[4] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']).''; + $data[4] = ''; } array_push($table->data, $data); @@ -349,22 +351,50 @@ if ($result === false) { html_print_input_hidden('multiple_delete', 1); html_print_table($table); echo ''; - $tablePagination = ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset, 0, true, 'offset', false); - $actionButtons = []; + echo '
    '; + echo html_print_input_hidden('create_module_inventory', 1); + echo ''; + + $tablePagination = ui_pagination( + $total_modules, + 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', + $offset, + 0, + true, + 'offset', + false + ); + + $actionButtons = ''; if ($management_allowed === true) { - $actionButtons[] = html_print_submit_button(__('Delete'), 'delete_btn', false, ['icon' => 'delete', 'mode' => 'secondary', 'form' => 'form_delete'], true); - $actionButtons[] = html_print_submit_button(__('Create'), 'crt', false, ['icon' => 'wand', 'form' => 'form_create'], true); + $actionButtons .= html_print_submit_button( + __('Create'), + 'crt', + false, + [ + 'icon' => 'wand', + 'form' => 'form_create', + ], + true + ); - $actionButtons[] = ''; - $actionButtons[] = html_print_input_hidden('create_module_inventory', 1, true); - $actionButtons[] = ''; + $actionButtons .= html_print_submit_button( + __('Delete'), + 'delete_btn', + false, + [ + 'icon' => 'delete', + 'mode' => 'secondary', + 'form' => 'form_delete', + ], + true + ); } - html_print_action_buttons( - implode('', $actionButtons), + $actionButtons, [ 'type' => 'form_action', 'right_content' => $tablePagination, diff --git a/pandora_console/godmode/modules/manage_inventory_modules_form.php b/pandora_console/godmode/modules/manage_inventory_modules_form.php index 65597d7af1..32424b7f39 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules_form.php +++ b/pandora_console/godmode/modules/manage_inventory_modules_form.php @@ -26,22 +26,32 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], // Header -if (defined('METACONSOLE')) { +if (is_metaconsole() === true) { $sec = 'advanced'; enterprise_include_once('meta/include/functions_components_meta.php'); components_meta_print_header(); } else { $sec = 'gmodules'; - ui_print_page_header( - __('Module management').' » '.__('Inventory modules'), + ui_print_standard_header( + __('Module management'), 'images/op_inventory.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configuration'), + ], + [ + 'link' => '', + 'label' => __('Inventory modules'), + ], + ] ); } -// Header $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; if ($is_windows) { ui_print_error_message(__('Not supported in Windows systems')); @@ -95,82 +105,166 @@ if ($id_os == null) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; +$table->class = 'databox filter-table-adv'; $table->style = []; -$table->style[0] = 'font-weight: bold'; +$table->style[0] = 'width: 50%'; +$table->style[1] = 'width: 50%'; $table->data = []; -$table->data[0][0] = ''.__('Name').''; -$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled); -$table->data[1][0] = ''.__('Description').''; -$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true); -$table->data[2][0] = ''.__('OS').''; -$table->data[2][1] = html_print_select_from_sql( - 'SELECT id_os, name FROM tconfig_os ORDER BY name', - 'id_os', - $id_os, - '', - '', - '', - $return = true + +$table->data[0][] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, + '', + 45, + 100, + true, + $disabled + ) ); -$table->data[3][0] = ''.__('Interpreter').''; -$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true); -$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true); +$table->data[0][] = html_print_label_input_block( + __('Description'), + html_print_input_text( + 'description', + $description, + '', + 60, + 500, + true + ) +); -$table->data['block_mode'][0] = ''.__('Block Mode').''; -$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true); +$table->data[1][] = html_print_label_input_block( + __('OS'), + html_print_select_from_sql( + 'SELECT id_os, name FROM tconfig_os ORDER BY name', + 'id_os', + $id_os, + '', + '', + '', + $return = true + ) +); -$table->data[4][0] = ''.__('Format').''; -$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true); -$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true); +$table->data[1][] = html_print_label_input_block( + __('Interpreter'), + html_print_input_text( + 'interpreter', + $interpreter, + '', + 25, + 100, + true + ).ui_print_input_placeholder( + __('Left blank for the LOCAL inventory modules'), + true + ) +); -$table->data[5][0] = ''.__('Script mode').''; -$table->data[5][0] .= ui_print_help_tip(__(''), true); -$table->data[5][1] = __('Use script'); -$table->data[5][1] .= html_print_radio_button( - 'script_mode', - 1, - '', - $script_mode, - true -).'  '; -$table->data[5][1] .= '    '.__('Use inline code'); -$table->data[5][1] .= html_print_radio_button( - 'script_mode', - 2, - '', - $script_mode, - true -).'  '; +$table->data[2][] = html_print_label_input_block( + __('Format'), + html_print_input_text( + 'format', + $data_format, + '', + 50, + 100, + true + ).ui_print_input_placeholder( + __('separate fields with ').SEPARATOR_COLUMN, + true + ) +); -$table->data[6][0] = ''.__('Script path').''; -$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true); +$table->data[2][] = html_print_label_input_block( + __('Block Mode'), + html_print_checkbox_switch( + 'block_mode', + 1, + $block_mode, + true + ) +); -$table->data[7][0] = ''.__('Code').''; -$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true); +$radioButtons = []; +$radioButtons[] = html_print_radio_button('script_mode', 1, __('Script mode'), $script_mode, true); +$radioButtons[] = html_print_radio_button('script_mode', 2, __('Use inline code'), $script_mode, true); -$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true); +$table->data[3][] = html_print_label_input_block( + __('Script mode'), + html_print_div( + [ + 'class' => 'switch_radio_button', + 'content' => implode('', $radioButtons), + ], + true + ) +); -echo 'colspan[4][0] = 2; + +$table->data[4][0] = html_print_label_input_block( + __('Script path'), + html_print_input_text( + 'script_path', + $script_path, + '', + 50, + 1000, + true + ), + ['div_class' => 'script_path_inventory_modules'] +); + +$table->data[4][0] .= html_print_label_input_block( + __('Code'), + html_print_textarea( + 'code', + 25, + 80, + base64_decode($code), + '', + true + ).ui_print_input_placeholder( + __("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, + true + ), + ['div_class' => 'code_inventory_modules'] +); + +echo ''; html_print_table($table); if ($id_module_inventory) { html_print_input_hidden('update_module_inventory', 1); html_print_input_hidden('id_module_inventory', $id_module_inventory); + $buttonCaption = __('Update'); + $buttonIcon = 'update'; } else { html_print_input_hidden('create_module_inventory', 1); + $buttonCaption = __('Create'); + $buttonIcon = 'wand'; } -echo '
    '; -if ($id_module_inventory) { - html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"'); -} else { - html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"'); -} +$actionButtons = ''; +$actionButtons = html_print_submit_button( + $buttonCaption, + 'submit', + false, + ['icon' => $buttonIcon], + true +); +$actionButtons .= html_print_go_back_button( + 'index.php?sec=gmodules&sec2=godmode/modules/manage_inventory_modules', + ['button_class' => ''], + true +); -echo '
    '; +html_print_action_buttons($actionButtons); echo '
    '; ?> @@ -180,21 +274,21 @@ echo ''; var mode = ; if (mode == 1) { - $('#table1-6').show(); - $('#table1-7').hide(); + $('.script_path_inventory_modules').show(); + $('.code_inventory_modules').hide(); } else { - $('#table1-7').show(); - $('#table1-6').hide(); + $('.code_inventory_modules').show(); + $('.script_path_inventory_modules').hide(); } $('input[type=radio][name=script_mode]').change(function() { if (this.value == 1) { - $('#table1-6').show(); - $('#table1-7').hide(); + $('.script_path_inventory_modules').show(); + $('.code_inventory_modules').hide(); } else if (this.value == 2) { - $('#table1-7').show(); - $('#table1-6').hide(); + $('.code_inventory_modules').show(); + $('.script_path_inventory_modules').hide(); } }); }); diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 44d35d3f06..a3050f02e9 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -615,18 +615,6 @@ $url = ui_get_url_refresh( true, false ); -$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components'; -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; - -$table->style = []; -$table->style[0] = 'font-weight: bold'; -$table->style[2] = 'font-weight: bold'; - -$table->data = []; - -$table->data[0][0] = __('Group'); $component_groups = network_components_get_groups(); @@ -656,54 +644,81 @@ foreach ($component_groups as $component_group_key => $component_group_val) { } } -$table->data[0][1] = html_print_select( - $component_groups, - 'search_id_group', - $search_id_group, +$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components'; +$table = new stdClass(); +$table->width = '100%'; +$table->class = 'filter-table-adv'; + +$table->style = []; +$table->style[0] = 'font-weight: bold'; +$table->style[2] = 'font-weight: bold'; + +$table->data = []; + +$table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select( + $component_groups, + 'search_id_group', + $search_id_group, + '', + __('All'), + 0, + true, + false, + false, + '', + false, + 'width: 100%' + ) +); + +$table->data[0][] = html_print_label_input_block( + __('Free Search'), + html_print_input_text( + 'search_string', + $search_string, + '', + 25, + 255, + true + ).ui_print_input_placeholder( + __('Search by name, description, tcp send or tcp rcv, list matches.'), + true + ) +); + +$toggleFilters = '
    '; +$toggleFilters .= html_print_table($table, true); +$toggleFilters .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true +); +$toggleFilters .= '
    '; + +ui_toggle( + $toggleFilters, + ''.__('Filters').'', + 'filter_form', '', - __('All'), - 0, true, false, - false -); -$table->data[0][2] = __('Free Search').ui_print_help_tip( - __('Search by name, description, tcp send or tcp rcv, list matches.'), - true -); -$table->data[0][3] = html_print_input_text( - 'search_string', - $search_string, '', - 25, - 255, - true + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); -if (is_metaconsole() === true) { - $table->data[0][4] = '
    '; -} else { - $table->data[0][4] = '
    '; -} - -$table->data[0][4] .= html_print_submit_button( - __('Search'), - 'search', - false, - 'class="sub search"', - true -); -$table->data[0][4] .= '
    '; - -if (is_metaconsole() === true) { - $filter = '
    '; - $filter .= html_print_table($table, true); - $filter .= '
    '; - ui_toggle($filter, __('Show Options')); -} else { - echo '
    '; - html_print_table($table); - echo '
    '; -} $filter = []; if ($search_id_group) { @@ -721,7 +736,6 @@ $total_components = network_components_get_network_components( ); $total_components = $total_components[0]['total']; $offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset; -ui_pagination($total_components, $name_url); $filter['offset'] = (int) get_parameter('offset'); $filter['limit'] = (int) $config['block_size']; $components = network_components_get_network_components( diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php index 26231fc107..a1361867b4 100644 --- a/pandora_console/godmode/reporting/create_container.php +++ b/pandora_console/godmode/reporting/create_container.php @@ -496,7 +496,7 @@ if ($edit_container) { $single_table .= ""; $single_table .= html_print_label_input_block( __('Type of graph'), - html_print_select($type_graphs, 'simple_type_graph', '', '', '', 0, true) + html_print_select($type_graphs, 'simple_type_graph2', '', '', '', 0, true, false, true, '', false, 'width:100%') ); $single_table .= ''; @@ -543,21 +543,22 @@ if ($edit_container) { $table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; - $table->class = 'dat'; + $table->class = 'filter-table-adv'; $table->styleTable = 'font-weight: bold;'; $table->style[0] = 'width: 13%'; $table->data = []; + $table->size[0] = '30%'; + $table->size[1] = '30%'; + $table->size[2] = '30%'; - $data = []; - $data[0] = __('Time lapse'); - $data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), true); - $data[1] = html_print_extended_select_for_time('period_custom', $period, '', '', '0', 10, true, false, true, '', false, $periods); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Custom graph'); + $table->data[0][0] = html_print_label_input_block( + __('Time lapse').ui_print_help_tip( + __('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), + true + ), + html_print_extended_select_for_time('period_custom', $period, '', '', '0', 10, true, 'width:100%', true, '', false, $periods) + ); $list_custom_graphs = custom_graphs_get_user($config['id_user'], false, true, 'RR'); @@ -566,29 +567,45 @@ if ($edit_container) { $graphs[$custom_graph['id_graph']] = $custom_graph['name']; } - $data[1] = html_print_select($graphs, 'id_custom_graph', $idCustomGraph, '', __('None'), 0, true); - $table->data[] = $data; - $table->rowclass[] = ''; + $table->data[0][1] = html_print_label_input_block( + __('Custom graph'), + html_print_select($graphs, 'id_custom_graph', $idCustomGraph, '', __('None'), 0, true, '', true, '', false, 'width:100%') + ); - $data = []; - $data[0] = __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true); - $data[1] = html_print_checkbox('fullscale_2', 1, false, true); - $table->data[] = $data; - $table->rowclass[] = ''; + $table->data[0][2] = html_print_label_input_block( + __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true), + html_print_checkbox('fullscale_2', 1, false, true) + ); - $data = []; - $data[0] = ''; - $data[1] = ""; - $table->data[] = $data; - $table->rowclass[] = ''; + $data_toggle = html_print_table($table, true); + $data_toggle .= html_print_div( + [ + 'class' => 'action-buttons-right-forced mrgn_right_10px', + 'content' => html_print_submit_button( + __('Add item'), + 'add_custom', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], + true + ); - echo ""; - echo ''; - echo ''; - echo ''; - echo '
    '; - echo ui_toggle(html_print_table($table, true), 'Custom graph', '', '', true); - echo '
    '; + ui_toggle( + $data_toggle, + ''.__('Custom graph').'', + 'container', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph' + ); unset($table); @@ -597,93 +614,113 @@ if ($edit_container) { $table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; - $table->class = 'dat'; + $table->class = 'filter-table-adv'; $table->styleTable = 'font-weight: bold;'; - $table->style[0] = 'width: 13%'; $table->data = []; + $table->size[0] = '30%'; + $table->size[1] = '30%'; + $table->size[2] = '30%'; - $data = []; - $data[0] = __('Time lapse'); - $data[0] .= ui_print_help_tip(__('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), true); - $data[1] = html_print_extended_select_for_time('period_dynamic', $period, '', '', '0', 10, true, false, true, '', false, $periods); - $table->data[] = $data; - $table->rowclass[] = ''; - $data = []; - $data[0] = __('Group'); - $data[1] = '
    '.html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true).'
    '; - $table->data[] = $data; - $table->rowclass[] = ''; + $table->data[0][0] = html_print_label_input_block( + __('Time lapse').ui_print_help_tip( + __('This is the interval or period of time with which the graph data will be obtained. For example, a week means data from a week ago from now. '), + true + ), + html_print_extended_select_for_time('period_custom', $period, '', '', '0', 10, true, 'width:100%', true, '', false, $periods) + ); - $data = []; - $data[0] = __('Module group'); - $data[1] = html_print_select_from_sql( - 'SELECT * FROM tmodule_group ORDER BY name', - 'combo_modulegroup', - $modulegroup, - '', - __('All'), - false, + $table->data[0][1] = html_print_label_input_block( + __('Group'), + html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true) + ); + + $table->data[0][2] = html_print_label_input_block( + __('Module group'), + html_print_select_from_sql( + 'SELECT * FROM tmodule_group ORDER BY name', + 'combo_modulegroup', + $modulegroup, + '', + __('All'), + false, + true, + false, + true, + false, + 'width:100%' + ) + ); + + $table->data[1][0] = html_print_label_input_block( + __('Agent'), + html_print_input_text('text_agent', $textAgent, '', 30, 100, true) + ); + + $table->data[1][1] = html_print_label_input_block( + __('Module'), + html_print_input_text('text_agent_module', $textModule, '', 30, 100, true) + ); + + $select_tags = tags_search_tag(false, false, true); + $table->data[1][2] = html_print_label_input_block( + __('Tag'), + html_print_select( + $select_tags, + 'tag', + $tag, + '', + __('Any'), + 0, + true, + false, + false, + '', + false, + 'width:100%' + ) + ); + + $table->data[2][0] = html_print_label_input_block( + __('Type of graph'), + html_print_select($type_graphs, 'simple_type_graph2', '', '', '', 0, true, false, true, '', false, 'width:100%') + ); + + $table->data[2][1] = html_print_label_input_block( + __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true), + html_print_checkbox('fullscale_3', 1, false, true) + ); + + $data_toggle = html_print_table($table, true); + $data_toggle .= html_print_div( + [ + 'class' => 'action-buttons-right-forced mrgn_right_10px', + 'content' => html_print_submit_button( + __('Add item'), + 'add_dynamic', + false, + [ + 'mode' => 'mini', + 'icon' => 'next', + ], + true + ), + ], true ); - $table->data[] = $data; - $table->rowclass[] = ''; - $data = []; - $data[0] = __('Agent'); - $data[1] = html_print_input_text('text_agent', $textAgent, '', 30, 100, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Module'); - $data[1] = html_print_input_text('text_agent_module', $textModule, '', 30, 100, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Tag'); - $select_tags = tags_search_tag(false, false, true); - $data[1] = html_print_select( - $select_tags, - 'tag', - $tag, + ui_toggle( + $data_toggle, + ''.__('Dynamic rules for simple module graph').'', + 'container', '', - __('Any'), - 0, true, false, - false + '', + 'white-box-content', + 'box-flat white_table_graph' ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Type of graph'); - $data[1] = html_print_select($type_graphs, 'simple_type_graph2', '', '', '', 0, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true); - $data[1] = html_print_checkbox('fullscale_3', 1, false, true); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $data[0] = ''; - $data[1] = ""; - $table->data[] = $data; - $table->rowclass[] = ''; - - echo ""; - echo ''; - echo ''; - echo ''; - echo '
    '; - echo ui_toggle(html_print_table($table, true), 'Dynamic rules for simple module graph', '', '', true); - echo '
    '; if ((bool) $id_container !== false) { $total_item = db_get_all_rows_sql('SELECT count(*) FROM tcontainer_item WHERE id_container = '.$id_container); @@ -696,7 +733,7 @@ if ($edit_container) { ui_pagination($total_item[0]['count(*)'], false, $offset, 10); $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox data'; + $table->class = 'info_table'; $table->id = 'item_table'; $table->align = []; $table->head = []; @@ -710,7 +747,7 @@ if ($edit_container) { $table->head[7] = __('Delete'); $table->data = []; - + $i = 0; foreach ($result_item as $item) { $data = []; @@ -759,6 +796,8 @@ if ($edit_container) { break; } + $table->cellclass[$i][7] = 'table_action_buttons'; + $i++; $data[7] = ''.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']).''; @@ -801,7 +840,7 @@ echo html_print_input_hidden('id_agent', 0); } }); - $("input[name=add_custom]").click (function () { + $("#button-add_custom").click (function () { var id_custom = $("#id_custom_graph").val(); var fullscale = $("#checkbox-fullscale_2").prop("checked"); if (id_custom !== '0'){ @@ -824,7 +863,7 @@ echo html_print_input_hidden('id_agent', 0); } }); - $("input[name=add_dynamic]").click (function () { + $("#button-add_dynamic").click (function () { var agent_alias = $("#text-text_agent").val(); var module_name = $("#text-text_agent_module").val(); var time_lapse = $("#hidden-period_dynamic").attr('value'); diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index cbc947ef78..370285d7bf 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -129,11 +129,22 @@ $container = folder_get_folders(); $tree = folder_get_folders_tree_recursive($container); echo folder_togge_tree_folders($tree); if ($report_r && $report_w) { - echo "
    "; - echo '
    '; - html_print_submit_button(__('Create container'), 'create', false, 'class="sub next mrgn_right_5px mrgn_top_15px"'); - echo '
    '; - echo '
    '; + $ActionButtons[] = '
    '; + $ActionButtons[] = '
    '; + $ActionButtons[] = html_print_submit_button( + __('Create container'), + 'create', + false, + [ + 'class' => 'sub ok submitButton', + 'icon' => 'next', + ], + true + ); + $ActionButtons[] = '
    '; + $ActionButtons[] = '
    '; + + html_print_action_buttons(implode('', $ActionButtons), ['type' => 'form_action']); } ?> diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index ce755015ed..ec336eb290 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2229,7 +2229,7 @@ $class = 'databox filters'; - + 'link', + 'style' => 'display:none', + ]; + } else { + $style_create = [ 'mode' => 'link' ]; + } + + if (!empty($style_button_edit_custom_graph)) { + $style_edit = [ + 'mode' => 'link', + 'style' => 'display:none', + ]; + } else { + $style_edit = [ 'mode' => 'link' ]; + } + html_print_button( __('Create'), 'create_graph', false, - 'create_custom_graph();', - 'class="sub add" '.$style_button_create_custom_graph + 'create_custom_graph()', + $style_create ); html_print_button( __('Edit'), 'edit_graph', false, - 'edit_custom_graph();', - 'class="sub config" '.$style_button_edit_custom_graph + 'edit_custom_graph()', + $style_edit ); ?> diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 086741d052..052f105eda 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1283,7 +1283,7 @@ if (check_login()) { $linkCaption, 'additional_action_for_'.$idAgenteModulo, false, - 'window.location.assign(\'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module['id_agente_modulo'].'&refr=60'.$addedLinkParams.'\')', + 'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&id_agente_modulo='.$module['id_agente_modulo'].'&refr=60'.$addedLinkParams.'")', [ 'mode' => 'link', 'style' => 'justify-content: flex-end;', @@ -1300,7 +1300,7 @@ if (check_login()) { __('Edit'), 'edit_module_'.$idAgenteModulo, false, - 'window.location.assign(\'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&id_agent_module='.$module['id_agente_modulo'].'&edit_module='.$module['id_modulo'].'\')', + 'window.location.assign("index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&id_agent_module='.$module['id_agente_modulo'].'&edit_module='.$module['id_modulo'].'")', [ 'mode' => 'link', 'style' => 'justify-content: flex-end;', diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index 8bdc200299..befc213a8c 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -103,42 +103,16 @@ class CredentialStore extends Wizard */ private function ajaxMsg($type, $msg, $delete=false) { - $msg_err = 'Failed while saving: %s'; - $msg_ok = 'Successfully saved into keystore '; - - if ($delete) { - $msg_err = 'Failed while removing: %s'; - $msg_ok = 'Successfully deleted '; - } - - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __( - $msg_err, - $msg - ), - '', - true - ), - ] - ); + if ($type === 'error') { + $msg_title = ($delete === true) ? 'Failed while removing' : 'Failed while saving'; } else { - echo json_encode( - [ - $type => ui_print_success_message( - __( - $msg_ok, - $msg - ), - '', - true - ), - ] - ); + $msg_title = ($delete === true) ? 'Successfully deleted' : 'Successfully saved into keystore'; } + echo json_encode( + [ $type => __($msg_title).':
    '.$msg ] + ); + exit; } diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index fb1a496246..2e777bdf4c 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -264,27 +264,11 @@ class ModuleTemplates extends HTML */ private function ajaxMsg($type, $msg) { - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); - } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); - } + echo json_encode( + [ + $type => __($msg), + ] + ); exit; } @@ -708,7 +692,7 @@ class ModuleTemplates extends HTML 'action' => $this->baseUrl, 'id' => 'add_module_form', 'method' => 'POST', - 'class' => 'modal', + 'class' => 'modal filter-list-adv', 'extra' => '', ]; @@ -846,10 +830,10 @@ class ModuleTemplates extends HTML false ); // Create the table with Module Block list. - $table = new StdClasS(); + $table = new stdClass(); $table->class = 'databox data '; $table->width = '75%'; - $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;'; + $table->styleTable = 'border: 1px solid #ddd;'; $table->rowid = []; $table->data = []; @@ -893,7 +877,7 @@ class ModuleTemplates extends HTML ); $data[3] .= html_print_input_image( 'export_profile', - 'images/csv.png', + 'images/file-csv.svg', $row['id_np'], '', true, @@ -914,7 +898,7 @@ class ModuleTemplates extends HTML $data[3] .= ''; $data[3] .= ''; $data[3] .= html_print_image( - 'images/csv.png', + 'images/file-csv.svg', true, [ 'title' => __('Export to CSV'), @@ -1165,7 +1149,7 @@ class ModuleTemplates extends HTML $blockComponentList = chop($blockComponentList, ','); // Title of Block. - $blockTitle = '
    '; + $blockTitle = '
    '; $blockTitle .= $blockTable['name']; $blockTitle .= '
    '; $blockTitle .= html_print_input_image( @@ -1186,7 +1170,7 @@ class ModuleTemplates extends HTML $table = new StdClasS(); $table->class = 'databox data border_bt'; $table->width = '75%'; - $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;'; + $table->styleTable = 'margin: 0; border: 1px solid #ddd;'; $table->rowid = []; $table->data = []; @@ -1220,7 +1204,7 @@ class ModuleTemplates extends HTML switch ($module['id_format']) { case MODULE_NETWORK: $formatInfo = html_print_image( - 'images/network.png', + 'images/network-server@os.svg', true, [ 'title' => __('Network module'), @@ -1231,7 +1215,7 @@ class ModuleTemplates extends HTML case MODULE_WMI: $formatInfo = html_print_image( - 'images/wmi.png', + 'images/WMI@svg.svg', true, [ 'title' => __('WMI module'), @@ -1242,7 +1226,7 @@ class ModuleTemplates extends HTML case MODULE_PLUGIN: $formatInfo = html_print_image( - 'images/plugin.png', + 'images/plugins@svg.svg', true, [ 'title' => __('Plug-in module'), diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index b1c5e84763..701eb4ecfb 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -3601,7 +3601,7 @@ class NetworkMap url_background_grid: url_background_grid, refresh_time: '.$this->mapOptions['refresh_time'].', font_size: '.$this->mapOptions['font_size'].', - method: '.$this->map['generation_method'].', + method: '.($this->map['generation_method'] ?? 3).', base_url_homedir: "'.ui_get_full_url(false).'" }); init_drag_and_drop(); diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php index 0d9111a24b..aa86f25e81 100644 --- a/pandora_console/include/class/SatelliteAgent.class.php +++ b/pandora_console/include/class/SatelliteAgent.class.php @@ -959,41 +959,28 @@ class SatelliteAgent extends HTML */ private function ajaxMsg($type, $msg, $delete=false, $disable=false) { - $msg_err = 'Failed while saving: %s'; - $msg_ok = 'Successfully saved agent '; - - if ($delete === true) { - $msg_err = 'Failed while removing: %s'; - $msg_ok = 'Successfully deleted '; - } - - if ($disable === true) { - $msg_err = 'Failed while disabling: %s'; - $msg_ok = 'Successfully disabled'; - } - - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); + if ($type === 'error') { + if ($delete === true) { + $msg_title = 'Failed while removing'; + } else if ($disable === true) { + $msg_title = 'Failed while disabling'; + } else { + $msg_title = 'Failed while saving'; + } } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); + if ($delete === true) { + $msg_title = 'Successfully deleted'; + } else if ($disable === true) { + $msg_title = 'Successfully disabled'; + } else { + $msg_title = 'Successfully saved agent'; + } } + echo json_encode( + [ $type => __($msg_title).':
    '.$msg ] + ); + exit; } diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index aae0cb6780..6ef72c40c4 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -475,27 +475,11 @@ class SatelliteCollection extends HTML */ private function ajaxMsg(string $type, string $msg) { - if ($type === 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); - } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); - } + echo json_encode( + [ + $type => __($msg), + ] + ); exit; } diff --git a/pandora_console/include/functions_container.php b/pandora_console/include/functions_container.php index 502db2b4ad..e9d034f431 100644 --- a/pandora_console/include/functions_container.php +++ b/pandora_console/include/functions_container.php @@ -316,13 +316,13 @@ function ui_toggle_container($code, $name, $title='', $hidden_default=true, $ret $data[0] = '
    '.html_print_image($original, true, ['title' => $title, 'id' => 'image_'.$uniqid, 'class' => 'invert_filter']).'  '.$name.''; $data[1] = ui_print_group_icon($group, true); if ($report_r && $report_w) { - $data[2] = ''.html_print_image('images/config.png', true, ['class' => 'invert_filter']).''; + $data[2] = ''.html_print_image('images/edit.svg', true, ['class' => 'invert_filter main_menu_icon']).''; } if ($report_r && $report_w && $report_m) { if ($id_container !== '1') { $data[2] .= '    '.''.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter']).''; + return false;">'.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter main_menu_icon']).''; } } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0f6d03fee7..977076824b 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -5339,3 +5339,199 @@ function get_baseline_data( $result['agent_alias'] = $array_data[0]['sum0']['agent_alias']; return ['sum0' => $result]; } + + +/** + * Draw graph SO agents by group. + * + * @param [type] $id_group + * @param integer $width + * @param integer $height + * @param boolean $recursive + * @param boolean $noWaterMark + * @return string Graph + */ +function graph_so_by_group($id_group, $width=300, $height=200, $recursive=true, $noWaterMark=true) +{ + global $config; + + $id_groups = [$id_group]; + + if ($recursive == true) { + $groups = groups_get_children($id_group); + if (count($groups) > 0) { + $id_groups = []; + foreach ($groups as $key => $value) { + $id_groups[] = $value['id_grupo']; + } + } + } + + $sql = sprintf( + 'SELECT COUNT(id_agente) AS count, + os.name + FROM tagente a + LEFT JOIN tconfig_os os ON a.id_os = os.id_os + WHERE a.id_grupo IN (%s) + GROUP BY os.id_os', + implode(',', $id_groups) + ); + + $result = db_get_all_rows_sql($sql, false, false); + if ($result === false) { + $result = []; + } + + $labels = []; + $data = []; + foreach ($result as $key => $row) { + $labels[] = $row['name']; + $data[] = $row['count']; + } + + if ($noWaterMark === true) { + $water_mark = [ + 'file' => $config['homedir'].'/images/logo_vertical_water.png', + 'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false), + ]; + } else { + $water_mark = []; + } + + $options = [ + 'width' => $width, + 'height' => $height, + 'waterMark' => $water_mark, + 'legend' => [ + 'display' => true, + 'position' => 'right', + 'align' => 'center', + ], + 'labels' => $labels, + ]; + + return pie_graph( + $data, + $options + ); + +} + + +/** + * Draw graph events by group + * + * @param [type] $id_group + * @param integer $width + * @param integer $height + * @param boolean $noWaterMark + * @param boolean $time_limit + * @param boolean $recursive + * @return string Graph + */ +function graph_events_agent_by_group($id_group, $width=300, $height=200, $noWaterMark=true, $time_limit=false, $recursive=true) +{ + global $config; + + $data = []; + $labels = []; + $loop = 0; + define('NUM_PIECES_PIE_2', 6); + + // Add tags condition to filter. + $tags_condition = ''; + if ($time_limit && $config['event_view_hr']) { + $tags_condition .= ' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; + } + + $id_groups = [$id_group]; + if ($recursive === true) { + $groups = groups_get_children($id_group); + if (count($groups) > 0) { + $id_groups = []; + foreach ($groups as $key => $value) { + $id_groups[] = $value['id_grupo']; + } + } + } + + $filter_groups = ' AND te.id_grupo IN ('.implode(',', $id_groups).') '; + + // This will give the distinct id_agente, give the id_grupo that goes + // with it and then the number of times it occured. GROUP BY statement + // is required if both DISTINCT() and COUNT() are in the statement. + $sql = sprintf( + 'SELECT DISTINCT(id_agente) AS id_agente, + COUNT(id_agente) AS count + FROM tevento te + WHERE 1=1 AND estado = 0 + %s %s + GROUP BY id_agente + ORDER BY count DESC LIMIT 8', + $tags_condition, + $filter_groups + ); + $result = db_get_all_rows_sql($sql, false, false); + if ($result === false) { + $result = []; + } + + $system_events = 0; + $other_events = 0; + + foreach ($result as $row) { + $row['id_grupo'] = agents_get_agent_group($row['id_agente']); + if (!check_acl($config['id_user'], $row['id_grupo'], 'ER') == 1) { + continue; + } + + if ($loop >= NUM_PIECES_PIE_2) { + $other_events += $row['count']; + } else { + if ($row['id_agente'] == 0) { + $system_events += $row['count']; + } else { + $alias = agents_get_alias($row['id_agente']); + $name = mb_substr($alias, 0, 25).' #'.$row['id_agente'].' ('.$row['count'].')'; + $labels[] = io_safe_output($name); + $data[] = $row['count']; + } + } + + $loop++; + } + + if ($system_events > 0) { + $name = __('SYSTEM').' ('.$system_events.')'; + $labels[] = io_safe_output($name); + $data[] = $system_events; + } + + // Sort the data. + arsort($data); + if ($noWaterMark === true) { + $water_mark = [ + 'file' => $config['homedir'].'/images/logo_vertical_water.png', + 'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false), + ]; + } else { + $water_mark = []; + } + + $options = [ + 'width' => $width, + 'height' => $height, + 'waterMark' => $water_mark, + 'legend' => [ + 'display' => true, + 'position' => 'right', + 'align' => 'center', + ], + 'labels' => $labels, + ]; + + return pie_graph( + $data, + $options + ); +} diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 6eb91b7afd..02d0f434bb 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -1276,7 +1276,7 @@ function groups_get_not_init_agents($group, $agent_filter=[], $module_filter=[], * * @return integer Number of monitors. */ -function groups_get_monitors_counter($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_monitors_counter($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { if (empty($group)) { return 0; @@ -1291,7 +1291,11 @@ function groups_get_monitors_counter($group, $agent_filter=[], $module_filter=[] } $group_str = implode(',', $groups); - $groups_clause = "AND (ta.id_grupo IN ($group_str) OR tasg.id_group IN ($group_str))"; + if ($secondary_group === true) { + $groups_clause = "AND (ta.id_grupo IN ($group_str) OR tasg.id_group IN ($group_str))"; + } else { + $groups_clause = "AND (ta.id_grupo IN ($group_str))"; + } $tags_clause = ''; @@ -1401,10 +1405,12 @@ function groups_get_monitors_counter($group, $agent_filter=[], $module_filter=[] ON tam.id_agente_modulo = tae.id_agente_modulo $modules_clause INNER JOIN tagente ta - ON tam.id_agente = ta.id_agente - LEFT JOIN tagent_secondary_group tasg - ON ta.id_agente = tasg.id_agent - AND ta.disabled = 0 + ON tam.id_agente = ta.id_agente"; + if ($secondary_group === true) { + $sql .= ' LEFT JOIN tagent_secondary_group tasg ON ta.id_agente = tasg.id_agent'; + } + + $sql .= "AND ta.disabled = 0 $agent_name_filter $agents_clause WHERE tam.disabled = 0 @@ -1450,8 +1456,9 @@ function groups_get_monitors_counter($group, $agent_filter=[], $module_filter=[] } $status_columns_str = implode(',', $status_columns_array); + $status_columns_str_sum = implode('+', $status_columns_array); - $sql = "SELECT SUM($status_columns_str) FROM + $sql = "SELECT SUM($status_columns_str_sum) FROM (SELECT DISTINCT(ta.id_agente), $status_columns_str FROM tagente ta LEFT JOIN tagent_secondary_group tasg ON ta.id_agente = tasg.id_agent @@ -1486,11 +1493,11 @@ function groups_get_monitors_counter($group, $agent_filter=[], $module_filter=[] * * @return integer Number of monitors. */ -function groups_get_total_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_total_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { // Always modify the module status filter $module_filter['status'] = AGENT_MODULE_STATUS_ALL; - return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime); + return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime, $secondary_group); } @@ -1511,11 +1518,11 @@ function groups_get_total_monitors($group, $agent_filter=[], $module_filter=[], * * @return integer Number of monitors. */ -function groups_get_normal_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_normal_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { // Always modify the module status filter $module_filter['status'] = AGENT_MODULE_STATUS_NORMAL; - return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime); + return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime, $secondary_group); } @@ -1536,11 +1543,11 @@ function groups_get_normal_monitors($group, $agent_filter=[], $module_filter=[], * * @return integer Number of monitors. */ -function groups_get_critical_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_critical_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { // Always modify the module status filter $module_filter['status'] = AGENT_MODULE_STATUS_CRITICAL_BAD; - return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime); + return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime, $secondary_group); } @@ -1561,11 +1568,11 @@ function groups_get_critical_monitors($group, $agent_filter=[], $module_filter=[ * * @return integer Number of monitors. */ -function groups_get_warning_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_warning_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { // Always modify the module status filter $module_filter['status'] = AGENT_MODULE_STATUS_WARNING; - return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime); + return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime, $secondary_group); } @@ -1586,11 +1593,11 @@ function groups_get_warning_monitors($group, $agent_filter=[], $module_filter=[] * * @return integer Number of monitors. */ -function groups_get_unknown_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_unknown_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { // Always modify the module status filter $module_filter['status'] = AGENT_MODULE_STATUS_UNKNOWN; - return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime); + return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime, $secondary_group); } @@ -1611,11 +1618,11 @@ function groups_get_unknown_monitors($group, $agent_filter=[], $module_filter=[] * * @return integer Number of monitors. */ -function groups_get_not_init_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false) +function groups_get_not_init_monitors($group, $agent_filter=[], $module_filter=[], $strict_user=false, $groups_and_tags=false, $realtime=false, $secondary_group=true) { // Always modify the module status filter $module_filter['status'] = AGENT_MODULE_STATUS_NOT_INIT; - return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime); + return groups_get_monitors_counter($group, $agent_filter, $module_filter, $strict_user, $groups_and_tags, $realtime, $secondary_group); } @@ -1635,7 +1642,7 @@ function groups_monitor_fired_alerts($group_array) } -function groups_monitor_alerts_total_counters($group_array) +function groups_monitor_alerts_total_counters($group_array, $secondary_group=true) { // If there are not groups to query, we jump to nextone $default_total = [ @@ -1649,26 +1656,32 @@ function groups_monitor_alerts_total_counters($group_array) } $group_clause = implode(',', $group_array); - $group_clause = "(tasg.id_group IN ($group_clause) OR ta.id_grupo IN ($group_clause))"; + if ($secondary_group === true) { + $group_clause = "(tasg.id_group IN ($group_clause) OR ta.id_grupo IN ($group_clause))"; + } else { + $group_clause = "(ta.id_grupo IN ($group_clause))"; + } - $alerts = db_get_row_sql( - "SELECT - COUNT(tatm.id) AS total, - SUM(IF(tatm.times_fired > 0, 1, 0)) AS fired - FROM talert_template_modules tatm - INNER JOIN tagente_modulo tam - ON tatm.id_agent_module = tam.id_agente_modulo - INNER JOIN tagente ta - ON ta.id_agente = tam.id_agente - WHERE ta.id_agente IN ( - SELECT ta.id_agente - FROM tagente ta - LEFT JOIN tagent_secondary_group tasg - ON ta.id_agente = tasg.id_agent - WHERE ta.disabled = 0 - AND $group_clause - ) AND tam.disabled = 0" - ); + $sql = 'SELECT + COUNT(tatm.id) AS total, + SUM(IF(tatm.times_fired > 0, 1, 0)) AS fired + FROM talert_template_modules tatm + INNER JOIN tagente_modulo tam + ON tatm.id_agent_module = tam.id_agente_modulo + INNER JOIN tagente ta + ON ta.id_agente = tam.id_agente + WHERE ta.id_agente IN ( + SELECT ta.id_agente + FROM tagente ta'; + if ($secondary_group === true) { + $sql .= ' LEFT JOIN tagent_secondary_group tasg ON ta.id_agente = tasg.id_agent'; + } + + $sql .= " WHERE ta.disabled = 0 + AND $group_clause + ) AND tam.disabled = 0"; + + $alerts = db_get_row_sql($sql); return ($alerts === false) ? $default_total : $alerts; } @@ -1746,7 +1759,7 @@ function groups_monitor_total_counters($group_array, $search_in_testado=false) } -function groups_agents_total_counters($group_array) +function groups_agents_total_counters($group_array, $secondary_groups=true) { $default_total = [ 'ok' => 0, @@ -1763,30 +1776,36 @@ function groups_agents_total_counters($group_array) } $group_clause = implode(',', $group_array); - $group_clause = "(tasg.id_group IN ($group_clause) OR ta.id_grupo IN ($group_clause))"; + if ($secondary_groups === true) { + $group_clause = "(tasg.id_group IN ($group_clause) OR ta.id_grupo IN ($group_clause))"; + } else { + $group_clause = "(ta.id_grupo IN ($group_clause))"; + } $condition_critical = agents_get_status_clause(AGENT_STATUS_CRITICAL); $condition_warning = agents_get_status_clause(AGENT_STATUS_WARNING); $condition_unknown = agents_get_status_clause(AGENT_STATUS_UNKNOWN); $condition_not_init = agents_get_status_clause(AGENT_STATUS_NOT_INIT); $condition_normal = agents_get_status_clause(AGENT_STATUS_NORMAL); + $sql = "SELECT SUM(IF($condition_normal, 1, 0)) AS ok, SUM(IF($condition_critical, 1, 0)) AS critical, SUM(IF($condition_warning, 1, 0)) AS warning, SUM(IF($condition_unknown, 1, 0)) AS unknown, SUM(IF($condition_not_init, 1, 0)) AS not_init, COUNT(ta.id_agente) AS total - FROM tagente ta - WHERE ta.disabled = 0 + FROM tagente ta + WHERE ta.disabled = 0 AND ta.id_agente IN ( - SELECT ta.id_agente FROM tagente ta - LEFT JOIN tagent_secondary_group tasg - ON ta.id_agente = tasg.id_agent - WHERE ta.disabled = 0 - AND $group_clause - GROUP BY ta.id_agente - ) - "; + SELECT ta.id_agente FROM tagente ta"; + if ($secondary_groups === true) { + $sql .= ' LEFT JOIN tagent_secondary_group tasg ON ta.id_agente = tasg.id_agent'; + } + + $sql .= " WHERE ta.disabled = 0 + AND $group_clause + GROUP BY ta.id_agente + )"; $agents = db_get_row_sql($sql); @@ -2438,3 +2457,390 @@ function groups_get_group_deep($id_group) return $deep; } + + +/** + * Heat map from agents by group + * + * @param array $id_group + * @param integer $width + * @param integer $height + * + * @return string Html Graph. + */ +function groups_get_heat_map_agents(array $id_group, float $width=0, float $height=0) +{ + ui_require_css_file('heatmap'); + + if (is_array($id_group) === false) { + $id_group = [$id_group]; + } + + $sql = 'SELECT * FROM tagente WHERE id_grupo IN('.implode(',', $id_group).')'; + + $all_agents = db_get_all_rows_sql($sql); + if (empty($all_agents)) { + return null; + } + + $total_agents = count($all_agents); + + // Best square. + $high = (float) max($width, $height); + $low = 0.0; + + while (abs($high - $low) > 0.000001) { + $mid = (($high + $low) / 2.0); + $midval = (floor($width / $mid) * floor($height / $mid)); + if ($midval >= $total_agents) { + $low = $mid; + } else { + $high = $mid; + } + } + + $square_length = min(($width / floor($width / $low)), ($height / floor($height / $low))); + + // Print starmap. + $html = sprintf( + '', + $id_group, + $width, + $height + ); + + $html .= ''; + $row = 0; + $column = 0; + $x = 0; + $y = 0; + $cont = 1; + + foreach ($all_agents as $key => $value) { + // Colour by status. + $status = agents_get_status_from_counts($value); + + switch ($status) { + case 5: + // Not init status. + $status = 'notinit'; + break; + + case 1: + // Critical status. + $status = 'critical'; + break; + + case 2: + // Warning status. + $status = 'warning'; + break; + + case 0: + // Normal status. + $status = 'normal'; + break; + + case 3: + case -1: + default: + // Unknown status. + $status = 'unknown'; + break; + } + + $html .= sprintf( + '', + 'rect_'.$cont, + $x, + $y, + $row, + $column, + $square_length, + $square_length, + $status, + random_int(1, 10) + ); + + $y += $square_length; + $row++; + if ((int) ($y + $square_length) > (int) $height) { + $y = 0; + $x += $square_length; + $row = 0; + $column++; + } + + if ((int) ($x + $square_length) > (int) $width) { + $x = 0; + $y += $square_length; + $column = 0; + $row++; + } + + $cont++; + } + ?> + + '; + $html .= ''; + + return $html; +} + + +/** + * Return html count from agents and monitoring by group. + * + * @param [type] $id_groups + * + * @return string Html + */ +function tactical_groups_get_agents_and_monitoring($id_groups) +{ + global $config; + + $data = [ + 'total_agents' => groups_agents_total_counters($id_groups, false)['total'], + 'monitor_total' => groups_get_total_monitors($id_groups, [], [], false, false, false, false), + ]; + + // Link URLS + $urls = []; + $urls['total_agents'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_groups[0].'&recursion=1'; + $urls['monitor_total'] = $config['homeurl'].'index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1&ag_group='.$id_groups[0].'&recursion=1'; + + $table_am = html_get_predefined_table(); + $tdata = []; + $tdata[0] = html_print_image('images/agent.png', true, ['title' => __('Total agents'), 'class' => 'invert_filter'], false, false, false, true); + $tdata[1] = $data['total_agents'] <= 0 ? '-' : $data['total_agents']; + $tdata[1] = ''.$tdata[1].''; + + if ($data['total_agents'] > 500 && !enterprise_installed()) { + $tdata[2] = "
    "; + } + + $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true); + $tdata[4] = $data['monitor_total'] <= 0 ? '-' : $data['monitor_total']; + $tdata[4] = ''.$tdata[4].''; + + /* + Hello there! :) + We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( + You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. + */ + if ($data['total_agents']) { + if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) { + $tdata[5] = "
    "; + } + } + + $table_am->rowclass[] = ''; + $table_am->data[] = $tdata; + + $output = '
    + '.__('Total agents and monitors').''.html_print_table($table_am, true).'
    '; + + return $output; +} + + +/** + * Return html count from stats alerts by group. + * + * @param [type] $id_groups + * @return string Html. + */ +function tactical_groups_get_stats_alerts($id_groups) +{ + global $config; + + $alerts = groups_monitor_alerts_total_counters($id_groups, false); + $data = [ + 'monitor_alerts' => $alerts['total'], + 'monitor_alerts_fired' => $alerts['fired'], + + ]; + + $urls = []; + $urls['monitor_alerts'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&ag_group='.$id_groups[0]; + $urls['monitor_alerts_fired'] = $config['homeurl'].'index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&disabled=fired&ag_group='.$id_groups[0]; + + // Alerts table. + $table_al = html_get_predefined_table(); + + $tdata = []; + $tdata[0] = html_print_image('images/bell.png', true, ['title' => __('Defined alerts'), 'class' => 'invert_filter'], false, false, false, true); + $tdata[1] = $data['monitor_alerts'] <= 0 ? '-' : $data['monitor_alerts']; + $tdata[1] = ''.$tdata[1].''; + + /* + Hello there! :) + We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( + You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. + */ + + if ($data['monitor_alerts'] > $data['total_agents'] && !enterprise_installed()) { + $tdata[2] = "
    "; + } + + $tdata[3] = html_print_image( + 'images/bell_error.png', + true, + [ + 'title' => __('Fired alerts'), + 'class' => 'invert_filter', + ], + false, + false, + false, + true + ); + $tdata[4] = $data['monitor_alerts_fired'] <= 0 ? '-' : $data['monitor_alerts_fired']; + $tdata[4] = ''.$tdata[4].''; + $table_al->rowclass[] = ''; + $table_al->data[] = $tdata; + + if (!is_metaconsole()) { + $output = '
    + '.__('Defined and fired alerts').''.html_print_table($table_al, true).'
    '; + } else { + // Remove the defined alerts cause with the new cache table is difficult to retrieve them. + unset($table_al->data[0][0], $table_al->data[0][1]); + + $table_al->class = 'tactical_view'; + $table_al->style = []; + $output = '
    + '.__('Fired alerts').''.html_print_table($table_al, true).'
    '; + } + + return $output; +} + + +/** + * Return html count from stats modules by group. + * + * @param [type] $id_groups + * @param integer $graph_width + * @param integer $graph_height + * @param boolean $links + * @param boolean $data_agents + * @return void + */ +function groups_get_stats_modules_status($id_groups, $graph_width=250, $graph_height=150, $links=false, $data_agents=false) +{ + global $config; + + $data = [ + 'monitor_critical' => groups_get_critical_monitors($id_groups, [], [], false, false, false, false), + 'monitor_warning' => groups_get_warning_monitors($id_groups, [], [], false, false, false, false), + 'monitor_ok' => groups_get_normal_monitors($id_groups, [], [], false, false, false, false), + 'monitor_unknown' => groups_get_unknown_monitors($id_groups, [], [], false, false, false, false), + 'monitor_not_init' => groups_get_not_init_monitors($id_groups, [], [], false, false, false, false), + ]; + + // Link URLS. + if ($links === false) { + $urls = []; + $urls['monitor_critical'] = $config['homeurl'].'index.php?'.'sec=view&sec2=operation/agentes/status_monitor&'.'refr=60&status='.AGENT_MODULE_STATUS_CRITICAL_BAD.'&pure='.$config['pure'].'&recursion=1&ag_group='.$id_groups[0]; + $urls['monitor_warning'] = $config['homeurl'].'index.php?'.'sec=view&sec2=operation/agentes/status_monitor&'.'refr=60&status='.AGENT_MODULE_STATUS_WARNING.'&pure='.$config['pure'].'&recursion=1&ag_group='.$id_groups[0]; + $urls['monitor_ok'] = $config['homeurl'].'index.php?'.'sec=view&sec2=operation/agentes/status_monitor&'.'refr=60&status='.AGENT_MODULE_STATUS_NORMAL.'&pure='.$config['pure'].'&recursion=1&ag_group='.$id_groups[0]; + $urls['monitor_unknown'] = $config['homeurl'].'index.php?'.'sec=view&sec2=operation/agentes/status_monitor&'.'refr=60&status='.AGENT_MODULE_STATUS_UNKNOWN.'&pure='.$config['pure'].'&recursion=1&ag_group='.$id_groups[0]; + $urls['monitor_not_init'] = $config['homeurl'].'index.php?'.'sec=view&sec2=operation/agentes/status_monitor&'.'refr=60&status='.AGENT_MODULE_STATUS_NOT_INIT.'&pure='.$config['pure'].'&recursion=1&ag_group='.$id_groups[0]; + } else { + $urls = []; + $urls['monitor_critical'] = $links['monitor_critical']; + $urls['monitor_warning'] = $links['monitor_warning']; + $urls['monitor_ok'] = $links['monitor_ok']; + $urls['monitor_unknown'] = $links['monitor_unknown']; + $urls['monitor_not_init'] = $links['monitor_not_init']; + } + + // Fixed width non interactive charts + $status_chart_width = $graph_width; + + // Modules by status table + $table_mbs = html_get_predefined_table(); + + $tdata = []; + $tdata[0] = html_print_image('images/module_critical.png', true, ['title' => __('Monitor critical')], false, false, false, true); + $tdata[1] = $data['monitor_critical'] <= 0 ? '-' : $data['monitor_critical']; + $tdata[1] = ''.$tdata[1].''; + + $tdata[2] = html_print_image('images/module_warning.png', true, ['title' => __('Monitor warning')], false, false, false, true); + $tdata[3] = $data['monitor_warning'] <= 0 ? '-' : $data['monitor_warning']; + $tdata[3] = ''.$tdata[3].''; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + + $tdata = []; + $tdata[0] = html_print_image('images/module_ok.png', true, ['title' => __('Monitor normal')], false, false, false, true); + $tdata[1] = $data['monitor_ok'] <= 0 ? '-' : $data['monitor_ok']; + $tdata[1] = ''.$tdata[1].''; + + $tdata[2] = html_print_image('images/module_unknown.png', true, ['title' => __('Monitor unknown')], false, false, false, true); + $tdata[3] = $data['monitor_unknown'] <= 0 ? '-' : $data['monitor_unknown']; + $tdata[3] = ''.$tdata[3].''; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + + $tdata = []; + $tdata[0] = html_print_image('images/module_notinit.png', true, ['title' => __('Monitor not init')], false, false, false, true); + $tdata[1] = $data['monitor_not_init'] <= 0 ? '-' : $data['monitor_not_init']; + $tdata[1] = ''.$tdata[1].''; + + $tdata[2] = $tdata[3] = ''; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + + if ($data['monitor_checks'] > 0) { + $tdata = []; + $table_mbs->colspan[count($table_mbs->data)][0] = 4; + $table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;'; + $tdata[0] = '
    '.'
    '.graph_agent_status(false, $graph_width, $graph_height, true, true, $data_agents).'
    '; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + } + + if (!is_metaconsole()) { + $output = ' +
    + '.__('Monitors by status').''.html_print_table($table_mbs, true).'
    '; + } else { + $table_mbs->class = 'tactical_view'; + $table_mbs->style = []; + $output = ' +
    + '.__('Monitors by status').''.html_print_table($table_mbs, true).'
    '; + } + + return $output; +} \ No newline at end of file diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 693a14adb7..e9e60f3418 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1361,29 +1361,27 @@ function html_print_select_multiple_filtered( $output .= '
    '; - $output .= html_print_input( + $output .= html_print_image( + 'images/plus.svg', + true, [ - 'type' => 'image', - 'src' => 'images/darrowright.png', - 'return' => true, - 'options' => [ - 'title' => $texts['title-add'], - 'onclick' => $add, - 'class' => 'invert_filter', - ], + 'id' => 'right_autorefreshlist', + 'style' => 'width: 24px; margin: 10px 10px 0;', + 'alt' => __('Push selected pages into autorefresh list'), + 'title' => __('Push selected pages into autorefresh list'), + 'onclick' => $add, ] ); - $output .= html_print_input( + $output .= html_print_image( + 'images/minus.svg', + true, [ - 'type' => 'image', - 'src' => 'images/darrowleft.png', - 'return' => true, - 'options' => [ - 'title' => $texts['title-del'], - 'onclick' => $del, - 'class' => 'invert_filter', - ], + 'id' => 'left_autorefreshlist', + 'style' => 'width: 24px; margin: 10px 10px 0;', + 'alt' => __('Pop selected pages out of autorefresh list'), + 'title' => __('Pop selected pages out of autorefresh list'), + 'onclick' => $del, ] ); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 710bae4c82..ea3f7de46f 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7488,7 +7488,7 @@ function reporting_sql($report, $content) foreach ($results as $id_node => $items) { foreach ($items['result']['data'] as $key => $item) { - $items['result']['data'][$key] = ['node_id' => $id_node] + $items['result']['data'][$key]; + $items['result']['data'][$key] = (['node_id' => $id_node] + $items['result']['data'][$key]); } if ((int) $items['result']['correct'] !== 1) { @@ -7537,7 +7537,8 @@ function reporting_sql($report, $content) * * @return array */ -function reporting_sql_auxiliary($report, $content) { +function reporting_sql_auxiliary($report, $content) +{ if ($content['treport_custom_sql_id'] != 0) { $sql = io_safe_output( db_get_value_filter( diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index b43d6bba95..e86c728fa7 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -467,7 +467,7 @@ function treeview_printAlertsTable($id_module, $server_data=[], $no_head=false) __('Go to alerts edition'), 'upd_button', false, - 'window.location.assign(\''.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'\')', + 'window.location.assign("'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name='.$module_name.'&id_agente='.$agent_id.$url_hash.'")', ['icon' => 'alert'], true ), diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 1e4556965b..e30ea78923 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -693,7 +693,7 @@ function ui_print_tags_warning($return=false) * * @return string HTML code if return parameter is true. */ -function ui_print_group_icon($id_group, $return=false, $path='', $style='', $link=true, $force_show_image=false, $show_as_image=false, $class='') +function ui_print_group_icon($id_group, $return=false, $path='', $style='', $link=true, $force_show_image=false, $show_as_image=false, $class='', $tactical_view=false) { global $config; @@ -707,7 +707,11 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin } if ($link === true) { - $output = ''; + if ($tactical_view === true) { + $output = ''; + } else { + $output = ''; + } } if ((bool) $config['show_group_name'] === true) { @@ -904,11 +908,11 @@ function ui_print_type_agent_icon( if ((int) $id_os === SATELLITE_OS_ID) { // Satellite. $options['title'] = __('Satellite'); - $output = html_print_image('images/satellite@svg.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); + $output = html_print_image('images/satellite@os.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); } else if ($remote_contact === $contact && $remote === 0 && empty($version) === true) { // Network. $options['title'] = __('Network'); - $output = html_print_image('images/network-server@svg.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); + $output = html_print_image('images/network-server@os.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); } else { // Software. $options['title'] = __('Software'); @@ -1210,7 +1214,7 @@ function ui_format_alert_row( $forceTitle, 'force_execution_'.$alert['id'], false, - 'window.location.assign(\''.$url.'&id_alert='.$alert['id'].'&refr=60'.$additionUrl.'\');', + 'window.location.assign("'.$url.'&id_alert='.$alert['id'].'&refr=60'.$additionUrl.'");', [ 'mode' => 'link' ], true ); @@ -1496,6 +1500,7 @@ function ui_print_alert_template_example($id_alert_template, $return=false, $pri * @param string $image Image path. * @param boolean $is_relative Route is relative or not. * @param string $id Target id. + * @param string $isHeader If true, the view is header. * * @return string The help tip */ @@ -1505,10 +1510,17 @@ function ui_print_help_icon( $home_url='', $image='images/info@svg.svg', $is_relative=false, - $id='' + $id='', + $isHeader=false ) { global $config; + if (empty($image) === true) { + $image = 'images/info@svg.svg'; + } + + $iconClass = ($isHeader === true) ? 'header_help_icon' : 'main_menu_icon'; + // Do not display the help icon if help is disabled. if ((bool) $config['disable_help'] === true) { return ''; @@ -1533,7 +1545,7 @@ function ui_print_help_icon( $image, true, [ - 'class' => 'img_help main_menu_icon', + 'class' => 'img_help '.$iconClass, 'title' => __('Help'), 'onclick' => "open_help ('".ui_get_full_url($help_handler)."')", 'id' => $id, @@ -5053,7 +5065,7 @@ function ui_print_page_header( if (is_metaconsole() === false) { if ($help != '') { - $buffer .= "
    ".ui_print_help_icon($help, true, '', 'images/help_g.png').'
    '; + $buffer .= "
    ".ui_print_help_icon($help, true, '', '', false, '', true).'
    '; } } @@ -7154,7 +7166,7 @@ function ui_print_servertype_icon(int $id) case MODULE_NETWORK: $title = __('Network server'); - $image = 'images/network-server@svg.svg'; + $image = 'images/network-server@os.svg'; break; case MODULE_PLUGIN: diff --git a/pandora_console/include/javascript/tactical_groups.js b/pandora_console/include/javascript/tactical_groups.js new file mode 100644 index 0000000000..08bca2f02e --- /dev/null +++ b/pandora_console/include/javascript/tactical_groups.js @@ -0,0 +1,18 @@ +/* global $, load_modal */ +function showInfoAgent(id_agent) { + load_modal({ + target: $("#modal-info-agent"), + url: "ajax.php", + modal: { + title: "Info agent", + cancel: "close" + }, + onshow: { + page: "include/ajax/group", + method: "loadInfoAgent", + extradata: { + idAgent: id_agent + } + } + }); +} diff --git a/pandora_console/include/lib/Group.php b/pandora_console/include/lib/Group.php index 1f34f941fd..9e386d8dd0 100644 --- a/pandora_console/include/lib/Group.php +++ b/pandora_console/include/lib/Group.php @@ -43,7 +43,13 @@ class Group extends Entity * * @var array */ - private static $ajaxMethods = ['getGroupsForSelect']; + private static $ajaxMethods = [ + 'getGroupsForSelect', + 'distributionBySoGraph', + 'groupEventsByAgent', + 'loadInfoAgent', + 'getAgentsByGroup', + ]; /** @@ -473,4 +479,271 @@ class Group extends Entity } + /** + * Draw a graph distribution so by group. + * + * @return void + */ + public static function distributionBySoGraph() + { + global $config; + $id_group = get_parameter('id_group', ''); + include_once $config['homedir'].'/include/functions_graph.php'; + + $out = '
    '; + $out .= graph_so_by_group($id_group, 300, 200, false, false); + $out .= '
    '; + echo $out; + return; + } + + + /** + * Draw a graph events agent by group. + * + * @return void + */ + public static function groupEventsByAgent() + { + global $config; + $id_group = get_parameter('id_group', ''); + include_once $config['homedir'].'/include/functions_graph.php'; + + $out = '
    '; + $out .= graph_events_agent_by_group($id_group, 300, 200, false, true, true); + $out .= '
    '; + echo $out; + return; + } + + + /** + * Draw in modal a agent info + * + * @return void + */ + public static function loadInfoAgent() + { + $extradata = get_parameter('extradata', ''); + echo '
    '; + + if (empty($extradata) === false) { + $extradata = json_decode(io_safe_output($extradata), true); + $agent = agents_get_agent($extradata['idAgent']); + + if (is_array($agent)) { + $status_img = agents_tree_view_status_img( + $agent['critical_count'], + $agent['warning_count'], + $agent['unknown_count'], + $agent['total_count'], + $agent['notinit_count'] + ); + $table = new \stdClass(); + $table->class = 'table_modal_alternate'; + $table->data = [ + [ + __('Id'), + $agent['id_agente'], + ], + [ + __('Agent name'), + ''.$agent['nombre'].'', + ], + [ + __('Alias'), + $agent['alias'], + ], + [ + __('Ip Address'), + $agent['direccion'], + ], + [ + __('Status'), + $status_img, + ], + [ + __('Group'), + groups_get_name($agent['id_grupo']), + ], + [ + __('Interval'), + $agent['intervalo'], + ], + [ + __('Operative system'), + get_os_name($agent['id_os']), + ], + [ + __('Server name'), + $agent['server_name'], + ], + [ + __('Description'), + $agent['comentarios'], + ], + ]; + + html_print_table($table); + } + } + + echo '
    '; + } + + + /** + * Get agents by group for datatable. + * + * @return void + */ + public static function getAgentsByGroup() + { + global $config; + + $data = []; + $id_group = get_parameter('id_group', ''); + $id_groups = [$id_group]; + $groups = groups_get_children($id_group); + + if (count($groups) > 0) { + $id_groups = []; + foreach ($groups as $key => $value) { + $id_groups[] = $value['id_grupo']; + } + } + + $start = get_parameter('start', 0); + $length = get_parameter('length', $config['block_size']); + $orderDatatable = get_datatable_order(true); + $pagination = ''; + $order = ''; + + try { + ob_start(); + if (isset($orderDatatable)) { + switch ($orderDatatable['field']) { + case 'alerts': + $orderDatatable['field'] = 'fired_count'; + break; + + case 'status': + $orderDatatable['field'] = 'total_count'; + + default: + $orderDatatable['field'] = $orderDatatable['field']; + break; + } + + $order = sprintf( + ' ORDER BY %s %s', + $orderDatatable['field'], + $orderDatatable['direction'] + ); + } + + if (isset($length) && $length > 0 + && isset($start) && $start >= 0 + ) { + $pagination = sprintf( + ' LIMIT %d OFFSET %d ', + $length, + $start + ); + } + + $sql = sprintf( + 'SELECT id_agente, + alias, + critical_count, + warning_count, + unknown_count, + total_count, + notinit_count, + ultimo_contacto_remoto, + fired_count + FROM tagente t + WHERE disabled = 0 AND + total_count <> notinit_count AND + id_grupo IN (%s) + %s %s', + implode(',', $id_groups), + $order, + $pagination + ); + + $data = db_get_all_rows_sql($sql); + + $sql = sprintf( + 'SELECT + id_agente, + alias, + critical_count, + warning_count, + unknown_count, + total_count, + notinit_count, + ultimo_contacto_remoto, + fired_count + FROM tagente t + WHERE disabled = 0 AND + total_count <> notinit_count AND + id_grupo IN (%s) + %s', + implode(',', $id_groups), + $order, + ); + + $count_agents = db_get_num_rows($sql); + + foreach ($data as $key => $agent) { + $status_img = agents_tree_view_status_img( + $agent['critical_count'], + $agent['warning_count'], + $agent['unknown_count'], + $agent['total_count'], + $agent['notinit_count'] + ); + $data[$key]['alias'] = ''.$agent['alias'].''; + $data[$key]['status'] = $status_img; + $data[$key]['alerts'] = agents_tree_view_alert_img($agent['fired_count']); + } + + if (empty($data) === true) { + $total = 0; + $data = []; + } else { + $total = $count_agents; + } + + echo json_encode( + [ + 'data' => $data, + 'recordsTotal' => $total, + 'recordsFiltered' => $total, + ] + ); + // Capture output. + $response = ob_get_clean(); + } catch (\Exception $e) { + echo json_encode(['error' => $e->getMessage()]); + exit; + } + + json_decode($response); + if (json_last_error() === JSON_ERROR_NONE) { + echo $response; + } else { + echo json_encode( + [ + 'success' => false, + 'error' => $response, + ] + ); + } + + exit; + } + + } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index d819230098..63ad0d2e52 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -647,6 +647,10 @@ select:-internal-list-box { width: 20%; } +.w21p { + width: 21%; +} + .w22p { width: 22%; } @@ -5811,10 +5815,10 @@ div.label_select_child_left > span { overflow: hidden; } -.switch_radio_button label { +div.switch_radio_button label { background-color: #fff; color: rgba(0, 0, 0, 0.6); - line-height: 9pt; + line-height: 6px !important; text-align: center; padding: 14px 10px; margin-right: -1px; @@ -5822,14 +5826,14 @@ div.label_select_child_left > span { transition: all 0.1s ease-in-out; } -.switch_radio_button label:first { - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; +div.switch_radio_button label:first-of-type { + border-top-left-radius: 4px !important; + border-bottom-left-radius: 4px !important; } -.switch_radio_button label:last-child { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; +div.switch_radio_button label:last-of-type { + border-top-right-radius: 4px !important; + border-bottom-right-radius: 4px !important; margin-right: 0px; } @@ -11014,14 +11018,14 @@ pre.external_tools_output { .tag-editor .tag-editor-tag { padding: 5px !important; color: #fff !important; - background: #82b92e !important; + background: var(--primary-color) !important; border-radius: 0 2px 2px 0 !important; } .tag-editor .tag-editor-delete { padding: 5px !important; line-height: 16px !important; - background: #82b92e !important; + background: var(--primary-color) !important; border-radius: 2px 0 0 2px !important; } @@ -11195,6 +11199,10 @@ table.table_modal_alternate height: 20px; } +.header_help_icon { + width: 16px; + height: 16px; +} .main_menu_icon.arrow_up { transform: rotate(90deg); } @@ -11509,6 +11517,15 @@ div[role="dialog"] { /* font-weight: bold; */ } +.font-title-font { + font-size: 13px; + line-height: 16px; + color: #161628; + text-align: left; + margin-bottom: 10px; + font-weight: bold; +} + .preimage_container span { font-size: 11pt; line-height: 28px; @@ -11545,6 +11562,20 @@ table.alert-template-fields > tbody > tr > td[id^="template-label_fields"] { text-align: center; } +ul.tag-editor { + list-style-type: none; + padding: 0.5em !important; + margin: 0; + overflow: hidden; + border: 2px solid #c0ccdc; + border-radius: 6px; + cursor: text; + font: normal 14px sans-serif; + color: #333333; + background: #f6f7fb; + line-height: 20px; +} + .max-width-100p { max-width: 100% !important; } diff --git a/pandora_console/include/styles/tactical_groups.css b/pandora_console/include/styles/tactical_groups.css new file mode 100644 index 0000000000..383e9ef37f --- /dev/null +++ b/pandora_console/include/styles/tactical_groups.css @@ -0,0 +1,31 @@ +.tactical_group_left_column { + vertical-align: top; + min-width: 30em; + width: 30%; + padding-top: 0px; +} +.tactical_group_right_column { + width: 40%; + vertical-align: top; + min-width: 30em; + padding-top: 0px; +} +rect { + cursor: pointer; +} +.info-agent { + width: 100%; + max-height: 400px; +} +.info-agent table { + width: 100%; +} +#modal-info-agent { + display: none; +} +#list_agents_tactical_wrapper { + max-height: 600px; +} +.graph-distribution-so { + margin-top: 55px; +} diff --git a/pandora_console/include/styles/wizard.css b/pandora_console/include/styles/wizard.css index 92d40ccc33..c7c37a8143 100644 --- a/pandora_console/include/styles/wizard.css +++ b/pandora_console/include/styles/wizard.css @@ -129,6 +129,12 @@ ul.wizard li > textarea { background: #e63c52; } +.wizard .tag-editor li, +.wizard .tag-editor li:focus, +.wizard .tag-editor li:hover { + border: 0; + padding: 0; +} .wizard .time_selection_container { display: flex; align-items: baseline; diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 3e5584fe42..8aaa7ed60a 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -106,7 +106,12 @@ $agentIconGroup = ((bool) $config['show_group_name'] === false) ? ui_print_group $agent['id_grupo'], true, '', - 'padding-right: 6px;' + 'padding-right: 6px;', + true, + false, + false, + '', + true ) : ''; $agentIconStatus = agents_detail_view_status_img( @@ -396,7 +401,7 @@ $buttonsRefreshAgent = html_print_button( __('Refresh data'), 'refresh_data', false, - 'window.location.assign(\'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60\')', + 'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60")', [ 'mode' => 'link' ], true ); @@ -406,7 +411,7 @@ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) { __('Force checks'), 'force_checks', false, - 'window.location.assign(\'index.php?sec=estado&sec2=operation/agentes/ver_agente&flag_agent=1&id_agente='.$id_agente.'\')', + 'window.location.assign("index.php?sec=estado&sec2=operation/agentes/ver_agente&flag_agent=1&id_agente='.$id_agente.'")', [ 'mode' => 'link' ], true ); @@ -488,7 +493,7 @@ $data = []; $data[0] = ''.__('Group').''; $data[1] = html_print_anchor( [ - 'href' => 'index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$agent['id_grupo'], + 'href' => 'index.php?sec=gagente&sec2=godmode/groups/tactical&id_group='.$agent['id_grupo'], 'content' => groups_get_name($agent['id_grupo']), ], true diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index 5c3ce7a73b..26e16c7f37 100755 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -226,77 +226,52 @@ ui_print_standard_header( // ------------------- END HEADER --------------------------------------- // ------------------------ INIT FORM ----------------------------------- -$table = new stdClass(); -$table->id = 'controls_table'; -$table->width = '100%'; -$table->class = 'filter-table-adv'; +$table2 = new stdClass(); +$table2->id = 'controls_table'; +$table2->size[2] = '50%'; +$table2->size[3] = '50%'; +$table2->style[0] = 'text-align:center'; +$table2->style[1] = 'text-align:center'; +$table2->styleTable = 'border:none'; + if (defined('METACONSOLE')) { - $table->width = '100%'; - $table->class = 'databox filters'; + $table2->width = '100%'; + $table2->class = 'databox filters'; - $table->head[0] = __('View Report'); - $table->head_colspan[0] = 5; - $table->headstyle[0] = 'text-align: center'; + $table2->head[0] = __('View Report'); + $table2->head_colspan[0] = 5; + $table2->headstyle[0] = 'text-align: center'; } -$table->style = []; -$table->style[0] = 'vertical-align: middle'; -$table->rowspan[0][0] = 2; - // Set initial conditions for these controls, later will be modified by javascript if (!$enable_init_date) { - $table->style[1] = 'display: none'; - $table->style[2] = 'display: flex;align-items: baseline;'; $display_to = 'none'; $display_item = ''; } else { - $table->style[1] = 'display: "block"'; - $table->style[2] = 'display: flex;align-items: baseline;'; $display_to = ''; $display_item = 'none'; } -$table->size = []; -$table->colspan[0][1] = 2; -$table->data = []; -$table->data[0][0] = html_print_image( - 'images/reporting32.png', - true, - [ - 'width' => '32', - 'height' => '32', - ] -); - -if (reporting_get_description($id_report)) { - $table->data[0][1] = '
    '.reporting_get_description($id_report).'
    '; -} else { - $table->data[0][1] = '
    '.reporting_get_name($id_report).'
    '; -} - -$table->data[0][1] .= '
    '.__('Set initial date').html_print_checkbox('enable_init_date', 1, $enable_init_date, true).'
    '; - $html_menu_export = enterprise_hook('reporting_print_button_export'); if ($html_menu_export === ENTERPRISE_NOT_HOOK) { $html_menu_export = ''; } -$table->data[0][1] .= '
    '; -$table->data[0][1] .= $html_menu_export; +$table2->data[0][2] = '
    '.__('Set initial date').'
    '.html_print_checkbox_switch('enable_init_date', 1, $enable_init_date, true).'

    '; +$table2->data[0][2] .= '
    '.__('From').':
    '; +$table2->data[0][2] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; +$table2->data[0][2] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; +$table2->data[0][2] .= '
    '.__('Items period before').':
    '; +$table2->data[0][2] .= '
    '.__('to').':
    '; +$table2->data[0][2] .= html_print_input_text('date', $date, '', 12, 10, true).' '; +$table2->data[0][2] .= html_print_input_text('time', $time, '', 10, 7, true).' '; +$table2->data[0][3] = $html_menu_export; -$table->data[1][1] = '
    '.__('From').':
    '; -$table->data[1][1] .= html_print_input_text('date_init', $date_init, '', 12, 10, true).' '; -$table->data[1][1] .= html_print_input_text('time_init', $time_init, '', 10, 7, true).' '; -$table->data[1][2] = '
    '.__('Items period before').':
    '; -$table->data[1][2] .= '
    '.__('to').':
    '; -$table->data[1][2] .= html_print_input_text('date', $date, '', 12, 10, true).' '; -$table->data[1][2] .= html_print_input_text('time', $time, '', 10, 7, true).' '; - $searchForm = '
    '; -$searchForm .= html_print_table($table, true); +$searchForm .= html_print_table($table2, true); $searchForm .= html_print_input_hidden('id_report', $id_report, true); $Actionbuttons .= html_print_submit_button( @@ -354,10 +329,6 @@ for ($i = 0; $i < count($report['contents']); $i++) { reporting_html_print_report($report, false, $config['custom_report_info']); -// ---------------------------------------------------------------------- -// The rowspan of the first row is only 2 in controls table. Why is used the same code here and in the items?? -$table->rowspan[0][0] = 1; - echo '
    '; echo html_print_image('images/wait.gif', true, ['border' => '0']); echo ''.__('Loading').'...'; @@ -387,16 +358,15 @@ $(document).ready (function () { secondText: '', currentText: '', closeText: ''}); - + $.datepicker.setDefaults($.datepicker.regional[ ""]); - + $("#text-date").datepicker({ dateFormat: "", changeMonth: true, changeYear: true, showAnim: "slideDown"}); - - + $('[id^=text-time_init]').timepicker({ showSecond: true, timeFormat: '', @@ -407,29 +377,23 @@ $(document).ready (function () { secondText: '', currentText: '', closeText: ''}); - + $('[id^=text-date_init]').datepicker ({ dateFormat: "", changeMonth: true, changeYear: true, showAnim: "slideDown"}); - - - $("*", "#controls_table-0").css("display", ""); //Re-show the first row of form. - + /* Show/hide begin date reports controls */ $("#checkbox-enable_init_date").click(function() { flag = $("#checkbox-enable_init_date").is(':checked'); if (flag == true) { - $("#controls_table-1-1").css("display", ""); - $("#controls_table-1-2").css("display", ""); $("#string_to").show(); + $('#string_from').show(); $("#string_items").hide(); - } - else { - $("#controls_table-1-1").css("display", "none"); - $("#controls_table-1-2").css("display", ""); + } else { $("#string_to").hide(); + $('#string_from').hide(); $("#string_items").show(); } }); From 1ba420a9ce1a8ebf9d657875efecd136a24a50bc Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 7 Mar 2023 16:22:13 +0100 Subject: [PATCH 19/42] fixed styles --- pandora_console/include/javascript/pandora.js | 7 +++++++ pandora_console/index.php | 15 --------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 30da9745eb..8bfdee500c 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -2400,3 +2400,10 @@ function topFunction() { 500 ); } + +function menuActionButtonResizing() { + $(".action_buttons_right_content").attr( + "style", + "left: " + $("#menu_full").width() + "px;" + ); +} diff --git a/pandora_console/index.php b/pandora_console/index.php index 78de0734b4..a78d97d926 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1524,17 +1524,6 @@ require 'include/php_to_js_values.php'; } } - //$('.button_collapse').on('click', menuActionButtonResizing()); - - // Cursor change for show a spinner. Experimental. - /* - $('.buttonButton').not('.dialog_opener').on('click', function(){ - $('*').css('cursor', 'wait'); - }); - $('.submitButton').not('.dialog_opener').on('click', function(){ - $('*').css('cursor', 'wait'); - }); -*/ // When the user scrolls down 400px from the top of the document, show the // button. window.onscroll = function() { @@ -1545,10 +1534,6 @@ require 'include/php_to_js_values.php'; scrollFunction() }; - function menuActionButtonResizing() { - $('.action_buttons_right_content').attr('style', 'left: '+($('#menu_full').width())+'px;'); - } - function first_time_identification() { jQuery.post("ajax.php", { "page": "general/register", From 2dbc2e801f210e1b7f224add470c5cf2565265dd Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 17:24:36 +0100 Subject: [PATCH 20/42] Minor icon fixes --- .../godmode/reporting/reporting_builder.php | 4 ++-- pandora_console/godmode/servers/plugin.php | 18 ++++++++++++----- .../include/class/SnmpConsole.class.php | 20 +++++++++---------- .../include/functions_filemanager.php | 11 +++++----- pandora_console/include/styles/tables.css | 6 ++++-- .../operation/snmpconsole/snmp_browser.php | 8 ++++---- .../operation/snmpconsole/snmp_statistics.php | 16 +++++++-------- .../operation/snmpconsole/snmp_view.php | 2 +- 8 files changed, 47 insertions(+), 38 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 9fd9c02f7e..12d5266f34 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -509,11 +509,11 @@ switch ($action) { 'list_reports' => [ 'active' => false, 'text' => ''.html_print_image( - 'images/report_list.png', + 'images/logs@svg.svg', true, [ 'title' => __('Reports list'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ], diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 43fad7d3be..688e898c9d 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -632,7 +632,7 @@ if (empty($create) === false || empty($view) === false) { $delete_macro_style = 'display:none;'; } - $datam[2] = ''; + $datam[2] = ''; $table->colspan['plugin_action'][0] = 2; $table->colspan['plugin_action'][2] = 2; @@ -665,8 +665,10 @@ if (empty($create) === false || empty($view) === false) { echo ''; - if ($create != '') { - $button = html_print_submit_button( + $buttons = ''; + + if (empty($create) === false) { + $buttons .= html_print_submit_button( __('Create'), 'crtbutton', false, @@ -674,7 +676,7 @@ if (empty($create) === false || empty($view) === false) { true ); } else { - $button = html_print_submit_button( + $buttons .= html_print_submit_button( __('Update'), 'uptbutton', false, @@ -683,8 +685,14 @@ if (empty($create) === false || empty($view) === false) { ); } + $buttons .= html_print_go_back_button( + 'index.php?sec=gservers&sec2=godmode/servers/plugin', + ['button_class' => ''], + true + ); + html_print_action_buttons( - $button + $buttons ); echo ''; diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php index c84775d4ed..5999479c64 100644 --- a/pandora_console/include/class/SnmpConsole.class.php +++ b/pandora_console/include/class/SnmpConsole.class.php @@ -183,29 +183,29 @@ class SnmpConsole extends HTML if (!isset($config['pure']) || $config['pure'] === false) { $statistics['text'] = ''.html_print_image( - 'images/op_reporting.png', + 'images/logs@svg.svg', true, [ 'title' => __('Statistics'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; $list['text'] = ''.html_print_image( - 'images/op_snmp.png', + 'images/SNMP-network-numeric-data@svg.svg', true, [ 'title' => __('List'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; $list['active'] = true; $screen['text'] = ''.html_print_image( - 'images/full_screen.png', + 'images/fullscreen@svg.svg', true, [ - 'title' => __('List'), - 'class' => 'invert_filter', + 'title' => __('View in full screen'), + 'class' => 'main_menu_icon invert_filter', ] ).''; @@ -242,11 +242,11 @@ class SnmpConsole extends HTML echo ''; echo html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Exit fullscreen'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); echo ''; @@ -844,7 +844,7 @@ class SnmpConsole extends HTML $tmp->snmp_agent .= ''.$tmp->source.''; } else { $tmp->snmp_agent .= ''; } diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 1f1f57c832..0012804398 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -744,8 +744,7 @@ function filemanager_file_explorer( // Actions buttons // Delete button. - $data[4] = ''; - $data[4] .= ''; + $data[4] = '
    '; $typefile = array_pop(explode('.', $fileinfo['name'])); if (is_writable($fileinfo['realpath']) === true && (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3) @@ -774,7 +773,7 @@ function filemanager_file_explorer( && ($typefile !== 'iso') && ($typefile !== 'docx') && ($typefile !== 'doc') && ($fileinfo['mime'] != MIME_DIR) ) { $hash = md5($fileinfo['realpath'].$config['server_unique_identifier']); - $data[4] .= "".html_print_image('images/edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Edit file'), 'class' => 'invert_filter']).''; + $data[4] .= "".html_print_image('images/edit.svg', true, ['style' => 'margin-top: 2px;', 'title' => __('Edit file'), 'class' => 'main_menu_icon invert_filter']).''; } } } @@ -794,7 +793,7 @@ function filemanager_file_explorer( $data[4] .= ''.html_print_image('images/enable.svg', true, ['style' => 'margin-top: 2px;', 'title' => __('Real path'), 'class' => 'invert_filter main_menu_icon']).''; } - $data[4] .= ''; + $data[4] .= '
    '; array_push($table->data, $data); } @@ -983,7 +982,7 @@ function filemanager_file_explorer(
    "; if (isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'on' || $_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '127.0.0.1') { - $modal_real_path .= "
    ".html_print_submit_button(__('Copy'), 'submit', false, 'class="sub next"', true).'
    '; + $modal_real_path .= "
    ".html_print_submit_button(__('Copy'), 'submit', false, ['icon' => 'wand', 'mode' => 'mini'], true).'
    '; } html_print_div( @@ -997,7 +996,7 @@ function filemanager_file_explorer( echo '
    '; } else { echo "
    "; - echo "".__('The directory is read-only'); + echo "".__('The directory is read-only'); echo '
    '; } } diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 7fbf593d16..4383e02ea5 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -235,7 +235,8 @@ .table_action_buttons > a, .table_action_buttons > img, -.table_action_buttons > button { +.table_action_buttons > button, +.table_action_buttons > form { visibility: hidden; } .info_table > tbody > tr:hover { @@ -246,7 +247,8 @@ .info_table > tbody > tr:hover .table_action_buttons > a, .info_table > tbody > tr:hover .table_action_buttons > img, -.info_table > tbody > tr:hover .table_action_buttons > button { +.info_table > tbody > tr:hover .table_action_buttons > button, +.info_table > tbody > tr:hover .table_action_buttons > form { visibility: visible; } diff --git a/pandora_console/operation/snmpconsole/snmp_browser.php b/pandora_console/operation/snmpconsole/snmp_browser.php index 3bcb2be975..9831d7ba64 100644 --- a/pandora_console/operation/snmpconsole/snmp_browser.php +++ b/pandora_console/operation/snmpconsole/snmp_browser.php @@ -50,11 +50,11 @@ if ($config['pure']) { // Windowed. $link['text'] = ''; $link['text'] .= html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Normal screen'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $link['text'] .= ''; @@ -62,11 +62,11 @@ if ($config['pure']) { // Fullscreen. $link['text'] = ''; $link['text'] .= html_print_image( - 'images/full_screen.png', + 'images/fullscreen@svg.svg', true, [ 'title' => __('Full screen'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $link['text'] .= ''; diff --git a/pandora_console/operation/snmpconsole/snmp_statistics.php b/pandora_console/operation/snmpconsole/snmp_statistics.php index 56109aa04c..0ebc548496 100755 --- a/pandora_console/operation/snmpconsole/snmp_statistics.php +++ b/pandora_console/operation/snmpconsole/snmp_statistics.php @@ -39,20 +39,20 @@ $refr = (int) get_parameter('refr', 0); $fullscreen = []; if ($config['pure']) { $fullscreen['text'] = ''.html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Normal screen'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; } else { $fullscreen['text'] = ''.html_print_image( - 'images/full_screen.png', + 'images/fullscreen@svg.svg', true, [ 'title' => __('Full screen'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; } @@ -60,11 +60,11 @@ if ($config['pure']) { // List $list = []; $list['text'] = ''.html_print_image( - 'images/op_snmp.png', + 'images/SNMP-network-numeric-data@svg.svg', true, [ 'title' => __('List'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; @@ -72,11 +72,11 @@ $list['text'] = ''.html_print_image( - 'images/op_reporting.png', + 'images/logs@svg.svg', true, [ 'title' => __('Statistics'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).''; diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 9f0f9e44f8..f5c967972c 100755 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License From b13892ecdbb2bd3e59700f31de1243ea6e8c1e66 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 17:37:01 +0100 Subject: [PATCH 21/42] Users connected view --- .../extensions/users_connected.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 40b17f4903..21c319065b 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -34,7 +34,24 @@ function users_extension_main_god($god=true) } // Header. - ui_print_page_header(__('Users connected'), $image, false, '', $god); + ui_print_standard_header( + __('List of users connected'), + $image, + false, + '', + $god, + [], + [ + [ + 'link' => '', + 'label' => __('Workspace'), + ], + [ + 'link' => '', + 'label' => __('Users connected'), + ], + ] + ); $check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up'); if ($check_profile === false && !users_is_admin()) { From 651469b562b4bf271a6406b303433fb79eb35b20 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 17:37:33 +0100 Subject: [PATCH 22/42] Users connected view --- .../extensions/users_connected.php | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 21c319065b..ad6282c598 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -1,16 +1,33 @@ Date: Tue, 7 Mar 2023 17:50:03 +0100 Subject: [PATCH 23/42] User edit notifications --- pandora_console/operation/users/user_edit_header.php | 12 ++++++------ .../operation/users/user_edit_notifications.php | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pandora_console/operation/users/user_edit_header.php b/pandora_console/operation/users/user_edit_header.php index ea698e1355..50cb5c52fc 100644 --- a/pandora_console/operation/users/user_edit_header.php +++ b/pandora_console/operation/users/user_edit_header.php @@ -77,28 +77,28 @@ if (is_metaconsole()) { user_meta_print_header(); $urls['main'] = 'index.php?sec=advanced&sec2=advanced/users_setup&tab=user_edit'; } else { - $urls['main'] = 'index.php?sec=workspace&sec2=operation/users/user_edit'; + $urls['main'] = 'index.php?sec=gusuarios&sec2=godmode/users/user_list'; $urls['notifications'] = 'index.php?sec=workspace&sec2=operation/users/user_edit_notifications'; $buttons = [ 'main' => [ - 'active' => $_GET['sec2'] === 'operation/users/user_edit', + 'active' => $_GET['sec2'] === 'godmode/users/user_list&tab=user&pure=0', 'text' => "".html_print_image( - 'images/user.png', + 'images/user.svg', true, [ 'title' => __('User management'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ], 'notifications' => [ 'active' => $_GET['sec2'] === 'operation/users/user_edit_notifications', 'text' => "".html_print_image( - 'images/alerts_template.png', + 'images/alert@svg.svg', true, [ 'title' => __('User notifications'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ], diff --git a/pandora_console/operation/users/user_edit_notifications.php b/pandora_console/operation/users/user_edit_notifications.php index 4228c16543..e511eb0b92 100644 --- a/pandora_console/operation/users/user_edit_notifications.php +++ b/pandora_console/operation/users/user_edit_notifications.php @@ -15,7 +15,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -58,7 +58,7 @@ if (get_parameter('change_label', 0)) { } -echo '
    +echo '
    '.__('Enable').'
    @@ -91,8 +91,9 @@ foreach ($sources as $source) { } if ((bool) $disabled_flag === true) { - $s = __('Controls have been disabled by the system administrator'); - echo ''.$s.''; + ui_print_warning_message( + __('Controls have been disabled by the system administrator') + ); } echo '
    '; From 4af67db415e2528ced9ab3bb6e1cf41726f102f2 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 18:10:07 +0100 Subject: [PATCH 24/42] Export data view --- .../operation/agentes/exportdata.php | 312 +++++++++++------- 1 file changed, 185 insertions(+), 127 deletions(-) diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index 604131d888..910a46acb2 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -1,10 +1,10 @@ '', + 'label' => __('Tools'), + ], + [ + 'link' => '', + 'label' => __('Export data'), + ], + ] +); $group = get_parameter_post('group', 0); $agentName = get_parameter_post('agent', 0); @@ -220,48 +242,10 @@ if (!empty($export_btn) && !empty($module)) { } if (empty($export_btn) || $show_form) { - echo '
    '; - - $table = new stdClass(); - $table->width = '100%'; - $table->border = 0; - $table->cellspacing = 3; - $table->cellpadding = 5; - $table->class = 'databox filters'; - $table->style[0] = 'vertical-align: top;'; - - $table->data = []; - - // Group selector - $table->data[0][0] = ''.__('Group').''; - $groups = users_get_groups($config['id_user'], 'RR', users_can_manage_group_all()); - $table->data[0][1] = '
    '.html_print_select_groups( - $config['id_user'], - 'RR', - true, - 'group', - $group, - '', - '', - 0, - true, - false, - true, - '', - false - ).'
    '; - - // Agent selector. - $table->data[1][0] = ''.__('Source agent').''; - $filter = []; - if ($group > 0) { - $filter['id_grupo'] = (array) $group; - } else { - $filter['id_grupo'] = array_keys($groups); - } + $filter['id_grupo'] = ($group > 0) ? (array) $group : array_keys($groups); $agents = []; $rows = agents_get_agents($filter, false, 'RR'); @@ -286,11 +270,6 @@ if (empty($export_btn) || $show_form) { $params['add_none_module'] = false; $params['size'] = 38; $params['selectbox_id'] = 'module_arr'; - $table->data[1][1] = ui_print_agent_autocomplete_input($params); - - // Module selector. - $table->data[2][0] = ''.__('Modules').''; - $table->data[2][0] .= ui_print_help_tip(__('No modules of type string. You can not calculate their average'), true); if ($agent > 0) { $modules = agents_get_modules($agent); @@ -325,91 +304,170 @@ if (empty($export_btn) || $show_form) { $disabled_export_button = true; } - $table->data[2][1] = html_print_select($modules, 'module_arr[]', array_keys($modules), '', '', 0, true, true, true, 'w250px', false); - - // Start date selector. - $table->data[3][0] = ''.__('Begin date').''; - - $table->data[3][1] = html_print_input_text( - 'start_date', - date('Y-m-d', (get_system_time() - SECONDS_1DAY)), - false, - 13, - 10, - true - ); - $table->data[3][1] .= html_print_image( - 'images/calendar_view_day.png', - true, - [ - 'alt' => 'calendar', - 'onclick' => "scwShow(scwID('text-start_date'),this);", - 'class' => 'invert_filter', - ] - ); - $table->data[3][1] .= html_print_input_text( - 'start_time', - date('H:i:s', (get_system_time() - SECONDS_1DAY)), - false, - 10, - 9, - true - ); - - // End date selector. - $table->data[4][0] = ''.__('End date').''; - $table->data[4][1] = html_print_input_text( - 'end_date', - date('Y-m-d', get_system_time()), - false, - 13, - 10, - true - ); - $table->data[4][1] .= html_print_image( - 'images/calendar_view_day.png', - true, - [ - 'alt' => 'calendar', - 'onclick' => "scwShow(scwID('text-end_date'),this);", - 'class' => 'invert_filter', - ] - ); - $table->data[4][1] .= html_print_input_text( - 'end_time', - date('H:i:s', get_system_time()), - false, - 10, - 9, - true - ); - - // Export type. - $table->data[5][0] = ''.__('Export type').''; - $export_types = []; $export_types['data'] = __('Data table'); $export_types['csv'] = __('CSV'); $export_types['excel'] = __('MS Excel'); $export_types['avg'] = __('Average per hour/day'); - $table->data[5][1] = html_print_select($export_types, 'export_type', $export_type, '', '', 0, true, false, true, 'w250px', false); + + echo ''; + + $table = new stdClass(); + $table->width = '100%'; + $table->border = 0; + $table->cellspacing = 3; + $table->cellpadding = 5; + $table->class = 'databox filter-table-adv'; + $table->style[0] = 'vertical-align: top;'; + + $table->data = []; + + // Group selector. + $table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + $config['id_user'], + 'RR', + true, + 'group', + $group, + '', + '', + 0, + true, + false, + true, + '', + false + ) + ); + + // Agent selector. + $table->data[0][] = html_print_label_input_block( + __('Source agent'), + ui_print_agent_autocomplete_input($params) + ); + + // Module selector. + $table->data[1][] = html_print_label_input_block( + __('Modules'), + html_print_select( + $modules, + 'module_arr[]', + array_keys($modules), + '', + '', + 0, + true, + true, + true, + 'w100p', + false + ).ui_print_input_placeholder( + __('No modules of type string. You can not calculate their average'), + true + ) + ); + + // Export type. + $table->data[1][] = html_print_label_input_block( + __('Export type'), + html_print_select( + $export_types, + 'export_type', + $export_type, + '', + '', + 0, + true, + false, + true, + 'w100p', + false + ) + ); + + // Start date selector. + $table->data[2][] = html_print_label_input_block( + __('Begin date'), + html_print_div( + [ + 'class' => 'flex-content', + 'content' => html_print_input_text( + 'start_date', + date('Y-m-d', (get_system_time() - SECONDS_1DAY)), + false, + 13, + 10, + true + ).html_print_image( + 'images/calendar_view_day.png', + true, + [ + 'alt' => 'calendar', + 'onclick' => "scwShow(scwID('text-start_date'),this);", + 'class' => 'main_menu_icon invert_filter', + ] + ).html_print_input_text( + 'start_time', + date('H:i:s', (get_system_time() - SECONDS_1DAY)), + false, + 10, + 9, + true + ), + ], + true + ) + ); + + // End date selector. + $table->data[2][] = html_print_label_input_block( + __('End date'), + html_print_div( + [ + 'class' => 'flex-content', + 'content' => html_print_input_text( + 'end_date', + date('Y-m-d', get_system_time()), + false, + 13, + 10, + true + ).html_print_image( + 'images/calendar_view_day.png', + true, + [ + 'alt' => 'calendar', + 'onclick' => "scwShow(scwID('text-end_date'),this);", + 'class' => 'main_menu_icon invert_filter', + ] + ).html_print_input_text( + 'end_time', + date('H:i:s', get_system_time()), + false, + 10, + 9, + true + ), + ], + true + ), + ); html_print_table($table); // Submit button. - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_button( - __('Export'), - 'export_btn', - false, - 'change_action()', - ['icon' => 'wand'], - true - ), - ] + html_print_action_buttons( + html_print_button( + __('Export'), + 'export_btn', + false, + 'change_action()', + ['icon' => 'wand'], + true + ) ); echo '
    '; From 5017878701e736b1dd028811ba607cbd6f7920b1 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 22:05:06 +0100 Subject: [PATCH 25/42] Messages view --- .../operation/messages/message_edit.php | 149 ++++++++++-------- .../operation/messages/message_list.php | 86 ++++++---- 2 files changed, 141 insertions(+), 94 deletions(-) diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index 105a9560de..0e232788e7 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -52,7 +52,7 @@ $buttons['message_list'] = [ true, [ 'title' => __('Received messages'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; @@ -64,7 +64,7 @@ $buttons['sent_messages'] = [ true, [ 'title' => __('Sent messages'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; @@ -76,7 +76,7 @@ $buttons['create_message'] = [ true, [ 'title' => __('Create message'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; @@ -218,11 +218,8 @@ if ($read_message) { true ); - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => $outputButtons, - ], + html_print_action_buttons( + $outputButtons ); return; @@ -264,18 +261,6 @@ if ($send_mes === true) { // User info. $own_info = get_user_info($config['id_user']); -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; - -$table->data = []; - -$table->data[0][0] = __('Sender'); - -$table->data[0][1] = (empty($own_info['fullname']) === false) ? $own_info['fullname'] : $config['id_user']; - -$table->data[1][0] = __('Destination'); - $is_admin = (bool) db_get_value( 'is_admin', 'tusuario', @@ -305,15 +290,29 @@ foreach ($users_full as $user_id => $user_info) { $users[$user_info['id_user']] = (empty($user_info['fullname']) === true) ? $user_info['id_user'] : $user_info['fullname']; } +$table = new stdClass(); +$table->id = 'send_message_table'; +$table->width = '100%'; +$table->class = 'databox max_floating_element_size filter-table-adv'; +$table->style = []; +$table->style[0] = 'width: 30%'; +$table->style[1] = 'width: 70%'; +$table->data = []; + +$table->data[0][] = html_print_label_input_block( + __('Sender'), + ''.((empty($own_info['fullname']) === false) ? $own_info['fullname'] : $config['id_user']).'' +); + // Check if the user to reply is in the list, if not add reply user. if ($reply === true) { - $table->data[1][1] = (array_key_exists($dst_user, $users) === true) ? $users[$dst_user] : $dst_user; - $table->data[1][1] .= html_print_input_hidden( + $destinationInputs = (array_key_exists($dst_user, $users) === true) ? $users[$dst_user] : $dst_user; + $destinationInputs .= html_print_input_hidden( 'dst_user', $dst_user, true ); - $table->data[1][1] .= html_print_input_hidden( + $destinationInputs .= html_print_input_hidden( 'replied', '1', true @@ -324,21 +323,27 @@ if ($reply === true) { $groups = users_get_groups($config['id_user'], 'AR'); // Get a list of all groups. - $table->data[1][1] = html_print_select( - $users, - 'dst_user', - $dst_user, - 'changeStatusOtherSelect(\'dst_user\', \'dst_group\')', - __('Select user'), - false, - true, - false, - '' - ); - $table->data[1][1] .= '  '.__('OR').'  '; - $table->data[1][1] .= html_print_div( + $destinationInputs = html_print_div( [ - 'class' => 'w250px inline', + 'class' => 'select_users mrgn_right_5px', + 'content' => html_print_select( + $users, + 'dst_user', + $dst_user, + 'changeStatusOtherSelect(\'dst_user\', \'dst_group\')', + __('Select user'), + false, + true, + false, + '' + ), + ], + true + ); + $destinationInputs .= __('OR'); + $destinationInputs .= html_print_div( + [ + 'class' => 'mrgn_lft_5px', 'content' => html_print_select_groups( $config['id_user'], 'AR', @@ -355,24 +360,41 @@ if ($reply === true) { ); } -$table->data[2][0] = __('Subject'); -$table->data[2][1] = html_print_input_text( - 'subject', - $subject, - '', - 50, - 70, - true +$table->data[0][] = html_print_label_input_block( + __('Destination'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => $destinationInputs, + ], + true + ) ); -$table->data[3][0] = __('Message'); -$table->data[3][1] = html_print_textarea( - 'message', - 15, - 255, - $message, - '', - true +$table->colspan[1][] = 2; +$table->data[1][] = html_print_label_input_block( + __('Subject'), + html_print_input_text( + 'subject', + $subject, + '', + 50, + 70, + true + ) +); + +$table->colspan[2][] = 2; +$table->data[2][] = html_print_label_input_block( + __('Message'), + html_print_textarea( + 'message', + 15, + 50, + $message, + '', + true + ) ); $jsOutput = ''; @@ -396,17 +418,14 @@ echo '
    '; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Click to read'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id; + $titleRead = __('Click to read'); } else { - $data[0] .= ''; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Mark as unread'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_list&mark_unread=1&id_message='.$message_id; + $titleRead = __('Mark as unread'); } } else { if ($show_sent === true) { - $data[0] .= ''; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id; + $titleRead = __('Message unread - click to read'); } else { - $data[0] .= ''; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id; + $titleRead = __('Message unread - click to read'); } } + $data[0] = html_print_anchor( + [ + 'href' => $pathRead, + 'content' => html_print_image( + 'images/email_inbox.png', + true, + [ + 'title' => $titleRead, + 'class' => 'main_menu_icon invert_filter', + ], + ), + ], + true + ); + if ($show_sent === true) { $dest_user = get_user_fullname($message['dest']); if (!$dest_user) { @@ -243,18 +254,24 @@ if (empty($messages) === true) { } if ($show_sent === true) { - $data[2] = ''; + $pathSubject = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id; } else { - $data[2] = ''; + $pathSubject = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id; } - if ($message['subject'] == '') { - $data[2] .= __('No Subject'); - } else { - $data[2] .= $message['subject']; + $contentSubject = (empty($message['subject']) === true) ? __('No Subject') : $message['subject']; + + if ((int) $message['read'] !== 1) { + $contentSubject = ''.$contentSubject.''; } - $data[2] .= ''; + $data[2] .= html_print_anchor( + [ + 'href' => $pathSubject, + 'content' => $contentSubject, + ], + true + ); $data[3] = ui_print_timestamp( $message['timestamp'], @@ -264,13 +281,27 @@ if (empty($messages) === true) { $table->cellclass[][4] = 'table_action_buttons'; if ($show_sent === true) { - $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + $pathDelete = 'index.php?sec=message_list&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id; } else { - $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + $pathDelete = 'index.php?sec=message_list&sec2=operation/messages/message_list&delete_message=1&id='.$message_id; } + $data[4] = html_print_anchor( + [ + 'href' => $pathDelete, + 'content' => html_print_image( + 'images/delete.svg', + true, + [ + 'title' => __('Delete'), + 'class' => 'main_menu_icon invert_filter', + ] + ), + 'onClick' => 'javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;', + ], + true + ); + array_push($table->data, $data); } } @@ -312,11 +343,8 @@ if (empty($messages) === false) { echo '
    '; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => $outputButton, - ] + html_print_action_buttons( + $outputButton ); ?> From eefb62e520fab8c2b199a2e702ff3ff108642cea Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 22:45:48 +0100 Subject: [PATCH 26/42] Input improve --- pandora_console/include/functions_html.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index e9e60f3418..be9ed5d1a8 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4903,7 +4903,8 @@ function html_print_autocomplete_modules( $filter=[], $return=false, $id_agent_module=0, - $size='30' + $size='30', + $underInputTip=false ) { global $config; @@ -4960,7 +4961,11 @@ function html_print_autocomplete_modules( html_print_input_hidden($name.'_hidden', $id_agent_module); if (is_metaconsole() === false) { - ui_print_help_tip(__('Type at least two characters to search the module.'), false); + if ($underInputTip === true) { + ui_print_input_placeholder(__('Type at least two characters to search the module.'), false); + } else { + ui_print_help_tip(__('Type at least two characters to search the module.'), false); + } } $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false); From 27357b16b632a40bd58c771c6f8e6a85f86feb7e Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 8 Mar 2023 01:00:21 +0100 Subject: [PATCH 27/42] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d48173512f..7d9cee8f9c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230307 +Version: 7.0NG.769-230308 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index cb6b963504..53c9f200aa 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230307" +pandora_version="7.0NG.769-230308" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 012a228cd2..492ec37320 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230307'; +use constant AGENT_BUILD => '230308'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 26931473af..77859b1dde 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230307 +%define release 230308 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 329768dfa7..857f141c94 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230307 +%define release 230308 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 1a32864bd8..79cc3133b3 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230307" +PI_BUILD="230308" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 48912e2ff3..a78a35121f 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230307} +{230308} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 11a3383389..d7ef085547 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230307") +#define PANDORA_VERSION ("7.0NG.769 Build 230308") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 3c842ed958..76b5c3540e 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230307))" + VALUE "ProductVersion", "(7.0NG.769(Build 230308))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d71a8ffb94..b3ce245f17 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230307 +Version: 7.0NG.769-230308 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index ecb6a40251..0a19d7c0e3 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230307" +pandora_version="7.0NG.769-230308" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 75b110fd90..e4b91d9635 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230307'; +$build_version = 'PC230308'; $pandora_version = 'v7.0NG.769'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 2a7bde9bb0..68d69a23d6 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 205a8ef850..a4738c6552 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230307 +%define release 230308 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 2cc1e07821..b108390a3d 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_server %define version 7.0NG.769 -%define release 230307 +%define release 230308 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 6479a6943a..2a76611dde 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230307" +PI_BUILD="230308" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 3ddb47ab77..ce08881710 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.769 Build 230307"; +my $version = "7.0NG.769 Build 230308"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index e5eec498f7..0b193ab6c6 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.769 Build 230307"; +my $version = "7.0NG.769 Build 230308"; # save program name for logging my $progname = basename($0); From bc501ec5524c0abddb35b59a05b45a008d84e896 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 8 Mar 2023 08:28:48 +0100 Subject: [PATCH 28/42] fixed styles --- pandora_console/include/styles/pandora.css | 37 ---------------------- 1 file changed, 37 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 63ad0d2e52..b426f2f4d2 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -86,43 +86,6 @@ font-weight: 900; } -/* -@font-face { - font-family: "lato-italic"; - src: url("../fonts/Lato-Italic.woff") format("woff"); - font-weight: 400; - font-style: italic; -} - -@font-face { - font-family: "lato"; - src: url("../fonts/Lato-LightItalic.woff") format("woff"); - font-weight: 300; - font-style: italic; -} - -@font-face { - font-family: "lato"; - src: url("../fonts/Lato-ThinItalic.woff") format("woff"); - font-weight: 100; - font-style: italic; -} - -@font-face { - font-family: "lato"; - src: url("../fonts/Lato-BoldItalic.woff") format("woff"); - font-weight: 700; - font-style: italic; -} - -@font-face { - font-family: "lato"; - src: url("../fonts/Lato-BlackItalic.woff") format("woff"); - font-weight: 900; - font-style: italic; -} -*/ - @font-face { font-family: "source-code"; src: url("../fonts/SourceCodePro.woff") format("woff"); From 1a7e063c6095e1e402a156f73285fd2120deac14 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 8 Mar 2023 13:36:36 +0100 Subject: [PATCH 29/42] Alerts --- .../godmode/alerts/alert_commands.php | 16 +- .../godmode/snmpconsole/snmp_alert.php | 1292 +++++++++++++---- pandora_console/include/styles/pandora.css | 12 +- pandora_console/include/styles/wizard.css | 4 + 4 files changed, 1007 insertions(+), 317 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 5369864105..696882e133 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -174,7 +174,7 @@ if (is_ajax()) { 5, 1, '', - 'class="fields"', + 'class="fields w100p"', true, '', $is_management_allowed @@ -307,7 +307,8 @@ if (is_ajax()) { false, false, 'fields', - $is_management_allowed + $is_management_allowed, + 'width: 100%;' ); $rfield .= html_print_select( @@ -321,7 +322,8 @@ if (is_ajax()) { false, false, 'fields', - $is_management_allowed + $is_management_allowed, + 'width: 100%;' ); $ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); @@ -487,7 +489,7 @@ if (is_ajax()) { 5, 1, $fv[0], - 'style="'.$style.'" class="fields min-height-40px"', + 'style="'.$style.'" class="fields min-height-40px w100p"', true, '', $is_management_allowed @@ -497,7 +499,7 @@ if (is_ajax()) { 5, 1, $fv[0], - 'style="'.$style.'" class="fields_recovery min-height-40px', + 'style="'.$style.'" class="fields_recovery min-height-40px w100p', true, '', $is_management_allowed @@ -510,7 +512,7 @@ if (is_ajax()) { 5, 1, '', - 'style="'.$style.'" class="fields min-height-40px"', + 'style="'.$style.'" class="fields min-height-40px w100p"', true, '', $is_management_allowed @@ -520,7 +522,7 @@ if (is_ajax()) { 5, 1, '', - 'style="'.$style.'" class="fields_recovery min-height-40px"', + 'style="'.$style.'" class="fields_recovery min-height-40px w100p"', true, '', $is_management_allowed diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 6ac7252512..6ad576198f 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -746,7 +746,8 @@ foreach ($user_groups as $id => $name) { // Alert form. if ($create_alert || $update_alert) { // The update_alert means the form should be displayed. If update_alert > 1 then an existing alert is updated. - echo '
    '; + echo ''; html_print_input_hidden('id_alert_snmp', $id_as); @@ -759,36 +760,67 @@ if ($create_alert || $update_alert) { } // SNMP alert filters. - echo ''; + echo '
    '; - // Description. + // 1. echo ''; - echo ''; - echo ''; + + echo ''; echo ''; - // OID. - echo ''; - echo ''; - echo ''; + echo ''; - echo ''; - // Custom. - echo ''; - echo ''; - - // SNMP Agent. - echo ''; echo ''; @@ -798,242 +830,669 @@ if ($create_alert || $update_alert) { $return_all_group = true; } - // Group. - echo ''; + echo ''; + + echo ''; echo ''; - // Trap type. - echo ''; + echo ''; + echo ''; echo ''; - // Single value. - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #1. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #2. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #3. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #4. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #5. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #6. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #7. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #8. - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ''; - // Variable bindings/Data #9. - echo ''; - echo ''; - echo ''; + echo ''; - echo ''; - - // Variable bindings/Data #10. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #11. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #12. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #13. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #14. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #15. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #16. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #17. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #18. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #19. - echo ''; - echo ''; - echo ''; - echo ''; - - // Variable bindings/Data #20. - echo ''; - echo ''; - echo ''; echo ''; @@ -1071,16 +1530,43 @@ if ($create_alert || $update_alert) { echo ''; } - // Max / Min alerts. - echo ''; - - // Time Threshold. - echo ''; + echo ''; + echo ''; + echo ''; $fields = []; $fields[$time_threshold] = human_time_description_raw($time_threshold); @@ -1096,54 +1582,144 @@ if ($create_alert || $update_alert) { $fields[SECONDS_1WEEK] = human_time_description_raw(SECONDS_1WEEK); $fields[-1] = __('Other value'); - html_print_select($fields, 'time_threshold', $time_threshold, '', '', '0', false, false, false, '" class="mrgn_right_60px'); - echo ''; - - // Priority. - echo ''; - - // Alert type (e-mail, event etc.). - echo ''; + echo ''; + echo ''; + echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; - html_print_input_text('position', $position, '', 3); - echo ''; - echo ''; + // Disable event, . + echo ''; + echo ''; + echo ''; + echo ''; echo '
    '.__('Description').''; - html_print_textarea('description', 3, 2, $description, 'class="w400px"'); + echo ''; + echo html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 2, + 2, + $description, + 'class="w100p"', + true + ) + ); + echo ''; + echo html_print_label_input_block( + __('Custom Value/OID'), + html_print_textarea( + 'custom_value', + 2, + 2, + $custom_value, + 'class="w100p"', + true + ) + ); echo '
    '.__('Enterprise String').ui_print_help_tip(__('Matches substrings. End the string with $ for exact matches.'), true).''; - html_print_input_text('oid', $oid, '', 50, 255); + // 2. + echo '
    '; + echo html_print_label_input_block( + __('Enterprise String').ui_print_help_tip(__('Matches substrings. End the string with $ for exact matches.'), true), + html_print_input_text( + 'oid', + $oid, + '', + 50, + 255, + true + ) + ); echo '
    '.__('Custom Value/OID'); - - echo ''; - html_print_textarea('custom_value', 2, 2, $custom_value, 'class="w400px"'); - - echo '
    '.__('SNMP Agent').' (IP)'; - html_print_input_text('source_ip', $source_ip, '', 20); + echo ''; + echo html_print_label_input_block( + __('SNMP Agent').' (IP)', + html_print_input_text( + 'source_ip', + $source_ip, + '', + 20, + 255, + true + ) + ); echo '
    '.__('Group').''; - echo '
    '; - html_print_select_groups( - $config['id_user'], - 'AR', - $return_all_group, - 'group', - $group, - '', - '', - 0, - false, - false, - false, - '', - false, - false, - false, - false, - 'id_grupo', - false + // 3. + echo '
    '; + echo html_print_label_input_block( + __('Group'), + html_print_select_groups( + $config['id_user'], + 'AR', + $return_all_group, + 'group', + $group, + '', + '', + 0, + true, + false, + false, + '', + false, + false, + false, + false, + 'id_grupo', + false + ) + ); + echo ''; + echo html_print_label_input_block( + __('Trap type'), + html_print_select( + $trap_types, + 'trap_type', + $trap_type, + '', + '', + '', + true, + false, + false, + 'w100p' + ) ); - echo ''; echo '
    '.__('Trap type').''; - echo html_print_select($trap_types, 'trap_type', $trap_type, '', '', '', false, false, false); + // 4. + echo '
    '; + echo html_print_label_input_block( + __('Single value'), + html_print_input_text( + 'single_value', + $single_value, + '', + 20, + 255, + true + ) + ); + echo ''; echo '
    '.__('Single value').''; - html_print_input_text('single_value', $single_value, '', 20); + // #1 #2. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_1', + $order_1, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_1', + $custom_oid_data_1, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_2', + $order_2, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_2', + $custom_oid_data_2, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_1', $order_1, '', 4); - html_print_input_text('custom_oid_data_1', $custom_oid_data_1, '', 60); + // #3 #4. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_3', + $order_3, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_3', + $custom_oid_data_3, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_4', + $order_4, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_4', + $custom_oid_data_4, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_2', $order_2, '', 4); - html_print_input_text('custom_oid_data_2', $custom_oid_data_2, '', 60); + // #5 #6. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_5', + $order_5, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_5', + $custom_oid_data_5, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_6', + $order_6, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_6', + $custom_oid_data_6, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_3', $order_3, '', 4); - html_print_input_text('custom_oid_data_3', $custom_oid_data_3, '', 60); + // #7 #8. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_7', + $order_7, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_7', + $custom_oid_data_7, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_8', + $order_8, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_8', + $custom_oid_data_8, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_4', $order_4, '', 4); - html_print_input_text('custom_oid_data_4', $custom_oid_data_4, '', 60); + // #9 #10. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_9', + $order_9, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_9', + $custom_oid_data_9, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_10', + $order_10, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_10', + $custom_oid_data_10, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_5', $order_5, '', 4); - html_print_input_text('custom_oid_data_5', $custom_oid_data_5, '', 60); + // #11 #12. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_11', + $order_11, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_11', + $custom_oid_data_11, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_12', + $order_12, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_12', + $custom_oid_data_12, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_6', $order_6, '', 4); - html_print_input_text('custom_oid_data_6', $custom_oid_data_6, '', 60); + // #13 #14. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_13', + $order_13, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_13', + $custom_oid_data_13, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_14', + $order_14, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_14', + $custom_oid_data_14, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_7', $order_7, '', 4); - html_print_input_text('custom_oid_data_7', $custom_oid_data_7, '', 60); + // #15 #16. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_15', + $order_15, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_15', + $custom_oid_data_15, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_16', + $order_16, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_16', + $custom_oid_data_16, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_8', $order_8, '', 4); - html_print_input_text('custom_oid_data_8', $custom_oid_data_8, '', 60); + // #17 #18. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_17', + $order_17, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_17', + $custom_oid_data_17, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_18', + $order_18, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_18', + $custom_oid_data_18, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_9', $order_9, '', 4); - html_print_input_text('custom_oid_data_9', $custom_oid_data_9, '', 60); + // #19 #20. + echo '
    '; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_19', + $order_19, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_19', + $custom_oid_data_19, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_10', $order_10, '', 4); - html_print_input_text('custom_oid_data_10', $custom_oid_data_10, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_11', $order_11, '', 4); - html_print_input_text('custom_oid_data_11', $custom_oid_data_11, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_12', $order_12, '', 4); - html_print_input_text('custom_oid_data_12', $custom_oid_data_12, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_13', $order_13, '', 4); - html_print_input_text('custom_oid_data_13', $custom_oid_data_13, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_14', $order_14, '', 4); - html_print_input_text('custom_oid_data_14', $custom_oid_data_14, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_15', $order_15, '', 4); - html_print_input_text('custom_oid_data_15', $custom_oid_data_15, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_16', $order_16, '', 4); - html_print_input_text('custom_oid_data_16', $custom_oid_data_16, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_17', $order_17, '', 4); - html_print_input_text('custom_oid_data_17', $custom_oid_data_17, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_18', $order_18, '', 4); - html_print_input_text('custom_oid_data_18', $custom_oid_data_18, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_19', $order_19, '', 4); - html_print_input_text('custom_oid_data_19', $custom_oid_data_19, '', 60); - echo '
    '.__('Variable bindings/Data').''; - echo '#'; - html_print_input_text('order_20', $order_20, '', 4); - html_print_input_text('custom_oid_data_20', $custom_oid_data_20, '', 60); + echo ''; + echo html_print_label_input_block( + __('Variable bindings/Data'), + '
    #'.html_print_input_text( + 'order_20', + $order_20, + '', + 4, + 255, + true, + false, + false, + '', + 'w10p' + ).html_print_input_text( + 'custom_oid_data_20', + $custom_oid_data_20, + '', + 60, + 255, + true, + false, + false, + '', + 'w88p' + ).'
    ' + ); echo '
    '.__('Min. number of alerts').''; - html_print_input_text('min_alerts', $min_alerts, '', 3); - - echo '
    '.__('Max. number of alerts').''; - html_print_input_text('max_alerts', $max_alerts, '', 3); - echo '
    '.__('Time threshold').''; + // Max, Min. + echo '
    '; + echo html_print_label_input_block( + __('Min. number of alerts'), + html_print_input_text( + 'min_alerts', + $min_alerts, + '', + 3, + 255, + true, + false, + false, + '', + 'w100p' + ) + ); + echo ''; + echo html_print_label_input_block( + __('Max. number of alerts'), + html_print_input_text( + 'max_alerts', + $max_alerts, + '', + 3, + 255, + true, + false, + false, + '', + 'w100p' + ) + ); + echo '
    '.__('Priority').''; - echo html_print_select(get_priorities(), 'priority', $priority, '', '', '0', false, false, false); - echo '
    '.__('Alert action').''; - html_print_select_from_sql( - 'SELECT id, name - FROM talert_actions - ORDER BY name', - 'alert_type', - $alert_type, - '', - '', - 0, - false, - false, - false + // Time Threshold, Priority. + echo '
    '; + echo html_print_label_input_block( + __('Time threshold'), + html_print_select( + $fields, + 'time_threshold', + $time_threshold, + '', + '', + '0', + true, + false, + false, + '" class="mrgn_right_60px' + ).'' ); + echo ''; + echo html_print_label_input_block( + __('Priority'), + html_print_select( + get_priorities(), + 'priority', + $priority, + '', + '', + '0', + true, + false, + false + ) + ); + echo '
    '.__('Position').''; + // Alert type (e-mail, event etc.), Position. + echo '
    '; + echo html_print_label_input_block( + __('Alert action'), + html_print_select_from_sql( + 'SELECT id, name + FROM talert_actions + ORDER BY name', + 'alert_type', + $alert_type, + '', + '', + 0, + true, + false, + false + ) + ); + echo ''; + echo html_print_label_input_block( + __('Position'), + html_print_input_text( + 'position', + $position, + '', + 3, + 255, + true, + false, + false, + '', + 'w100p' + ) + ); + echo '
    '.__('Disable event').''; - - html_print_checkbox('disable_event', 1, $disable_event, false); - echo '
    '; + echo html_print_label_input_block( + __('Disable event'), + html_print_checkbox( + 'disable_event', + 1, + $disable_event, + true + ) + ); + echo ''; + echo '
    '; - echo ""; - echo '
    '; - html_print_button(__('Back'), 'button_back', false, '', 'class="sub cancel margin-right-05"'); + + $back_button = html_print_button( + __('Back'), + 'button_back', + false, + '', + [ + 'class' => 'secondary', + 'icon' => 'back', + ], + true + ); if ($id_as > 0) { - html_print_submit_button(__('Update'), 'submit', false, 'class="sub upd"'); + $submit_button = html_print_submit_button( + __('Update'), + 'submit', + false, + [ + 'class' => '', + 'icon' => 'wand', + ], + true + ); } else { - html_print_submit_button(__('Create'), 'submit', false, 'class="sub wand"'); + $submit_button = html_print_submit_button( + __('Create'), + 'submit', + false, + [ + 'class' => '', + 'icon' => 'wand', + ], + true + ); } - echo '
    '; - echo ''; + html_print_action_buttons($submit_button.$back_button); echo '
    '; } else { include_once 'include/functions_alerts.php'; @@ -1156,28 +1732,91 @@ if ($create_alert || $update_alert) { $table_filter = new stdClass(); $table_filter->width = '100%'; - $table_filter->class = 'databox filters'; + $table_filter->class = 'databox filters filter-table-adv'; $table_filter->data = []; - $table_filter->data[0][0] = __('Free search').ui_print_help_tip( - __('Search by these fields description, OID, Custom Value, SNMP Agent (IP), Single value, each Variable bindings/Datas.'), - true + $table_filter->size[0] = '33%'; + $table_filter->size[1] = '33%'; + $table_filter->size[2] = '33%'; + + $table_filter->data[0][0] = html_print_label_input_block( + __('Free search').ui_print_help_tip( + __('Search by these fields description, OID, Custom Value, SNMP Agent (IP), Single value, each Variable bindings/Datas.'), + true + ), + html_print_input_text( + 'free_search', + $free_search, + '', + 30, + 100, + true + ) + ); + + $table_filter->data[0][1] = html_print_label_input_block( + __('Trap type'), + html_print_select( + $trap_types, + 'trap_type_filter', + $trap_type_filter, + '', + '', + '', + true, + false, + false, + 'w100p', + false, + 'width: 100%;' + ) + ); + + $table_filter->data[0][2] = html_print_label_input_block( + __('Priority'), + html_print_select( + get_priorities(), + 'priority_filter', + $priority_filter, + '', + __('None'), + '-1', + true, + false, + false, + 'w100p', + false, + 'width: 100%;' + ) ); - $table_filter->data[0][1] = html_print_input_text('free_search', $free_search, '', 30, 100, true); - $table_filter->data[0][2] = __('Trap type'); - $table_filter->data[0][3] = html_print_select($trap_types, 'trap_type_filter', $trap_type_filter, '', '', '', true, false, false); - $table_filter->data[0][4] = __('Priority'); - $table_filter->data[0][5] = html_print_select(get_priorities(), 'priority_filter', $priority_filter, '', __('None'), '-1', true, false, false); - ; $form_filter = '
    '; $form_filter .= html_print_input_hidden('filter', 1, true); $form_filter .= html_print_table($table_filter, true); - $form_filter .= '
    '; - $form_filter .= html_print_submit_button(__('Filter'), 'filter_button', false, 'class="sub filter"', true); + $form_filter .= '
    '; + $form_filter .= html_print_submit_button( + __('Filter'), + 'filter_button', + false, + [ + 'class' => 'mini', + 'icon' => 'search', + ], + true + ); $form_filter .= '
    '; $form_filter .= ''; - ui_toggle($form_filter, __('Alert SNMP control filter'), __('Toggle filter(s)')); + ui_toggle( + $form_filter, + ''.__('Alert SNMP control filter').'', + __('Toggle filter(s)'), + 'filter', + true, + false, + '', + 'white-box-content no_border', + 'filter-datatable-main box-flat white_table_graph fixed_filter_bar' + ); $filter = []; $offset = (int) get_parameter('offset'); @@ -1231,8 +1870,6 @@ if ($create_alert || $update_alert) { $result = []; ui_print_info_message(['no_close' => true, 'message' => __('There are no SNMP alerts') ]); } else { - ui_pagination($count, $url_pagination); - $where_sql .= ' LIMIT '.$limit.' OFFSET '.$offset; $result = db_get_all_rows_sql( 'SELECT * @@ -1491,37 +2128,76 @@ if ($create_alert || $update_alert) { echo ''; html_print_input_hidden('add_alert', 1); - echo html_print_submit_button(__('Add'), 'addbutton', false, ['class' => 'sub next', 'style' => 'float:right'], true); + echo html_print_submit_button( + __('Add'), + 'addbutton', + false, + [ + 'class' => 'mini', + 'icon' => 'wand', + 'style' => 'float:right', + ], + true + ); echo ''; echo '
    '; // END DIALOG ADD MORE ACTIONS. - if (empty($table->data) === false) { - echo '
    '; - html_print_table($table); + $pagination = ''; + $deleteButton = ''; + if (empty($table->data) === false) { + echo ''; + html_print_table($table); - ui_pagination($count, $url_pagination); + $pagination = ui_pagination($count, $url_pagination, 0, 0, true, 'offset', false); - echo '
    '; - html_print_input_hidden('multiple_delete', 1); - html_print_button(__('Delete selected'), 'delete_button', false, 'delete_selected_snmp_alerts()', 'class="sub delete mrgn_btn_10px"'); - echo '
    '; - echo '
    '; - } + echo '
    '; + html_print_input_hidden('multiple_delete', 1); + $deleteButton = html_print_button( + __('Delete selected'), + 'delete_button', + false, + 'delete_selected_snmp_alerts()', + [ + 'class' => 'secondary', + 'icon' => 'delete', + ], + true + ); + echo '
    '; + echo ''; + } echo '
    '; echo '
    '; html_print_input_hidden('create_alert', 1); - html_print_submit_button(__('Create'), 'alert', false, 'class="sub next"'); + $submitButton = html_print_submit_button( + __('Create'), + 'alert', + false, + ['icon' => 'wand'], + true + ); + html_print_action_buttons($submitButton.$deleteButton, ['right_content' => $pagination]); echo '
    '; - echo '
    '; - echo '

    '.__('Legend').'

    '; - foreach (get_priorities() as $num => $name) { - echo ''.$name.''; - echo '
    '; - } + $legend = ''; + + ui_toggle($legend, __('Legend')); unset($table); } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 63ad0d2e52..ee4a24d5f5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -719,6 +719,10 @@ select:-internal-list-box { width: 80%; } +.w88p { + width: 88%; +} + .w90p { width: 90%; } @@ -2414,7 +2418,7 @@ ol.steps li.visited span { } ol.steps li.current { - border-left: 5px solid #778866; + border-left: 5px solid var(--primary-color); margin-left: 0; font-weight: bold; background-color: #e9f3d2; @@ -7885,6 +7889,10 @@ div.graph div.legend table { height: 10px; } +.height_15px { + height: 15px; +} + .height_20px { height: 20px; } @@ -11577,5 +11585,5 @@ ul.tag-editor { } .max-width-100p { - max-width: 100% !important; + max-width: 100%; } diff --git a/pandora_console/include/styles/wizard.css b/pandora_console/include/styles/wizard.css index c7c37a8143..af3b1c3359 100644 --- a/pandora_console/include/styles/wizard.css +++ b/pandora_console/include/styles/wizard.css @@ -236,3 +236,7 @@ form.alert-correlation > div > ul > li.flex-flex-end > input { form.alert-correlation > div > ul > li.flex-flex-end > label { width: 50px !important; } + +form.alert-correlation > div > ul > li.display-grid > textarea { + width: 100% !important; +} From 91a708dfb8a38a93c2129e13b8750b88a8773285 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Mar 2023 13:41:00 +0100 Subject: [PATCH 30/42] SNMP Browser and agent module SNMP walk --- .../agentes/module_manager_editor_common.php | 2 +- .../agentes/module_manager_editor_network.php | 1 + .../include/functions_snmp_browser.php | 123 ++++++++++++++---- .../javascript/pandora_snmp_browser.js | 6 +- .../operation/snmpconsole/snmp_browser.php | 4 +- 5 files changed, 108 insertions(+), 28 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 8f951565c2..aba3daf8f4 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -325,7 +325,7 @@ if ($edit === false) { $table_simple->data['module_n_type'][1] = ''.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')'; } else { - $idModuleType = (isset($id_module_type) === true) ? $idModuleType : ''; + $idModuleType = (isset($id_module_type) === true) ? $id_module_type : ''; // Removed web analysis and log4x from select. $tipe_not_in = '24, 25'; if (is_metaconsole() === true) { diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index be63ddfeef..f9c1117377 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -128,6 +128,7 @@ if ($page === 'enterprise/godmode/policies/policy_modules') { // In ICMP modules, port is not configurable. if ($id_module_type !== 6 && $id_module_type !== 7) { + $tcp_port = (empty($tcp_port) === false) ? $tcp_port : get_parameter('tcp_port'); $data[1] = html_print_input_text( 'tcp_port', $tcp_port, diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index be9ac48424..a43150c94e 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -612,8 +612,8 @@ function snmp_browser_print_oid( $table->head[1] = __('OID Information'); $output .= html_print_table($table, true); - $url = 'index.php?'.'sec=gmodules&'.'sec2=godmode/modules/manage_network_components'; - $output .= '
    '; + $url = 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components'; + $output .= ''; $output .= html_print_input_hidden('create_network_from_snmp_browser', 1, true); $output .= html_print_input_hidden('id_component_type', 2, true); $output .= html_print_input_hidden('type', 17, true); @@ -638,19 +638,21 @@ function snmp_browser_print_oid( __('Create network component'), 'create_network_component', false, - 'class="sub add float-left mrgn_right_20px"', + 'class="buttonButton mrgn_right_20px"', true ); - // Hidden by default. - $output .= html_print_button( - __('Create agent module'), - 'create_module_agent_single', - false, - 'show_add_module()', - 'class="sub add invisible"', - true - ); + if (isset($_POST['print_create_agent_module'])) { + // Hidden by default. + $output .= html_print_button( + __('Create agent module'), + 'create_module_agent_single', + false, + 'show_add_module()', + 'class="sub add invisible"', + true + ); + } // Select agent modal. $output .= snmp_browser_print_create_modules(true); @@ -685,7 +687,8 @@ function snmp_browser_print_container( $width='100%', $height='60%', $display='', - $show_massive_buttons=false + $show_massive_buttons=false, + $toggle=false ) { global $config; @@ -948,8 +951,22 @@ function snmp_browser_print_container( ); $table->data[2] .= ''; + if ($toggle == true) { + $print_create_agent_module = 1; + } else { + $print_create_agent_module = 0; + } + $searchForm = ''; $searchForm .= html_print_table($table, true); + $searchForm .= html_print_input_hidden( + 'print_create_agent_module', + $print_create_agent_module, + true, + false, + false, + 'print_create_agent_module' + ); $searchForm .= html_print_div( [ 'class' => 'action-buttons', @@ -969,17 +986,19 @@ function snmp_browser_print_container( $searchForm .= ''; - ui_toggle( - $searchForm, - ''.__('Filters').'', - 'filter_form', - '', - false, - false, - '', - 'white-box-content', - 'box-flat white_table_graph fixed_filter_bar' - ); + if ($toggle == true) { + ui_toggle( + $searchForm, + ''.__('Filters').'', + 'filter_form', + '', + false, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); + } // Search tools. $table2 = new stdClass(); @@ -1101,6 +1120,62 @@ function snmp_browser_print_container( ); $output .= ''; + if ($toggle === false) { + // This extra div that can be handled by jquery's dialog. + $output .= '
    '; + $legend .= '
    '; + $priorities = get_priorities(); + $half = (count($priorities) / 2); + $count = 0; + foreach ($priorities as $num => $name) { + if ($count == $half) { + $legend .= '
    '; + } - echo '
    '; + $legend .= ''.$name.''; + $legend .= '
    '; + $count++; + } + + $legend .= '
    - - - - - - - - -
    ".__('From:').''.html_print_input_text('once_date_from', $once_date_from, '', 10, 10, true, $disabled_in_execution).html_print_input_text('once_time_from', $once_time_from, '', 9, 9, true, $disabled_in_execution).'
    '.__('To:').''.html_print_input_text('once_date_to', $once_date_to, '', 10, 10, true).html_print_input_text('once_time_to', $once_time_to, '', 9, 9, true)."
    -
    - - '; - -if ($id_downtime > 0) { - echo "
    "; -} else { - echo ''; -} - -// Editor form. -html_print_table($table); - -echo ""; $filter_group = (int) get_parameter('filter_group', 0); @@ -1074,39 +864,439 @@ if (empty($agents) || $disabled_in_execution) { $disabled_add_button = true; } -// Show available agents to include into downtime + $table = new StdClass(); -$table->class = 'databox filters'; +$table->class = 'databox filter-table-adv'; +$table->id = 'principal_table_scheduled'; $table->width = '100%'; +$table->size = []; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $table->data = []; -$table->size[0] = '25%'; - -$table->data[0][0] = __('Group filter'); -$table->data[0][1] = html_print_select_groups( - false, - $access, - $return_all_group, - 'filter_group', - $filter_group, - '', - '', - '', - true, - false, - true, - '', - false, - 'min-width:180px;margin-right:15px;' +$table->data['first_title'][] = html_print_div( + [ + 'class' => 'section_table_title', + 'content' => __('Editor'), + ], + true +); +$table->data[0][] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, + '', + 25, + 40, + true, + $disabled_in_execution + ) ); -$table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); -$table->data[1][0] = __('Available agents'); -$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;'); +$table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + $access, + $return_all_group, + 'id_group', + $id_group, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) +); +$table->data[1][] = html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 3, + 35, + $description, + '', + true + ) +); -$table->rowid[2] = 'available_modules_selection_mode'; +$table->data[1][] = html_print_label_input_block( + __('Type'), + html_print_select( + [ + 'quiet' => __('Quiet'), + 'disable_agents' => __('Disabled Agents'), + 'disable_agent_modules' => __('Disable Modules'), + 'disable_agents_alerts' => __('Disabled only Alerts'), + ], + 'type_downtime', + $type_downtime, + 'change_type_downtime()', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ).ui_print_input_placeholder( + __('Quiet: Modules will not generate events or fire alerts.').'
    '.__('Disable Agents: Disables the selected agents.').'
    '.__('Disable Alerts: Disable alerts for the selected agents.'), + true + ) +); -$table->data[2][1] = html_print_select( +$table->data[2][] = html_print_label_input_block( + __('Execution'), + html_print_select( + [ + 'once' => __('Once'), + 'periodically' => __('Periodically'), + 'cron' => __('Cron from/to'), + ], + 'type_execution', + $type_execution, + 'change_type_execution();', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) +); + +$timeInputs = []; + +$timeInputs[] = html_print_div( + [ + 'id' => 'once_time', + 'style' => 'display: none', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => html_print_input_text( + 'once_date_from', + $once_date_from, + '', + 10, + 10, + true, + $disabled_in_execution + ).html_print_input_text( + 'once_time_from', + $once_time_from, + '', + 9, + 9, + true, + $disabled_in_execution + ).''.__( + 'To' + ).''.html_print_input_text( + 'once_date_to', + $once_date_to, + '', + 10, + 10, + true + ).html_print_input_text( + 'once_time_to', + $once_time_to, + '', + 9, + 9, + true + ), + ], + true + ), + ], + true +); + +$timeInputs[] = html_print_div( + [ + 'id' => 'periodically_time', + 'style' => 'display: none', + 'content' => html_print_div( + [ + 'class' => 'filter-table-adv-manual w50p', + 'content' => html_print_label_input_block( + __('Type Periodicity'), + html_print_select( + [ + 'weekly' => __('Weekly'), + 'monthly' => __('Monthly'), + ], + 'type_periodicity', + $type_periodicity, + 'change_type_periodicity();', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) + ), + ], + true + ).html_print_div( + [ + 'id' => 'weekly_item', + 'class' => '', + 'content' => '
      +
    • '.__('Mon').html_print_checkbox('monday', 1, $monday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    • '.__('Tue').html_print_checkbox('tuesday', 1, $tuesday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    • '.__('Wed').html_print_checkbox('wednesday', 1, $wednesday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    • '.__('Thu').html_print_checkbox('thursday', 1, $thursday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    • '.__('Fri').html_print_checkbox('friday', 1, $friday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    • '.__('Sat').html_print_checkbox('saturday', 1, $saturday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    • '.__('Sun').html_print_checkbox('sunday', 1, $sunday, true, $disabled_in_execution, '', false, ['label_style' => 'margin: 0 5px;' ]).'
    • +
    ', + ], + true + ).html_print_div( + [ + 'id' => 'monthly_item', + 'style' => 'margin-top: 12px;', + 'class' => 'filter-table-adv-manual flex-row-start w50p', + 'content' => html_print_label_input_block( + __('From day'), + html_print_select( + $days, + 'periodically_day_from', + $periodically_day_from, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ), + [ 'div_style' => 'flex: 50; margin-right: 5px;' ] + ).html_print_label_input_block( + __('To day'), + html_print_select( + $days, + 'periodically_day_to', + $periodically_day_to, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ).ui_print_input_placeholder( + __('The end day must be higher than the start day'), + true + ), + [ 'div_style' => 'flex: 50; margin-left: 5px;' ] + ), + ], + true + ).html_print_div( + [ + 'class' => 'filter-table-adv-manual flex-row-start w50p', + 'content' => html_print_label_input_block( + __('From hour'), + html_print_input_text( + 'periodically_time_from', + $periodically_time_from, + '', + 7, + 7, + true, + $disabled_in_execution + ).ui_print_input_placeholder( + __('The start time must be lower than the end time'), + true + ), + [ 'div_style' => 'flex: 50; margin-right: 5px;' ] + ).html_print_label_input_block( + __('To hour'), + html_print_input_text( + 'periodically_time_to', + $periodically_time_to, + '', + 7, + 7, + true, + $disabled_in_execution + ).ui_print_input_placeholder( + __('The end time must be higher than the start time'), + true + ), + [ 'div_style' => 'flex: 50; margin-left: 5px;' ] + ), + ], + true + ).ui_get_using_system_timezone_warning(), + ], + true +); + +$timeInputs[] = html_print_div( + [ + 'id' => 'cron_time', + 'style' => 'display: none', + 'content' => html_print_label_input_block( + __('Cron from'), + html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from') + ).html_print_label_input_block( + __('Cron to'), + html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to') + ), + ], + true +); + +$table->colspan[3][0] = 2; +$table->data[3][0] = html_print_label_input_block( + __('Configure the time'), + implode('', $timeInputs) +); + +$table->data[4][] = html_print_div( + [ + 'class' => 'section_table_title', + 'content' => __('Filtering'), + ], + true +); + +$table->data[5][] = html_print_label_input_block( + __('Group filter'), + html_print_select_groups( + false, + $access, + $return_all_group, + 'filter_group', + $filter_group, + '', + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;margin-right:15px;' + ) +); + +$table->data[5][] = html_print_label_input_block( + __('Recursion'), + html_print_checkbox_switch( + 'recursion', + 1, + $recursion, + true, + false, + '' + ) +); + +$table->colspan[6][0] = 2; +$availableModules = html_print_label_input_block( + __('Available agents'), + html_print_select( + $agents, + 'id_agents[]', + -1, + '', + __('Any'), + -2, + true, + true, + true, + '', + false, + 'min-width: 250px;width: 70%;' + ), + [ + 'div_class' => 'flex-column', + 'div_style' => 'flex: 33', + ] +); + +$availableModules .= html_print_label_input_block( + __('Selection mode'), + html_print_select( + [ + 'common' => __('Show common modules'), + 'all' => __('Show all modules'), + ], + 'modules_selection_mode', + 'common', + false, + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;' + ), + [ + 'div_class' => 'available_modules_selection_mode flex-column', + 'div_style' => 'flex: 33', + ] +); + +$availableModules .= html_print_label_input_block( + __('Available modules'), + html_print_select( + [], + 'module[]', + '', + '', + '', + 0, + true, + true, + true, + '', + false, + 'min-width: 250px;width: 70%;' + ).ui_print_input_placeholder( + __('Only for type Quiet for downtimes.'), + true + ), + [ + 'div_class' => 'available_modules flex-column', + 'div_style' => 'flex: 33', + ] +); + +$table->data[6][0] = html_print_div( + [ + 'style' => 'flex-direction: row;align-items: flex-start;', + 'content' => $availableModules, + ], + true +); + +// $table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); +/* + $table->data[1][0] = __('Available agents'); + $table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;'); +*/ +/* + $table->rowid[2] = 'available_modules_selection_mode'; + + $table->data[2][1] = html_print_select( [ 'common' => __('Show common modules'), 'all' => __('Show all modules'), @@ -1122,16 +1312,16 @@ $table->data[2][1] = html_print_select( '', false, 'min-width:180px;' -); + ); -$table->rowid[3] = 'available_modules'; -$table->data[3][0] = __('Available modules:').ui_print_help_tip( + $table->rowid[3] = 'available_modules'; + $table->data[3][0] = __('Available modules:').ui_print_help_tip( __('Only for type Quiet for downtimes.'), true -); + ); -$table->data[3][1] = html_print_select( + $table->data[3][1] = html_print_select( [], 'module[]', '', @@ -1144,35 +1334,45 @@ $table->data[3][1] = html_print_select( '', false, 'min-width: 250px;width: 70%;' -); - + ); +*/ // Print agent table. +if ($id_downtime > 0) { + echo ""; +} else { + echo ''; +} + html_print_table($table); -echo '


    '; - +$buttons = ''; html_print_input_hidden('id_agent', $id_agent); -echo '
    '; + if ($id_downtime > 0) { html_print_input_hidden('update_downtime', 1); html_print_input_hidden('id_downtime', $id_downtime); - html_print_submit_button( + $buttons .= html_print_submit_button( __('Update'), 'updbutton', false, - 'class="sub upd"' + ['icon' => 'update'], + true ); } else { html_print_input_hidden('create_downtime', 1); - html_print_submit_button( + $buttons .= html_print_submit_button( __('Add'), 'crtbutton', false, - 'class="sub wand"' + ['icon' => 'wand'], + true ); } -echo '
    '; +html_print_action_buttons( + $buttons +); + html_print_input_hidden('all_common_modules', ''); echo '
    '; @@ -1208,11 +1408,17 @@ if (empty($downtimes_agents)) { $table->head[2] = __('OS'); $table->head[3] = __('Last contact'); $table->head['count_modules'] = __('Modules'); + $table->align = []; + $table->align[0] = 'center'; + $table->align[1] = 'center'; + $table->align[2] = 'center'; + $table->align[3] = 'center'; + $table->align[4] = 'center'; if (!$running) { $table->head[5] = __('Actions'); - $table->align[5] = 'center'; - $table->size[5] = '5%'; + $table->align[5] = 'right'; + $table->size[5] = '10%'; } foreach ($downtimes_agents as $downtime_agent) { @@ -1232,7 +1438,13 @@ if (empty($downtimes_agents)) { WHERE id_grupo = '.$downtime_agent['id_grupo'] ); - $data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); + $data[2] = html_print_div( + [ + 'class' => 'main_menu_icon invert_filter', + 'content' => ui_print_os_icon($downtime_agent['id_os'], false, true), + ], + true + ); $data[3] = $downtime_agent['ultimo_contacto']; @@ -1251,10 +1463,10 @@ if (empty($downtimes_agents)) { if (!$running) { $data[5] = ''; if ($type_downtime !== 'disable_agents') { - $data[5] = ''.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).''; + $data[5] = ''.html_print_image('images/edit.svg', true, ['alt' => __('Edit'), 'class' => 'main_menu_icon invert_filter']).''; } - $data[5] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).''; + $data[5] .= ''.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'class' => 'main_menu_icon invert_filter']).''; } $table->data['agent_'.$downtime_agent['id_agente']] = $data; @@ -1263,17 +1475,7 @@ if (empty($downtimes_agents)) { html_print_table($table); } -$table = new stdClass(); -$table->id = 'loading'; -$table->width = '100%'; -$table->colspan['loading'][0] = '6'; -$table->style[0] = 'text-align: center;'; -$table->data = []; -$table->data['loading'] = []; -$table->data['loading'][0] = html_print_image('images/spinner.gif', true); -echo "'; +ui_print_spinner('Loading'); $table = new stdClass(); $table->id = 'editor'; diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 0eda511a48..da860c1bbc 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -89,7 +89,7 @@ if (is_ajax() === true) { [ 'id' => 'agent_modules_affected_planned_downtime', 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => 'godmode/agentes/planned_downtime.list', @@ -103,6 +103,7 @@ if (is_ajax() === true) { ], 'search_button_class' => 'sub filter float-right', 'form' => [ + 'class' => 'filter-table-adv', 'inputs' => [ [ 'label' => __('Agents'), @@ -207,13 +208,23 @@ if ($migrate_malformed === true) { } // Header. -ui_print_page_header( +ui_print_standard_header( __('Scheduled Downtime'), 'images/gm_monitoring.png', false, '', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Tools'), + ], + [ + 'link' => '', + 'label' => __('Scheduled Downtime'), + ], + ], ); $id_downtime = (int) get_parameter('id_downtime', 0); @@ -308,34 +319,8 @@ $filter_params['module_name'] = $module_name; $filter_params_str = http_build_query($filter_params); -// Table filter. -$table_form = new StdClass(); -$table_form->class = 'databox filters'; -$table_form->width = '100%'; -$table_form->rowstyle = []; -$table_form->cellstyle[0] = ['width: 100px;']; -$table_form->cellstyle[1] = ['width: 100px;']; -$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; -$table_form->cellstyle[2] = ['width: 100px;']; -$table_form->cellstyle[3] = ['text-align: right;']; -$table_form->colspan[3][0] = 3; -$table_form->data = []; - -$row = []; - -// Search text. -$row[] = __('Search'); - -$row[] = html_print_input_text( - 'search_text', - $search_text, - '', - 50, - 250, - true -); -// Dates. -$date_inputs = __('From').' '.html_print_input_text( +// From/To inputs. +$date_inputs = html_print_input_text( 'date_from', $date_from, '', @@ -343,8 +328,8 @@ $date_inputs = __('From').' '.html_print_input_text( 10, true ); -$date_inputs .= '  '; -$date_inputs .= __('To').' '.html_print_input_text( +$date_inputs .= ' '.__('To').' '; +$date_inputs .= html_print_input_text( 'date_to', $date_to, '', @@ -352,11 +337,6 @@ $date_inputs .= __('To').' '.html_print_input_text( 10, true ); -$row[] = $date_inputs; - -$table_form->data[] = $row; - -$row = []; // Execution type. $execution_type_fields = [ @@ -364,29 +344,6 @@ $execution_type_fields = [ 'periodically' => __('Periodically'), 'cron' => __('Cron'), ]; -$row[] = __('Execution type'); -$row[] = html_print_select( - $execution_type_fields, - 'execution_type', - $execution_type, - '', - __('Any'), - '', - true, - false, - false -); -// Show past downtimes. -$row[] = __('Show past downtimes').'    '.html_print_switch( - [ - 'name' => 'archived', - 'value' => $show_archived, - ] -); - -$table_form->data[] = $row; - -$row = []; // Agent. $params = []; @@ -397,36 +354,89 @@ $params['return'] = true; $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_value'] = $agent_id; -$row[] = __('Agent'); -$row[] = ui_print_agent_autocomplete_input($params); -// Module. -$row[] = __('Module').' '.html_print_autocomplete_modules( - 'module_name', - $module_name, - false, - true, - '', - [], - true -); - -$table_form->data[] = $row; - -$row = []; - -$row[] = html_print_submit_button( +// Table filter. +$table_form = new stdClass(); +$table_form->class = 'filter-table-adv'; +$table_form->id = 'filter_scheduled_downtime'; +$table_form->width = '100%'; +$table_form->rowstyle = []; +$table_form->cellstyle[0] = ['width: 100px;']; +$table_form->cellstyle[1] = ['width: 100px;']; +$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; +$table_form->cellstyle[2] = ['width: 100px;']; +$table_form->cellstyle[3] = ['text-align: right;']; +$table_form->data = []; +// Search text. +$table_form->data[0][] = html_print_label_input_block( __('Search'), - 'search', - false, - [ - 'icon' => 'search', - 'mode' => 'mini', - ], - true + html_print_input_text( + 'search_text', + $search_text, + '', + 50, + 250, + true + ) +); +// From / To. +$table_form->data[0][] = html_print_label_input_block( + __('Between dates'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => $date_inputs, + ], + true + ) +); +// Show past downtimes. +$table_form->data[0][] = html_print_label_input_block( + __('Show past downtimes'), + html_print_switch( + [ + 'name' => 'archived', + 'value' => $show_archived, + ] + ) +); +// Execution type. +$table_form->data[1][] = html_print_label_input_block( + __('Execution type'), + html_print_select( + $execution_type_fields, + 'execution_type', + $execution_type, + '', + __('Any'), + '', + true, + false, + false + ) +); + +$table_form->data[1][] = html_print_label_input_block( + __('Agent'), + ui_print_agent_autocomplete_input($params) +); + +$table_form->data[1][] = html_print_label_input_block( + __('Module'), + html_print_autocomplete_modules( + 'module_name', + $module_name, + false, + true, + '', + [], + true, + 0, + 30, + true + ) ); -$table_form->data[] = $row; // End of table filter. // Useful to know if the user has done a form filtering. $filter_performed = false; @@ -629,41 +639,86 @@ if ($downtimes === false && $filter_performed === false) { // No downtimes cause the user performed a search. // Filter form. echo '
    '; - html_print_table($table_form); + $outputTable = html_print_table($table_form, true); + $outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true + ); + ui_toggle( + $outputTable, + ''.__('Filters').'', + __('Filters'), + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); echo '
    '; // Info message. - echo '
    '.__('No scheduled downtime').'
    '; + ui_print_info_message(__('No scheduled downtime')); // Create button. if ($write_permisson === true) { echo '
    '; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Create'), - 'create', - false, - ['icon' => 'next'], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'next'], + true + ) ); echo '
    '; } } else { // Has downtimes. echo '
    '; - html_print_table($table_form); + $outputTable = html_print_table($table_form, true); + $outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Search'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true + ); + ui_toggle( + $outputTable, + ''.__('Filters').'', + __('Filters'), + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); echo '
    '; - ui_pagination( - $downtimes_number, - $url_list.'&'.$filter_params_str, - $offset - ); - // User groups with AR, AD or AW permission. $groupsAD = users_get_groups($config['id_user'], $access); $groupsAD = array_keys($groupsAD); @@ -762,17 +817,17 @@ if ($downtimes === false && $filter_performed === false) { $settings = [ 'url' => ui_get_full_url('ajax.php', false, false, false), 'loadingText' => __('Loading, this operation might take several minutes...'), - 'title' => __('Agents / Modules affected'), + 'title' => __('Elements affected'), 'id' => $downtime['id'], ]; $data['agents_modules'] = ''; $data['agents_modules'] .= html_print_image( - 'images/search_big.png', + 'images/details.svg', true, [ 'title' => __('Agents and modules affected'), - 'style' => 'width:22px; height: 22px;', + 'class' => 'main_menu_icon invert_filter', ] ); $data['agents_modules'] .= ''; @@ -789,15 +844,21 @@ if ($downtimes === false && $filter_performed === false) { $url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $data['stop'] = ''; $data['stop'] .= html_print_image( - 'images/cancel.png', + 'images/fail@svg.svg', true, - ['title' => __('Stop downtime')] + [ + 'title' => __('Stop downtime'), + 'class' => 'main_menu_icon invert_filter', + ] ); } else { $data['stop'] = html_print_image( - 'images/cancel.png', + 'images/fail@svg.svg', true, - ['title' => __('Stop downtime')] + [ + 'title' => __('Stop downtime'), + 'class' => 'main_menu_icon invert_filter', + ] ); } } else { @@ -812,11 +873,11 @@ if ($downtimes === false && $filter_performed === false) { // Copy. $data['copy'] = ''; $data['copy'] .= html_print_image( - 'images/copy.png', + 'images/copy.svg', true, [ 'title' => __('Copy'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['copy'] .= ''; @@ -824,11 +885,11 @@ if ($downtimes === false && $filter_performed === false) { // Edit. $data['edit'] = ''; $data['edit'] .= html_print_image( - 'images/config.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Update'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['edit'] .= ''; @@ -837,11 +898,11 @@ if ($downtimes === false && $filter_performed === false) { $url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $data['delete'] = ''; $data['delete'] .= html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'title' => __('Delete'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['delete'] .= ''; @@ -858,22 +919,22 @@ if ($downtimes === false && $filter_performed === false) { // Copy. $data['copy'] = ''; $data['copy'] .= html_print_image( - 'images/copy.png', + 'images/copy.svg', true, [ 'title' => __('Copy'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['copy'] .= ''; // Edit. $data['edit'] = ''; $data['edit'] .= html_print_image( - 'images/config.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Update'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['edit'] .= ''; @@ -910,44 +971,47 @@ if ($downtimes === false && $filter_performed === false) { } html_print_table($table); - ui_pagination( + $tablePagination = ui_pagination( $downtimes_number, $url_list.'&'.$filter_params_str, $offset, 0, - false, - 'offset', true, - 'pagination-bottom' + 'offset', + false ); - echo '
    '; - - // CSV export button. - echo '
    '; - html_print_button( - __('Export to CSV'), - 'csv_export', - false, - 'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'', - 'class="sub next"' - ); - echo '
    '; - + $actionsButtons = ''; // Create button. if ($write_permisson === true) { - echo ' '; - echo '
    '; - html_print_submit_button( + $actionsButtons .= ''; + $actionsButtons .= html_print_submit_button( __('Create'), 'create', false, - 'class="sub next"' + ['icon' => 'next'], + true ); - echo '
    '; + $actionsButtons .= ''; } - echo '
    '; + // CSV export button. + $actionsButtons .= html_print_button( + __('Export to CSV'), + 'csv_export', + false, + 'blockResubmit($(this)); location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', + [ + 'icon' => 'load', + 'mode' => 'secondary', + ], + true + ); + + html_print_action_buttons( + $actionsButtons, + [ 'right_content' => $tablePagination ] + ); } ui_require_jquery_file( From f5daa72c6b603f3f622dfeae10532ed2b7b2ec3c Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 8 Mar 2023 15:04:07 +0100 Subject: [PATCH 33/42] Scheduled downtime --- .../agentes/planned_downtime.editor.php | 58 ++----------------- 1 file changed, 4 insertions(+), 54 deletions(-) diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index b0925a787a..32fdcac6be 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -29,8 +29,6 @@ global $config; - - check_login(); $agent_d = check_acl($config['id_user'], 0, 'AD'); @@ -1288,54 +1286,6 @@ $table->data[6][0] = html_print_div( true ); -// $table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); -/* - $table->data[1][0] = __('Available agents'); - $table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;'); -*/ -/* - $table->rowid[2] = 'available_modules_selection_mode'; - - $table->data[2][1] = html_print_select( - [ - 'common' => __('Show common modules'), - 'all' => __('Show all modules'), - ], - 'modules_selection_mode', - 'common', - false, - '', - '', - true, - false, - true, - '', - false, - 'min-width:180px;' - ); - - - $table->rowid[3] = 'available_modules'; - $table->data[3][0] = __('Available modules:').ui_print_help_tip( - __('Only for type Quiet for downtimes.'), - true - ); - - $table->data[3][1] = html_print_select( - [], - 'module[]', - '', - '', - '', - 0, - true, - true, - true, - '', - false, - 'min-width: 250px;width: 70%;' - ); -*/ // Print agent table. if ($id_downtime > 0) { echo "
    "; @@ -1779,13 +1729,13 @@ function insert_downtime_agent($id_downtime, $user_groups_ad) switch ($("#type_downtime").val()) { case 'disable_agents_alerts': case 'disable_agents': - $("#available_modules").hide(); - $("#available_modules_selection_mode").hide(); + $(".available_modules").hide(); + $(".available_modules_selection_mode").hide(); break; case 'quiet': case 'disable_agent_modules': - $("#available_modules_selection_mode").show(); - $("#available_modules").show(); + $(".available_modules_selection_mode").show(); + $(".available_modules").show(); break; } } From 0304c1f18e4d7e910699803df86f01b496e1cf75 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 8 Mar 2023 15:23:42 +0100 Subject: [PATCH 34/42] Calendar CSS styles --- pandora_console/include/styles/js/calendar.css | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/styles/js/calendar.css b/pandora_console/include/styles/js/calendar.css index 73315cf0e3..c5473e3199 100644 --- a/pandora_console/include/styles/js/calendar.css +++ b/pandora_console/include/styles/js/calendar.css @@ -6,7 +6,7 @@ /* Calendar background */ table.scw { - background-color: #82b92e; + background-color: var(--secondary-color); border: 0 !important; border-radius: 4px; } @@ -65,3 +65,19 @@ td.scwFoot { color: #3c3c3c !important; border: 0 !important; } + +.scwHead input { + line-height: 6px; + padding-left: 5px; + background-color: #000; + color: #cccccc; +} + +.scwHead input:hover { + background-color: #cccccc; + color: #000; +} + +table.scw { + border: 2px solid #c0ccdc; +} From 87e82c04105e6ff33589f1bd985a7b49c21dc82e Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 8 Mar 2023 15:30:48 +0100 Subject: [PATCH 35/42] 10457-Audit log, save/load filters --- pandora_console/include/ajax/audit_log.php | 41 ++++++++++++------- .../include/class/AuditLog.class.php | 4 +- pandora_console/include/styles/pandora.css | 37 +++++++++++++++++ pandora_console/include/styles/tables.css | 4 -- 4 files changed, 66 insertions(+), 20 deletions(-) diff --git a/pandora_console/include/ajax/audit_log.php b/pandora_console/include/ajax/audit_log.php index 3bf5e09d24..4d92704852 100644 --- a/pandora_console/include/ajax/audit_log.php +++ b/pandora_console/include/ajax/audit_log.php @@ -135,18 +135,15 @@ if ($load_filter_modal) { $table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; - $table->class = 'databox'; + $table->class = 'databox no_border'; if (is_metaconsole()) { $table->cellspacing = 0; $table->cellpadding = 0; - $table->class = 'databox filters'; + $table->class = 'databox filters no_border'; } $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; - $filter_id_width = '200px'; - if (is_metaconsole()) { - $filter_id_width = '150px'; - } + $filter_id_width = 'w100p'; $data = []; $table->rowid[3] = 'update_filter_row1'; @@ -165,11 +162,17 @@ if ($load_filter_modal) { false, 'margin-left:5px; width:'.$filter_id_width.';' ); + + $table->rowclass[] = 'display-grid'; $data[1] = html_print_submit_button( __('Load filter'), 'load_filter', false, - 'class="sub upd" onclick="load_filter_values()"', + [ + 'class' => 'mini w25p', + 'style' => 'margin-left: 73%', + 'onclick' => 'load_filter_values();', + ], true ); $data[1] .= html_print_input_hidden('load_filter', 1, true); @@ -186,7 +189,7 @@ function show_filter() { draggable: true, modal: false, closeOnEscape: true, - width: 450 + width: 500 }); } @@ -238,7 +241,7 @@ $(document).ready (function() { if ($save_filter_modal) { - echo '
    '; + echo '
    '; if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) { echo '
    '; @@ -247,9 +250,9 @@ if ($save_filter_modal) { $table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; - $table->class = 'databox'; + $table->class = 'databox no_border'; if (is_metaconsole()) { - $table->class = 'databox filters'; + $table->class = 'databox filters no_border'; $table->cellspacing = 0; $table->cellpadding = 0; } @@ -289,7 +292,11 @@ if ($save_filter_modal) { __('Save filter'), 'save_filter', false, - 'class="sub wand" onclick="save_new_filter();"', + [ + 'class' => 'mini w25p', + 'style' => 'margin-left: 56%', + 'onclick' => 'save_new_filter();', + ], true ); @@ -317,11 +324,16 @@ if ($save_filter_modal) { 0, true ); + $table->rowclass[] = 'display-grid'; $data[1] = html_print_submit_button( __('Update filter'), 'update_filter', false, - 'class="sub upd" onclick="save_update_filter();"', + [ + 'class' => 'mini w25p', + 'style' => 'margin-left: 56%', + 'onclick' => 'save_update_filter();', + ], true ); @@ -359,7 +371,8 @@ function show_save_filter() { resizable: true, draggable: true, modal: false, - closeOnEscape: true + closeOnEscape: true, + width: 380 }); } diff --git a/pandora_console/include/class/AuditLog.class.php b/pandora_console/include/class/AuditLog.class.php index 31120b7014..93f391ee73 100644 --- a/pandora_console/include/class/AuditLog.class.php +++ b/pandora_console/include/class/AuditLog.class.php @@ -437,7 +437,7 @@ class AuditLog extends HTML $('#audit_logs').css('width','95% !important'); }); - $('#save-filter').click(function() { + $('#button-save-filter').click(function() { if ($('#save-filter-select').length) { $('#save-filter-select').dialog({ width: "20%", @@ -495,7 +495,7 @@ class AuditLog extends HTML }); /* Filter management */ - $('#load-filter').click(function (){ + $('#button-load-filter').click(function (){ if($('#load-filter-select').length) { $('#load-filter-select').dialog({width: "20%", maxWidth: "25%", diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 4837f18d08..ee4a24d5f5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -86,6 +86,43 @@ font-weight: 900; } +/* +@font-face { + font-family: "lato-italic"; + src: url("../fonts/Lato-Italic.woff") format("woff"); + font-weight: 400; + font-style: italic; +} + +@font-face { + font-family: "lato"; + src: url("../fonts/Lato-LightItalic.woff") format("woff"); + font-weight: 300; + font-style: italic; +} + +@font-face { + font-family: "lato"; + src: url("../fonts/Lato-ThinItalic.woff") format("woff"); + font-weight: 100; + font-style: italic; +} + +@font-face { + font-family: "lato"; + src: url("../fonts/Lato-BoldItalic.woff") format("woff"); + font-weight: 700; + font-style: italic; +} + +@font-face { + font-family: "lato"; + src: url("../fonts/Lato-BlackItalic.woff") format("woff"); + font-weight: 900; + font-style: italic; +} +*/ + @font-face { font-family: "source-code"; src: url("../fonts/SourceCodePro.woff") format("woff"); diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 4383e02ea5..4ff2775884 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -648,10 +648,6 @@ td#save_filter_form-1-0 > b { line-height: 16px; } -tr#save_filter_row1 { - display: flex !important; -} - td#save_filter_form-0-0, td#save_filter_form-0-1, td#save_filter_form-1-0 > input#text-id_name, From 63ecb7eb0be6fd088d5ad2ab194d1294e273a3d8 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Mar 2023 15:45:18 +0100 Subject: [PATCH 36/42] Tree view metaconsole view like nodo --- .../include/functions_treeview.php | 2 +- .../include/graphs/functions_flot.php | 2 +- pandora_console/operation/tree.php | 22 +++---------------- pandora_console/pandoradb.sql | 14 ++++++++++++ 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index e86c728fa7..e93910ec15 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -588,7 +588,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) $hashdata = md5($hashdata); if ((bool) $grants_on_node === true && (bool) $user_access_node !== false) { - $urlAgent = 'sendHash(\''.$server_data['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'\')'; + $urlAgent = $server_data['server_url'].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente']; } else { $urlAgent = ''; } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 4c5811b746..dc32be4b9b 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -855,7 +855,7 @@ function flot_slicesbar_graph( $full_legend_date = false; } - if (!$date_to) { + if (!$date_to || $date_to === '1') { $date_to = get_system_time(); } diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index 0054361e07..25b696a69e 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -27,11 +27,7 @@ */ // Begin. -if (is_metaconsole() === true) { - ui_require_css_file('tree_meta'); -} else { - ui_require_css_file('tree'); -} +ui_require_css_file('tree'); ui_require_css_file('fixed-bottom-box'); @@ -168,10 +164,6 @@ switch ($tab) { break; } -if (is_metaconsole() === true) { - $tabs = []; -} - if (!$strict_acl) { $header_title = $header_title.' » '.$header_sub_title; } @@ -373,11 +365,7 @@ html_print_input_hidden('tag-id', $tag_id); ui_include_time_picker(); ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); -if (is_metaconsole() === true) { - ui_require_javascript_file('TreeControllerMeta', 'include/javascript/tree/'); -} else { - ui_require_javascript_file('TreeController', 'include/javascript/tree/'); -} +ui_require_javascript_file('TreeController', 'include/javascript/tree/'); ui_print_spinner(__('Loading')); @@ -388,10 +376,6 @@ html_print_div( ] ); -if (is_metaconsole() === true) { - echo '
    '; -} - $infoHeadTitle = 'Sombra oscura'; ?> @@ -505,7 +489,7 @@ $infoHeadTitle = 'Sombra oscura'; emptyMessage: "", foundMessage: foundMessage, tree: data.tree, - baseURL: "", + baseURL: "", ajaxURL: "", filter: parameters['filter'], counterTitles: { diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 33bec21130..bfcb4d1582 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -4206,3 +4206,17 @@ CREATE TABLE `tevent_sound` ( `sound` TEXT NULL, `active` TINYINT NOT NULL DEFAULT '1', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- --------------------------------------------------------------------- +-- Table `tsesion_filter` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tsesion_filter` ( + `id_filter` INT NOT NULL AUTO_INCREMENT, + `id_name` TEXT NULL, + `text` TEXT NULL, + `period` TEXT NULL, + `ip` TEXT NULL, + `type` TEXT NULL, + `user` TEXT NULL, + PRIMARY KEY (`id_filter`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file From 434aa1dbc38147c47af2fd49d2383787449bf0fe Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Mar 2023 15:57:55 +0100 Subject: [PATCH 37/42] z-index fix on buttons and mesage --- pandora_console/include/functions_html.php | 2 +- pandora_console/include/styles/pandora.css | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index b120b4d128..5d6f413573 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -3477,7 +3477,7 @@ function html_print_action_buttons(mixed $content, array $parameters=[], bool $r 'id' => ($parameters['id'] ?? 'principal_action_buttons'), 'class' => 'action-buttons '.$typeClass.' '.($parameters['class'] ?? ''), 'content' => $content, - 'style' => 'z-index: 1', + 'style' => 'z-index: 6', ], $return ); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 8c2768f356..f694d788c6 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -2109,6 +2109,10 @@ table.rounded_cells td { z-index: 5; } +#principal_action_buttons { + z-index: 6; +} + .action-buttons > button { margin-left: 16px; } @@ -2790,7 +2794,7 @@ td.cellBig { } .info_box_container:not(.info_box_information) { - z-index: 2; + z-index: 6; } .info_box_container.info_box_information { From 72990ab177c008d424b738022cf91873865a735a Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 8 Mar 2023 16:41:26 +0100 Subject: [PATCH 38/42] #9662 Fixed pandora black --- pandora_console/include/styles/menu.css | 4 +- .../include/styles/pandora_black.css | 87 +++++++++++++++++-- 2 files changed, 80 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/styles/menu.css b/pandora_console/include/styles/menu.css index db1eebb9da..b8085838bb 100644 --- a/pandora_console/include/styles/menu.css +++ b/pandora_console/include/styles/menu.css @@ -598,7 +598,7 @@ ul li { display: flex; align-items: center; justify-content: space-evenly; - min-height: 53px; + min-height: 50px; } .tabs_li { @@ -637,7 +637,7 @@ ul li { } .tabs_collapsed { - height: 53px; + height: 50px; display: flex; justify-content: center; align-items: center; diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index b09d441686..da9f58a9de 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -67,11 +67,22 @@ table.agent_info_table tr { color: #fff !important; } -div#head, -#menu_tabs { +div#head { border-bottom: 1px solid #1a1a1a; } +.menu_full_classic #menu_tabs { + height: 49px; + border-bottom: 1px solid #82b92e; + padding-bottom: 2px; +} + +.menu_full_collapsed #menu_tabs { + height: 49px; + border-bottom: 1px solid #82b92e; + padding-bottom: 1px; +} + #menu_full { border-right: 1px solid #111; } @@ -248,13 +259,10 @@ ol.steps li a { /* Tabs icons change color */ /* menu.css */ -.operation { - background-color: #252525; -} - +.operation, .godmode, #menu_full { - background-color: #1a1a1a; + background-color: #222; } .button_collapse { @@ -264,11 +272,72 @@ ol.steps li a { .operation .selected, .godmode .selected, .menu_icon:hover { - background-color: #080808; + background-color: #191919; +} + +.submenu_text, +.span_has_menu_text, +.title_menu_classic span { + font-size: 14px; + font-weight: normal; + letter-spacing: -0.3px; + height: 18px; + color: #fff; +} + +.head_tab_selected span { + color: #fff; +} + +.tabs_selected { + background-color: #1d7874; +} + +.operation .menu_icon ul.submenu > li, +.godmode .menu_icon ul.submenu > li { + background-color: #222; + padding-left: 24px !important; +} + +.submenu_not_selected:hover { + background-color: #171717 !important; + color: #fff !important; +} + +.submenu_selected { + margin-bottom: 0px; + background-color: #171717 !important; +} + +.submenu_selected_no_submenu { + background-color: #111 !important; + color: #ffffff !important; } .sub_subMenu { - background-color: #343434; + font-weight: normal; + background-color: #171717; + padding-left: 1.5em; + color: #fff !important; +} + +.sub_subMenu.selected { + font-weight: 600; + background-color: #111 !important; +} + +.sub_subMenu:hover { + background-color: #141414; +} + +.sub_subMenu.selected a { + color: #fff !important; +} + +.span_has_menu_text { + font-weight: normal; + font-size: 9.4pt; + color: #fff; } /* footer */ From 54e6a99cc3c0ca65593a71a7e1b1aa0c6fab1749 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Mar 2023 17:09:42 +0100 Subject: [PATCH 39/42] Dashboard pagination visual position --- pandora_console/include/styles/pandora.css | 3 +++ pandora_console/views/dashboard/listWidgets.php | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f694d788c6..43e66868bd 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -7535,6 +7535,9 @@ div.graph div.legend table { .pdd_t_0px { padding-top: 0px; } +.pdd_t_0px_important { + padding-top: 0px !important; +} .pdd_t_3px { padding-top: 3px; diff --git a/pandora_console/views/dashboard/listWidgets.php b/pandora_console/views/dashboard/listWidgets.php index c7cac752f0..5ce90af8c7 100644 --- a/pandora_console/views/dashboard/listWidgets.php +++ b/pandora_console/views/dashboard/listWidgets.php @@ -48,6 +48,7 @@ $inputs = [ 'class' => 'search_input', 'autofocus' => true, ], + 'class' => 'pdd_t_0px_important', ], ]; @@ -58,9 +59,8 @@ HTML::printForm( ] ); -ui_pagination($total, '#', $offset, 9); -$output = '
    '; +$output = '
    '; foreach ($widgets as $widget) { $urlWidgets = $config['homedir']; @@ -97,3 +97,5 @@ foreach ($widgets as $widget) { $output .= '
    '; echo $output; + +ui_pagination($total, '#', $offset, 9, false, 'offset', false, 'center mrgn_top_10px'); From bb1d9c323d4772ba05cd5e51a281ab578453569a Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Wed, 8 Mar 2023 17:12:15 +0100 Subject: [PATCH 40/42] Admin tools --- pandora_console/godmode/setup/links.php | 98 +++++++++++++------ .../include/class/Diagnostics.class.php | 14 ++- .../include/styles/diagnostics.css | 4 +- pandora_console/include/styles/omnishell.css | 16 --- 4 files changed, 78 insertions(+), 54 deletions(-) diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index f1a5e9fca2..7bd589fe27 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -25,7 +25,20 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user } // Header -ui_print_page_header(__('Link management'), 'images/extensions.png', false, '', true, ''); +ui_print_standard_header( + __('Admin tools'), + 'images/extensions.png', + false, + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Link management'), + ], + ] +); if (isset($_POST['create'])) { @@ -98,7 +111,7 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { $link = ''; } - echo ''; + echo '
    '; echo ''; if ($creation_mode == 1) { echo ""; @@ -112,17 +125,42 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { } echo "'>"; - echo ' - - '; - echo ' - - '; - echo ''; + echo ''; + echo ''; + echo ''; echo '
    '.__('Link name').'
    '.__('Link').' -
    '; + echo html_print_label_input_block( + __('Link name'), + html_print_input_text( + 'name', + $nombre, + '', + 50, + 255, + true, + false, + true, + '', + 'text_input' + ) + ); + echo ''; + echo html_print_label_input_block( + __('Link'), + html_print_input_text( + 'link', + $link, + '', + 50, + 255, + true, + false, + true, + '', + 'text_input' + ) + ); + echo '
    '; - echo ""; - echo "
    "; if (isset($_GET['form_add']) === true) { $actionForPerform = __('Create'); $iconForPerform = 'wand'; @@ -131,16 +169,14 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { $iconForPerform = 'update'; } - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - $actionForPerform, - 'crtbutton', - false, - [ 'icon' => $iconForPerform ] - ), - ], + html_print_action_buttons( + html_print_submit_button( + $actionForPerform, + 'crtbutton', + false, + [ 'icon' => $iconForPerform ], + true + ) ); echo '
    '; @@ -185,16 +221,14 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { echo ""; echo "
    "; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Add'), - 'form_add', - false, - [ 'icon' => 'wand' ] - ), - ], + html_print_action_buttons( + html_print_submit_button( + __('Add'), + 'form_add', + false, + [ 'icon' => 'wand' ], + true + ) ); echo '
    '; diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 02bec5060d..f7a660f2c4 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -155,13 +155,19 @@ class Diagnostics extends Wizard ]; // Header. - ui_print_page_header( - __('%s Diagnostic tool', $this->product_name), + ui_print_standard_header( + __('Admin tools'), 'images/gm_massive_operations.png', false, '', true, - $header_buttons + $header_buttons, + [ + [ + 'link' => '', + 'label' => __('%s Diagnostic tool', $this->product_name), + ], + ] ); // Print all Methods Diagnostic Info. @@ -1569,7 +1575,7 @@ class Diagnostics extends Wizard [ 'id' => $tableId, 'class' => 'info_table caption_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $columnNames, 'ajax_data' => [ diff --git a/pandora_console/include/styles/diagnostics.css b/pandora_console/include/styles/diagnostics.css index 6591adabff..706038cbd0 100644 --- a/pandora_console/include/styles/diagnostics.css +++ b/pandora_console/include/styles/diagnostics.css @@ -8,8 +8,8 @@ text-align: center; font-size: 1.5em; font-weight: bolder; - color: #fff; - background: #282828; + color: #000; + background: var(--secondary-color); padding: 8px; } diff --git a/pandora_console/include/styles/omnishell.css b/pandora_console/include/styles/omnishell.css index 03810e9a89..7d97fdd866 100644 --- a/pandora_console/include/styles/omnishell.css +++ b/pandora_console/include/styles/omnishell.css @@ -489,14 +489,6 @@ li > .select2-selection { padding: 0px !important; } -.box-flat { - margin: 20px; -} - -.mrgn_20px { - margin: 20px !important; -} - .omnishell_results_wrapper { max-width: 100% !important; } @@ -547,10 +539,6 @@ ul.datatable_filter > li > div.action-buttons > button { height: auto !important; } -.action_buttons_right_content { - padding-left: 20px; -} - #image-1, #image-2 { padding-left: 0px !important; @@ -560,10 +548,6 @@ ul.datatable_filter > li > div.action-buttons > button { margin-bottom: 10px !important; } -.dataTables_length { - margin-bottom: 50px !important; -} - .item_status_tree_view { position: initial; } From e21d9968e818e2015fb6088f5fd3511b503402b7 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 8 Mar 2023 19:25:25 +0100 Subject: [PATCH 41/42] fixed styles --- pandora_console/general/header.php | 4 - .../godmode/agentes/module_manager.php | 216 ------------------ .../agentes/module_manager_editor_common.php | 8 +- pandora_console/include/class/HTML.class.php | 2 +- pandora_console/include/functions_ui.php | 4 +- pandora_console/include/styles/pandora.css | 3 +- pandora_console/index.php | 4 + 7 files changed, 13 insertions(+), 228 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index c4915e366d..81526eb129 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -471,10 +471,6 @@ echo sprintf('
    ', $menuTypeClass);
    - - - - diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 1c6cd62be4..fe27bf4bb1 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -34,7 +34,6 @@ $url = sprintf( $url_id_agente ); -enterprise_include('godmode/agentes/module_manager.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_agents.php'; @@ -51,196 +50,10 @@ if (isset($policy_page) === false) { $checked = (bool) get_parameter('checked'); $sec2 = (string) get_parameter('sec2'); -// Table for filter bar. -$filterTable = new stdClass(); -$filterTable->class = 'fixed_filter_bar'; -$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 === 'true'), - 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 '
    '; -html_print_table($filterTable); -echo '
    '; -// Check if there is at least one server of each type available to assign that -// kind of modules. If not, do not show server type in combo. -$network_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_NETWORK -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$wmi_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_WMI -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$plugin_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_PLUGIN -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$prediction_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_PREDICTION -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$web_available = db_get_sql( - 'SELECT count(*) -FROM tserver -WHERE server_type = '.SERVER_TYPE_WEB -); -// POSTGRESQL AND ORACLE COMPATIBLE. -// Development mode to use all servers. -if ($develop_bypass || is_metaconsole()) { - $network_available = 1; - $wmi_available = 1; - $plugin_available = 1; - // FIXME when prediction predictions server modules can be configured. - // on metaconsole. - $prediction_available = (is_metaconsole() === true) ? 0 : 1; -} - -$modules = []; -$modules['dataserver'] = __('Create a new data server module'); -if ($network_available) { - $modules['networkserver'] = __('Create a new network server module'); -} - -if ($plugin_available) { - $modules['pluginserver'] = __('Create a new plugin server module'); -} - -if ($wmi_available) { - $modules['wmiserver'] = __('Create a new WMI server module'); -} - -if ($prediction_available) { - $modules['predictionserver'] = __('Create a new prediction server module'); -} - -if (is_metaconsole() === true || $web_available >= '1') { - $modules['webserver'] = __('Create a new web Server module'); -} - -if (enterprise_installed() === true) { - set_enterprise_module_types($modules); -} - -if (strstr($sec2, 'enterprise/godmode/policies/policies') !== false) { - // It is unset because the policies haven't a table tmodule_synth and the - // some part of code to apply this kind of modules in policy agents. - // But in the future maybe will be good to make this feature, but remember - // the modules to show in syntetic module policy form must be the policy - // modules from the same policy. - unset($modules['predictionserver']); - if (enterprise_installed() === true) { - unset($modules['webux']); - } -} - -if (($policy_page === true) || (isset($agent) === true)) { - if ($policy_page === true) { - $show_creation = is_management_allowed(); - } else { - if (isset($all_groups) === false) { - $all_groups = agents_get_all_groups_agent( - $agent['id_agente'], - $agent['id_grupo'] - ); - } - - $show_creation = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true; - } -} else { - $show_creation = false; -} - -if ($show_creation === true) { - // Create module/type combo. - $tableCreateModule = new stdClass(); - $tableCreateModule->id = 'create'; - $tableCreateModule->class = 'create_module_dialog'; - $tableCreateModule->width = '100%'; - $tableCreateModule->data = []; - $tableCreateModule->style = []; - - $tableCreateModule->data['caption_type'] = html_print_input_hidden('edit_module', 1); - $tableCreateModule->data['caption_type'] .= __('Type'); - $tableCreateModule->data['type'] = html_print_select( - $modules, - 'moduletype', - '', - '', - '', - '', - true, - false, - false, - '', - false, - 'width:380px;' - ); - - // Link for get more modules. - if ((bool) $config['disable_help'] === false) { - $tableCreateModule->data['get_more_modules'] = html_print_anchor( - [ - 'href' => 'https://pandorafms.com/Library/Library/', - 'target' => '_blank', - 'class' => 'color-black-grey', - 'content' => __('Get more modules on Monitoring Library'), - ], - true - ); - } -} - if (isset($id_agente) === false) { return; } - $module_action = (string) get_parameter('module_action'); if ($module_action === 'delete') { @@ -1256,35 +1069,6 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr [ 'type' => 'data_table' ] ); echo ''; - - - $modalCreateModule = '
    '; - $modalCreateModule .= html_print_table($tableCreateModule, true); - $modalCreateModule .= html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Create'), - 'create_module', - false, - [ - 'icon' => 'next', - 'mode' => 'mini secondary', - ], - true - ), - ], - true - ); - $modalCreateModule .= '
    '; - - html_print_div( - [ - 'id' => 'modal', - 'style' => 'display: none', - 'content' => $modalCreateModule, - ] - ); } ?> diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index aba3daf8f4..085afcb455 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -444,7 +444,7 @@ $tableBasicThresholds->data = []; $tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').' '; -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) { +if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_warning_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text( 'min_warning', @@ -482,7 +482,7 @@ if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeM ); } -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) { +if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalWarning = []; $basicThresholdsIntervalWarning[] = ''.__('Inverse interval').''; $basicThresholdsIntervalWarning[] = html_print_checkbox_switch( @@ -531,7 +531,7 @@ $tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div( $tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').' '; -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) { +if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_critical_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text( 'min_critical', @@ -569,7 +569,7 @@ if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeM ); } -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) { +if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalCritical = []; $basicThresholdsIntervalCritical[] = ''.__('Inverse interval').''; $basicThresholdsIntervalCritical[] = html_print_checkbox_switch( diff --git a/pandora_console/include/class/HTML.class.php b/pandora_console/include/class/HTML.class.php index a8f7c54985..ca74f7dc46 100644 --- a/pandora_console/include/class/HTML.class.php +++ b/pandora_console/include/class/HTML.class.php @@ -544,7 +544,7 @@ class HTML 'container_class' => $input['toggle_container_class'], 'img_a' => $input['toggle_img_a'], 'img_b' => $input['toggle_img_b'], - 'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true), + 'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : false), ] ); } else { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ae8fbb4a84..166166518f 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -4519,8 +4519,8 @@ function ui_print_toggle($data) (isset($data['toggle_class']) === true) ? $data['toggle_class'] : '', (isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content', (isset($data['main_class']) === true) ? $data['main_class'] : 'box-flat white_table_graph', - (isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png', - (isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png', + (isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow@svg.svg', + (isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow@svg.svg', (isset($data['clean']) === true) ? $data['clean'] : false, (isset($data['reverseImg']) === true) ? $data['reverseImg'] : false, (isset($data['switch']) === true) ? $data['switch'] : false, diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 43e66868bd..e2afb9534a 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -297,6 +297,7 @@ td input[type="checkbox"] { padding: 10px; margin-top: 2px; display: table-cell; + height: 15px; } input[type="image"] { @@ -4816,7 +4817,7 @@ div#dialog_messages table th:last-child { z-index: 900000; position: absolute; width: 550px; - margin-top: -5px; + margin-top: 55px; border-radius: 5px; } diff --git a/pandora_console/index.php b/pandora_console/index.php index a78d97d926..ccf64a9841 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1169,6 +1169,10 @@ if ($config['pure'] == 0) { $menuTypeClass = ($menuCollapsed === true) ? 'collapsed' : 'classic'; // Container. echo '
    '; + + // Notifications content wrapper + echo ''; + // Header. echo '