From 488be0d602a858eff96dbe6382fcbe7510fd12af Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 4 Mar 2019 13:12:01 +0100 Subject: [PATCH 1/2] Changed radio buttons by checkbox switch Former-commit-id: f0c64cecbf9e1197be08a9a95248d3b4ea8bd949 --- pandora_console/godmode/setup/setup_auth.php | 1 - .../godmode/setup/setup_ehorus.php | 36 ++++++++++-------- .../godmode/setup/setup_general.php | 36 ++++++++++-------- .../godmode/setup/setup_netflow.php | 37 +++++++++++-------- .../godmode/setup/setup_visuals.php | 8 ++-- 5 files changed, 65 insertions(+), 53 deletions(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index cdb75816cc..ac9f706e41 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -134,7 +134,6 @@ if (is_ajax()) { set_unless_defined($config['double_auth_enabled'], false); $row = []; $row['name'] = __('Double authentication').ui_print_help_tip(__('If this option is enabled, the users can use double authentication with their accounts'), true); - $row['control'] = html_print_input_hidden('double_auth_enabled', 0); $row['control'] .= html_print_checkbox_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true); $table->data['double_auth_enabled'] = $row; diff --git a/pandora_console/godmode/setup/setup_ehorus.php b/pandora_console/godmode/setup/setup_ehorus.php index f51854a63c..0274767cff 100644 --- a/pandora_console/godmode/setup/setup_ehorus.php +++ b/pandora_console/godmode/setup/setup_ehorus.php @@ -1,18 +1,23 @@ style['name'] = 'font-weight: bold'; // Enable eHorus $row = []; $row['name'] = __('Enable eHorus'); -$row['control'] = __('Enabled').' '.html_print_radio_button('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'  '; -$row['control'] .= __('Disabled').' '.html_print_radio_button('ehorus_enabled', 0, '', $config['ehorus_enabled'], true); +$row['control'] = html_print_checkbox_switch('ehorus_enabled', false, $config['ehorus_enabled'], true); $row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true); $table_enable->data['ehorus_enabled'] = $row; @@ -169,7 +173,7 @@ if ($config['ehorus_enabled']) { if (event.target.value == '1') showFields(); else hideFields(); } - $('input:radio[name="ehorus_enabled"]').change(handleEnable); + $('input:checkbox[name="ehorus_enabled"]').change(handleEnable); var handleTest = function (event) { var user = $('input#text-ehorus_user').val(); diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 8f07d3d88d..370df5d808 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -1,17 +1,23 @@ data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory $table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true); $table->data[38][0] = __('Set alias as name by default in agent creation'); -$table->data[38][1] = __('Yes').'   '.html_print_radio_button('alias_as_name', 1, '', $config['alias_as_name'], true).'  '; -$table->data[38][1] .= __('No').'   '.html_print_radio_button('alias_as_name', 0, '', $config['alias_as_name'], true); +$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true); $table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true); -$table->data[39][1] = __('Yes').'   '.html_print_radio_button('unique_ip', 1, '', $config['unique_ip'], true).'  '; -$table->data[39][1] .= __('No').'   '.html_print_radio_button('unique_ip', 0, '', $config['unique_ip'], true); +$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true); echo '
'; diff --git a/pandora_console/godmode/setup/setup_netflow.php b/pandora_console/godmode/setup/setup_netflow.php index 1b62a23810..0b2cddbc25 100644 --- a/pandora_console/godmode/setup/setup_netflow.php +++ b/pandora_console/godmode/setup/setup_netflow.php @@ -1,16 +1,23 @@ data[5][0] = ''.__('Maximum chart resolution').''.ui_print_help_t $table->data[5][1] = html_print_input_text('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true); $table->data[6][0] = ''.__('Disable custom live view filters').''.ui_print_help_tip(__('Disable the definition of custom filters in the live view. Only existing filters can be used.'), true); -$table->data[6][1] = __('Yes').'  '.html_print_radio_button('netflow_disable_custom_lvfilters', 1, '', $config['netflow_disable_custom_lvfilters'], true).'   '; -$table->data[6][1] .= __('No').'  '.html_print_radio_button('netflow_disable_custom_lvfilters', 0, '', $config['netflow_disable_custom_lvfilters'], true); +$table->data[6][1] = html_print_checkbox_switch('netflow_disable_custom_lvfilters', 1, $config['netflow_disable_custom_lvfilters'], true); $table->data[7][0] = ''.__('Netflow max lifetime').''.ui_print_help_tip(__('Sets the maximum lifetime for netflow data in days.'), true); $table->data[7][1] = html_print_input_text('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true); $table->data[8][0] = ''.__('Name resolution for IP address').''.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true); $onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;"; -$table->data[8][1] = __('Yes').'  '.html_print_radio_button_extended('netflow_get_ip_hostname', 1, '', $config['netflow_get_ip_hostname'], false, $onclick, '', true).'   '; -$table->data[8][1] .= __('No').'  '.html_print_radio_button('netflow_get_ip_hostname', 0, '', $config['netflow_get_ip_hostname'], true); +$table->data[8][1] = html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true); echo ''; html_print_table($table); -// Update button +// Update button. echo '
'; html_print_input_hidden('update_config', 1); html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"'); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 85047cd488..2a8cf22d8d 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -961,7 +961,7 @@ $table_other->data[$row][0] = __('Custom report front page').ui_print_help_tip( __('Custom report front page. It will be applied to all reports and templates by default.'), true ); -$table_other->data[$row][1] = html_print_checkbox( +$table_other->data[$row][1] = html_print_checkbox_switch( 'custom_report_front', 1, $config['custom_report_front'], @@ -1435,12 +1435,12 @@ $(document).ready (function () { // Juanma (06/05/2014) New feature: Custom front page for reports var custom_report = $('#checkbox-custom_report_front') .prop('checked'); - display_custom_report_front(custom_report,$('#checkbox-custom_report_front').parent().parent().parent().parent().attr('id')); + display_custom_report_front(custom_report,$('#checkbox-custom_report_front').parent().parent().parent().parent().parent().attr('id')); - $("#checkbox-custom_report_front").click( function() { + $("#checkbox-custom_report_front").change( function() { var custom_report = $('#checkbox-custom_report_front') .prop('checked'); - display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().attr('id')); + display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().parent().attr('id')); }); $(".databox.filters").css('margin-bottom','-10px'); }); From ccb669a204967d6cd72607c998eaebfe4d609bc5 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 11 Mar 2019 09:37:08 +0100 Subject: [PATCH 2/2] Fixed minor errors in setup_ehorus Former-commit-id: ed0ba17641714a87446b4db88d933d7b176e531e --- .../godmode/setup/setup_ehorus.php | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/pandora_console/godmode/setup/setup_ehorus.php b/pandora_console/godmode/setup/setup_ehorus.php index 0274767cff..fc2ebd3d3a 100644 --- a/pandora_console/godmode/setup/setup_ehorus.php +++ b/pandora_console/godmode/setup/setup_ehorus.php @@ -28,7 +28,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user return; } -// Check custom field +// Check custom field. $custom_field = db_get_value('name', 'tagent_custom_fields', 'name', $config['ehorus_custom_field']); $custom_field_exists = !empty($custom_field); $custom_field_created = null; @@ -41,7 +41,7 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) { $custom_field_exists = $custom_field_created = $result; } -// Enable table +// Enable table. $table_enable = new StdClass(); $table_enable->data = []; $table_enable->width = '100%'; @@ -50,14 +50,13 @@ $table_enable->class = 'databox filters'; $table_enable->size['name'] = '30%'; $table_enable->style['name'] = 'font-weight: bold'; -// Enable eHorus +// Enable eHorus. $row = []; $row['name'] = __('Enable eHorus'); -$row['control'] = html_print_checkbox_switch('ehorus_enabled', false, $config['ehorus_enabled'], true); -$row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true); +$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true); $table_enable->data['ehorus_enabled'] = $row; -// Remote config table +// Remote config table. $table_remote = new StdClass(); $table_remote->data = []; $table_remote->width = '100%'; @@ -67,40 +66,40 @@ $table_remote->class = 'databox filters'; $table_remote->size['name'] = '30%'; $table_remote->style['name'] = 'font-weight: bold'; -// User +// User. $row = []; $row['name'] = __('User'); $row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true); $table_remote->data['ehorus_user'] = $row; -// Pass +// Pass. $row = []; $row['name'] = __('Password'); $row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true); $table_remote->data['ehorus_pass'] = $row; -// Directory hostname +// Directory hostname. $row = []; $row['name'] = __('API Hostname'); $row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true); $row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API').'. '.__('Without protocol and port').'. '.__('e.g., portal.ehorus.com'), true); $table_remote->data['ehorus_hostname'] = $row; -// Directory port +// Directory port. $row = []; $row['name'] = __('API Port'); $row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true); $row['control'] .= ui_print_help_tip(__('e.g., 18080'), true); $table_remote->data['ehorus_port'] = $row; -// Request timeout +// Request timeout. $row = []; $row['name'] = __('Request timeout'); $row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true); $row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the eHorus API').'. '.__('0 to disable'), true); $table_remote->data['ehorus_req_timeout'] = $row; -// Test +// Test. $row = []; $row['name'] = __('Test'); $row['control'] = html_print_button(__('Start'), 'test-ehorus', false, '', 'class="sub next"', true); @@ -110,7 +109,7 @@ $row['control'] .= '