From 122f45fcaad0c03049b3a0c715a889dc394c510b Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Thu, 23 Mar 2023 17:44:04 +0100 Subject: [PATCH] Metasetup --- pandora_console/godmode/setup/gis.php | 14 +- .../godmode/setup/setup_integria.php | 384 ++++++++++-------- .../update_manager/update_manager.history.php | 5 +- .../update_manager/update_manager.setup.php | 187 +++++---- .../include/functions_filemanager.php | 6 +- pandora_console/include/functions_html.php | 9 +- 6 files changed, 333 insertions(+), 272 deletions(-) diff --git a/pandora_console/godmode/setup/gis.php b/pandora_console/godmode/setup/gis.php index 57edc19f5c..3838345360 100755 --- a/pandora_console/godmode/setup/gis.php +++ b/pandora_console/godmode/setup/gis.php @@ -65,7 +65,7 @@ switch ($action) { $table = new stdClass(); $table->class = 'info_table'; -$table->width = '98%'; +$table->width = '100%'; $table->head[0] = __('Map connection name'); $table->head[1] = __('Group'); $table->head[3] = __('Delete'); @@ -84,7 +84,7 @@ if ($mapsConnections !== false) { ''.$mapsConnection['conection_name'].'', ui_print_group_icon($mapsConnection['group_id'], true), ''.html_print_image('images/delete.svg', true, ['class' => 'invert_filter']).'', + onClick="javascript: if (!confirm(\''.__('Do you wan delete this connection?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'invert_filter main_menu_icon']).'', ]; $table->cellclass[][2] = 'table_action_buttons'; } @@ -95,6 +95,14 @@ html_print_table($table); echo '
'; echo '
'; html_print_input_hidden('action', 'create_connection_map'); -html_print_submit_button(__('Create'), '', false, 'class="sub next"'); +html_print_action_buttons( + html_print_submit_button( + __('Create'), + '', + false, + ['icon' => 'wand'], + true + ) +); echo '
'; echo '
'; diff --git a/pandora_console/godmode/setup/setup_integria.php b/pandora_console/godmode/setup/setup_integria.php index 9b4770471c..f96391c233 100644 --- a/pandora_console/godmode/setup/setup_integria.php +++ b/pandora_console/godmode/setup/setup_integria.php @@ -386,120 +386,132 @@ $table_alert_settings->data = []; $table_alert_settings->width = '100%'; $table_alert_settings->styleTable = 'margin-bottom: 10px;'; $table_alert_settings->id = 'integria-cr-settings-setup'; -$table_alert_settings->class = 'databox filters'; -$table_alert_settings->size['name'] = '30%'; -$table_alert_settings->style['name'] = 'font-weight: bold'; +$table_alert_settings->class = 'databox filters filter-table-adv'; +$table_alert_settings->size[0] = '50%'; +$table_alert_settings->size[1] = '50%'; // Alert incident title. $row = []; -$row['name'] = __('Title'); -$row['control'] = html_print_input_text( - 'incident_title', - $config['incident_title'], - __('Name'), - 50, - 100, - true, - false, - false +$row[0] = html_print_label_input_block( + __('Title'), + html_print_input_text( + 'incident_title', + $config['incident_title'], + __('Name'), + 50, + 100, + true, + false, + false + ) ); -$table_alert_settings->data['custom_response_incident_title'] = $row; // Alert incident description. -$row = []; -$row['name'] = __('Ticket body'); -$row['control'] = html_print_textarea( - 'incident_content', - 7, - 25, - $config['incident_content'], - '', - true +$row[1] = html_print_label_input_block( + __('Ticket body'), + html_print_textarea( + 'incident_content', + 3, + 25, + $config['incident_content'], + '', + true + ) ); -$table_alert_settings->data['custom_response_incident_content'] = $row; +$table_alert_settings->data[0] = $row; // Alert default group. $row = []; -$row['name'] = __('Group'); -$row['control'] = html_print_select( - $integria_group_values, - 'default_group', - $config['default_group'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[0] = html_print_label_input_block( + __('Group'), + html_print_select( + $integria_group_values, + 'default_group', + $config['default_group'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_alert_settings->data['custom_response_def_group'] = $row; // Alert default criticity. -$row = []; -$row['name'] = __('Priority'); -$row['control'] = html_print_select( - $integria_criticity_values, - 'default_criticity', - $config['default_criticity'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[1] = html_print_label_input_block( + __('Priority'), + html_print_select( + $integria_criticity_values, + 'default_criticity', + $config['default_criticity'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_alert_settings->data['custom_response_def_criticity'] = $row; +$table_alert_settings->data[1] = $row; // Alert default owner. $row = []; -$row['name'] = __('Owner'); -$row['control'] = html_print_autocomplete_users_from_integria( - 'default_owner', - $config['default_owner'], - true +$row[0] = html_print_label_input_block( + __('Owner'), + html_print_autocomplete_users_from_integria( + 'default_owner', + $config['default_owner'], + true, + '30', + false, + false, + 'w100p' + ), + ['div_class' => 'inline'] ); -$table_alert_settings->data['custom_response_def_owner'] = $row; - // Alert default incident type. -$row = []; -$row['name'] = __('Type'); -$row['control'] = html_print_select( - $integria_types_values, - 'incident_type', - $config['incident_type'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[1] = html_print_label_input_block( + __('Type'), + html_print_select( + $integria_types_values, + 'incident_type', + $config['incident_type'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_alert_settings->data['custom_response_incident_type'] = $row; +$table_alert_settings->data[2] = $row; // Alert default incident status. $row = []; -$row['name'] = __('Status'); -$row['control'] = html_print_select( - $integria_status_values, - 'incident_status', - $config['incident_status'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[0] = html_print_label_input_block( + __('Status'), + html_print_select( + $integria_status_values, + 'incident_status', + $config['incident_status'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_alert_settings->data['custom_response_incident_status'] = $row; +$table_alert_settings->data[3] = $row; // Custom response settings. $table_cr_settings = new StdClass(); @@ -507,121 +519,133 @@ $table_cr_settings->data = []; $table_cr_settings->width = '100%'; $table_cr_settings->styleTable = 'margin-bottom: 10px;'; $table_cr_settings->id = 'integria-cr-settings-setup'; -$table_cr_settings->class = 'databox filters'; -$table_cr_settings->size['name'] = '30%'; -$table_cr_settings->style['name'] = 'font-weight: bold'; +$table_cr_settings->class = 'databox filters filter-table-adv'; +$table_cr_settings->size[0] = '50%'; +$table_cr_settings->size[1] = '50%'; // Custom response incident title. $row = []; -$row['name'] = __('Title'); -$row['control'] = html_print_input_text( - 'cr_incident_title', - $config['cr_incident_title'], - __('Name'), - 50, - 100, - true, - false, - false +$row[0] = html_print_label_input_block( + __('Title'), + html_print_input_text( + 'cr_incident_title', + $config['cr_incident_title'], + __('Name'), + 50, + 100, + true, + false, + false + ) ); -$table_cr_settings->data['custom_response_incident_title'] = $row; // Custom response incident description. -$row = []; -$row['name'] = __('Ticket body'); -$row['control'] = html_print_textarea( - 'cr_incident_content', - 7, - 25, - $config['cr_incident_content'], - '', - true +$row[1] = html_print_label_input_block( + __('Ticket body'), + html_print_textarea( + 'cr_incident_content', + 3, + 25, + $config['cr_incident_content'], + '', + true + ) ); -$table_cr_settings->data['custom_response_incident_content'] = $row; +$table_cr_settings->data[0] = $row; // Custom response default group. $row = []; -$row['name'] = __('Group'); -$row['control'] = html_print_select( - $integria_group_values, - 'cr_default_group', - $config['cr_default_group'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[0] = html_print_label_input_block( + __('Group'), + html_print_select( + $integria_group_values, + 'cr_default_group', + $config['cr_default_group'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_cr_settings->data['custom_response_def_group'] = $row; // Custom response default criticity. -$row = []; -$row['name'] = __('Priority'); -$row['control'] = html_print_select( - $integria_criticity_values, - 'cr_default_criticity', - $config['cr_default_criticity'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[1] = html_print_label_input_block( + __('Priority'), + html_print_select( + $integria_criticity_values, + 'cr_default_criticity', + $config['cr_default_criticity'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_cr_settings->data['custom_response_def_criticity'] = $row; +$table_cr_settings->data[1] = $row; // Custom response default owner. $row = []; -$row['name'] = __('Owner'); -$row['control'] = html_print_autocomplete_users_from_integria( - 'cr_default_owner', - $config['cr_default_owner'], - true +$row[0] = html_print_label_input_block( + __('Owner'), + html_print_autocomplete_users_from_integria( + 'cr_default_owner', + $config['cr_default_owner'], + true, + '30', + false, + false, + 'w100p' + ), + ['div_class' => 'inline'] ); -$table_cr_settings->data['custom_response_def_owner'] = $row; - // Custom response default incident type. -$row = []; -$row['name'] = __('Type'); -$row['control'] = html_print_select( - $integria_types_values, - 'cr_incident_type', - $config['cr_incident_type'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[1] = html_print_label_input_block( + __('Type'), + html_print_select( + $integria_types_values, + 'cr_incident_type', + $config['cr_incident_type'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_cr_settings->data['custom_response_incident_type'] = $row; +$table_cr_settings->data[2] = $row; // Custom response default incident status. $row = []; -$row['name'] = __('Status'); -$row['control'] = html_print_select( - $integria_status_values, - 'cr_incident_status', - $config['cr_incident_status'], - '', - __('Select'), - 0, - true, - false, - true, - '', - false +$row[0] = html_print_label_input_block( + __('Status'), + html_print_select( + $integria_status_values, + 'cr_incident_status', + $config['cr_incident_status'], + '', + __('Select'), + 0, + true, + false, + true, + '', + false + ) ); -$table_cr_settings->data['custom_response_incident_status'] = $row; +$table_cr_settings->data[3] = $row; // Test. $row = []; @@ -682,7 +706,7 @@ echo ''; if ($has_connection != false) { // Form alert default settings. echo '
'; - echo '
'; + echo '
'; echo ''.__('Alert default values').' '.ui_print_help_icon('alert_macros', true).''; html_print_table($table_alert_settings); @@ -692,7 +716,7 @@ if ($has_connection != false) { // Form custom response default settings. echo '
'; - echo '
'; + echo '
'; echo ''.__('Event custom response default values').' '.ui_print_help_icon('alert_macros', true).''; html_print_table($table_cr_settings); diff --git a/pandora_console/godmode/update_manager/update_manager.history.php b/pandora_console/godmode/update_manager/update_manager.history.php index 84e1d57897..e4350a3902 100644 --- a/pandora_console/godmode/update_manager/update_manager.history.php +++ b/pandora_console/godmode/update_manager/update_manager.history.php @@ -50,7 +50,7 @@ try { [ 'id' => $tableId, 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => 'include/ajax/update_manager', @@ -66,12 +66,13 @@ try { [ 'label' => __('Free search'), 'type' => 'text', - 'class' => 'mw250px', + 'class' => 'w400px', 'id' => 'free_search', 'name' => 'free_search', ], ], ], + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ', ] ); } catch (Exception $e) { diff --git a/pandora_console/godmode/update_manager/update_manager.setup.php b/pandora_console/godmode/update_manager/update_manager.setup.php index e3ca9f4958..d0faaa92f6 100644 --- a/pandora_console/godmode/update_manager/update_manager.setup.php +++ b/pandora_console/godmode/update_manager/update_manager.setup.php @@ -256,133 +256,158 @@ if ((bool) is_metaconsole() === true) { ); } -echo '
'; +echo ''; html_print_input_hidden('update_config', 1); $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; - -$i = 0; -$table->style[$i] = 'font-weight: bolder;width:250px'; +$table->class = 'databox filters filter-table-adv'; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $url_update_manager = update_manager_get_url(); -$table->data[$i][0] = __('Warp Update URL'); -$table->data[$i++][1] = html_print_input_text( - 'url_update_manager', - $url_update_manager, - __('URL update manager'), - 80, - 255, - true, - true +$table->data[0][0] = html_print_label_input_block( + __('Warp Update URL'), + html_print_input_text( + 'url_update_manager', + $url_update_manager, + __('URL update manager'), + 80, + 255, + true, + true + ) ); -$table->data[$i][0] = __('Use secured Warp Update'); -$table->data[$i++][1] = html_print_input( - [ - 'type' => 'switch', - 'name' => 'secure_update_manager', - 'value' => ($secure_update_manager ?? 1), - ] +$table->data[0][1] = html_print_label_input_block( + __('Use secured Warp Update'), + html_print_input( + [ + 'type' => 'switch', + 'name' => 'secure_update_manager', + 'value' => ($secure_update_manager ?? 1), + ] + ) ); -$table->data[$i][0] = __('Proxy server'); -$table->data[$i++][1] = html_print_input_text( - 'update_manager_proxy_server', - $update_manager_proxy_server, +$table->data[1][0] = html_print_label_input_block( __('Proxy server'), - 80, - 60, - true + html_print_input_text( + 'update_manager_proxy_server', + $update_manager_proxy_server, + __('Proxy server'), + 80, + 60, + true + ) ); -$table->data[$i][0] = __('Proxy port'); -$table->data[$i++][1] = html_print_input_text( - 'update_manager_proxy_port', - $update_manager_proxy_port, +$table->data[1][1] = html_print_label_input_block( __('Proxy port'), - 80, - 60, - true + html_print_input_text( + 'update_manager_proxy_port', + $update_manager_proxy_port, + __('Proxy port'), + 80, + 60, + true + ) ); -$table->data[$i][0] = __('Proxy user'); -$table->data[$i++][1] = html_print_input_text( - 'update_manager_proxy_user', - $update_manager_proxy_user, +$table->data[2][0] = html_print_label_input_block( __('Proxy user'), - 80, - 60, - true + html_print_input_text( + 'update_manager_proxy_user', + $update_manager_proxy_user, + __('Proxy user'), + 80, + 60, + true + ) ); -$table->data[$i][0] = __('Proxy password'); -$table->data[$i++][1] = html_print_input_password( - 'update_manager_proxy_password', - $update_manager_proxy_password, +$table->data[2][1] = html_print_label_input_block( __('Proxy password'), - 80, - 60, - true + html_print_input_password( + 'update_manager_proxy_password', + $update_manager_proxy_password, + __('Proxy password'), + 80, + 60, + true + ) ); -$table->data[$i][0] = __('Allow no-consecutive patches'); -$table->data[$i++][1] = html_print_switch( - [ - 'name' => 'allow_offline_patches', - 'value' => $allow_offline_patches, - 'return' => true, - ] +$table->data[3][0] = html_print_label_input_block( + __('Allow no-consecutive patches'), + html_print_switch( + [ + 'name' => 'allow_offline_patches', + 'value' => $allow_offline_patches, + 'return' => true, + ] + ) ); -$table->data[$i][0] = __('Limit to LTS updates'); -$table->data[$i++][1] = html_print_switch( - [ - 'name' => 'lts_updates', - 'value' => $lts_updates, - 'return' => true, - ] +$table->data[3][1] = html_print_label_input_block( + __('Limit to LTS updates'), + html_print_switch( + [ + 'name' => 'lts_updates', + 'value' => $lts_updates, + 'return' => true, + ] + ) ); - -$table->data[$i][0] = __('Registration ID'); -$table->data[$i++][1] = ''.($config['pandora_uid'] ?? __('Not registred yet')).''; +$table->data[4][0] = html_print_label_input_block( + __('Registration ID'), + ''.($config['pandora_uid'] ?? __('Not registred yet')).'' +); if (update_manager_verify_registration() === true && users_is_admin()) { - $table->data[$i][0] = __('Cancel registration'); - $table->data[$i][1] = 'data[$i][1] .= ui_get_full_url( + $url .= ui_get_full_url( 'index.php?sec=advanced&sec2=advanced/metasetup&pure=0&tab=update_manager_setup&um_disconnect_console=1' ); } else { - $table->data[$i][1] .= ui_get_full_url( + $url .= ui_get_full_url( 'index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=setup&um_disconnect_console=1' ); } - $table->data[$i++][1] .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').''; + $url .= '" onclick="if(confirm(\'Are you sure?\')) {return true;} else { return false; }">'.__('Unregister').''; + + $table->data[4][1] = html_print_label_input_block( + __('Cancel registration'), + $url + ); } if (license_free()) { $config['identification_reminder'] = isset($config['identification_reminder']) ? $config['identification_reminder'] : 1; - $table->data[$i][0] = __('%s community reminder', get_product_name()).ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this %s instance', get_product_name()), true); - $table->data[$i][1] = __('Yes').'   '.html_print_radio_button('identification_reminder', 1, '', $config['identification_reminder'], true).'  '; - $table->data[$i++][1] .= __('No').'   '.html_print_radio_button('identification_reminder', 0, '', $config['identification_reminder'], true); + + $table->data[4][1] = html_print_label_input_block( + __('%s community reminder', get_product_name()).ui_print_help_tip(__('Every 8 days, a message is displayed to admin users to remember to register this %s instance', get_product_name()), true), + '
+ '.__('Yes').html_print_radio_button('realtimestats', 1, '', $config['realtimestats'], true).'   + '.__('No').html_print_radio_button('realtimestats', 0, '', $config['realtimestats'], true).'
' + ); } html_print_input_hidden('action_update_url_update_manager', 1); html_print_input_hidden('update_config', 1); html_print_table($table); -echo '
'; -html_print_submit_button( - __('Update'), - 'update_button', - false, - 'class="sub upd"' +html_print_action_buttons( + html_print_submit_button( + __('Update'), + 'update_button', + false, + ['icon' => 'wand'], + true + ) ); -echo '
'; echo '
'; diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 0012804398..66f60967c7 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -626,7 +626,7 @@ function filemanager_file_explorer( $table->width = '100%'; $table->id = 'table_filemanager'; - $table->class = (is_metaconsole() === true) ? 'databox_tactical' : 'info_table'; + $table->class = 'info_table'; $table->title = ''.__('Index of %s', $relative_directory).''; $table->colspan = []; $table->data = []; @@ -751,7 +751,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); @@ -896,7 +896,7 @@ function filemanager_file_explorer( $uploadFileElements .= html_print_input_hidden('upload_file', 1, true); } - $uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, [ 'class' => 'submitButton', 'style' => 'float:right', 'icon' => 'next'], true); + $uploadFileElements .= html_print_submit_button(__('Go'), 'go', false, [ 'class' => 'submitButton', 'style' => 'float:right; margin-top: 10px;', '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); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index c475a44207..ee9fba264a 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4787,13 +4787,16 @@ function html_print_input_file($name, $return=false, $options=false) if (isset($options['accept']) === true) { $output .= ' accept="'.$options['accept'].'"'; } + + $label = ''; + if (isset($options['label']) === true) { + $label = $options['label']; + } } // Close input. $output .= '/>'; - if (is_metaconsole() === false) { - $output .= ($options['caption'] ?? __('Select a file')); - } + $output .= ($options['caption'] ?? __('Select a file')); $output .= ''; $output .= ' ';