Changed radio buttons by checkbox switch

Former-commit-id: f0c64cecbf9e1197be08a9a95248d3b4ea8bd949
This commit is contained in:
manuel 2019-03-04 13:12:01 +01:00
parent 3ed6a2b089
commit 488be0d602
5 changed files with 65 additions and 53 deletions

View File

@ -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;

View File

@ -1,18 +1,23 @@
<?php
/**
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 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
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Warning: This file may be required into the metaconsole's setup
// Load global vars
global $config;
check_login();
@ -48,8 +53,7 @@ $table_enable->style['name'] = 'font-weight: bold';
// Enable eHorus
$row = [];
$row['name'] = __('Enable eHorus');
$row['control'] = __('Enabled').'&nbsp;'.html_print_radio_button('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'&nbsp;&nbsp;';
$row['control'] .= __('Disabled').'&nbsp;'.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();

View File

@ -1,17 +1,23 @@
<?php
/**
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login();
@ -269,12 +275,10 @@ $table->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').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('alias_as_name', 1, '', $config['alias_as_name'], true).'&nbsp;&nbsp;';
$table->data[38][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.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').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('unique_ip', 1, '', $config['unique_ip'], true).'&nbsp;&nbsp;';
$table->data[39][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.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 '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';

View File

@ -1,16 +1,23 @@
<?php
/**
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 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
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once 'include/functions_ui.php';
@ -55,21 +62,19 @@ $table->data[5][0] = '<b>'.__('Maximum chart resolution').'</b>'.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] = '<b>'.__('Disable custom live view filters').'</b>'.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').'&nbsp;&nbsp;'.html_print_radio_button('netflow_disable_custom_lvfilters', 1, '', $config['netflow_disable_custom_lvfilters'], true).'&nbsp;&nbsp;&nbsp;';
$table->data[6][1] .= __('No').'&nbsp;&nbsp;'.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] = '<b>'.__('Netflow max lifetime').'</b>'.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] = '<b>'.__('Name resolution for IP address').'</b>'.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').'&nbsp;&nbsp;'.html_print_radio_button_extended('netflow_get_ip_hostname', 1, '', $config['netflow_get_ip_hostname'], false, $onclick, '', true).'&nbsp;&nbsp;&nbsp;';
$table->data[8][1] .= __('No').'&nbsp;&nbsp;'.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 '<form id="netflow_setup" method="post">';
html_print_table($table);
// Update button
// Update button.
echo '<div class="action-buttons" style="width:100%;">';
html_print_input_hidden('update_config', 1);
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');

View File

@ -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');
});