diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 487f1b476d..44d4bc64b6 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -397,61 +397,139 @@ function mainAgentsModules() 1 => __('Show module data'), ]; - $filter_type_label = ''.__('Information to be shown').''; - $filter_type = html_print_select($show_select, 'show_type', $show_type, '', '', 0, true, false, false, '', false, 'min-width: 180px;'); - - // Groups. - $filter_groups_label = ''.__('Group').''; - $filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;'); - - $filter_recursion_label = ''.__('Recursion').''; - $filter_recursion = html_print_checkbox('recursion', 1, 0, true).''; - // Groups module. - $filter_module_groups_label = ''.__('Module group').''; - $filter_module_groups = html_print_select_from_sql( - 'SELECT * FROM tmodule_group ORDER BY name', - 'modulegroup', - $modulegroup, - '', - __('All'), - 0, - true, - false, - true, - false, - 'width: auto;' + $filter_type = html_print_label_input_block( + __('Information to be shown'), + html_print_select( + $show_select, + 'show_type', + $show_type, + '', + '', + 0, + true, + false, + false, + '', + false, + 'width: 100%;' + ) + ); + + $filter_groups = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + 'AR', + true, + 'group_id', + $group_id, + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ) + ); + + $filter_groups .= html_print_label_input_block( + __('Recursion'), + html_print_checkbox_switch('recursion', 1, 0, true), + [ + 'div_class' => 'add-input-reverse', + 'label_class' => 'label-thin', + ] + ); + + $filter_module_groups = html_print_label_input_block( + __('Module group'), + html_print_select_from_sql( + 'SELECT * FROM tmodule_group ORDER BY name', + 'modulegroup', + $modulegroup, + '', + __('All'), + 0, + true, + false, + true, + false, + 'width: 100%;' + ) ); - // Agent. $agents = agents_get_group_agents($group_id); if ((empty($agents)) || $agents == -1) { $agents = []; } - $filter_agents_label = ''.__('Agents').''; - $filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, 'min-width: 180px; max-width: 200px;'); + $filter_agents = html_print_label_input_block( + __('Agents'), + html_print_select( + $agents, + 'id_agents2[]', + $agents_id, + '', + '', + 0, + true, + true, + true, + '', + false, + 'width: 100%;' + ) + ); // Type show. $selection = [ 0 => __('Show common modules'), 1 => __('Show all modules'), ]; - $filter_type_show_label = ''.__('Show common modules').''; - $filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', '', 0, true, false, true, '', false, 'min-width: 180px;'); + $filter_type_show = html_print_label_input_block( + __('Show common modules'), + html_print_select( + $selection, + 'selection_agent_module', + $selection_a_m, + '', + '', + 0, + true, + false, + true, + '', + false, + 'width: 100%;' + ) + ); // Modules. $all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false); - $filter_modules_label = ''.__('Module').''; - $filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, false, '', false, 'min-width: 180px; max-width: 200px;'); - - // Update. - $filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true); + $filter_modules = html_print_label_input_block( + __('Module'), + html_print_select( + $all_modules, + 'module[]', + $modules_selected, + '', + '', + 0, + true, + true, + false, + '', + false, + 'width: 100%;' + ) + ); $onheader = [ - 'updated_time' => $updated_time, - 'fullscreen' => $fullscreen, - 'combo_module_groups' => $filter_module_groups, - 'combo_groups' => $filter_groups, + 'updated_time' => $updated_time, + 'fullscreen' => $fullscreen, ]; /* @@ -467,7 +545,7 @@ function mainAgentsModules() false, '', false, - (array) $updated_time, + $onheader, [ [ 'link' => '', @@ -479,12 +557,6 @@ function mainAgentsModules() ], ] ); - - echo ''; - echo ''; - echo "'; - echo ''; - echo '
".$fullscreen['text'].'
'; } else { if ($full_agents_id[0]) { $full_modules = urlencode(implode(';', $full_modules_selected)); @@ -574,35 +646,46 @@ function mainAgentsModules() if ($config['pure'] != 1) { $show_filters = '
'; - $show_filters .= ''; + $show_filters .= '
'; $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; + $show_filters .= ''; $show_filters .= ''; $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; - $show_filters .= ''; $show_filters .= ''; - $show_filters .= ''; $show_filters .= ''; - $show_filters .= ''; $show_filters .= ''; $show_filters .= ''; - $show_filters .= ''; - $show_filters .= "'; - $show_filters .= ''; $show_filters .= '
'.$filter_type_label.''.$filter_type.''.$filter_type.''.$filter_groups.''.$filter_module_groups.'
'.$filter_groups_label.''.$filter_groups.'   '.$filter_recursion_label.$filter_recursion.''.$filter_module_groups_label.''.$filter_module_groups.'
'.$filter_agents_label.''.$filter_agents.''.$filter_type_show_label.''.$filter_type_show.''.$filter_modules_label.''.$filter_modules.'
".$filter_update.'
'; + $show_filters .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Filter'), + 'srcbutton', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true + ); $show_filters .= '
'; + ui_toggle( $show_filters, - __('Filters ').ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true) + ''.__('Filters ').''.ui_print_help_tip(__('Secondary groups and agent subgroups will be taken into account.'), true), + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); } @@ -751,11 +834,11 @@ function mainAgentsModules() return; } - echo ''; + echo '
'; echo ''; - echo "'; + echo "'; if ($hor_offset > 0) { $new_hor_offset = ($hor_offset - $block); @@ -804,7 +887,20 @@ function mainAgentsModules() // Prepare pagination. $url = 'index.php?extension_in_menu=estado&sec=extensions&sec2=extensions/agents_modules&save_serialize=1&hor_offset='.$hor_offset.'&selection_a_m='.$selection_a_m; - ui_pagination($total_pagination, $url); + $tablePagination = ui_pagination( + $total_pagination, + $url, + 0, + 0, + true, + 'offset', + false + ); + + html_print_action_buttons( + '', + [ 'right_content' => $tablePagination ] + ); foreach ($agents as $agent) { // Get stats for this group. diff --git a/pandora_console/extensions/api_checker.php b/pandora_console/extensions/api_checker.php index 6b4dcf4d72..2ffc5ef6c8 100755 --- a/pandora_console/extensions/api_checker.php +++ b/pandora_console/extensions/api_checker.php @@ -301,10 +301,21 @@ function extension_api_checker() html_print_table($table3); echo ''; - echo "
"; html_print_input_hidden('api_execute', 1); - html_print_submit_button(__('Call'), 'submit', false, 'class="sub next"'); - echo '
'; + + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Call'), + 'submit', + false, + [ 'icon' => 'next' ], + true + ), + ] + ); + echo ''; if ($api_execute === true) { diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 638d795b31..98b95783be 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -67,11 +67,20 @@ function extension_db_status() html_print_table($table); echo ''; - echo "
"; - html_print_input_hidden('db_status_execute', 1); - html_print_submit_button(__('Execute Test'), 'submit', false, 'class="sub next"'); - echo '
'; + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Execute Test'), + 'submit', + false, + [ 'icon' => 'cog' ], + true + ), + ] + ); + html_print_input_hidden('db_status_execute', 1); echo ''; if ($db_status_execute) { diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 3f36935e5c..ffcc2fdb72 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -76,10 +76,6 @@ function dbmgr_extension_main() global $config; - if (is_metaconsole() === true) { - open_meta_frame(); - } - if (!is_user_admin($config['id_user'])) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, @@ -92,7 +88,21 @@ function dbmgr_extension_main() $sql = (string) get_parameter('sql'); $node_id = (int) get_parameter('node_id', -1); - ui_print_page_header(__('Database interface'), 'images/gm_db.png', false, false, true); + // Header. + ui_print_standard_header( + __('Database interface'), + 'images/gm_db.png', + false, + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Extensions'), + ], + ] + ); if (is_metaconsole() === true) { $img = '../../images/warning_modern.png'; @@ -195,15 +205,18 @@ function dbmgr_extension_main() ); } - $data[4][2] = '
'; - $data[4][2] .= html_print_submit_button( - __('Execute SQL'), - '', - false, - 'class="sub next"', - true + $data[4][2] = html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Execute SQL'), + '', + false, + [ 'icon' => 'cog' ], + true + ), + ] ); - $data[4][2] .= '
'; $table->data = $data; html_print_table($table); @@ -282,10 +295,6 @@ function dbmgr_extension_main() html_print_table($table); echo ''; - if (is_metaconsole()) { - close_meta_frame(); - } - } diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 783e155dc4..6c75218d18 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -98,7 +98,7 @@ if (!empty($files)) { // Last modification // Public URL $data[4] = ''; - $table->cellclass[][4] = 'action_buttons'; + $table->cellclass[][4] = 'table_action_buttons'; if (!empty($file['hash'])) { $public_url = ui_get_full_url( EXTENSIONS_DIR.'/files_repo/files_repo_get_file.php?file='.$file['hash'] diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index 54306ac5d7..3ccf1af688 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -1,16 +1,32 @@ '', + 'label' => __('Resources'), + ], + [ + 'link' => '', + 'label' => __('Insert Data'), + ], + ] + ); if (! check_acl($config['id_user'], 0, 'AW') && ! is_user_admin($config['id_user'])) { db_pandora_audit( @@ -84,6 +117,13 @@ function mainInsertData() $csv = false; } + ui_print_warning_message( + sprintf( + __('Please check that the directory "%s" is writeable by the apache user.

The CSV file format is date;value<newline>date;value<newline>... The date in CSV is in format Y/m/d H:i:s.'), + $config['remote_config'] + ) + ); + if ($save) { if (!check_acl($config['id_user'], agents_get_agent_group($agent_id), 'AW')) { ui_print_error_message(__('You haven\'t privileges for insert data in the agent.')); @@ -140,27 +180,25 @@ function mainInsertData() } } - echo '
'; - echo sprintf( - __('Please check that the directory "%s" is writeable by the apache user.

The CSV file format is date;value<newline>date;value<newline>... The date in CSV is in format Y/m/d H:i:s.'), - $config['remote_config'] - ); - echo '
'; + $modules = []; + if ($agent_id > 0) { + $modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]); + } $table = new stdClass(); - $table->width = '100%'; - $table->class = 'databox filters'; + $table->class = 'databox filter-table-adv'; $table->style = []; - $table->style[0] = 'font-weight: bolder;'; - + $table->cellstyle[0][0] = 'width: 0'; + $table->cellstyle[0][1] = 'width: 0'; $table->data = []; - - $table->data[0][0] = __('Agent'); + $table->data[0][0] = ''; + $table->data[0][1] = ''; + $table->data[0][2] = ''; $params = []; $params['return'] = true; $params['show_helptip'] = true; $params['input_name'] = 'agent_name'; - $params['value'] = $agent_name; + $params['value'] = ($save === true) ? '' : $agent_name; $params['javascript_is_function_select'] = true; $params['javascript_name_function_select'] = 'custom_select_function'; $params['javascript_code_function_select'] = ''; @@ -170,18 +208,12 @@ function mainInsertData() $params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_value'] = $agent_id; - $table->data[0][1] = ui_print_agent_autocomplete_input($params); - - $table->data[1][0] = __('Module'); - $modules = []; - if ($agent_id) { - $modules = agents_get_modules($agent_id, false, ['delete_pending' => 0]); - } + $table->data[1][0] = html_print_div(['class' => 'flex flex-items-center', 'content' => ui_print_agent_autocomplete_input($params)], true); $table->data[1][1] = html_print_select( $modules, 'id_agent_module', - $id_agent_module, + ($save === true) ? '' : $id_agent_module, true, __('Select'), 0, @@ -191,22 +223,45 @@ function mainInsertData() '', empty($agent_id) ); - $table->data[2][0] = __('Data'); - $table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true); - $table->data[3][0] = __('Date'); - $table->data[3][1] = html_print_input_text('date', $date, '', 11, 11, true).' '; - $table->data[3][1] .= html_print_input_text('time', $time, '', 7, 7, true); - $table->data[4][0] = __('CSV'); - $table->data[4][1] = html_print_input_file('csv', true); + $table->data[1][2] = html_print_input_text('data', ($save === true) ? date(DATE_FORMAT) : $data, __('Data'), 10, 60, true); + $table->data[1][2] .= ' '; + $table->data[1][2] .= html_print_input_text('time', ($save === true) ? date(TIME_FORMAT) : $time, '', 10, 7, true); + + $table->data[2][0] = ''; + $table->data[2][1] = ''; + $table->data[3][0] = html_print_input_text( + 'data', + $data, + __('Data'), + 40, + 60, + true + ); + $table->data[3][1] = html_print_div( + [ + 'class' => '', + 'content' => html_print_input_file('csv', true), + ], + true + ); echo ""; html_print_table($table); - echo "
"; html_print_input_hidden('save', 1); - html_print_submit_button(__('Save'), 'submit', ($id_agent === ''), 'class="sub next"'); - echo '
'; + + html_print_action_buttons( + html_print_submit_button( + __('Save'), + 'submit', + // (empty($id_agent) === true), + false, + [ 'icon' => 'next' ], + true + ), + ['type' => 'form_action'] + ); echo ''; @@ -257,8 +312,8 @@ function mainInsertData() $('#id_agent_module').enable(); $('#id_agent_module').fadeIn ('normal'); - $('#submit-submit').enable(); - $('#submit-submit').fadeIn ('normal'); + $('button [name="submit"]').removeClass('disabled_action_button'); + $('button [name="submit"]').fadeIn ('normal'); } }); } diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index a04e6a08dc..e554b34b51 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -266,24 +266,68 @@ function mainModuleGroups() ] ); - echo "
".__('Agents').' / '.__('Modules').'".__('Agents').' / '.__('Modules').'
- "; - echo ""; + $output = ""; - echo '
'; - echo __('Search by agent group').' '; - html_print_input_text('agent_group_search', $agent_group_search); + $output .= ""; + $output .= ''; + $output .= '
'; + $output .= html_print_label_input_block( + __('Search by agent group'), + html_print_input_text( + 'agent_group_search', + $agent_group_search, + '', + 50, + 255, + true + ) + ); - echo ''; - echo __('Search by module group').' '; - html_print_input_text('module_group_search', $module_group_search); + $output .= ''; + $output .= html_print_label_input_block( + __('Search by module group'), + html_print_input_text( + 'module_group_search', + $module_group_search, + '', + 50, + 255, + true + ) + ); + $output .= '
'; - echo '
'; - echo ""; - echo ''; - echo ''; - echo '
'; + $output .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Filter'), + 'srcbutton', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true + ); + + $output .= ''; + + ui_toggle( + $output, + ''.__('Filters').'', + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); $cell_style = ' min-width: 60px; @@ -299,26 +343,35 @@ function mainModuleGroups() if ($info && $array_module_group) { $table = new StdClass(); - $table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; min-width: 230px;'; + $table->class = 'info_table'; + $table->style[0] = 'font-weight: bolder; min-width: 230px;'; $table->width = '100%'; - if ($config['style'] === 'pandora_black' && !is_metaconsole()) { - $background_color = '#333'; - } else { - $background_color = '#fff'; - } - $head[0] = __('Groups'); $headstyle[0] = 'width: 20%; font-weight: bolder;'; foreach ($array_module_group as $key => $value) { - $headstyle[] = 'min-width: 60px;max-width: 5%;text-align:center; color: #ffffff; background-color: #373737; font-weight: bolder;'; - $head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF'); + $headstyle[] = 'min-width: 60px;max-width: 5%;text-align:center; font-weight: bolder;'; + $head[] = ui_print_truncate_text( + $value, + GENERIC_SIZE_TEXT, + true, + true, + true, + '…' + ); } $i = 0; foreach ($array_for_defect as $key => $value) { $deep = groups_get_group_deep($key); - $data[$i][0] = $deep.ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF'); + $data[$i][0] = $deep.ui_print_truncate_text( + $value['data']['name'], + GENERIC_SIZE_TEXT, + true, + true, + true, + '…' + ); $j = 1; if (isset($array_data[$key])) { foreach ($value['gm'] as $k => $v) { @@ -378,25 +431,37 @@ function mainModuleGroups() $table->headstyle = $headstyle; $table->data = $data; - ui_pagination($counter); - echo "
"; html_print_table($table); echo '
'; - ui_pagination($counter); + $tablePagination = ui_pagination( + $counter, + false, + 0, + 0, + true, + 'offset', + false + ); - echo "
"; - echo ''; - echo "'; - echo "'; - echo "'; - echo "'; - echo "'; - echo "'; - echo "'; - echo '
".__('Legend').'
".__('Orange cell when the module group and agent have at least one alarm fired.').'
".__('Red cell when the module group and agent have at least one module in critical status and the others in any status').'
".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'
".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'
".__('Green cell when the module group and agent have all modules in OK status').'
".__('Blue cell when the module group and agent have all modules in not init status.').'
'; - echo '
'; + html_print_action_buttons( + '', + [ 'right_content' => $tablePagination ] + ); + + $show_legend = '
'; + $show_legend .= ''; + $show_legend .= "'; + $show_legend .= "'; + $show_legend .= "'; + $show_legend .= "'; + $show_legend .= "'; + $show_legend .= "'; + $show_legend .= '
".__('Orange cell when the module group and agent have at least one alarm fired.').'
".__('Red cell when the module group and agent have at least one module in critical status and the others in any status').'
".__('Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status').'
".__('Grey cell when the module group and agent have at least one in unknown status and the others in green status').'
".__('Green cell when the module group and agent have all modules in OK status').'
".__('Blue cell when the module group and agent have all modules in not init status.').'
'; + $show_legend .= '
'; + + ui_toggle($show_legend, __('Legend')); } else { ui_print_info_message(['no_close' => true, 'message' => __('This table shows in columns the modules group and in rows agents group. The cell shows all modules') ]); ui_print_info_message(['no_close' => true, 'message' => __('There are no defined groups or module groups') ]); diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php index 7cbb5607e1..9182380a95 100644 --- a/pandora_console/extensions/quick_shell.php +++ b/pandora_console/extensions/quick_shell.php @@ -151,7 +151,7 @@ function quickShell() 'name' => 'submit', 'label' => __('Retry'), 'type' => 'submit', - 'attributes' => 'class="sub next"', + 'attributes' => ['icon' => 'next'], 'return' => true, ], ], @@ -202,7 +202,7 @@ function quickShell() 'arguments' => [ 'type' => 'submit', 'label' => __('Connect'), - 'attributes' => 'class="sub next"', + 'attributes' => ['icon' => 'cog'], ], ], ], @@ -544,7 +544,7 @@ if (empty($agent_id) === false // TabName. __('QuickShell'), // TabIcon. - 'images/ehorus/terminal.png', + 'images/quick-shell@svg.svg', // TabFunction. 'quickShell', // Version. diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php index 8f978f0fac..133af5b3f8 100644 --- a/pandora_console/extensions/realtime_graphs.php +++ b/pandora_console/extensions/realtime_graphs.php @@ -74,61 +74,11 @@ function pandora_realtime_graphs() ); } - $chart[time()]['graph'] = '0'; - $interactive_graph = true; - $color = []; - $legend = ''; - $long_index = []; - $no_data_image = ''; - - $canvas = '
'; - $canvas .= '
'; - - $width = 800; - $height = 300; - - $data_array['realtime']['data'][0][0] = (time() - 10); - $data_array['realtime']['data'][0][1] = 0; - $data_array['realtime']['data'][1][0] = time(); - $data_array['realtime']['data'][1][1] = 0; - $data_array['realtime']['color'] = 'green'; - - $params = [ - 'agent_module_id' => false, - 'period' => 300, - 'width' => $width, - 'height' => $height, - 'unit' => $unit, - 'only_image' => $only_image, - 'homeurl' => $homeurl, - 'type_graph' => 'area', - 'font' => $config['fontpath'], - 'font-size' => $config['font_size'], - 'array_data_create' => $data_array, - 'show_legend' => false, - 'show_menu' => false, - ]; - - $canvas .= grafico_modulo_sparse($params); - - $canvas .= '
'; - echo $canvas; - $table = new stdClass(); $table->width = '100%'; $table->id = 'table-form'; - $table->class = 'databox filters'; + $table->class = 'filter-table-adv'; $table->style = []; - $table->cellpadding = '0'; - $table->cellspacing = '0'; - $table->style['graph'] = 'font-weight: bold;'; - $table->style['refresh'] = 'font-weight: bold;'; - $table->style['incremental'] = 'font-weight: bold;'; - $table->style['reset'] = 'font-weight: bold;'; - $table->style['snmp_address'] = 'font-weight: bold;'; - $table->style['snmp_community'] = 'font-weight: bold;'; - $table->style['snmp_oid'] = 'font-weight: bold;'; - $table->style['snmp_oid'] = 'font-weight: bold;'; $table->data = []; $graph_fields['cpu_load'] = __('%s Server CPU', get_product_name()); @@ -158,15 +108,22 @@ function pandora_realtime_graphs() $refresh = get_parameter('refresh', '1000'); if ($graph != 'snmp_module') { - $data['graph'] = __('Graph').'  '; - $data['graph'] .= html_print_select( - $graph_fields, - 'graph', - $graph, - '', - '', - 0, - true + $data['graph'] = html_print_label_input_block( + __('Graph'), + html_print_select( + $graph_fields, + 'graph', + $graph, + '', + '', + 0, + true, + false, + true, + '', + false, + 'width: 100%' + ) ); } @@ -179,18 +136,35 @@ function pandora_realtime_graphs() $agent_alias = io_safe_output(get_parameter('agent_alias', '')); $module_name = io_safe_output(get_parameter('module_name', '')); $module_incremental = get_parameter('incremental', 0); - $data['module_info'] = $agent_alias.': '.$module_name.''; - - // Append all the hidden in this cell. - $data['module_info'] .= html_print_input_hidden( - 'incremental', - $module_incremental, - true + $data['module_info'] = html_print_label_input_block( + $agent_alias.': '.$module_name, + html_print_input_hidden( + 'incremental', + $module_incremental, + true + ).html_print_select( + ['snmp_module' => '-'], + 'graph', + 'snmp_module', + '', + '', + 0, + true, + false, + true, + '', + false, + 'width: 100%; display: none;' + ) ); - $data['module_info'] .= html_print_select( - ['snmp_module' => '-'], - 'graph', - 'snmp_module', + } + + $data['refresh'] = html_print_label_input_block( + __('Refresh interval'), + html_print_select( + $refresh_fields, + 'refresh', + $refresh, '', '', 0, @@ -199,33 +173,17 @@ function pandora_realtime_graphs() true, '', false, - 'display: none;' + 'width: 100%' + ) + ); + + if ($graph != 'snmp_module') { + $data['incremental'] = html_print_label_input_block( + __('Incremental'), + html_print_checkbox_switch('incremental', 1, 0, true) ); } - $data['refresh'] = __('Refresh interval').'  '; - $data['refresh'] .= html_print_select( - $refresh_fields, - 'refresh', - $refresh, - '', - '', - 0, - true - ); - if ($graph != 'snmp_module') { - $data['incremental'] = __('Incremental').'  '; - $data['incremental'] .= html_print_checkbox('incremental', 1, 0, true); - } - - $data['reset'] = html_print_button( - __('Clear graph'), - 'reset', - false, - 'javascript:realtimeGraphs.clearGraph();', - 'class="sub delete mgn_tp_0" ', - true - ); $table->data[] = $data; if ($graph == 'snmp_interface' || $graph == 'snmp_module') { @@ -236,10 +194,79 @@ function pandora_realtime_graphs() html_print_input_hidden('rel_path', get_parameter('rel_path', '')); // Print the form. - echo '
'; - html_print_table($table); - echo '
'; + $searchForm = '
'; + $searchForm .= html_print_table($table, true); + $searchForm .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Clear graph'), + 'srcbutton', + false, + [ + 'icon' => 'delete', + 'mode' => 'mini', + 'onClick' => 'javascript:realtimeGraphs.clearGraph();', + ], + true + ), + ], + true + ); + $searchForm .= '
'; + ui_toggle( + $searchForm, + ''.__('Filters').'', + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); + + $chart[time()]['graph'] = '0'; + $canvas = '
'; + $canvas .= '
'; + + $width = 800; + $height = 300; + + $data_array['realtime']['data'][0][0] = (time() - 10); + $data_array['realtime']['data'][0][1] = 0; + $data_array['realtime']['data'][1][0] = time(); + $data_array['realtime']['data'][1][1] = 0; + $data_array['realtime']['color'] = 'green'; + + $params = [ + 'agent_module_id' => false, + 'period' => 300, + 'width' => $width, + 'height' => $height, + 'only_image' => false, + 'type_graph' => 'area', + 'font' => $config['fontpath'], + 'font-size' => $config['font_size'], + 'array_data_create' => $data_array, + 'show_legend' => false, + 'show_menu' => false, + 'backgroundColor' => 'transparent', + ]; + + $canvas .= grafico_modulo_sparse($params); + + $canvas .= '
'; + + html_print_div( + [ + 'class' => 'white_box', + 'content' => $canvas, + ] + ); + + // echo $canvas; // Define a custom action to save // the OID selected in the SNMP browser to the form. html_print_input_hidden( diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.css b/pandora_console/extensions/realtime_graphs/realtime_graphs.css index a5dfa19975..a839ad6ab0 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.css +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.css @@ -12,6 +12,5 @@ #graph_container { width: 800px; margin: 20px auto; - background-color: white; border-radius: 3px; } diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index b6e594c744..905b389eee 100755 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -1,16 +1,32 @@ \n"; break; @@ -224,18 +209,6 @@ function output_xml_report($id) echo '\n"; break; - case 'event_report_module': - break; - - case 'alert_report_module': - break; - - case 'alert_report_agent': - break; - - case 'alert_report_group': - break; - case 'url': echo ''; break; @@ -245,6 +218,29 @@ function output_xml_report($id) echo ''; echo ''; break; + + case 1: + case 'simple_graph': + case 'simple_baseline_graph': + case 6: + case 'monitor_report': + case 7: + case 'avg_value': + case 8: + case 'max_value': + case 9: + case 'min_value': + case 10: + case 'sumatory': + case 'agent_detailed_event': + case 'event_report_agent': + case 'event_report_module': + case 'alert_report_module': + case 'alert_report_agent': + case 'alert_report_group': + default: + // Do nothing. + break; } echo "\n"; @@ -417,25 +413,59 @@ function resource_exportation_extension_main() $hook_enterprise = enterprise_include('extensions/resource_exportation/functions.php'); - ui_print_page_header(__('Resource exportation'), 'images/extensions.png', false, '', true, ''); + ui_print_standard_header( + __('Resource exportation'), + 'images/extensions.png', + false, + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Resources'), + ], + [ + 'link' => '', + 'label' => __('Resource exporting'), + ], + ] + ); - echo '
'; - echo __('This extension makes exportation of resource template more easy.').' '.__('You can export resource templates in .ptr format.'); - echo '
'; - - echo '

'; + ui_print_warning_message( + __('This extension makes exportation of resource template more easy.').'
'.__('You can export resource templates in .ptr format.') + ); $table = new stdClass(); - $table->width = '100%'; - $table->style[0] = 'width: 30%;'; - $table->style[1] = 'width: 10%;'; - $table->class = 'databox filters'; - $table->data[0][0] = __('Report'); - $table->data[0][1] = html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true); - $table->data[0][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', 'class="sub config"', true); - $table->data[1][0] = __('Visual console'); - $table->data[1][1] = html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true); - $table->data[1][2] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', 'class="sub config"', true); + $table->class = 'databox filter-table-adv'; + $table->id = 'resource_exportation_table'; + $table->style = []; + $table->style[0] = 'width: 30%'; + $table->style[1] = 'vertical-align: bottom;'; + $table->data = []; + $table->data[0][] = html_print_label_input_block( + __('Report'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => html_print_select_from_sql('SELECT id_report, name FROM treport', 'report', '', '', '', 0, true), + ], + true + ) + ); + $table->data[0][] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'report\');', ['mode' => 'link'], true); + + $table->data[1][] = html_print_label_input_block( + __('Visual console'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => html_print_select_from_sql('SELECT id, name FROM tlayout', 'visual_console', '', '', '', 0, true), + ], + true + ) + ); + $table->data[1][] = html_print_button(__('Export'), '', false, 'export_to_ptr(\'visual_console\');', ['mode' => 'link'], true); if ($hook_enterprise === true) { add_rows_for_enterprise($table->data); diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index 732c0151ea..d76814e886 100755 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -1,4 +1,5 @@ group)); break; - case 'event_report_module': - break; - - case 'alert_report_module': - break; - - case 'alert_report_agent': - break; - - case 'alert_report_group': - break; - case 'url': $values['external_source'] = io_safe_input($item['url']); break; @@ -426,9 +384,32 @@ function process_upload_xml_report($xml, $group_filter=0) $values['line_separator'] = io_safe_input($item['line_separator']); $values['column_separator'] = io_safe_input($item['column_separator']); break; + + case 1: + case 'simple_graph': + case 'simple_baseline_graph': + case 6: + case 'monitor_report': + case 7: + case 'avg_value': + case 8: + case 'max_value': + case 9: + case 'min_value': + case 10: + case 'sumatory': + case 'event_report_module': + case 'alert_report_module': + case 'alert_report_agent': + case 'alert_report_group': + case 'agent_detailed_event': + case 'event_report_agent': + default: + // Do nothing. + break; } - if (empty($agents_item)) { + if (empty($agents_item) === true) { $id_content = db_process_sql_insert('treport_content', $values); ui_print_result_message( $id_content, @@ -782,7 +763,7 @@ function process_upload_xml_visualmap($xml, $filter_group=0) function process_upload_xml_component($xml) { - // Extract components + // Extract components. $components = []; foreach ($xml->xpath('/component') as $componentElement) { $name = io_safe_input((string) $componentElement->name); @@ -838,7 +819,7 @@ function process_upload_xml_component($xml) $idComponent = false; switch ((int) $componentElement->module_source) { case 1: - // Local component + // Local component. $values = [ 'description' => $description, 'id_network_component_group' => $group, @@ -854,12 +835,12 @@ function process_upload_xml_component($xml) // Network component // for modules // 15 = remote_snmp, 16 = remote_snmp_inc, - // 17 = remote_snmp_string, 18 = remote_snmp_proc + // 17 = remote_snmp_string, 18 = remote_snmp_proc. $custom_string_1 = ''; $custom_string_2 = ''; $custom_string_3 = ''; if ($type >= 15 && $type <= 18) { - // New support for snmp v3 + // New support for snmp v3. $tcp_send = $snmp_version; $plugin_user = $auth_user; $plugin_pass = $auth_password; @@ -909,13 +890,13 @@ function process_upload_xml_component($xml) 'post_process' => $post_process, ] ); - if ((bool) $idComponent) { + if ((bool) $idComponent === true) { $components[] = $idComponent; } break; case 4: - // Plugin component + // Plugin component. $idComponent = network_components_create_network_component( $name, $type, @@ -956,17 +937,13 @@ function process_upload_xml_component($xml) 'post_process' => $post_process, ] ); - if ((bool) $idComponent) { + if ((bool) $idComponent === true) { $components[] = $idComponent; } break; - case 5: - // Prediction component - break; - case 6: - // WMI component + // WMI component. $idComponent = network_components_create_network_component( $name, $type, @@ -1013,13 +990,17 @@ function process_upload_xml_component($xml) 'post_process' => $post_process, ] ); - if ((bool) $idComponent) { + if ((bool) $idComponent === true) { $components[] = $idComponent; } break; + case 5: + // Prediction component. case 7: - // Web component + // Web component. + default: + // Do nothing. break; } @@ -1030,9 +1011,9 @@ function process_upload_xml_component($xml) ); } - // Extract the template + // Extract the template. $templateElement = $xml->xpath('//template'); - if (!empty($templateElement)) { + if (empty($templateElement) === false) { $templateElement = $templateElement[0]; $templateName = (string) $templateElement->name; @@ -1092,9 +1073,26 @@ function resource_registration_extension_main() include_once $config['homedir'].'/include/functions_db.php'; enterprise_include_once('include/functions_local_components.php'); - ui_print_page_header(__('Resource registration'), 'images/extensions.png', false, '', true, ''); + ui_print_standard_header( + __('Resource registration'), + 'images/extensions.png', + false, + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Resources'), + ], + [ + 'link' => '', + 'label' => __('Resource registration'), + ], + ] + ); - if (!extension_loaded('libxml')) { + if (extension_loaded('libxml') === false) { ui_print_error_message(_('Error, please install the PHP libXML in the system.')); return; @@ -1119,15 +1117,42 @@ function resource_registration_extension_main() return; } - echo '
'; - echo __('This extension makes registering resource templates easier.').' '.__('Here you can upload a resource template in .ptr format.').' '.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'

'.__('You can get more resurces in our Public Resource Library'); - echo '
'; + ui_print_warning_message( + __('This extension makes registering resource templates easier.').'
'.__('Here you can upload a resource template in .ptr format.').'
'.__('Please refer to our documentation for more information on how to obtain and use %s resources.', get_product_name()).' '.'

'.__('You can get more resurces in our Public Resource Library') + ); - echo '

'; + $table = new stdClass(); + $table->class = 'databox filter-table-adv'; + $table->id = 'resource_registration_table'; + + $table->data = []; + + $table->data[0][] = html_print_label_input_block( + __('File to upload'), + html_print_input_file('resource_upload', true) + ); + + $table->data[0][] = html_print_label_input_block( + __('Group filter'), + html_print_select_groups(false, 'AW', true, 'group', '', '', __('All'), 0, true) + ); // Upload form. - echo "
"; - echo ''; + echo ''; + html_print_table($table); + html_print_action_buttons( + html_print_submit_button( + __('Upload'), + 'upload', + false, + [ 'icon' => 'wand' ], + true + ), + ['type' => 'form_action'] + ); + echo ''; + /* + echo '
'; echo ''; echo "'; @@ -1136,8 +1161,7 @@ function resource_registration_extension_main() echo ''; echo "'; - echo '
"; echo ''.__('Group filter: ').'"; echo '
'; - echo ''; + echo '';*/ if (isset($_FILES['resource_upload']['tmp_name']) === false) { return; diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index e4ef421b1f..f92441a5f0 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -1,5 +1,65 @@ START TRANSACTION; +UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1; +UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2; +UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3; +UPDATE tconfig_os SET `icon_name` = 'freebsd@os.svg' WHERE `id_os` = 4; +UPDATE tconfig_os SET `icon_name` = 'HP@os.svg' WHERE `id_os` = 5; +UPDATE tconfig_os SET `icon_name` = 'cisco@os.svg' WHERE `id_os` = 7; +UPDATE tconfig_os SET `icon_name` = 'apple@os.svg' WHERE `id_os` = 8; +UPDATE tconfig_os SET `icon_name` = 'windows@os.svg' WHERE `id_os` = 9; +UPDATE tconfig_os SET `icon_name` = 'other-OS@os.svg' WHERE `id_os` = 10; +UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 11; +UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 12; +UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 13; +UPDATE tconfig_os SET `icon_name` = 'embedded@os.svg' WHERE `id_os` = 14; +UPDATE tconfig_os SET `icon_name` = 'android@os.svg' WHERE `id_os` = 15; +UPDATE tconfig_os SET `icon_name` = 'vmware@os.svg' WHERE `id_os` = 16; +UPDATE tconfig_os SET `icon_name` = 'routers@os.svg' WHERE `id_os` = 17; +UPDATE tconfig_os SET `icon_name` = 'switch@os.svg' WHERE `id_os` = 18; +UPDATE tconfig_os SET `icon_name` = 'satellite@os.svg' WHERE `id_os` = 19; +UPDATE tconfig_os SET `icon_name` = 'mainframe@os.svg' WHERE `id_os` = 20; +UPDATE tconfig_os SET `icon_name` = 'cluster@os.svg' WHERE `id_os` = 100; + +UPDATE tgrupo SET `icon` = 'servers@groups.svg' WHERE `id_grupo` = 2; +UPDATE tgrupo SET `icon` = 'firewall@groups.svg' WHERE `id_grupo` = 4; +UPDATE tgrupo SET `icon` = 'database@groups.svg' WHERE `id_grupo` = 8; +UPDATE tgrupo SET `icon` = 'network@groups.svg' WHERE `id_grupo` = 9; +UPDATE tgrupo SET `icon` = 'unknown@groups.svg' WHERE `id_grupo` = 10; +UPDATE tgrupo SET `icon` = 'workstation@groups.svg' WHERE `id_grupo` = 11; +UPDATE tgrupo SET `icon` = 'applications@groups.svg' WHERE `id_grupo` = 12; +UPDATE tgrupo SET `icon` = 'web@groups.svg' WHERE `id_grupo` = 13; + +UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 1; +UPDATE `ttipo_modulo` SET `icon` = 'generic-boolean@svg.svg' WHERE `id_tipo` = 2; +UPDATE `ttipo_modulo` SET `icon` = 'generic-string@svg.svg' WHERE `id_tipo` = 3; +UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 4; +UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 5; +UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-boolean-data@svg.svg' WHERE `id_tipo` = 6; +UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-latency@svg.svg' WHERE `id_tipo` = 7; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-numeric-data@svg.svg' WHERE `id_tipo` = 8; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-boolean-data@svg.svg' WHERE `id_tipo` = 9; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 10; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-incremental-data@svg.svg' WHERE `id_tipo` = 11; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-numeric-data@svg.svg' WHERE `id_tipo` = 15; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 16; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 17; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 18; +UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 21; +UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 22; +UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 23; +UPDATE `ttipo_modulo` SET `icon` = 'wux@svg.svg' WHERE `id_tipo` = 25; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 30; +UPDATE `ttipo_modulo` SET `icon` = 'web-analisys-data@svg.svg' WHERE `id_tipo` = 31; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 32; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 33; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-numeric-data@svg.svg' WHERE `id_tipo` = 34; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-boolean-data@svg.svg' WHERE `id_tipo` = 35; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-alphanumeric-data@svg.svg' WHERE `id_tipo` = 36; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-incremental-data@svg.svg' WHERE `id_tipo` = 37; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 38; +UPDATE `ttipo_modulo` SET `icon` = 'keepalive@svg.svg' WHERE `id_tipo` = 100; + CREATE TABLE IF NOT EXISTS `tagent_filter` ( `id_filter` INT UNSIGNED NOT NULL AUTO_INCREMENT, `id_name` VARCHAR(600) NOT NULL, diff --git a/pandora_console/general/first_task/custom_fields.php b/pandora_console/general/first_task/custom_fields.php index c8767a3c48..11f9f30c2d 100644 --- a/pandora_console/general/first_task/custom_fields.php +++ b/pandora_console/general/first_task/custom_fields.php @@ -1,16 +1,32 @@ true, 'message' => __('There are no custom __('Custom Fields')]); ?>
-

+

true, 'message' => __('There are no custom ?>

+ 'action-buttons', + 'content' => html_print_submit_button( + __('Create Custom Fields'), + 'button_task', + false, + [ 'icon' => 'next' ], + true + ), + ] + ); + ?>
diff --git a/pandora_console/general/first_task/custom_graphs.php b/pandora_console/general/first_task/custom_graphs.php index 9429218133..96f4c1262b 100644 --- a/pandora_console/general/first_task/custom_graphs.php +++ b/pandora_console/general/first_task/custom_graphs.php @@ -15,9 +15,6 @@ global $config; check_login(); ui_require_css_file('first_task'); ?> - true, 'message' => __('There are no custom graphs defined yet.') ]); -?>
@@ -36,7 +33,17 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no custom ?>

- + 'wand'], + true + ) + ); + ?>
\ No newline at end of file diff --git a/pandora_console/general/first_task/map_builder.php b/pandora_console/general/first_task/map_builder.php index de964bf087..6091b45d61 100755 --- a/pandora_console/general/first_task/map_builder.php +++ b/pandora_console/general/first_task/map_builder.php @@ -1,28 +1,38 @@ true, - 'message' => __('There are no visual console defined yet.'), - ] -); if ($vconsoles_write || $vconsoles_manage) { ?> @@ -31,7 +41,7 @@ if ($vconsoles_write || $vconsoles_manage) { __('Visual Console')]); ?>
-

+

- - + 'wand'], + true + ) + ); + ?>
diff --git a/pandora_console/general/first_task/planned_downtime.php b/pandora_console/general/first_task/planned_downtime.php index 6bfbe5627b..a88a3e0fc3 100644 --- a/pandora_console/general/first_task/planned_downtime.php +++ b/pandora_console/general/first_task/planned_downtime.php @@ -1,16 +1,32 @@ __('Scehduled Downtime')]); ?>
-

+

- +
diff --git a/pandora_console/general/first_task/service_list.php b/pandora_console/general/first_task/service_list.php index f3b816c006..dae4eedb08 100755 --- a/pandora_console/general/first_task/service_list.php +++ b/pandora_console/general/first_task/service_list.php @@ -1,29 +1,44 @@ - true, 'message' => __('There are no services defined yet.') ]); ?>
- __('Services')]); ?> + __('Services'), 'class' => 'w120px']); ?>
-

+

- + 'wand'], + true + ) + ); + ?>
-
', $menuTypeClass); ?> -
+
', $menuTypeClass); // ======= Servers List =============================================== if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { - $servers_list = '
'; $servers = []; $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); if ($servers['all'] != 0) { @@ -45,22 +44,33 @@ echo sprintf('
', $menuTypeClass); $servers['down'] = ($servers['all'] - $servers['up']); if ($servers['up'] == 0) { // All Servers down or no servers at all. - $servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]); + $servers_check_img = html_print_image('images/system_error@header.svg', true, ['alt' => 'cross', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Down')]); } else if ($servers['down'] != 0) { // Some servers down. - $servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]); + $servers_check_img = html_print_image('images/system_warning@header.svg', true, ['alt' => 'error', 'class' => 'main_menu_icon bot', 'title' => $servers['down'].' '.__('servers down')]); } else { // All servers up. - $servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]); + $servers_check_img = html_print_image('images/system_ok@header.svg', true, ['alt' => 'ok', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Ready')]); } unset($servers); // Since this is the header, we don't like to trickle down variables. - $servers_check_img_link = ''; - $servers_check_img_link .= $servers_check_img; - $servers_check_img_link .= ''; + $servers_check_img_link = html_print_anchor( + [ + 'href' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', + 'content' => $servers_check_img, + ], + true + ); }; - $servers_list .= $servers_check_img_link.'
'; + + $servers_list = html_print_div( + [ + 'id' => 'servers_list', + 'content' => $servers_check_img_link, + ], + true + ); } @@ -71,9 +81,9 @@ echo sprintf('
', $menuTypeClass); $check_minor_release_available = db_check_minor_relase_available(); - if ($check_minor_release_available) { + if ($check_minor_release_available === true) { if (users_is_admin($config['id_user'])) { - if ($config['language'] == 'es') { + if ($config['language'] === 'es') { set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. '.__('Sobre actualizaciรณn de revisiรณn menor').'', 'Revisiรณn/es menor/es disponible/s'); } else { set_pandora_error_for_header('There are one or more minor releases waiting for update. '.__('About minor release update').'', 'minor release/s available'); @@ -227,10 +237,10 @@ echo sprintf('
', $menuTypeClass); if ($do_refresh) { $autorefresh_img = html_print_image( - 'images/header_refresh_gray.png', + 'images/auto_refresh@header.svg', true, [ - 'class' => 'bot', + 'class' => 'main_menu_icon bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh'), ] @@ -293,10 +303,10 @@ echo sprintf('
', $menuTypeClass); $display_counter = 'display:block'; } else { $autorefresh_img = html_print_image( - 'images/header_refresh_disabled_gray.png', + 'images/auto_refresh@header.svg', true, [ - 'class' => 'bot autorefresh_disabled invert_filter', + 'class' => 'main_menu_icon bot autorefresh_disabled invert_filter', 'alt' => 'lightning', 'title' => __('Disabled autorefresh'), ] @@ -312,10 +322,10 @@ echo sprintf('
', $menuTypeClass); } } else { $autorefresh_img = html_print_image( - 'images/header_refresh_disabled_gray.png', + 'images/auto_refresh@header.svg', true, [ - 'class' => 'bot autorefresh_disabled invert_filter', + 'class' => 'main_menu_icon bot autorefresh_disabled invert_filter', 'alt' => 'lightning', 'title' => __('Disabled autorefresh'), ] @@ -350,9 +360,10 @@ echo sprintf('
', $menuTypeClass); $header_feedback .= ''; $header_feedback .= ''; $header_feedback .= html_print_image( - 'images/feedback-header.png', + 'images/send_feedback@header.svg', true, [ + 'class' => 'main_menu_icon invert_filter', 'title' => __('Feedback'), 'id' => 'feedback-header', 'alt' => __('Feedback'), @@ -373,11 +384,11 @@ echo sprintf('
', $menuTypeClass); $header_support = '
'; $header_support .= ''; $header_support .= html_print_image( - 'images/header_support.png', + 'images/support@header.svg', true, [ 'title' => __('Go to support'), - 'class' => 'bot invert_filter', + 'class' => 'main_menu_icon bot invert_filter', 'alt' => 'user', ] ); @@ -387,11 +398,11 @@ echo sprintf('
', $menuTypeClass); $header_docu = '
'; $header_docu .= ''; $header_docu .= html_print_image( - 'images/header_docu.png', + 'images/documentation@header.svg', true, [ 'title' => __('Go to documentation'), - 'class' => 'bot invert_filter', + 'class' => 'main_menu_icon bot invert_filter', 'alt' => 'user', ] ); @@ -399,34 +410,38 @@ echo sprintf('
', $menuTypeClass); // User. - if (is_user_admin($config['id_user']) == 1) { - $header_user = html_print_image( - 'images/header_user_admin_green.png', - true, - [ - 'title' => __('Edit my user'), - 'class' => 'bot', - 'alt' => 'user', - ] - ); - } else { - $header_user = html_print_image( - 'images/header_user_green.png', - true, - [ - 'title' => __('Edit my user'), - 'class' => 'bot', - 'alt' => 'user', - ] - ); - } + // $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png'; + $headerUser = []; + $headerUser[] = html_print_image( + 'images/edit_user@header.svg', + true, + [ + 'title' => __('Edit my user'), + 'class' => 'main_menu_icon bot invert_filter', + 'alt' => 'user', + ] + ); - $header_user = ''; + $headerUser[] = sprintf('[ %s ]', $config['id_user']); + + $header_user = html_print_div( + [ + 'id' => 'header_user', + 'content' => html_print_anchor( + [ + 'href' => sprintf('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user=%s', $config['id_user']), + 'content' => implode('', $headerUser), + ], + true + ), + ], + true + ); // Logout. $header_logout = '
'; $header_logout .= html_print_image( - 'images/header_logout_gray.png', + 'images/sign_out@header.svg', true, [ 'alt' => __('Logout'), diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 29b03d8094..8517b1c46c 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -30,16 +30,21 @@ require_once __DIR__.'/../include/functions_html.php'; if ($config['visual_animation']) { echo ''; } @@ -87,18 +92,36 @@ if (!empty($page) && !empty($sec)) { } $login_body_style = ''; -$login_body_class = ''; // Overrides the default background with the defined by the user. -if (!empty($config['login_background'])) { +$background_url = 'images/backgrounds/background_pandora_console_keys.jpg'; + +if (empty($config['random_background']) === false) { + $random_backgrounds = scandir($config['homedir'].'/images/backgrounds/random_backgrounds'); + unset($random_backgrounds[0], $random_backgrounds[1]); + $random_background = array_rand($random_backgrounds); + $background_url = 'images/backgrounds/random_backgrounds/'.$random_backgrounds[$random_background]; + $background_100 = 'background-size: 100% 100% !important; '; +} + +if (empty($config['login_background']) === false) { $background_url = 'images/backgrounds/'.$config['login_background']; - $login_body_style = "style=\"background-size: 100% 100% !important;background:linear-gradient(74deg, rgba(2, 2, 2, 0.333) 36%, transparent 36%), url('".$background_url."');\""; + $background_100 = 'background-size: 100% 100% !important; '; } // Support for Internet Explorer and Microsoft Edge browsers if (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) { - $login_body_class = "class='login_body_trident'"; + $background_url = 'images/backgrounds/background_pandora_console_keys.jpg'; + $background_100 = ''; } +if (empty($config['background_opacity']) === false) { + $opacity = $config['background_opacity']; +} else { + $opacity = 30; +} + +$login_body_style = 'style="'.$background_100.'background: linear-gradient(rgba(0,0,0,.'.$opacity.'), rgba(0,0,0,.'.$opacity.")), url('".$background_url."');\""; + // Get alternative custom in case of db fail. $custom_fields = [ 'custom_logo_login', @@ -123,36 +146,36 @@ foreach ($custom_fields as $field) { // Get the custom icons. $docs_logo = ui_get_docs_logo(); $support_logo = ui_get_support_logo(); -echo '
'; +echo '
'; echo ''; echo ''; echo ''; echo ''; } else { echo ''; echo ''; } break; @@ -302,12 +348,13 @@ switch ($login_screen) { echo ''; echo ''; break; @@ -337,17 +384,18 @@ if ($config['enterprise_installed']) { echo ''.__('Forgot your password?'); echo ''; - echo ''; + echo '
'; echo '
'; - html_print_submit_button('Ok', 'reset_correct_button', false); + html_print_submit_button('Ok', 'reset_correct_button', false, ['class' => 'mini float-right']); echo '
'; echo '
'; echo '
'; echo '
'; } else if (isset($process_error_message) && !empty($process_error_message)) { - echo '
'; + echo '
'; echo '
'; echo '
'; - echo html_print_image('images/icono_stop.png', true, ['alt' => __('Password reset'), 'border' => 0]); + echo html_print_image('images/icono_stop.png', true, ['alt' => __('Forbidden'), 'border' => 0]); echo '
'; echo '
'; echo '
'; echo '

'.__('ERROR').'

'; echo '

'.$process_error_message.'

'; + echo '
'; echo '
'; + echo '
'; echo '
'; - html_print_submit_button('Ok', 'reset_correct_button', false); + html_print_submit_button('Ok', 'reset_correct_button', false, ['class' => 'mini float-right']); echo '
'; echo '
'; echo '
'; @@ -476,8 +551,9 @@ if (isset($correct_reset_pass_process)) { echo '

'.__('SUCCESS').'

'; echo '

'.$correct_reset_pass_process.'

'; echo '
'; + echo '
'; echo '
'; - html_print_submit_button('Ok', 'final_process_correct_button', false); + html_print_submit_button('Ok', 'final_process_correct_button', false, ['class' => 'mini float-right']); echo '
'; echo '
'; echo '
'; @@ -536,8 +612,9 @@ if (isset($login_failed)) { echo '
'; } + echo '
'; echo '
'; - html_print_submit_button('Ok', 'hide-login-error', false); + html_print_submit_button('Ok', 'hide-login-error', false, ['class' => ' mini float-right']); echo '
'; echo '
'; echo '
'; @@ -560,8 +637,9 @@ if ($login_screen == 'logout') { } echo '
'; + echo '
'; echo '
'; - html_print_submit_button('Ok', 'hide-login-logout', false); + html_print_submit_button('Ok', 'hide-login-logout', false, ['class' => ' mini float-right']); echo '
'; echo '
'; echo '
'; @@ -579,8 +657,9 @@ if ($login_screen === 'disabled_access_node') { echo '

'.__('Centralized user in metaconsole').'

'; echo '

'.__('This user does not have access on node, please enable node access on this user from metaconsole.').'

'; echo '
'; + echo '
'; echo '
'; - html_print_submit_button('Ok', 'hide-login-logout', false); + html_print_submit_button('Ok', 'hide-login-logout', false, ['class' => 'mini float-right']); echo '
'; echo '
'; echo '
'; @@ -687,8 +766,9 @@ if ($login_screen == 'error_authconfig' || $login_screen == 'error_emptyconfig' echo '

'.$title.'

'; echo '

'.$message.''; echo '

'; + echo '
'; echo '
'; - html_print_submit_button('Ok', 'hide-login-error', false); + html_print_submit_button('Ok', 'hide-login-error', false, ['class' => 'mini float-right']); echo '
'; echo '
'; echo '
'; @@ -743,7 +823,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' }); }); - $("#submit-hide-login-error").click (function () { + $("#button-hide-login-error").click (function () { $("#modal_alert" ).dialog('close'); }); @@ -758,19 +838,23 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 220, width: 528, clickOutside: true, overlay: { opacity: 0.5, background: "black" + }, + open: function (event, ui) { + $(".ui-widget-overlay").click(function () { + $('#login_logout').dialog('close'); + }); } }); }); - $("#submit-hide-login-logout").click (function () { - document.location = ""; - }); + $("#button-hide-login-logout").click (function () { + $( "#login_logout" ).dialog( "close" ); + }); }); break; @@ -781,7 +865,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 220, width: 528, clickOutside: true, overlay: { @@ -791,7 +874,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' }); }); - $("#submit-hide-login-logout").click (function () { + $("#button-hide-login-logout").click (function () { document.location = ""; }); }); @@ -805,7 +888,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 400, width: 700, overlay: { opacity: 0.5, @@ -832,7 +914,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' }); }); - $("#submit-hide-login-error").click (function () { + $("#button-hide-login-error").click (function () { $("#login_failed" ).dialog('close'); $("#login_correct_pass").dialog('close'); }); @@ -847,7 +929,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 220, width: 528, clickOutside: true, overlay: { @@ -857,7 +938,7 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' }); }); - $("#submit-reset_correct_button").click (function () { + $("#button-reset_correct_button").click (function () { $("#reset_correct").dialog('close'); }); }); @@ -868,7 +949,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 220, width: 528, clickOutside: true, overlay: { @@ -888,7 +968,6 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' resizable: true, draggable: true, modal: true, - height: 220, width: 528, overlay: { opacity: 0.5, @@ -901,5 +980,18 @@ html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', ' }); } + $(document).ready(function () { + $('#submit-login_button span').removeAttr('style'); + $('#spinner_login').hide(); + }); + + $('#submit-login_button').click(function (e) { + $('.login_nick').hide(); + $('.login_pass').hide(); + $('.login_button').hide(); + $('.reset_password').hide(); + $('#spinner_login').show(); + }); + /* ]]> */ diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 972e6f37ca..2b88b6a103 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -124,8 +124,14 @@ foreach ($stats as $stat) { } $status .= ''; +$table->rowclass = []; +$table->rowclass[0] = 'w100p'; +$table->rowclass[1] = 'w100p'; +$table->rowclass[2] = 'w100p'; +$table->rowclass[3] = 'w100p'; +$table->rowclass[4] = 'w100p'; +$table->rowclass[5] = 'w100p'; $table->data[0][0] = $status; -$table->rowclass[] = ''; $table->data[] = $tdata; diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index 3ce49b646a..a961a62ecb 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.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 @@ -26,38 +26,21 @@ * ============================================================================ */ -use function PHPSTORM_META\map; - // Begin. if (isset($config['id_user']) === false) { include 'general/login_page.php'; exit(); } -?> - -', $menuTypeClass); + $url_logo = ui_get_full_url('index.php'); if (is_reporting_console_node() === true) { $url_logo = 'index.php?logged=1&sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist'; @@ -76,311 +59,400 @@ html_print_div( ), ], true - ), + ).'
', ] ); -require 'operation/menu.php'; -require 'godmode/menu.php'; +$display_classic = ''; +$display_collapsed = 'display: none;'; +if ($menuTypeClass === 'collapsed') { + $display_classic = 'display: none;'; + $display_collapsed = ''; +} -html_print_div( - [ - 'id' => 'button_collapse', - 'class' => sprintf('button_collapse button_%s', $menuTypeClass), - ] -); + +// Tabs. +echo ''; -// Menu_container. -ui_require_jquery_file('cookie'); -$config_fixed_header = false; -if (isset($config['fixed_header']) === true) { - $config_fixed_header = $config['fixed_header']; -} +echo '
'; +require 'operation/menu.php'; +echo '
'; +echo '
'; +require 'godmode/menu.php'; +echo '
'; +echo ''; ?> - - - diff --git a/pandora_console/general/mysqlerr.php b/pandora_console/general/mysqlerr.php index fe24117d3a..6368122da3 100644 --- a/pandora_console/general/mysqlerr.php +++ b/pandora_console/general/mysqlerr.php @@ -1,167 +1,77 @@ - - - - - - -
- -
- - - - /images/icono_cerrar.png'> -
- -
- /images/mysqlerr.png'> -
- -
-
- $value) { - if (preg_match('/._alt/i', $key)) { - $custom_conf_enabled = true; - break; - } +$custom_conf_enabled = false; +foreach ($config as $key => $value) { + if (preg_match('/._alt/i', $key)) { + $custom_conf_enabled = true; + break; } +} - if (!$custom_conf_enabled || isset($config['custom_docs_url_alt'])) { - if (isset($config['custom_docs_url_alt'])) { - $docs_url = $config['custom_docs_url_alt']; - } else { - $docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration'; - } - - echo ' - -
- '.__('Documentation').' - -
-
- '; +if (empty($custom_conf_enabled) === true || isset($config['custom_docs_url_alt']) === true) { + if (isset($config['custom_docs_url_alt']) === true) { + $docs_url = $config['custom_docs_url_alt']; + } else { + $docs_url = 'https://pandorafms.com/manual/en/documentation/02_installation/04_configuration'; } +} + +echo '
'; + echo '
'; + echo '
'; + echo html_print_image('images/mysqlerr.png', true, ['alt' => __('Mysql error'), 'border' => 0]); + echo '
'; + echo '
'; + echo '
'; + echo '

'.__('Database error').'

'; + echo '

'.$message.'

'; + echo '
'; + echo '
'; + echo '
'; + html_print_submit_button( + __('Documentation'), + 'mysqlerr_button', + false, + ['class' => 'mini float-right'] + ); + echo '
'; + echo '
'; + echo '
'; + echo '
'; + ?> - ?> - - - -
- -
- - - diff --git a/pandora_console/general/pandora_help.php b/pandora_console/general/pandora_help.php index 9d0a5e79d6..c78c006a9f 100644 --- a/pandora_console/general/pandora_help.php +++ b/pandora_console/general/pandora_help.php @@ -77,7 +77,7 @@ if (! $id || ! file_exists($help_file)) { echo '
'.__("%s help system has been called with a help reference that currently don't exist. There is no help content to show.", get_product_name()).'
'; echo '

'; echo ''; echo ''; ?> diff --git a/pandora_console/godmode/agentes/agent_conf_gis.php b/pandora_console/godmode/agentes/agent_conf_gis.php index 6b80ed752a..ca213bae37 100644 --- a/pandora_console/godmode/agentes/agent_conf_gis.php +++ b/pandora_console/godmode/agentes/agent_conf_gis.php @@ -59,7 +59,7 @@ ui_print_warning_message( ] ); -$table = new StdClass(); +$table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; $table->data = []; diff --git a/pandora_console/godmode/agentes/agent_incidents.php b/pandora_console/godmode/agentes/agent_incidents.php index 796a3afd77..e7e442e7e3 100644 --- a/pandora_console/godmode/agentes/agent_incidents.php +++ b/pandora_console/godmode/agentes/agent_incidents.php @@ -59,23 +59,22 @@ $result = integria_api_call(null, null, null, null, 'get_incidents', $params, fa $result = json_decode($result, true); -$count = count($result); - -$result = array_slice($result, $offset, $config['block_size']); - -if (empty($result)) { +if (empty($result) === true) { $result = []; $count = 0; echo '
'.__('No incidents associated to this agent').'

'; return; +} else { + $count = count($result); + $result = array_slice($result, $offset, $config['block_size']); } -// Show pagination +// Show pagination. ui_pagination($count, $url, $offset, 0, false, 'offset'); // ($count + $offset) it's real count of incidents because it's use LIMIT $offset in query. echo '
'; -// Show headers +// Show headers. $table->width = '100%'; $table->class = 'databox'; $table->cellpadding = 4; diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 836b68ba68..f524fb7d9e 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -1,11 +1,11 @@ '; echo '
'; // Custom ID. $custom_id_div = '
'; -$custom_id_div .= '

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

'; +$custom_id_div .= '

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

'; $custom_id_div .= html_print_input_text( 'custom_id', $custom_id, @@ -209,107 +206,214 @@ $custom_id_div .= html_print_input_text( 'agent_custom_id' ).'
'; -if (!$new_agent && $alias != '') { - $table_agent_name = '

'.__('Agent name').'

'; - $table_agent_name .= '
'; - $table_agent_name .= '
'.html_print_input_text('agente', $nombre_agente, '', 50, 100, true).'
'; - $table_agent_name .= '
'; +// Get groups. +$groups = users_get_groups($config['id_user'], 'AR', false); - if ($id_agente) { - $table_agent_name .= ''; - $table_agent_name .= ''; - $table_agent_name .= html_print_image( - 'images/zoom.png', - true, - [ - 'border' => 0, - 'title' => __('Agent detail'), - 'class' => 'invert_filter', - ] - ); - $table_agent_name .= ''; +// Get modules. +$modules = db_get_all_rows_sql( + 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo + WHERE id_agente = '.$id_parent +); +$modules_values = []; +$modules_values[0] = __('Any'); +if (is_array($modules) === true) { + foreach ($modules as $m) { + $modules_values[$m['id_module']] = $m['name']; } +} - $agent_options_update = 'agent_options_update'; - - // Delete link from here. - if (is_management_allowed() === true) { - $table_agent_name .= "".html_print_image( - 'images/cross.png', - true, - [ - 'title' => __('Delete agent'), - 'class' => 'invert_filter', - ] - ).''; - } - - // Remote configuration available. +// Remote configuration available. +if (isset($filename) === true && file_exists($filename['md5']) === true) { + $remote_agent = true; + $agent_md5 = md5(io_safe_output(agents_get_name($id_agente)), false); +} else { $remote_agent = false; - if (isset($filename)) { - if (file_exists($filename['md5'])) { - $remote_agent = true; +} - $agent_name = agents_get_name($id_agente); - $agent_name = io_safe_output($agent_name); - $agent_md5 = md5($agent_name, false); +// Get Servers. +$servers = servers_get_names(); +// Set the agent have not server. +if (array_key_exists($server_name, $servers) === false) { + $server_name = 0; +} - $table_agent_name .= ''; - $table_agent_name .= html_print_image( - 'images/application_edit.png', - true, - [ - 'border' => 0, - 'title' => __('This agent can be remotely configured'), - 'class' => 'invert_filter', - ] - ); - $table_agent_name .= ''; +if ($new_agent === true) { + // Set first server by default. + $servers_get_names = $servers; + $array_keys_servers_get_names = array_keys($servers_get_names); + $server_name = reset($array_keys_servers_get_names); +} + + +// QR Code table. +if ($new_agent === false) { + $CodeQRContent .= html_print_div(['id' => 'qr_container_image'], true); + $CodeQRContent .= html_print_anchor( + [ + 'id' => 'qr_code_agent_view', + 'href' => ui_get_full_url('mobile/index.php?page=agent&id='.$id_agente), + ], + true + ); + $CodeQRContent .= '
'.$custom_id_div; + + // QR code div. + $CodeQRTable = html_print_div( + [ + 'class' => 'agent_qr', + 'content' => $CodeQRContent, + ], + true + ); +} else { + $CodeQRTable = ''; +} + +// Advanced mode. +if (enterprise_installed() === true) { + // Safe operation mode. + if ($new_agent === false) { + $sql_modules = db_get_all_rows_sql( + 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo + WHERE id_agente = '.$id_agente + ); + $safe_mode_modules = []; + $safe_mode_modules[0] = __('Any'); + if (is_array($sql_modules) === true) { + foreach ($sql_modules as $m) { + $safe_mode_modules[$m['id_module']] = $m['name']; + } } } - $table_agent_name .= '
'; - - // QR code div. - $table_qr_code = '
'; - $table_qr_code .= '

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

'; - $table_qr_code .= '
'; - if ($id_agente) { - $table_qr_code .= ""; + // Calculate cps value - agents. + if ($new_agent === false) { + $cps_val = service_agents_cps($id_agente); + } else { + // No agent defined, use received cps as base value. + if ($cps >= 0) { + $cps_val = $cps; + } } - // Add Custom id div. - $table_qr_code .= '
'; - $table_qr_code .= $custom_id_div; - $table_qr_code .= '
'; + // Parent agents. + $paramsParentAgent = []; + $paramsParentAgent['return'] = true; + $paramsParentAgent['show_helptip'] = false; + $paramsParentAgent['input_name'] = 'id_parent'; + $paramsParentAgent['print_hidden_input_idagent'] = true; + $paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent'; + $paramsParentAgent['hidden_input_idagent_value'] = $id_parent; + $paramsParentAgent['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent); + $paramsParentAgent['selectbox_id'] = 'cascade_protection_module'; + $paramsParentAgent['javascript_is_function_select'] = true; + $paramsParentAgent['cascade_protection'] = true; + $paramsParentAgent['input_style'] = 'width: 100%;'; + + if ($id_agente !== 0) { + // Deletes the agent's offspring. + $paramsParentAgent['delete_offspring_agents'] = $id_agente; + } } -if ($new_agent) { - $label_select_child_left = 'label_select_child_left'; - $label_select_parent = 'label_select_parent'; +$listIcons = gis_get_array_list_icons(); + +$arraySelectIcon = []; +foreach ($listIcons as $index => $value) { + $arraySelectIcon[$index] = $index; } -$table_alias = '

'.__('Alias').'

'; -$table_alias .= '
'; -$table_alias .= '
'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'
'; -if ($new_agent) { - $table_alias .= '
'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'
'; +// Agent icons. +$path = 'images/gis_map/icons/'; +// TODO set better method the path. +$table_adv_agent_icon = '

'.__('Agent icon').'

'; +if ($icon_path == '') { + $display_icons = 'none'; + // Hack to show no icon. Use any given image to fix not found image errors. + $path_without = 'images/spinner.gif'; + $path_default = 'images/spinner.gif'; + $path_ok = 'images/spinner.gif'; + $path_bad = 'images/spinner.gif'; + $path_warning = 'images/spinner.gif'; +} else { + $display_icons = ''; + $path_without = $path.$icon_path.'.default.png'; + $path_default = $path.$icon_path.'.default.png'; + $path_ok = $path.$icon_path.'.ok.png'; + $path_bad = $path.$icon_path.'.bad.png'; + $path_warning = $path.$icon_path.'.warning.png'; } -$table_alias .= '
'; +$tableAgent = new stdClass(); +$tableAgent->class = 'floating_form primary_form'; +$tableAgent->data = []; +$tableAgent->style = []; +$tableAgent->cellclass = []; +$tableAgent->colspan = []; +$tableAgent->rowspan = []; -$table_ip = '

'.__('IP Address').'

'; -$table_ip .= '
'; -$table_ip .= '
'.html_print_input_text('direccion', $direccion_agente, '', 16, 100, true).'
'; -$table_ip .= '
'.html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true).__('Unique IP').'
'; -$table_ip .= '
'.html_print_input( +// Agent name. +if ($new_agent === false) { + $tableAgent->data['caption_name'][0] = __('Agent name'); + $tableAgent->rowclass['name'] = 'w540px'; + $tableAgent->cellstyle['name'][0] = 'width: 100%;'; + $tableAgent->data['name'][0] = html_print_input_text('agente', $nombre_agente, '', 76, 100, true, false, false, '', 'w100p'); + $tableAgent->data['name'][0] .= html_print_div( + [ + 'class' => 'moduleIdBox', + 'content' => __('ID').' '.$id_agente.'', + ], + true + ); + // Agent options for QR code. + $agent_options_update = 'agent_options_update'; +} + +// Alias. +$tableAgent->data['caption_alias'][0] = __('Alias'); +$tableAgent->rowclass['alias'] = 'w540px'; +$tableAgent->data['alias'][0] = html_print_input_text('alias', $alias, '', 50, 100, true, false, true, '', 'w540px'); +if ($new_agent === true) { + $tableAgent->rowclass['additional_alias'] = 'subinput'; + $tableAgent->data['additional_alias'][0] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true); + $tableAgent->data['additional_alias'][1] = __('Use alias as name'); +} else { + if ($remote_agent === true) { + $tableAgent->data['alias'][0] .= html_print_anchor( + [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$id_agente.'&disk_conf='.$agent_md5, + 'content' => html_print_image( + 'images/remote-configuration@svg.svg', + true, + [ + 'border' => 0, + 'title' => __('This agent can be remotely configured'), + 'class' => 'invert_filter after_input_icon', + ] + ), + ], + true + ); + } +} + +// Ip adress. +$tableAgent->data['caption_ip_address'] = __('IP Address'); +$tableAgent->rowclass['ip_address'] = 'w540px'; +$tableAgent->data['ip_address'][0] = html_print_input_text('direccion', $direccion_agente, '', 16, 100, true, false, false, '', 'w540px'); + +$tableAgent->rowclass['additional_ip_address'] = 'subinput'; +$tableAgent->data['additional_ip_address'][0] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); +$tableAgent->data['additional_ip_address'][1] = __('Unique IP'); +$tableAgent->cellclass['additional_ip_address'][1] = 'w120px'; +$tableAgent->data['additional_ip_address'][2] = html_print_input( [ 'type' => 'switch', 'id' => 'fixed_ip', 'name' => 'fixed_ip', 'value' => $fixed_ip, ] -).__('Fix IP address').'

'.ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true).'

'; +); $table_ip .= '
'; @@ -336,48 +440,73 @@ $modules = db_get_all_rows_sql( 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo WHERE id_agente = '.$id_parent ); -$modules_values = []; -$modules_values[0] = __('Any'); -if (is_array($modules)) { - foreach ($modules as $m) { - $modules_values[$m['id_module']] = $m['name']; - } +$tableAgent->data['additional_ip_address'][3] = __('Fix IP address'); +$tableAgent->data['additional_ip_address'][3] .= ui_print_help_tip(__('Avoid automatic IP address update when agent IP changes.'), true); + +// IP Address List. +if ($new_agent === false) { + $tableAgent->data['caption_ip_address_list'] = __('IP Address list'); + $tableAgent->data['ip_address_list'][0] = html_print_select(agents_get_addresses($id_agente), 'address_list', $direccion_agente, '', '', 0, true, false, true, 'w540px'); + $tableAgent->rowclass['additional_ip_address_list'] = 'subinput'; + $tableAgent->data['additional_ip_address_list'][0] = html_print_checkbox_switch('delete_ip', 1, false, true); + $tableAgent->data['additional_ip_address_list'][1] = __('Delete selected IPs'); } -$table_primary_group = '

'.__('Primary group').'

'; -$table_primary_group .= '
'; -// Cannot change primary group if user have not permission for that group. -if (isset($groups[$grupo]) || $new_agent) { - $table_primary_group .= html_print_input( - [ - 'type' => 'select_groups', - 'returnAllGroup' => false, - 'name' => 'grupo', - 'selected' => $grupo, - 'return' => true, - 'required' => true, - 'privilege' => 'AW', - ] +// Select primary group. +$tableAgent->data['caption_primary_group'][0] = __('Primary group'); +if (isset($groups[$grupo]) === true || $new_agent === true) { + $tableAgent->rowclass['primary_group'] = 'w540px'; + // Cannot change primary group if user have not permission for that group. + $tableAgent->data['primary_group'][0] = html_print_select_groups( + false, + 'AW', + false, + 'grupo', + $grupo, + '', + '', + 0, + true, + false, + true, + '', + false, + '', + '', + false, + 'id_grupo', + false, + false, + false, + '540px', + false, + true, ); } else { - $table_primary_group .= groups_get_name($grupo); - $table_primary_group .= html_print_input_hidden('grupo', $grupo, true); + $tableAgent->data['primary_group'][0] .= groups_get_name($grupo); + $tableAgent->data['primary_group'][0] .= html_print_input_hidden('grupo', $grupo, true); } -$table_primary_group .= '
'; -if ($id_agente === 0) { - $hidden = 'display: none;'; -} else { - $hidden = ''; -} +$tableAgent->data['primary_group'][0] .= html_print_div( + [ + 'content' => ui_print_group_icon( + $grupo, + true, + '', + ($id_agente === 0) ? 'display: none;' : '', + true, + false, + false, + 'after_input_icon' + ), + ], + true +); -$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden); - -$table_primary_group .= '
'; - -$table_interval = '

'.__('Interval').'

'; -$table_interval .= '
'; -$table_interval .= html_print_extended_select_for_time( +$tableAgent->data['caption_interval'][0] = __('Interval'); +// $tableAgent->rowstyle['interval'] = 'width: 260px'; +$tableAgent->rowclass['interval'] = 'w540px'; +$tableAgent->data['interval'][0] = html_print_extended_select_for_time( 'intervalo', $intervalo, '', @@ -387,61 +516,82 @@ $table_interval .= html_print_extended_select_for_time( true, false, true, - 'w40p' + 'w33p' ); - - if ($intervalo < SECONDS_5MINUTES) { - $table_interval .= clippy_context_help('interval_agent_min'); + $tableAgent->data['interval'][0] .= clippy_context_help('interval_agent_min'); } -$table_interval .= '
'; - -$table_os = '

'.__('OS').'

'; -$table_os .= '
'; -$table_os .= html_print_select_from_sql( +$tableAgent->data['caption_os'][0] = __('OS'); +$tableAgent->rowclass['os'] = 'w540px'; +$tableAgent->data['os'][0] = html_print_select_from_sql( 'SELECT id_os, name FROM tconfig_os', 'id_os', $id_os, '', '', '0', + true, + false, + true, + false, + 'width: 540px;' +); +$tableAgent->data['os'][0] .= html_print_div( + [ + 'class' => 'after_input_icon', + 'id' => 'os_preview', + 'content' => ui_print_os_icon( + $id_os, + false, + true + ), + ], true ); -$table_os .= '
'; -$table_os .= ui_print_os_icon($id_os, false, true); -$table_os .= '
'; -// Network server. -$servers = servers_get_names(); -// Set the agent have not server. -if (array_key_exists($server_name, $servers) === false) { - $server_name = 0; -} - -$table_server = '

'.__('Server').'

'; -$table_server .= '
'; -if ($new_agent) { - // Set first server by default. - $servers_get_names = $servers; - $array_keys_servers_get_names = array_keys($servers_get_names); - $server_name = reset($array_keys_servers_get_names); -} - -$table_server .= html_print_select( +$tableAgent->data['caption_server'][0] = __('Server'); +$tableAgent->rowclass['server'] = 'w540px'; +$tableAgent->data['server'][0] = html_print_select( $servers, 'server_name', $server_name, '', __('None'), 0, - true -).'
'; + true, + false, + true, + 'w540px', + false, + 'width: 540px;' +); +// Description. +$tableAgent->data['caption_description'][0] = __('Description'); +$tableAgent->rowclass['description'] = 'w540px'; +$tableAgent->data['description'][0] = html_print_textarea( + 'comentarios', + 3, + 80, + $comentarios, + '', + true, + 'agent_description w540px' +); -$table_satellite = ''; -if ($remote_agent === true) { +html_print_div( + [ + 'class' => 'box-flat white_table_flex white_box agent_details_col', + 'style' => 'display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px', + 'content' => html_print_table($tableAgent, true).$CodeQRTable, + ] +); +/* + TODO REVIEW + $table_satellite = ''; + if ($remote_agent === true) { // Satellite server selector. $satellite_servers = db_get_all_rows_filter( 'tserver', @@ -473,148 +623,70 @@ if ($remote_agent === true) { ] ).'
'; } -} + } +*/ -// Description. -$table_description = '

'.__('Description').'

'; -$table_description .= html_print_textarea( - 'comentarios', - 3, - 10, - $comentarios, - '', - true, - 'agent_description' -).'
'; - -// QR code. -echo '
-
-
'.$table_agent_name.$table_alias.$table_ip.$table_primary_group.'
-
'.$table_interval.$table_os.$table_server.$table_satellite.$table_description.'
-
'; -if (!$new_agent && $alias != '') { - echo $table_qr_code; -} - -echo '
'; - -if (enterprise_installed()) { - $adv_secondary_groups_label = '
'; - $adv_secondary_groups_label .= '

'; - $adv_secondary_groups_label .= __('Secondary groups'); - $adv_secondary_groups_label .= '

'; - $adv_secondary_groups_label .= '
'; - $select_agent_secondary = html_print_select_agent_secondary( +// Advanced options. +$tableAdvancedAgent = new stdClass(); +$tableAdvancedAgent->class = 'filter-table-adv floating_form primary_form'; +$tableAdvancedAgent->data = []; +$tableAdvancedAgent->style = []; +$tableAdvancedAgent->cellclass = []; +$tableAdvancedAgent->colspan = []; +$tableAdvancedAgent->rowspan = []; +// Secondary groups. +$tableAdvancedAgent->data['secondary_groups'][] = html_print_label_input_block( + __('Secondary groups'), + html_print_select_agent_secondary( $agent, $id_agente - ); + ) +); - // Safe operation mode. - if ($id_agente) { - $sql_modules = db_get_all_rows_sql( - 'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo - WHERE id_agente = '.$id_agente - ); - $safe_mode_modules = []; - $safe_mode_modules[0] = __('Any'); - if (is_array($sql_modules)) { - foreach ($sql_modules as $m) { - $safe_mode_modules[$m['id_module']] = $m['name']; - } - } - - $table_adv_safe = '

'.__('Safe operation mode').'

'; - $table_adv_safe .= html_print_checkbox_switch('safe_mode', 1, $safe_mode, true); - $table_adv_safe .= __('Module').' '.html_print_select($safe_mode_modules, 'safe_mode_module', $safe_mode_module, '', '', 0, true).'
'; - } - - // Remote configuration. - $table_adv_remote = '

'.__('Remote configuration').'

'; - - if (!$new_agent && isset($filename) && file_exists($filename['md5'])) { - $table_adv_remote .= date('F d Y H:i:s', fileatime($filename['md5'])); - // Delete remote configuration. - $table_adv_remote .= ''; - $table_adv_remote .= html_print_image( - 'images/cross.png', - true, - [ - 'title' => __('Delete remote configuration file'), - 'style' => 'vertical-align: middle;', - 'class' => 'invert_filter', - ] - ).''; - $table_adv_remote .= ''; - } else { - $table_adv_remote .= ''.__('Not available').''; - } - - $table_adv_remote .= '
'; +// Parent agent. +$tableAdvancedAgent->data['parent_agent'][] = html_print_label_input_block( + __('Parent'), + ui_print_agent_autocomplete_input($paramsParentAgent) +); - // Calculate cps value - agents. - if ($id_agente) { - $cps_val = service_agents_cps($id_agente); - } else { - // No agent defined, use received cps as base value. - if ($cps >= 0) { - $cps_val = $cps; - } - } - - $cps_html = '
'; - $cps_html .= html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true); - $cps_html .= __('Cascade protection services').' '; - $cps_html .= '
'; - - $table_adv_cascade .= $cps_html; -} - -$table_adv_parent = '
'; -$params = []; -$params['return'] = true; -$params['show_helptip'] = true; -$params['input_name'] = 'id_parent'; -$params['print_hidden_input_idagent'] = true; -$params['hidden_input_idagent_name'] = 'id_agent_parent'; -$params['hidden_input_idagent_value'] = $id_parent; -$params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent); -$params['selectbox_id'] = 'cascade_protection_module'; -$params['javascript_is_function_select'] = true; -$params['cascade_protection'] = true; -if ($id_agente !== 0) { - // Deletes the agent's offspring. - $params['delete_offspring_agents'] = $id_agente; -} - -$table_adv_parent .= '
'; -$table_adv_parent .= ui_print_agent_autocomplete_input($params); -if (enterprise_installed()) { - $table_adv_parent .= html_print_checkbox_switch( +if (enterprise_installed() === true) { + $cascadeProtectionContents = []; + $cascadeProtectionContents[] = html_print_checkbox_switch( 'cascade_protection', 1, $cascade_protection, true - ).__('Cascade protection').' '; + ); - $table_adv_parent .= __('Module').' '.html_print_select( + $cascadeProtectionContents[] = html_print_select( $modules_values, 'cascade_protection_module', $cascade_protection_module, '', '', 0, - true + true, + false, + true, + 'w220p' + ); + + $tableAdvancedAgent->data['caption_cascade_protection'][] = html_print_label_input_block( + __('Cascade protection modules'), + html_print_div( + [ + 'class' => 'flex-row-center', + 'content' => implode('', $cascadeProtectionContents), + ], + true + ) ); } -$table_adv_parent .= '
'; - -// Learn mode / Normal mode. -$table_adv_module_mode = '

'.__('Module definition').'

'; -$table_adv_module_mode .= '
'; -$table_adv_module_mode .= html_print_radio_button_extended( +// Module Definition (Learn mode). +$switchButtons = []; +$switchButtons[] = html_print_radio_button_extended( 'modo', 1, __('Learning mode'), @@ -624,7 +696,7 @@ $table_adv_module_mode .= html_print_radio_button_extended( '', true ); -$table_adv_module_mode .= html_print_radio_button_extended( +$switchButtons[] = html_print_radio_button_extended( 'modo', 0, __('Normal mode'), @@ -634,7 +706,7 @@ $table_adv_module_mode .= html_print_radio_button_extended( '', true ); -$table_adv_module_mode .= html_print_radio_button_extended( +$switchButtons[] = html_print_radio_button_extended( 'modo', 2, __('Autodisable mode'), @@ -644,23 +716,73 @@ $table_adv_module_mode .= html_print_radio_button_extended( '', true ); -$table_adv_module_mode .= '
'; -// Status (Disabled / Enabled). -$table_adv_status = '
'; -$table_adv_status .= html_print_checkbox_switch( - 'disabled', - 1, - $disabled, - true +$tableAdvancedAgent->data['module_definition'][] = html_print_label_input_block( + __('Module definition'), + html_print_div( + [ + 'class' => 'switch_radio_button', + 'content' => implode('', $switchButtons), + ], + true + ) +); + +// CPS - Cascade Protection Services. +$tableAdvancedAgent->data['cps_value'][] = html_print_label_input_block( + __('Cascade protection services'), + html_print_checkbox_switch('cps', $cps_val, ($cps >= 0), true) +); + +// Update GIS data. +if ((bool) $config['activate_gis'] === true) { + $tableAdvancedAgent->data['gis'][] = html_print_label_input_block( + __('Update new GIS data'), + html_print_checkbox_switch('update_gis_data', 1, ($new_agent === true), true) + ); +} + +// Agent Icons. +$tableAdvancedAgent->data['agent_icon'][] = html_print_label_input_block( + __('Agent icon'), + html_print_select( + $arraySelectIcon, + 'icon_path', + $icon_path, + 'changeIcons();', + __('None'), + '', + true, + false, + true, + 'w540px' + ).html_print_image( + $path_ok, + true, + [ + 'id' => 'icon_ok', + 'style' => 'display:'.$display_icons.';', + ] + ).html_print_image( + $path_bad, + true, + [ + 'id' => 'icon_bad', + 'style' => 'display:'.$display_icons.';', + ] + ).html_print_image( + $path_warning, + true, + [ + 'id' => 'icon_warning', + 'style' => 'display:'.$display_icons.';', + ] + ) ); -$table_adv_status .= '

'.__('Disabled mode').'

'; -$table_adv_status .= '
'; // Url address. -if (enterprise_installed()) { - $table_adv_url = '

'.__('Url address').'

'; - $table_adv_url .= html_print_input_text( +if (enterprise_installed() === true) { + $urlAddressInput = html_print_input_text( 'url_description', $url_description, '', @@ -670,152 +792,131 @@ if (enterprise_installed()) { false, false, '', - '', + 'w540px', '', // Autocomplete. 'new-password' - ).'
'; + ); } else { - $table_adv_url = '

'.__('Url address').'

'; - $table_adv_url .= html_print_input_text( + $urlAddressInput = html_print_input_text( 'url_description', $url_description, '', 45, 255, true - ).''; + ); } -$table_adv_quiet = '
'; -$table_adv_quiet .= html_print_checkbox_switch('quiet', 1, $quiet, true); -$table_adv_quiet .= '

'.__('Quiet').'

'; -$table_adv_quiet .= '
'; +$tableAdvancedAgent->data['url_description'][] = html_print_label_input_block( + __('URL Address'), + $urlAddressInput +); -$listIcons = gis_get_array_list_icons(); +// Agent status. +$tableAdvancedAgent->data['agent_status'][] = html_print_label_input_block( + __('Disabled mode'), + html_print_checkbox_switch( + 'disabled', + 1, + $disabled, + true + ) +); -$arraySelectIcon = []; -foreach ($listIcons as $index => $value) { - $arraySelectIcon[$index] = $index; +// Quiet mode. +$tableAdvancedAgent->data['agent_quiet'][] = html_print_label_input_block( + __('Quiet'), + html_print_checkbox_switch('quiet', 1, $quiet, true) +); + +// Remote configuration. +if ($new_agent === false && isset($filename) === true && file_exists($filename['md5']) === true) { + $remoteConfigurationElements = []; + $remoteConfigurationElements[] = html_print_input_text( + 'remote_file_timestamp', + date('F d Y H:i:s', fileatime($filename['md5'])), + '', + 0, + 100, + true, + true, + false, + '', + 'w540px' + ); + $remoteConfigurationElements[] = html_print_anchor( + [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente, + 'content' => html_print_image( + 'images/delete.svg', + true, + [ + 'border' => 0, + 'title' => __('Delete remote configuration file'), + 'class' => 'invert_filter after_input_icon', + ] + ), + ], + true + ); + + $tableAdvancedAgent->data['remote_configuration'][] = html_print_label_input_block( + __('Remote configuration'), + html_print_div( + [ + 'class' => 'flex-row-center', + 'content' => implode('', $remoteConfigurationElements), + ], + true + ) + ); } -$path = 'images/gis_map/icons/'; -// TODO set better method the path. -$table_adv_agent_icon = '

'.__('Agent icon').'

'; -if ($icon_path == '') { - $display_icons = 'none'; - // Hack to show no icon. Use any given image to fix not found image errors. - $path_without = 'images/spinner.gif'; - $path_default = 'images/spinner.gif'; - $path_ok = 'images/spinner.gif'; - $path_bad = 'images/spinner.gif'; - $path_warning = 'images/spinner.gif'; -} else { - $display_icons = ''; - $path_without = $path.$icon_path.'.default.png'; - $path_default = $path.$icon_path.'.default.png'; - $path_ok = $path.$icon_path.'.ok.png'; - $path_bad = $path.$icon_path.'.bad.png'; - $path_warning = $path.$icon_path.'.warning.png'; -} - -$table_adv_agent_icon .= html_print_select( - $arraySelectIcon, - 'icon_path', - $icon_path, - 'changeIcons();', - __('None'), - '', +// Safe operation mode. +$safeOperationElements = []; +$safeOperationElements[] = html_print_checkbox_switch( + 'safe_mode', + 1, + $safe_mode, true -).html_print_image( - $path_ok, - true, - [ - 'id' => 'icon_ok', - 'style' => 'display:'.$display_icons.';', - ] -).html_print_image( - $path_bad, - true, - [ - 'id' => 'icon_bad', - 'style' => 'display:'.$display_icons.';', - ] -).html_print_image( - $path_warning, - true, - [ - 'id' => 'icon_warning', - 'style' => 'display:'.$display_icons.';', - ] -).'
'; +); +$safeOperationElements[] = html_print_select( + $safe_mode_modules, + 'safe_mode_module', + $safe_mode_module, + '', + '', + 0, + true +); -if ($config['activate_gis']) { - $table_adv_gis = '

'.__('Update new GIS data:').'

'; - if ($new_agent) { - $update_gis_data = true; - } +$tableAdvancedAgent->data['safe_operation'][] = html_print_label_input_block( + __('Safe operation mode'), + html_print_div( + [ + 'class' => 'flex-row-center', + 'content' => implode('', $safeOperationElements), + ], + true + ) +); - $table_adv_gis .= html_print_checkbox_switch('update_gis_data', 1, $update_gis_data, true).'No / Yes
'; -} - - -if (enterprise_installed()) { - $advanced_div = '
'; -} else { - $advanced_div = ''; - -$table_adv_options .= '
'; -$table_adv_options .= $table_adv_parent; -$table_adv_options .= $table_adv_module_mode; -$table_adv_options .= $table_adv_cascade; - -if ($new_agent) { - // If agent is new, show custom id as old style format. - $table_adv_options .= $custom_id_div; -} - -$table_adv_options .= '
'; - -$table_adv_options .= ' -
- '.$table_adv_gis.$table_adv_agent_icon.$table_adv_url.$table_adv_quiet.$table_adv_status.$table_adv_remote.$table_adv_safe.' -
'; - -if (enterprise_installed()) { - echo '
'; +if (enterprise_installed() === true) { ui_toggle( - $table_adv_options, - __('Advanced options'), + html_print_table($tableAdvancedAgent, true), + ''.__('Advanced options').'', '', '', true, false, - 'white_box white_box_opened', - 'no-border flex' + 'white_box_content', + 'no-border white_table_graph' ); - echo '
'; } -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'custom_fields_table'; - -$table->head = [ - 0 => __('Click to display'), -]; -$table->class = 'info_table'; -$table->style = []; -$table->style[0] = 'font-weight: bold;'; -$table->data = []; -$table->rowstyle = []; +// Custom fields. +$customOutputData = ''; $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -823,13 +924,8 @@ if ($fields === false) { $fields = []; } -$i = 0; foreach ($fields as $field) { - $id_custom_field = $field['id_field']; - - $data[0] = '
'; - $data[0] .= ''.$field['name'].''; - $data[0] .= '
'; + // Filling the data. $combo = []; $combo = $field['combo_values']; $combo = explode(',', $combo); @@ -851,15 +947,8 @@ foreach ($fields as $field) { $custom_value = ''; } - $table->rowstyle[$i] = 'cursor: pointer;user-select: none;'; - if (!empty($custom_value)) { - $table->rowstyle[($i + 1)] = 'display: table-row;'; - } else { - $table->rowstyle[($i + 1)] = 'display: none;'; - } - - if ($field['is_password_type']) { - $data_field[1] = html_print_input_text_extended( + if ((bool) $field['is_password_type'] === true) { + $customContent = html_print_input_text_extended( 'customvalue_'.$field['id_field'], $custom_value, 'customvalue_'.$field['id_field'], @@ -887,7 +976,7 @@ foreach ($fields as $field) { 2, 65, $link_text, - 'class="min-height-30px', + 'class="min-height-30px w100p"', true ); $data_field[1] .= '
'; @@ -898,22 +987,22 @@ foreach ($fields as $field) { 2, 65, $link_url, - 'class="min-height-30px', + 'class="min-height-30px w100p"', true ); } else { - $data_field[1] = html_print_textarea( + $customContent = html_print_textarea( 'customvalue_'.$field['id_field'], 2, 65, $custom_value, - 'class="min-height-30px', + 'class="min-height-30px w100p"', true ); } - if ($field['combo_values'] !== '') { - $data_field[1] = html_print_input( + if (empty($field['combo_values']) === false) { + $customContent = html_print_input( [ 'type' => 'select_search', 'fields' => $combo_values, @@ -929,61 +1018,32 @@ foreach ($fields as $field) { ); }; - $table->rowid[] = 'name_field-'.$id_custom_field; - $table->data[] = $data; - - $table->rowid[] = 'field-'.$id_custom_field; - $table->data[] = $data_field; - $i += 2; + $customOutputData .= ui_toggle( + html_print_div( + [ 'content' => $customContent ], + true + ), + $field['name'], + $field['name'], + 'custom_field_toggle_'.$field['id_field'], + true, + true, + ); } -if (enterprise_installed()) { - if (!empty($fields)) { - echo '
'; - ui_toggle( - html_print_table($table, true), - __('Custom fields'), - '', - '', - true, - false, - 'white_box white_box_opened', - 'no-border' - ); - echo '
'; - } -} else { - echo '
'; +if (empty($fields) === false) { ui_toggle( - $table_adv_options, - __('Advanced options'), + $customOutputData, + ''.__('Custom fields').'', '', '', true, false, - 'white_box white_box_opened', - 'no-border flex' + 'white_box white_box_opened white_table_graph_fixed', + 'no-border custom_fields_elements' ); - if (!empty($fields)) { - ui_toggle( - html_print_table($table, true), - __('Custom fields'), - '', - '', - true, - false, - 'white_box white_box_opened', - 'no-border' - ); - } - - echo '
'; - - echo '
'; } -echo '
'; - // The context help about the learning mode. if ($modo == 0) { echo ""; @@ -994,28 +1054,51 @@ if ($modo == 0) { echo clippy_context_help('modules_not_learning_mode'); echo ''; - -if ($id_agente) { - echo '
'; - html_print_submit_button( +if ($new_agent === false) { + $actionButtons = html_print_submit_button( __('Update'), 'updbutton', false, - 'class="sub upd"' + [ 'icon' => 'update'], + true ); - html_print_input_hidden('update_agent', 1); - html_print_input_hidden('id_agente', $id_agente); + $actionButtons .= html_print_input_hidden('update_agent', 1); + $actionButtons .= html_print_input_hidden('id_agente', $id_agente); + + if (is_management_allowed() === true) { + $actionButtons .= html_print_button( + __('Delete agent'), + 'deleteAgent', + false, + 'deleteAgentDialog('.$id_agente.')', + [ + 'icon' => 'delete', + 'mode' => 'secondary dialog_opener', + ], + true + ); + } } else { - html_print_submit_button( + $actionButtons = html_print_input_hidden('create_agent', 1); + $actionButtons .= html_print_submit_button( __('Create'), 'crtbutton', false, - 'class="sub wand"' + [ 'icon' => 'wand'], + true ); - html_print_input_hidden('create_agent', 1); } -echo '
'; +$actionButtons .= html_print_go_back_button( + 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente', + ['button_class' => ''], + true +); + +html_print_action_buttons($actionButtons, ['type' => 'form_action']); + +echo '
'; +echo ''; ui_require_jquery_file('pandora.controls'); ui_require_jquery_file('ajaxqueue'); @@ -1035,6 +1118,15 @@ ui_require_jquery_file('bgiframe'); } } + function deleteAgentDialog($idAgente) { + confirmDialog({ + title: "", + message: "", + onAccept: function() { + window.location.assign('index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente='+$idAgente); + } + }); + } //Use this function for change 3 icons when change the selectbox function changeIcons() { diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index 933b37fbce..ea5c8176c8 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -1,20 +1,35 @@ $id_agente, 'id_tipo_modulo' => $row2['type'], @@ -113,14 +129,14 @@ if (isset($_POST['template_id'])) { $name = $row2['name']; - // Put tags in array if the component has to add them later - if (!empty($row2['tags'])) { + // Put tags in array if the component has to add them later. + if (empty($row2['tags']) === false) { $tags = explode(',', $row2['tags']); } else { $tags = []; } - // Check if this module exists in the agent + // Check if this module exists in the agent. $module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', ['delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente]); if ($module_name_check !== false) { @@ -132,13 +148,13 @@ if (isset($_POST['template_id'])) { if ($id_agente_modulo === false) { $error_count++; } else { - if (!empty($tags)) { - // Creating tags + if (empty($tags) === false) { + // Creating tags. $tag_ids = []; foreach ($tags as $tag_name) { $tag_id = tags_get_id($tag_name); - // If tag exists in the system we store to create it + // If tag exists in the system we store to create it. $tag_ids[] = $tag_id; } @@ -152,7 +168,7 @@ if (isset($_POST['template_id'])) { } if ($error_count > 0) { - if (empty($modules_already_added)) { + if (empty($modules_already_added) === true) { ui_print_error_message(__('Error adding modules').sprintf(' (%s)', $error_count)); } else { ui_print_error_message(__('Error adding modules. The following errors already exists: ').implode(', ', $modules_already_added)); @@ -168,8 +184,6 @@ if (isset($_POST['template_id'])) { // ========================== // TEMPLATE ASSIGMENT FORM // ========================== -echo '
'; - $nps = db_get_all_fields_in_table('tnetwork_profile', 'name'); if ($nps === false) { $nps = []; @@ -180,44 +194,45 @@ foreach ($nps as $row) { $select[$row['id_np']] = $row['name']; } -echo ''; -echo "'; -echo ''; -echo ''; -echo ''; -echo '
"; -html_print_select($select, 'template_id', '', '', '', 0, false, false, true, '', false, 'max-width: 200px !important'); -echo ''; -html_print_submit_button(__('Assign'), 'crt', false, 'class="sub next mgn_tp_0"'); -echo '
'; -echo ''; +$filterTable = new stdClass(); +$filterTable->width = '100%'; +$filterTable->class = 'fixed_filter_bar'; +$filterTable->data = []; +$filterTable->data[0][0] = __('Module templates'); +$filterTable->data[1][0] = html_print_select($select, 'template_id', '', '', '', 0, true, false, true, '', false, 'max-width: 200px !important'); +$filterTable->data[1][1] = html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Assign'), + 'crt', + false, + [ + 'icon' => 'wand', + 'mode' => 'secondary mini', + ], + true + ), + ], + true +); + +$outputFilterTable = '
'; +$outputFilterTable .= html_print_table($filterTable, true); +$outputFilterTable .= '
'; + +echo $outputFilterTable; // ========================== // MODULE VISUALIZATION TABLE // ========================== -switch ($config['dbtype']) { - case 'mysql': - case 'postgresql': - $sql = sprintf( - 'SELECT * - FROM tagente_modulo - WHERE id_agente = %d AND delete_pending = false - ORDER BY id_module_group, nombre', - $id_agente - ); - break; - - case 'oracle': - $sql = sprintf( - 'SELECT * - FROM tagente_modulo - WHERE id_agente = %d - AND (delete_pending <> 1 AND delete_pending IS NOT NULL) - ORDER BY id_module_group, dbms_lob.substr(nombre,4000,1)', - $id_agente - ); - break; -} +$sql = sprintf( + 'SELECT * + FROM tagente_modulo + WHERE id_agente = %d AND delete_pending = false + ORDER BY id_module_group, nombre', + $id_agente +); $result = db_get_all_rows_sql($sql); if ($result === false) { @@ -233,10 +248,10 @@ $table->head = []; $table->data = []; $table->align = []; -$table->head[0] = __('Module name'); -$table->head[1] = __('Type'); -$table->head[2] = __('Description'); -$table->head[3] = __('Action'); +$table->head[0] = ''.__('Module name').''; +$table->head[1] = ''.__('Type').''; +$table->head[2] = ''.__('Description').''; +$table->head[3] = ''.__('Action').''; $table->align[1] = 'left'; $table->align[3] = 'left'; @@ -245,27 +260,43 @@ $table->size[1] = '5%'; $table->size[3] = '8%'; foreach ($result as $row) { + $table->cellclass[][3] = 'table_action_buttons'; + $data = []; $data[0] = ''.$row['nombre']; - if ($row['id_tipo_modulo'] > 0) { - $data[1] = html_print_image('images/'.modules_show_icon_type($row['id_tipo_modulo']), true, ['border' => '0', 'class' => 'invert_filter']); - } else { - $data[1] = ''; - } - + $data[1] = ($row['id_tipo_modulo'] > 0) ? ui_print_moduletype_icon($row['id_tipo_modulo'], true, false, true) : ''; $data[2] = mb_substr($row['descripcion'], 0, 60); - - $table->cellclass[][3] = 'action_buttons'; - $data[3] = ''.html_print_image('images/cross.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Delete'), 'onclick' => "if (!confirm('".__('Are you sure?')."')) return false;"]).''; - $data[3] .= ''.html_print_image('images/config.png', true, ['class' => 'invert_filter', 'border' => '0', 'alt' => __('Update')]).''; + $data[3] = html_print_menu_button( + [ + 'href' => 'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'&delete_module='.$row['id_agente_modulo'], + 'image' => 'images/delete.svg', + 'title' => __('Delete'), + 'onClick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;', + ], + true + ); + $data[3] .= html_print_menu_button( + [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&tab=module&edit_module=1&id_agent_module='.$row['id_agente_modulo'], + 'image' => 'images/edit.svg', + 'title' => __('Edit'), + ], + true + ); array_push($table->data, $data); } -if (!empty($table->data)) { - html_print_table($table); - unset($table); +if (empty($table->data) === false) { + $output = html_print_table($table, true); } else { - ui_print_empty_data(__('No modules')); + $output = ui_print_empty_data(__('No modules'), '', true); } + +html_print_div( + [ + 'class' => 'datatable_form', + 'content' => $output, + ] +); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index ab01bbf47f..27f3b7ea3a 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -295,7 +295,6 @@ if ($create_agent) { 'fixed_ip' => $fixed_ip, ] ); - enterprise_hook('update_agent', [$id_agente]); } else { $id_agente = false; } @@ -377,86 +376,89 @@ $img_style = [ if ($id_agente) { // View tab. - $viewtab['text'] = ''.html_print_image( - 'images/eye.png', - true, + $viewtab['text'] = html_print_anchor( [ - 'title' => __('View'), - 'class' => 'invert_filter', - ] - ).''; - - if ($tab == 'view') { - $viewtab['active'] = true; - } else { - $viewtab['active'] = false; - } + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente, + 'content' => html_print_image( + 'images/enable.svg', + true, + [ + 'title' => __('View'), + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); + $viewtab['active'] = ($tab === 'view'); $viewtab['operation'] = 1; // Main tab. - $maintab['text'] = ''.html_print_image( - 'images/gm_setup.png', - true, + $maintab['text'] = html_print_anchor( [ - 'title' => __('Setup'), - 'class' => 'invert_filter', - ] - ).''; - if ($tab == 'main') { - $maintab['active'] = true; - } else { - $maintab['active'] = false; - } + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente, + 'content' => html_print_image( + 'images/configuration@svg.svg', + true, + [ + 'title' => __('Setup'), + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); + + $maintab['active'] = ($tab === 'main'); // Module tab. - $moduletab['text'] = ''.html_print_image( - 'images/gm_modules.png', - true, + $moduletab['text'] = html_print_anchor( [ - 'title' => __('Modules'), - 'class' => 'invert_filter', - ] - ).''; + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente, + 'content' => html_print_image( + 'images/modules@svg.svg', + true, + [ + 'title' => __('Modules'), + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); - if ($tab == 'module') { - $moduletab['active'] = true; - } else { - $moduletab['active'] = false; - } + $moduletab['active'] = ($tab === 'module'); // Alert tab. - $alerttab['text'] = ''.html_print_image( - 'images/gm_alerts.png', - true, + $alerttab['text'] = html_print_anchor( [ - 'title' => __('Alerts'), - 'class' => 'invert_filter', - ] - ).''; + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente, + 'content' => html_print_image( + 'images/alert@svg.svg', + true, + [ + 'title' => __('Alerts'), + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); - if ($tab == 'alert') { - $alerttab['active'] = true; - } else { - $alerttab['active'] = false; - } + $alerttab['active'] = ($tab === 'alert'); // Template tab. - $templatetab['text'] = ''.html_print_image( - 'images/templates.png', - true, + $templatetab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente, + 'image' => 'images/modules-group@svg.svg', 'title' => __('Module templates'), - 'class' => 'invert_filter', - ] - ).''; - - if ($tab == 'template') { - $templatetab['active'] = true; - } else { - $templatetab['active'] = false; - } + ], + true + ); + $templatetab['active'] = ($tab === 'template'); // Inventory. $inventorytab['text'] = ''.html_print_image( @@ -474,11 +476,11 @@ if ($id_agente) { $inventorytab['active'] = false; } - if ($inventorytab == -1) { + $inventorytab = enterprise_hook('inventory_tab'); + if ($inventorytab === ENTERPRISE_NOT_HOOK) { $inventorytab = ''; } - $has_remote_conf = enterprise_hook( 'config_agents_has_remote_configuration', [$id_agente] @@ -490,7 +492,7 @@ if ($id_agente) { if ($has_remote_conf === true) { // Plugins. $pluginstab = enterprise_hook('plugins_tab'); - if ($pluginstab == -1) { + if ($pluginstab === ENTERPRISE_NOT_HOOK) { $pluginstab = ''; } } else { @@ -500,60 +502,60 @@ if ($id_agente) { // Collection. if ((int) $config['license_nms'] !== 1) { $collectiontab = enterprise_hook('collection_tab'); - - if ($collectiontab == -1) { + if ($collectiontab === ENTERPRISE_NOT_HOOK) { $collectiontab = ''; } + } else { + $collectiontab = ''; } // NetworkConfigManager tab. $ncm_tab = enterprise_hook('networkconfigmanager_tab'); - if ($ncm_tab === ENTERPRISE_NOT_HOOK) { $ncm_tab = ''; } // Group tab. - $grouptab['text'] = ''.html_print_image( - 'images/group.png', - true, + $grouptab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group, + 'image' => 'images/groups@svg.svg', 'title' => __('Group'), - 'class' => 'invert_filter', - ] - ).''; + ], + true + ); $grouptab['active'] = false; $gistab = []; - // GIS tab. - if ($config['activate_gis']) { - $gistab['text'] = ''.html_print_image( - 'images/gm_gis.png', - true, - [ - 'title' => __('GIS data'), - 'class' => 'invert_filter', - ] - ).''; + // TODO. OVERRIDE. + $config['activate_gis'] = true; - if ($tab == 'gis') { - $gistab['active'] = true; - } else { - $gistab['active'] = false; - } + // GIS tab. + if ((bool) $config['activate_gis'] === true) { + $gistab['text'] = html_print_menu_button( + [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=gis&id_agente='.$id_agente, + 'image' => 'images/poi@svg.svg', + 'title' => __('GIS data'), + ], + true + ); + + $gistab['active'] = ($tab === 'gis'); } // Agent wizard tab. - $agent_wizard['text'] = ''.html_print_image( - 'images/wand_agent.png', - true, + $agent_wizard['text'] = html_print_menu_button( [ + 'href' => 'javascript:', + 'class' => 'agent_wizard_tab', + 'image' => 'images/wizard@svg.svg', 'title' => __('Agent wizard'), - 'class' => 'invert_filter', - ] - ).''; + ], + true + ); // Hidden subtab layer. $agent_wizard['sub_menu'] = '
'; echo ''; echo ''; @@ -398,21 +409,31 @@ if ($id_profile || $new_profile) { html_print_table($table); - echo '
'; - if ($new_profile) { - html_print_submit_button(__('Add'), 'crt', false, 'class="sub wand"'); + $actionButtons = []; + + if ($new_profile === true) { + $actionButtons[] = html_print_submit_button(__('Create profile'), 'crt', false, [ 'icon' => 'wand' ], true); html_print_input_hidden('create_profile', 1); } else { + $actionButtons[] = html_print_submit_button(__('Update'), 'upd', false, [ 'icon' => 'update' ], true); html_print_input_hidden('id', $id_profile); html_print_input_hidden('old_name_profile', $name); html_print_input_hidden('update_profile', 1); - html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"'); } - echo '
'; -} + $actionButtons[] = html_print_go_back_button( + ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/profile_list&tab=profile&pure=0'), + ['button_class' => ''], + true + ); -enterprise_hook('close_meta_frame'); + html_print_action_buttons( + implode('', $actionButtons), + ['type' => 'form_action'] + ); + + echo ''; +} ?> diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 513f7c83de..468d789e0f 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -1,4 +1,5 @@ 'Gray', - 'blue-marble' => 'Blue marble', - 'night-electric' => 'Night Electric', - 'living' => 'Living Earth', - ]; - - $local_file = 'include/javascript/timezonepicker/images/gray-400.png'; - - // Dimensions must always be exact since the imagemap does not scale. - $array_size = getimagesize($local_file); - - $map_width = $array_size[0]; - $map_height = $array_size[1]; - - $timezones = timezone_picker_parse_files( - $map_width, - $map_height, - 'include/javascript/timezonepicker/tz_world.txt', - 'include/javascript/timezonepicker/tz_islands.txt' - ); - - - foreach ($timezones as $timezone_name => $tz) { - if ($timezone_name == 'America/Montreal') { - $timezone_name = 'America/Toronto'; - } else if ($timezone_name == 'Asia/Chongqing') { - $timezone_name = 'Asia/Shanghai'; - } - - $area_data_timezone_polys .= ''; - foreach ($tz['polys'] as $coords) { - $area_data_timezone_polys .= ''; - } - - $area_data_timezone_rects .= ''; - foreach ($tz['rects'] as $coords) { - $area_data_timezone_rects .= ''; - } - } -} - // This defines the working user. Beware with this, old code get confusses // and operates with current logged user (dangerous). $id = get_parameter('id', get_parameter('id_user', '')); +// Check if we are the same user for edit or we have a proper profile for edit users. +if ($id !== $config['id_user']) { + if ((is_centralized() === true) || (bool) check_acl($config['id_user'], 0, 'UM') === false) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to access User Management' + ); + include 'general/noaccess.php'; + + return; + } +} + // ID given as parameter. $pure = get_parameter('pure', 0); - $user_info = get_user_info($id); $is_err = false; -if ((bool) check_acl($config['id_user'], 0, 'UM') === false) { - db_pandora_audit( - AUDIT_LOG_ACL_VIOLATION, - 'Trying to access User Management' - ); - include 'general/noaccess.php'; - - return; -} - if (is_ajax() === true) { $delete_profile = (bool) get_parameter('delete_profile'); $get_user_profile = (bool) get_parameter('get_user_profile'); @@ -268,44 +222,50 @@ if (is_ajax() === true) { } } -enterprise_hook('open_meta_frame'); - $tab = get_parameter('tab', 'user'); +// Save autorefresh list. +$autorefresh_list = (array) get_parameter_post('autorefresh_list'); +$autorefresh_white_list = (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) ? '' : json_encode($autorefresh_list); + // Header. if (is_metaconsole() === true) { user_meta_print_header(); $sec = 'advanced'; } else { - $buttons = [ - 'user' => [ - 'active' => false, - 'text' => ''.html_print_image( - 'images/user.png', - true, - [ - 'title' => __('User management'), - 'class' => 'invert_filter', - ] - ).'', - ], - 'profile' => [ - 'active' => false, - 'text' => ''.html_print_image( - 'images/profiles.png', - true, - [ - 'title' => __('Profile management'), - 'class' => 'invert_filter', - ] - ).'', - ], - ]; + if ((bool) check_acl($config['id_user'], 0, 'UM') === false) { + $buttons = []; + } else { + $buttons = [ + 'user' => [ + 'active' => false, + 'text' => ''.html_print_image( + 'images/user.svg', + true, + [ + 'title' => __('User management'), + 'class' => 'invert_filter main_menu_icon', + ] + ).'', + ], + 'profile' => [ + 'active' => false, + 'text' => ''.html_print_image( + 'images/suitcase@svg.svg', + true, + [ + 'title' => __('Profile management'), + 'class' => 'invert_filter main_menu_icon', + ] + ).'', + ], + ]; - $buttons[$tab]['active'] = true; + $buttons[$tab]['active'] = true; + } ui_print_standard_header( - (empty($id) === false) ? __('Update user') : __('Create user'), + (empty($id) === false) ? sprintf('%s [ %s ]', __('Update User'), $id) : __('Create User'), 'images/gm_users.png', false, '', @@ -337,6 +297,7 @@ if ((bool) $config['user_can_update_info'] === true) { $view_mode = true; } +$delete_profile = (is_ajax() === true) ? (bool) get_parameter('delete_profile') : false; $new_user = (bool) get_parameter('new_user'); $create_user = (bool) get_parameter('create_user'); $add_profile = (bool) get_parameter('add_profile'); @@ -442,13 +403,13 @@ if ($create_user === true) { $values['block_size'] = (int) get_parameter('block_size', $config['block_size']); $values['section'] = get_parameter('section'); - if (($values['section'] === 'Event list') || ($values['section'] === 'Group view') || ($values['section'] === 'Alert detail') || ($values['section'] === 'Tactical view') || ($values['section'] === 'Default')) { + if (($values['section'] === HOME_SCREEN_EVENT_LIST) || ($values['section'] === HOME_SCREEN_GROUP_VIEW) || ($values['section'] === HOME_SCREEN_ALERT_DETAIL) || ($values['section'] === HOME_SCREEN_TACTICAL_VIEW) || ($values['section'] === HOME_SCREEN_DEFAULT)) { $values['data_section'] = ''; - } else if ($values['section'] === 'Dashboard') { + } else if ($values['section'] === HOME_SCREEN_DASHBOARD) { $values['data_section'] = $dashboard; - } else if (io_safe_output($values['section']) === 'Visual console') { + } else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) { $values['data_section'] = $visual_console; - } else if ($values['section'] === 'Other' || io_safe_output($values['section']) === 'External link') { + } else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { $values['data_section'] = get_parameter('data_section'); } @@ -582,7 +543,7 @@ if ($create_user === true) { $user_info = get_user_info($id); $new_user = false; - if (!empty($json_profile)) { + if (empty($json_profile) === false) { $json_profile = json_decode(io_safe_output($json_profile), true); foreach ($json_profile as $key => $profile) { if (is_array($profile) === false) { @@ -723,13 +684,13 @@ if ($update_user) { $values['block_size'] = get_parameter('block_size', $config['block_size']); $values['section'] = get_parameter('section'); - if (($values['section'] === 'Event list') || ($values['section'] === 'Group view') || ($values['section'] === 'Alert detail') || ($values['section'] === 'Tactical view') || ($values['section'] === 'Default')) { + if (($values['section'] === HOME_SCREEN_EVENT_LIST) || ($values['section'] === HOME_SCREEN_GROUP_VIEW) || ($values['section'] === HOME_SCREEN_ALERT_DETAIL) || ($values['section'] === HOME_SCREEN_TACTICAL_VIEW) || ($values['section'] === HOME_SCREEN_DEFAULT)) { $values['data_section'] = ''; - } else if ($values['section'] === 'Dashboard') { + } else if ($values['section'] === HOME_SCREEN_DASHBOARD) { $values['data_section'] = $dashboard; - } else if (io_safe_output($values['section']) === 'Visual console') { + } else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) { $values['data_section'] = $visual_console; - } else if ($values['section'] === 'Other' || io_safe_output($values['section']) === 'External link') { + } else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { $values['data_section'] = get_parameter('data_section'); } @@ -743,7 +704,8 @@ if ($update_user) { $values['local_user'] = (bool) get_parameter('local_user', false); $values['strict_acl'] = (bool) get_parameter('strict_acl', false); $values['session_time'] = (int) get_parameter('session_time', 0); - + // Previously defined. + $values['autorefresh_white_list'] = $autorefresh_white_list; $res1 = update_user($id, $values); @@ -930,7 +892,7 @@ if ((int) $status !== -1) { } if ($add_profile && empty($json_profile)) { - $id2 = (string) get_parameter('id'); + $id2 = (string) get_parameter('id', get_parameter('id_user')); $group2 = (int) get_parameter('assign_group'); $profile2 = (int) get_parameter('assign_profile'); $tags = (array) get_parameter('assign_tags'); @@ -951,6 +913,7 @@ if ($add_profile && empty($json_profile)) { false, 'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags ); + $return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy); if ($return === false) { $is_err = true; @@ -1000,13 +963,13 @@ if ($add_profile && empty($json_profile)) { ); } -if ($values) { +if (isset($values) === true && empty($values) === false) { $user_info = $values; } -if (!users_is_admin() && $config['id_user'] != $id && !$new_user) { +if (!users_is_admin() && $config['id_user'] !== $id && $new_user === false) { $group_um = users_get_groups_UM($config['id_user']); - if (isset($group_um[0])) { + if (isset($group_um[0]) === true) { $group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true))); } else { $group_um_string = implode(',', array_keys($group_um)); @@ -1036,7 +999,7 @@ if (is_metaconsole() === true) { html_print_div( [ 'class' => 'user_form_title', - 'content' => ((bool) $id === true) ? __('Update User') : __('Create User'), + 'content' => ((bool) $id === true) ? sprintf('%s [ %s ]', __('Update User'), $id) : __('Create User'), ] ); } @@ -1046,48 +1009,49 @@ if (!$new_user) { $user_id .= ''.$id.''; $user_id .= html_print_input_hidden('id_user', $id, true); $user_id .= ''; - $user_id .= '

'.__('API Token').'

'; - $user_id .= html_print_anchor( + + $apiTokenContentElements[] = ''.__('API Token').''; + $apiTokenContentElements[] = html_print_button( + __('Renew'), + 'renew_api_token', + false, + sprintf( + 'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')', + __('Warning'), + __('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'), + 'user_profile_form', + ), [ - 'onClick' => sprintf( - 'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')', - __('Warning'), - __('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'), - 'user_profile_form', - ), - 'content' => html_print_image( - 'images/icono-refrescar.png', - true, - [ - 'class' => 'renew_api_token_image clickable', - 'title' => __('Renew API Token'), - ] - ), - 'class' => 'renew_api_token_link', + 'mode' => 'link', + 'style' => 'min-width: initial;', + ], + true, + ); + $apiTokenContentElements[] = html_print_button( + __('Show'), + 'show_api_token', + false, + sprintf( + 'javascript:showAPIToken(\'%s\', \'%s\')', + __('API Token'), + base64_encode(__('Your API Token is:').' 
'.users_get_API_token($id).'
 '.__('Please, avoid share this string with others.')), + ), + [ + 'mode' => 'link', + 'style' => 'min-width: initial;', + ], + true, + ); + + $apiTokenContent = html_print_div( + [ + 'class' => 'flex-row-center', + 'content' => implode('', $apiTokenContentElements), ], true ); - $user_id .= html_print_anchor( - [ - 'onClick' => sprintf( - 'javascript:showAPIToken(\'%s\', \'%s\')', - __('API Token'), - base64_encode(__('Your API Token is:').' 
'.users_get_API_token($id).'
 '.__('Please, avoid share this string with others.')), - ), - 'content' => html_print_image( - 'images/eye_show.png', - true, - [ - 'class' => 'renew_api_token_image clickable', - 'title' => __('Show API Token'), - ] - ), - 'class' => 'renew_api_token_link', - ], - true - ); - $user_id .= '
'; + $user_id .= $apiTokenContent; } else { $user_id = '
'.html_print_input_text_extended( 'id_user', @@ -1099,7 +1063,7 @@ if (!$new_user) { !$new_user || $view_mode, '', [ - 'class' => 'input_line user_icon_input', + 'class' => 'input_line', 'placeholder' => __('User ID'), ], true @@ -1236,7 +1200,7 @@ $email = '
'.html_print_input_text_extended( $view_mode, '', [ - 'class' => 'input input_line email_icon_input', + 'class' => 'input input_line', 'placeholder' => __('E-mail'), ], true @@ -1304,7 +1268,7 @@ if ($new_user) { $id_usr = $id; } -if ((bool) $meta === false) { +if (is_metaconsole() === false) { // User only can change skins if has more than one group. if (count($usr_groups) > 1) { if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { @@ -1314,7 +1278,7 @@ if ((bool) $meta === false) { } } -if ((bool) $meta === true) { +if (is_metaconsole() === true) { $array_filters = get_filters_custom_fields_view(0, true); $search_custom_fields_view = '

'.__('Search custom field view').' '.ui_print_help_tip(__('Load by default the selected view in custom field view'), true).'

'; @@ -1343,20 +1307,9 @@ $home_screen = '

'.__('Home __('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'), true ).'

'; -; -$values = [ - 'Default' => __('Default'), - 'Visual console' => __('Visual console'), - 'Event list' => __('Event list'), - 'Group view' => __('Group view'), - 'Tactical view' => __('Tactical view'), - 'Alert detail' => __('Alert detail'), - 'External link' => __('External link'), - 'Other' => __('Other'), - 'Dashboard' => __('Dashboard'), -]; -$home_screen .= html_print_select( +/* + $home_screen .= html_print_select( $values, 'section', io_safe_output($user_info['section']), @@ -1366,8 +1319,8 @@ $home_screen .= html_print_select( true, false, false -).'
'; - + ).'
'; +*/ $dashboards = Manager::getDashboards( -1, @@ -1433,7 +1386,7 @@ $size_pagination .= html_print_input_text( true ).'
'; -if ($id == $config['id_user']) { +if ($id === $config['id_user']) { $language .= html_print_input_hidden( 'quick_language_change', 1, @@ -1441,14 +1394,14 @@ if ($id == $config['id_user']) { ); } -if (enterprise_installed() && defined('METACONSOLE')) { +if (enterprise_installed() && is_metaconsole() === true) { $user_info_metaconsole_access = 'only_console'; if (isset($user_info['metaconsole_access'])) { $user_info_metaconsole_access = $user_info['metaconsole_access']; } // TODO review help tips on meta. - $meta_access = '

'.__('Metaconsole access').' './* ui_print_help_icon('meta_access', true). */'

'; + $meta_access = '

'.__('Metaconsole access').' './* ui_print_help_icon('meta_access', true). */ '

'; $metaconsole_accesses = [ 'basic' => __('Basic'), 'advanced' => __('Advanced'), @@ -1466,36 +1419,37 @@ if (enterprise_installed() && defined('METACONSOLE')) { ).'
'; } -$not_login = '

'.__('Not Login').'

'; -$not_login .= ui_print_help_tip( +/* + $not_login = '

'.__('Not Login').'

'; + $not_login .= ui_print_help_tip( __('The user with not login set only can access to API.'), true -); -$not_login .= html_print_checkbox_switch( + ); + $not_login .= html_print_checkbox_switch( 'not_login', 1, $user_info['not_login'], true -).'
'; + ).'
'; -$local_user = '

'.__('Local user').'

'; -$local_user .= ui_print_help_tip( + $local_user = '

'.__('Local user').'

'; + $local_user .= ui_print_help_tip( __('The user with local authentication enabled will always use local authentication.'), true -); -$local_user .= html_print_checkbox_switch( + ); + $local_user .= html_print_checkbox_switch( 'local_user', 1, $user_info['local_user'], true -).'
'; + ).'
'; -$session_time = '

'.__('Session Time'); -$session_time .= ui_print_help_tip( + $session_time = '

'.__('Session Time'); + $session_time .= ui_print_help_tip( __('This is defined in minutes, If you wish a permanent session should putting -1 in this field.'), true -).'

'; -$session_time .= html_print_input_text( + ).'

'; + $session_time .= html_print_input_text( 'session_time', $user_info['session_time'], '', @@ -1505,8 +1459,8 @@ $session_time .= html_print_input_text( false, '', 'class="input_line_small"' -).'
'; - + ).'
'; +*/ $user_groups = implode(',', array_keys((users_get_groups($id, 'AR', $display_all_group)))); if (empty($user_groups) === false) { @@ -1538,7 +1492,7 @@ $default_event_filter .= html_print_select( false ).'
'; -if ($config['ehorus_user_level_conf']) { +if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) { $ehorus = '

'.__('eHorus user access enabled').'

'; $ehorus .= html_print_checkbox_switch( 'ehorus_user_level_enabled', @@ -1568,27 +1522,50 @@ if ($config['ehorus_user_level_conf']) { $ehorus .= '
'; } -$double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $id); - -if ($config['double_auth_enabled'] && check_acl($config['id_user'], 0, 'PM')) { - $double_authentication = '

'.__('Double authentication').'

'; +// Double authentication. +$doubleAuthElementsContent = []; +if (isset($config['double_auth_enabled']) === true && (bool) ($config['double_auth_enabled']) === true && check_acl($config['id_user'], 0, 'PM')) { + // Know if Double Auth is enabled. + $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $id); + // Double authentication elements. + $doubleAuthElementsSubContent = []; + // Caption. + $doubleAuthElementsSubContent[] = ''.__('Double authentication').''; + // Switch. if (($config['2FA_all_users'] == '' && !$double_auth_enabled) || ($config['double_auth_enabled'] == '' && $double_auth_enabled) || check_acl($config['id_user'], 0, 'PM') ) { if ($new_user === false) { - $double_authentication .= html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); + $doubleAuthElementsSubContent[] = html_print_checkbox_switch('double_auth', 1, $double_auth_enabled, true); } else { - $double_authentication .= ui_print_help_tip(__('User must be created before activating double authentication.'), true); + $doubleAuthElementsSubContent[] = ui_print_help_tip(__('User must be created before activating double authentication.'), true); } } + // Control for show. + $doubleAuthElementsContent[] = html_print_div( + [ + 'style' => 'display: flex; flex-direction: row-reverse; align-items: center;', + 'class' => 'margin-top-10', + 'content' => implode('', $doubleAuthElementsSubContent), + ], + true + ); + // Dialog. - $double_authentication .= ''; + $doubleAuthElementsContent[] = html_print_div( + [ + 'id' => 'dialog-double_auth', + 'class' => 'invisible', + 'content' => html_print_div(['id' => 'dialog-double_auth-container'], true), + ], + true + ); } -if ($double_auth_enabled && $config['double_auth_enabled'] && $config['2FA_all_users'] != '') { - $double_authentication .= html_print_button( +if ($double_auth_enabled === true && (bool) $config['double_auth_enabled'] === true && empty($config['2FA_all_users']) === false) { + $doubleAuthElementsContent[] = html_print_button( __('Show information'), 'show_info', false, @@ -1598,11 +1575,98 @@ if ($double_auth_enabled && $config['double_auth_enabled'] && $config['2FA_all_u ); } -if (isset($double_authentication)) { - $double_authentication .= '
'; +if (empty($doubleAuthElementsContent) === false) { + $doubleAuthentication = html_print_div(['content' => implode('', $doubleAuthElementsContent)], true); +} else { + $doubleAuthentication = ''; } -if ($meta) { + +/* + if (isset($double_authentication)) { + $double_authentication .= '
'; +}*/ + + + + + + + + + + + + + + + + + + + + +$autorefresh_list_out = []; +if (is_metaconsole() === false || is_centralized() === true) { + $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; + $autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; + $autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; + $autorefresh_list_out['operation/gis_maps/render_view'] = 'Gis Map'; + $autorefresh_list_out['operation/reporting/graph_viewer'] = 'Graph Viewer'; + $autorefresh_list_out['operation/snmpconsole/snmp_view'] = 'SNMP console'; + + if (enterprise_installed()) { + $autorefresh_list_out['general/sap_view'] = 'SAP view'; + } +} + +$autorefresh_list_out['operation/agentes/tactical'] = 'Tactical view'; +$autorefresh_list_out['operation/agentes/group_view'] = 'Group view'; +$autorefresh_list_out['operation/agentes/status_monitor'] = 'Monitor detail'; +$autorefresh_list_out['enterprise/operation/services/services'] = 'Services'; +$autorefresh_list_out['operation/dashboard/dashboard'] = 'Dashboard'; + +$autorefresh_list_out['operation/agentes/pandora_networkmap'] = 'Network map'; +$autorefresh_list_out['operation/visual_console/render_view'] = 'Visual console'; +$autorefresh_list_out['operation/events/events'] = 'Events'; + + +if (isset($autorefresh_list) === false) { + $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '".$config['id_user']."'"); + $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); + if ($autorefresh_list === null) { + $autorefresh_list[0] = __('None'); + } else { + $aux = []; + $count_autorefresh_list = count($autorefresh_list); + for ($i = 0; $i < $count_autorefresh_list; $i++) { + $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; + unset($autorefresh_list_out[$autorefresh_list[$i]]); + $autorefresh_list[$i] = $aux; + } + + $autorefresh_list = $aux; + } +} else { + if (is_array($autorefresh_list) === false || empty($autorefresh_list[0]) === true || $autorefresh_list[0] === '0') { + $autorefresh_list = []; + $autorefresh_list[0] = __('None'); + } else { + $aux = []; + $count_autorefresh_list = count($autorefresh_list); + for ($i = 0; $i < $count_autorefresh_list; $i++) { + $aux[$autorefresh_list[$i]] = $autorefresh_list_out[$autorefresh_list[$i]]; + unset($autorefresh_list_out[$autorefresh_list[$i]]); + $autorefresh_list[$i] = $aux; + } + + $autorefresh_list = $aux; + } +} + + + +if (is_metaconsole() === true) { enterprise_include_once('include/functions_metaconsole.php'); $access_node = db_get_value('metaconsole_access_node', 'tusuario', 'id_user', $id); @@ -1624,8 +1688,9 @@ if ($meta) { ).''; } -echo '
'; +echo '
'; +echo ''; if (!$id) { $user_id_update_view = $user_id; @@ -1637,71 +1702,139 @@ if (!$id) { if (is_metaconsole() === true) { $access_or_pagination = $meta_access; -} else { - $access_or_pagination = $size_pagination; -} + if ($id != '' && !$is_err) { + $div_user_info = ' + '; + } else { + $div_user_info = ' + '; + } -if ($id != '' && !$is_err) { - $div_user_info = ' - '; -} else { - $div_user_info = ' - '; -} + echo '
+
+ +

Extra info

'.$email.$phone.$not_login.$local_user.$session_time.'
+
+
+
'.$language.$access_or_pagination.$skin.$default_event_filter.$double_authentication.'
+ +
'.$timezone; -echo '
-
- -

Extra info

'.$email.$phone.$not_login.$local_user.$session_time.'
-
-
-
'.$language.$access_or_pagination.$skin.$home_screen.$default_event_filter.$double_authentication.'
- -
'.$timezone; -if (is_metaconsole() === false) { - echo '
- - - '.$area_data_timezone_polys.$area_data_timezone_rects.' -
'; -} else { echo $search_custom_fields_view.$metaconsole_agents_manager.$metaconsole_access_node; -} -echo '
-
+ $autorefresh_show = '

'._('Autorefresh').ui_print_help_tip( + __('This will activate autorefresh in selected pages'), + true + ).'

'; + $select_out = html_print_select( + $autorefresh_list_out, + 'autorefresh_list_out[]', + '', + '', + '', + '', + true, + true, + true, + '', + false, + 'width:100%' + ); + $arrows = ' '; + $select_in = html_print_select( + $autorefresh_list, + 'autorefresh_list[]', + '', + '', + '', + '', + true, + true, + true, + '', + false, + 'width:100%' + ); -
-
'.$comments.'
-
'; + $table_ichanges = ''; -html_print_div( - [ - 'class' => 'user_edit_third_row white_box', - 'content' => html_print_div( + $autorefresh_show .= $table_ichanges; + + // Time autorefresh. + $times = get_refresh_time_array(); + $time_autorefresh = '

'.__('Time autorefresh'); + $time_autorefresh .= ui_print_help_tip( + __('Interval of autorefresh of the elements, by default they are 30 seconds, needing to enable the autorefresh first'), + true + ).'

'; + $time_autorefresh .= html_print_select( + $times, + 'time_autorefresh', + $user_info['time_autorefresh'], + '', + '', + '', + true, + false, + false + ).'
'; + + + echo '
+
+
'.$autorefresh_show.$time_autorefresh.'
+
+
'.$comments.'
+
'; + + if (empty($ehorus) === false) { + html_print_div( [ - 'class' => 'edit_user_allowed_ip', - 'content' => $allowedIP, + 'class' => 'user_edit_third_row white_box', + 'content' => $ehorus, ], true - ), - ] -); - -if (!empty($ehorus)) { - echo '
'.$ehorus.'
'; + ); + } +} else { + $access_or_pagination = $size_pagination; + // WIP: Only for node. + include_once 'user_management.php'; } -echo '
'; -echo '
'; -if ($config['admin_can_add_user']) { +if ((bool) $config['admin_can_add_user'] === true) { html_print_csrf_hidden(); - if ($new_user) { - html_print_input_hidden('create_user', 1); - } else { - html_print_input_hidden('update_user', 1); - } + html_print_input_hidden((($new_user === true) ? 'create_user' : 'update_user'), 1); } echo '
'; @@ -1709,42 +1842,49 @@ if ($new_user === true) { html_print_input_hidden('json_profile', $json_profile); } +echo '
'; echo ''; +echo '
'; -if ($is_err === true && $new_user === true) { - profile_print_profile_table($id, io_safe_output($json_profile), false, true); -} else { - profile_print_profile_table($id, io_safe_output($json_profile)); -} +$actionButtons = []; -echo '
'; - -echo '
'; -if ($config['admin_can_add_user']) { - if ($new_user) { - html_print_submit_button( - __('Create'), - 'crtbutton', - false, - 'class="sub wand" form="user_profile_form"' - ); +if ((bool) $config['admin_can_add_user'] === true) { + if ($new_user === true) { + $submitButtonCaption = __('Create'); + $submitButtonName = 'crtbutton'; + $submitButtonIcon = 'wand'; } else { - html_print_submit_button( - __('Update'), - 'uptbutton', - false, - 'class="sub upd" form="user_profile_form"' - ); + $submitButtonCaption = __('Update'); + $submitButtonName = 'uptbutton'; + $submitButtonIcon = 'update'; } + + $actionButtons[] = html_print_submit_button( + $submitButtonCaption, + $submitButtonName, + false, + [ + 'icon' => $submitButtonIcon, + 'form' => 'user_profile_form', + ], + true + ); } -echo '
'; +if ((bool) check_acl($config['id_user'], 0, 'UM') === true) { + $actionButtons[] = html_print_go_back_button( + ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list&tab=user&pure=0'), + ['button_class' => ''], + true + ); +} +html_print_action_buttons(implode('', $actionButtons), ['type' => 'form_action']); echo ''; -enterprise_hook('close_meta_frame'); +// This is an image generated for JS. $delete_image = html_print_input_image( 'del', 'images/cross.png', @@ -1757,7 +1897,7 @@ $delete_image = html_print_input_image( ] ); -if (!is_metaconsole()) { +if (is_metaconsole() === false) { ?> + $dialogContainer + .empty() + .append(message) + .append($button); + + var request; + + $button.click(function(e) { + e.preventDefault(); + + $dialogContainer.html($loadingSpinner); + + // Deactivate the double auth + request = $.ajax({ + url: "", + type: 'POST', + dataType: 'json', + data: { + page: 'include/ajax/double_auth.ajax', + id_user: userID, + FA_forced: 1, + deactivate_double_auth: 1 + }, + complete: function(xhr, textStatus) { + + }, + success: function(data, textStatus, xhr) { + if (data === -1) { + $dialogContainer.html("
'.__('Authentication error').'
'; ?>"); + } else if (data) { + $dialogContainer.html("
'.__('The double autentication was deactivated successfully').'
'; ?>"); + $("input#checkbox-double_auth").prop("checked", false); + } else { + $dialogContainer.html("
'.__('There was an error deactivating the double autentication').'
'; ?>"); + } + }, + error: function(xhr, textStatus, errorThrown) { + $dialogContainer.html("
'.__('There was an error deactivating the double autentication').'
'; ?>"); + } + }); + }); + + + $("div#dialog-double_auth").dialog({ + resizable: true, + draggable: true, + modal: true, + title: "", + overlay: { + opacity: 0.5, + background: "black" + }, + width: 300, + height: 150, + close: function(event, ui) { + // Abort the ajax request + if (typeof request != 'undefined') + request.abort(); + // Remove the contained html + $dialogContainer.empty(); + + } + }) + .show(); + } + + + /* ]]> */ + \ No newline at end of file diff --git a/pandora_console/godmode/users/profile_list.php b/pandora_console/godmode/users/profile_list.php index 7ce7c82cc0..e47e989d0f 100644 --- a/pandora_console/godmode/users/profile_list.php +++ b/pandora_console/godmode/users/profile_list.php @@ -31,8 +31,6 @@ global $config; check_login(); -enterprise_hook('open_meta_frame'); - require_once $config['homedir'].'/include/functions_profile.php'; require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_groups.php'; @@ -57,22 +55,22 @@ if (is_metaconsole() === false) { 'user' => [ 'active' => false, 'text' => ''.html_print_image( - 'images/gm_users.png', + 'images/user.svg', true, [ 'title' => __('User management'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_user', ] ).'', ], 'profile' => [ 'active' => false, 'text' => ''.html_print_image( - 'images/profiles.png', + 'images/suitcase@svg.svg', true, [ 'title' => __('Profile management'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_user', ] ).'', ], @@ -80,13 +78,24 @@ if (is_metaconsole() === false) { $buttons[$tab]['active'] = true; - ui_print_page_header( - __('User management').' » '.__('Profiles defined on %s', get_product_name()), - 'images/gm_users.png', + // Header. + ui_print_standard_header( + __('User Profile management'), + 'images/user.svg', false, 'profile_tab', - true, - $buttons + false, + $buttons, + [ + [ + 'link' => '', + 'label' => __('Profiles'), + ], + [ + 'link' => '', + 'label' => __('Manage users'), + ], + ] ); $sec = 'gusuarios'; } else { @@ -312,8 +321,8 @@ if ($is_management_allowed === true && $create_profile === true) { $table = new stdClass(); $table->cellpadding = 0; $table->cellspacing = 0; +$table->styleTable = 'margin: 10px'; $table->class = 'info_table profile_list'; -$table->width = '100%'; $table->head = []; $table->data = []; @@ -322,36 +331,37 @@ $table->align = []; $table->head['profiles'] = __('Profiles'); -$table->head['AR'] = 'AR'; -$table->head['AW'] = 'AW'; -$table->head['AD'] = 'AD'; -$table->head['LW'] = 'LW'; -$table->head['LM'] = 'LM'; -$table->head['UM'] = 'UM'; -$table->head['DM'] = 'DM'; -$table->head['ER'] = 'ER'; -$table->head['EW'] = 'EW'; -$table->head['EM'] = 'EM'; -$table->head['RR'] = 'RR'; -$table->head['RW'] = 'RW'; -$table->head['RM'] = 'RM'; -$table->head['MR'] = 'MR'; -$table->head['MW'] = 'MW'; -$table->head['MM'] = 'MM'; -$table->head['VR'] = 'VR'; -$table->head['VW'] = 'VW'; -$table->head['VM'] = 'VM'; -$table->head['NR'] = 'NR'; -$table->head['NW'] = 'NW'; -$table->head['NM'] = 'NM'; -$table->head['PM'] = 'PM'; +$table->head['AR'] = ''.'AR'.''; +$table->head['AW'] = ''.'AW'.''; +$table->head['AD'] = ''.'AD'.''; +$table->head['LW'] = ''.'LW'.''; +$table->head['LM'] = ''.'LM'.''; +$table->head['UM'] = ''.'UM'.''; +$table->head['DM'] = ''.'DM'.''; +$table->head['ER'] = ''.'ER'.''; +$table->head['EW'] = ''.'EW'.''; +$table->head['EM'] = ''.'EM'.''; +$table->head['RR'] = ''.'RR'.''; +$table->head['RW'] = ''.'RW'.''; +$table->head['RM'] = ''.'RM'.''; +$table->head['MR'] = ''.'MR'.''; +$table->head['MW'] = ''.'MW'.''; +$table->head['MM'] = ''.'MM'.''; +$table->head['VR'] = ''.'VR'.''; +$table->head['VW'] = ''.'VW'.''; +$table->head['VM'] = ''.'VM'.''; +$table->head['NR'] = ''.'NR'.''; +$table->head['NW'] = ''.'NW'.''; +$table->head['NM'] = ''.'NM'.''; +$table->head['PM'] = ''.'PM'.''; + if ($is_management_allowed === true) { $table->head['operations'] = ''.__('Op.').''; } $table->align = array_fill(1, 11, 'center'); -$table->size['profiles'] = '200px'; +$table->size['profiles'] = '150px'; $table->size['AR'] = '10px'; $table->size['AW'] = '10px'; $table->size['AD'] = '10px'; @@ -376,7 +386,7 @@ $table->size['NW'] = '10px'; $table->size['NM'] = '10px'; $table->size['PM'] = '10px'; if ($is_management_allowed === true) { - $table->size['operations'] = '5%'; + $table->size['operations'] = '6%'; } $profiles = db_get_all_rows_in_table('tperfil'); @@ -385,11 +395,11 @@ if ($profiles === false) { } $img = html_print_image( - 'images/ok.png', + 'images/validate.svg', true, [ 'border' => 0, - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); @@ -425,25 +435,32 @@ foreach ($profiles as $profile) { $data['NW'] = (empty($profile['network_config_edit']) === false) ? $img : ''; $data['NM'] = (empty($profile['network_config_management']) === false) ? $img : ''; $data['PM'] = (empty($profile['pandora_management']) === false) ? $img : ''; - $table->cellclass[]['operations'] = 'action_buttons'; + $table->cellclass[]['operations'] = 'table_action_buttons'; if ($is_management_allowed === true) { $data['operations'] = ''.html_print_image( - 'images/config.png', + 'images/edit.svg', true, [ 'title' => __('Edit'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; - if (check_acl($config['id_user'], 0, 'PM') || users_is_admin()) { - $data['operations'] .= ''.html_print_image( - 'images/cross.png', - true, + if ((bool) check_acl($config['id_user'], 0, 'PM') === true || (bool) users_is_admin() === true) { + $data['operations'] .= html_print_anchor( [ - 'title' => __('Delete'), - 'class' => 'invert_filter', - ] - ).''; + 'href' => 'index.php?sec='.$sec.'&sec2=godmode/users/profile_list&delete_profile=1&id='.$profile['id_perfil'].'&pure='.$pure, + 'onClick' => 'if (!confirm(\' '.__('Are you sure?').'\')) return false;', + 'content' => html_print_image( + 'images/delete.svg', + true, + [ + 'title' => __('Delete'), + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); } } @@ -458,13 +475,21 @@ if (isset($data) === true) { if ($is_management_allowed === true) { echo '
'; - echo '
'; html_print_input_hidden('new_profile', 1); - html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"'); - echo '
'; + html_print_action_buttons( + html_print_submit_button( + __('Create profile'), + 'crt', + false, + [ 'icon' => 'next' ], + true + ), + [ + 'type' => 'data_table', + 'class' => 'fixed_action_buttons', + ] + ); echo '
'; } unset($table); - -enterprise_hook('close_meta_frame'); diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 11ecc02f11..e4fe4225fa 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.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 @@ -132,8 +132,6 @@ if (is_ajax()) { } } -enterprise_hook('open_meta_frame'); - $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $tab = get_parameter('tab', 'user'); @@ -247,22 +245,22 @@ if (is_metaconsole() === true) { 'user' => [ 'active' => false, 'text' => ''.html_print_image( - 'images/gm_users.png', + 'images/user.svg', true, [ 'title' => __('User management'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', ], 'profile' => [ 'active' => false, 'text' => ''.html_print_image( - 'images/profiles.png', + 'images/suitcase@svg.svg', true, [ 'title' => __('Profile management'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', ], @@ -272,11 +270,11 @@ if (is_metaconsole() === true) { 'user' => [ 'active' => false, 'text' => ''.html_print_image( - 'images/gm_users.png', + 'images/user.svg', true, [ 'title' => __('User management'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', ], @@ -285,13 +283,24 @@ if (is_metaconsole() === true) { $buttons[$tab]['active'] = true; - ui_print_page_header( - __('User management').' » '.__('Users defined on %s', get_product_name()), - 'images/gm_users.png', + // Header. + ui_print_standard_header( + __('Users management'), + 'images/user.svg', false, '', - true, - $buttons + false, + $buttons, + [ + [ + 'link' => '', + 'label' => __('Profiles'), + ], + [ + 'link' => '', + 'label' => __('Manage users'), + ], + ] ); $sec = 'gusuarios'; @@ -326,8 +335,11 @@ if ($delete_user === true) { ); if (isset($private_dashboards) === true) { - db_process_sql_delete('tdashboard', ['id_user' => $id_user]); - header('Refresh:1'); + $dashboardRemoveResult = db_process_sql_delete('tdashboard', ['id_user' => $id_user]); + // Refresh the view when delete private dashboards. For review. + if ($dashboardRemoveResult === false || (int) $dashboardRemoveResult > 0) { + header('Refresh:1'); + } } $result = delete_user($id_user); @@ -449,12 +461,14 @@ if (($filter_group == 0) && ($filter_search == '')) { $search = false; } -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; -$table->rowclass[0] = ''; -$table->data[0][0] = ''.__('Group').''; -$table->data[0][1] = html_print_select_groups( +$filterTable = new stdClass(); +$filterTable->width = '100%'; +$filterTable->class = 'fixed_filter_bar'; +$filterTable->rowclass[0] = ''; +$filterTable->cellstyle[0][0] = 'width:0'; +$filterTable->cellstyle[0][1] = 'width:0'; +$filterTable->data[0][0] = __('Group'); +$filterTable->data[1][0] = html_print_select_groups( false, 'AR', true, @@ -465,8 +479,8 @@ $table->data[0][1] = html_print_select_groups( 0, true ); -$table->data[0][2] = ''.__('Search').''.ui_print_help_tip(__('Search by username, fullname or email'), true); -$table->data[0][3] = html_print_input_text( +$filterTable->data[0][1] = __('Search').ui_print_help_tip(__('Search by username, fullname or email'), true); +$filterTable->data[1][1] = html_print_input_text( 'filter_search', $filter_search, __('Search by username, fullname or email'), @@ -474,11 +488,16 @@ $table->data[0][3] = html_print_input_text( 90, true ); -$table->data[0][4] = html_print_submit_button( +$filterTable->cellstyle[1][2] = 'vertical-align: bottom'; +$filterTable->data[1][2] = html_print_submit_button( __('Search'), 'search', false, - ['class' => 'sub search'], + [ + 'icon' => 'search', + 'class' => 'float-right', + 'mode' => 'secondary mini', + ], true ); @@ -503,22 +522,16 @@ if (is_metaconsole() === false && is_management_allowed() === false) { if (is_metaconsole() === true) { - $table->width = '96%'; + $filterTable->width = '96%'; $form_filter = "
"; - $form_filter .= html_print_table($table, true); + $form_filter .= html_print_table($filterTable, true); $form_filter .= '
'; ui_toggle($form_filter, __('Show Options')); } else { $form_filter = "
"; - $form_filter .= html_print_table($table, true); + $form_filter .= html_print_table($filterTable, true); $form_filter .= '
'; - ui_toggle( - $form_filter, - __('Users control filter'), - __('Toggle filter(s)'), - '', - !$search - ); + echo $form_filter; } // Urls to sort the table. @@ -533,8 +546,9 @@ $url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_con $table = new stdClass(); $table->cellpadding = 0; $table->cellspacing = 0; -$table->width = '100%'; -$table->class = 'info_table'; +$table->class = 'info_table tactical_table'; +$table->id = 'user_list'; +$table->styleTable = 'margin: 0 10px'; $table->head = []; $table->data = []; @@ -542,15 +556,18 @@ $table->align = []; $table->size = []; $table->valign = []; -$table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown); -$table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown); -$table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown); +$table->head[0] = ''.__('User ID').''; +$table->head[0] .= ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown); +$table->head[1] = ''.__('Name').''; +$table->head[1] .= ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown); +$table->head[2] = ''.__('Last contact').''; +$table->head[2] .= ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown); -$table->head[3] = __('Admin'); -$table->head[4] = __('Profile / Group'); -$table->head[5] = __('Description'); +$table->head[3] = ''.__('Admin').''; +$table->head[4] = ''.__('Profile / Group').''; +$table->head[5] = ''.__('Description').''; if ($is_management_allowed === true) { - $table->head[6] = ''.__('Op.').''; + $table->head[6] = ''.__('Actions').''; } if (is_metaconsole() === false) { @@ -585,7 +602,7 @@ if ($user_is_admin) { } else { $group_um = users_get_groups_UM($config['id_user']); // 0 is the group 'all'. - if (isset($group_um[0])) { + if (isset($group_um[0]) === true) { $info1 = get_users($order); } else { foreach ($group_um as $group => $value) { @@ -642,9 +659,6 @@ foreach ($info1 as $user_id => $user_info) { $info = $info1; -// Prepare pagination. -ui_pagination(count($info)); - $offset = (int) get_parameter('offset'); $limit = (int) $config['block_size']; @@ -714,7 +728,13 @@ foreach ($info as $user_id => $user_info) { || isset($group_um[0]) || (isset($user_info['edit']) && $user_info['edit'])))) ) { - $data[0] = ''.$user_id.''; + $data[0] = html_print_anchor( + [ + 'href' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user='.$user_id), + 'content' => $user_id, + ], + true + ); } else { $data[0] = $user_id; } @@ -728,12 +748,12 @@ foreach ($info as $user_id => $user_info) { if ($user_info['is_admin']) { $data[3] = html_print_image( - 'images/user_suit.png', + 'images/user.svg', true, [ 'alt' => __('Admin'), 'title' => __('Administrator'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).' '; } else { @@ -792,10 +812,10 @@ foreach ($info as $user_id => $user_info) { } $data[5] = ui_print_string_substr($user_info['comments'], 24, true); - + $table->cellclass[][6] = 'table_action_buttons'; + $data[6] = ''; + $userListActionButtons = []; if ($is_management_allowed === true) { - $table->cellclass[][6] = 'action_buttons'; - $data[6] = ''; if ($user_is_admin || $config['id_user'] == $user_info['id_user'] || isset($group_um[0]) @@ -804,32 +824,49 @@ foreach ($info as $user_id => $user_info) { ) { // Disable / Enable user. if (isset($user_info['not_delete']) === false) { - if ($user_info['disabled'] == 0) { + if ((int) $user_info['disabled'] === 0) { $toDoString = __('Disable'); $toDoAction = '1'; - $toDoImage = 'images/lightbulb.png'; + $toDoImage = 'images/disable.svg'; $toDoClass = ''; } else { $toDoString = __('Enable'); $toDoAction = '0'; - $toDoImage = 'images/lightbulb_off.png'; + $toDoImage = 'images/enable.svg'; $toDoClass = 'filter_none'; } - $data[6] = '
'; - $data[6] .= html_print_input_hidden( + $userListActionButtons[] = html_print_menu_button( + [ + 'href' => ui_get_full_url( + sprintf( + 'index.php?sec=%s&sec2=godmode/users/user_list&disable_user=%s&pure=%s&id=%s', + $sec, + $toDoAction, + $pure, + $user_info['id_user'] + ) + ), + 'image' => $toDoImage, + 'title' => $toDoString, + ], + true + ); + /* + $data[6] = ''; + $data[6] .= html_print_input_hidden( 'id', $user_info['id_user'], true - ); - // Same csrf for every disable button for submit. - $data[6] .= $csrf; - $data[6] .= html_print_input_hidden( + ); + // Same csrf for every disable button for submit. + $data[6] .= $csrf; + $data[6] .= html_print_input_hidden( 'disable_user', $toDoAction, true - ); - $data[6] .= html_print_input_image( + ); + $data[6] .= html_print_input_image( 'submit_disable_enable', $toDoImage, '', @@ -838,67 +875,102 @@ foreach ($info as $user_id => $user_info) { [ 'data-title' => $toDoString, 'data-use_title_for_force_title' => '1', - 'class' => 'forced_title no-padding '.$toDoClass, + 'class' => 'main_menu_icon forced_title no-padding '.$toDoClass, ] - ); - $data[6] .= '
'; + ); + $data[6] .= ''; + */ } - // Edit user. - $data[6] .= '
'; - $data[6] .= html_print_input_hidden( + /* + // Edit user. + $data[6] .= ''; + $data[6] .= html_print_input_hidden( 'id_user', $user_info['id_user'], true - ); - $data[6] .= html_print_input_hidden( + ); + $data[6] .= html_print_input_hidden( 'edit_user', '1', true - ); - $data[6] .= html_print_input_image( + ); + $data[6] .= html_print_input_image( 'submit_edit_user', - 'images/config.png', + 'images/edit.svg', '', 'padding:0', true, [ 'data-title' => __('Edit'), 'data-use_title_for_force_title' => '1', - 'class' => 'forced_title no-padding', + 'class' => 'main_menu_icon forced_title no-padding', ] + ); + $data[6] .= '
';*/ + + $userListActionButtons[] = html_print_menu_button( + [ + 'href' => ui_get_full_url( + sprintf( + 'index.php?sec=%s&sec2=godmode/users/configure_user&edit_user=1&pure=%s&id_user=%s', + $sec, + $pure, + $user_info['id_user'] + ) + ), + 'image' => 'images/edit.svg', + 'title' => __('Edit user'), + ], + true ); - $data[6] .= ''; if ($config['admin_can_delete_user'] && $user_info['id_user'] != $config['id_user'] && isset($user_info['not_delete']) === false ) { - $offset_delete = ($offset >= count($info) - 1) ? ($offset - $config['block_size']) : $offset; - $data[6] .= '
'; - $data[6] .= html_print_input_hidden( + /* + $offset_delete = ($offset >= count($info) - 1) ? ($offset - $config['block_size']) : $offset; + $data[6] .= ''; + $data[6] .= html_print_input_hidden( 'delete_user', $user_info['id_user'], true - ); - $data[6] .= html_print_input_hidden( + ); + $data[6] .= html_print_input_hidden( 'user_del', '1', true - ); - $data[6] .= html_print_input_image( + ); + $data[6] .= html_print_input_image( 'submit_delete_user', - 'images/cross.png', + 'images/delete.svg', '', 'padding:0', true, [ 'data-title' => __('Delete'), 'data-use_title_for_force_title' => '1', - 'class' => 'forced_title no-padding', + 'class' => 'main_menu_icon forced_title no-padding', ] + ); + $data[6] .= '
'; + */ + $userListActionButtons[] = html_print_menu_button( + [ + 'href' => ui_get_full_url( + sprintf( + 'index.php?sec=%s&sec2=godmode/users/user_list&user_del=1&pure=%s&delete_user=%s', + $sec, + $pure, + $user_info['id_user'] + ) + ), + 'image' => 'images/delete.svg', + 'title' => __('Delete'), + ], + true ); - $data[6] .= ''; if (is_metaconsole() === true) { $data[6] .= '
'; @@ -918,11 +990,16 @@ foreach ($info as $user_id => $user_info) { true ); $data[6] .= '
'; + } else { + $data[6] = implode('', $userListActionButtons); } } else { $data[6] .= ''; // Delete button not in this mode. } + + // TODO. Check this in META!!! + $data[6] = implode('', $userListActionButtons); } else { $data[6] .= ''; // Delete button not in this mode. @@ -933,26 +1010,45 @@ foreach ($info as $user_id => $user_info) { } html_print_table($table); -ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom'); - -echo '
'; +$tablePagination = ui_pagination(count($info), false, 0, 0, true, 'offset', false, 'dataTables_paginate paging_simple_numbers'); unset($table); if ($is_management_allowed === true) { if ($config['admin_can_add_user'] !== false) { echo '
'; + html_print_action_buttons( + html_print_submit_button( + __('Create user'), + 'crt', + false, + [ 'icon' => 'wand' ], + true + ), + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ], + ); html_print_input_hidden('new_user', 1); - html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"'); echo '
'; } else { echo ''.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).''; } +} else { + html_print_action_buttons( + html_print_submit_button( + __('Create user'), + 'none', + true, + [ 'icon' => 'wand' ], + true + ), + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ], + ); } - -echo '
'; - -enterprise_hook('close_meta_frame'); - ?> data)) { - if ($filter_monitors) { - ui_print_info_message([ 'no_close' => true, 'message' => __('Any monitors aren\'t with this filter.') ]); - } else { - ui_print_info_message([ 'no_close' => true, 'message' => __('This agent doesn\'t have any active monitors.') ]); - } + if (empty($table->data) === true) { + ui_print_info_message( + [ + 'no_close' => true, + 'message' => ($filter_monitors === true) ? __('Any monitors aren\'t with this filter.') : __('This agent doesn\'t have any active monitors.'), + ] + ); } else { $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.'&status_text_monitor='.$status_text_monitor.'&status_module_group='.$status_module_group; - if ($paginate_module) { + if ($paginate_module === true) { ui_pagination( $count_modules, false, @@ -1350,7 +1376,7 @@ if (check_login()) { html_print_table($table); - if ($paginate_module) { + if ($paginate_module === true) { ui_pagination( $count_modules, false, @@ -1373,7 +1399,7 @@ if (check_login()) { unset($table_data); } - if ($get_type) { + if ($get_type === true) { $id_module = (int) get_parameter('id_module'); $module = modules_get_agentmodule($id_module); $graph_type = return_graphtype($module['id_tipo_modulo']); @@ -1627,7 +1653,7 @@ if (check_login()) { // If not valid it will throw an exception. json_decode($response); - if (json_last_error() == JSON_ERROR_NONE) { + if (json_last_error() === JSON_ERROR_NONE) { // If valid dump. echo $response; } else { @@ -1799,56 +1825,54 @@ if (check_login()) { $filters[$event_filter['id_filter']] = $event_filter['id_name']; } - echo '
'; + echo '
'; echo '
'; $table = new StdClass; $table->id = 'load_filter_form'; $table->width = '100%'; - $table->cellspacing = 4; - $table->cellpadding = 4; - $table->class = 'databox'; - if (is_metaconsole()) { - $table->cellspacing = 0; - $table->cellpadding = 0; - $table->class = 'databox filters'; - } - - $table->styleTable = 'font-weight: bold; color: #555; text-align:left;'; - $filter_id_width = '200px'; - if (is_metaconsole()) { - $filter_id_width = '150px'; - } + $table->class = 'filter-table-adv'; $data = []; $table->rowid[3] = 'update_filter_row1'; - $data[0] = __('Load filter').$jump; - $data[0] .= html_print_select( - $filters, - 'filter_id', - $current, - '', - __('None'), - 0, - true, - false, - true, - '', - false, - 'margin-left:5px; width:'.$filter_id_width.';' - ); - $data[1] = html_print_submit_button( + $data[0] = html_print_label_input_block( __('Load filter'), - 'load_filter', - false, - 'class="sub upd"', - true + html_print_select( + $filters, + 'filter_id', + $current, + '', + __('None'), + 0, + true, + false, + true, + '', + false + ) ); - $data[1] .= html_print_input_hidden('load_filter', 1, true); + $table->data[] = $data; $table->rowclass[] = ''; html_print_table($table); + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Load filter'), + 'srcbutton', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + false + ); + echo html_print_input_hidden('load_filter', 1, true); echo '
'; echo '
'; ?> @@ -1874,55 +1898,49 @@ if (check_login()) { } if ($save_filter_modal) { - echo '
'; + echo '
'; if (check_acl($config['id_user'], 0, 'AW')) { echo '
'; $table = new StdClass; $table->id = 'save_filter_form'; - $table->width = '100%'; - $table->cellspacing = 4; - $table->cellpadding = 4; - $table->class = 'databox'; - if (is_metaconsole()) { - $table->class = 'databox filters'; - $table->cellspacing = 0; - $table->cellpadding = 0; - } - - $table->styleTable = 'font-weight: bold; text-align:left;'; - if (!is_metaconsole()) { - $table->style[0] = 'width: 50%; width:50%;'; - } - + $table->size = []; + $table->size[0] = '50%'; + $table->size[1] = '50%'; + $table->class = 'filter-table-adv'; $data = []; + $table->rowid[0] = 'update_save_selector'; - $data[0] = html_print_radio_button( - 'filter_mode', - 'new', - '', - true, - true - ).__('New filter').''; + $data[0][0] = html_print_label_input_block( + __('New filter'), + html_print_radio_button( + 'filter_mode', + 'new', + '', + true, + true + ) + ); - $data[1] = html_print_radio_button( - 'filter_mode', - 'update', - '', - false, - true - ).__('Update/delete filter').''; + $data[0][1] = html_print_label_input_block( + __('Update/delete filter'), + html_print_radio_button( + 'filter_mode', + 'update', + '', + false, + true + ) + ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; $table->rowid[1] = 'save_filter_row1'; - $data[0] = __('Filter name').$jump; - $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true); - if (is_metaconsole()) { - $data[1] = __('Save in Group').$jump; - } else { - $data[1] = __('Filter group').$jump; + $data[1][0] = html_print_label_input_block( + __('Filter name'), + html_print_input_text('id_name', '', '', 15, 255, true) + ); + + $labelInput = __('Filter group'); + if (is_metaconsole() === true) { + $labelInput = __('Save in Group'); } $user_groups_array = users_get_groups_for_select( @@ -1932,32 +1950,23 @@ if (check_login()) { true ); - $data[1] .= html_print_select( - $user_groups_array, - 'id_group_filter_dialog', - $id_group_filter, - '', - '', - 0, - true, - false, - false, - 'w130' + $data[1][1] = html_print_label_input_block( + $labelInput, + html_print_select( + $user_groups_array, + 'id_group_filter_dialog', + $id_group_filter, + '', + '', + 0, + true, + false, + false + ), + ['div_class' => 'filter-group-dialog'] ); - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; $table->rowid[2] = 'save_filter_row2'; - - $table->data[] = $data; - $table->rowclass[] = ''; - - $data = []; - $table->rowid[3] = 'update_filter_row1'; - $data[0] = __('Overwrite filter').$jump; - $sql = 'SELECT id_filter, id_name FROM tmonitor_filter'; $monitor_filters = db_get_all_rows_sql($sql); @@ -1969,45 +1978,74 @@ if (check_login()) { } } - $data[0] .= html_print_select( - $_filters_update, - 'overwrite_filter', - '', - '', - '', - 0, + $data[2][0] = html_print_label_input_block( + __('Overwrite filter'), + html_print_select( + $_filters_update, + 'overwrite_filter', + '', + '', + '', + 0, + true + ) + ); + + $table->data = $data; + + html_print_table($table); + + html_print_div( + [ + 'id' => 'submit-save_filter', + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Save current filter'), + 'srcbutton', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + 'onclick' => 'save_new_filter();', + ], + true + ), + ], + false + ); + + $input_actions = html_print_submit_button( + __('Delete filter'), + 'delete_filter', + false, + [ + 'icon' => 'delete', + 'mode' => 'mini', + 'onclick' => 'save_delete_filter();', + ], true ); - $table->data[] = $data; - $table->rowclass[] = ''; + $input_actions .= html_print_submit_button( + __('Update filter'), + 'srcbutton', + false, + [ + 'icon' => 'update', + 'mode' => 'mini', + 'onclick' => 'save_update_filter();', + ], + true + ); - html_print_table($table); - echo '

'; - echo html_print_submit_button( - __('Update filter'), - 'update_filter', - false, - 'class="sub upd" onclick="save_update_filter();"', - true - ); - echo html_print_submit_button( - __('Delete filter'), - 'delete_filter', - false, - 'class="sub delete float-right" onclick="save_delete_filter();"', - true - ); - echo '
'; - echo '

'; - echo html_print_submit_button( - __('Save current filter'), - 'save_filter', - false, - 'class="sub upd float-right" onclick="save_new_filter();"', - true - ); - echo '
'; + html_print_div( + [ + 'id' => 'update_filter_row', + 'class' => 'action-buttons', + 'content' => $input_actions, + ], + false + ); } else { include 'general/noaccess.php'; } @@ -2016,32 +2054,34 @@ if (check_login()) { ?> '; $output .= '
fullSize) { $output .= ' width:100%'; @@ -3665,11 +3757,7 @@ class NetworkMap // Open networkconsole_id div. $output .= '
fullSize) { - if ($this->widget) { - $output .= ' class="networkconsole">'; - } else { - $output .= ' class="networkconsole">'; - } + $output .= ' class="networkconsole">'; } else { $output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">'; } @@ -3691,7 +3779,7 @@ class NetworkMap $output .= '
'; - $output .= html_print_image('/images/icono_borrar.png', true, ['id' => 'image_hide_show_labels']); + $output .= html_print_image('/images/disable.svg', true, ['id' => 'image_hide_show_labels', 'class' => 'main_menu_icon invert_filter']); $output .= '
'; $output .= '
__('Tactical View'), 'icon' => ui_get_full_url( - 'images/menu/op_monitoring.menu_gray.png' + 'images/menu/monitoring.svg' ), 'url' => ui_get_full_url( 'index.php?sec=view&sec2=operation/agentes/tactical' @@ -122,7 +122,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Agent Management'), 'icon' => ui_get_full_url( - 'images/menu/gm_resources.menu_gray.png' + 'images/menu/resources.svg' ), 'url' => ui_get_full_url( 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente' @@ -140,7 +140,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('General Setup'), 'icon' => ui_get_full_url( - 'images/menu/gm_setup.menu_gray.png' + 'images/menu/settings.svg' ), 'url' => ui_get_full_url( 'index.php?sec=general&sec2=godmode/setup/setup§ion=general' @@ -156,7 +156,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Manage Policies'), 'icon' => ui_get_full_url( - 'images/menu/gm_configuration.menu_gray.png' + 'images/menu/configuration.svg' ), 'url' => ui_get_full_url( 'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies' @@ -170,7 +170,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('List Alerts'), 'icon' => ui_get_full_url( - 'images/menu/gm_alerts.menu_gray.png' + 'images/menu/alerts.svg' ), 'url' => ui_get_full_url( 'index.php?sec=galertas&sec2=godmode/alerts/alert_list' @@ -194,7 +194,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('View Events'), 'icon' => ui_get_full_url( - 'images/menu/op_events.menu_gray.png' + 'images/menu/events.svg' ), 'url' => ui_get_full_url( 'index.php?sec=eventos&sec2=operation/events/events' @@ -218,7 +218,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Dashboard'), 'icon' => ui_get_full_url( - 'images/menu/op_reporting.menu_gray.png' + 'images/menu/reporting.svg' ), 'url' => ui_get_full_url( 'index.php?sec=reporting&sec2=operation/dashboard/dashboard' @@ -232,7 +232,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Visual Console'), 'icon' => ui_get_full_url( - 'images/menu/op_network.menu_gray.png' + 'images/menu/network.svg' ), 'url' => ui_get_full_url( 'index.php?sec=network&sec2=godmode/reporting/map_builder' @@ -246,7 +246,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Manage Servers'), 'icon' => ui_get_full_url( - 'images/menu/gm_servers.menu_gray.png' + 'images/menu/servers.svg' ), 'url' => ui_get_full_url( 'index.php?sec=gservers&sec2=godmode/servers/modificar_server' @@ -260,7 +260,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Edit User'), 'icon' => ui_get_full_url( - 'images/menu/gm_users.menu_gray.png' + 'images/menu/users.svg' ), 'url' => ui_get_full_url( 'index.php?sec=workspace&sec2=operation/users/user_edit' @@ -270,7 +270,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Tree View'), 'icon' => ui_get_full_url( - 'images/menu/op_monitoring.menu_gray.png' + 'images/menu/monitoring.svg' ), 'url' => ui_get_full_url( 'index.php?sec=view&sec2=operation/tree' @@ -280,7 +280,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Network Component'), 'icon' => ui_get_full_url( - 'images/menu/gm_configuration.menu_gray.png' + 'images/menu/configuration.svg' ), 'url' => ui_get_full_url( 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components' @@ -294,7 +294,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Task List'), 'icon' => ui_get_full_url( - 'images/menu/gm_discovery.menu.png' + 'images/menu/discovery.svg' ), 'url' => ui_get_full_url( 'index.php?sec=discovery&sec2=godmode/servers/discovery&wiz=tasklist' @@ -338,7 +338,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Warp Update'), 'icon' => ui_get_full_url( - 'images/menu/um_messages.menu_gray.png' + 'images/menu/warp_update.svg' ), 'url' => ui_get_full_url( 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup' @@ -352,7 +352,7 @@ class OrderInterpreter extends Wizard [ 'name' => __('Manage Agent Groups'), 'icon' => ui_get_full_url( - 'images/menu/gm_users.menu_gray.png' + 'images/menu/users.svg' ), 'url' => ui_get_full_url( 'index.php?sec=gagente&sec2=godmode/groups/group_list&tab=groups' diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php index 72c15795a4..0d9111a24b 100644 --- a/pandora_console/include/class/SatelliteAgent.class.php +++ b/pandora_console/include/class/SatelliteAgent.class.php @@ -157,11 +157,6 @@ class SatelliteAgent extends HTML $this->tableId = 'satellite_agents'; - if (is_metaconsole() === true) { - // Only in case of Metaconsole, format the frame. - open_meta_frame(); - } - // Load datatables user interface. ui_print_datatable( [ @@ -211,11 +206,6 @@ class SatelliteAgent extends HTML echo $e->getMessage(); } - if (is_metaconsole() === true) { - // Close the frame. - close_meta_frame(); - } - // Auxiliar div. $modal = ''; $msg = ''; @@ -1258,7 +1248,7 @@ class SatelliteAgent extends HTML $('body').append('
'); - $("#submit-create").on('click', function() { + $("#button-create").on('click', function() { show_form(); }); diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index 769ec5c6f4..aae0cb6780 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -119,11 +119,6 @@ class SatelliteCollection extends HTML $this->createBlock(); - if (is_metaconsole() === true) { - // Only in case of Metaconsole, format the frame. - open_meta_frame(); - } - // Datatables list. try { $columns = [ @@ -179,11 +174,6 @@ class SatelliteCollection extends HTML echo $e->getMessage(); } - if (is_metaconsole() === true) { - // Close the frame. - close_meta_frame(); - } - echo ''; echo ''; diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php index 3e31f810d5..c84775d4ed 100644 --- a/pandora_console/include/class/SnmpConsole.class.php +++ b/pandora_console/include/class/SnmpConsole.class.php @@ -383,14 +383,13 @@ class SnmpConsole extends HTML 5 => __('Other'), ]; - $this->tableId = 'snmp_console'; - + $tableId = 'snmp_console'; // Load datatables user interface. ui_print_datatable( [ - 'id' => $this->tableId, + 'id' => $tableId, 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => $this->ajaxController, @@ -421,6 +420,7 @@ class SnmpConsole extends HTML 'fields' => $show_alerts, 'return' => true, 'selected' => $this->filter_alert, + 'style' => 'widht:100% !important', ], [ 'label' => __('Severity'), @@ -431,6 +431,7 @@ class SnmpConsole extends HTML 'fields' => $severities, 'return' => true, 'selected' => $this->filter_severity, + 'style' => 'widht:100%', ], [ 'label' => __('Free search'), @@ -449,6 +450,7 @@ class SnmpConsole extends HTML 'fields' => $status_array, 'return' => true, 'selected' => $this->filter_status, + 'style' => 'widht:100%', ], [ 'label' => __('Group by Enterprise String/IP'), @@ -484,77 +486,103 @@ class SnmpConsole extends HTML ], ], ], + 'pagination_options' => [ + [ + $config['block_size'], + 5, + 10, + 25, + 100, + 200, + 500, + 1000, + ], + [ + $config['block_size'], + 5, + 10, + 25, + 100, + 200, + 500, + 1000, + ], + ], + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar', ] ); } catch (Exception $e) { echo $e->getMessage(); } - echo '
'; - html_print_submit_button(__('Validate'), 'updatebt', false, 'class="sub ok"'); - echo ' '; - html_print_submit_button( + $buttons[] = html_print_submit_button( + __('Validate'), + 'updatebt', + false, + [ + 'class' => 'sub ok', + 'icon' => 'next', + ], + true + ); + $buttons[] = html_print_submit_button( __('Delete'), 'deletebt', false, - 'class="sub delete" onClick="javascript:return confirm(\''.__('Are you sure?').'\')"' + [ + 'icon' => 'delete', + 'mode' => 'secondary', + 'onClick' => "javascript:return confirm('".__('Are you sure?')."')", + ], + true ); - echo '
'; - echo '
'; - echo '

'.__('Status').'

'; - echo html_print_image( - 'images/pixel_green.png', - true, - [ - 'width' => '20', - 'height' => '20', - ] - ).' - '.__('Validated'); - echo '
'; - echo html_print_image( - 'images/pixel_red.png', - true, - [ - 'width' => '20', - 'height' => '20', - ] - ).' - '.__('Not validated'); - echo '
'; - echo '
'; - echo '

'.__('Alert').'

'; - echo html_print_image( - 'images/pixel_yellow.png', - true, - [ - 'width' => '20', - 'height' => '20', - ] - ).' - '.__('Fired'); - echo '
'; - echo html_print_image( - 'images/pixel_gray.png', - true, - [ - 'width' => '20', - 'height' => '20', - ] - ).' - '.__('Not fired'); - echo '
'; - echo '
'; - echo '

'.__('Action').'

'; - echo html_print_image('images/ok.png', true).' - '.__('Validate'); - echo '
'; - echo html_print_image('images/cross.png', true, ['class' => 'invert_filter']).' - '.__('Delete'); - echo '
'; - echo '
'; - echo '

'.__('Severity').'

'; - foreach (get_priorities() as $num => $name) { - echo ''.$name.''; - echo '
'; + html_print_action_buttons( + implode('', $buttons), + ['type' => 'form_action'] + ); + + $legend = ''; + $legend .= ''; + $legend .= ''; + $legend .= ''; + + ui_toggle($legend, __('Legend')); // Load own javascript file. echo $this->loadJS(); @@ -882,12 +910,13 @@ class SnmpConsole extends HTML $tmp->action = ''; if ($status != 1) { $tmp->action .= ''.html_print_image( - 'images/ok.png', + 'images/validate.svg', true, [ 'border' => '0', 'title' => __('Validate'), 'onclick' => 'validate_trap(\''.$tmp->id_trap.'\')', + 'class' => 'invert_filter main_menu_icon', ] ).' '; } @@ -895,41 +924,51 @@ class SnmpConsole extends HTML if ($tmp->source === '') { if (\users_is_admin()) { $tmp->action .= ''.html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'border' => '0', 'title' => __('Delete'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', 'onclick' => 'delete_trap(\''.$tmp->id_trap.'\')', ] ).' '; } } else { $tmp->action .= ''.html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'border' => '0', 'title' => __('Delete'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', 'onclick' => 'delete_trap(\''.$tmp->id_trap.'\')', ] ).' '; } $tmp->action .= ''.html_print_image( - 'images/eye.png', + 'images/see-details@svg.svg', true, [ 'alt' => __('Show more'), 'title' => __('Show more'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; if ($config['enterprise_installed']) { - $tmp->action .= ''.html_print_image('images/edit.png', true, ['alt' => __('SNMP trap editor'), 'title' => __('SNMP trap editor')]).''; + $tmp->action .= ''; + $tmp->action .= html_print_image( + 'images/edit.svg', + true, + [ + 'alt' => __('SNMP trap editor'), + 'title' => __('SNMP trap editor'), + 'class' => 'main_menu_icon invert_filter', + ] + ); + $tmp->action .= ''; } $tmp->m = html_print_checkbox_extended('snmptrapid[]', $tmp->id_trap, false, false, '', 'class="chk"', true); @@ -1469,7 +1508,7 @@ class SnmpConsole extends HTML } }); - $('#submit-updatebt').click(function() { + $('#button-updatebt').click(function() { let array = []; $('input[name="snmptrapid[]"]:checked').each(function() { array.push(this.value); @@ -1496,7 +1535,7 @@ class SnmpConsole extends HTML } }); - $('#submit-deletebt').click(function() { + $('#button-deletebt').click(function() { let array = []; $('input[name="snmptrapid[]"]:checked').each(function() { array.push(this.value); diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index bf3fbf9b5d..c5af28b54f 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -405,13 +405,13 @@ class Tree $processed_item['rootType'] = $this->rootType; $processed_item['searchChildren'] = 1; - if (isset($item['type'])) { + if (isset($item['type']) === true) { $processed_item['type'] = $item['type']; } else { $processed_item['type'] = $this->type; } - if (isset($item['rootType'])) { + if (isset($item['rootType']) === true) { $processed_item['rootType'] = $item['rootType']; } else { $processed_item['rootType'] = $this->rootType; @@ -420,23 +420,23 @@ class Tree if ($processed_item['type'] == 'group') { $processed_item['parent'] = $item['parent']; - $processed_item['icon'] = empty($item['icon']) ? 'without_group.png' : $item['icon'].'.png'; + $processed_item['icon'] = empty($item['icon']) === true ? 'unknown@groups.svg' : $item['icon']; } - if (isset($item['iconHTML'])) { + if (isset($item['iconHTML']) === true) { $processed_item['icon'] = $item['iconHTML']; } - if (is_metaconsole() && !empty($server)) { + if (is_metaconsole() === true && empty($server) === false) { $processed_item['serverID'] = $server['id']; } $counters = []; - if (isset($item['total_unknown_count'])) { + if (isset($item['total_unknown_count']) === true) { $counters['unknown'] = $item['total_unknown_count']; } - if (isset($item['total_critical_count'])) { + if (isset($item['total_critical_count']) === true) { $counters['critical'] = $item['total_critical_count']; } @@ -677,10 +677,9 @@ class Tree } } - $module['statusImageHTML'] = ui_print_status_image($statusType, htmlspecialchars($statusTitle), true); - - // HTML of the server type image - $module['serverTypeHTML'] = servers_show_type($module['server_type']); + $module['statusImageHTML'] = ui_print_status_image($statusType, htmlspecialchars($statusTitle), true, ['is_tree_view' => true]); + // HTML of the server type image. + $module['serverTypeHTML'] = ui_print_servertype_icon((int) $module['server_type']); // Link to the Module graph. // ACL. @@ -781,10 +780,19 @@ class Tree if ((bool) $module['alerts']) { // Module has alerts triggered. if ($module_alert_triggered === true) { - $module['alertsImageHTML'] = html_print_image('images/bell_orange.png', true, ['title' => __('Module alerts'), 'style' => 'filter: initial']); + $colorAlertButton = COL_ALERTFIRED; } else { - $module['alertsImageHTML'] = html_print_image('images/bell_green.png', true, ['title' => __('Module alerts'), 'style' => 'filter: initial']); + $colorAlertButton = COL_NORMAL; } + + $module['alertsImageHTML'] = html_print_div( + [ + 'title' => __('Module alerts'), + 'class' => 'alert_background_state main_menu_icon module-button', + 'style' => 'background-color: '.$colorAlertButton, + ], + true + ); } } @@ -925,7 +933,7 @@ class Tree // Quiet image if (isset($agent['quiet']) && $agent['quiet']) { - $agent['statusImageHTML'] = ui_print_status_sets('agent_no_monitors_ball.png', __('Quiet'), 1, ['class' => 'status_balls', 'style' => 'background: '.COL_QUIET.';'], '', false); + $agent['statusImageHTML'] = ui_print_status_sets('agent_no_monitors_ball.png', __('Quiet'), 1, ['is_tree_view' => 'yes', 'class' => 'status_balls', 'style' => 'background: '.COL_QUIET.';'], '', false); } // Children diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index e68158c117..69b06fd684 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -222,22 +222,30 @@ class TreeService extends Tree switch ($status) { case SERVICE_STATUS_NORMAL: - $processed_items[$row['id']]['statusImageHTML'] = 'NORMAL status.'; + $serviceStatusLine = COL_NORMAL; break; case SERVICE_STATUS_CRITICAL: - $processed_items[$row['id']]['statusImageHTML'] = 'CRITICAL status.'; + $serviceStatusLine = COL_CRITICAL; break; case SERVICE_STATUS_WARNING: - $processed_items[$row['id']]['statusImageHTML'] = 'WARNING status.'; + $serviceStatusLine = COL_WARNING; break; case SERVICE_STATUS_UNKNOWN: default: - $processed_items[$row['id']]['statusImageHTML'] = 'UNKNOWN status.'; + $serviceStatusLine = COL_UNKNOWN; break; } + + $processed_items[$row['id']]['statusImageHTML'] = html_print_div( + [ + 'class' => 'node-service-status', + 'style' => 'background-color: '.$serviceStatusLine, + ], + true + ); } $this->tree = $processed_items; @@ -510,14 +518,11 @@ class TreeService extends Tree $tmp['eventAgent'] = $item->module()->id_agente(); $tmp['disabled'] = $item->module()->disabled(); - $html = 'module()->lastStatusTitle().'" />'; + $tmp['statusImageHTML'] = $html; $tmp = array_merge( $tmp, diff --git a/pandora_console/include/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php index 43c68cd533..d1f14c2217 100644 --- a/pandora_console/include/class/WelcomeWindow.class.php +++ b/pandora_console/include/class/WelcomeWindow.class.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2022 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 @@ -392,15 +392,10 @@ class WelcomeWindow extends Wizard 'class' => 'modal', ]; - $logo_url = ''; - if (enterprise_installed()) { - $logo_url = ENTERPRISE_DIR.'/'; - } + $logo_url = 'images/custom_logo/pandora_logo_head_white_bg.png'; - if (empty($config['custom_logo_white_bg']) === false) { - $logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg']; - } else { - $logo_url .= 'images/custom_logo/pandora_logo_head_white_bg.png'; + if (enterprise_installed() === true) { + $logo_url = ENTERPRISE_DIR.'/'.$logo_url; } $inputs = [ @@ -421,7 +416,7 @@ class WelcomeWindow extends Wizard [ 'wrapper' => 'div', 'block_id' => 'div_configure_mail', - 'class' => 'hole flex-row w98p '.$li_configure_mail_class, + 'class' => 'hole flex-row flex-items-center w98p '.$li_configure_mail_class, 'direct' => 1, 'block_content' => [ [ @@ -436,7 +431,10 @@ class WelcomeWindow extends Wizard 'arguments' => [ 'label' => '', 'type' => 'button', - 'attributes' => 'class="go '.$btn_configure_mail_class.' second_background"', + 'attributes' => [ + 'class' => (empty($btn_configure_mail_class) === false) ? $btn_configure_mail_class : 'invisible_important', + 'mode' => 'onlyIcon', + ], 'name' => 'btn_email_conf', 'id' => 'btn_email_conf', ], @@ -455,7 +453,7 @@ class WelcomeWindow extends Wizard [ 'wrapper' => 'div', 'block_id' => 'div_create_agent', - 'class' => 'learn_content_indented flex-row w98p '.$li_create_agent_class, + 'class' => 'learn_content_indented flex-row flex-items-center w98p '.$li_create_agent_class, 'direct' => 1, 'block_content' => [ [ @@ -470,7 +468,10 @@ class WelcomeWindow extends Wizard 'arguments' => [ 'label' => '', 'type' => 'button', - 'attributes' => 'class="go '.$btn_create_agent_class.' second_background"', + 'attributes' => [ + 'class' => (empty($btn_create_agent_class) === false) ? $btn_create_agent_class : 'invisible_important', + 'mode' => 'onlyIcon', + ], 'name' => 'btn_create_agent', 'id' => 'btn_create_agent', ], @@ -480,7 +481,7 @@ class WelcomeWindow extends Wizard [ 'wrapper' => 'div', 'block_id' => 'div_monitor_actions', - 'class' => 'learn_content_indented flex-row w98p '.$li_create_module_class, + 'class' => 'learn_content_indented flex-row flex-items-center w98p '.$li_create_module_class, 'direct' => 1, 'block_content' => [ [ @@ -495,7 +496,10 @@ class WelcomeWindow extends Wizard 'arguments' => [ 'label' => '', 'type' => 'button', - 'attributes' => 'class="go '.$btn_create_module_class.' second_background"', + 'attributes' => [ + 'class' => (empty($btn_create_module_class) === false) ? $btn_create_module_class : 'invisible_important', + 'mode' => 'onlyIcon', + ], 'name' => 'btn_create_module', 'id' => 'btn_create_module', ], @@ -505,7 +509,7 @@ class WelcomeWindow extends Wizard [ 'wrapper' => 'div', 'block_id' => 'div_monitor_actions', - 'class' => 'hole learn_content_indented flex-row w98p '.$li_create_alert_class, + 'class' => 'hole learn_content_indented flex-row flex-items-center w98p '.$li_create_alert_class, 'direct' => 1, 'block_content' => [ [ @@ -520,7 +524,10 @@ class WelcomeWindow extends Wizard 'arguments' => [ 'label' => '', 'type' => 'button', - 'attributes' => 'class="go '.$btn_create_alert_class.' second_background"', + 'attributes' => [ + 'class' => (empty($btn_create_alert_class) === false) ? $btn_create_alert_class : 'invisible_important', + 'mode' => 'onlyIcon', + ], 'name' => 'btn_create_alert', 'id' => 'btn_create_alert', ], @@ -530,7 +537,7 @@ class WelcomeWindow extends Wizard [ 'wrapper' => 'div', 'block_id' => 'div_discover', - 'class' => 'hole flex-row w98p '.$li_create_discovery_class, + 'class' => 'hole flex-row flex-items-center w98p '.$li_create_discovery_class, 'direct' => 1, 'block_content' => [ [ @@ -545,7 +552,10 @@ class WelcomeWindow extends Wizard 'arguments' => [ 'label' => '', 'type' => 'button', - 'attributes' => 'class="go '.$btn_create_discovery_class.' second_background"', + 'attributes' => [ + 'class' => (empty($btn_create_discovery_class) === false) ? $btn_create_discovery_class : 'invisible_important', + 'mode' => 'onlyIcon', + ], 'name' => 'btn_discover_devices', 'id' => 'btn_discover_devices', ], @@ -554,11 +564,11 @@ class WelcomeWindow extends Wizard ], ]; - if (enterprise_installed()) { + if (enterprise_installed() === true) { $inputs[] = [ 'wrapper' => 'div', 'block_id' => 'div_not_working', - 'class' => 'hole flex-row w98p', + 'class' => 'hole flex-row flex-items-center w98p', 'direct' => 1, 'block_content' => [ [ @@ -773,7 +783,7 @@ class WelcomeWindow extends Wizard // Create Discovery task is pending. // Host&Devices finishses on page 2. if ($sec2 === 'godmode/servers/discovery' - && get_parameter('page', 0) == 2 + && (int) get_parameter('page') === 2 ) { // Discovery task have been created. $this->step = W_CREATE_TASK; @@ -882,8 +892,8 @@ class WelcomeWindow extends Wizard window.location = 'getWelcomeAgent().''); ?>'; } - function monitorRemoteCommands() { - window.location = ''; + function monitorRemoteCommands() { + window.location = ''; } function discoverDevicesNetwork() { @@ -896,7 +906,7 @@ class WelcomeWindow extends Wizard function cierre_dialog(){ this.dialog("close"); } - + ', @@ -4444,6 +4471,7 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0) $y, $row, $column, + // $square_length.$measureSymbol, $square_length, $square_length, $status, @@ -4502,3 +4530,17 @@ function agents_get_starmap(int $id_agent, float $width=0, float $height=0) return $html; } + + +/** + * Defines a hash for agent name. + * + * @param string $alias Alias. + * @param string $nombre_agente Agent name. + * + * @return string. + */ +function hash_agent_name(string $alias, string $nombre_agente) +{ + return hash('sha256', $alias.'|'.$nombre_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); +} \ No newline at end of file diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 7b6e133f22..24d2de537d 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -947,6 +947,10 @@ function config_update_config() $error_update[] = __('Date format string'); } + if (config_update_value('notification_autoclose_time', (string) get_parameter('notification_autoclose_time'), true) === false) { + $error_update[] = __('Notification Autoclose time'); + } + if (config_update_value('prominent_time', (string) get_parameter('prominent_time'), true) === false) { $error_update[] = __('Timestamp or time comparation'); } @@ -1120,6 +1124,14 @@ function config_update_config() $error_update[] = __('Copyright notice'); } + if (config_update_value('background_opacity', (string) get_parameter('background_opacity'), true) === false) { + $error_update[] = __('Background opacity % (login)'); + } + + if (config_update_value('meta_background_opacity', (string) get_parameter('meta_background_opacity'), true) === false) { + $error_update[] = __('Background opacity % (login)'); + } + if (config_update_value('meta_custom_logo_white_bg', (string) get_parameter('meta_custom_logo_white_bg'), true) === false) { $error_update[] = __('Custom logo metaconsole (white background)'); } @@ -1225,7 +1237,15 @@ function config_update_config() } if (config_update_value('visual_animation', get_parameter('visual_animation'), true) === false) { - $error_update[] = __('visual_animation'); + $error_update[] = __('Visual animation'); + } + + if (config_update_value('random_background', get_parameter('random_background'), true) === false) { + $error_update[] = __('Random background'); + } + + if (config_update_value('meta_random_background', get_parameter('meta_random_background'), true) === false) { + $error_update[] = __('Random background'); } if (config_update_value('disable_help', get_parameter('disable_help'), true) === false) { @@ -2541,7 +2561,7 @@ function config_process_config() } if (!isset($config['custom_splash_login'])) { - config_update_value('custom_splash_login', 'splash_image_default.png'); + config_update_value('custom_splash_login', 'default'); } if (!isset($config['custom_docs_logo'])) { @@ -2600,6 +2620,14 @@ function config_process_config() config_update_value('rb_copyright_notice', get_copyright_notice()); } + if (!isset($config['background_opacity'])) { + config_update_value('background_opacity', 30); + } + + if (!isset($config['meta_background_opacity'])) { + config_update_value('meta_background_opacity', 30); + } + if (!isset($config['meta_custom_docs_url'])) { config_update_value('meta_custom_docs_url', 'https://pandorafms.com/manual/'); } @@ -2617,7 +2645,7 @@ function config_process_config() } if (!isset($config['meta_custom_splash_login'])) { - config_update_value('meta_custom_splash_login', 'splash_image_metaconsola.png'); + config_update_value('meta_custom_splash_login', 'default'); } if (!isset($config['meta_custom_title1_login'])) { @@ -3453,6 +3481,14 @@ function config_process_config() config_update_value('visual_animation', 1); } + if (!isset($config['random_background'])) { + config_update_value('random_background', ''); + } + + if (!isset($config['meta_random_background'])) { + config_update_value('meta_random_background', ''); + } + if (!isset($config['networkmap_max_width'])) { config_update_value('networkmap_max_width', 900); } @@ -3575,6 +3611,10 @@ function config_process_config() config_update_value('decimal_separator', '.'); } + if (isset($config['notification_autoclose_time']) === false) { + config_update_value('notification_autoclose_time', 5); + } + // Finally, check if any value was overwritten in a form. config_update_config(); } diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index c41c909c27..f779b7121e 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2470,13 +2470,9 @@ function events_print_event_table( ui_require_css_file('events'); - if ($agent_id == 0) { - $agent_condition = ''; - } else { - $agent_condition = ' id_agente = '.$agent_id.' AND '; - } + $agent_condition = ($agent_id === 0) ? '' : ' id_agente = '.$agent_id.' AND '; - if ($filter == '') { + if (empty($filter) === true) { $filter = '1 = 1'; } @@ -2496,7 +2492,7 @@ function events_print_event_table( $result = db_get_all_rows_sql($sql); if ($result === false) { - if ($return) { + if ($return === true) { $returned = ui_print_info_message(__('No events'), '', true); return $returned; } else { @@ -2508,8 +2504,8 @@ function events_print_event_table( $table->cellpadding = 0; $table->cellspacing = 0; $table->width = $width; - $table->class = 'info_table no-td-padding'; - if (!$tactical_view) { + $table->class = 'tactical_table info_table no-td-padding'; + if ($tactical_view === false) { $table->title = __('Latest events'); } @@ -2524,31 +2520,28 @@ function events_print_event_table( $table->style = []; $i = 0; - $table->head[$i] = "".__('S.').''; - $table->headstyle[$i] = 'width: 1%;text-align: center;'; - $table->style[$i++] = 'text-align: center;'; - $table->head[$i] = __('Type'); + $table->head[$i] = ''.__('Type').''; $table->headstyle[$i] = 'width: 3%;text-align: center;'; $table->style[$i++] = 'text-align: center;'; - $table->head[$i] = __('Event name'); + $table->head[$i] = ''.__('Event name').''; $table->headstyle[$i] = ''; - $table->style[$i++] = 'word-break: break-word;'; + $table->style[$i++] = 'padding: 0 5px;word-break: break-word'; - if ($agent_id == 0) { - $table->head[$i] = __('Agent name'); + if ($agent_id === 0) { + $table->head[$i] = ''.__('Agent name').''; $table->headstyle[$i] = ''; $table->style[$i++] = 'word-break: break-all;'; } - $table->head[$i] = __('Timestamp'); + $table->head[$i] = ''.__('Timestamp').''; $table->headstyle[$i] = 'width: 150px;'; - $table->style[$i++] = 'word-break: break-word;'; + $table->style[$i++] = 'padding: 0 5px;word-break: break-word;'; - $table->head[$i] = __('Status'); + $table->head[$i] = ''.__('Status').''; $table->headstyle[$i] = 'width: 150px;text-align: center;'; - $table->style[$i++] = 'text-align: center;'; + $table->style[$i++] = 'padding: 0 5px;text-align: center;'; $table->head[$i] = "".__('V.').''; $table->headstyle[$i] = 'width: 1%;text-align: center;'; @@ -2563,7 +2556,7 @@ function events_print_event_table( // Copy all groups of the agent and append the event group. $check_events = $all_groups; $check_events[] = $event['id_grupo']; - if (! check_acl_one_of_groups($config['id_user'], $check_events, 'ER')) { + if ((bool) check_acl_one_of_groups($config['id_user'], $check_events, 'ER') === false) { continue; } @@ -2571,30 +2564,24 @@ function events_print_event_table( // Colored box. switch ($event['estado']) { - case 0: - $img = 'images/star.png'; + case EVENT_STATUS_NEW: + default: + $img = 'images/star@svg.svg'; $title = __('New event'); break; - case 1: - $img = 'images/tick.png'; + case EVENT_STATUS_VALIDATED: + $img = 'images/validate.svg'; $title = __('Event validated'); break; - case 2: - $img = 'images/hourglass.png'; + case EVENT_STATUS_INPROCESS: + $img = 'images/clock.svg'; $title = __('Event in process'); break; - - default: - // Ignore. - break; } $i = 0; - // Criticity. - $data[$i++] = ui_print_event_priority($event['criticity'], true, true); - // Event type. $data[$i++] = events_print_type_img($event['event_type'], true); @@ -2603,14 +2590,19 @@ function events_print_event_table( strip_tags(io_safe_output($event['evento'])), 75, true, - '7.5' ); - if ($agent_id == 0) { + if ($agent_id === 0) { if ($event['id_agente'] > 0) { // Agent name. // Get class name, for the link color, etc. - $data[$i] = "".agents_get_alias($event['id_agente']).''; + $data[$i] = html_print_anchor( + [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event['id_agente'], + 'content' => agents_get_alias($event['id_agente']), + ], + true + ); // For System or SNMP generated alerts. } else if ($event['event_type'] === 'system') { $data[$i] = __('System'); @@ -2622,10 +2614,10 @@ function events_print_event_table( } // Timestamp. - $data[$i++] = ui_print_timestamp($event['timestamp'], true, ['style' => 'font-size: 7.5pt; letter-spacing: 0.3pt;']); + $data[$i++] = ui_print_timestamp($event['timestamp'], true, ['style' => 'letter-spacing: 0.3pt;']); // Status. - $data[$i++] = ui_print_event_type($event['event_type'], true); + $data[$i++] = ui_print_event_type($event['event_type'], true, true); $data[$i++] = html_print_image( $img, @@ -2643,7 +2635,7 @@ function events_print_event_table( unset($table); - if ($return) { + if ($return === true) { return $out; } else { echo $out; @@ -2671,84 +2663,85 @@ function events_print_type_img( $output = ''; $urlImage = ui_get_full_url(false); - - $style = ''; + $icon = ''; + $style = 'invert_filter main_menu_icon'; switch ($type) { case 'alert_recovered': - $icon = 'images/bell.png'; - $style = 'invert_filter'; + $icon = 'images/alert@svg.svg'; break; case 'alert_manual_validation': - $icon = 'images/ok.png'; - $style = 'invert_filter'; + $icon = 'images/validate.svg'; break; case 'going_down_critical': case 'going_up_critical': // This is to be backwards compatible. - $icon = 'images/module_critical.png'; + $style .= ' event_module_background_state icon_background_critical'; break; case 'going_up_normal': case 'going_down_normal': // This is to be backwards compatible. - $icon = 'images/module_ok.png'; + $style .= ' event_module_background_state icon_background_normal'; break; case 'going_up_warning': case 'going_down_warning': - $icon = 'images/module_warning.png'; + $style .= ' event_module_background_state icon_background_warning'; break; case 'going_unknown': - $icon = 'images/module_unknown.png'; + $style .= ' event_module_background_state icon_background_unknown'; break; case 'alert_fired': $icon = 'images/bell_error.png'; - $style = 'invert_filter'; break; case 'system': - $icon = 'images/cog.png'; - $style = 'invert_filter'; + $icon = 'images/configuration@svg.svg'; break; case 'recon_host_detected': $icon = 'images/recon.png'; - $style = 'invert_filter'; break; case 'new_agent': - $icon = 'images/agent.png'; - $style = 'invert_filter'; + $icon = 'images/agents@svg.svg'; break; case 'configuration_change': - $icon = 'images/config.png'; - $style = 'invert_filter'; + $icon = 'images/configuration@svg.svg'; break; case 'unknown': default: - $icon = 'images/lightning_go.png'; - $style = 'invert_filter'; + $icon = 'images/event.svg'; break; } if ($only_url) { $output = $urlImage.'/'.$icon; } else { - $output .= html_print_image( + $output .= html_print_div( + [ + 'title' => events_print_type_description($type, true), + 'class' => $style, + 'style' => 'margin: 0 auto;'.((empty($icon) === false) ? 'background-image: url('.$icon.'); background-repeat: no-repeat;' : ''), + ], + true + ); + /* + $output .= html_print_image( $icon, true, [ 'title' => events_print_type_description($type, true), 'class' => $style, ] - ); + );*/ } if ($return) { @@ -3379,7 +3372,10 @@ function events_page_responses($event) 'owner_button', false, 'event_change_owner('.$event['id_evento'].', '.$event['server_id'].');', - 'class="sub next w70p"', + [ + 'icon' => 'next', + 'mode' => 'link', + ], true ); @@ -3458,7 +3454,10 @@ function events_page_responses($event) 'status_button', false, 'event_change_status(\''.$event['similar_ids'].'\','.$event['server_id'].');', - 'class="sub next w70p"', + [ + 'icon' => 'next', + 'mode' => 'link', + ], true ); } @@ -3486,7 +3485,10 @@ function events_page_responses($event) 'comment_button', false, '$(\'#link_comments\').trigger(\'click\');', - 'class="sub next w70p"', + [ + 'icon' => 'next', + 'mode' => 'link', + ], true ); @@ -3510,7 +3512,10 @@ function events_page_responses($event) 'delete_button', false, 'if(!confirm(\''.__('Are you sure?').'\')) { return false; } this.form.submit();', - 'class="sub cancel w70p"', + [ + 'icon' => 'cancel', + 'mode' => 'link', + ], true ); $data[2] .= html_print_input_hidden('delete', 1, true); @@ -3565,7 +3570,7 @@ function events_page_responses($event) 'custom_response_button', false, 'execute_response('.$event['id_evento'].','.$server_id.',0)', - "class='sub next w70p'", + ['mode' => 'link'], true ); } @@ -4184,7 +4189,7 @@ function events_page_details($event, $server_id=0) $agent = []; } - $data[0] = __('Agent details'); + $data[0] = ''.__('Agent details').''; $data[1] = empty($agent) ? ''.__('N/A').'' : ''; $table_details->data[] = $data; @@ -4229,11 +4234,14 @@ function events_page_details($event, $server_id=0) $data = []; $data[0] = '
'.__('OS').'
'; - $data[1] = ui_print_os_icon($agent['id_os'], true, true); + $data[1] = '
'; + $data[1] .= get_os_name($agent['id_os']); if (empty($agent['os_version']) === false) { $data[1] .= ' ('.$agent['os_version'].')'; } + $data[1] .= '
'; + $table_details->data[] = $data; $data = []; @@ -4253,7 +4261,7 @@ function events_page_details($event, $server_id=0) 'custom_button', false, '$(\'#link_custom_fields\').trigger(\'click\');', - 'class="sub next"', + [ 'mode' => 'link' ], true ); $table_details->data[] = $data; @@ -4272,8 +4280,8 @@ function events_page_details($event, $server_id=0) } $data = []; - $data[0] = __('Module details'); - $data[1] = empty($module) ? ''.__('N/A').'' : ''; + $data[0] = ''.__('Module details').''; + $data[1] = (empty($module) === true) ? ''.__('N/A').'' : ''; $table_details->data[] = $data; if (empty($module) === false) { @@ -4349,10 +4357,7 @@ function events_page_details($event, $server_id=0) $graph_params_str = http_build_query($graph_params); $link = "winopeng_var('".$url.'?'.$graph_params_str."','".$win_handle."', 800, 480)"; - - $data[1] = ''; - $data[1] .= html_print_image('images/chart_curve.png', true, ['class' => 'invert_filter']); - $data[1] .= ''; + $data[1] = html_print_button(__('View graph'), 'view_graph_button', false, $link, ['mode' => 'link'], true); $table_details->data[] = $data; } } @@ -4369,7 +4374,7 @@ function events_page_details($event, $server_id=0) $standby = db_get_value('standby', 'talert_template_modules', 'id', $event['id_alert_am']); if (!$standby) { $data[1] .= html_print_image( - 'images/bell.png', + 'images/alert@svg.svg', true, [ 'title' => __('Go to data overview'), @@ -4378,11 +4383,12 @@ function events_page_details($event, $server_id=0) ); } else { $data[1] .= html_print_image( - 'images/bell_pause.png', + 'images/alert@svg.svg', true, [ 'title' => __('Go to data overview'), 'class' => 'invert_filter', + 'style' => 'opacity: .5', ] ); } @@ -4550,19 +4556,19 @@ function events_display_status($status) switch ($status) { case 0: return [ - 'img' => 'images/star.png', + 'img' => 'images/star@svg.svg', 'title' => __('New event'), ]; case 1: return [ - 'img' => 'images/tick.png', + 'img' => 'images/validate.svg', 'title' => __('Event validated'), ]; case 2: return [ - 'img' => 'images/hourglass.png', + 'img' => 'images/clock.svg', 'title' => __('Event in process'), ]; @@ -4808,7 +4814,7 @@ function events_page_general($event) $table_general->cellclass[count($table_general->data)][1] = 'general_status'; $data[0] = __('Status'); $data[1] = $event_st['title']; - $data[2] = html_print_image($event_st['img'], true); + $data[2] = html_print_image($event_st['img'], true, [ 'class' => 'invert_filter main_menu_icon']); $table_general->data[] = $data; // If event is validated, show who and when acknowleded it. @@ -5167,7 +5173,10 @@ function events_page_comments($event, $ajax=false, $groupedComments=[]) 'comment_button', false, 'event_comment(\''.base64_encode(json_encode($event)).'\');', - 'class="sub next"', + [ + 'icon' => 'next', + 'mode' => 'mini secondary', + ], true ); $comments_form .= '
'; @@ -5771,7 +5780,10 @@ function get_row_response_action( 'btn_str', false, 'perform_response(\''.base64_encode(json_encode($event_response)).'\','.$response_id.',\''.trim($index).'\')', - "class='sub next'", + [ + 'icon' => 'next', + 'mode' => 'mini secondary', + ], true ); $output .= ''; diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 4fc6dd0b14..1f1f57c832 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -542,7 +542,7 @@ function filemanager_file_explorer( break; case 'create_text_file': - title_action = ""; + title_action = ""; break; case 'upload_file': @@ -752,7 +752,7 @@ function filemanager_file_explorer( && ($readOnly === false) ) { $data[4] .= '
'; - $data[4] .= ''; + $data[4] .= ''; $data[4] .= html_print_input_hidden('filename', $fileinfo['realpath'], true); $data[4] .= html_print_input_hidden('hash', md5($fileinfo['realpath'].$config['server_unique_identifier']), true); $data[4] .= html_print_input_hidden('delete_file', 1, true); @@ -791,7 +791,7 @@ function filemanager_file_explorer( && (is_dir($fileinfo['realpath']) === false || count(scandir($fileinfo['realpath'])) < 3) && ($readOnly === false) ) { - $data[4] .= ''.html_print_image('images/book_edit.png', true, ['style' => 'margin-top: 2px;', 'title' => __('Real path'), 'class' => 'invert_filter']).''; + $data[4] .= ''.html_print_image('images/enable.svg', true, ['style' => 'margin-top: 2px;', 'title' => __('Real path'), 'class' => 'invert_filter main_menu_icon']).''; } $data[4] .= '
'; @@ -830,10 +830,10 @@ function filemanager_file_explorer( 'images/create_file.png', true, [ - 'title' => __('Create a Text'), + 'title' => __('Create File'), 'class' => 'invert_filter', ] - ).''.__('Create a Text').' + ).''.__('Create File').' '; } @@ -857,7 +857,7 @@ function filemanager_file_explorer( $createFolderElements = $tabs_dialog; $createFolderElements .= sprintf('', $url); $createFolderElements .= html_print_input_text('dirname', '', '', 30, 255, true); - $createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"', true); + $createFolderElements .= html_print_submit_button(__('Create'), 'crt', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true); $createFolderElements .= html_print_input_hidden('directory', $relative_directory, true); $createFolderElements .= html_print_input_hidden('create_dir', 1, true); $createFolderElements .= html_print_input_hidden('hash', md5($relative_directory.$config['server_unique_identifier']), true); @@ -897,7 +897,7 @@ function filemanager_file_explorer( $uploadFileElements .= html_print_input_hidden('upload_file', 1, true); } - $uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, 'class="sub next"', true); + $uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true); $uploadFileElements .= html_print_input_hidden('real_directory', $real_directory, true); $uploadFileElements .= html_print_input_hidden('directory', $relative_directory, true); $uploadFileElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true); @@ -918,7 +918,7 @@ function filemanager_file_explorer( $createTextElements = $tabs_dialog; $createTextElements .= ''; $createTextElements .= html_print_input_text('name_file', '', '', 30, 50, true); - $createTextElements .= html_print_submit_button(__('Create'), 'create', false, 'class="sub next"', true); + $createTextElements .= html_print_submit_button(__('Create'), 'create', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true); $createTextElements .= html_print_input_hidden('real_directory', $real_directory, true); $createTextElements .= html_print_input_hidden('directory', $relative_directory, true); $createTextElements .= html_print_input_hidden('hash', md5($real_directory.$relative_directory.$config['server_unique_identifier']), true); @@ -937,40 +937,46 @@ function filemanager_file_explorer( echo "
"; - echo ""; - echo html_print_image( - 'images/create_directory.png', - true, + $buttons[] = html_print_button( + __('Create directory'), + 'create_directory', + false, + 'show_form_create_folder()', [ - 'title' => __('Create directory'), - 'class' => 'invert_filter', - ] + 'class' => 'margin-right-2 invert_filter secondary', + 'icon' => 'create_directory', + ], + true, + false ); - echo ''; if ($allowCreateText === true) { - echo ""; - echo html_print_image( - 'images/create_file.png', - true, + $buttons[] = html_print_button( + __('Create file'), + 'create_text', + false, + 'show_create_text_file()', [ - 'title' => __('Create text'), - 'class' => 'invert_filter', - ] + 'class' => 'margin-right-2 invert_filter secondary', + 'icon' => 'create_file', + ], + true, + false ); - echo ''; } - echo ""; - echo html_print_image( - 'images/upload_file.png', - true, + $buttons[] = html_print_button( + __('Upload file/s'), + 'upload_file', + false, + 'show_upload_file()', [ - 'title' => __('Upload file/s'), - 'class' => 'invert_filter', - ] + 'class' => 'margin-right-2 invert_filter secondary', + 'icon' => 'upload_file', + ], + true, + false ); - echo ''; // Show Modal Real Path $modal_real_path = "
Real path to plugin execution is:
@@ -997,6 +1003,11 @@ function filemanager_file_explorer( } html_print_table($table); + + html_print_action_buttons( + implode('', $buttons), + ['type' => 'form_action'] + ); } diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 20841bf26a..6eb91b7afd 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -440,17 +440,17 @@ function groups_give_disabled_group($id_group) */ function groups_get_icon($id_group) { - if ($id_group == 0) { - return 'world'; + if ((int) $id_group === 0) { + $icon = 'unknown@groups.svg'; } else { $icon = (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group); - if ($icon == '') { - $icon = 'without_group'; + if (empty($icon) === true) { + $icon = 'unknown@groups.svg'; } - - return $icon; } + + return $icon; } @@ -2029,7 +2029,7 @@ function group_get_data( } $stats_by_group = []; - if (!empty($data_stats)) { + if (empty($data_stats) === false) { foreach ($data_stats as $value) { $group_id = (int) $value['id_grupo']; @@ -2045,47 +2045,47 @@ function group_get_data( $stats_by_group[$group_id] = $stats; } - if (!empty($stats_by_group)) { - if (!empty($data_stats_unknown)) { + if (empty($stats_by_group) === false) { + if (empty($data_stats_unknown) === false) { foreach ($data_stats_unknown as $value) { $group_id = (int) $value['id_grupo']; - if (isset($stats_by_group[$group_id])) { + if (isset($stats_by_group[$group_id]) === true) { $stats_by_group[$group_id]['agents_unknown'] = (int) $value['agents_unknown']; } } } - if (!empty($data_stats_not_init)) { + if (empty($data_stats_not_init) === false) { foreach ($data_stats_not_init as $value) { $group_id = (int) $value['id_grupo']; - if (isset($stats_by_group[$group_id])) { + if (isset($stats_by_group[$group_id]) === true) { $stats_by_group[$group_id]['agents_not_init'] = (int) $value['agents_not_init']; } } } - if (!empty($data_stats_ok)) { + if (empty($data_stats_ok) === false) { foreach ($data_stats_ok as $value) { $group_id = (int) $value['id_grupo']; - if (isset($stats_by_group[$group_id])) { + if (isset($stats_by_group[$group_id]) === true) { $stats_by_group[$group_id]['agents_ok'] = (int) $value['agents_ok']; } } } - if (!empty($data_stats_warning)) { + if (empty($data_stats_warning) === false) { foreach ($data_stats_warning as $value) { $group_id = (int) $value['id_grupo']; - if (isset($stats_by_group[$group_id])) { + if (isset($stats_by_group[$group_id]) === true) { $stats_by_group[$group_id]['agents_warning'] = (int) $value['agents_warning']; } } } - if (!empty($data_stats_critical)) { + if (empty($data_stats_critical) === false) { foreach ($data_stats_critical as $value) { $group_id = (int) $value['id_grupo']; - if (isset($stats_by_group[$group_id])) { + if (isset($stats_by_group[$group_id]) === true) { $stats_by_group[$group_id]['agents_critical'] = (int) $value['agents_critical']; } } @@ -2097,18 +2097,18 @@ function group_get_data( foreach ($list_groups as $key => $item) { $id = $item['id_grupo']; - if (is_metaconsole()) { - // Agent cache + if (is_metaconsole() === true) { + // Agent cache. $group_stat = []; - if (isset($stats_by_group[$id])) { + if (isset($stats_by_group[$id]) === true) { $group_stat = $stats_by_group[$id]; } $list[$i]['_id_'] = $id; $list[$i]['_name_'] = $item['nombre']; - $list[$i]['_iconImg_'] = html_print_image('images/groups_small/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']); + $list[$i]['_iconImg_'] = html_print_image('images/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']); - if ($mode == 'tree' && !empty($item['parent'])) { + if ($mode === 'tree' && empty($item['parent']) === false) { $list[$i]['_parent_id_'] = $item['parent']; } @@ -2116,7 +2116,7 @@ function group_get_data( $list[$i]['_monitors_alerts_fired_'] = isset($group_stat['alerts_fired']) ? $group_stat['alerts_fired'] : 0; $list[$i]['_total_agents_'] = isset($group_stat['agents_total']) ? $group_stat['agents_total'] : 0; - // This fields are not in database + // This fields are not in database. $list[$i]['_monitors_ok_'] = isset($group_stat['monitors_ok']) ? $group_stat['monitors_ok'] : 0; $list[$i]['_monitors_critical_'] = isset($group_stat['monitors_critical']) ? $group_stat['monitors_critical'] : 0; $list[$i]['_monitors_warning_'] = isset($group_stat['monitors_warning']) ? $group_stat['monitors_warning'] : 0; @@ -2124,7 +2124,7 @@ function group_get_data( $list[$i]['_monitors_not_init_'] = isset($group_stat['monitors_not_init']) ? $group_stat['monitors_not_init'] : 0; $list[$i]['_agents_not_init_'] = isset($group_stat['agents_not_init']) ? $group_stat['agents_not_init'] : 0; - if ($mode == 'tactical' || $mode == 'tree') { + if ($mode === 'tactical' || $mode === 'tree') { $list[$i]['_agents_ok_'] = isset($group_stat['agents_ok']) ? $group_stat['agents_ok'] : 0; $list[$i]['_agents_warning_'] = isset($group_stat['agents_warning']) ? $group_stat['agents_warning'] : 0; $list[$i]['_agents_critical_'] = isset($group_stat['agents_critical']) ? $group_stat['agents_critical'] : 0; @@ -2136,11 +2136,11 @@ function group_get_data( $list[$i]['_total_alerts_'] = $group_stat[0]['alerts']; } - if ($mode == 'tactical') { + if ($mode === 'tactical') { // Get total count of monitors for this group, except disabled. $list[$i]['_monitor_checks_'] = ($list[$i]['_monitors_not_init_'] + $list[$i]['_monitors_unknown_'] + $list[$i]['_monitors_warning_'] + $list[$i]['_monitors_critical_'] + $list[$i]['_monitors_ok_']); - // Calculate not_normal monitors + // Calculate not_normal monitors. $list[$i]['_monitor_not_normal_'] = ($list[$i]['_monitor_checks_'] - $list[$i]['_monitors_ok_']); if ($list[$i]['_monitor_not_normal_'] > 0 && $list[$i]['_monitor_checks_'] > 0) { @@ -2155,7 +2155,7 @@ function group_get_data( $list[$i]['_module_sanity_'] = 100; } - if (isset($list[$i]['_alerts_'])) { + if (isset($list[$i]['_alerts_']) === true) { if ($list[$i]['_monitors_alerts_fired_'] > 0 && $list[$i]['_alerts_'] > 0) { $list[$i]['_alert_level_'] = format_numeric((100 - ($list[$i]['_monitors_alerts_fired_'] / ($list[$i]['_alerts_'] / 100))), 1); } else { @@ -2177,7 +2177,7 @@ function group_get_data( $list[$i]['_server_sanity_'] = format_numeric((100 - $list[$i]['_module_sanity_']), 1); } - if ($returnAllGroup) { + if ($returnAllGroup === true) { $list[0]['_agents_unknown_'] += $list[$i]['_agents_unknown_']; $list[0]['_monitors_alerts_fired_'] += $list[$i]['_monitors_alerts_fired_']; $list[0]['_total_agents_'] += $list[$i]['_total_agents_']; @@ -2188,7 +2188,7 @@ function group_get_data( $list[0]['_monitors_not_init_'] += $list[$i]['_monitors_not_init_']; $list[0]['_agents_not_init_'] += $list[$i]['_agents_not_init_']; - if ($mode == 'tactical' || $mode == 'tree') { + if ($mode === 'tactical' || $mode === 'tree') { $list[0]['_agents_ok_'] += $list[$i]['_agents_ok_']; $list[0]['_agents_warning_'] += $list[$i]['_agents_warning_']; $list[0]['_agents_critical_'] += $list[$i]['_agents_critical_']; @@ -2196,7 +2196,7 @@ function group_get_data( } } - if ($mode == 'group') { + if ($mode === 'group') { if (($list[$i]['_agents_unknown_'] == 0) && ($list[$i]['_monitors_alerts_fired_'] == 0) && ($list[$i]['_total_agents_'] == 0) && ($list[$i]['_monitors_ok_'] == 0) && ($list[$i]['_monitors_critical_'] == 0) && ($list[$i]['_monitors_warning_'] == 0) @@ -2204,7 +2204,7 @@ function group_get_data( unset($list[$i]); } } - } else if (($config['realtimestats'] == 0)) { + } else if (((int) $config['realtimestats'] === 0)) { $group_stat = db_get_all_rows_sql( "SELECT * FROM tgroup_stat, tgrupo @@ -2215,9 +2215,9 @@ function group_get_data( $list[$i]['_id_'] = $id; $list[$i]['_name_'] = $item['nombre']; - $list[$i]['_iconImg_'] = html_print_image('images/groups_small/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']); + $list[$i]['_iconImg_'] = html_print_image('images/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']); - if ($mode == 'tree' && !empty($item['parent'])) { + if ($mode === 'tree' && empty($item['parent']) === false) { $list[$i]['_parent_id_'] = $item['parent']; } @@ -2225,7 +2225,7 @@ function group_get_data( $list[$i]['_monitors_alerts_fired_'] = $group_stat[0]['alerts_fired']; $list[$i]['_total_agents_'] = $group_stat[0]['agents']; - // This fields are not in database + // This fields are not in database. $list[$i]['_monitors_ok_'] = (int) groups_get_normal_monitors($id); $list[$i]['_monitors_critical_'] = (int) groups_get_critical_monitors($id); $list[$i]['_monitors_warning_'] = (int) groups_get_warning_monitors($id); @@ -2318,7 +2318,7 @@ function group_get_data( } else { $list[$i]['_id_'] = $id; $list[$i]['_name_'] = $item['nombre']; - $list[$i]['_iconImg_'] = html_print_image('images/groups_small/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']); + $list[$i]['_iconImg_'] = html_print_image('images/'.groups_get_icon($item['id_grupo']).'.png', true, ['style' => 'vertical-align: middle;']); if ($mode == 'tree' && !empty($item['parent'])) { $list[$i]['_parent_id_'] = $item['parent']; diff --git a/pandora_console/include/functions_groupview.php b/pandora_console/include/functions_groupview.php index a87bea1650..5554343730 100644 --- a/pandora_console/include/functions_groupview.php +++ b/pandora_console/include/functions_groupview.php @@ -176,7 +176,7 @@ function groupview_get_groups_list($id_user=false, $access='AR', $is_not_paginat [] ); - $total_counters = []; + $list = []; foreach ($agents_counters as $id_group => $agent_counter) { $list[$id_group]['_name_'] = $agent_counter['name']; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 44a8289b0d..693a14adb7 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -953,12 +953,12 @@ function html_print_select( } $select2 = 'select2.min'; - if ($config['style'] === 'pandora_black' && !is_metaconsole()) { + if ($config['style'] === 'pandora_black' && is_metaconsole() === false) { $select2 = 'select2_dark.min'; } if (($multiple === false || $select2_multiple_enable === true) && $select2_enable === true) { - if (is_ajax()) { + if (is_ajax() === true) { $output .= '"; + $value = ''; + } + // Attributes specified by function call. $attrs = [ 'name' => 'unnamed', @@ -2611,6 +2648,17 @@ function html_print_input_text_extended( $output .= $function.'/>'; + if ($password === true && $hide_div_eye === false) { + $output .= html_print_div( + [ + 'id' => 'show-hide-'.$id, + 'class' => 'show-hide-pass', + 'onClick' => 'show_hide_password(event, \''.$config['homeurl'].'\')', + ], + true + ); + } + if (!$return) { echo $output; } @@ -2645,10 +2693,11 @@ function html_print_div( 'style', 'class', 'title', + 'onClick', ]; - if (isset($options['hidden'])) { - if (isset($options['style'])) { + if (isset($options['hidden']) === true) { + if (isset($options['style']) === true) { $options['style'] .= 'display:none;'; } else { $options['style'] = 'display:none;'; @@ -2656,7 +2705,7 @@ function html_print_div( } foreach ($attrs as $attribute) { - if (isset($options[$attribute])) { + if (isset($options[$attribute]) === true) { $output .= ' '.$attribute.'="'.io_safe_input_html($options[$attribute]).'"'; } } @@ -2667,7 +2716,7 @@ function html_print_div( $output .= '
'; - if ($return) { + if ($return === true) { return $output; } else { echo $output; @@ -2739,7 +2788,7 @@ function html_print_anchor( $output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url(); foreach ($attrs as $attribute) { - if (isset($options[$attribute])) { + if (isset($options[$attribute]) === true && empty($options[$attribute]) === false) { $output .= ' '.$attribute.'="'.io_safe_input_html($options[$attribute]).'"'; } } @@ -2784,7 +2833,8 @@ function html_print_input_password( $disabled=false, $required=false, $class='', - $autocomplete='off' + $autocomplete='off', + $hide_div_eye=false, ) { if ($maxlength == 0) { $maxlength = 255; @@ -2815,7 +2865,7 @@ function html_print_input_password( } } - return html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete); + return '
'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'
'; } @@ -3138,19 +3188,19 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $ } } - // If metaconsole is activated and image doesn't exists try to search on normal console - if (is_metaconsole()) { + // If metaconsole is activated and image doesn't exists try to search on normal console. + if (is_metaconsole() === true) { if (false === @file_get_contents($src, 0, null, 0, 1)) { $src = '../../'.$src; } } - // path to image + // Path to image. $src = ui_get_full_url($src); $output = ' Type of action-buttons: + * 'form_action' => Fits into form size (fixed size). + * 'data_table' => Fits into browser window. + * $var['class'] => Added class for action-buttons container. + * $var['id'] => Customize Id. By default `principal_action_buttons` (Handled by JS). + * $var['background_mask'] => Boolean. True by default. Set a background for action buttons. + * $var['background_mask_style'] => String. Empty by default. Set a manual style. + * @param boolean $return Return formed string if is true. + * + * @return mixed. + */ +function html_print_action_buttons(mixed $content, array $parameters=[], bool $return=false) +{ + if (is_array($content) === true) { + $content = implode('', $content); + } + + $typeClass = 'fixed_action_buttons '; + switch (($parameters['type'] ?? '')) { + case 'form_action': + case 'fixed_size': + $typeClass .= 'fixed_action_buttons_size'; + break; + + default: + case 'data_table': + // For fill. + break; + } + + if (isset($parameters['background_mask']) === false || $parameters['background_mask'] !== false) { + $backgroundId = 'backgroundMaskId'; + + $content .= html_print_div( + [ + 'id' => $backgroundId, + 'class' => 'action_buttons_background_mask', + 'content' => '', + 'style' => ($parameters['background_mask_style'] ?? ''), + ], + true + ); + } + + // Optional content. + $content .= html_print_div( + [ + 'class' => 'action_buttons_right_content', + 'content' => ($parameters['right_content'] ?? ''), + ], + true + ); + + return html_print_div( + [ + 'id' => ($parameters['id'] ?? 'principal_action_buttons'), + 'class' => 'action-buttons '.$typeClass.' '.($parameters['class'] ?? ''), + 'content' => $content, + 'style' => 'z-index: 1', + ], + $return + ); +} + + /** * Render an submit input button element. * @@ -3343,36 +3464,31 @@ function html_print_input_color($name, $value, $id='', $class=false, $return=fal * @param string $label Input label. * @param string $name Input name. * @param boolean $disabled Whether to disable by default or not. Enabled by default. - * @param array $attributes Additional HTML attributes. + * @param mixed $attributes Additional HTML attributes. * @param boolean $return Whether to return an output string or echo now (optional, echo by default). * * @return string HTML code if return parameter is true. */ function html_print_submit_button($label='OK', $name='', $disabled=false, $attributes='', $return=false) { - if (!$name) { - $name = 'unnamed'; + if (is_string($attributes) === true) { + // Convert Attributes in array for handle in the principal function. + $tmp = []; + $tmp['rawAttributes'] = $attributes; + $attributes = $tmp; } - if (is_array($attributes)) { - $attr_array = $attributes; - $attributes = ''; - foreach ($attr_array as $attribute => $value) { - $attributes .= $attribute.'="'.$value.'" '; - } - } + // Set the button type from here. + $attributes['type'] = 'submit'; - $output = ' $value) { + if ($attribute === 'icon') { + $iconToUse = $value; + } else if ($attribute === 'mode') { + if ($value !== 'link') { + $buttonMode = $value; + } else { + $iconToUse = ''; + } + + $classes .= ' '.$value; + } else if ($attribute === 'type') { + $buttonType = $value; + $classes .= ' '.$value.'Button'; + } else if ($attribute === 'class') { + $classes .= ' '.$value; + } else if ($attribute === 'fixed_id') { + $fixedId = $value; + } else if ($attribute === 'icon_style') { + $iconStyle = $value; + } else if ($attribute === 'span_style') { + $spanStyle .= $value; + } else if ($attribute === 'rawAttributes') { + $buttonType = ($attr_array['type'] ?? 'button'); + $buttonAttributes = $value; + break; + } else { + $attributes .= $attribute.'="'.$value.'" '; + } + } + } else if (empty($attributes) === false && is_string($attributes) === true) { + $buttonAttrutes = explode(' ', $attributes); } - $output .= ' />'; + if (empty($iconToUse) === false || (isset($buttonMode) === true && $buttonMode !== 'onlyIcon')) { + $iconDiv = html_print_div( + [ + 'style' => $iconStyle, + 'class' => sprintf( + 'subIcon %s %s', + $iconToUse, + (empty($buttonMode) === false) ? $buttonMode : '' + ), + ], + true + ); + } else { + $iconDiv = ''; + } - if ($modal && !enterprise_installed()) { + // Defined id. Is usable for span and button. + // TODO. Check if will be proper use button or submit when where appropiate. + $mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name); + + if ($imageButton === false) { + $content = ''.$label.''; + $content .= $iconDiv; + } else { + $content = $iconDiv; + } + + // In case of not selected button type, in this case, will be normal button. + if (isset($buttonType) === false || ($buttonType !== 'button' && $buttonType !== 'submit')) { + $buttonType = 'button'; + $classes .= ' buttonButton'; + } + + if ($disabled === true) { + $classes .= ' disabled_action_button'; + } + + if (empty($buttonAttributes) === true) { + $parameters = []; + $parameters[] = 'class="'.$classes.'"'; + $parameters[] = (empty($name) === false) ? ' name="'.$name.'"' : ''; + $parameters[] = 'id="'.$mainId.'"'; + $parameters[] = (empty($label) === false) ? ' value="'.$label.'"' : ''; + $parameters[] = (empty($script) === false) ? " onClick='".$script."'" : ''; + $parameters[] = ($disabled === true) ? ' disabled' : ''; + $parameters[] = (empty($attributes) === false) ? $attributes : ''; + + $buttonAttributes = implode(' ', $parameters); + } + + $output = sprintf( + '', + $buttonType, + $buttonAttributes, + $content + ); + + if ($modal !== false && enterprise_installed() === false) { $output .= "
"; } - if ($return) { + if ($return === true) { return $output; + } else { + echo $output; } - echo $output; } @@ -3743,7 +3951,13 @@ function html_print_table(&$table, $return=false) $output .= '
'."\n"; } - $output .= ''."\n"; + $tbodyStyle = ''; + + if (empty($table->width) === false) { + $tbodyStyle .= 'width:'.$table->width.';'; + } + + $output .= ''."\n"; if (!empty($table->data)) { $oddeven = 1; foreach ($table->data as $keyrow => $row) { @@ -3891,22 +4105,22 @@ function html_print_radio_button_extended( $output .= ' />'; if (is_array($label)) { - if (!empty($label)) { - $output .= ''."\n"; + if (empty($label) === false) { + $output .= ''."\n"; } } else { if ($label != '') { - $output .= ''."\n"; + $output .= ''."\n"; } } - if ($modal && !enterprise_installed()) { + if ($modal === true && enterprise_installed() === false) { $output .= "
"; } - if ($return) { + if ($return === true) { return $output; } @@ -3937,17 +4151,48 @@ function html_print_radio_button($name, $value, $label='', $checkedvalue='', $re } +/** + * Render a Switch-Radio selector buttons. + * + * @param array $switches Switches for add (html_print_radio_button). + * @param array $attributes Special attributes. + * @param boolean $return Return. False by default. + * + * @return mixed. + */ +function html_print_switch_radio_button(array $switches, array $attributes=[], bool $return=false) +{ + // By default, the content are only the switches added. + $content = implode('', $switches); + // If you want add more content, you can attach in attributes. + if (isset($attributes['add_content']) === true) { + $content .= $attributes['add_content']; + } + + return html_print_div( + [ + 'id' => ($attributes['id'] ?? ''), + 'class' => 'switch_radio_button '.($attributes['class'] ?? ''), + 'content' => $content, + ], + $return + ); +} + + /** * Render a checkbox button input. Extended version, use html_print_checkbox() to simplify. * - * @param string $name Input name. - * @param string $value Input value. - * @param string $checked Set the button to be marked (optional, unmarked by default). - * @param boolean $disabled Disable the button (optional, button enabled by default). - * @param string $script Script to execute when onClick event is triggered (optional). - * @param string $attributes Optional HTML attributes. It's a free string which will be inserted into the HTML tag, use it carefully (optional). - * @param boolean $return Whether to return an output string or echo now (optional, echo by default). - * @param string $id Custom id. + * @param string $name Input name. + * @param string $value Input value. + * @param string $checked Set the button to be marked (optional, unmarked by default). + * @param boolean $disabled Disable the button (optional, button enabled by default). + * @param string $script Script to execute when onClick event is triggered (optional). + * @param string $attributes Optional HTML attributes. It's a free string which will be inserted into the HTML tag, use it carefully (optional). + * @param boolean $return Whether to return an output string or echo now (optional, echo by default). + * @param string $id Custom id. + * @param string $customAttributes Custom Attribute for customized checkbox. + * @param string $customHTML Custom HTML for customized checkbox. * * @return string HTML code if return parameter is true. */ @@ -3959,7 +4204,9 @@ function html_print_checkbox_extended( $script, $attributes, $return=false, - $id='' + $id='', + $customAttributes='', + $customHTML='' ) { static $idcounter = []; @@ -3970,25 +4217,42 @@ function html_print_checkbox_extended( $idcounter[$name] = 0; } + $inputClass = 'custom_checkbox_input'; + $labelClass = 'custom_checkbox'; + + if (is_array($attributes) === true) { + $tmpAttributes = []; + foreach ($attributes as $key => $value) { + switch ($key) { + case 'input_class': + $inputClass .= ' '.$value; + break; + + case 'label_class': + $labelClass .= ' '.$value; + break; + + default: + $tmpAttributes[] = $key.'="'.$value.'"'; + break; + } + } + + $attributes = implode(' ', $tmpAttributes); + } + $id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); - $output = ''; + $output .= ''; + $output .= ''; $output .= "\n"; if ($return === false) { @@ -4002,15 +4266,17 @@ function html_print_checkbox_extended( /** * Render a checkbox button input. * - * @param string $name Input name. - * @param string $value Input value. - * @param string $checked Set the button to be marked (optional, unmarked by default). - * @param boolean $return Whether to return an output string or echo now (optional, echo by default). - * @param boolean $disabled Disable the button (optional, button enabled by default). - * @param string $script Script. - * @param string $disabled_hidden Disabled_hidden. - * @param string $attributes Extra attributes. - * @param string $id Custom ID. + * @param string $name Input name. + * @param string $value Input value. + * @param string $checked Set the button to be marked (optional, unmarked by default). + * @param boolean $return Whether to return an output string or echo now (optional, echo by default). + * @param boolean $disabled Disable the button (optional, button enabled by default). + * @param string $script Script. + * @param string $disabled_hidden Disabled_hidden. + * @param string $attributes Extra attributes. + * @param string $id Custom ID. + * @param string $customAttributes Custom Attribute for customized checkbox. + * @param string $customHTML Custom HTML for customized checkbox. * * @return string HTML code if return parameter is true. */ @@ -4023,7 +4289,9 @@ function html_print_checkbox( $script='', $disabled_hidden=false, $attributes='', - $id='' + $id='', + $customAttributes='', + $customHTML='' ) { $output = html_print_checkbox_extended( $name, @@ -4033,7 +4301,9 @@ function html_print_checkbox( $script, $attributes, true, - $id + $id, + $customAttributes, + $customHTML ); if (!$disabled_hidden) { $output .= html_print_input_hidden($name.'_sent', 1, true); @@ -4413,7 +4683,7 @@ function html_print_header_logo_image(bool $menuCollapsed, bool $return=false) true, [ 'border' => '0', - 'width' => '60', + 'width' => '35', 'alt' => $logo_title, 'class' => 'logo_icon', 'style' => ($menuCollapsed === true) ? 'display:block' : 'display:none', @@ -4442,7 +4712,8 @@ function html_print_header_logo_image(bool $menuCollapsed, bool $return=false) function html_print_input_file($name, $return=false, $options=false) { $output = ''; - + // Start to build the input. + $output .= '
'; + $legend .= '

'.__('Severity').'

'; + $legend .= '
'; + $priorities = get_priorities(); + $half = (count($priorities) / 2); + $count = 0; + foreach ($priorities as $num => $name) { + if ($count == $half) { + $legend .= '
'; + } + + $legend .= ''.$name.''; + $legend .= '
'; + $count++; } - echo '
'; + $legend .= '
'; + $legend .= '

'.__('Status').'

'; + $legend .= ''.__('Validated').''; + $legend .= '
'; + $legend .= ''.__('Not validated').''; + $legend .= '
'; + $legend .= '

'.__('Alert').'

'; + $legend .= ''.__('Alert').''; + $legend .= '
'; + $legend .= ''.__('Not fired').''; + $legend .= '
'; + $legend .= '

'.__('Action').'

'; + $legend .= '
'; + $legend .= html_print_image('images/validate.svg', true, ['class' => 'main_menu_icon invert_filter']).' - '.__('Validate'); + $legend .= '
'; + $legend .= '
'; + $legend .= '
'; + $legend .= html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).' - '.__('Delete'); + $legend .= '
'; + $legend .= '
- - diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index aa45aacc10..f804416a6a 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2580,8 +2580,8 @@ function modules_get_agentmodule_data_for_humans($module) switch ($module['id_tipo_modulo']) { case 15: $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if (($value == '.1.3.6.1.2.1.1.3.0' - || $value == '.1.3.6.1.2.1.25.1.1.0') + if (($value === '.1.3.6.1.2.1.1.3.0' + || $value === '.1.3.6.1.2.1.25.1.1.0') && modules_get_unit_macro($module['data'], $module['unit']) === true ) { if ($module['post_process'] > 0) { @@ -2604,8 +2604,8 @@ function modules_get_agentmodule_data_for_humans($module) switch ($module['id_tipo_modulo']) { case 15: $value = db_get_value('snmp_oid', 'tagente_modulo', 'id_agente_modulo', $module['id_agente_modulo']); - if (($value == '.1.3.6.1.2.1.1.3.0' - || $value == '.1.3.6.1.2.1.25.1.1.0') + if (($value === '.1.3.6.1.2.1.1.3.0' + || $value === '.1.3.6.1.2.1.25.1.1.0') && modules_get_unit_macro($module['data'], $module['unit']) === true ) { if ($module['post_process'] > 0) { @@ -2624,8 +2624,8 @@ function modules_get_agentmodule_data_for_humans($module) } } - // Show units ONLY in numeric data types - if (isset($module['unit'])) { + // Show units ONLY in numeric data types. + if (isset($module['unit']) === true) { $data_macro = modules_get_unit_macro($module['datos'], $module['unit']); if ($data_macro) { $salida = $data_macro; @@ -4133,12 +4133,12 @@ function get_module_realtime_link_graph($module) 'community' => urlencode($module['snmp_community']), 'starting_oid' => urlencode($module['snmp_oid']), 'snmp_browser_version' => urlencode($module['tcp_send']), - 'snmp3_auth_user' => urlencode($module['plugin_user']), - 'snmp3_security_level' => urlencode($module['custom_string_3']), - 'snmp3_auth_method' => urlencode($module['plugin_parameters']), - 'snmp3_auth_pass' => urlencode($module['plugin_pass']), - 'snmp3_privacy_method' => urlencode($module['custom_string_1']), - 'snmp3_privacy_pass' => urlencode($module['custom_string_2']), + 'snmp3_auth_user' => urlencode(($module['plugin_user'] ?? '')), + 'snmp3_security_level' => urlencode(($module['custom_string_3'] ?? '')), + 'snmp3_auth_method' => urlencode(($module['plugin_parameters'] ?? '')), + 'snmp3_auth_pass' => urlencode(($module['plugin_pass'] ?? '')), + 'snmp3_privacy_method' => urlencode(($module['custom_string_1'] ?? '')), + 'snmp3_privacy_pass' => urlencode(($module['custom_string_2'] ?? '')), 'hide_header' => 1, 'rel_path' => '../../', ]; @@ -4161,13 +4161,13 @@ function get_module_realtime_link_graph($module) $link_button = ''; $link_button .= html_print_image( - 'images/realtime_shortcut.png', + 'images/prediction@svg.svg', true, [ 'border' => '0', 'alt' => '', 'title' => __('Realtime SNMP graph'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $link_button .= ''; diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index 5132817588..d656cdeff2 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -191,24 +191,20 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $table->id = 'table_profiles'; $table->width = '100%'; $table->class = 'info_table'; - if (defined('METACONSOLE')) { + if (is_metaconsole() === true) { $table->head_colspan[0] = 0; $table->width = '100%'; $table->class = 'databox_tactical data'; $table->title = $title; } else { - echo '
'; - echo '

'.$title.'

'; + echo '
'; + echo '

'.$title.'

'; } $table->data = []; $table->head = []; $table->align = []; $table->style = []; - if (!defined('METACONSOLE')) { - $table->style['name'] = 'font-weight: bold'; - $table->style['group'] = 'font-weight: bold'; - } $table->head['name'] = __('Profile name'); $table->head['group'] = __('Group'); @@ -217,6 +213,10 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $table->head['actions'] = __('Action'); $table->align['actions'] = 'center'; + $table->headstyle['tags'] = 'width: 33%'; + $table->headstyle['hierarchy'] = 'text-align: center'; + $table->headstyle['actions'] = 'text-align: center'; + if (users_is_admin()) { $result = db_get_all_rows_filter( 'tusuario_perfil', @@ -225,7 +225,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c } else { // Only profiles that can be viewed by the user. $group_um = users_get_groups_UM($config['id_user']); - if (isset($group_um[0])) { + if (isset($group_um[0]) === true) { $group_um_string = implode(',', array_keys(users_get_groups($config['id_user'], 'um', true))); } else { $group_um_string = implode(',', array_keys($group_um)); @@ -238,7 +238,6 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c $id, $group_um_string ); - $result = db_get_all_rows_sql($sql); } @@ -262,26 +261,40 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c } } - foreach ($result as $profile) { - if ($profile['id_grupo'] == -1) { + $lastKey = 0; + foreach ($result as $key => $profile) { + if ((int) $profile['id_grupo'] === -1) { continue; } $data = []; - $data['name'] = ''.profile_get_name($profile['id_perfil']).''; + $profileName = profile_get_name($profile['id_perfil']); + + if (is_management_allowed() === false) { + $data['name'] = $profileName; + } else { + $data['name'] = html_print_anchor( + [ + 'href' => 'index.php?sec2=godmode/users/configure_profile&id='.$profile['id_perfil'], + 'content' => $profileName, + ], + true + ); + } + $data['group'] = ui_print_group_icon($profile['id_grupo'], true); - if (!defined('METACONSOLE')) { - $data['group'] .= ''; + if (is_metaconsole() === false) { + $data['group'] .= ''; } $data['group'] .= ' '.ui_print_truncate_text(groups_get_name($profile['id_grupo'], true), GENERIC_SIZE_TEXT); - if (!defined('METACONSOLE')) { + if (is_metaconsole() === false) { $data['group'] .= ''; } - if (empty($profile['tags'])) { + if (empty($profile['tags']) === true) { $data['tags'] = ''; } else { if (is_array($profile['tags']) === false) { @@ -299,7 +312,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c if ($create_user) { $data['actions'] .= html_print_input_image( 'del', - 'images/cross.png', + 'images/delete.svg', 1, '', true, @@ -310,7 +323,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c ); } else { $data['actions'] = ''; - $data['actions'] .= html_print_input_image('del', 'images/cross.png', 1, ['class' => 'invert_filter'], true); + $data['actions'] .= html_print_input_image('del', 'images/delete.svg', 1, 'width:40px; height: 28px', true); $data['actions'] .= html_print_input_hidden('delete_profile', 1, true); $data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true); $data['actions'] .= html_print_input_hidden('id_user', $id, true); @@ -318,13 +331,23 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c } array_push($table->data, $data); + $lastKey++; + } + + if (is_metaconsole() === false) { + $table->style['last_name'] = 'vertical-align: top'; + $table->style['last_group'] = 'vertical-align: top'; + $table->style['hierarchy'] = 'text-align:center;'; + $table->style['last_hierarchy'] = 'text-align:center;vertical-align: top'; + $table->style['actions'] = 'text-align:center;vertical-align: top'; + $table->style['last_actions'] = 'text-align:center;vertical-align: top'; } $data = []; - $data['name'] = ''; + $data['last_name'] = ''; if (check_acl($config['id_user'], 0, 'PM')) { - $data['name'] .= html_print_select( + $data['last_name'] .= html_print_select( profile_get_profiles(), 'assign_profile', 0, @@ -336,7 +359,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c false ); } else { - $data['name'] .= html_print_select( + $data['last_name'] .= html_print_select( profile_get_profiles( [ 'pandora_management' => '<> 1', @@ -355,7 +378,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c ); } - $data['group'] = html_print_select_groups( + $data['last_group'] = html_print_select_groups( $config['id_user'], 'UM', users_can_manage_group_all('UM'), @@ -370,18 +393,19 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c ); $tags = tags_get_all_tags(); - $data['tags'] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true); + $data['last_tags'] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true, true, 'w100p'); - $data['hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true); + $data['last_hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true); - $data['actions'] = html_print_input_image('add', 'images/add.png', 1, '', true); - $data['actions'] .= html_print_input_hidden('id', $id, true); - $data['actions'] .= html_print_input_hidden('add_profile', 1, true); - $data['actions'] .= ''; + $data['last_actions'] = html_print_input_image('add', 'images/validate.svg', 1, 'width: 40px; height: 28px', true); + $data['last_actions'] .= html_print_input_hidden('id', $id, true); + $data['last_actions'] .= html_print_input_hidden('add_profile', 1, true); + $data['last_actions'] .= ''; array_push($table->data, $data); html_print_table($table, $return); - if (!is_metaconsole()) { + + if (is_metaconsole() === false) { echo '
'; } diff --git a/pandora_console/include/functions_register.php b/pandora_console/include/functions_register.php index 82c94441e7..2fa6f4a8df 100644 --- a/pandora_console/include/functions_register.php +++ b/pandora_console/include/functions_register.php @@ -179,7 +179,7 @@ function config_wiz_modal( __('Cancel'), 'cancel', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub cancel submit-cancel w100px"', + ['icon' => 'cancel'], true ); $output .= '
'; @@ -188,7 +188,7 @@ function config_wiz_modal( __('Continue'), 'register-next', false, - 'class="ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next w100px"', + ['icon' => 'next'], true ); $output .= ''; @@ -287,7 +287,7 @@ function show_configuration_wizard() { // CLICK EVENTS: Cancel and Registration - $("#submit-cancel").click (function (e) { + $("#button-cancel").click (function (e) { e.preventDefault(); $("#wiz_ensure_cancel").dialog({ buttons: [ @@ -320,7 +320,7 @@ function show_configuration_wizard() { $("#wiz_ensure_cancel").dialog('open'); }); - $("#submit-register-next").click (function () { + $("#button-register-next").click (function () { // All fields are required. if ($("#text-email").val() == '') { $("#all-required").show(); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index c17745da8b..710bae4c82 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11986,7 +11986,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru $table_ind->data[] = $tdata; $tdata[0] = '
- '.__('Module sanity').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).''.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).'
'; + '.__('Module sanityX').ui_print_help_tip(sprintf(__('%d Not inited monitors'), (int) $data['monitor_not_init']), true).''.progress_bar($data['module_sanity'], $width, $height, $data['module_sanity'].'% '.__('of total modules inited'), 0).''; $table_ind->rowclass[] = ''; $table_ind->data[] = $tdata; @@ -12052,7 +12052,7 @@ function reporting_get_stats_alerts($data, $links=false) $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[0] = html_print_image('images/alert@svg.svg', true, ['title' => __('Defined alerts'), 'class' => 'main_menu_icon invert_filter'], false, false, false, true); $tdata[1] = $data['monitor_alerts'] <= 0 ? '-' : $data['monitor_alerts']; $tdata[1] = ''.$tdata[1].''; @@ -12063,10 +12063,19 @@ function reporting_get_stats_alerts($data, $links=false) */ if ($data['monitor_alerts'] > $data['total_agents'] && !enterprise_installed()) { - $tdata[2] = "
"; + $tdata[2] = "
"; } - $tdata[3] = html_print_image( + $tdata[3] = html_print_div( + [ + 'title' => __('Fired alerts'), + 'style' => 'background-color: '.COL_CRITICAL, + 'class' => 'alert_background_state main_menu_icon invert_filter', + ], + true + ); + /* + html_print_image( 'images/bell_error.png', true, [ @@ -12077,7 +12086,7 @@ function reporting_get_stats_alerts($data, $links=false) false, false, true - ); + );*/ $tdata[4] = $data['monitor_alerts_fired'] <= 0 ? '-' : $data['monitor_alerts_fired']; $tdata[4] = ''.$tdata[4].''; $table_al->rowclass[] = ''; @@ -12128,29 +12137,29 @@ function reporting_get_stats_modules_status($data, $graph_width=250, $graph_heig $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[0] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_CRITICAL, 'title' => __('Monitor critical')], 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[2] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_WARNING_DARK, 'title' => __('Monitor warning')], 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[0] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_NORMAL, 'title' => __('Monitor normal')], 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[2] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_UNKNOWN, 'title' => __('Monitor unknown')], 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[0] = html_print_div(['class' => 'main_menu_icon module_background_state', 'style' => 'background-color: '.COL_NOTINIT, 'title' => __('Monitor not init')], true); $tdata[1] = $data['monitor_not_init'] <= 0 ? '-' : $data['monitor_not_init']; $tdata[1] = ''.$tdata[1].''; @@ -12209,7 +12218,7 @@ function reporting_get_stats_agents_monitors($data) $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[0] = html_print_image('images/agents@svg.svg', true, ['title' => __('Total agents'), 'class' => 'invert_filter main_menu_icon'], false, false, false, true); $tdata[1] = $data['total_agents'] <= 0 ? '-' : $data['total_agents']; $tdata[1] = ''.$tdata[1].''; @@ -12220,10 +12229,10 @@ function reporting_get_stats_agents_monitors($data) */ if ($data['total_agents'] > 500 && !enterprise_installed()) { - $tdata[2] = "
"; + $tdata[2] = "
"; } - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Monitor checks'), 'class' => 'invert_filter'], false, false, false, true); + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Monitor checks'), 'class' => 'main_menu_icon invert_filter'], false, false, false, true); $tdata[4] = $data['monitor_total'] <= 0 ? '-' : $data['monitor_total']; $tdata[4] = ''.$tdata[4].''; @@ -12234,7 +12243,7 @@ function reporting_get_stats_agents_monitors($data) */ if ($data['total_agents']) { if (($data['monitor_total'] / $data['total_agents'] > 100) && !enterprise_installed()) { - $tdata[5] = "
"; + $tdata[5] = "
"; } } @@ -12264,7 +12273,7 @@ function reporting_get_stats_users($data) $table_us = html_get_predefined_table(); $tdata = []; - $tdata[0] = html_print_image('images/user.png', true, ['title' => __('Defined users'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/user.svg', true, ['title' => __('Defined users'), 'class' => 'main_menu_icon invert_filter']); $user_is_admin = users_is_admin(); $users = []; @@ -14540,10 +14549,10 @@ function reporting_get_stats_servers() $table_srv->style[1] = $table_srv->style[3] = 'text-align: left; padding: 5px;'; $tdata = []; - $tdata[0] = html_print_image('images/module.png', true, ['title' => __('Total running modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/modules@svg.svg', true, ['title' => __('Total running modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_modules']).''; $tdata[2] = ''.format_numeric($server_performance['total_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -14555,25 +14564,25 @@ function reporting_get_stats_servers() $table_srv->data[] = $tdata; $tdata = []; - $tdata[0] = html_print_image('images/database.png', true, ['title' => __('Local modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/data-server@svg.svg', true, ['title' => __('Local modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_local_modules']).''; $tdata[2] = ''.format_numeric($server_performance['local_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; if (isset($server_performance['total_network_modules'])) { $tdata = []; - $tdata[0] = html_print_image('images/network.png', true, ['title' => __('Network modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/network@svg.svg', true, ['title' => __('Network modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_network_modules']).''; $tdata[2] = ''.format_numeric($server_performance['network_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; if ($server_performance['total_remote_modules'] > 10000 && !enterprise_installed()) { - $tdata[4] = "
"; + $tdata[4] = "
"; } else { $tdata[4] = ' '; } @@ -14584,11 +14593,11 @@ function reporting_get_stats_servers() if (isset($server_performance['total_plugin_modules'])) { $tdata = []; - $tdata[0] = html_print_image('images/plugin.png', true, ['title' => __('Plugin modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/plugins@svg.svg', true, ['title' => __('Plugin modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_plugin_modules']).''; $tdata[2] = ''.format_numeric($server_performance['plugin_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -14596,11 +14605,11 @@ function reporting_get_stats_servers() if (isset($server_performance['total_prediction_modules'])) { $tdata = []; - $tdata[0] = html_print_image('images/chart_bar.png', true, ['title' => __('Prediction modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/prediction@svg.svg', true, ['title' => __('Prediction modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_prediction_modules']).''; $tdata[2] = ''.format_numeric($server_performance['prediction_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -14608,11 +14617,11 @@ function reporting_get_stats_servers() if (isset($server_performance['total_wmi_modules'])) { $tdata = []; - $tdata[0] = html_print_image('images/wmi.png', true, ['title' => __('WMI modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/WMI@svg.svg', true, ['title' => __('WMI modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_wmi_modules']).''; $tdata[2] = ''.format_numeric($server_performance['wmi_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -14620,11 +14629,11 @@ function reporting_get_stats_servers() if (isset($server_performance['total_web_modules'])) { $tdata = []; - $tdata[0] = html_print_image('images/world.png', true, ['title' => __('Web modules'), 'class' => 'invert_filter']); + $tdata[0] = html_print_image('images/web-analisys-data@svg.svg', true, ['title' => __('Web modules'), 'class' => 'main_menu_icon invert_filter']); $tdata[1] = ''.format_numeric($server_performance['total_web_modules']).''; $tdata[2] = ''.format_numeric($server_performance['web_modules_rate'], 2).''; - $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec '; + $tdata[3] = html_print_image('images/modules@svg.svg', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'main_menu_icon invert_filter']).'/sec '; $table_srv->rowclass[] = ''; $table_srv->data[] = $tdata; @@ -14638,17 +14647,17 @@ function reporting_get_stats_servers() $tdata = []; $tdata[0] = html_print_image( - 'images/lightning_go.png', + 'images/event.svg', true, [ 'title' => __('Total events'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $tdata[1] = ''.html_print_image('images/spinner.gif', true).''; if (isset($system_events) && $system_events > 50000 && !enterprise_installed()) { - $tdata[2] = "
"; + $tdata[2] = "
"; } else { $tdata[3] = ' '; } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 8d709a1003..1f86ef8f0d 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -5763,7 +5763,7 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1 $agent_data = []; $agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]); - $agent_data[1] = "".format_numeric($data['agent_ok']).''; + $agent_data[1] = "".format_numeric($data['agent_ok']).''; $agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]); $agent_data[3] = "".format_numeric($data['agent_unknown']).''; @@ -5883,7 +5883,7 @@ function reporting_get_events($data, $links=false) $table_events->data[0][1] = html_print_image('images/module_warning.png', true, ['title' => __('Warning events')]); $table_events->data[0][1] .= '   '."".format_numeric($data['warning']).''; $table_events->data[0][2] = html_print_image('images/module_ok.png', true, ['title' => __('OK events')]); - $table_events->data[0][2] .= '   '."".format_numeric($data['normal']).''; + $table_events->data[0][2] .= '   '."".format_numeric($data['normal']).''; $table_events->data[0][3] = html_print_image('images/module_unknown.png', true, ['title' => __('Unknown events')]); $table_events->data[0][3] .= '   '."".format_numeric($data['unknown']).''; } diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 0d39f5b916..41356e9455 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -1059,7 +1059,7 @@ function get_table_custom_macros_report($data) $table = new StdClass(); $table->data = []; $table->width = '100%'; - $table->class = 'databox data fullwidth'; + $table->class = 'info_table'; $table->id = 'table-macros-definition'; $table->rowclass = []; diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 3f9fe1a6b2..649df85725 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -550,11 +550,11 @@ function servers_get_info($id_server=-1) switch ($server['server_type']) { case SERVER_TYPE_DATA: $server['img'] = html_print_image( - 'images/database.png', + 'images/data-server@svg.svg', true, [ 'title' => __('Data server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'data'; @@ -563,11 +563,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_NETWORK: $server['img'] = html_print_image( - 'images/network.png', + 'images/network-server@os.svg', true, [ 'title' => __('Network server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'network'; @@ -576,11 +576,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_SNMP: $server['img'] = html_print_image( - 'images/snmp.png', + 'images/snmp-trap@svg.svg', true, [ 'title' => __('SNMP Trap server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'snmp'; @@ -589,11 +589,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_DISCOVERY: $server['img'] = html_print_image( - 'images/recon.png', + 'images/rrs@svg.svg', true, [ 'title' => __('Discovery server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'recon'; @@ -602,11 +602,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_PLUGIN: $server['img'] = html_print_image( - 'images/plugin.png', + 'images/plugins@svg.svg', true, [ 'title' => __('Plugin server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'plugin'; @@ -615,11 +615,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_PREDICTION: $server['img'] = html_print_image( - 'images/chart_bar.png', + 'images/prediction@svg.svg', true, [ 'title' => __('Prediction server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'prediction'; @@ -628,11 +628,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_WMI: $server['img'] = html_print_image( - 'images/wmi.png', + 'images/WMI@svg.svg', true, [ 'title' => __('WMI server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'wmi'; @@ -641,11 +641,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_EXPORT: $server['img'] = html_print_image( - 'images/server_export.png', + 'images/server-export@svg.svg', true, [ 'title' => __('Export server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'export'; @@ -654,11 +654,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_INVENTORY: $server['img'] = html_print_image( - 'images/page_white_text.png', + 'images/hardware-software-component@svg.svg', true, [ 'title' => __('Inventory server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'inventory'; @@ -667,11 +667,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_WEB: $server['img'] = html_print_image( - 'images/world.png', + 'images/server-web@svg.svg', true, [ 'title' => __('Web server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'web'; @@ -680,11 +680,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_EVENT: $server['img'] = html_print_image( - 'images/lightning_go.png', + 'images/server-events@svg.svg', true, [ 'title' => __('Event server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'event'; @@ -693,11 +693,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_CORRELATION: $server['img'] = html_print_image( - 'images/lightning_go.png', + 'images/server-events@svg.svg', true, [ 'title' => __('Correlation server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'correlation'; @@ -706,11 +706,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_ENTERPRISE_ICMP: $server['img'] = html_print_image( - 'images/network.png', + 'images/network@svg.svg', true, [ 'title' => __('Enterprise ICMP server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'enterprise icmp'; @@ -719,11 +719,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_ENTERPRISE_SNMP: $server['img'] = html_print_image( - 'images/network.png', + 'images/network@svg.svg', true, [ 'title' => __('Enterprise SNMP server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'enterprise snmp'; @@ -732,11 +732,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_ENTERPRISE_SATELLITE: $server['img'] = html_print_image( - 'images/satellite.png', + 'images/satellite@os.svg', true, [ 'title' => __('Enterprise Satellite server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'enterprise satellite'; @@ -745,11 +745,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_ENTERPRISE_TRANSACTIONAL: $server['img'] = html_print_image( - 'images/transactional_map.png', + 'images/server-transactions@svg.svg', true, [ 'title' => __('Enterprise Transactional server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'enterprise transactional'; @@ -758,11 +758,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_MAINFRAME: $server['img'] = html_print_image( - 'images/mainframe.png', + 'images/mainframe@os.svg', true, [ 'title' => __('Mainframe server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'mainframe'; @@ -775,7 +775,7 @@ function servers_get_info($id_server=-1) true, [ 'title' => __('Sync server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'sync'; @@ -784,11 +784,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_WUX: $server['img'] = html_print_image( - 'images/icono-wux.png', + 'images/wux@svg.svg', true, [ 'title' => __('Wux server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'wux'; @@ -797,11 +797,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_SYSLOG: $server['img'] = html_print_image( - 'images/syslog.png', + 'images/logs@svg.svg', true, [ 'title' => __('Log server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'syslog'; @@ -810,11 +810,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_NCM: $server['img'] = html_print_image( - 'images/book_edit.png', + 'images/custom-input@svg.svg', true, [ 'title' => __('NCM server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'ncm'; @@ -827,7 +827,7 @@ function servers_get_info($id_server=-1) true, [ 'title' => __('Autoprovision server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'autoprovision'; @@ -836,11 +836,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_MIGRATION: $server['img'] = html_print_image( - 'images/migration.png', + 'images/server-export@svg.svg', true, [ 'title' => __('Migration server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'migration'; @@ -849,11 +849,11 @@ function servers_get_info($id_server=-1) case SERVER_TYPE_ALERT: $server['img'] = html_print_image( - 'images/alerts_extern.png', + 'images/alert@svg.svg', true, [ 'title' => __('Alert server'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $server['type'] = 'alert'; @@ -1152,108 +1152,6 @@ function servers_check_remote_config($server_name) } -/** - * Return a string containing image tag for a given target id (server). - * TODO: Make this print_servertype_icon and move to functions_ui.php. - * Make XHTML compatible. Make string translatable. - * - * @param integer $id Server type id. - * - * @deprecated Use print_servertype_icon instead. - * - * @return string Fully formatted IMG HTML tag with icon. - */ -function servers_show_type($id) -{ - global $config; - - switch ($id) { - case 1: - $return = html_print_image( - 'images/database.png', - true, - [ - 'title' => get_product_name().' Data server', - 'class' => 'invert_filter', - ] - ); - break; - - case 2: - $return = html_print_image( - 'images/network.png', - true, - [ - 'title' => get_product_name().' Network server', - 'class' => 'invert_filter', - ] - ); - break; - - case 4: - $return = html_print_image( - 'images/plugin.png', - true, - [ - 'title' => get_product_name().' Plugin server', - 'class' => 'invert_filter', - ] - ); - break; - - case 5: - $return = html_print_image( - 'images/chart_bar.png', - true, - [ - 'title' => get_product_name().' Prediction server', - 'class' => 'invert_filter', - ] - ); - break; - - case 6: - $return = html_print_image( - 'images/wmi.png', - true, - [ - 'title' => get_product_name().' WMI server', - 'class' => 'invert_filter', - ] - ); - break; - - case 7: - $return = html_print_image( - 'images/server_web.png', - true, - [ - 'title' => get_product_name().' WEB server', - 'class' => 'invert_filter', - ] - ); - break; - - case 8: - $return = html_print_image( - 'images/module-wux.png', - true, - [ - 'title' => get_product_name().' WUX server', - 'class' => 'invert_filter', - ] - ); - break; - - default: - $return = '--'; - break; - } - - return $return; -} - - /** * Get the numbers of servers up. * diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index b97f6cc313..be9ac48424 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -690,76 +690,92 @@ function snmp_browser_print_container( global $config; $snmp_version = get_parameter('snmp_browser_version', '2c'); + // Target selection. $table = new stdClass(); $table->width = '100%'; - $table->class = 'databox filters'; + $table->class = 'filter-table-adv'; $table->size = []; $table->data = []; $table->size[0] = '30%'; + $table->size[1] = '30%'; + $table->size[2] = '30%'; - $table->data[0][0] = '
'.__('Target IP').'   '; - $table->data[0][0] .= html_print_input( - [ - 'type' => 'text', - 'name' => 'target_ip', - 'value' => get_parameter('target_ip', ''), - 'required' => true, - 'size' => 25, - 'maxlength' => 0, - 'return' => true, - ] - ); - $table->data[0][0] .= '  '.__('Port').'  '; - $table->data[0][0] .= html_print_input( - [ - 'type' => 'number', - 'name' => 'target_port', - 'id' => 'target_port', - 'value' => get_parameter('target_port', 161), - 'required' => true, - 'return' => true, - ] - ); - $table->data[0][0] .= '
'; - - $table->data[0][1] = ''.__('Community').'   '; - $table->data[0][1] .= html_print_input_text( - 'community', - get_parameter('community', ''), - '', - 25, - 0, - true - ); - $table->data[0][2] = ''.__('Starting OID').'   '; - $table->data[0][2] .= html_print_input_text( - 'starting_oid', - get_parameter('starting_oid', '.1.3.6.1.2.1.2.2'), - '', - 25, - 0, - true + $table->data[0][0] = html_print_label_input_block( + __('Target IP'), + html_print_input( + [ + 'type' => 'text', + 'name' => 'target_ip', + 'value' => get_parameter('target_ip', ''), + 'required' => true, + 'size' => 25, + 'maxlength' => 0, + 'return' => true, + ] + ) ); - $table->data[1][0] = ''.__('Version').'   '; - $table->data[1][0] .= html_print_select( - [ - '1' => 'v. 1', - '2' => 'v. 2', - '2c' => 'v. 2c', - '3' => 'v. 3', - ], - 'snmp_browser_version', - get_parameter('snmp_browser_version', '2c'), - 'checkSNMPVersion();', - '', - '', - true, - false, - false, - '' + $table->data[0][1] .= html_print_label_input_block( + __('Port'), + html_print_input( + [ + 'type' => 'number', + 'name' => 'target_port', + 'id' => 'target_port', + 'value' => get_parameter('target_port', 161), + 'required' => true, + 'return' => true, + ] + ) + ); + + $table->data[0][2] = html_print_label_input_block( + __('Community'), + html_print_input_text( + 'community', + get_parameter('community', ''), + '', + 25, + 0, + true + ) + ); + + $table->data[1][0] = html_print_label_input_block( + __('Starting OID'), + html_print_input_text( + 'starting_oid', + get_parameter('starting_oid', '.1.3.6.1.2.1.2.2'), + '', + 25, + 0, + true + ) + ); + + $table->data[1][1] = html_print_label_input_block( + __('Version'), + html_print_select( + [ + '1' => 'v. 1', + '2' => 'v. 2', + '2c' => 'v. 2c', + '3' => 'v. 3', + ], + 'snmp_browser_version', + get_parameter('snmp_browser_version', '2c'), + 'checkSNMPVersion();', + '', + '', + true, + false, + false, + '', + false, + 'width: 100%', + ) ); $servers_to_exec = []; @@ -782,31 +798,22 @@ function snmp_browser_print_container( } } - $table->data[1][1] = ''; - $table->data[1][1] .= __('Server to execute'); - $table->data[1][1] .= '   '; - $table->data[1][1] .= html_print_select( - $servers_to_exec, - 'server_to_exec', - '', - '', - '', - '', - true - ); - - $table->data[1][2] = html_print_input( - [ - 'type' => 'submit', - 'label' => __('Browse'), - 'name' => 'browse', - 'disabled' => false, - 'script' => 'snmpBrowse()', - 'attributes' => 'class="sub search mrgn_top_0px"', - 'return' => true, - ], - 'div', - true + $table->data[1][2] = html_print_label_input_block( + __('Server to execute'), + html_print_select( + $servers_to_exec, + 'server_to_exec', + '', + '', + '', + '', + true, + false, + false, + '', + false, + 'width: 100%', + ) ); // SNMP v3 options. @@ -819,87 +826,159 @@ function snmp_browser_print_container( $table3 = new stdClass(); $table3->width = '100%'; + $table3->class = 'filter-table-adv'; - $table3->valign[0] = ''; - $table3->valign[1] = ''; + $table3->size[0] = '30%'; + $table3->size[1] = '30%'; + $table3->size[2] = '30%'; - $table3->data[2][1] = ''.__('Auth user').''; - $table3->data[2][2] = html_print_input_text( - 'snmp3_browser_auth_user', - $snmp3_auth_user, - '', - 15, - 60, - true + $table3->data[0][0] = html_print_label_input_block( + __('Auth user'), + html_print_input_text( + 'snmp3_browser_auth_user', + $snmp3_auth_user, + '', + 15, + 60, + true + ) ); - $table3->data[2][3] = ''.__('Auth password').''; - $table3->data[2][4] = html_print_input_password( - 'snmp3_browser_auth_pass', - $snmp3_auth_pass, - '', - 15, - 60, - true + $table3->data[0][1] = html_print_label_input_block( + __('Auth password'), + '
'.html_print_input_password( + 'snmp3_browser_auth_pass', + $snmp3_auth_pass, + '', + 15, + 60, + true + ).'
' ); - $table3->data[2][4] .= html_print_input_hidden_extended( + $table3->data[0][1] .= html_print_input_hidden_extended( 'active_snmp_v3', 0, 'active_snmp_v3_fsb', true ); - $table3->data[5][0] = ''.__('Privacy method').''; - $table3->data[5][1] = html_print_select( + $table3->data[0][2] = html_print_label_input_block( + __('Privacy method'), + html_print_select( + [ + 'DES' => __('DES'), + 'AES' => __('AES'), + ], + 'snmp3_browser_privacy_method', + $snmp3_privacy_method, + '', + '', + '', + true + ) + ); + + $table3->data[1][0] = html_print_label_input_block( + __('Privacy pass'), + '
'.html_print_input_password( + 'snmp3_browser_privacy_pass', + $snmp3_privacy_pass, + '', + 15, + 60, + true + ).'
' + ); + + $table3->data[1][1] = html_print_label_input_block( + __('Auth method'), + html_print_select( + [ + 'MD5' => __('MD5'), + 'SHA' => __('SHA'), + ], + 'snmp3_browser_auth_method', + $snmp3_auth_method, + '', + '', + '', + true + ) + ); + + $table3->data[1][2] = html_print_label_input_block( + __('Security level'), + html_print_select( + [ + 'noAuthNoPriv' => __('Not auth and not privacy method'), + 'authNoPriv' => __('Auth and not privacy method'), + 'authPriv' => __('Auth and privacy method'), + ], + 'snmp3_browser_security_level', + $snmp3_security_level, + '', + '', + '', + true + ) + ); + + if (isset($snmp_version) === false) { + $snmp_version = null; + } + + if ($snmp_version == 3) { + $table->data[2] = '
'; + } else { + $table->data[2] = ''; + + $searchForm = '
'; + $searchForm .= html_print_table($table, true); + $searchForm .= html_print_div( [ - 'DES' => __('DES'), - 'AES' => __('AES'), + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Execute'), + 'srcbutton', + false, + [ + 'mode' => 'mini', + 'icon' => 'cog', + ], + true + ), ], - 'snmp3_browser_privacy_method', - $snmp3_privacy_method, - '', - '', - '', true ); - $table3->data[5][2] = ''.__('Privacy pass').''; - $table3->data[5][3] = html_print_input_password( - 'snmp3_browser_privacy_pass', - $snmp3_privacy_pass, - '', - 15, - 60, - true - ); + $searchForm .= ''; - $table3->data[6][0] = ''.__('Auth method').''; - $table3->data[6][1] = html_print_select( - [ - 'MD5' => __('MD5'), - 'SHA' => __('SHA'), - ], - 'snmp3_browser_auth_method', - $snmp3_auth_method, + ui_toggle( + $searchForm, + ''.__('Filters').'', + 'filter_form', '', + false, + false, '', - '', - true - ); - $table3->data[6][2] = ''.__('Security level').''; - $table3->data[6][3] = html_print_select( - [ - 'noAuthNoPriv' => __('Not auth and not privacy method'), - 'authNoPriv' => __('Auth and not privacy method'), - 'authPriv' => __('Auth and privacy method'), - ], - 'snmp3_browser_security_level', - $snmp3_security_level, - '', - '', - '', - true + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); // Search tools. @@ -1011,34 +1090,7 @@ function snmp_browser_print_container( $table2->data[0][2] .= ''; $table2->cellstyle[0][2] = 'text-align:center;'; - // This extra div that can be handled by jquery's dialog. - $output = '
'; - $output .= '
'; - $output .= '
'; - $output .= '
'; - $output .= html_print_table($table, true); - $output .= '
'; - - if (isset($snmp_version) === false) { - $snmp_version = null; - } - - if ($snmp_version == 3) { - $output .= '
'; - } else { - $output .= ''; - $output .= '
'; + $output = ''; // SNMP tree container. - $output .= '
'; + $output .= '
+ logo +

'.$product_name.'

'.__('Version').' '.$pandora_version.' - '.(enterprise_installed() ? 'Enterprise' : 'Community').'

'.__('MR version').' MR'.$config['MR'].'

'.__('Build').' '.$build_version.'

'.__('Support expires').' 2023/04/26

'; - if ((bool) check_acl($config['id_user'], 0, 'PM') === true) { - $dialog .= ' -
- - -
- '; + + if (((bool) check_acl($config['id_user'], 0, 'PM') === true) && (is_metaconsole() === false)) { + $dialogButtons = []; + + $dialogButtons[] = html_print_button( + __('Update manager'), + 'update_manager', + false, + 'location.href="'.ui_get_full_url('/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=history', false, false, false).'"', + [ + 'icon' => 'cog', + 'mode' => 'mini secondary', + ], + true + ); + + $dialogButtons[] = html_print_button( + __('System report'), + 'system_report', + false, + 'location.href="'.ui_get_full_url('/index.php?sec=gextensions&sec2=tools/diagnostics', false, false, false).'"', + [ + 'icon' => 'info', + 'mode' => 'mini secondary', + ], + true + ); + + $dialog .= html_print_div( + [ + 'style' => 'flex-direction: row;', + 'class' => 'action-buttons', + 'content' => implode('', $dialogButtons), + ], + true + ); } $dialog .= '
- - - - - - - - - - '; + $messageTable = new stdClass(); + $messageTable->cellpadding = 0; + $messageTable->cellspacing = 0; + $messageTable->id = 'table_'.$id; + $messageTable->class = 'info_box '.$class.' textodialogo'; + $messageTable->styleTable = $force_style; - if (($first_execution) && (!$no_close_bool)) { - $first_execution = false; + $messageTable->rowclass = []; + $messageTable->rowclass[0] = 'title font_16pt text_left'; + $messageTable->rowclass[1] = 'black font_10pt invert_filter'; + $messageTable->colspan[1][0] = 2; - $output .= ' - - '; + $messageTable->data = []; + $messageTable->data[0][0] = ''.$text_title.''; + $messageTable->data[0][1] = $closeButton; + $messageTable->data[1][0] = ''.$text_message.''; + + // JavaScript help vars. + $messageCreated = html_print_table($messageTable, true); + $autocloseTime = ((int) $config['notification_autoclose_time'] * 1000); + + $classes[] = 'info_box_container'; + $classes[] = (($autoclose === true) && ($autocloseTime > 0)) ? ' info_box_autoclose' : ''; + + // This session var is defined in index. + if (isset($_SESSION['info_box_count']) === false) { + $_SESSION['info_box_count'] = 1; + } else { + $_SESSION['info_box_count']++; } - if ($return) { + $position = (20 + ((int) $_SESSION['info_box_count'] * 100)); + + $output = html_print_div( + [ + 'id' => $id, + 'style' => 'top: '.$position.'px;', + 'class' => implode(' ', $classes), + 'content' => $messageCreated, + ], + true + ); + + if ($return === true) { return $output; } else { echo $output; } - - return ''; } @@ -461,15 +505,15 @@ function ui_print_empty_data($message, $attributes='', $return=false, $tag='h3') */ function ui_print_result_message($result, $good='', $bad='', $attributes='', $return=false, $tag='h3') { - if ($good == '' || $good === false) { + if (empty($good) === true || $good === false) { $good = __('Request successfully processed'); } - if ($bad == '' || $bad === false) { + if (empty($bad) === true || $bad === false) { $bad = __('Error processing request'); } - if (empty($result)) { + if (empty($result) === true) { return ui_print_error_message($bad, $attributes, $return, $tag); } else { return ui_print_success_message($good, $attributes, $return, $tag); @@ -516,31 +560,31 @@ function ui_print_timestamp($unixtime, $return=false, $option=[]) // TODO: Add/use a javascript timer for the seconds so it automatically // updates as time passes by. - if (isset($option['html_attr'])) { + if (isset($option['html_attr']) === true) { $attributes = $option['html_attr']; } else { $attributes = ''; } - if (isset($option['tag'])) { + if (isset($option['tag']) === true) { $tag = $option['tag']; } else { $tag = 'span'; } - if (empty($option['style'])) { - $style = 'class="nowrap"'; + if (empty($option['style']) === true) { + $style = 'class="'.($option['class'] ?? 'nowrap').'"'; } else { $style = 'style="'.$option['style'].'"'; } - if (!empty($option['prominent'])) { + if (empty($option['prominent']) === false) { $prominent = $option['prominent']; } else { $prominent = $config['prominent_time']; } - if (!is_numeric($unixtime)) { + if (is_numeric($unixtime) === false) { $unixtime = time_w_fixed_tz($unixtime); } @@ -562,7 +606,7 @@ function ui_print_timestamp($unixtime, $return=false, $option=[]) } else { $title = date($config['date_format'], $unixtime); $units = 'large'; - if (isset($option['units'])) { + if (isset($option['units']) === true) { $units = $option['units']; } @@ -584,11 +628,11 @@ function ui_print_timestamp($unixtime, $return=false, $option=[]) break; } - if ($return) { + if ($return === true) { return $output; + } else { + echo $output; } - - echo $output; } @@ -596,19 +640,20 @@ function ui_print_timestamp($unixtime, $return=false, $option=[]) * Prints a username with real name, link to the user_edit page etc. * * @param string $username The username to render. + * @param boolean $fullname If true, returns the user fullname. * @param boolean $return Whether to return or print. * - * @return string HTML code if return parameter is true. + * @return void|string HTML code if return parameter is true. */ -function ui_print_username($username, $return=false) +function ui_print_username($username, $fullname=false, $return=false) { - $string = ''.get_user_fullname($username).''; - - if ($return) { - return $string; - } - - echo $string; + return html_print_anchor( + [ + 'href' => sprintf('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user=%s', $username), + 'content' => ($fullname === true) ? get_user_fullname($username) : $username, + ], + $return + ); } @@ -644,43 +689,42 @@ function ui_print_tags_warning($return=false) * @param boolean $link Whether the group have link or not. * @param boolean $force_show_image Force show image. * @param boolean $show_as_image Show as image. + * @param string $class Overrides the default class. * * @return string HTML code if return parameter is true. */ -function ui_print_group_icon($id_group, $return=false, $path='groups_small', $style='', $link=true, $force_show_image=false, $show_as_image=false) +function ui_print_group_icon($id_group, $return=false, $path='', $style='', $link=true, $force_show_image=false, $show_as_image=false, $class='') { global $config; - if ($id_group > 0) { - $icon = (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group); - } else { - $icon = 'world'; - } - $output = ''; + $icon = ($id_group > 0) ? (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group) : 'unknown@groups.svg'; + // Don't show link in metaconsole. - if (defined('METACONSOLE')) { + if (is_metaconsole() === true) { $link = false; } - if ($link) { + if ($link === true) { $output = ''; } - if ($config['show_group_name']) { + if ((bool) $config['show_group_name'] === true) { $output .= ''.groups_get_name($id_group, true).' '; } else { - if (empty($icon)) { + if (empty($icon) === true) { $output .= '  '; } else { - $class = 'bot'; - if ($icon === 'transmit') { - $class .= ' invert_filter'; + if (empty($class) === true) { + $class = 'bot'; + if ($icon === 'transmit') { + $class .= ' invert_filter'; + } } $output .= html_print_image( - 'images/'.$path.'/'.$icon.'.png', + 'images/'.$icon, true, [ 'style' => $style, @@ -696,15 +740,15 @@ function ui_print_group_icon($id_group, $return=false, $path='groups_small', $st } } - if ($link) { + if ($link === true) { $output .= ''; } - if (!$return) { + if ($return === false) { echo $output; + } else { + return $output; } - - return $output; } @@ -720,7 +764,7 @@ function ui_print_group_icon($id_group, $return=false, $path='groups_small', $st * * @return string HTML code if return parameter is true. */ -function ui_print_group_icon_path($id_group, $return=false, $path='images/groups_small', $style='', $link=true) +function ui_print_group_icon_path($id_group, $return=false, $path='images', $style='', $link=true) { if ($id_group > 0) { $icon = (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group); @@ -781,7 +825,7 @@ function ui_print_os_icon( $options=false, $big_icons=false ) { - $subfolder = 'os_icons'; + $subfolder = '.'; if ($networkmap) { $subfolder = 'networkmap'; } @@ -790,15 +834,11 @@ function ui_print_os_icon( $subfolder .= '/so_big_icons'; } - if (is_metaconsole()) { - $no_in_meta = false; - } else { - $no_in_meta = true; - } + $no_in_meta = (is_metaconsole() === false); $icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os); $os_name = get_os_name($id_os); - if (empty($icon)) { + if (empty($icon) === true) { if ($only_src) { $output = html_print_image( 'images/'.$subfolder.'/unknown.png', @@ -861,18 +901,18 @@ function ui_print_type_agent_icon( ) { global $config; - if ($id_os == 19) { + if ((int) $id_os === SATELLITE_OS_ID) { // Satellite. $options['title'] = __('Satellite'); - $output = html_print_image('images/satellite.png', true, ['class' => 'invert_filter'], false, false, false, true); - } else if ($remote_contact == $contact && $remote == 0 && $version == '') { + $output = html_print_image('images/satellite@svg.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.png', true, ['class' => 'invert_filter'], false, false, false, true); + $output = html_print_image('images/network-server@svg.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); } else { // Software. $options['title'] = __('Software'); - $output = html_print_image('images/data.png', true, ['class' => 'invert_filter'], false, false, false, true); + $output = html_print_image('images/data-server@svg.svg', true, ['class' => 'main_menu_icon invert_filter'], false, false, false, true); } return $output; @@ -1157,15 +1197,60 @@ function ui_format_alert_row( if (is_metaconsole() === false) { // Force alert execution. - if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) { - if ($alert['force_execution'] == 0) { - $data[$index['force_execution']] = ''.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force'), 'class' => 'invert_filter']).''; + if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) { + if ((int) $alert['force_execution'] === 0) { + $forceTitle = __('Force check'); + $additionUrl = '&force_execution=1'; } else { - $data[$index['force_execution']] = ''.html_print_image('images/refresh.png', true, ['class' => 'invert_filter']).''; + $forceTitle = __('Refresh'); + $additionUrl = ''; } + + $forceExecButtons[] = html_print_button( + $forceTitle, + 'force_execution_'.$alert['id'], + false, + 'window.location.assign(\''.$url.'&id_alert='.$alert['id'].'&refr=60'.$additionUrl.'\');', + [ 'mode' => 'link' ], + true + ); } + + $forceExecButtons[] = html_print_button( + __('View'), + 'view_template_'.$alert['id'], + false, + '', + [ + 'mode' => 'link', + 'class' => 'template_details', + 'href' => 'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'], + ], + true + ); + } else { + $forceExecButtons[] = html_print_button( + __('View'), + 'view_template_'.$alert['id'], + false, + '', + [ + 'mode' => 'link', + 'class' => 'template_details', + 'href' => ui_get_full_url('/', false, false, false).'/ajax.php?page=enterprise/meta/include/ajax/tree_view.ajax&action=get_template_tooltip&id_template='.$template['id'].'&server_name='.$alert['server_data']['server_name'], + ], + true + ); } + $data[$index['force_execution']] = html_print_div( + [ + 'class' => 'table_action_buttons flex', + 'content' => implode('', $forceExecButtons), + ], + true + ); + $data[$index['agent_name']] = $disabledHtmlStart; if ($agent == 0) { $data[$index['module_name']] .= ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[…]', ''); @@ -1182,16 +1267,24 @@ function ui_format_alert_row( // Do not show link if user cannot access node if ((bool) can_user_access_node() === true) { $url = $server['server_url'].'/index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$agente['id_agente']; - $data[$index['agent_name']] .= ''.''.$agente['alias'].''; + $data[$index['agent_name']] .= html_print_anchor( + [ + 'href' => $url, + 'content' => ''.$agente['alias'].'', + ], + true + ); } else { - $data[$index['agent_name']] .= ''.$agente['alias'].''; + $data[$index['agent_name']] .= ''.$agente['alias'].''; } } else { - if ($agent_style !== false) { - $data[$index['agent_name']] .= ' '.$agente['alias'].''; - } else { - $data[$index['agent_name']] .= ' '.$agente['alias'].''; - } + $data[$index['agent_name']] .= html_print_anchor( + [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent, + 'content' => ''.$agente['alias'].'', + ], + true + ); } $data[$index['module_name']] = ui_print_truncate_text(isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name($alert['id_agent_module']), 'module_small', false, true, true, '[…]', ''); @@ -1201,14 +1294,6 @@ function ui_format_alert_row( $data[$index['description']] = ''; - if (is_metaconsole() === true) { - $data[$index['template']] .= ''; - } else { - $data[$index['template']] .= ''; - } - - $data[$index['template']] .= html_print_image('images/zoom.png', true, ['class' => 'invert_filter']); - $data[$index['template']] .= ' '; $actionDefault = db_get_value_sql( 'SELECT id_alert_action FROM talert_templates WHERE id = '.$alert['id_alert_template'] @@ -1418,22 +1503,22 @@ function ui_print_help_icon( $help_id, $return=false, $home_url='', - $image='images/help_green.png', + $image='images/info@svg.svg', $is_relative=false, $id='' ) { global $config; // Do not display the help icon if help is disabled. - if ($config['disable_help']) { + if ((bool) $config['disable_help'] === true) { return ''; } - if (empty($home_url)) { + if (empty($home_url) === true) { $home_url = ''; } - if (defined('METACONSOLE')) { + if (is_metaconsole() === true) { $home_url = '../../'.$home_url; } @@ -1448,7 +1533,7 @@ function ui_print_help_icon( $image, true, [ - 'class' => 'img_help', + 'class' => 'img_help main_menu_icon', 'title' => __('Help'), 'onclick' => "open_help ('".ui_get_full_url($help_handler)."')", 'id' => $id, @@ -2048,25 +2133,26 @@ function ui_pagination( $set_id='' ) { global $config; + ui_require_css_file('tables'); - if (empty($pagination)) { + if (empty($pagination) === true) { $pagination = (int) $config['block_size']; } - if (is_string($offset)) { + if (is_string($offset) === true) { $offset_name = $offset; $offset = (int) get_parameter($offset_name); } - if (empty($offset)) { + if (empty($offset) === true) { $offset = (int) get_parameter($offset_name); } - if (empty($url)) { + if (empty($url) === true) { $url = ui_get_url_refresh([$offset_name => false]); } - if (!empty($set_id)) { + if (empty($set_id) === false) { $set_id = " id = '".$set_id."'"; } @@ -2108,7 +2194,7 @@ function ui_pagination( // Visualize only $block_limit blocks. if ($count <= $pagination) { if ($print_total_items) { - $output = "'; } @@ -1507,6 +1513,9 @@ require 'include/php_to_js_values.php'; ?> diff --git a/pandora_console/operation/agentes/alerts_status.functions.php b/pandora_console/operation/agentes/alerts_status.functions.php index f77b6a4daf..3d6b415bb7 100755 --- a/pandora_console/operation/agentes/alerts_status.functions.php +++ b/pandora_console/operation/agentes/alerts_status.functions.php @@ -63,33 +63,35 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st $table = new StdClass(); $table->width = '100%'; - $table->class = 'databox filters no-border'; - $table->cellpadding = '0'; - $table->cellspacing = '0'; - if (defined('METACONSOLE')) { - $table->class = 'databox filters no-border'; - $table->width = '100%'; - $table->cellpadding = '0'; - $table->cellspacing = '0'; - } - + $table->class = 'filter-table-adv p020'; + $table->size = []; + $table->size[0] = '33%'; + $table->size[1] = '33%'; + $table->size[2] = '33%'; $table->data = []; - $table->style = []; - $table->style[0] = 'font-weight: bold;'; - $table->style[1] = 'font-weight: bold;'; - $table->style[2] = 'font-weight: bold;'; - $table->style[3] = 'font-weight: bold;'; - $table->style[4] = 'font-weight: bold;'; - if (defined('METACONSOLE')) { - $table->style[0] = 'font-weight: bold;'; - $table->style[1] = 'font-weight: bold;'; - $table->style[2] = 'font-weight: bold;'; - $table->style[3] = 'font-weight: bold;'; - $table->style[4] = 'font-weight: bold;'; - } - - $table->data[0][0] = __('Group'); - $table->data[0][1] = html_print_select_groups($config['id_user'], $access, true, 'ag_group', $id_group, '', '', '', true, false, false, '', false, '', false, false, 'id_grupo', $strict_user); + $table->data[0][0] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + $config['id_user'], + $access, + true, + 'ag_group', + $id_group, + '', + '', + '', + true, + false, + false, + '', + false, + '', + false, + false, + 'id_grupo', + $strict_user + ) + ); $alert_status_filter = []; $alert_status_filter['all_enabled'] = __('All (Enabled)'); @@ -102,32 +104,93 @@ function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_st $alert_standby['1'] = __('Standby on'); $alert_standby['0'] = __('Standby off'); - $table->data[0][2] = __('Status'); - $table->data[0][3] = html_print_select($alert_status_filter, 'disabled', $filter, '', '', '', true); - - $table->data[0][4] = __('Tags').ui_print_help_tip(__('Only it is show tags in use.'), true); + $table->data[0][1] = html_print_label_input_block( + __('Status'), + html_print_select( + $alert_status_filter, + 'disabled', + $filter, + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ) + ); $tags = tags_get_user_tags(); - - if (empty($tags)) { - $table->data[0][5] .= html_print_input_text('tags', __('No tags'), '', 20, 40, true, true); + if (empty($tags) === true) { + $callbackTag = html_print_input_text('tags', __('No tags'), '', 20, 40, true, true); } else { - $table->data[0][5] .= html_print_select($tags, 'tag', $tag_filter, '', __('All'), '', true, false, true, '', false, 'width: 150px;'); + $callbackTag = html_print_select( + $tags, + 'tag', + $tag_filter, + '', + __('All'), + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ); } - $table->data[1][0] = __('Free text for search').ui_print_help_tip( - __('Filter by agent name, module name, template name or action name'), - true + $table->data[0][2] = html_print_label_input_block( + __('Tags').ui_print_help_tip(__('Only it is show tags in use.'), true), + $callbackTag ); - $table->data[1][1] = html_print_input_text('free_search', $free_search, '', 20, 40, true); - $table->data[1][2] = __('Standby'); - $table->data[1][3] = html_print_select($alert_standby, 'standby', $filter_standby, '', __('All'), '', true); + $table->data[1][0] = html_print_label_input_block( + __('Free text for search').ui_print_help_tip( + __('Filter by agent name, module name, template name or action name'), + true + ), + html_print_input_text('free_search', $free_search, '', 20, 40, true) + ); + + $table->data[1][1] = html_print_label_input_block( + __('Standby'), + html_print_select( + $alert_standby, + 'standby', + $filter_standby, + '', + __('All'), + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ) + ); - $table->data[1][4] = __('Action'); $alert_action = alerts_get_alert_actions_filter(); - - $table->data[1][5] = html_print_select($alert_action, 'action', $action_filter, '', __('All'), '', true); + $table->data[1][2] = html_print_label_input_block( + __('Action'), + html_print_select( + $alert_action, + 'action', + $action_filter, + '', + __('All'), + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ) + ); $data .= html_print_table($table, true); diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index d547412a29..418e52e8a8 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -184,35 +184,27 @@ if ($idAgent != 0) { $print_agent = true; - if (is_metaconsole() === false) { - // Header. - ui_print_standard_header( - __('Alert detail'), - 'images/op_alerts.png', - false, - '', - false, - [], + // Header. + ui_print_standard_header( + __('Alert detail'), + 'images/op_alerts.png', + false, + '', + false, + [], + [ [ - [ - 'link' => '', - 'label' => __('Monitoring'), - ], - [ - 'link' => '', - 'label' => __('Views'), - ], - ] - ); - } else { - ui_meta_print_header(__('Alerts view')); - } + 'link' => '', + 'label' => __('Monitoring'), + ], + [ + 'link' => '', + 'label' => __('Views'), + ], + ] + ); } - -enterprise_hook('open_meta_frame'); - - $alerts = []; if ($tab != null) { @@ -223,67 +215,77 @@ if ($pure) { $url .= '&pure='.$pure; } -if ($free_search != '') { +if (empty($free_search) === false) { $url .= '&free_search='.$free_search; } -$columns = ['standby']; -$column_names = [ - [ - 'title' => 'Standby', - 'text' => 'S.', - ], -]; +$columns = []; +$column_names = []; -if (enterprise_installed() === true) { +if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) { array_unshift( $column_names, [ - 'title' => 'Policy', - 'text' => 'P.', - ] + 'title' => __('Standby'), + 'text' => __('Standby'), + ], ); $columns = array_merge( - ['policy'], + ['standby'], $columns ); -} -if (is_metaconsole() === false) { - if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) { + if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { array_unshift( $column_names, [ - 'title' => 'Validate', - 'text' => html_print_checkbox('all_validate', 0, false, true, false), - 'class' => 'dt-left', + 'title' => __('Policy'), + 'text' => __('Policy'), ] ); $columns = array_merge( - ['validate'], + ['policy'], $columns ); } - if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) { + if ($print_agent === true) { array_push( $column_names, - [ - 'title' => 'Force execution', - 'text' => 'F.', - ] + ['text' => 'Agent'] ); $columns = array_merge( $columns, - ['force'] + ['agent_name'] ); } } +if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) { + array_push( + $column_names, + ['text' => 'Module'], + ['text' => 'Template'], + ['text' => 'Operation'], + ['text' => 'Last fired'], + ['text' => 'Status'] + ); + + $columns = array_merge( + $columns, + ['agent_module_name'], + ['template_name'], + ['operation'], + ['last_fired'], + ['status'] + ); +} + + if ($print_agent === true) { array_push( $column_names, @@ -296,25 +298,40 @@ if ($print_agent === true) { ); } -array_push( - $column_names, - ['text' => 'Module'], - ['text' => 'Template'], - ['text' => 'Action'], - ['text' => 'Last fired'], - ['text' => 'Status'] -); +if (is_metaconsole() === false) { + if ((bool) check_acl($config['id_user'], $id_group, 'LW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) { + array_unshift( + $column_names, + [ + 'title' => __('Validate'), + 'text' => html_print_checkbox('all_validate', 0, false, true, false), + 'class' => 'dt-left', + 'style' => 'max-width: 5%;', + ] + ); -$columns = array_merge( - $columns, - ['agent_module_name'], - ['template_name'], - ['action'], - ['last_fired'], - ['status'] -); + $columns = array_merge( + ['validate'], + $columns + ); + } + if ((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true) { + array_push( + $column_names, + [ + 'title' => __('Actions'), + 'text' => __('Actions'), + 'style' => 'min-width: 15%;', + ] + ); + $columns = array_merge( + $columns, + ['actions'] + ); + } +} if (is_metaconsole() === true) { $no_sortable_columns = [ @@ -397,7 +414,7 @@ if ($agent_view_page === true) { [ 'id' => 'alerts_status_datatable', 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%;', 'columns' => $columns, 'column_names' => $column_names, 'no_sortable_columns' => $no_sortable_columns, @@ -415,6 +432,7 @@ if ($agent_view_page === true) { 'zeroRecords' => __('No alerts found'), 'emptyTable' => __('No alerts found'), 'search_button_class' => 'sub filter float-right', + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar', 'form' => [ 'html' => printFormFilterAlert( $id_group, @@ -432,57 +450,83 @@ if ($agent_view_page === true) { ); } -if (!is_metaconsole()) { - if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) { - echo '
'; - html_print_submit_button(__('Validate'), 'alert_validate', false, 'class="sub ok"', false); - echo '
'; +if (((bool) check_acl($config['id_user'], $id_group, 'AW') === true || (bool) check_acl($config['id_user'], $id_group, 'LM') === true)) { + if ($agent_view_page === true) { + html_print_div( + [ + 'class' => 'action-buttons pdd_b_10px pdd_r_5px w100p', + 'content' => html_print_submit_button( + __('Validate'), + 'alert_validate', + false, + [ + 'icon' => 'wand', + 'mode' => 'secondary mini', + ], + true + ), + ] + ); + } else { + html_print_action_buttons( + html_print_submit_button( + __('Validate'), + 'alert_validate', + false, + [ 'icon' => 'wand' ], + true + ), + ['type' => 'form_action'] + ); } } - - $html_content = ob_get_clean(); +$html_content = ob_get_clean(); if ($agent_view_page === true) { // Create controlled toggle content. - ui_toggle( - $html_content, - __('Full list of alerts'), - 'status_monitor_agent', - !$alerts_defined, - false, - '', - 'white_table_graph_content no-padding-imp', - 'white_table_graph_content' + html_print_div( + [ + 'class' => 'agent_details_line', + 'content' => ui_toggle( + $html_content, + ''.__('Full list of alerts').'', + 'status_monitor_agent', + !$alerts_defined, + false, + true, + 'box-flat agent_details_col', + 'white-box-content', + 'width_available' + ), + ], ); } else { // Dump entire content. echo $html_content; } - // Strict user hidden. - echo ''; - enterprise_hook('close_meta_frame'); - - - ui_require_css_file('cluetip', 'include/styles/js/'); - ui_require_jquery_file('cluetip'); +ui_require_css_file('cluetip', 'include/styles/js/'); +ui_require_jquery_file('cluetip'); ?> '; -$table_events .= '
'; -$table_events .= html_print_image( - 'images/arrow_down_green.png', +$agent_contact = html_print_div( + [ + 'class' => 'agent_details_header', + 'content' => $agentContactCaption.$buttons_refresh_agent_view, + ], true ); -$table_events .= ''; -$table_events .= __('Events (Last 24h)'); -$table_events .= ''; -$table_events .= '
'; -$table_events .= '
'; -$table_events .= graph_graphic_agentevents( - $id_agente, - 95, - 70, - SECONDS_1DAY, - '', - true, - true, - 500 + +$agent_contact .= html_print_table($table_contact, true); + +$agentDetails = html_print_div( + [ + 'class' => 'box-flat agent_details_col', + 'content' => $table_agent, + ], + true +); + +$agentContact = html_print_div( + [ + 'class' => 'box-flat agent_details_col mrgn_lft_20px', + 'content' => $agent_contact, + ], + true +); + +$agentEventsHeader = html_print_div( + [ + 'class' => 'agent_details_header', + 'content' => ''.__('Events (Last 24h)').'', + ], + true +); + +$agentEventsGraph = html_print_div( + [ + 'class' => 'white-table-graph-content', + 'content' => graph_graphic_agentevents( + $id_agente, + 95, + 70, + SECONDS_1DAY, + '', + true, + true, + 500 + ), + ], + true +); + +$agentEvents = html_print_div( + [ + 'class' => 'box-flat agent_details_col', + 'content' => $agentEventsHeader.$agentEventsGraph, + ], + true ); -$table_events .= '
'; -$table_events .= '
'; /* * EVENTS TABLE END. */ - -$agent_contact = html_print_table($table_contact, true); - -if (empty($table_data->data)) { - $agent_info = ''; +if (isset($data_opcional) === false || isset($data_opcional->data) === false || empty($data_opcional->data) === true) { + $agentAdditionalInfo = ''; } else { - if (count($table_data->data) === 1 && $config['activate_gis'] && $dataPositionAgent === false) { - $agent_info = ''; - } else { - $agent_info = html_print_table($table_data, true); - } + $agentAdditionalInfo = ui_toggle( + html_print_table($data_opcional, true), + ''.__('Agent data').'', + 'status_monitor_agent', + false, + false, + true, + 'box-flat agent_details_col agent_details_toggle agent_details_first_row w100p', + 'mrgn_right_20px', + 'w100p' + ); } -$agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true); - -echo '
-
'.$table_agent.'
-
'.$agent_contact.'
+$agentIncidents = (isset($table_incident) === false) ? '' : html_print_table($table_incident, true); +/* + echo '
+
'.$table_agent.'
+
'.$agent_contact.'
'.$agent_info; +*/ -// Show both graphs, events and access rate. -if ($table_access_rate) { - echo '
'.$table_access_rate.$table_events.'
'; -} else { - echo '
'.$table_events.'
'; +html_print_div( + [ + 'class' => 'agent_details_first_row agent_details_line', + 'content' => $agentDetails.$agentContact, + ] +); + +html_print_div( + [ + 'class' => 'agent_details_line', + 'content' => $agentEvents.$agentAccessRate, + ] +); + +if (empty($agentAdditionalInfo) === false) { + html_print_div( + [ + 'class' => 'agent_details_line', + 'content' => $agentAdditionalInfo, + ] + ); } -echo $agent_incidents; +if (empty($agentIncidents) === false) { + html_print_div( + [ + 'class' => 'agent_details_line', + 'content' => $agentIncidents, + ] + ); +} + + + +/* + // Show both graphs, events and access rate. + if ($table_access_rate) { + echo '
'.$table_access_rate.$table_events.'
'; + } else { + echo '
'.$table_events.'
'; + } + + echo $agent_incidents; +*/ if (isset($table_interface) === true) { ui_toggle( diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index e6f5a01ad6..0d04a3b6f0 100755 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.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 @@ -30,14 +30,14 @@ global $config; // Ajax tooltip to deploy modules's tag info. -if (is_ajax()) { +if (is_ajax() === true) { $get_tag_tooltip = (bool) get_parameter('get_tag_tooltip', 0); $get_relations_tooltip = (bool) get_parameter('get_relations_tooltip', 0); - if ($get_tag_tooltip) { + if ($get_tag_tooltip === true) { $id_agente_modulo = (int) get_parameter('id_agente_modulo'); - if ($id_agente_modulo == false) { + if ($id_agente_modulo === 0) { return; } @@ -80,9 +80,9 @@ if (is_ajax()) { } - if ($get_relations_tooltip) { + if ($get_relations_tooltip === true) { $id_agente_modulo = (int) get_parameter('id_agente_modulo'); - if ($id_agente_modulo == false) { + if ($id_agente_modulo === 0) { return; } @@ -94,7 +94,7 @@ if (is_ajax()) { ]; $relations = modules_get_relations($params); - if (empty($relations)) { + if (empty($relations) === true) { return; } @@ -136,7 +136,7 @@ if (is_ajax()) { return; } -if (!isset($id_agente)) { +if (isset($id_agente) === false) { // This page is included, $id_agente should be passed to it. db_pandora_audit( AUDIT_LOG_HACK_ATTEMPT, @@ -172,30 +172,42 @@ print_form_filter_monitors( $status_hierachy_mode ); -echo '
'; +echo html_print_div( + [ + 'id' => 'module_list', + 'content' => '', + ], + true +); $html_toggle = ob_get_clean(); -ui_toggle( - $html_toggle, - __('List of modules').$help_not_init.ui_print_help_tip( - __('To see the list of modules paginated, enable this option in the Styles Configuration.'), - true - ).reporting_tiny_stats( - $agent, - true, - 'modules', - ':', - true - ), - 'status_monitor_agent', - false, - false, - '', - 'white_table_graph_content no-padding-imp' +html_print_div( + [ + 'class' => 'agent_details_line', + 'content' => ui_toggle( + $html_toggle, + ''.__('List of modules').''.$help_not_init.ui_print_help_tip( + __('To see the list of modules paginated, enable this option in the Styles Configuration.'), + true + ).reporting_tiny_stats( + $agent, + true, + 'modules', + ':', + true, + ), + 'status_monitor_agent', + false, + false, + true, + 'box-flat agent_details_col', + 'white-box-content', + 'width_available' + ), + ], ); - ?> + width = '100%'; $table->id = 'stat_win_form_div'; - $table->style[0] = 'text-align:left;'; - $table->style[1] = 'text-align:left;'; - $table->style[2] = 'text-align:left;font-weight: bold;'; - $table->style[3] = 'text-align:left;'; + $table->style[0] = 'text-align:left;font-weight: bold;font-size:8.5pt;line-height:30pt;'; + $table->style[1] = 'text-align:left;font-weight: bold;line-height:30pt;'; + $table->style[2] = 'text-align:left;font-weight: bold;line-height:30pt;'; + $table->style[3] = 'text-align:left;font-weight: bold;line-height:30pt;'; $table->class = 'table_modal_alternate'; $table->data = []; @@ -446,66 +446,47 @@ ui_print_message_dialog( } $form_table = html_print_table($table, true); - $form_table .= '
'; - $form_table .= html_print_submit_button( - __('Reload'), - 'submit', - false, - 'class="sub upd"', + $form_table .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Reload'), + 'submit', + false, + [ + 'icon' => 'search', + 'mode' => 'secondary mini', + 'class' => 'float-right', + ], + true + ), + ], true ); - $form_table .= '
'; - // Menu. - $menu_form = "
"; - $menu_form .= html_print_input_hidden('id', $id, true); - $menu_form .= html_print_input_hidden('label', $label, true); + echo ''; + html_print_input_hidden('id', $id); + html_print_input_hidden('label', $label); if (empty($server_id) === false) { - $menu_form .= html_print_input_hidden('server', $server_id, true); + html_print_input_hidden('server', $server_id); } - $menu_form .= html_print_input_hidden('histogram', $histogram, true); + html_print_input_hidden('histogram', $histogram); if (isset($_GET['type']) === true) { $type = get_parameter_get('type'); - $menu_form .= html_print_input_hidden('type', $type, true); + html_print_input_hidden('type', $type); } - $menu_form .= '
'; - $menu_form .= '
'; - $menu_form .= html_print_image( - 'images/arrow_down_green.png', - true, - [ - 'class' => 'module_graph_menu_arrow', - 'float' => 'left', - ], - false, - false, - true + ui_toggle( + $form_table, + ''.__('Graph configuration menu').''.ui_print_help_tip( + __('In Pandora FMS, data is stored compressed. The data visualization in database, charts or CSV exported data won\'t match, because is interpreted at runtime. Please check \'Pandora FMS Engineering\' chapter from documentation.'), + true + ) ); - $menu_form .= ''; - $menu_form .= ''.__('Graph configuration menu').''; - $menu_form .= ui_print_help_tip( - __('In Pandora FMS, data is stored compressed. The data visualization in database, charts or CSV exported data won\'t match, because is interpreted at runtime. Please check \'Pandora FMS Engineering\' chapter from documentation.'), - true - ); - $menu_form .= ''; - $menu_form .= '
'; - - $class = 'module_graph_menu_content'; - if ($histogram === false) { - $class .= ' module_graph_menu_content_closed invisible'; - } - - $menu_form .= '
'; - $menu_form .= $form_table; - $menu_form .= '
'; - $menu_form .= '
'; - $menu_form .= '
'; - - echo $menu_form; + echo ''; // Hidden div to forced title. html_print_div( @@ -541,7 +522,7 @@ ui_print_message_dialog( ]; // Graph. - $output = '
'; + $output = '
'; $output .= '
'; $output .= html_print_image('images/spinner_charts.gif', true); $output .= '
'; diff --git a/pandora_console/operation/agentes/status_events.php b/pandora_console/operation/agentes/status_events.php index 8049d52b04..d4c63a8b2c 100755 --- a/pandora_console/operation/agentes/status_events.php +++ b/pandora_console/operation/agentes/status_events.php @@ -21,15 +21,22 @@ if (!isset($id_agente)) { require_once 'include/functions_events.php'; ui_require_css_file('events'); -ui_toggle( - "
".html_print_image('images/spinner.gif', true).'
', - __('Latest events for this agent'), - __('Latest events for this agent'), - '', - false, - false, - '', - 'white_table_graph_content no-padding-imp' + +html_print_div( + [ + 'class' => 'agent_details_line', + 'content' => ui_toggle( + '
'.html_print_image('images/spinner.gif', true).'
', + ''.__('Latest events for this agent').'', + __('Latest events for this agent'), + 'latest_events_agent', + false, + true, + 'box-flat agent_details_col', + 'white-box-content', + 'width_available' + ), + ], ); ?> diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 3988e82d72..775703ef22 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -50,17 +50,19 @@ enterprise_include_once('include/functions_metaconsole.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); -if (! defined('METACONSOLE')) { +$buttons = []; +$subpage = ''; +if (is_metaconsole() === false) { $section = (string) get_parameter('section', 'view'); $buttons['fields'] = [ 'active' => false, 'text' => ''.html_print_image( - 'images/custom_columns.png', + 'images/edit_columns@svg.svg', true, [ 'title' => __('Custom fields'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', 'operation' => true, @@ -69,11 +71,11 @@ if (! defined('METACONSOLE')) { $buttons['view'] = [ 'active' => false, 'text' => ''.html_print_image( - 'images/list.png', + 'images/logs@svg.svg', true, [ 'title' => __('View'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', 'operation' => true, @@ -89,34 +91,36 @@ if (! defined('METACONSOLE')) { $buttons['view']['active'] = true; break; } +} - // Header. - ui_print_standard_header( - __('Monitor detail').$subpage, - 'images/agent.png', - false, - '', - true, - $buttons, +// Header. +ui_print_standard_header( + __('Monitor detail').$subpage, + 'images/agent.png', + false, + '', + true, + $buttons, + [ [ - [ - 'link' => '', - 'label' => __('Monitoring'), - ], - [ - 'link' => '', - 'label' => __('Views'), - ], - ] - ); + 'link' => '', + 'label' => __('Monitoring'), + ], + [ + 'link' => '', + 'label' => __('Views'), + ], + ] +); + +if (is_metaconsole() === false) { if ($section == 'fields') { include_once $config['homedir'].'/godmode/agentes/status_monitor_custom_fields.php'; exit(); } } else { $section = (string) get_parameter('sec', 'estado'); - ui_meta_print_header(__('Monitor view')); } $recursion = get_parameter_switch('recursion', false); @@ -169,9 +173,7 @@ if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== '' $autosearch = true; } -$is_metaconsole = is_metaconsole(); - -if (!$is_metaconsole) { +if (is_metaconsole() === false) { $ag_group = (int) get_parameter('ag_group', 0); } else { $ag_group = get_parameter('ag_group', 0); @@ -193,8 +195,6 @@ if ($id_module) { $ag_freestring = modules_get_agentmodule_agent_alias($id_module); } -enterprise_hook('open_meta_frame'); - // Get Groups and profiles from user. $user_groups = implode(',', array_keys(users_get_groups(false, 'AR', false))); @@ -290,7 +290,7 @@ if ($loaded_filter['id_filter'] > 0) { $all_groups = []; // Agent group selector. -if (!$is_metaconsole) { +if (is_metaconsole() === false) { if ($ag_group > 0 && check_acl($config['id_user'], $ag_group, 'AR')) { if ($recursion) { $all_groups = groups_get_children_ids($ag_group, true); @@ -343,7 +343,7 @@ if (!$is_metaconsole) { } // Module group. -if ($is_metaconsole) { +if (is_metaconsole() === true) { if ($modulegroup != '-1') { $sql_conditions .= sprintf(' AND tagente_modulo.id_module_group '.$not_condition.' IN (%s)', $modulegroup); } @@ -370,7 +370,7 @@ if ($module_option !== 0) { } } -if ($datatype != '') { +if (empty($datatype) === false) { $sql_conditions .= sprintf(' AND ttipo_modulo.id_tipo '.$condition_query.' '.$datatype); } @@ -488,7 +488,7 @@ if (!defined('METACONSOLE')) { } // Get limit_sql depend of the metaconsole or standard mode. -if ($is_metaconsole) { +if (is_metaconsole() === true) { // Offset will be used to get the subset of modules. $inferior_limit = $offset; $superior_limit = ($config['block_size'] + $offset); @@ -503,63 +503,6 @@ if ($is_metaconsole) { $limit_sql = $config['block_size']; } -// End Build SQL sentences. -// -// Start Build Search Form. -// -$table = new StdClass(); -$table->width = '100%'; -$table->cellspacing = 0; -$table->cellpadding = 0; -$table->class = 'databox filters'; -$table->style[0] = 'font-weight: bold;'; -$table->style[1] = 'font-weight: bold;'; -$table->style[2] = 'font-weight: bold;'; -$table->style[3] = 'font-weight: bold;'; -$table->style[4] = 'font-weight: bold;'; - -$table->data[0][0] = __('Group'); -$table->data[0][1] = '
'; -$table->data[0][1] .= html_print_select_groups( - $config['id_user'], - 'AR', - true, - 'ag_group', - $ag_group, - '', - '', - '0', - true, - false, - false, - '', - false, - '', - false, - false, - 'id_grupo', - false, - false, - false, - false, - false, - false, - $not_condition -); - -$table->data[0][1] .= '
'; -$table->data[0][1] .= html_print_input( - [ - 'type' => 'checkbox', - 'name' => 'recursion', - 'return' => true, - 'checked' => ($recursion === true || $recursion === 'true' || $recursion === '1') ? 'checked' : false, - 'value' => 1, - ] -); -$table->data[0][1] .= __('Recursion'); -$table->data[0][1] .= '
'; - $fields = []; $fields[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); $fields[AGENT_MODULE_STATUS_WARNING] = __('Warning'); @@ -569,32 +512,15 @@ $fields[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); // Default. $fields[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); -$table->data[0][2] = __('Monitor status'); -$table->data[0][3] = html_print_select( - $fields, - 'status', - $status, - '', - __($is_none), - -1, - true, - false, - true, - '', - false, - 'width: 150px;' -); - $rows_select = []; -$table->data[0][4] = __('Module group'); $rows_select[0] = __('Not assigned'); -if (!$is_metaconsole) { +if (is_metaconsole() === false) { $rows = db_get_all_rows_sql( 'SELECT * FROM tmodule_group ORDER BY name' ); $rows = io_safe_output($rows); - if (!empty($rows)) { + if (empty($rows) === false) { foreach ($rows as $module_group) { $rows_select[$module_group['id_mg']] = $module_group['name']; } @@ -603,30 +529,12 @@ if (!$is_metaconsole) { $rows_select = modules_get_modulegroups(); } -$table->data[0][5] = html_print_select($rows_select, 'modulegroup', $modulegroup, '', __($is_none), -1, true, false, true, '', false, 'width: 120px;'); - -$table->data[1][0] = __('Module name'); -$table->data[1][1] = html_print_autocomplete_modules( - 'ag_modulename', - $ag_modulename, - false, - true, - '', - [], - true -); - -$table->data[1][2] = __('Search'); -$table->data[1][3] = html_print_input_text('ag_freestring', $ag_freestring, '', 20, 30, true); - -$table->data[1][4] = __('Tags').ui_print_help_tip(__('Only it is show tags in use.'), true); - $tags = []; $tags = tags_get_user_tags(); -if (empty($tags)) { - $table->data[1][5] = __('No tags'); +if (empty($tags) === true) { + $tagsElement = __('No tags'); } else { - $table->data[1][5] = html_print_select( + $tagsElement = html_print_select( $tags, 'tag_filter[]', $tag_filter, @@ -638,16 +546,15 @@ if (empty($tags)) { true, '', false, - 'width: 150px;' + 'width: 100%;' + ); + $tagsElement .= ui_print_input_placeholder( + __('Only it is show tags in use.'), + true ); } -$table2 = new StdClass(); -$table2->width = '100%'; -$table2->class = 'filters'; -$table2->style = []; -$table2->style[0] = 'font-weight: bold;'; -$table2->style[1] = 'font-weight: bold;'; + $network_available = db_get_sql( 'SELECT count(*) @@ -687,60 +594,42 @@ if ($develop_bypass) { $prediction_available = 1; } - - $typemodules = []; $typemodules[1] = __('Data server module'); -if ($network_available || $is_metaconsole) { +if ($network_available || is_metaconsole() === true) { $typemodules[2] = __('Network server module'); } -if ($plugin_available || $is_metaconsole) { +if ($plugin_available || is_metaconsole() === true) { $typemodules[4] = __('Plugin server module'); } -if ($wmi_available || $is_metaconsole) { +if ($wmi_available || is_metaconsole() === true) { $typemodules[6] = __('WMI server module'); } -if ($prediction_available || $is_metaconsole) { +if ($prediction_available || is_metaconsole() === true) { $typemodules[5] = __('Prediction server module'); } if (enterprise_installed()) { $typemodules[7] = __('Web server module'); - if ($wux_available || $is_metaconsole) { + if ($wux_available || is_metaconsole() === true) { $typemodules[8] = __('Wux server module'); } } - -$table2->data[0][0] = ''.__('Server type').''; - -$table2->data[0][1] = html_print_select($typemodules, 'moduletype', $moduletype, '', __($is_none), '', true, false, true, '', false, 'width: 150px;'); - $monitor_options = [ 0 => __('All'), 1 => __('Only enabled'), 2 => __('Only disabled'), ]; -$table2->data[0][2] = ''.__('Show monitors...').''; - -$table2->data[0][3] = html_print_select($monitor_options, 'module_option', $module_option, '', '', '', true, false, true, '', false, 'width: 150px;'); - $min_hours_val = empty($min_hours_status) ? '' : (int) $min_hours_status; -$table2->data[0][4] = ''.__('Min. hours in current status').''; -$table2->data[0][5] = html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true); - -$table2->data[1][0] = 'data[1][0] .= '>'.__('Data type').''; -$table2->data[1][1] .= '
'; - switch ($moduletype) { case 1: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE categoria '.$not_condition.' IN (6,7,8,0,1,2,-1) order by descripcion ' @@ -748,7 +637,7 @@ switch ($moduletype) { break; case 2: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE categoria '.$not_condition.' between 3 and 5 ' @@ -756,7 +645,7 @@ switch ($moduletype) { break; case 4: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE categoria '.$not_condition.' between 0 and 2 ' @@ -764,7 +653,7 @@ switch ($moduletype) { break; case 6: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE categoria '.$not_condition.' between 0 and 2 ' @@ -772,7 +661,7 @@ switch ($moduletype) { break; case 7: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE categoria '.$condition_query.' 9' @@ -780,7 +669,7 @@ switch ($moduletype) { break; case 5: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE categoria '.$condition_query.' 0' @@ -788,7 +677,7 @@ switch ($moduletype) { break; case 8: - $sql = sprintf( + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo WHERE nombre '.$condition_query.' \'web_analysis\'' @@ -796,62 +685,20 @@ switch ($moduletype) { break; case '': - $sql = sprintf( + default: + $sqlModuleType = sprintf( 'SELECT id_tipo, descripcion FROM ttipo_modulo' ); break; - - default: - // Nothing. - break; } -$a = db_get_all_rows_sql($sql); -$table2->data[1][1] .= ''; -$table2->data[1][1] .= '
'; -$check_not_condition = ''; - if ($not_condition !== '') { $check_not_condition = true; +} else { + $check_not_condition = ''; } -$table2->data[1][2] .= __('Not condition').' '.ui_print_help_tip(__('If you check this option, those elements that do NOT meet any of the requirements will be shown'), true); -$table2->data[1][3] = html_print_div( - [ - 'class' => 'w120px mrgn_5px mrgn_lft_0px mrgn_right_0px', - 'content' => html_print_input( - [ - 'type' => 'switch', - 'name' => 'not_condition', - 'return' => false, - 'checked' => ($check_not_condition === true || $check_not_condition === 'true' || $check_not_condition === '1') ? 'checked' : false, - 'value' => 'NOT', - 'id' => 'not_condition_switch', - 'onclick' => 'changeNotConditionStatus(this)', - ] - ), - ], - true -); - $custom_fields = db_get_all_fields_in_table('tagent_custom_fields'); if ($custom_fields === false) { $custom_fields = []; @@ -893,11 +740,212 @@ foreach ($custom_fields as $custom_field) { $div_custom_fields .= '
'; -$filters = '
'; -$table2->colspan[2][0] = 7; -$table2->cellstyle[2][0] = 'padding-left: 10px;'; -$table2->data[2][0] = ui_toggle( +// End Build SQL sentences. +// +// Start Build Search Form. +// +$table = new stdClass(); +$tableFilter = new StdClass(); +$tableFilter->width = '100%'; +$tableFilter->size = []; +$tableFilter->size[0] = '33%'; +$tableFilter->size[1] = '33%'; +$tableFilter->size[2] = '33%'; +$tableFilter->id = 'main_status_monitor_filter'; +$tableFilter->class = 'filter-table-adv'; +// Captions for first line. +$tableFilter->data['first_line'][0] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + $config['id_user'], + 'AR', + true, + 'ag_group', + $ag_group, + '', + '', + '0', + true, + false, + false, + '', + false, + '', + false, + false, + 'id_grupo', + false, + false, + false, + false, + false, + false, + $not_condition + ) +); +$tableFilter->data['first_line'][0] .= html_print_label_input_block( + __('Recursion'), + html_print_checkbox_switch( + 'recursion', + 1, + ($recursion === true || $recursion === 'true' || $recursion === '1') ? 'checked' : false, + true + ), + [ + 'div_class' => 'add-input-reverse', + 'label_class' => 'label-thin', + ] +); + +$tableFilter->data['first_line'][1] = html_print_label_input_block( + __('Module group'), + html_print_select( + $rows_select, + 'modulegroup', + $modulegroup, + '', + __($is_none), + -1, + true, + false, + true, + '', + false, + 'width: 100%;' + ) +); + +$tableFilter->rowspan['first_line'][2] = 3; +$tableFilter->data['first_line'][2] = html_print_label_input_block( + __('Tags'), + $tagsElement +); + +// Inputs for second line. +$tableFilter->data['second_line'][0] = html_print_label_input_block( + __('Monitor status'), + html_print_select( + $fields, + 'status', + $status, + '', + __($is_none), + -1, + true, + false, + true, + '', + false, + 'width: 100%' + ) +); + +$tableFilter->data['second_line'][1] = html_print_label_input_block( + __('Module name'), + html_print_autocomplete_modules( + 'ag_modulename', + $ag_modulename, + false, + true, + '', + [], + true + ) +); + +$tableFilter->data['third_line'][0] = html_print_label_input_block( + __('Search'), + html_print_input_text( + 'ag_freestring', + $ag_freestring, + '', + 40, + 30, + true + ) +); + +// Advanced filter. +$tableAdvancedFilter = new StdClass(); +$tableAdvancedFilter->width = '100%'; +$tableAdvancedFilter->class = 'filters'; +$tableAdvancedFilter->size = []; +$tableAdvancedFilter->size[0] = '33%'; +$tableAdvancedFilter->size[1] = '33%'; +$tableAdvancedFilter->size[2] = '33%'; +$tableAdvancedFilter->data['advancedField_1'][0] = html_print_label_input_block( + __('Server type'), + html_print_select( + $typemodules, + 'moduletype', + $moduletype, + '', + __($is_none), + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ) +); + +$tableAdvancedFilter->data['advancedField_1'][1] = html_print_label_input_block( + __('Show monitors...'), + html_print_select( + $monitor_options, + 'module_option', + $module_option, + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%;' + ) +); + +$tableAdvancedFilter->data['advancedField_1'][2] = html_print_label_input_block( + __('Min. hours in current status'), + html_print_input_text('min_hours_status', $min_hours_val, '', 12, 20, true) +); + +$tableAdvancedFilter->data['advancedField_2'][0] = html_print_label_input_block( + __('Data type'), + html_print_select_from_sql($sqlModuleType, 'datatype', '', '', __('All'), 0, true) +); + +$tableAdvancedFilter->data['advancedField_2'][1] = html_print_label_input_block( + __('Not condition'), + html_print_div( + [ + 'class' => 'mrgn_5px mrgn_lft_0px mrgn_right_0px flex wrap', + 'content' => html_print_input( + [ + 'type' => 'switch', + 'name' => 'not_condition', + 'return' => false, + 'checked' => ($check_not_condition === true || $check_not_condition === 'true' || $check_not_condition === '1') ? 'checked' : false, + 'value' => 'NOT', + 'id' => 'not_condition_switch', + 'onclick' => 'changeNotConditionStatus(this)', + ] + ).ui_print_input_placeholder( + __('If you check this option, those elements that do NOT meet any of the requirements will be shown'), + true + ), + ], + true + ) +); + +$tableAdvancedFilter->colspan[2][0] = 3; +$tableAdvancedFilter->data[2][0] = ui_toggle( $div_custom_fields, __('Agent custom fields'), '', @@ -905,66 +953,83 @@ $table2->data[2][0] = ui_toggle( true, true, '', - 'white-box-content', - 'white_table_graph' + 'white-box-content' ); -$table->colspan[3][0] = 7; -$table->cellstyle[3][0] = 'padding-left: 10px;padding-bottom: 0px;'; -$table->data[3][0] = ui_toggle( +$tableFilter->colspan[3][0] = 3; +$tableFilter->data[3][0] = ui_toggle( html_print_table( - $table2, + $tableAdvancedFilter, true ), - __('Advanced options'), + ''.__('Advanced options').'', '', '', true, true, '', - 'white-box-content', - 'white_table_graph' + 'white-box-content' ); -$table->colspan[4][0] = 2; -$table->cellstyle[4][0] = 'padding-top: 0px;'; -$table->data[4][0] = html_print_button( +$filters = ''; +$filters .= html_print_table($tableFilter, true); +$buttons = html_print_submit_button( + __('Filter'), + 'uptbutton', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true +); + +$buttons .= html_print_button( __('Load filter'), 'load-filter', false, '', - 'class="float-left margin-right-2 sub config"', + [ + 'icon' => 'wand', + 'mode' => 'mini secondary', + 'class' => 'float-left margin-right-2 sub config', + ], true ); -$table->cellstyle[4][0] .= 'padding-top: 0px;'; -$table->data[4][0] .= html_print_button( +$buttons .= html_print_button( __('Manage filter'), 'save-filter', false, '', - 'class="float-left margin-right-2 sub wand"', + [ + 'icon' => 'wand', + 'mode' => 'mini secondary', + 'class' => 'float-left margin-right-2 sub wand', + ], true ); -$table->colspan[4][2] = 5; -$table->cellstyle[4][2] = 'padding-top: 0px;'; -$table->data[4][2] = html_print_submit_button( - __('Show'), - 'uptbutton', - false, - 'class="sub search mgn_tp_0 right"', +$filters .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => $buttons, + ], true ); -$filters .= html_print_table($table, true); $filters .= '
'; - -if (is_metaconsole() === true) { - ui_toggle($filters, __('Show filters'), '', '', false); -} else { - echo $filters; -} +ui_toggle( + $filters, + ''.__('Filters').'', + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' +); unset($table); // End Build Search Form. @@ -1204,15 +1269,15 @@ switch ($sortField) { break; } - - $sql = 'SELECT +$sql = 'SELECT (SELECT GROUP_CONCAT(ttag.name SEPARATOR \',\') FROM ttag WHERE ttag.id_tag IN ( SELECT ttag_module.id_tag FROM ttag_module - WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo)) - AS tags, + WHERE ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo + ) + ) AS tags, tagente_modulo.id_agente_modulo, tagente_modulo.id_modulo, tagente.intervalo AS agent_interval, @@ -1251,15 +1316,15 @@ switch ($sortField) { LIMIT '.$offset.','.$limit_sql; - // We do not show the modules until the user searches with the filter. +// We do not show the modules until the user searches with the filter. if ($autosearch) { - if (! defined('METACONSOLE')) { + if (is_metaconsole() === false) { $result = db_get_all_rows_sql($sql); if ($result === false) { $result = []; } else { - ui_pagination($count, false, $offset, 0, false, 'offset', true); + $tablePagination = ui_pagination($count, false, $offset, 0, true, 'offset', false); } } else { // For each server defined and not disabled. @@ -1276,7 +1341,7 @@ if ($autosearch) { $count_modules = 0; foreach ($servers as $server) { // If connection was good then retrieve all data server. - if (metaconsole_connect($server) == NOERR) { + if (metaconsole_connect($server) === NOERR) { $connection = true; } else { $connection = false; @@ -1284,7 +1349,7 @@ if ($autosearch) { $result_server = db_get_all_rows_sql($sql); - if (!empty($result_server)) { + if (empty($result_server) === false) { // Create HASH login info. $pwd = $server['auth_token']; $auth_serialized = json_decode($pwd, true); @@ -1325,7 +1390,7 @@ if ($autosearch) { } if ($count_modules > $config['block_size']) { - ui_pagination($count_modules, false, $offset); + $tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', false); } // Get number of elements of the pagination. @@ -1333,67 +1398,70 @@ if ($autosearch) { } } -if (($config['dbtype'] == 'oracle') && ($result !== false)) { - for ($i = 0; $i < count($result); $i++) { - unset($result[$i]['rnum']); +// Urls to sort the table. +$url_agent_name = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_type = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_module_name = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_server_type = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_interval = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_status = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_status = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_data = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_timestamp_up = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; +$url_timestamp_down = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; + +$url_agent_name .= '&refr='.$refr.'&datatype='.$datatype.'&moduletype='.$moduletype.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_type .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_module_name .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_server_type .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_interval .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_status .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_status .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_data .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_timestamp_up .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; +$url_timestamp_down .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; + +// Holy god... +$url_agent_name .= '&recursion='.$recursion; +$url_type .= '&recursion='.$recursion; +$url_module_name .= '&recursion='.$recursion; +$url_server_type .= '&recursion='.$recursion; +$url_interval .= '&recursion='.$recursion; +$url_status .= '&recursion='.$recursion; +$url_status .= '&recursion='.$recursion; +$url_data .= '&recursion='.$recursion; +$url_timestamp_up .= '&recursion='.$recursion; +$url_timestamp_down .= '&recursion='.$recursion; + +$url_agent_name .= '&sort_field=agent_alias&sort='; +$url_type .= '&sort_field=type&sort='; +$url_module_name .= '&sort_field=module_name&sort='; +$url_server_type .= '&sort_field=moduletype&sort='; +$url_interval .= '&sort_field=interval&sort='; +$url_status .= '&sort_field=status&sort='; +$url_status .= '&sort_field=last_status_change&sort='; +$url_data .= '&sort_field=data&sort='; +$url_timestamp_up .= '&sort_field=timestamp&sort=up'; +$url_timestamp_down .= '&sort_field=timestamp&sort=down'; + +// Start Build List Result. +if (empty($result) === false) { + if (is_metaconsole() === true) { + html_print_action_buttons( + html_print_div(['style' => 'float:left; height: 55px;', 'class' => 'mrgn_top_15px'], true), + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ] + ); } -} - - // Urls to sort the table. - $url_agent_name = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_type = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_module_name = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_server_type = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_interval = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_status = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_status = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_data = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_timestamp_up = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - $url_timestamp_down = 'index.php?sec='.$section.'&sec2=operation/agentes/status_monitor'; - - $url_agent_name .= '&refr='.$refr.'&datatype='.$datatype.'&moduletype='.$moduletype.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_type .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_module_name .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_server_type .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_interval .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_status .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_status .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_data .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_timestamp_up .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - $url_timestamp_down .= '&datatype='.$datatype.'&moduletype='.$moduletype.'&refr='.$refr.'&modulegroup='.$modulegroup.'&offset='.$offset.'&ag_group='.$ag_group.'&ag_freestring='.$ag_freestring.'&ag_modulename='.$ag_modulename.'&status='.$status.$ag_custom_fields_params; - - // Holy god... - $url_agent_name .= '&recursion='.$recursion; - $url_type .= '&recursion='.$recursion; - $url_module_name .= '&recursion='.$recursion; - $url_server_type .= '&recursion='.$recursion; - $url_interval .= '&recursion='.$recursion; - $url_status .= '&recursion='.$recursion; - $url_status .= '&recursion='.$recursion; - $url_data .= '&recursion='.$recursion; - $url_timestamp_up .= '&recursion='.$recursion; - $url_timestamp_down .= '&recursion='.$recursion; - - - $url_agent_name .= '&sort_field=agent_alias&sort='; - $url_type .= '&sort_field=type&sort='; - $url_module_name .= '&sort_field=module_name&sort='; - $url_server_type .= '&sort_field=moduletype&sort='; - $url_interval .= '&sort_field=interval&sort='; - $url_status .= '&sort_field=status&sort='; - $url_status .= '&sort_field=last_status_change&sort='; - $url_data .= '&sort_field=data&sort='; - $url_timestamp_up .= '&sort_field=timestamp&sort=up'; - $url_timestamp_down .= '&sort_field=timestamp&sort=down'; - - // Start Build List Result. -if (!empty($result)) { $table = new StdClass(); $table->cellpadding = 0; $table->cellspacing = 0; - $table->width = '100%'; - $table->class = 'info_table'; + $table->styleTable = 'margin: 0 10px; width: -webkit-fill-available; width: -moz-available'; + $table->class = 'info_table tactical_table'; + $table->id = 'monitors_view'; $table->head = []; $table->data = []; $table->size = []; @@ -1401,7 +1469,6 @@ if (!empty($result)) { $show_fields = explode(',', $config['status_monitor_fields']); - if (in_array('policy', $show_fields)) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $table->head[0] = ''.__('P.').''; @@ -1409,56 +1476,61 @@ if (!empty($result)) { } if (in_array('agent', $show_fields) || is_metaconsole()) { - $table->head[1] = __('Agent'); + $table->head[1] = ''.__('Agent').''; $table->head[1] .= ui_get_sorting_arrows($url_agent_name.'up', $url_agent_name.'down', $selectAgentNameUp, $selectAgentNameDown); } if (in_array('data_type', $show_fields) || is_metaconsole()) { - $table->head[2] = __('Data Type'); + $table->head[2] = ''.__('Data Type').''; $table->head[2] .= ui_get_sorting_arrows($url_type.'up', $url_type.'down', $selectDataTypeUp, $selectDataTypeDown); - $table->align[2] = 'left'; + $table->headstyle[2] = 'text-align: center'; + $table->align[2] = 'center'; } if (in_array('module_name', $show_fields) || is_metaconsole()) { - $table->head[3] = __('Module name'); + $table->head[3] = ''.__('Module name').''; $table->head[3] .= ui_get_sorting_arrows($url_module_name.'up', $url_module_name.'down', $selectModuleNameUp, $selectModuleNameDown); } if (in_array('server_type', $show_fields) || is_metaconsole()) { - $table->head[4] = __('Server type'); + $table->head[4] = ''.__('Server type').''; $table->head[4] .= ui_get_sorting_arrows($url_server_type.'up', $url_server_type.'down', $selectTypeUp, $selectTypeDown); + $table->headstyle[4] = 'text-align: center'; + $table->align[4] = 'center'; } if (in_array('interval', $show_fields) || is_metaconsole()) { - $table->head[5] = __('Interval'); + $table->head[5] = ''.__('Interval').''; $table->head[5] .= ui_get_sorting_arrows($url_interval.'up', $url_interval.'down', $selectIntervalUp, $selectIntervalDown); $table->align[5] = 'left'; } if (in_array('status', $show_fields) || is_metaconsole()) { - $table->head[6] = __('Status'); + $table->head[6] = ''.__('Status').''; $table->head[6] .= ui_get_sorting_arrows($url_status.'up', $url_status.'down', $selectStatusUp, $selectStatusDown); $table->align[6] = 'left'; } if (in_array('last_status_change', $show_fields)) { - $table->head[7] = __('Last status change'); + $table->head[7] = ''.__('Last status change').''; $table->head[7] .= ui_get_sorting_arrows($url_status.'up', $url_status.'down', $selectStatusUp, $selectStatusDown); - $table->align[7] = 'left'; + $table->headstyle[7] = 'text-align: center'; + $table->align[7] = 'center'; } if (in_array('graph', $show_fields) || is_metaconsole()) { - $table->head[8] = __('Graph'); - $table->align[8] = 'left'; + $table->head[8] = ''.__('Graph').''; + $table->headstyle[8] = 'text-align: center'; + $table->align[8] = 'center'; } if (in_array('warn', $show_fields) || is_metaconsole()) { - $table->head[9] = __('Warn'); + $table->head[9] = ''.__('W/C').''; $table->align[9] = 'left'; } if (in_array('data', $show_fields) || is_metaconsole()) { - $table->head[10] = __('Data'); + $table->head[10] = ''.__('Data').''; $table->align[10] = 'left'; if (is_metaconsole()) { $table->head[10] .= ui_get_sorting_arrows($url_data.'up', $url_data.'down', $selectDataUp, $selectDataDown); @@ -1466,7 +1538,7 @@ if (!empty($result)) { } if (in_array('timestamp', $show_fields) || is_metaconsole()) { - $table->head[11] = __('Timestamp'); + $table->head[11] = ''.__('Timestamp').''; $table->head[11] .= ui_get_sorting_arrows($url_timestamp_up, $url_timestamp_down, $selectTimestampUp, $selectTimestampDown); $table->align[11] = 'left'; } @@ -1486,7 +1558,7 @@ if (!empty($result)) { foreach ($result as $row) { // Avoid unset, null and false value. - if (empty($row['server_name'])) { + if (empty($row['server_name']) === true) { $row['server_name'] = ''; } @@ -1595,78 +1667,75 @@ if (!empty($result)) { } if (in_array('data_type', $show_fields) || is_metaconsole()) { - $data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true, ['class' => 'invert_filter']); + $data[2] = html_print_image('images/'.modules_show_icon_type($row['module_type']), true, ['class' => 'invert_filter main_menu_icon']); $agent_groups = is_metaconsole() ? $row['groups_in_server'] : agents_get_all_groups_agent($row['id_agent'], $row['id_group']); + if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) { + $show_edit_icon = true; + if (is_metaconsole() === true) { + if (!can_user_access_node()) { + $show_edit_icon = false; + } + + $url_edit_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'.'&loginhash=auto&loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']); + } else { + $url_edit_module = 'index.php?'.'sec=gagente&'.'sec2=godmode/agentes/configurar_agente&'.'id_agente='.$row['id_agent'].'&'.'tab=module&'.'id_agent_module='.$row['id_agente_modulo'].'&'.'edit_module=1'; + } + } } - if (in_array('module_name', $show_fields) || is_metaconsole()) { - $data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true); - if ($row['extended_info'] != '') { + if (in_array('module_name', $show_fields) === true || is_metaconsole() === true) { + $data[3] = html_print_anchor( + [ + 'href' => ($url_edit_module ?? '#'), + 'content' => ui_print_truncate_text($row['module_name'], 'module_small', false, true, true), + ], + true + ); + + if (empty($row['extended_info']) === false) { $data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png'); } - if ($row['tags'] != '') { + if (empty($row['tags']) === false) { $data[3] .= html_print_image( - '/images/tag_red.png', + '/images/tag@svg.svg', true, [ 'title' => $row['tags'], - 'class' => 'tag_row', + 'class' => 'inverse_filter main_menu_icon', ] ); } } - if (in_array('server_type', $show_fields) || is_metaconsole()) { - $data[4] = servers_show_type($row['id_modulo']); + if (in_array('server_type', $show_fields) === true || is_metaconsole() === true) { + $data[4] = ui_print_servertype_icon((int) $row['id_modulo']); } - if (in_array('module_name', $show_fields) || is_metaconsole()) { - $data[3] = ui_print_truncate_text($row['module_name'], 'module_small', false, true, true); - if ($row['extended_info'] != '') { - $data[3] .= ui_print_help_tip($row['extended_info'], true, '/images/default_list.png'); - } - - if ($row['tags'] != '') { - $data[3] .= html_print_image( - '/images/tag_red.png', - true, - [ - 'title' => $row['tags'], - 'class' => 'tag_row invert_filter', - ] - ); - } - } - - if (in_array('server_type', $show_fields) || is_metaconsole()) { - $data[4] = servers_show_type($row['id_modulo']); - } - - - if (in_array('interval', $show_fields) || is_metaconsole()) { - $data[5] = ($row['module_interval'] == 0) ? human_time_description_raw($row['agent_interval']) : human_time_description_raw($row['module_interval']); + if (in_array('interval', $show_fields) === true || is_metaconsole() === true) { + $data[5] = ((int) $row['module_interval'] === 0) ? human_time_description_raw($row['agent_interval']) : human_time_description_raw($row['module_interval']); } if (in_array('status', $show_fields) || is_metaconsole()) { - if ($row['utimestamp'] == 0 && (($row['module_type'] < 21 + $data[6] = '
'; + if ($row['utimestamp'] === 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100) ) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_NO_DATA, __('NOT INIT'), true ); } else if ($row['estado'] == 0) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_OK, __('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_OK, __('NORMAL').': '.htmlspecialchars($row['datos']), true @@ -1674,7 +1743,7 @@ if (!empty($result)) { } } else if ($row['estado'] == 1) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_CRITICAL, __('CRITICAL').': '.remove_right_zeros( number_format( @@ -1687,7 +1756,7 @@ if (!empty($result)) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_CRITICAL, __('CRITICAL').': '.htmlspecialchars($row['datos']), true @@ -1695,7 +1764,7 @@ if (!empty($result)) { } } else if ($row['estado'] == 2) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_WARNING, __('WARNING').': '.remove_right_zeros( number_format( @@ -1708,7 +1777,7 @@ if (!empty($result)) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_WARNING, __('WARNING').': '.htmlspecialchars($row['datos']), true @@ -1716,7 +1785,7 @@ if (!empty($result)) { } } else if ($row['estado'] == 3) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').': '.remove_right_zeros( number_format( @@ -1729,7 +1798,7 @@ if (!empty($result)) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').': '.htmlspecialchars($row['datos']), true @@ -1737,7 +1806,7 @@ if (!empty($result)) { } } else if ($row['estado'] == 4) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_NO_DATA, __('NO DATA').': '.remove_right_zeros( number_format( @@ -1750,7 +1819,7 @@ if (!empty($result)) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_NO_DATA, __('NO DATA').': '.htmlspecialchars($row['datos']), true @@ -1760,16 +1829,17 @@ if (!empty($result)) { $last_status = modules_get_agentmodule_last_status( $row['id_agente_modulo'] ); + switch ($last_status) { case 0: if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.htmlspecialchars($row['datos']), true @@ -1779,13 +1849,13 @@ if (!empty($result)) { case 1: if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.htmlspecialchars($row['datos']), true @@ -1795,13 +1865,13 @@ if (!empty($result)) { case 2: if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.htmlspecialchars($row['datos']), true @@ -1810,6 +1880,8 @@ if (!empty($result)) { break; } } + + $data[6] .= '
'; } if (in_array('last_status_change', $show_fields) || is_metaconsole()) { @@ -1858,7 +1930,7 @@ if (!empty($result)) { $graph_params['histogram'] = 1; } - if (is_metaconsole() && isset($row['server_id'])) { + if (is_metaconsole() === true && isset($row['server_id']) === true) { // Set the server id. $graph_params['server'] = $row['server_id']; } @@ -1867,21 +1939,28 @@ if (!empty($result)) { $link = 'winopeng_var(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\', 800, 480)'; - $data[8] = get_module_realtime_link_graph($row); + $graphIconsContent = []; + $graphIconsContent[] = get_module_realtime_link_graph($row); if ($tresholds === true || $graph_type === 'boolean') { - $data[8] .= ''.html_print_image( - 'images/histograma.png', - true, + $graphIconsContent[] = html_print_anchor( [ - 'border' => '0', - 'alt' => '', - 'class' => 'invert_filter', - ] - ).''; + 'href' => 'javascript:'.$link, + 'content' => html_print_image( + 'images/event-history.svg', + true, + [ + 'border' => '0', + 'alt' => '', + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); } - if (!is_snapshot_data($row['datos'])) { + if (is_snapshot_data($row['datos']) === false) { if ($tresholds === true || $graph_type === 'boolean') { unset($graph_params['histogram']); } @@ -1889,21 +1968,41 @@ if (!empty($result)) { $graph_params_str = http_build_query($graph_params); $link = 'winopeng_var(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\', 800, 480)'; - $data[8] .= ''.html_print_image('images/chart.png', true, ['border' => '0', 'alt' => '', 'class' => 'invert_filter']).''; + $graphIconsContent[] = html_print_anchor( + [ + 'href' => 'javascript:'.$link, + 'content' => html_print_image('images/module-graph.svg', true, ['border' => '0', 'alt' => '', 'class' => 'invert_filter main_menu_icon']), + ], + true + ); } - $data[8] .= ''.html_print_image( - 'images/binary.png', - true, + $graphIconsContent[] = html_print_anchor( [ - 'border' => '0', - 'alt' => '', - 'class' => 'invert_filter', - ] - ).''; + 'href' => 'javascript: show_module_detail_dialog('.$row['id_agente_modulo'].', '.$row['id_agent'].', \''.$row['server_name'].'\', 0, '.SECONDS_1DAY.', \''.$row['module_name'].'\')', + 'content' => html_print_image( + 'images/simple-value.svg', + true, + [ + 'border' => '0', + 'alt' => '', + 'class' => 'invert_filter main_menu_icon', + ] + ), + ], + true + ); - $data[8] .= ''.$row['module_name'].''; + + $data[8] = html_print_div( + [ + 'class' => 'table_action_buttons', + 'content' => implode('', $graphIconsContent), + ], + true + ); } } @@ -2073,33 +2172,40 @@ if (!empty($result)) { } if (check_acl_one_of_groups($config['id_user'], $agent_groups, 'AW')) { - if (defined('METACONSOLE')) { - $url_edit_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&'; - $url_edit_module .= 'loginhash=auto&id_agente='.$row['id_agent']; - $url_edit_module .= '&tab=module&id_agent_module='.$row['id_agente_modulo'].'&edit_module=1&'; - $url_edit_module .= 'loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']); + $url_edit_module = $row['server_url']; + $url_edit_module .= 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&'; + $url_edit_module .= '&id_agente='.$row['id_agent']; + $url_edit_module .= '&tab=module&id_agent_module='.$row['id_agente_modulo'].'&edit_module=1'; + if (is_metaconsole() === true) { + $url_edit_module .= '&loginhash=auto'; + $url_edit_module .= '&loginhash_data='.$row['hashdata'].'&loginhash_user='.str_rot13($row['user']); + } + $table->cellclass[][2] = 'action_buttons'; + $data[12] .= ''.html_print_image( + 'images/edit.svg', + true, + [ + 'alt' => '0', + 'border' => '', + 'title' => __('Edit'), + 'class' => 'main_menu_icon invert_filter', + ] + ).''; + + if (is_metaconsole() === false) { $url_delete_module = $row['server_url'].'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente'; $url_delete_module .= '&id_agente='.$row['id_agent'].'&delete_module='.$row['id_agente_modulo']; - $table->cellclass[][2] = 'action_buttons'; - $data[12] .= ''.html_print_image( - 'images/config.png', - true, - [ - 'alt' => '0', - 'border' => '', - 'title' => __('Edit'), - ] - ).''; $onclick = 'onclick="javascript: if (!confirm(\''.__('Are you sure to delete?').'\')) return false;'; $data[12] .= ''.html_print_image( - 'images/delete.png', + 'images/delete.svg', true, [ 'alt' => '0', 'border' => '', 'title' => __('Delete'), + 'class' => 'main_menu_icon invert_filter', ] ).''; } @@ -2110,9 +2216,8 @@ if (!empty($result)) { html_print_table($table); - if ($count_modules > $config['block_size']) { - ui_pagination($count_modules, false, $offset, 0, false, 'offset', true, 'pagination-bottom'); + $tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', false); } } else { if ($first_interaction) { @@ -2122,6 +2227,15 @@ if (!empty($result)) { } } +if (is_metaconsole() !== true) { + html_print_action_buttons( + html_print_div(['style' => 'float:left; height: 55px;'], true), + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ] + ); +} // End Build List Result. echo "
"; @@ -2130,8 +2244,6 @@ echo "
"; echo ''; echo ''; -enterprise_hook('close_meta_frame'); - ui_require_javascript_file('pandora_modules'); ?> @@ -2270,7 +2382,7 @@ function show_module_detail_dialog(module_id, id_agent, server_name, offset, per opacity: 0.5, background: "black" }, - width: 620, + width: 700, height: 500 }) .show (); diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index d2dabfb167..afcd4e56a1 100755 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -46,6 +46,8 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], return; } +ui_require_css_file('tactical'); + $is_admin = check_acl($config['id_user'], 0, 'PM'); $user_strict = (bool) db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']); @@ -163,14 +165,30 @@ $table->data = []; $table->style = [$bg_color]; $stats = reporting_get_stats_indicators($data, 120, 10, false); -$status = ''; -foreach ($stats as $stat) { - $status .= ''; + +$statusTacticalTable = new stdClass(); +$statusTacticalTable->width = '100%'; +$statusTacticalTable->id = 'statusTacticalTable'; +$statusTacticalTable->class = 'status_tactical tactical_table bg_white'; +$statusTacticalTable->data = []; + +foreach ($stats as $key => $stat) { + $statusTacticalTable->cellstyle['line_'.$key][0] = 'width: 40%;'; + $statusTacticalTable->style['line_'.$key][1] = 'width: 60%;'; + $statusTacticalTable->data['line_'.$key][0] = ''.$stat['title'].''; + $statusTacticalTable->data['line_'.$key][1] = $stat['graph']; } -$status .= '
'.$stat['title'].''.''.$stat['graph'].'
'; +$status = html_print_table($statusTacticalTable, true); + +$table->rowclass = []; +$table->rowclass[0] = 'w100p'; +$table->rowclass[1] = 'w100p'; +$table->rowclass[2] = 'w100p'; +$table->rowclass[3] = 'w100p'; +$table->rowclass[4] = 'w100p'; $table->data[0][0] = $status; -$table->rowclass[] = ''; + // --------------------------------------------------------------------- // Monitor checks @@ -184,6 +202,7 @@ $data_agents = [ ]; $table->data[1][0] = reporting_get_stats_alerts($data); +$table->rowclass[1] = 'w100p'; $table->data[2][0] = reporting_get_stats_modules_status($data, 180, 100, false, $data_agents); $table->data[3][0] = reporting_get_stats_agents_monitors($data); @@ -223,7 +242,7 @@ if (check_acl($config['id_user'], 0, 'ER')) { $event_filter .= ' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; } - $events = events_print_event_table($event_filter, 10, '100%', true, false, true); + $events = events_print_event_table($event_filter, 10, '100%', true, 0, true); ui_toggle( $events, __('Latest events'), @@ -241,13 +260,13 @@ if ($is_admin) { include $config['homedir'].'/godmode/servers/servers.build_table.php'; } -$out = '
'; -$out .= '
'; +$out = '
'; +$out .= '
'; $out .= ''.__('Event graph').''; $out .= html_print_image('images/spinner.gif', true, ['id' => 'spinner_total_event_graph']); $out .= '
'; $out .= '
'; -$out .= '
+$out .= '
'.__('Event graph by agent').''.html_print_image('images/spinner.gif', true, ['id' => 'spinner_graphic_event_group']).'
'; $out .= '
'; diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index cc234b996a..121800e92f 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -1,9 +1,8 @@ '.html_print_image( - 'images/setup.png', - true, +if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true) { + $managetab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente, + 'image' => 'images/configuration@svg.svg', 'title' => __('Manage'), - 'class' => 'invert_filter', - ] - ).''; - - if ($tab == 'manage') { - $managetab['active'] = true; - } else { - $managetab['active'] = false; - } + ], + true + ); + $managetab['active'] = ($tab === 'manage'); $managetab['godmode'] = 1; } // Main tab. -$maintab['text'] = ''.html_print_image( - 'images/agent.png', - true, +$maintab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente, + 'image' => 'images/agents@svg.svg', 'title' => __('Main'), - 'class' => 'invert_filter', - ] -).''; + ], + true +); -if ($tab == 'main') { - $maintab['active'] = true; -} else { - $maintab['active'] = false; -} +$maintab['active'] = ($tab === 'main'); // Interfaces tab. $agent_interfaces = agents_get_network_interfaces( @@ -1439,20 +1429,16 @@ if ($agent_interfaces_count > 0) { } // Alert tab. -$alerttab['text'] = ''.html_print_image( - 'images/bell.png', - true, +$alerttab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&tab=alert', + 'image' => 'images/alert@svg.svg', 'title' => __('Alerts'), - 'class' => 'invert_filter', - ] -).''; + ], + true +); -if ($tab === 'alert') { - $alerttab['active'] = true; -} else { - $alerttab['active'] = false; -} +$alerttab['active'] = ($tab === 'alert'); // Inventory. $inventoryCount = db_get_num_rows('SELECT id_agent_module_inventory FROM tagent_module_inventory WHERE id_agente = '.$agent['id_agente']); @@ -1469,22 +1455,27 @@ if ($tab == 'inventory') { $inventorytab['active'] = true; } else { $inventorytab['active'] = false; -}if ($inventorytab == -1 || $inventoryCount === 0) { +} + +$inventorytab = enterprise_hook('inventory_tab'); +if ($inventorytab === ENTERPRISE_NOT_HOOK || $inventoryCount === 0) { $inventorytab = ''; } // Collection. if ((int) $config['license_nms'] !== 1) { $collectiontab = enterprise_hook('collection_tab'); - if ($collectiontab == -1) { + if ($collectiontab === ENTERPRISE_NOT_HOOK) { $collectiontab = ''; } +} else { + $collectiontab = ''; } // Policy. $policyTab = enterprise_hook('policy_tab'); -if ($policyTab == -1) { +if ($policyTab === ENTERPRISE_NOT_HOOK) { $policyTab = ''; } @@ -1501,17 +1492,17 @@ if ($tasks === true) { // WUX Console. $modules_wux = enterprise_hook('get_wux_modules', [$id_agente]); -if ($modules_wux) { +if ((bool) $modules_wux === true) { $wux_console_tab = enterprise_hook('wux_console_tab'); - if ($wux_console_tab == -1) { + if ($wux_console_tab === ENTERPRISE_NOT_HOOK) { $wux_console_tab = ''; } } $url_route_analyzer = enterprise_hook('get_url_route_analyzer_modules', [$id_agente]); -if ($url_route_analyzer) { +if ((bool) $url_route_analyzer === true) { $url_route_analyzer_tab = enterprise_hook('url_route_analyzer_tab'); - if ($url_route_analyzer_tab == -1) { + if ($url_route_analyzer_tab === ENTERPRISE_NOT_HOOK) { $url_route_analyzer_tab = ''; } } @@ -1523,128 +1514,106 @@ if ($ncm_tab === ENTERPRISE_NOT_HOOK) { // GIS tab. $gistab = []; -if ($config['activate_gis']) { - $gistab['text'] = ''.html_print_image( - 'images/op_gis.png', - true, +if ((bool) $config['activate_gis'] === true) { + $gistab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente='.$id_agente, + 'image' => 'images/poi@svg.svg', 'title' => __('GIS data'), - 'class' => 'invert_filter', - ] - ).''; + ], + true + ); - if ($tab == 'gis') { - $gistab['active'] = true; - } else { - $gistab['active'] = false; - } + $gistab['active'] = ($tab === 'gis'); } - // Incident tab. $total_incidents = agents_get_count_incidents($id_agente); if ($total_incidents > 0) { - $incidenttab['text'] = ''.html_print_image( - 'images/book_edit.png', - true, + $incidenttab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=gagente&sec2=operation/agentes/ver_agente&tab=incident&id_agente='.$id_agente, + 'image' => 'images/logs@svg.svg', 'title' => __('Incidents'), - 'class' => 'invert_filter', - ] - ).''; + ], + true + ); - if ($tab == 'incident') { - $incidenttab['active'] = true; - } else { - $incidenttab['active'] = false; - } + $incidenttab['active'] = ($tab === 'incident'); } - // Url address tab. -if ($agent['url_address'] != '') { - $urladdresstab['text'] = ''.html_print_image( - 'images/link.png', - true, +if (empty($agent['url_address']) === false) { + $urladdresstab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=gagente&sec2=operation/agentes/ver_agente&tab=url_address&id_agente='.$id_agente, + 'image' => 'images/generic-string@svg.svg', 'title' => __('Url address'), - 'class' => 'invert_filter', - ] - ).''; -} - -if ($tab == 'url_address') { - $urladdresstab['active'] = true; -} else { - $urladdresstab['active'] = false; + ], + true + ); } +$urladdresstab['active'] = ($tab === 'url_address'); // Custom fields tab. -$custom_fields['text'] = ''.html_print_image( - 'images/custom_field.png', - true, +$custom_fields['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=custom_fields&id_agente='.$id_agente, + 'image' => 'images/custom-input@svg.svg', 'title' => __('Custom fields'), - 'class' => 'invert_filter', - ] -).''; -if ($tab == 'custom_fields') { - $custom_fields['active'] = true; -} else { - $custom_fields['active'] = false; -} + ], + true +); + +$custom_fields['active'] = ($tab === 'custom_fields'); // Graphs tab. -$graphs['text'] = ''.html_print_image( - 'images/chart.png', - true, +$graphs['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=graphs&id_agente='.$id_agente, + 'image' => 'images/graph@svg.svg', 'title' => __('Graphs'), - 'class' => 'invert_filter', - ] -).''; -if ($tab == 'graphs') { - $graphs['active'] = true; -} else { - $graphs['active'] = false; -} + ], + true +); +$graphs['active'] = ($tab === 'graphs'); // Log viewer tab. -if (enterprise_installed() && $config['log_collector']) { +if (enterprise_installed() === true && (bool) $config['log_collector'] === true) { $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; $agent_has_logs = (bool) db_get_value('id_agent', 'tagent_module_log', 'id_agent', $id_agente); - if ($agent_has_logs && !$is_windows) { + if ($agent_has_logs === true && (bool) $is_windows === false) { $log_viewer_tab = []; - $log_viewer_tab['text'] = ''.html_print_image( - 'images/gm_log.png', - true, + $log_viewer_tab['text'] = html_print_menu_button( [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=log_viewer&id_agente='.$id_agente, + 'image' => 'images/gm_log.png', 'title' => __('Log Viewer'), - 'class' => 'invert_filter', - ] - ).''; - $log_viewer_tab['active'] = $tab == 'log_viewer'; + ], + true + ); + $log_viewer_tab['active'] = ($tab === 'log_viewer'); } } // EHorus tab. -if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field']) +if ((bool) $config['ehorus_enabled'] === true && empty($config['ehorus_custom_field'] === false) && (check_acl_one_of_groups( $config['id_user'], $all_groups, 'AW' - ) || is_user_admin($config['id_user'])) + ) || is_user_admin($config['id_user']) === true) ) { $user_info = users_get_user_by_id($config['id_user']); - if ($config['ehorus_user_level_conf'] && !$user_info['ehorus_user_level_enabled']) { + if ($config['ehorus_user_level_conf'] && (bool) $user_info['ehorus_user_level_enabled'] === false) { // If ehorus user configuration is enabled, and userr acces level is disabled do not show eHorus tab. } else { $ehorus_agent_id = agents_get_agent_custom_field($id_agente, $config['ehorus_custom_field']); - if (!empty($ehorus_agent_id)) { + if (empty($ehorus_agent_id) === false) { $tab_url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=ehorus&id_agente='.$id_agente; $ehorus_tab['text'] = ''.html_print_image( 'images/ehorus/ehorus.png', @@ -1659,11 +1628,11 @@ if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field']) $ehorus_tab['sub_menu'] = '
    '; $ehorus_tab['sub_menu'] .= ''; $ehorus_tab['sub_menu'] .= '
  • '.html_print_image( - 'images/ehorus/terminal.png', + 'images/quick-shell@svg.svg', true, [ 'title' => __('Terminal'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $ehorus_tab['sub_menu'] .= '
  • '; @@ -1720,28 +1689,32 @@ if ($config['ehorus_enabled'] && !empty($config['ehorus_custom_field']) } $is_sap = agents_get_sap_agents($id_agente); -if ($is_sap) { - $saptab['text'] = '
    '.html_print_image( - 'images/sap_icon.png', - true, - ['title' => __('SAP view')] - ).''; - if ($tab == 'sap_view') { - $saptab['active'] = true; - } else { - $saptab['active'] = false; - } +if ($is_sap === true) { + $saptab['text'] = html_print_menu_button( + [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sap_view&page=1&id_agente='.$id_agente, + 'image' => 'images/sap_icon.png', + 'title' => __('SAP view'), + ], + true + ); + + $saptab['active'] = ($tab === 'sap_view'); } else { $saptab = ''; } // External Tools tab. -$external_tools['text'] = ''.html_print_image('images/nettool.png', true, ['title' => __('External Tools'), 'class' => 'invert_filter']).''; -if ($tab == 'external_tools') { - $external_tools['active'] = true; -} else { - $external_tools['active'] = false; -} +$external_tools['text'] = html_print_menu_button( + [ + 'href' => 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=external_tools&id_agente='.$id_agente, + 'image' => 'images/external-tools@svg.svg', + 'title' => __('External Tools'), + ], + true +); + +$external_tools['active'] = ($tab === 'external_tools'); $onheader = [ 'manage' => ($managetab ?? null), @@ -1770,12 +1743,12 @@ if ($agent['url_address'] != '') { } // If the log viewer tab exists. -if (isset($log_viewer_tab) && !empty($log_viewer_tab)) { +if (isset($log_viewer_tab) === true && empty($log_viewer_tab) === false) { $onheader['log_viewer'] = $log_viewer_tab; } // If the ehorus id exists. -if (isset($ehorus_tab) && !empty($ehorus_tab)) { +if (isset($ehorus_tab) === true && empty($ehorus_tab) === false) { $onheader['ehorus'] = $ehorus_tab; } @@ -1846,44 +1819,44 @@ foreach ($config['extensions'] as $extension) { switch ($tab) { case 'custom_fields': - $tab_name = 'Custom fields'; + $tab_name = __('Custom fields'); break; case 'gis': - $tab_name = 'GIS data'; + $tab_name = __('GIS data'); break; case 'manage': - $tab_name = 'Manage'; + $tab_name = __('Manage'); break; case 'main': - $tab_name = 'Main'; + $tab_name = __('Main'); $help_header = 'agent_'.$tab.'_tab'; break; case 'data_view': - $tab_name = ''; + $tab_name = __('Data View'); break; case 'interface': - $tab_name = 'Interfaces'; + $tab_name = __('Interfaces'); break; case 'alert': - $tab_name = 'Alerts'; + $tab_name = __('Alerts'); break; case 'inventory': - $tab_name = 'Inventory'; + $tab_name = __('Inventory'); break; case 'collection': - $tab_name = 'Collection'; + $tab_name = __('Collection'); break; case 'policy': - $tab_name = 'Policies'; + $tab_name = __('Policies'); break; case 'omnishell': @@ -1891,36 +1864,36 @@ switch ($tab) { break; case 'ux_console_tab': - $tab_name = 'UX Console'; + $tab_name = __('UX Console'); break; case 'wux_console_tab': - $tab_name = 'WUX Console'; + $tab_name = __('WUX Console'); $help_header = 'wux_console_tab'; break; case 'url_route_analyzer_tab': - $tab_name = 'URL Route Analyzer'; + $tab_name = __('URL Route Analyzer'); break; case 'graphs'; - $tab_name = 'Graphs'; + $tab_name = __('Graphs'); break; case 'incident': - $tab_name = 'Incidents'; + $tab_name = __('Incidents'); break; case 'url_address': - $tab_name = 'Url address'; + $tab_name = __('Url address'); break; case 'log_viewer': - $tab_name = 'Log viewer'; + $tab_name = __('Log viewer'); break; case 'ehorus': - $tab_name = 'eHorus'; + $tab_name = __('eHorus'); break; case 'extension': @@ -1928,17 +1901,16 @@ switch ($tab) { break; case 'sap_view': - $tab_description = '- '.__('SAP view'); - $help_header = 'sap_view'; - $tab_name = 'SAP View'; + $tab_name = __('SAP view'); + $help_header = 'sap_view'; break; case 'ncm': - $tab_name = 'Network configuration'; + $tab_name = __('Network configuration'); break; case 'external_tools': - $tab_name = 'External Tools'; + $tab_name = __('External Tools'); break; default: @@ -1947,25 +1919,28 @@ switch ($tab) { break; } -if (!$config['pure']) { - ui_print_page_header( - agents_get_alias($id_agente), +if ((bool) $config['pure'] === false) { + ui_print_standard_header( + __('Agent main view'), $icon, false, - '', + ($help_header ?? ''), false, $onheader, - false, - '', - $config['item_title_size_text'], - '', - ui_print_breadcrums( + [ [ - __('Monitoring'), - __('View'), - ''.$tab_name.'', - ] - ) + 'link' => '', + 'label' => __('Resources'), + ], + [ + 'link' => 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente', + 'label' => __('View agents'), + ], + [ + 'link' => '', + 'label' => $tab_name, + ], + ] ); } diff --git a/pandora_console/operation/dashboard/dashboard.php b/pandora_console/operation/dashboard/dashboard.php index 348b365e9f..b80a871266 100644 --- a/pandora_console/operation/dashboard/dashboard.php +++ b/pandora_console/operation/dashboard/dashboard.php @@ -70,14 +70,6 @@ if (is_ajax() === true) { } } } else { - if ((bool) is_metaconsole() === true) { - echo '
    '; - } - // Run. $cs->run(); - - if ((bool) is_metaconsole() === true) { - echo '
    '; - } } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index e12f2527b1..3f1ca54d2a 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -74,7 +74,9 @@ $readonly = false; ui_require_css_file('events'); ui_require_css_file('tables'); if (is_metaconsole() === true) { - ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/'); + ui_require_css_file('tables'); + // ui_require_css_file('meta_tables', ENTERPRISE_DIR.'/meta/styles/'); + ui_require_css_file('meta_events', ENTERPRISE_DIR.'/meta/styles/'); } // Load extra javascript. @@ -561,11 +563,11 @@ if (is_ajax() === true) { $tmp->user_comment .= $tmp->b64; $tmp->user_comment .= '\',\'comments\')>;'; $tmp->user_comment .= html_print_image( - 'images/operation.png', + 'images/details.svg', true, [ 'title' => __('Show more'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $tmp->user_comment .= ''; @@ -581,37 +583,37 @@ if (is_ajax() === true) { // Event severity prepared. switch ($tmp->criticity) { - case EVENT_CRIT_CRITICAL; + case EVENT_CRIT_CRITICAL: $text = __('CRITICAL'); $color = COL_CRITICAL; break; - case EVENT_CRIT_MAINTENANCE; + case EVENT_CRIT_MAINTENANCE: $text = __('MAINTENANCE'); $color = COL_MAINTENANCE; break; - case EVENT_CRIT_INFORMATIONAL; + case EVENT_CRIT_INFORMATIONAL: $text = __('INFORMATIONAL'); $color = COL_INFORMATIONAL; break; - case EVENT_CRIT_MAJOR; + case EVENT_CRIT_MAJOR: $text = __('MAJOR'); $color = COL_MAJOR; break; - case EVENT_CRIT_MINOR; + case EVENT_CRIT_MINOR: $text = __('MINOR'); $color = COL_MINOR; break; - case EVENT_CRIT_NORMAL; + case EVENT_CRIT_NORMAL: $text = __('NORMAL'); $color = COL_NORMAL; break; - case EVENT_CRIT_WARNING; + case EVENT_CRIT_WARNING: $text = __('WARNING'); $color = COL_WARNING; break; @@ -633,8 +635,8 @@ if (is_ajax() === true) { $tmp->mini_severity .= $output; $tmp->mini_severity .= ''; - $criticity = '
    '.$text.'
    '; + $criticity = '
    '.$text.'
    '; $tmp->criticity = $criticity; // Add event severity to end of text. @@ -659,79 +661,79 @@ if (is_ajax() === true) { // Event type prepared. switch ($tmp->event_type) { - case EVENTS_ALERT_FIRED; - case EVENTS_ALERT_RECOVERED; - case EVENTS_ALERT_CEASED; - case EVENTS_ALERT_MANUAL_VALIDATION; + case EVENTS_ALERT_FIRED: + case EVENTS_ALERT_RECOVERED: + case EVENTS_ALERT_CEASED: + case EVENTS_ALERT_MANUAL_VALIDATION: $text = __('ALERT'); $color = COL_ALERTFIRED; break; - case EVENTS_RECON_HOST_DETECTED; - case EVENTS_SYSTEM; - case EVENTS_ERROR; - case EVENTS_NEW_AGENT; - case EVENTS_CONFIGURATION_CHANGE; + case EVENTS_RECON_HOST_DETECTED: + case EVENTS_SYSTEM: + case EVENTS_ERROR: + case EVENTS_NEW_AGENT: + case EVENTS_CONFIGURATION_CHANGE: $text = __('SYSTEM'); $color = COL_MAINTENANCE; break; - case EVENTS_GOING_UP_WARNING; - case EVENTS_GOING_DOWN_WARNING; + case EVENTS_GOING_UP_WARNING: + case EVENTS_GOING_DOWN_WARNING: $text = __('WARNING'); $color = COL_WARNING; break; - case EVENTS_GOING_DOWN_NORMAL; - case EVENTS_GOING_UP_NORMAL; + case EVENTS_GOING_DOWN_NORMAL: + case EVENTS_GOING_UP_NORMAL: $text = __('NORMAL'); $color = COL_NORMAL; break; - case EVENTS_GOING_DOWN_CRITICAL; - case EVENTS_GOING_UP_CRITICAL; + case EVENTS_GOING_DOWN_CRITICAL: + case EVENTS_GOING_UP_CRITICAL: $text = __('CRITICAL'); $color = COL_CRITICAL; break; - case EVENTS_UNKNOWN; - case EVENTS_GOING_UNKNOWN; + case EVENTS_UNKNOWN: + case EVENTS_GOING_UNKNOWN: default: $text = __('UNKNOWN'); $color = COL_UNKNOWN; break; } - $event_type = '
    '.$text.'
    '; + $event_type = '
     
    '; $tmp->event_type = $event_type; // Module status. // Event severity prepared. switch ($tmp->module_status) { - case AGENT_MODULE_STATUS_NORMAL; + case AGENT_MODULE_STATUS_NORMAL: $text = __('NORMAL'); $color = COL_NORMAL; break; - case AGENT_MODULE_STATUS_CRITICAL_BAD; + case AGENT_MODULE_STATUS_CRITICAL_BAD: $text = __('CRITICAL'); $color = COL_CRITICAL; break; - case AGENT_MODULE_STATUS_NO_DATA; + case AGENT_MODULE_STATUS_NO_DATA: $text = __('NOT INIT'); $color = COL_NOTINIT; break; - case AGENT_MODULE_STATUS_CRITICAL_ALERT; - case AGENT_MODULE_STATUS_NORMAL_ALERT; - case AGENT_MODULE_STATUS_WARNING_ALERT; + case AGENT_MODULE_STATUS_CRITICAL_ALERT: + case AGENT_MODULE_STATUS_NORMAL_ALERT: + case AGENT_MODULE_STATUS_WARNING_ALERT: $text = __('ALERT'); $color = COL_ALERTFIRED; break; - case AGENT_MODULE_STATUS_WARNING; + case AGENT_MODULE_STATUS_WARNING: $text = __('WARNING'); $color = COL_WARNING; break; @@ -742,19 +744,19 @@ if (is_ajax() === true) { break; } - $module_status = '
    '.$text.'
    '; + $module_status = '
     
    '; $tmp->module_status = $module_status; // Status. switch ($tmp->estado) { case EVENT_STATUS_NEW: $img = html_print_image( - 'images/star.png', + 'images/star@svg.svg', true, [ 'title' => __('New event'), - 'class' => 'forced-title', + 'class' => 'forced-title main_menu_icon', ] ); $state = 0; @@ -763,11 +765,11 @@ if (is_ajax() === true) { case EVENT_STATUS_VALIDATED: $state = 1; $img = html_print_image( - 'images/tick.png', + 'images/validate.svg', true, [ 'title' => __('Event validated'), - 'class' => 'forced-title invert_filter', + 'class' => 'forced-title invert_filter main_menu_icon', ] ); break; @@ -775,18 +777,18 @@ if (is_ajax() === true) { case EVENT_STATUS_INPROCESS: $state = 2; $img = html_print_image( - 'images/hourglass.png', + 'images/clock.svg', true, [ 'title' => __('Event in process'), - 'class' => 'forced-title invert_filter', + 'class' => 'forced-title invert_filter height_20px', ] ); break; default: $img = html_print_image( - 'images/star.png', + 'images/star@svg.svg', true, [ 'title' => __('Unknown'), @@ -797,7 +799,7 @@ if (is_ajax() === true) { break; } - $draw_state = '
    '; + $draw_state = '
    '; $draw_state .= ''; @@ -826,7 +828,7 @@ if (is_ajax() === true) { // Show more. $tmp->options = ''; $tmp->options .= html_print_image( - 'images/operation.png', + 'images/details.svg', true, [ 'title' => __('Show more'), @@ -855,11 +857,11 @@ if (is_ajax() === true) { $tmp->options .= $tmp->event_rep.', this, '.$tmp->server_id.')"'; $tmp->options .= ' id="val-'.$id_val.'">'; $tmp->options .= html_print_image( - 'images/tick.png', + 'images/validate.svg', true, [ 'title' => __('Validate events'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $tmp->options .= ''; @@ -872,11 +874,11 @@ if (is_ajax() === true) { $tmp->options .= $tmp->id_evento.', 0, this, '; $tmp->options .= $tmp->server_id.')" id="val-'.$id_val.'">'; $tmp->options .= html_print_image( - 'images/tick.png', + 'images/validate.svg', true, [ 'title' => __('Validate event'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $tmp->options .= ''; @@ -907,11 +909,11 @@ if (is_ajax() === true) { } $tmp->options .= html_print_image( - 'images/hourglass.png', + 'images/clock.svg', true, [ 'title' => __('Change to in progress status'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $tmp->options .= ''; @@ -932,11 +934,11 @@ if (is_ajax() === true) { $tmp->options .= $tmp->max_id_evento.', '.$tmp->event_rep; $tmp->options .= ', this, '.$tmp->server_id.')" id="del-'.$id_del.'">'; $tmp->options .= html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'title' => __('Delete events'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $tmp->options .= ''; @@ -949,11 +951,11 @@ if (is_ajax() === true) { $tmp->options .= $tmp->id_evento.', 0, this, '; $tmp->options .= $tmp->server_id.')" id="del-'.$id_del.'">'; $tmp->options .= html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'title' => __('Delete event'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ); $tmp->options .= ''; @@ -1373,7 +1375,7 @@ if ($pure) { echo '
  • '; echo ''; echo html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Back to normal mode'), @@ -1416,11 +1418,6 @@ if ($pure) { // Floating menu - End. ui_require_jquery_file('countdown'); } else { - if (is_metaconsole() === true) { - // Load metaconsole frame. - enterprise_hook('open_meta_frame'); - } - // Header. $pss = get_user_info($config['id_user']); $hashup = md5($config['id_user'].$pss['password']); @@ -1428,22 +1425,22 @@ if ($pure) { // Fullscreen. $fullscreen['active'] = false; $fullscreen['text'] = ''.html_print_image( - 'images/full_screen.png', + 'images/fullscreen@svg.svg', true, [ 'title' => __('Full screen'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; // Event list. $list['active'] = false; $list['text'] = ''.html_print_image( - 'images/events_list.png', + 'images/event.svg', true, [ 'title' => __('Event list'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; @@ -1454,29 +1451,29 @@ if ($pure) { true, [ 'title' => __('History event list'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; // RSS. $rss['active'] = false; $rss['text'] = ''.html_print_image( - 'images/rss.png', + 'images/rrs@svg.svg', true, [ 'title' => __('RSS Events'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; // CSV. $csv['active'] = false; $csv['text'] = ''.html_print_image( - 'images/csv.png', + 'images/file-csv.svg', true, [ 'title' => __('Export to CSV file'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; @@ -1500,11 +1497,11 @@ if ($pure) { ); $sound_event['text'] = ''.html_print_image( - 'images/sound.png', + 'images/sound_console@svg.svg', true, [ 'title' => __('Accoustic console'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; @@ -1513,11 +1510,11 @@ if ($pure) { // Manage events. $manage_events['active'] = false; $manage_events['text'] = ''.html_print_image( - 'images/setup.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Manage events'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).''; @@ -1567,11 +1564,16 @@ if ($pure) { break; } - if (is_metaconsole() === false) { + if (is_metaconsole() === true) { + unset($onheader['rss']); + unset($onheader['sound_event']); + unset($onheader['fullscreen']); + } + unset($onheader['history']); ui_print_standard_header( __('Events list'), - 'images/lightning_go.png', + 'images/event.svg', false, 'eventview', false, @@ -1583,12 +1585,6 @@ if ($pure) { ], ] ); - } else { - unset($onheader['rss']); - unset($onheader['sound_event']); - unset($onheader['fullscreen']); - ui_meta_print_header(__('Events'), $section_string, $onheader); - } } if (enterprise_installed() === true) { @@ -1655,11 +1651,57 @@ $data = html_print_input( 'selected' => $id_group, 'nothing' => false, 'return' => true, - 'size' => '80%', + 'size' => '100%', ] ); $in = '
    '; -$in .= $data.'
    '; +$in .= $data; + +// Search recursive groups. +$data = html_print_checkbox_switch( + 'search_recursive_groups', + $search_recursive_groups, + $search_recursive_groups, + true, + false, + 'checked_slide_events(this);', + true +); + +$in_group = '
    '; +$in_group .= $data; +$in_group .= ''; +$in .= $in_group; + +// Search secondary groups. +$data = html_print_checkbox_switch( + 'search_secondary_groups', + $search_secondary_groups, + $search_secondary_groups, + true, + false, + 'checked_slide_events(this);', + true +); + +$in_sec_group .= $data; +$in_sec_group .= ''; +$in_sec_group .= '
    '; +$in .= $in_sec_group; + +$in .= '
  • '; $inputs[] = $in; // Event type. @@ -1726,11 +1768,9 @@ $inputs[] = $in; // Free search. $data = html_print_input_text('search', $search, '', '', 255, true); + // Search recursive groups. -$data .= ui_print_help_tip( - __('Search for elements NOT containing given text.'), - true -); +$data .= '
    '; $data .= html_print_checkbox_switch( 'not_search', $not_search, @@ -1740,6 +1780,13 @@ $data .= html_print_checkbox_switch( 'checked_slide_events(this);', true ); + +$data .= ui_print_help_tip( + __('Search for elements NOT containing given text.'), + true +); +$data .= '
    '; + $in = ''; @@ -1774,68 +1821,26 @@ $in = '
    '; $in .= $data.'
    '; $inputs[] = $in; -// Search recursive groups. -$data = html_print_checkbox_switch( - 'search_recursive_groups', - $search_recursive_groups, - $search_recursive_groups, - true, - false, - 'checked_slide_events(this);', - true -); - -$in = '
    '; -$in .= $data; -$in .= '
    '; -$inputs[] = $in; - -// Search secondary groups. -$data = html_print_checkbox_switch( - 'search_secondary_groups', - $search_secondary_groups, - $search_secondary_groups, - true, - false, - 'checked_slide_events(this);', - true -); - -$in = '
    '; -$in .= $data; -$in .= '
    '; -$inputs[] = $in; - // Trick view in table. -$inputs[] = '
    '; +$inputs[] = '
    '; $buttons = []; $buttons[] = [ 'id' => 'load-filter', - 'class' => 'float-left margin-right-2 sub config', + 'class' => 'float-left margin-right-2', 'text' => __('Load filter'), 'onclick' => '', + 'icon' => 'load', ]; if ($event_w === true || $event_m === true) { $buttons[] = [ 'id' => 'save-filter', - 'class' => 'float-left margin-right-2 sub wand', + 'class' => 'margin-right-2', 'text' => __('Save filter'), 'onclick' => '', + 'icon' => 'save', ]; } @@ -1908,8 +1913,9 @@ if ($id_agent !== null) { } $data = ui_print_agent_autocomplete_input($params); -$in = '
    '; -$in .= $data.'
    '; +$in = '
    '.$data.'
    '; $adv_inputs[] = $in; // Mixed. Metaconsole => server, Console => module. @@ -1962,7 +1968,12 @@ $data = html_print_select( '', __('Any'), 0, - true + true, + false, + true, + '', + false, + 'width: 400px' ); $in = '
    '; $in .= $data.'
    '; @@ -1975,7 +1986,12 @@ $data = html_print_select( '', __('Any'), 0, - true + true, + false, + true, + '', + false, + 'width: 400px' ); $in = '
    '; $in .= $data.'
    '; @@ -1992,7 +2008,12 @@ $data = html_print_select( '', __('All'), -1, - true + true, + false, + true, + '', + false, + 'width: 400px' ); $adv_inputs[] = html_print_div( @@ -2079,7 +2100,7 @@ $adv_inputs[] = html_print_div( [ 'class' => 'filter_input', 'content' => sprintf( - '%s:%s', + '
    %s:%s
    ', __('From (date:time)'), $inputDateFrom, $inputTimeFrom @@ -2137,7 +2158,7 @@ $adv_inputs[] = html_print_div( [ 'class' => 'filter_input', 'content' => sprintf( - '%s:%s', + '
    %s:%s
    ', __('To (date:time)'), $inputDateTo, $inputTimeTo @@ -2157,7 +2178,12 @@ $custom_data_filter_type_input = html_print_select( '', false, -1, - true + true, + false, + true, + '', + false, + 'width: 400px' ); $adv_inputs[] = html_print_div( @@ -2212,13 +2238,14 @@ $adv_filter = join('', $adv_inputs); $filter = join('', $inputs); $filter .= ui_toggle( $adv_filter, - __('Advanced options'), + ''.__('Advanced options').'', '', '', true, true, - 'white_box white_box_opened', - 'no-border flex-row' + 'white_box white_box_opened no_border', + 'advanced-options-events no-border flex-row', + 'box-flat white_table_graph w100p' ); try { @@ -2244,7 +2271,7 @@ try { 'event_type', [ 'text' => 'options', - 'class' => 'action_buttons w120px', + 'class' => 'table_action_buttons w120px', ], [ 'text' => 'm', @@ -2288,7 +2315,7 @@ try { [ [ 'text' => 'options', - 'class' => 'action_buttons mw120px', + 'class' => 'table_action_buttons mw120px', ], [ 'text' => 'm', @@ -2387,69 +2414,85 @@ try { // Close. $active_filters_div .= '
    '; - $active_filters_div .= '
    '; - + // $active_filters_div .= '
    '; $table_id = 'table_events'; $form_id = 'events_form'; + $show_hide_filters = ''; + if ((int) $_GET['pure'] === 1) { + $show_hide_filters = 'invisible'; + } + // Print datatable. - ui_print_datatable( + html_print_div( [ - 'id' => $table_id, - 'class' => 'info_table events', - 'style' => 'width: 100%;', - 'ajax_url' => 'operation/events/events', - 'ajax_data' => [ - 'get_events' => 1, - 'history' => (int) $history, - 'table_id' => $table_id, - ], - 'form' => [ - 'id' => $form_id, - 'class' => 'flex-row', - 'html' => $filter, - 'inputs' => [], - 'extra_buttons' => $buttons, - ], - 'extra_html' => $active_filters_div, - 'pagination_options' => [ + 'class' => 'events_table_wrapper', + 'style' => 'margin-top: 0px; margin-bottom: 0px;', + 'content' => ui_print_datatable( [ - $config['block_size'], - 10, - 25, - 100, - 200, - 500, + 'id' => $table_id, + 'class' => 'info_table events', + 'style' => 'width: 99%;', + 'ajax_url' => 'operation/events/events', + 'ajax_data' => [ + 'get_events' => 1, + 'history' => (int) $history, + 'table_id' => $table_id, + ], + 'form' => [ + 'id' => $form_id, + 'class' => 'flex-row', + 'html' => $filter, + 'inputs' => [], + 'extra_buttons' => $buttons, + ], + 'extra_html' => $active_filters_div, + 'pagination_options' => [ + [ + $config['block_size'], + 10, + 25, + 100, + 200, + 500, + ], + [ + $config['block_size'], + 10, + 25, + 100, + 200, + 500, + ], + ], + 'order' => [ + 'field' => 'timestamp', + 'direction' => 'desc', + ], + 'column_names' => $column_names, + 'columns' => $fields, + 'no_sortable_columns' => [ + -1, + -2, + 'column-instructions', + ], + 'ajax_return_operation' => 'buffers', + 'ajax_return_operation_function' => 'process_buffers', + 'drawCallback' => 'process_datatables_callback(this, settings)', + 'print' => false, + 'csv' => 0, + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar '.$show_hide_filters, ], - [ - $config['block_size'], - 10, - 25, - 100, - 200, - 500, - ], - ], - 'order' => [ - 'field' => 'timestamp', - 'direction' => 'desc', - ], - 'column_names' => $column_names, - 'columns' => $fields, - 'no_sortable_columns' => [ - -1, - -2, - 'column-instructions', - ], - 'ajax_return_operation' => 'buffers', - 'ajax_return_operation_function' => 'process_buffers', - 'drawCallback' => 'process_datatables_callback(this, settings)', + ), ] ); } catch (Exception $e) { ui_print_error_message($e->getMessage()); } +// Close. +echo '
    '; + // Event responses. if (is_user_admin($config['id_user'])) { $sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'"; @@ -2488,25 +2531,33 @@ if (check_acl( echo '
    '; echo '
    '; echo ''; - html_print_select( + + $elements = html_print_button( + __('Execute event response'), + 'submit_event_response', + false, + 'execute_event_response(true);', + [ 'icon' => 'cog' ], + true + ); + + $elements .= html_print_select( $array_events_actions, 'response_id', '', '', '', 0, - false, + true, false, false ); - echo '  '; - html_print_button( - __('Execute event response'), - 'submit_event_response', - false, - 'execute_event_response(true);', - 'class="sub next"' + + html_print_action_buttons( + $elements, + [ 'type' => 'data_table' ] ); + echo "
    '; } -// Close viewer. -enterprise_hook('close_meta_frame'); - // Datepicker requirements. ui_require_css_file('datepicker'); ui_include_time_picker(); @@ -2645,7 +2693,7 @@ function process_datatables_callback(table, settings) { function countdown_repeat() { var until_time = new Date(); - until_time.setTime (until_time.getTime () + parseInt()); + until_time.setTime (until_time.getTime () + parseInt()); return until_time; } @@ -2962,7 +3010,7 @@ $(document).ready( function() { /* Summary updates end. */ /* Filter management */ - $('#load-filter').click(function (){ + $('#button-load-filter').click(function (){ if($('#load-filter-select').length) { $('#load-filter-select').dialog(); } else { @@ -2986,7 +3034,7 @@ $(document).ready( function() { } }); - $('#save-filter').click(function (){ + $('#button-save-filter').click(function (){ if($('#save-filter-select').length) { $('#save-filter-select').dialog(); } else { @@ -3063,7 +3111,7 @@ $(document).ready( function() { //Autorefresh in fullscreen var pure = ''; if(pure == 1){ - var refresh_interval = parseInt(''); + var refresh_interval = parseInt(''); var until_time=''; // If autorefresh is disabled, don't show the countdown @@ -3074,7 +3122,7 @@ $(document).ready( function() { function events_refresh() { until_time = new Date(); - until_time.setTime (until_time.getTime () + parseInt()); + until_time.setTime (until_time.getTime () + parseInt()); $("#refrcounter").countdown ({ until: until_time, @@ -3155,4 +3203,15 @@ function show_instructions(id){ }); } +$(document).ready(function () { + let agentLabel = $('#text-text_agent').prev(); + let agentTip = $('#text-text_agent').next(); + agentLabel.append(agentTip); + + let moduleLabel = $('#text-module_search').prev(); + let moduleTip = $('#text-module_search').next().next(); + moduleLabel.append(moduleTip); + + $('.white_table_graph_header').first().append($('.filter_summary')); +}); diff --git a/pandora_console/operation/gis_maps/gis_map.php b/pandora_console/operation/gis_maps/gis_map.php index a8a12b0012..0e044d37cb 100644 --- a/pandora_console/operation/gis_maps/gis_map.php +++ b/pandora_console/operation/gis_maps/gis_map.php @@ -186,7 +186,7 @@ if ($maps !== false) { $data['default'] = html_print_radio_button_extended('default_map', $map['id_tgis_map'], '', $checked, false, 'setDefault('.$map['id_tgis_map'].');', '', true); } - $table->cellclass[]['op'] = 'action_buttons'; + $table->cellclass[]['op'] = 'table_action_buttons'; $data['op'] = ''.html_print_image('images/config.png', true, ['title' => __('Edit')]).''.''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; } diff --git a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php index 121fedb342..b6d8c83b82 100644 --- a/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php +++ b/pandora_console/operation/incidents/dashboard_detail_integriaims_incident.php @@ -375,9 +375,9 @@ $dates_box .= ''; // Show details, people and dates. echo '
    '; - ui_toggle($details_box, __('Details'), '', 'details_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-shadow white_table_graph'); - ui_toggle($people_box, __('People'), '', 'people_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-shadow white_table_graph'); - ui_toggle($dates_box, __('Dates'), '', 'dates_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-shadow white_table_graph'); + ui_toggle($details_box, __('Details'), '', 'details_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-flat white_table_graph'); + ui_toggle($people_box, __('People'), '', 'people_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-flat white_table_graph'); + ui_toggle($dates_box, __('Dates'), '', 'dates_box', false, false, '', 'integria_details_content white-box-content', 'integria_details_shadow box-flat white_table_graph'); echo '
    '; // Show description. diff --git a/pandora_console/operation/incidents/list_integriaims_incidents.php b/pandora_console/operation/incidents/list_integriaims_incidents.php index 8b1e986e89..71dd1df064 100644 --- a/pandora_console/operation/incidents/list_integriaims_incidents.php +++ b/pandora_console/operation/incidents/list_integriaims_incidents.php @@ -545,7 +545,7 @@ foreach ($incidents_paginated as $key => $value) { $table->data[$i][6] = $array_get_incidents[$key][10]; $table->data[$i][7] = $array_get_incidents[$key][5]; $table->data[$i][8] = ''; - $table->cellclass[$i][8] = 'action_buttons'; + $table->cellclass[$i][8] = 'table_action_buttons'; $table->data[$i][8] .= ''; $table->data[$i][8] .= html_print_image('images/config.png', true, ['title' => __('Edit')]); $table->data[$i][8] .= ''; diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php index 0a1cd508bd..45caeb85a7 100755 --- a/pandora_console/operation/inventory/inventory.php +++ b/pandora_console/operation/inventory/inventory.php @@ -32,6 +32,7 @@ require_once $config['homedir'].'/include/functions_inventory.php'; if (is_ajax() === true) { $get_csv_url = (bool) get_parameter('get_csv_url'); + $get_data_basic_info = (bool) get_parameter('get_data_basic_info'); if ($get_csv_url) { // $inventory_module = get_parameter ('module_inventory_general_view', 'all'); @@ -109,6 +110,156 @@ if (is_ajax() === true) { return; } + if ($get_data_basic_info === true) { + // Datatables offset, limit and order. + $filter = get_parameter('search', []); + $start = (int) get_parameter('start', 0); + $length = (int) get_parameter('length', $config['block_size']); + $order = get_datatable_order(); + $id_agent = (int) get_parameter('id_agent', 0); + + $params = [ + 'search' => $filter['value'], + 'start' => $start, + 'length' => $length, + 'order' => $order, + 'id_agent' => $id_agent, + ]; + + $data = get_data_basic_info_sql($params); + $count = get_data_basic_info_sql($params, true); + + try { + ob_start(); + + $data = array_reduce( + $data, + function ($carry, $agent) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = new stdClass(); + + $id = $agent['id_agente']; + + $tmp->alias = $agent['alias']; + $ip = ''.__('N/A').''; + if (empty($agent['direccion']) === false) { + $ip = $agent['direccion']; + } + + $tmp->ip = $ip; + + $secondary_ips = ''; + foreach (agents_get_addresses($id) as $ip) { + if ($ip !== $agent['direccion']) { + $secondary_ips .= ''.$ip.''; + } + } + + $tmp->secondaryIp = $secondary_ips; + + $tmp->group = groups_get_name($agent['id_grupo']); + $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id]); + + if (empty($secondary_groups['for_select']) === true) { + $sec_group_data = ''.__('N/A').''; + } else { + $sec_group = []; + foreach ($secondary_groups['for_select'] as $name) { + $sec_group[] = $name; + } + + $sec_group_data = implode(', ', $sec_group); + } + + $tmp->secondaryGroups = $sec_group_data; + + $tmp->os = ui_print_os_icon( + $agent['id_os'], + false, + true, + true, + false, + false, + false, + ['class' => 'main_menu_icon invert_filter'] + ); + + $interval = human_time_description_raw($agent['intervalo'], false, 'large'); + $last_contact = ui_print_timestamp($agent['ultimo_contacto'], true); + // $last_contact .= ' / '.date_w_fixed_tz($agent['ultimo_contacto_remoto']); + $last_status_change_agent = agents_get_last_status_change($agent['id_agente']); + $time_elapsed = !empty($last_status_change_agent) ? human_time_comparation($last_status_change_agent) : ''.__('N/A').''; + + $sql_fields = 'SELECT tcf.name, tcd.description, tcf.is_password_type + FROM tagent_custom_fields tcf + INNER JOIN tagent_custom_data tcd ON tcd.id_field=tcf.id_field + WHERE tcd.id_agent='.$id.' AND tcd.description!=""'; + $field_result = db_get_all_rows_sql($sql_fields); + + $custom_fields_names = ''; + $custom_fields_values = ''; + foreach ($field_result as $field) { + $field_name = str_replace(' ', ' ', io_safe_output($field['name'])); + $custom_fields_names .= ''.$field_name.''; + + $description = $field['description']; + $password_length = strlen(io_safe_output($field['description'])); + $asterisks = ''; + + if ((int) $field['is_password_type'] === 1) { + for ($i = 0; $i < $password_length; $i++) { + $asterisks .= '●'; + } + + $description = $asterisks; + } + + $custom_fields_values .= ''.$description.''; + } + + $tmp->description = $agent['comentarios']; + $tmp->interval = $interval; + $tmp->lastContact = $last_contact; + $tmp->lastStatusChange = $time_elapsed; + $tmp->customFields = $custom_fields_names; + $tmp->valuesCustomFields = $custom_fields_values; + + $carry[] = $tmp; + return $carry; + }, + [] + ); + + // Datatables format: RecordsTotal && recordsfiltered. + echo json_encode( + [ + 'data' => $data, + 'recordsTotal' => $count, + 'recordsFiltered' => $count, + ] + ); + // Capture output. + $response = ob_get_clean(); + } catch (\Exception $e) { + echo json_encode(['error' => $e->getMessage()]); + exit; + } + + // If not valid, show error with issue. + json_decode($response); + if (json_last_error() == JSON_ERROR_NONE) { + // If valid dump. + echo $response; + } else { + echo json_encode( + ['error' => $response] + ); + } + + return; + } + return; } @@ -116,13 +267,8 @@ global $config; check_login(); - $is_metaconsole = is_metaconsole(); -if ($is_metaconsole === true) { - open_meta_frame(); -} - if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], 0, 'AW')) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, @@ -135,6 +281,9 @@ if (! check_acl($config['id_user'], 0, 'AR') && ! check_acl($config['id_user'], require_once $config['homedir'].'/include/functions_users.php'; require_once $config['homedir'].'/include/functions_inventory.php'; + +// TODO: Button +// echo "".__('Export this list to CSV').''.html_print_image('images/csv.png', true, ['title' => __('Export this list to CSV')]).''; // Header. ui_print_standard_header( __('Inventory'), @@ -160,7 +309,7 @@ if (strlen($inventory_agent) == 0) { $inventory_id_agent = 0; } -$inventory_module = get_parameter('module_inventory_general_view'); +$inventory_module = get_parameter('module_inventory_general_view', 'basic'); $inventory_id_group = (int) get_parameter('id_group'); $inventory_search_string = (string) get_parameter('search_string'); $order_by_agent = (bool) get_parameter('order_by_agent'); @@ -196,10 +345,12 @@ if ($is_metaconsole === true) { } if ($is_metaconsole === true) { + $nodo_image_url = $config['homeurl'].'/images/node.png'; if ($id_server > 0) { $connection = metaconsole_get_connection_by_id($id_server); $agents_node = metaconsole_get_agents_servers($connection['server_name'], $inventory_id_group); $node = metaconsole_get_servers($id_server); + $nodos = []; if (metaconsole_connect($connection) !== NOERR) { ui_print_error_message( @@ -216,7 +367,8 @@ if ($is_metaconsole === true) { $result_module = db_get_all_rows_sql($sql); if ($submit_filter === true) { - $inventory_data .= inventory_get_data( + // Get the data. + $rows_meta = inventory_get_datatable( array_keys($agents_node), $inventory_module, $utimestamp, @@ -224,15 +376,26 @@ if ($is_metaconsole === true) { $export, false, $order_by_agent, - $node, + $server, $pagination_url_parameters ); + + $data_tmp['server_name'] = $connection['server_name']; + $data_tmp['dbhost'] = $connection['dbhost']; + $data_tmp['server_uid'] = $connection['server_uid']; + $data_tmp['data'] = $rows_meta; + + $nodos[$connection['id']] = $data_tmp; + if ($result_data !== ERR_NODATA) { + $inventory_data .= $result_data; + } } // Restore db connection. metaconsole_restore_db(); } else { $result_module = []; + $nodos = []; foreach ($nodes_connection as $key => $server) { $agents_node = metaconsole_get_agents_servers($server['server_name'], $inventory_id_group); $connection = metaconsole_get_connection($server['server_name']); @@ -253,7 +416,7 @@ if ($is_metaconsole === true) { $result_module = array_merge($result_module, $result); if ($submit_filter === true) { // Get the data. - $result_data = inventory_get_data( + $rows_meta = inventory_get_datatable( array_keys($agents_node), $inventory_module, $utimestamp, @@ -264,6 +427,13 @@ if ($is_metaconsole === true) { $server, $pagination_url_parameters ); + + $data_tmp['server_name'] = $server['server_name']; + $data_tmp['dbhost'] = $server['dbhost']; + $data_tmp['server_uid'] = $server['server_uid']; + $data_tmp['data'] = $rows_meta; + + $nodos[$server['id']] = $data_tmp; if ($result_data !== ERR_NODATA) { $inventory_data .= $result_data; } @@ -312,17 +482,15 @@ if (is_metaconsole() === true) { $filteringFunction = ''; } -echo ''; - +$searchForm = ''; $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; $table->size = []; -$table->size[0] = '120px'; -$table->cellpadding = 0; -$table->cellspacing = 0; +$table->size[0] = '33%'; +$table->size[1] = '33%'; +$table->size[2] = '33%'; +$table->class = 'filter-table-adv'; $table->data = []; -$table->rowspan[0][4] = 2; if ($is_metaconsole === true) { // Node select. @@ -331,36 +499,61 @@ if ($is_metaconsole === true) { $nodes[$row['id']] = $row['server_name']; } - $table->data[-1][0] = ''.__('Server').''; - $table->data[-1][1] = html_print_select($nodes, 'id_server', $id_server, $filteringFunction, __('All'), 0, true, false, true, '', false, 'min-width: 250px; max-width: 300px;'); + $table->data[-1][0] = html_print_label_input_block( + __('Server'), + html_print_select( + $nodes, + 'id_server', + $id_server, + $filteringFunction, + __('All'), + 0, + true, + false, + true, + '', + false, + 'width:100%;' + ) + ); } // Group select. -$table->data[0][0] = ''.__('Group').''; - -$table->data[0][1] = '
    '; -$table->data[0][1] .= html_print_select_groups( - $config['id_user'], - $access, - true, - 'id_group', - $inventory_id_group, - $filteringFunction, - '', - '1', - true, - false, - true, - '', - false +$table->data[0][0] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + $config['id_user'], + $access, + true, + 'id_group', + $inventory_id_group, + $filteringFunction, + '', + '1', + true, + false, + true, + '', + false + ) ); -$table->data[0][1] .= '
    '; - -// Module selected. -$table->data[0][2] = ''.__('Module').''; if ($is_metaconsole === true) { - $table->data[0][3] = html_print_select($fields, 'module_inventory_general_view', $inventory_module, $filteringFunction, __('All'), 0, true, false, true, '', false, 'min-width: 194px; max-width: 200px;'); + array_unshift($fields, __('All')); + $module_input = html_print_select( + $fields, + 'module_inventory_general_view', + $inventory_module, + $filteringFunction, + __('Basic info'), + 'basic', + true, + false, + true, + '', + false, + 'width:100%;' + ); } else { $sql = 'SELECT name as indexname, name FROM tmodule_inventory, tagent_module_inventory @@ -369,13 +562,35 @@ if ($is_metaconsole === true) { $sql .= ' AND id_agente = '.$inventory_id_agent; } - $table->data[0][3] = html_print_select_from_sql($sql, 'module_inventory_general_view', $inventory_module, '', __('All'), 'all', true, false, false); + $fields = []; + $result = db_get_all_rows_sql($sql); + if ($result === false) { + $result = []; + } + + foreach ($result as $row) { + $id = array_shift($row); + $value = array_shift($row); + $fields[$id] = $value; + } + + array_unshift($fields, __('All')); + $module_input = html_print_select( + $fields, + 'module_inventory_general_view', + $inventory_module, + '', + __('Basic info'), + 'basic', + true, + false, + false, + '', + false, + 'width:100%;' + ); } - -// Button of submit. -$table->data[0][4] = html_print_submit_button(__('Search'), 'submit_filter', $noFilterSelected, "class='sub search'", true); - // Agent select. if ($is_metaconsole === false) { $agents = []; @@ -401,8 +616,6 @@ if ($is_metaconsole === false) { } } -$table->data[1][0] = ''.__('Agent').''; - $params = []; $params['return'] = true; $params['show_helptip'] = true; @@ -424,34 +637,109 @@ if ($is_metaconsole === true) { $params['metaconsole_enabled'] = true; } -$table->data[1][1] = ui_print_agent_autocomplete_input($params); +$table->data[0][1] = html_print_label_input_block( + __('Agent'), + ui_print_agent_autocomplete_input($params) +); + +// Module selected. +$table->data[0][2] = html_print_label_input_block( + __('Module'), + $module_input +); // String search_string. -$table->data[1][2] = ''.__('Search').''; -$table->data[1][3] = html_print_input_text('search_string', $inventory_search_string, '', 25, 0, true, false, false, '', '', $filteringFunction, 'off', false, $filteringFunction); +$table->data[1][0] = html_print_label_input_block( + __('Search'), + html_print_input_text( + 'search_string', + $inventory_search_string, + '', + 25, + 0, + true, + false, + false, + '', + '', + $filteringFunction, + 'off', + false, + $filteringFunction + ) +); + +// Order by agent filter. +$table->data[1][1] = html_print_label_input_block( + __('Order by agent'), + html_print_checkbox( + 'order_by_agent', + 1, + $order_by_agent, + true, + false, + '' + ) +); // Date filter. In Metaconsole has not reason for show. if (is_metaconsole() === false) { - $table->data[2][0] = ''.__('Date').''; - $dates = inventory_get_dates($inventory_module, $inventory_agent, $inventory_id_group); - $table->data[2][1] = html_print_select($dates, 'utimestamp', $utimestamp, '', __('Last'), 0, true); + $dates = inventory_get_dates( + $inventory_module, + $inventory_agent, + $inventory_id_group + ); + + $table->data[1][2] = html_print_label_input_block( + __('Date'), + html_print_select( + $dates, + 'utimestamp', + $utimestamp, + '', + __('Last'), + 0, + true, + false, + true, + '', + false, + 'width:100%;' + ) + ); } -// Order by agent filter. -$table->data[2][2] = ''.__('Order by agent').''; +$searchForm .= html_print_table($table, true); +$searchForm .= html_print_div( + [ + 'class' => 'action-buttons', + 'content' => html_print_submit_button( + __('Filter'), + 'srcbutton', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true +); -$table->data[2][3] = html_print_checkbox('order_by_agent', 1, $order_by_agent, true, false, ''); +$searchForm .= ''; -html_print_table($table); - -echo ''; - -// No agent selected or no search performed. -if ($inventory_id_agent < 0 || $submit_filter === false) { - echo ' 
'; - - return; -} +ui_toggle( + $searchForm, + ''.__('Filters').'', + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' +); if ($is_metaconsole === false) { // Single agent selected. @@ -461,29 +749,24 @@ if ($is_metaconsole === false) { $agents_ids = array_keys($agents); if (count($agents_ids) > 0) { - $inventory_data = inventory_get_data( + $rows = inventory_get_datatable( $agents_ids, $inventory_module, $utimestamp, $inventory_search_string, $export, false, - $order_by_agent, - '', - $pagination_url_parameters + $order_by_agent ); } - if (count($agents_ids) === 0 || (int) $inventory_data === ERR_NODATA) { + if (count($agents_ids) === 0 || (int) $rows === ERR_NODATA) { ui_print_info_message(['no_close' => true, 'message' => __('No data found.') ]); echo ' 
'; return; } - echo "'; echo "'; ?> true, 'message' => __('No data found.') ]); - } else { - echo $inventory_data; - } + if ($inventory_module !== 'basic') { + if ($order_by_agent === true) { + foreach ($rows as $agent_rows) { + $data = []; + $modules = ''; + foreach ($agent_rows['row'] as $key_row => $row) { + $columns = explode(';', io_safe_output($row['data_format'])); + array_push($columns, 'Timestamp'); - close_meta_frame(); + $data_rows = explode(PHP_EOL, $row['data']); + foreach ($data_rows as $data_row) { + // Exclude results don't match filter. + if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($data_row)) == 0) { + continue; + } + + $column_data = explode(';', io_safe_output($data_row)); + + if ($column_data[0] !== '') { + $row_tmp = []; + foreach ($column_data as $key => $value) { + $row_tmp[$columns[$key]] = $value; + } + + $row_tmp['Timestamp'] = $row['timestamp']; + array_push($data, (object) $row_tmp); + } + } + + $id_table = 'id_'.$key_row.'_'.$row['id_module_inventory'].'_'.$row['id_agente']; + + $table = ui_print_datatable( + [ + 'id' => $id_table, + 'class' => 'info_table w100p', + 'style' => 'width: 99%', + 'columns' => $columns, + 'column_names' => $columns, + 'no_sortable_columns' => [], + 'data_element' => $data, + 'searching' => true, + 'dom_elements' => 'ftip', + 'order' => [ + 'field' => $columns[0], + 'direction' => 'asc', + ], + 'zeroRecords' => __('No inventory found'), + 'emptyTable' => __('No inventory found'), + 'return' => true, + 'default_pagination' => 10, + 'no_sortable_columns' => [-1], + ] + ); + + $modules .= ui_toggle( + $table, + ''.$row['name'].'', + '', + '', + true, + true, + '', + 'white-box-content w100p', + 'box-shadow white_table_graph w100p', + 'images/arrow_down_green.png', + 'images/arrow_right_green.png', + false, + false, + false, + '', + '', + null, + null, + false, + $id_table + ); + } + + ui_toggle( + $modules, + $agent_rows['agent'], + '', + '', + false, + false + ); + } + } else { + $count_rows = count($rows); + foreach ($rows as $module_rows) { + $agent = ''; + $data = []; + + foreach ($module_rows as $row) { + $columns = explode(';', io_safe_output($row['data_format'])); + array_push($columns, 'Timestamp'); + array_push($columns, 'Agent'); + + // Exclude results don't match filter. + if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($row['data'])) == 0) { + continue; + } + + $data_tmp = []; + if ($row['data'] !== '') { + $values_explode = explode(';', io_safe_output($row['data'])); + + foreach ($values_explode as $key => $value) { + $data_tmp[$columns[$key]] = $value; + } + + $data_tmp['Timestamp'] = $row['timestamp']; + $data_tmp['Agent'] = $row['name_agent']; + array_push($data, $data_tmp); + } + + + $id_table = 'id_'.$row['id_module_inventory']; + } + + $table = ui_print_datatable( + [ + 'id' => $id_table, + 'class' => 'info_table w100p', + 'style' => 'width: 99%', + 'columns' => $columns, + 'column_names' => $columns, + 'no_sortable_columns' => [], + 'data_element' => $data, + 'searching' => true, + 'dom_elements' => 'ftip', + 'order' => [ + 'field' => $columns[0], + 'direction' => 'asc', + ], + 'zeroRecords' => __('No inventory found'), + 'emptyTable' => __('No inventory found'), + 'return' => true, + 'no_sortable_columns' => [], + ] + ); + + if ($count_rows > 1) { + ui_toggle( + $table, + array_shift($module_rows)['name'], + '', + '', + false, + false + ); + } else { + echo $table; + + html_print_action_buttons( + '', + ['type' => 'form_action'] + ); + } + } + } + } else { + $id_agente = $inventory_id_agent; + $agentes = []; + $data = []; + $class = 'info_table'; + $style = 'width: 99%'; + $ordering = true; + $searching = false; + + $columns = [ + 'alias', + 'ip', + 'secondoaryIp', + 'group', + 'secondaryGroups', + 'description', + 'os', + 'interval', + 'lastContact', + 'lastStatusChange', + 'customFields', + 'valuesCustomFields', + ]; + + $columns_names = [ + __('Alias'), + __('IP'), + __('Secondary IP'), + __('Group'), + __('Secondary groups'), + __('Description'), + __('OS'), + __('Interval'), + __('Last contact'), + __('Last status change'), + __('Custom fields'), + __('Values Custom Fields'), + ]; + + ui_print_datatable( + [ + 'id' => 'basic_info', + 'class' => $class, + 'style' => $style, + 'columns' => $columns, + 'column_names' => $columns_names, + 'ordering' => $ordering, + 'searching' => $searching, + 'order' => [ + 'field' => $columns[0], + 'direction' => 'asc', + ], + 'ajax_url' => 'operation/inventory/inventory', + 'ajax_data' => [ + 'get_data_basic_info' => 1, + 'id_agent' => $id_agente, + ], + 'zeroRecords' => __('Agent info not found'), + 'emptyTable' => __('Agent info not found'), + 'return' => false, + ] + ); + + html_print_action_buttons( + '', + ['type' => 'form_action'] + ); + } +} else { + // Metaconsole. + if ($inventory_module !== 'basic') { + if ($order_by_agent === true) { + $count_nodos_tmp = []; + foreach ($nodos as $count_value) { + array_push($count_nodos_tmp, $count_value['server_name']); + } + + $count = array_count_values($count_nodos_tmp); + + foreach ($nodos as $nodo) { + $agents = ''; + foreach ($nodo['data'] as $agent_rows) { + $modules = ''; + foreach ($agent_rows['row'] as $row) { + $data = []; + + $columns = explode(';', io_safe_output($row['data_format'])); + array_push($columns, 'Timestamp'); + + $data_rows = explode(PHP_EOL, $row['data']); + foreach ($data_rows as $data_row) { + // Exclude results don't match filter. + if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($data_row)) == 0) { + continue; + } + + $column_data = explode(';', io_safe_output($data_row)); + + if ($column_data[0] !== '') { + $row_tmp = []; + foreach ($column_data as $key => $value) { + $row_tmp[$columns[$key]] = $value; + } + + $row_tmp['Timestamp'] = $row['timestamp']; + array_push($data, (object) $row_tmp); + } + } + + $id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid']; + + $table = ui_print_datatable( + [ + 'id' => $id_table, + 'class' => 'info_table w100p', + 'style' => 'width: 100%', + 'columns' => $columns, + 'column_names' => $columns, + 'no_sortable_columns' => [], + 'data_element' => $data, + 'searching' => true, + 'dom_elements' => 'lftipB', + 'order' => [ + 'field' => $columns[0], + 'direction' => 'asc', + ], + 'zeroRecords' => __('No inventory found'), + 'emptyTable' => __('No inventory found'), + 'return' => true, + 'default_pagination' => 10, + 'no_sortable_columns' => [-1], + ] + ); + + $modules .= ui_toggle( + $table, + ''.$row['name'].'', + '', + '', + true, + true, + '', + 'white-box-content w100p', + 'box-shadow white_table_graph w100p', + 'images/arrow_down_green.png', + 'images/arrow_right_green.png', + false, + false, + false, + '', + '', + null, + null, + false, + $id_table + ); + } + + $agents .= ui_toggle( + $modules, + $agent_rows['agent'], + '', + '', + true, + true + ); + } + + $node_name = $nodo['server_name']; + if ($count[$nodo['server_name']] > 1) { + $node_name .= ' ('.$nodo['dbhost'].')'; + } + + ui_toggle( + $agents, + ''.$node_name.'', + '', + '', + false, + false + ); + } + } else { + $count_nodos_tmp = []; + foreach ($nodos as $count_value) { + array_push($count_nodos_tmp, $count_value['server_name']); + } + + $count = array_count_values($count_nodos_tmp); + + foreach ($nodos as $nodo_key => $nodo) { + $agents = ''; + foreach ($nodo['data'] as $module_rows) { + $agent = ''; + foreach ($module_rows as $row) { + $columns = explode(';', io_safe_output($row['data_format'])); + array_push($columns, 'Timestamp'); + $data = []; + + $data_explode = explode(PHP_EOL, $row['data']); + foreach ($data_explode as $values) { + // Exclude results don't match filter. + if ($inventory_search_string && preg_match('/'.io_safe_output($inventory_search_string).'/', ($values)) == 0) { + continue; + } + + $data_tmp = []; + if ($values !== '') { + $values_explode = explode(';', io_safe_output($values)); + + foreach ($values_explode as $key => $value) { + $data_tmp[$columns[$key]] = $value; + } + + $data_tmp['Timestamp'] = $row['timestamp']; + array_push($data, $data_tmp); + } + } + + + $id_table = 'id_'.$row['id_module_inventory'].'_'.$nodo['server_uid']; + + $table = ui_print_datatable( + [ + 'id' => $id_table, + 'class' => 'info_table w100p', + 'style' => 'width: 100%', + 'columns' => $columns, + 'column_names' => $columns, + 'no_sortable_columns' => [], + 'data_element' => $data, + 'searching' => true, + 'dom_elements' => 'lftipB', + 'order' => [ + 'field' => $columns[0], + 'direction' => 'asc', + ], + 'zeroRecords' => __('No inventory found'), + 'emptyTable' => __('No inventory found'), + 'return' => true, + 'default_pagination' => 10, + 'no_sortable_columns' => [-1], + ] + ); + + $agent .= ui_toggle( + $table, + ''.$row['name_agent'].'', + '', + '', + true, + true, + '', + 'white-box-content w100p', + 'box-shadow white_table_graph w100p', + 'images/arrow_down_green.png', + 'images/arrow_right_green.png', + false, + false, + false, + '', + '', + null, + null, + false, + $id_table + ); + } + + $agents .= ui_toggle( + $agent, + $module_rows[0]['name'], + '', + '', + true, + true + ); + } + + $node_name = $nodo['server_name']; + if ($count[$nodo['server_name']] > 1) { + $node_name .= ' ('.$nodo['dbhost'].')'; + } + + ui_toggle( + $agents, + ''.$node_name.'', + '', + '', + false, + false + ); + } + } + } else { + $id_agente = $inventory_id_agent; + $agentes = []; + $data = []; + $class = 'info_table w100p'; + $style = 'width: 100%'; + $ordering = false; + $searching = false; + $dom = 't'; + $columns = [ + __('Alias'), + __('IP'), + __('Secondary IP'), + __('Group'), + __('Secondary groups'), + __('Description'), + __('OS'), + __('Interval'), + __('Last contact'), + __('Last status change'), + __('Custom fields'), + __('Values Custom Fields'), + ]; + + if ($id_server === 0) { + $servers_ids = array_column(metaconsole_get_servers(), 'id'); + } else { + $servers_ids = [$id_server]; + } + + foreach ($servers_ids as $server_id) { + if (is_metaconsole()) { + $server = metaconsole_get_connection_by_id($server_id); + + if ((int) $es_agent_server_filter !== 0 + && (int) $es_agent_server_filter !== (int) $server_id + ) { + continue; + } + + metaconsole_connect($server); + } + + if ((int) $id_agente === 0) { + $class = 'databox info_table w100p'; + $style = 'width: 99%'; + $ordering = true; + $searching = true; + $dom = 'lftipB'; + $sql_agentes = 'SELECT t.id_agente + FROM tagente t + LEFT JOIN tgrupo tg ON tg.id_grupo = t.id_grupo + WHERE (t.alias LIKE "%'.$inventory_search_string.'%") + OR (t.comentarios LIKE "%'.$inventory_search_string.'%") + OR (t.direccion LIKE "%'.$inventory_search_string.'%") + OR (t.os_version LIKE "%'.$inventory_search_string.'%") + OR (tg.nombre LIKE "%'.$inventory_search_string.'%")'; + $agentes = db_get_all_rows_sql($sql_agentes); + } else { + array_push($agentes, $id_agente); + } + + foreach ($agentes as $id) { + if ((int) $id_agente === 0) { + $id = $id['id_agente']; + } + + $agent = db_get_row('tagente', 'id_agente', $id); + + $ip = ''.__('N/A').''; + if (empty($agent['direccion']) === false) { + $ip = $agent['direccion']; + } + + + $secondary_ips = ''; + foreach (agents_get_addresses($id) as $ip) { + if ($ip !== $agent['direccion']) { + $secondary_ips .= ''.$ip.''; + } + } + + $group = groups_get_name($agent['id_grupo']); + $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id]); + + if (empty($secondary_groups['for_select']) === true) { + $sec_group_data = ''.__('N/A').''; + } else { + $sec_group = []; + foreach ($secondary_groups['for_select'] as $name) { + $sec_group[] = $name; + } + + $sec_group_data = implode(', ', $sec_group); + } + + $os = ui_print_os_icon($agent['id_os'], false, true).' '; + $os .= io_safe_output(get_os_name($agent['id_os'])).' '.io_safe_output($agent['os_version']); + $interval = human_time_description_raw($agent['intervalo'], false, 'large'); + $last_contact = ui_print_timestamp($agent['ultimo_contacto'], true); + // $last_contact .= ' / '.date_w_fixed_tz($agent['ultimo_contacto_remoto']); + $last_status_change_agent = agents_get_last_status_change($agent['id_agente']); + $time_elapsed = !empty($last_status_change_agent) ? human_time_comparation($last_status_change_agent) : ''.__('N/A').''; + + $sql_fields = 'SELECT tcf.name, tcd.description, tcf.is_password_type + FROM tagent_custom_fields tcf + INNER JOIN tagent_custom_data tcd ON tcd.id_field=tcf.id_field + WHERE tcd.id_agent='.$id.' AND tcd.description!=""'; + $field_result = db_get_all_rows_sql($sql_fields); + + $custom_fields_names = ''; + $custom_fields_values = ''; + foreach ($field_result as $field) { + $field_name = str_replace(' ', ' ', io_safe_output($field['name'])); + $custom_fields_names .= ''.$field_name.''; + + $description = $field['description']; + $password_length = strlen(io_safe_output($field['description'])); + $asterisks = ''; + + if ((int) $field['is_password_type'] === 1) { + for ($i = 0; $i < $password_length; $i++) { + $asterisks .= '●'; + } + + $description = $asterisks; + } + + $custom_fields_values .= ''.$description.''; + } + + $data_tmp = [ + __('Alias') => $agent['alias'], + __('IP') => $ip, + __('Secondary IP') => $secondary_ips, + __('Group') => $group, + __('Secondary groups') => $sec_group_data, + __('Description') => $agent['comentarios'], + __('OS') => $os, + __('Interval') => $interval, + __('Last contact') => $last_contact, + __('Last status change') => $time_elapsed, + __('Custom fields') => $custom_fields_names, + __('Values Custom Fields') => $custom_fields_values, + ]; + + array_push($data, $data_tmp); + } + + if (is_metaconsole()) { + metaconsole_restore_db(); + } + } + + $table = ui_print_datatable( + [ + 'id' => 'basic_info', + 'class' => $class, + 'style' => $style, + 'columns' => $columns, + 'column_names' => $columns, + 'ordering' => $ordering, + 'data_element' => $data, + 'searching' => $searching, + 'dom_elements' => $dom, + 'order' => [ + 'field' => $columns[0], + 'direction' => 'asc', + ], + 'zeroRecords' => __('Agent info not found'), + 'emptyTable' => __('Agent info not found'), + 'default_pagination' => 10, + 'return' => true, + ] + ); + if ((int) $id_agente === 0) { + echo $table; + } else { + echo '
'.$table.'
'; + } + } } ui_require_jquery_file('pandora.controls'); @@ -546,6 +1456,27 @@ ui_require_jquery_file('bgiframe'); $("#id_group").blur (function () { $(this).css ("width", "180px"); }); + + // Reduce margins between table and pagination. + $('.dataTables_paginate.paging_simple_numbers').css('margin-top', 10); + $('.dataTables_paginate.paging_simple_numbers').css('margin-bottom', 10); + + // Change chevron for node icon. + let toggle = document.querySelectorAll('.toggle-inventory-nodo'); + let src = ''; + + toggle.forEach(img => { + img.parentElement.parentElement.style = 'cursor: pointer; border: 0'; + img.parentElement.previousElementSibling.src = src; + }); + + toggle.forEach(divParent => { + let div = divParent.parentElement.parentElement; + $(div).click(function (e) { + div.style = 'cursor: pointer; border: 0'; + div.firstChild.src = src; + }); + }); }); /* ]]> */ diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 66abd21c63..62984b4078 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -1,16 +1,32 @@ setIcon('icon'); + $menuOperation['monitoring']->setClass('menu'); + $menuOperation['monitoring']->setACL(['AR']); + $monitoringItems = []; + + // L1. Views. + $monitoringItems['views'] = new MenuItem(__('Views')); + $monitoringItems['views']->setIcon('icono'); + $monitoringItems['views']->setClass('submenu'); + $monitoringViewsItems = []; + + // L2. Tactical view. + $monitoringViewsItems['tacticalView'] = new MenuItem(__('Tactical view')); + $monitoringViewsItems['tacticalView']->setSec('view'); + $monitoringViewsItems['tacticalView']->setSec2('operation/agentes/tactical'); + $monitoringViewsItems['tacticalView']->setClass('submenu'); + + // L2. Group View. + $monitoringViewsItems['groupView'] = new MenuItem(__('Group view')); + $monitoringViewsItems['groupView']->setSec('view'); + $monitoringViewsItems['groupView']->setSec2('operation/agentes/group_view'); + $monitoringViewsItems['groupView']->setClass('submenu'); + + // L2. Tree View. + $monitoringViewsItems['treeView'] = new MenuItem(__('Tree view')); + $monitoringViewsItems['treeView']->setSec('view'); + $monitoringViewsItems['treeView']->setSec2('operation/tree'); + $monitoringViewsItems['treeView']->setClass('submenu'); + + // L2. Monitor detail. + $monitoringViewsItems['monitorDetail'] = new MenuItem(__('Monitor detail')); + $monitoringViewsItems['monitorDetail']->setSec('view'); + $monitoringViewsItems['monitorDetail']->setSec2('operation/agentes/status_monitor'); + $monitoringViewsItems['monitorDetail']->setClass('submenu'); + + // L2. Interface view. + $monitoringViewsItems['interfaceView'] = new MenuItem(__('Interface View')); + $monitoringViewsItems['interfaceView']->setSec('view'); + $monitoringViewsItems['interfaceView']->setSec2('operation/agentes/interface_view'); + $monitoringViewsItems['interfaceView']->setClass('submenu'); + + // L2. Enterprise Tag view. + $idTagView = 'tagView'; + $monitoringViewsItems[$idTagView] = enterprise_hook('tag_view_submenu', $idTagView); + + // L2. Alert detail view. + $monitoringViewsItems['alertDetail'] = new MenuItem(__('Alert Detail')); + $monitoringViewsItems['alertDetail']->setSec('view'); + $monitoringViewsItems['alertDetail']->setSec2('operation/agentes/alerts_status'); + $monitoringViewsItems['alertDetail']->setClass('submenu'); + + // L2. Heatmap view. + $monitoringViewsItems['heatmapView'] = new MenuItem(__('Heatmap view')); + $monitoringViewsItems['heatmapView']->setSec('view'); + $monitoringViewsItems['heatmapView']->setSec2('operation/heatmap'); + $monitoringViewsItems['heatmapView']->setClass('submenu'); + + $monitoringItems['views']->setSubmenu($monitoringViewsItems); + + // L1. Inventory. + $monitoringItems['inventory'] = new MenuItem(__('Inventory')); + $monitoringItems['inventory']->setSec('estado'); + $monitoringItems['inventory']->setSec2('enterprise/operation/inventory/inventory'); + $monitoringItems['inventory']->setClass('submenu'); + + // L1. Network. + $monitoringItems['network'] = new MenuItem(); + $monitoringItems['network']->setDisplay((bool) $config['activate_netflow'] === true); + $monitoringItems['network']->setText(__('Network')); + + // L2. Netflow explorer. + $monitoringNetworkItems['netflowExplorer'] = new MenuItem(); + $monitoringNetworkItems['netflowExplorer']->setText(__('Netflow Explorer')); + $monitoringNetworkItems['netflowExplorer']->setSec('network_traffic'); + $monitoringNetworkItems['netflowExplorer']->setSec2('operation/netflow/netflow_explorer'); + + // L2. Netflow Live view. + $monitoringNetworkItems['netflowLiveView'] = new MenuItem(); + $monitoringNetworkItems['netflowLiveView']->setText(__('Netflow Live View')); + $monitoringNetworkItems['netflowLiveView']->setSec('network_traffic'); + $monitoringNetworkItems['netflowLiveView']->setSec2('operation/netflow/nf_live_view'); + + // L2. Network usage map. + $monitoringNetworkItems['networkUsageMap'] = new MenuItem(); + $monitoringNetworkItems['networkUsageMap']->setText(__('Network usage map')); + $monitoringNetworkItems['networkUsageMap']->setSec('network_traffic'); + $monitoringNetworkItems['networkUsageMap']->setSec2('operation/network/network_usage_map'); + + $monitoringItems['network']->setSubmenu($monitoringNetworkItems); + + $menuOperation['monitoring']->setSubmenu($monitoringItems); + + // L0. Topology Maps. + $menuOperation['topologyMaps'] = new MenuItem(__('Topology Maps')); + $menuOperation['topologyMaps']->setIcon('icon'); + $menuOperation['topologyMaps']->setClass('menu'); + + $menuOperation['topologyMaps']->setSubmenu($topologyMapsItems); +*/ $access_console_node = !is_reporting_console_node(); if ($access_console_node === true) { @@ -173,7 +299,7 @@ if ($access_console_node === true) { if (check_acl($config['id_user'], 0, 'MR') || check_acl($config['id_user'], 0, 'MW') || check_acl($config['id_user'], 0, 'MM')) { // Network enterprise. $sub['operation/agentes/pandora_networkmap']['text'] = __('Network map'); - $sub['operation/agentes/pandora_networkmap']['id'] = 'Network map'; + $sub['operation/agentes/pandora_networkmap']['id'] = 'Network_map'; $sub['operation/agentes/pandora_networkmap']['refr'] = 0; } @@ -181,14 +307,21 @@ if ($access_console_node === true) { if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, 'VW') || check_acl($config['id_user'], 0, 'VM')) { + $url_visual_console = ''; if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) { // Visual console. $sub['godmode/reporting/map_builder']['text'] = __('Visual console'); - $sub['godmode/reporting/map_builder']['id'] = 'Visual console'; + $sub['godmode/reporting/map_builder']['id'] = 'Visual_console'; + $sub['godmode/reporting/map_builder']['type'] = 'direct'; + $sub['godmode/reporting/map_builder']['subtype'] = 'nolink'; + $url_visual_console = 'godmode/reporting/map_builder'; } else { // Visual console favorite. $sub['godmode/reporting/visual_console_favorite']['text'] = __('Visual console'); - $sub['godmode/reporting/visual_console_favorite']['id'] = 'Visual console'; + $sub['godmode/reporting/visual_console_favorite']['id'] = 'Visual_console'; + $sub['godmode/reporting/visual_console_favorite']['type'] = 'direct'; + $sub['godmode/reporting/visual_console_favorite']['subtype'] = 'nolink'; + $url_visual_console = 'godmode/reporting/visual_console_favorite'; } if ($config['vc_menu_items'] != 0) { @@ -215,6 +348,12 @@ if ($access_console_node === true) { $layouts = visual_map_get_user_layouts($config['id_user'], false, false, $returnAllGroups, true); $sub2 = []; + $sub2[$url_visual_console] = [ + 'text' => __('Visual console list'), + 'title' => __('Visual console list'), + 'refr' => 0, + ]; + if ($layouts === false) { $layouts = []; } else { @@ -238,15 +377,15 @@ if ($access_console_node === true) { $name = io_safe_output($layout['name']); - $sub2['operation/visual_console/render_view&id='.$layout['id']]['text'] = ui_print_truncate_text($name, MENU_SIZE_TEXT, false, true, false); - $sub2['operation/visual_console/render_view&id='.$layout['id']]['id'] = mb_substr($name, 0, 19); - $sub2['operation/visual_console/render_view&id='.$layout['id']]['title'] = $name; + $sub2['operation/visual_console/render_view&id='.$layout['id']]['text'] = ui_print_truncate_text($name, MENU_SIZE_TEXT, false, true, false); + $sub2['operation/visual_console/render_view&id='.$layout['id']]['id'] = mb_substr($name, 0, 19); + $sub2['operation/visual_console/render_view&id='.$layout['id']]['title'] = $name; if (!empty($config['vc_refr'])) { - $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = $config['vc_refr']; + $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = $config['vc_refr']; } else if (((int) get_parameter('refr', 0)) > 0) { - $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = (int) get_parameter('refr', 0); + $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = (int) get_parameter('refr', 0); } else { - $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = 0; + $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = 0; } } @@ -298,10 +437,10 @@ if ($access_console_node === true) { continue; } - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['text'] = ui_print_truncate_text(io_safe_output($gisMap['map_name']), MENU_SIZE_TEXT, false, true, false); - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['id'] = mb_substr(io_safe_output($gisMap['map_name']), 0, 15); - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['title'] = io_safe_output($gisMap['map_name']); - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['refr'] = 0; + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['text'] = ui_print_truncate_text(io_safe_output($gisMap['map_name']), MENU_SIZE_TEXT, false, true, false); + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['id'] = mb_substr(io_safe_output($gisMap['map_name']), 0, 15); + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['title'] = io_safe_output($gisMap['map_name']); + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['refr'] = 0; } $sub['gismaps']['sub2'] = $sub2; @@ -330,7 +469,7 @@ if ($access_console_node === true) { $sub = []; $sub['godmode/reporting/reporting_builder']['text'] = __('Custom reporting'); - $sub['godmode/reporting/reporting_builder']['id'] = 'Custom reporting'; + $sub['godmode/reporting/reporting_builder']['id'] = 'Custom_reporting'; // Set godomode path. $sub['godmode/reporting/reporting_builder']['subsecs'] = [ 'godmode/reporting/reporting_builder', @@ -339,7 +478,7 @@ if ($access_console_node === true) { $sub['godmode/reporting/graphs']['text'] = __('Custom graphs'); - $sub['godmode/reporting/graphs']['id'] = 'Custom graphs'; + $sub['godmode/reporting/graphs']['id'] = 'Custom_graphs'; // Set godomode path. $sub['godmode/reporting/graphs']['subsecs'] = [ 'operation/reporting/graph_viewer', @@ -354,10 +493,16 @@ if ($access_console_node === true) { $sub['operation/dashboard/dashboard']['id'] = 'Dashboard'; $sub['operation/dashboard/dashboard']['refr'] = 0; $sub['operation/dashboard/dashboard']['subsecs'] = ['operation/dashboard/dashboard']; + $sub['operation/dashboard/dashboard']['type'] = 'direct'; + $sub['operation/dashboard/dashboard']['subtype'] = 'nolink'; $dashboards = Manager::getDashboards(-1, -1, true); $sub2 = []; + $sub2['operation/dashboard/dashboard'] = [ + 'text' => __('Dashboard list'), + 'title' => __('Dashboard list'), + ]; foreach ($dashboards as $dashboard) { $name = io_safe_output($dashboard['name']); @@ -391,7 +536,7 @@ if ($access_console_node === true) { $sub = []; $sub['operation/events/events']['text'] = __('View events'); - $sub['operation/events/events']['id'] = 'View events'; + $sub['operation/events/events']['id'] = 'View_events'; $sub['operation/events/events']['pages'] = ['godmode/events/events']; // If ip doesn't is in list of allowed IP, isn't show this options. @@ -468,14 +613,16 @@ $menu_operation['workspace']['id'] = 'oper-users'; // ANY user can view him/herself ! // Users. +$query_paramameters_user = '&edit_user=1&pure=0&id_user='.$config['id_user']; + $sub = []; -$sub['operation/users/user_edit']['text'] = __('Edit my user'); -$sub['operation/users/user_edit']['id'] = 'Edit my user'; -$sub['operation/users/user_edit']['refr'] = 0; +$sub['godmode/users/configure_user'.$query_paramameters_user]['text'] = __('Edit my user'); +$sub['godmode/users/configure_user'.$query_paramameters_user]['id'] = 'Edit_my_user'; +$sub['godmode/users/configure_user'.$query_paramameters_user]['refr'] = 0; // Users. $sub['operation/users/user_edit_notifications']['text'] = __('Configure user notifications'); -$sub['operation/users/user_edit_notifications']['id'] = 'Configure user notifications'; +$sub['operation/users/user_edit_notifications']['id'] = 'Configure_user_notifications'; $sub['operation/users/user_edit_notifications']['refr'] = 0; if ($access_console_node === true) { @@ -509,7 +656,7 @@ if ($access_console_node === true) { $sub['message_list']['subtype'] = 'nolink'; $sub2 = []; $sub2['operation/messages/message_list']['text'] = __('Messages List'); - $sub2['operation/messages/message_edit&new_msg=1']['text'] = __('New message'); + $sub2['operation/messages/message_edit&new_msg=1']['text'] = __('New message'); $sub['message_list']['sub2'] = $sub2; } @@ -526,13 +673,13 @@ if ($access_console_node === true) { if (check_acl($config['id_user'], 0, 'RR') || check_acl($config['id_user'], 0, 'RW') || check_acl($config['id_user'], 0, 'RM')) { $sub['operation/agentes/exportdata']['text'] = __('Export data'); - $sub['operation/agentes/exportdata']['id'] = 'Export data'; + $sub['operation/agentes/exportdata']['id'] = 'Export_data'; $sub['operation/agentes/exportdata']['subsecs'] = ['operation/agentes/exportdata']; } if (check_acl($config['id_user'], 0, 'AR') || check_acl($config['id_user'], 0, 'AD') || check_acl($config['id_user'], 0, 'AW')) { $sub['godmode/agentes/planned_downtime.list']['text'] = __('Scheduled downtime'); - $sub['godmode/agentes/planned_downtime.list']['id'] = 'Scheduled downtime'; + $sub['godmode/agentes/planned_downtime.list']['id'] = 'Scheduled_downtime'; } foreach ($config['extensions'] as $extension) { @@ -562,7 +709,7 @@ if ($access_console_node === true) { } $sub[$extension_menu['sec2']]['text'] = $extension_menu['name']; - $sub[$extension_menu['sec2']]['id'] = $extension_menu['name']; + $sub[$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']); $sub[$extension_menu['sec2']]['refr'] = 0; } else { if (array_key_exists('fatherId', $extension_menu)) { @@ -571,7 +718,7 @@ if ($access_console_node === true) { if (array_key_exists('subfatherId', $extension_menu) && empty($extension_menu['subfatherId']) === false) { if ((strlen($extension_menu['subfatherId']) > 0)) { $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['text'] = __($extension_menu['name']); - $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = $extension_menu['name']; + $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']); $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['refr'] = 0; $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['icon'] = $extension_menu['icon']; $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['subfatherId']]['sub2'][$extension_menu['sec2']]['sec'] = 'extensions'; @@ -580,7 +727,7 @@ if ($access_console_node === true) { $menu_operation[$extension_menu['fatherId']]['hasExtensions'] = true; } else { $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']); - $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = $extension_menu['name']; + $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']); $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['refr'] = 0; $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['icon'] = $extension_menu['icon']; $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['sec'] = 'extensions'; @@ -590,7 +737,7 @@ if ($access_console_node === true) { } } else { $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['text'] = __($extension_menu['name']); - $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = $extension_menu['name']; + $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['id'] = str_replace(' ', '_', $extension_menu['name']); $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['refr'] = 0; $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['icon'] = $extension_menu['icon']; $menu_operation[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]['sec'] = 'extensions'; diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index bfbbcbbb37..105a9560de 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2022 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 @@ -81,11 +81,6 @@ $buttons['create_message'] = [ ).'', ]; -// Header. -if (is_metaconsole() === true) { - enterprise_hook('open_meta_frame'); -} - ui_print_standard_header( __('Compose message'), 'images/email_mc.png', @@ -198,24 +193,37 @@ if ($read_message) { html_print_input_hidden('orig_user', $message['id_usuario_destino']); echo ''; - echo "
"; - html_print_submit_button( - __('Delete conversation'), - 'delete_btn', - false, - 'form="delete_message" class="sub delete"' - ); - echo ' '; if (empty($message['id_usuario_origen']) !== true) { - html_print_submit_button( + $outputButtons .= html_print_submit_button( __('Reply'), 'reply', false, - 'form="reply_message" class="sub next"' + [ + 'icon' => 'next', + 'form' => 'reply_message', + ], + true ); } - echo '
'; + $outputButtons .= html_print_submit_button( + __('Delete conversation'), + 'delete_btn', + false, + [ + 'icon' => 'delete', + 'mode' => 'secondary', + 'form' => 'delete_message', + ], + true + ); + + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => $outputButtons, + ], + ); return; } @@ -391,12 +399,11 @@ html_print_table($table); html_print_div( [ 'class' => 'action-buttons', - 'style' => 'width: '.$table->width, 'content' => html_print_submit_button( __('Send message'), 'send_mes', false, - 'class="sub wand"', + [ 'icon' => 'wand' ], true ), ] @@ -404,6 +411,3 @@ html_print_div( echo ''; echo $jsOutput; -if (is_metaconsole() === true) { - enterprise_hook('close_meta_frame'); -} diff --git a/pandora_console/operation/messages/message_list.php b/pandora_console/operation/messages/message_list.php index a55dd28d87..7a8258aeff 100644 --- a/pandora_console/operation/messages/message_list.php +++ b/pandora_console/operation/messages/message_list.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2022 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 @@ -68,10 +68,6 @@ $buttons['create_message'] = [ ]; if (is_ajax() === false) { - if (is_metaconsole() === true) { - enterprise_hook('open_meta_frame'); - } - // Header. ui_print_standard_header( $tabSelectedMessage, @@ -266,7 +262,7 @@ if (empty($messages) === true) { ['prominent' => 'timestamp'] ); - $table->cellclass[][4] = 'action_buttons'; + $table->cellclass[][4] = 'table_action_buttons'; if ($show_sent === true) { $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; @@ -279,36 +275,51 @@ if (empty($messages) === true) { } } +$outputButton = html_print_submit_button( + __('Create message'), + 'create', + false, + [ + 'icon' => 'next', + 'form' => 'create_message_form', + ], + true +); + if (empty($messages) === false) { if ($show_sent === true) { - echo '
'; + echo ''; } else { - echo ''; + echo ''; } html_print_input_hidden('multiple_delete', 1); html_print_table($table); - echo "
"; - html_print_submit_button( - __('Delete'), - 'delete_btn', - false, - 'class="sub delete"' - ); - echo '
'; echo '
'; + + $outputButton .= html_print_submit_button( + __('Delete'), + 'delete_btn', + false, + [ + 'icon' => 'delete', + 'mode' => 'secondary', + 'form' => 'message_form', + ], + true + ); } -echo "
"; - echo '
'; - html_print_submit_button(__('Create message'), 'create', false, 'class="sub next mrgn_right_5px"'); - echo '
'; -echo '
'; + echo '
'; -if (is_ajax() !== true && is_metaconsole() === true) { - enterprise_hook('close_meta_frame'); -} -?> + html_print_div( + [ + 'class' => 'action-buttons', + 'content' => $outputButton, + ] + ); + + ?>