diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 08a656c69f..092f0925c7 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230315 +Version: 7.0NG.769-230316 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 5218fc92cc..d71a7b978b 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230315" +pandora_version="7.0NG.769-230316" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 07f62b6c54..539b2e24a6 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230315'; +use constant AGENT_BUILD => '230316'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index e41ed8c290..468ec39656 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230315 +%define release 230316 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index ca32dc789f..628a9064a0 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230315 +%define release 230316 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 8107c738db..623e85f1cf 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230315" +PI_BUILD="230316" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 86c9cf1820..89d354f968 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230315} +{230316} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6120e75fe4..43ade1d81d 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230315") +#define PANDORA_VERSION ("7.0NG.769 Build 230316") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index cc42f22709..dadfdba481 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230315))" + VALUE "ProductVersion", "(7.0NG.769(Build 230316))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index aa3dd4d6cc..f808e5048e 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230315 +Version: 7.0NG.769-230316 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index d51774a6b6..84d810cbb3 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230315" +pandora_version="7.0NG.769-230316" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index d19d3587c6..90c7403847 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.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,6 +26,8 @@ * ============================================================================ */ +use function PHPSTORM_META\map; + // File begin. global $config; @@ -47,153 +49,17 @@ if (is_ajax()) { exit(); } -$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control'])); - -$table = new StdClass(); -$table->class = 'databox filters'; -$table->id = 'setup_general'; -$table->width = '100%'; -$table->data = []; -$table->size = []; -$table->size[0] = '30%'; -$table->style[0] = 'font-weight:bold'; -$table->size[1] = '70%'; - -$table_mail_conf = new stdClass(); -$table_mail_conf->width = '100%'; -$table_mail_conf->class = 'databox filters'; -$table_mail_conf->data = []; -$table_mail_conf->style[0] = 'font-weight: bold'; - -// Current config["language"] could be set by user, not taken from global setup ! -$current_system_lang = db_get_sql( - 'SELECT `value` FROM tconfig WHERE `token` = "language"' -); - -if ($current_system_lang == '') { - $current_system_lang = 'en'; -} - -$i = 0; - -$table->data[$i][0] = __('Language code'); -$table->data[$i++][1] = html_print_select_from_sql( - 'SELECT id_language, name FROM tlanguage', - 'language', - $current_system_lang, - '', - '', - '', - true -); - -$table->data[$i][0] = __('Remote config directory'); -$table->data[$i++][1] = html_print_input_text( - 'remote_config', - io_safe_output($config['remote_config']), - '', - 30, - 100, - true -); - -$table->data[$i][0] = __('Chromium path'); -$table->data[$i++][1] = html_print_input_text( - 'chromium_path', - io_safe_output( - $config['chromium_path'] - ), - '', - 30, - 100, - true -); - -$table->data[$i][0] = __('Auto login (hash) password'); -$table->data[$i][1] = html_print_input_password( - 'loginhash_pwd', - io_output_password($config['loginhash_pwd']), - '', - 15, - 15, - true -); -$table->data[$i++][1] .= ui_print_reveal_password( - 'loginhash_pwd', - true -); - -$table->data[$i][0] = __('Time source'); -$sources['system'] = __('System'); -$sources['sql'] = __('Database'); -$table->data[$i++][1] = html_print_select( - $sources, - 'timesource', - $config['timesource'], - '', - '', - '', - true -); - -$table->data[$i][0] = __('Automatic check for updates'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'autoupdate', - 1, - $config['autoupdate'], - true -); - echo "'; -$table->data[$i][0] = __('Enforce https'); -$table->data[$i++][1] = html_print_checkbox_switch_extended( - 'https', - 1, - $config['https'], - false, - '', - '', - true -); +$performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control'])); +$sources = []; +$sources['system'] = __('System'); +$sources['sql'] = __('Database'); -$table->data[$i][0] = __('Use cert of SSL'); -$table->data[$i++][1] = html_print_checkbox_switch_extended( - 'use_cert', - 1, - $config['use_cert'], - false, - '', - '', - true -); - -$table->rowstyle[$i] = 'display: none;'; -$table->rowid[$i] = 'ssl-path-tr'; -$table->data[$i][0] = __('Path of SSL Cert.'); -$table->data[$i++][1] = html_print_input_text( - 'cert_path', - io_safe_output($config['cert_path']), - '', - 50, - 255, - true -); - -$table->data[$i][0] = __('Attachment store'); -$table->data[$i++][1] = html_print_input_text( - 'attachment_store', - io_safe_output($config['attachment_store']), - '', - 50, - 255, - true -); - -$table->data[$i][0] = __('IP list with API access'); -if (isset($_POST['list_ACL_IPs_for_API'])) { +// ACL Ips for API. +if (isset($_POST['list_ACL_IPs_for_API']) === true) { $list_ACL_IPs_for_API = get_parameter_post('list_ACL_IPs_for_API'); } else { $list_ACL_IPs_for_API = get_parameter_get( @@ -202,51 +68,14 @@ if (isset($_POST['list_ACL_IPs_for_API'])) { ); } -$table->data[$i++][1] = html_print_textarea( - 'list_ACL_IPs_for_API', - 2, - 25, - $list_ACL_IPs_for_API, - 'class="height_130px w300px"', - true -); - -$table->data[$i][0] = __('API password'); -$table->data[$i][1] = html_print_input_password( - 'api_password', - io_output_password($config['api_password']), - '', - 25, - 255, - true -); -$table->data[$i++][1] .= ui_print_reveal_password('api_password', true); - -$table->data[$i][0] = __('Enable GIS features'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'activate_gis', - 1, - $config['activate_gis'], - true -); - -$table->data[$i][0] = __('Enable Netflow'); -$rbt_disabled = false; +// Enable Netflow. if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $rbt_disabled = true; +} else { + $rbt_disabled = false; } -$table->data[$i++][1] = html_print_checkbox_switch_extended( - 'activate_netflow', - 1, - $config['activate_netflow'], - $rbt_disabled, - '', - '', - true -); - - +// Zone names. $zone_name = [ 'Africa' => __('Africa'), 'America' => __('America'), @@ -278,83 +107,16 @@ foreach ($timezones as $timezone) { } } -$table->data[$i][0] = __('Timezone setup'); -$table->data[$i][1] = html_print_input_text_extended( - 'timezone_text', - $config['timezone'], - 'text-timezone_text', - '', - 25, - 25, - false, - '', - 'readonly', - true -); -$table->data[$i][1] .= ''.html_print_image( - 'images/edit.svg', - true, +// Force Public URL Dialog. +html_print_div( [ - 'title' => __('Change timezone'), - 'class' => 'main_menu_icon invert_filter', - ] -).''; -$table->data[$i][1] .= '  '.html_print_select( - $zone_name, - 'zone', - $zone_selected, - 'show_timezone();', - '', - '', - true -); -$table->data[$i++][1] .= '  '.html_print_select( - $timezone_n, - 'timezone', - $config['timezone'], - '', - '', - '', - true -); - -$table->data[$i][0] = __('Public URL'); -$table->data[$i++][1] = html_print_input_text( - 'public_url', - $config['public_url'], - '', - 40, - 255, - true -); - -$table->data[$i][0] = __('Force use Public URL'); -$table->data[$i++][1] = html_print_switch( - [ - 'name' => 'force_public_url', - 'value' => $config['force_public_url'], + 'id' => 'force_public_url_dialog', + 'class' => 'invisible', + 'content' => __('If public URL is not properly configured you will lose access to ').get_product_name().__(' Console'), ] ); -echo "'; - -$table->data[$i][0] = __('Public URL host exclusions'); -$table->data[$i++][1] = html_print_textarea( - 'public_url_exclusions', - 2, - 25, - $config['public_url_exclusions'], - 'class="height_50px w300px"', - true -); - -// Inventory changes blacklist. -$table->data[$i][0] = __('Inventory changes blacklist'); - +// Inventory blacklist. $inventory_changes_blacklist_id = get_parameter( 'inventory_changes_blacklist', $config['inventory_changes_blacklist'] @@ -416,186 +178,507 @@ $select_in = html_print_select( $table_ichanges = ' - - - + + + - - + - +
'.__('Out of black list').''.__('In black list').''.__('Out of black list').''.__('In black list').'
'.$select_out.' + '.$select_out.' '.html_print_image('images/arrow@svg.svg', true, ['style' => 'rotate: 180deg;', 'id' => 'right_iblacklist', 'alt' => __('Push selected modules into blacklist'), 'title' => __('Push selected modules into blacklist'), 'class' => 'main_menu_icon invert_filter']).'

'.html_print_image('images/arrow@svg.svg', true, ['style' => 'rotate: 0', 'id' => 'left_iblacklist', 'alt' => __('Pop selected modules out of blacklist'), 'title' => __('Pop selected modules out of blacklist'), 'class' => 'main_menu_icon invert_filter']).'
'.$select_in.''.$select_in.'
'; -$table->data[$i++][1] = $table_ichanges; - -$table->data[$i][0] = __('Referer security'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'referer_security', - 1, - $config['referer_security'], - true -); - -$table->data[$i][0] = __('Event storm protection'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'event_storm_protection', - 1, - $config['event_storm_protection'], - true -); - - -$table->data[$i][0] = __('Command Snapshot'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'command_snapshot', - 1, - $config['command_snapshot'], - true -); - -$table->data[$i][0] = __('Change remote config encoding'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'use_custom_encoding', - 1, - $config['use_custom_encoding'], - true -); - -$table->data[$i][0] = __('Server logs directory'); -$table->data[$i++][1] = html_print_input_text( - 'server_log_dir', - $config['server_log_dir'], - '', - 50, - 255, - true -); - -$table->data[$i][0] = __('Log size limit in system logs viewer extension'); -$table->data[$i++][1] = html_print_input_text( - 'max_log_size', - $config['max_log_size'], - '', - 10, - 255, - true -).html_print_label(' x1000', 'max_log_size', true); - $modes_tutorial = [ 'full' => __('Full mode'), 'on_demand' => __('On demand'), 'expert' => __('Expert'), ]; -$table->data[$i][0] = __('Tutorial mode'); -$table->data[$i++][1] = html_print_select( - $modes_tutorial, - 'tutorial_mode', - $config['tutorial_mode'], - '', - '', - 0, - true -); $config['past_planned_downtimes'] = isset( $config['past_planned_downtimes'] ) ? $config['past_planned_downtimes'] : 1; -$table->data[$i][0] = __('Allow create scheduled downtimes in the past'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'past_planned_downtimes', - 1, - $config['past_planned_downtimes'], - true + +$table = new stdClass(); +$table->class = 'filter-table-adv'; +$table->id = 'setup_general'; +$table->width = '100%'; +$table->data = []; +$table->size = []; +$table->size[0] = '50%'; +$table->size[1] = '50%'; + +// Current config["language"] could be set by user, not taken from global setup ! +$current_system_lang = db_get_sql( + 'SELECT `value` FROM tconfig WHERE `token` = "language"' ); -$table->data[$i][0] = __('Limit for bulk operations'); -$table->data[$i++][1] = html_print_input( +if ($current_system_lang === '') { + $current_system_lang = 'en'; +} + +$i = 0; + +$table->data[$i][] = html_print_label_input_block( + __('Language code'), + html_print_select_from_sql( + 'SELECT id_language, name FROM tlanguage', + 'language', + $current_system_lang, + '', + '', + '', + true, + false, + true, + false, + 'width:100%' + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Remote config directory'), + html_print_input_text( + 'remote_config', + io_safe_output($config['remote_config']), + '', + 30, + 100, + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Chromium path'), + html_print_input_text( + 'chromium_path', + io_safe_output( + $config['chromium_path'] + ), + '', + 30, + 100, + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Auto login (hash) password'), + html_print_input_password( + 'loginhash_pwd', + io_output_password($config['loginhash_pwd']), + '', + 15, + 15, + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Time source'), + html_print_select( + $sources, + 'timesource', + $config['timesource'], + '', + '', + '', + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Attachment store'), + html_print_input_text( + 'attachment_store', + io_safe_output($config['attachment_store']), + '', + 50, + 255, + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Enforce https'), + html_print_checkbox_switch_extended( + 'https', + 1, + $config['https'], + false, + '', + '', + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Automatic check for updates'), + html_print_checkbox_switch( + 'autoupdate', + 1, + $config['autoupdate'], + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Use cert of SSL'), + html_print_checkbox_switch_extended( + 'use_cert', + 1, + $config['use_cert'], + false, + '', + '', + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Path of SSL Cert.'), + html_print_input_text( + 'cert_path', + io_safe_output($config['cert_path']), + '', + 50, + 255, + true + ), [ - 'type' => 'number', - 'size' => 5, - 'max' => $performance_variables_control['limit_parameters_massive']->max, - 'name' => 'limit_parameters_massive', - 'value' => $config['limit_parameters_massive'], - 'return' => true, - 'min' => $performance_variables_control['limit_parameters_massive']->min, - 'style' => 'width:50px', + 'div_id' => 'ssl-path-tr', + 'div_style' => 'display: none', ] ); -$table->data[$i][0] = __('Include agents manually disabled'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'include_agents', - 1, - $config['include_agents'], - true +$table->data[$i][] = html_print_label_input_block( + __('API password'), + html_print_input_password( + 'api_password', + io_output_password($config['api_password']), + '', + 25, + 255, + true + ) ); -$table->data[$i][0] = __('Set alias as name by default in agent creation'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'alias_as_name', - 1, - $config['alias_as_name'], - true +$table->data[$i++][] = html_print_label_input_block( + __('IP list with API access'), + html_print_textarea( + 'list_ACL_IPs_for_API', + 2, + 25, + $list_ACL_IPs_for_API, + 'class="height_130px"', + true + ) ); -$table->data[$i][0] = __('Unique IP'); -$table->data[$i++][1] = html_print_checkbox_switch( - 'unique_ip', - 1, - $config['unique_ip'], - true + +$table->data[$i][] = html_print_label_input_block( + __('Enable GIS features'), + html_print_checkbox_switch( + 'activate_gis', + 1, + $config['activate_gis'], + true + ) ); -$table->data[$i][0] = __('Enable console log').ui_print_help_tip( - __('Log location').': pandora_console/log/console.log', - true -); -$table->data[$i++][1] = html_print_checkbox_switch( - 'console_log_enabled', - 1, - $config['console_log_enabled'], - true +$table->data[$i++][] = html_print_label_input_block( + __('Enable Netflow'), + html_print_checkbox_switch_extended( + 'activate_netflow', + 1, + $config['activate_netflow'], + $rbt_disabled, + '', + '', + true + ) ); -$table->data[$i][0] = __('Enable audit log').ui_print_help_tip( - __('Log location').': pandora_console/log/audit.log', - true -); -$table->data[$i++][1] = html_print_checkbox_switch( - 'audit_log_enabled', - 1, - $config['audit_log_enabled'], - true +$table->colspan[$i][] = 2; +$table->data[$i++][] = html_print_label_input_block( + __('Timezone setup'), + html_print_div( + [ + 'class' => '', + 'content' => html_print_input_text_extended( + 'timezone_text', + $config['timezone'], + 'text-timezone_text', + '', + 25, + 25, + false, + '', + 'readonly', + true + ).html_print_image( + 'images/edit.svg', + true, + [ + 'id' => 'change_timezone', + 'title' => __('Change timezone'), + 'class' => 'main_menu_icon invert_filter', + ] + ).html_print_select( + $zone_name, + 'zone', + $zone_selected, + 'show_timezone();', + '', + '', + true + ).html_print_select( + $timezone_n, + 'timezone', + $config['timezone'], + '', + '', + '', + true + ), + ], + true + ) ); -$table->data[$i][0] = __('Module custom ID readonly').ui_print_help_tip( - __('Useful for integrations'), - true -); -$table->data[$i++][1] = html_print_checkbox_switch( - 'module_custom_id_ro', - 1, - $config['module_custom_id_ro'], - true +$table->data[$i][] = html_print_label_input_block( + __('Public URL'), + html_print_input_text( + 'public_url', + $config['public_url'], + '', + 40, + 255, + true + ) ); -$table->data[$i][0] = __('Enable console report').ui_print_help_tip( +$table->data[$i++][] = html_print_label_input_block( + __('Force use Public URL'), + html_print_switch( + [ + 'name' => 'force_public_url', + 'value' => $config['force_public_url'], + ] + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Public URL host exclusions'), + html_print_textarea( + 'public_url_exclusions', + 2, + 25, + $config['public_url_exclusions'], + 'class="height_50px w300px"', + true + ) +); + +// Inventory changes blacklist. +$table->data[$i][] = html_print_label_input_block( + __('Inventory changes blacklist'), + $table_ichanges +); + +$table->data[$i++][] = html_print_label_input_block( + __('Server logs directory'), + html_print_input_text( + 'server_log_dir', + $config['server_log_dir'], + '', + 50, + 255, + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Event storm protection'), + html_print_checkbox_switch( + 'event_storm_protection', + 1, + $config['event_storm_protection'], + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Command Snapshot'), + html_print_checkbox_switch( + 'command_snapshot', + 1, + $config['command_snapshot'], + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Change remote config encoding'), + html_print_checkbox_switch( + 'use_custom_encoding', + 1, + $config['use_custom_encoding'], + true + ) +); +$table->data[$i++][] = html_print_label_input_block( + __('Referer security'), + html_print_checkbox_switch( + 'referer_security', + 1, + $config['referer_security'], + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Log size limit in system logs viewer extension'), + html_print_div( + [ + 'class' => '', + 'content' => html_print_input_text( + 'max_log_size', + $config['max_log_size'], + '', + 20, + 255, + true + ).html_print_label( + ' x1000', + 'max_log_size', + true + ), + ], + true + ) +); +$table->data[$i++][] = html_print_label_input_block( + __('Tutorial mode'), + html_print_select( + $modes_tutorial, + 'tutorial_mode', + $config['tutorial_mode'], + '', + '', + 0, + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Allow create scheduled downtimes in the past'), + html_print_checkbox_switch( + 'past_planned_downtimes', + 1, + $config['past_planned_downtimes'], + true + ) +); +$table->data[$i++][] = html_print_label_input_block( + __('Limit for bulk operations'), + html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => $performance_variables_control['limit_parameters_massive']->max, + 'name' => 'limit_parameters_massive', + 'value' => $config['limit_parameters_massive'], + 'return' => true, + 'min' => $performance_variables_control['limit_parameters_massive']->min, + 'style' => 'width:50%', + ] + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Include agents manually disabled'), + html_print_checkbox_switch( + 'include_agents', + 1, + $config['include_agents'], + true + ) +); +$table->data[$i++][] = html_print_label_input_block( + __('Set alias as name by default in agent creation'), + html_print_checkbox_switch( + 'alias_as_name', + 1, + $config['alias_as_name'], + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Unique IP'), + html_print_checkbox_switch( + 'unique_ip', + 1, + $config['unique_ip'], + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Module custom ID readonly'), + html_print_checkbox_switch( + 'module_custom_id_ro', + 1, + $config['module_custom_id_ro'], + true + ).ui_print_input_placeholder( + __('Useful for integrations'), + true + ) +); + +$table->data[$i][] = html_print_label_input_block( + __('Enable console log'), + html_print_checkbox_switch( + 'console_log_enabled', + 1, + $config['console_log_enabled'], + true + ).ui_print_input_placeholder( + __('Log location').': pandora_console/log/console.log', + true + ) +); + +$table->data[$i++][] = html_print_label_input_block( + __('Enable audit log'), + html_print_checkbox_switch( + 'audit_log_enabled', + 1, + $config['audit_log_enabled'], + true + ).ui_print_input_placeholder( + __('Log location').': pandora_console/log/audit.log', + true + ) +); + +$table->data[$i][] = html_print_label_input_block( __('Enable console report'), - true -); -$table->data[$i++][1] = html_print_checkbox_switch( - 'reporting_console_enable', - 1, - $config['reporting_console_enable'], - true + html_print_checkbox_switch( + 'reporting_console_enable', + 1, + $config['reporting_console_enable'], + true + ) ); -echo '
'; +echo ''; echo '
'; echo ''.__('General options').''; @@ -615,7 +698,7 @@ echo '
'; echo '
'; echo ''.__('Mail configuration').''; - $table_mail_conf->data[0][0] = ui_print_warning_message( + ui_print_warning_message( __( 'Please notice that some providers like Gmail or Office365 need to setup/enable manually external connections using SMTP and you need to use STARTTLS on port 587. @@ -623,114 +706,128 @@ echo ''.__('Mail configuration').''; ) ); - $table_mail_conf->data[1][0] = __('From address'); - $table_mail_conf->data[1][1] = html_print_input_text( - 'email_from_dir', - $config['email_from_dir'], - '', - 30, - 100, - true + $table_mail_conf = new stdClass(); + $table_mail_conf->width = '100%'; + $table_mail_conf->class = 'databox filter-table-adv'; + $table_mail_conf->size = []; + $table_mail_conf->size[0] = '50%'; + $table_mail_conf->size[1] = '50%'; + $table_mail_conf->data = []; + + $table_mail_conf->data[0][] = html_print_label_input_block( + __('From address'), + html_print_input_text( + 'email_from_dir', + $config['email_from_dir'], + '', + 30, + 100, + true + ) ); - $table_mail_conf->data[2][0] = __('From name'); - $table_mail_conf->data[2][1] = html_print_input_text( - 'email_from_name', - $config['email_from_name'], - '', - 30, - 100, - true + $table_mail_conf->data[0][] = html_print_label_input_block( + __('From name'), + html_print_input_text( + 'email_from_name', + $config['email_from_name'], + '', + 30, + 100, + true + ) ); - $table_mail_conf->data[3][0] = __('SMTP Server'); - $table_mail_conf->data[3][1] = html_print_input_text( - 'email_smtpServer', - $config['email_smtpServer'], - '', - 30, - 100, - true + $table_mail_conf->data[1][] = html_print_label_input_block( + __('SMTP Server'), + html_print_input_text( + 'email_smtpServer', + $config['email_smtpServer'], + '', + 30, + 100, + true + ) ); - $table_mail_conf->data[4][0] = __('SMTP Port'); - $table_mail_conf->data[4][1] = html_print_input_text( - 'email_smtpPort', - $config['email_smtpPort'], - '', - 30, - 100, - true + $table_mail_conf->data[1][] = html_print_label_input_block( + __('SMTP Port'), + html_print_input_text( + 'email_smtpPort', + $config['email_smtpPort'], + '', + 30, + 100, + true + ) ); - $table_mail_conf->data[5][0] = __('Encryption'); - $table_mail_conf->data[5][1] = html_print_select( - $encryption, - 'email_encryption', - $config['email_encryption'], - '', - __('none'), - 0, - true + $table_mail_conf->data[2][] = html_print_label_input_block( + __('Email user'), + html_print_input_text( + 'email_username', + $config['email_username'], + '', + 30, + 100, + true + ) + ); + $table_mail_conf->data[2][] = html_print_label_input_block( + __('Email password'), + html_print_input_password( + 'email_password', + io_output_password( + $config['email_password'] + ), + '', + 30, + 100, + true + ) ); - $table_mail_conf->data[6][0] = __('Email user'); - $table_mail_conf->data[6][1] = html_print_input_text( - 'email_username', - $config['email_username'], - '', - 30, - 100, - true - ); - - $table_mail_conf->data[7][0] = __('Email password'); - $table_mail_conf->data[7][1] = html_print_input_password( - 'email_password', - io_output_password( - $config['email_password'] - ), - '', - 30, - 100, - true - ); - $table_mail_conf->data[7][1] .= ui_print_reveal_password( - 'email_password', - true + $table_mail_conf->data[3][] = html_print_label_input_block( + __('Encryption'), + html_print_select( + $encryption, + 'email_encryption', + $config['email_encryption'], + '', + __('none'), + 0, + true + ) ); $uniqid = uniqid(); - $table_mail_conf->data[8][0] = html_print_button( - __('Email test'), - 'email_test_dialog', - false, - "show_email_test('".$uniqid."');", - [ 'icon' => 'next' ], - true - ); - print_email_test_modal_window($uniqid); html_print_input_hidden('update_config', 1); html_print_table($table_mail_conf); - echo '
'; - html_print_div( - [ - 'class' => 'action-buttons w100p', - 'content' => html_print_submit_button( - __('Update'), - 'update_button', - false, - ['icon' => 'update'], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Update'), + 'update_button', + false, + ['icon' => 'update'], + true + ).html_print_button( + __('Email test'), + 'email_test_dialog', + false, + 'show_email_test("'.$uniqid.'");', + [ + 'icon' => 'mail', + 'mode' => 'secondary', + ], + true + ) ); echo '
'; @@ -748,26 +845,27 @@ echo ''.__('Mail configuration').''; // Email config table. $table_mail_test = new stdClass(); $table_mail_test->width = '100%'; - $table_mail_test->class = 'databox filters'; + $table_mail_test->class = 'filter-table-adv'; $table_mail_test->data = []; - $table_mail_test->style[0] = 'font-weight: bold;'; - $table_mail_test->style[1] = 'font-weight: bold;display: flex;height: 54px;align-items: center;padding-left: 15px;'; - $table_mail_test->data[0][0] = __('Address'); - $table_mail_test->data[0][1] = html_print_input_text( - 'email_test_address', - '', - '', - 35, - 100, - true + $table_mail_test->data[0][] = html_print_label_input_block( + __('Address'), + html_print_input_text( + 'email_test_address', + '', + '', + 35, + 100, + true + ) ); - $table_mail_test->data[1][0] = '  Email could not be sent'; + $table_mail_test->data[1][] = '  Email could not be sent'; - $table_mail_test->data[1][1] = html_print_div( + // $table_mail_test->colspan[2][0] = 2; + $submitButton = html_print_div( [ - 'class' => 'action-buttons w100p', + 'class' => 'action-buttons-right-forced', 'content' => html_print_button( __('Send'), 'email_test', @@ -783,7 +881,7 @@ echo ''.__('Mail configuration').''; true ); - echo ''; + echo ''; } diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 5fb042fe66..589593ba49 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1,16 +1,31 @@ '; +echo '
'; html_print_input_hidden('update_config', 1); $performance_variables_control = (array) json_decode(io_safe_output($config['performance_variables_control'])); @@ -58,28 +73,6 @@ $performance_variables_control = (array) json_decode(io_safe_output($config['per // ---------------------------------------------------------------------- // BEHAVIOUR CONFIGURATION // ---------------------------------------------------------------------- -$table_behaviour = new stdClass(); -$table_behaviour->width = '100%'; -$table_behaviour->class = 'databox filters'; -$table_behaviour->style[0] = 'font-weight: bold;'; -$table_behaviour->size[0] = '50%'; -$table_behaviour->data = []; - -$table_behaviour->data[$row][0] = __('Block size for pagination'); -$table_behaviour->data[$row][1] = html_print_input( - [ - 'type' => 'number', - 'size' => 5, - 'max' => $performance_variables_control['block_size']->max, - 'name' => 'block_size', - 'value' => $config['global_block_size'], - 'return' => true, - 'min' => $performance_variables_control['block_size']->min, - 'style' => 'width:50px', - ] -); -$row++; - $values = []; $values[5] = human_time_description_raw(5); $values[30] = human_time_description_raw(30); @@ -89,178 +82,87 @@ $values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES); $values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES); $values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES); -$table_behaviour->data[$row][0] = __('Paginated module view'); -$table_behaviour->data[$row][1] = html_print_checkbox_switch( - 'paginate_module', - 1, - $config['paginate_module'], - true +$table_behaviour = new stdClass(); +$table_behaviour->width = '100%'; +$table_behaviour->class = 'filter-table-adv'; +$table_behaviour->size[0] = '50%'; +$table_behaviour->data = []; + +$table_behaviour->data[$row][] = html_print_label_input_block( + __('Block size for pagination'), + html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => $performance_variables_control['block_size']->max, + 'name' => 'block_size', + 'value' => $config['global_block_size'], + 'return' => true, + 'min' => $performance_variables_control['block_size']->min, + 'style' => 'width:50px', + ] + ) +); + +$table_behaviour->data[$row][] = html_print_label_input_block( + __('Click to display lateral menus'), + html_print_checkbox_switch( + 'click_display', + 1, + $config['click_display'], + true + ) +); + +$row++; + +$table_behaviour->data[$row][] = html_print_label_input_block( + __('Paginated module view'), + html_print_checkbox_switch( + 'paginate_module', + 1, + $config['paginate_module'], + true + ) +); +$table_behaviour->data[$row][] = html_print_label_input_block( + __('Display data of proc modules in other format'), + html_print_checkbox_switch( + 'render_proc', + 1, + $config['render_proc'], + true + ) ); $row++; -$table_behaviour->data[$row][0] = __('Display data of proc modules in other format'); -$table_behaviour->data[$row][1] = html_print_checkbox_switch( - 'render_proc', - 1, - $config['render_proc'], - true +$table_behaviour->data[$row][] = html_print_label_input_block( + __('Display text proc modules have state is ok'), + html_print_input_text('render_proc_ok', $config['render_proc_ok'], '', 25, 25, true) ); -$row++; - -$table_behaviour->data[$row][0] = __('Display text proc modules have state is ok'); -$table_behaviour->data[$row][1] = html_print_input_text('render_proc_ok', $config['render_proc_ok'], '', 25, 25, true); -$row++; - -$table_behaviour->data[$row][0] = __('Display text when proc modules have state critical'); -$table_behaviour->data[$row][1] = html_print_input_text('render_proc_fail', $config['render_proc_fail'], '', 25, 25, true); -$row++; - -$table_behaviour->data[$row][0] = __('Click to display lateral menus'); -$table_behaviour->data[$row][1] = html_print_checkbox_switch( - 'click_display', - 1, - $config['click_display'], - true +$table_behaviour->data[$row][] = html_print_label_input_block( + __('Display text when proc modules have state critical'), + html_print_input_text('render_proc_fail', $config['render_proc_fail'], '', 25, 25, true) ); $row++; if (enterprise_installed() === true) { - $table_behaviour->data[$row][0] = __('Service label font size'); - $table_behaviour->data[$row][1] = html_print_input_text('service_label_font_size', $config['service_label_font_size'], '', 5, 5, true); - $row++; - - $table_behaviour->data[$row][0] = __('Space between items in Service maps'); - $table_behaviour->data[$row][1] = html_print_input_text('service_item_padding_size', $config['service_item_padding_size'], '', 5, 5, true, false, false, 'onChange="change_servicetree_nodes_padding()"'); $row++; + $table_behaviour->data[$row][] = html_print_label_input_block( + __('Service label font size'), + html_print_input_text('service_label_font_size', $config['service_label_font_size'], '', 5, 5, true) + ); + $table_behaviour->data[$row][] = html_print_label_input_block( + __('Space between items in Service maps'), + html_print_input_text('service_item_padding_size', $config['service_item_padding_size'], '', 5, 5, true, false, false, 'onChange="change_servicetree_nodes_padding()"') + ); } + // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // STYLE CONFIGURATION // ---------------------------------------------------------------------- -$table_styles = new stdClass(); -$table_styles->width = '100%'; -$table_styles->class = 'databox filters'; -$table_styles->style[0] = 'font-weight: bold;'; -$table_styles->style[1] = 'display: flex; align-items: center;'; -$table_styles->size[0] = '50%'; -$table_styles->data = []; - - -$table_styles->data[$row][0] = __('Style template'); -$table_styles->data[$row][1] = html_print_select( - themes_get_css(), - 'style', - $config['style'].'.css', - '', - '', - '', - true -); -$row++; - -$table_styles->data[$row][0] = __('Status icon set'); -$iconsets['default'] = __('Colors'); -$iconsets['faces'] = __('Faces'); -$iconsets['color_text'] = __('Colors and text'); -$table_styles->data[$row][1] = html_print_select( - $iconsets, - 'status_images_set', - $config['status_images_set'], - '', - '', - '', - true -); -$table_styles->data[$row][1] .= html_print_button( - __('View'), - 'status_set_preview', - false, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true -); -$row++; - -// Divs to show icon status Colours (Default). -$icon_unknown_ball = ui_print_status_image(STATUS_AGENT_UNKNOWN_BALL, '', true); -$icon_unknown = ui_print_status_image(STATUS_AGENT_UNKNOWN, '', true); -$icon_ok_ball = ui_print_status_image(STATUS_AGENT_OK_BALL, '', true); -$icon_ok = ui_print_status_image(STATUS_AGENT_OK, '', true); -$icon_warning_ball = ui_print_status_image(STATUS_AGENT_WARNING_BALL, '', true); -$icon_warning = ui_print_status_image(STATUS_AGENT_WARNING, '', true); -$icon_bad_ball = ui_print_status_image(STATUS_AGENT_CRITICAL_BALL, '', true); -$icon_bad = ui_print_status_image(STATUS_AGENT_CRITICAL, '', true); -// End - Divs to show icon status Colours (Default). -$table_styles->data[$row][0] = __('Login background'); -$backgrounds_list_jpg = list_files('images/backgrounds', 'jpg', 1, 0); -$backgrounds_list_gif = list_files('images/backgrounds', 'gif', 1, 0); -$backgrounds_list_png = list_files('images/backgrounds', 'png', 1, 0); -$backgrounds_list = array_merge($backgrounds_list_jpg, $backgrounds_list_png); -$backgrounds_list = array_merge($backgrounds_list, $backgrounds_list_gif); -asort($backgrounds_list); - -$open = false; -if (enterprise_installed() === false) { - $open = true; -} - -// Custom favicon. -$files = list_files('images/custom_favicon', 'ico', 1, 0); -$table_styles->data[$row][0] = __('Custom favicon'); -$table_styles->data[$row][1] = html_print_select( - $files, - 'custom_favicon', - $config['custom_favicon'], - 'setup_visuals_change_favicon();', - __('Default'), - '', - true, - false, - true, - '', - false, - 'width:240px' -); -$table_styles->data[$row][1] .= '   '.html_print_image( - ui_get_favicon(), - true, - ['id' => 'favicon_preview'] -); -$row++; - -$table_styles->data[$row][0] = __('Custom background logo'); -$table_styles->data[$row][1] = html_print_select( - $backgrounds_list, - 'login_background', - $config['login_background'], - '', - __('Default'), - '', - true, - false, - true, - '', - false, - 'width:240px' -); -$table_styles->data[$row][1] .= html_print_button( - __('View'), - 'login_background_preview', - false, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true -); -$row++; /** @@ -311,50 +213,59 @@ function logo_custom_enterprise($name, $logo) } -$table_styles->data[$row][0] = __('Custom logo (menu)'); -$table_styles->data[$row][1] = logo_custom_enterprise('custom_logo', $config['custom_logo']); -$table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_logo_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' -); -$row++; +function load_fonts() +{ + global $config; -$table_styles->data[$row][0] = __('Custom logo collapsed (menu)'); -$table_styles->data[$row][1] = logo_custom_enterprise('custom_logo_collapsed', $config['custom_logo_collapsed']); -$table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_logo_collapsed_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' -); -$row++; + $home = str_replace('\\', '/', $config['homedir']); + $dir = scandir($home.'/include/fonts/'); + + $fonts = []; + + foreach ($dir as $file) { + if (strstr($file, '.ttf') !== false) { + $fonts[$home.'/include/fonts/'.$file] = $file; + } + } + + return $fonts; +} + + +$iconsets['default'] = __('Colors'); +$iconsets['faces'] = __('Faces'); +$iconsets['color_text'] = __('Colors and text'); + +// Divs to show icon status Colours (Default). +$icon_unknown_ball = ui_print_status_image(STATUS_AGENT_UNKNOWN_BALL, '', true); +$icon_unknown = ui_print_status_image(STATUS_AGENT_UNKNOWN, '', true); +$icon_ok_ball = ui_print_status_image(STATUS_AGENT_OK_BALL, '', true); +$icon_ok = ui_print_status_image(STATUS_AGENT_OK, '', true); +$icon_warning_ball = ui_print_status_image(STATUS_AGENT_WARNING_BALL, '', true); +$icon_warning = ui_print_status_image(STATUS_AGENT_WARNING, '', true); +$icon_bad_ball = ui_print_status_image(STATUS_AGENT_CRITICAL_BALL, '', true); +$icon_bad = ui_print_status_image(STATUS_AGENT_CRITICAL, '', true); +// End - Divs to show icon status Colours (Default). +$backgrounds_list_jpg = list_files('images/backgrounds', 'jpg', 1, 0); +$backgrounds_list_gif = list_files('images/backgrounds', 'gif', 1, 0); +$backgrounds_list_png = list_files('images/backgrounds', 'png', 1, 0); +$backgrounds_list = array_merge($backgrounds_list_jpg, $backgrounds_list_png); +$backgrounds_list = array_merge($backgrounds_list, $backgrounds_list_gif); +asort($backgrounds_list); + +$open = false; +if (enterprise_installed() === false) { + $open = true; +} -$table_styles->data[$row][0] = __('Custom logo (header white background)'); if (enterprise_installed() === true) { + // Get all the custom logos. + $filesCustomLogos = list_files('enterprise/images/custom_general_logos', 'png', 1, 0); + $ent_files = list_files('enterprise/images/custom_logo', 'png', 1, 0); $open_files = list_files('images/custom_logo', 'png', 1, 0); - $table_styles->data[$row][1] = html_print_select( + $entOpenFilesInput = html_print_select( array_merge($open_files, $ent_files), 'custom_logo_white_bg', $config['custom_logo_white_bg'], @@ -368,44 +279,8 @@ if (enterprise_installed() === true) { $open, 'width:240px' ); -} else { - $table_styles->data[$row][1] = html_print_select( - list_files('images/custom_logo', 'png', 1, 0), - 'custom_logo_white_bg', - $config['custom_logo_white_bg'], - '', - '', - '', - true, - false, - true, - '', - $open, - 'width:240px' - ); -} -$table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_logo_white_bg_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' -); -$row++; - -$table_styles->data[$row][0] = __('Custom logo (login)'); - -if (enterprise_installed()) { - $table_styles->data[$row][1] = html_print_select( + $customLogoLoginInput = html_print_select( list_files('enterprise/images/custom_logo_login', 'png', 1, 0), 'custom_logo_login', $config['custom_logo_login'], @@ -420,7 +295,22 @@ if (enterprise_installed()) { 'width:240px' ); } else { - $table_styles->data[$row][1] = html_print_select( + $entOpenFilesInput = html_print_select( + list_files('images/custom_logo', 'png', 1, 0), + 'custom_logo_white_bg', + $config['custom_logo_white_bg'], + '', + '', + '', + true, + false, + true, + '', + $open, + 'width:240px' + ); + + $customLogoLoginInput = html_print_select( '', 'custom_logo_login', $config['custom_logo_login'], @@ -436,364 +326,576 @@ if (enterprise_installed()) { ); } -$table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_logo_login_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' +// Custom favicon. +$filesFavicon = list_files('images/custom_favicon', 'ico', 1, 0); + +$table_styles = new stdClass(); +$table_styles->width = '100%'; +$table_styles->class = 'filter-table-adv'; +$table_styles->size[0] = '50%'; +$table_styles->data = []; + +$table_styles->data[$row][] = html_print_label_input_block( + __('Style template'), + html_print_select( + themes_get_css(), + 'style', + $config['style'].'.css', + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%' + ) +); +$row++; +$table_styles->data[$row][] = html_print_label_input_block( + __('Custom favicon'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $filesFavicon, + 'custom_favicon', + $config['custom_favicon'], + 'setup_visuals_change_favicon();', + __('Default'), + '', + true, + false, + true, + '', + false, + 'width:240px' + ).html_print_image( + ui_get_favicon(), + true, + ['id' => 'favicon_preview'] + ), + ], + true + ) +); + +$table_styles->data[$row][] = html_print_label_input_block( + __('Custom background logo'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $backgrounds_list, + 'login_background', + $config['login_background'], + '', + __('Default'), + 'background_pandora_console_keys.jpg', + true, + false, + true, + '', + false, + 'width:240px' + ).html_print_button( + __('View'), + 'login_background_preview', + false, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true + ), + ], + true + ) +); +$row++; + +$table_styles->data[$row][] = html_print_label_input_block( + __('Custom logo (menu)'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => logo_custom_enterprise('custom_logo', $config['custom_logo']).html_print_button( + __('View'), + 'custom_logo_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) +); + +$table_styles->data[$row][] = html_print_label_input_block( + __('Custom logo collapsed (menu)'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => logo_custom_enterprise('custom_logo_collapsed', $config['custom_logo_collapsed']).html_print_button( + __('View'), + 'custom_logo_collapsed_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) +); +$row++; + +$table_styles->data[$row][] = html_print_label_input_block( + __('Custom logo (header white background)'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => $entOpenFilesInput.html_print_button( + __('View'), + 'custom_logo_white_bg_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) +); + +$table_styles->data[$row][] = html_print_label_input_block( + __('Custom logo (login)'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => $entOpenFilesInput.html_print_button( + __('View'), + 'custom_logo_login_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) ); $row++; // Splash login. if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Custom Splash (login)'); - - $table_styles->data[$row][1] = html_print_select( - list_files('enterprise/images/custom_splash_login', 'png', 1, 0), - 'custom_splash_login', - $config['custom_splash_login'], - '', - __('Default'), - 'default', - true, - false, - true, - '', - $open, - 'width:240px' + $table_styles->data[$row][] = html_print_label_input_block( + __('Custom Splash (login)'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + list_files('enterprise/images/custom_splash_login', 'png', 1, 0), + 'custom_splash_login', + $config['custom_splash_login'], + '', + __('Default'), + 'default.svg', + true, + false, + true, + '', + $open, + 'width:240px' + ).html_print_button( + __('View'), + 'custom_splash_login_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) ); - $table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_splash_login_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' - ); - $row++; -} - -if (enterprise_installed() === true) { - // Get all the custom logos. - $files = list_files('enterprise/images/custom_general_logos', 'png', 1, 0); - - // Custom docs icon. - $table_styles->data[$row][0] = __('Custom documentation logo'); - - $table_styles->data[$row][1] = html_print_select( - $files, - 'custom_docs_logo', - $config['custom_docs_logo'], - '', - __('None'), - '', - true, - false, - true, - '', - false, - 'width:240px' - ); - $table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_docs_logo_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' + $table_styles->data[$row][] = html_print_label_input_block( + __('Custom documentation logo'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $filesCustomLogos, + 'custom_docs_logo', + $config['custom_docs_logo'], + '', + __('None'), + '', + true, + false, + true, + '', + false, + 'width:240px' + ).html_print_button( + __('View'), + 'custom_docs_logo_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) ); $row++; // Custom support icon. - $table_styles->data[$row][0] = __('Custom support logo'); - $table_styles->data[$row][1] = html_print_select( - $files, - 'custom_support_logo', - $config['custom_support_logo'], - '', - __('None'), - '', - true, - false, - true, - '', - false, - 'width:240px' + $table_styles->data[$row][] = html_print_label_input_block( + __('Custom support logo'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $filesCustomLogos, + 'custom_support_logo', + $config['custom_support_logo'], + '', + __('None'), + '', + true, + false, + true, + '', + false, + 'width:240px' + ).html_print_button( + __('View'), + 'custom_support_logo_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) ); - $table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_support_logo_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' - ); - $row++; - // Custom center networkmap icon. - $table_styles->data[$row][0] = __('Custom networkmap center logo'); - $table_styles->data[$row][1] = html_print_select( - $files, - 'custom_network_center_logo', - $config['custom_network_center_logo'], - '', - __('Default'), - '', - true, - false, - true, - '', - false, - 'width:240px' - ); - $table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_network_center_logo_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' + $table_styles->data[$row][] = html_print_label_input_block( + __('Custom networkmap center logo'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $filesCustomLogos, + 'custom_network_center_logo', + $config['custom_network_center_logo'], + '', + __('Default'), + 'bola_pandora_network_maps.png', + true, + false, + true, + '', + false, + 'width:240px' + ).html_print_button( + __('View'), + 'custom_network_center_logo_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) ); $row++; // Custom center mobile console icon. - $table_styles->data[$row][0] = __('Custom mobile console icon'); - $table_styles->data[$row][1] = html_print_select( - $files, - 'custom_mobile_console_logo', - $config['custom_mobile_console_logo'], - '', - __('Default'), - '', - true, - false, - true, - '', - false, - 'width:240px' + $table_styles->data[$row][] = html_print_label_input_block( + __('Custom mobile console icon'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $filesCustomLogos, + 'custom_mobile_console_logo', + $config['custom_mobile_console_logo'], + '', + __('Default'), + '', + true, + false, + true, + '', + false, + 'width:240px' + ).html_print_button( + __('View'), + 'custom_mobile_console_logo_preview', + $open, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true, + false, + $open, + 'visualmodal' + ), + ], + true + ) ); - $table_styles->data[$row][1] .= ' '.html_print_button( - __('View'), - 'custom_mobile_console_logo_preview', - $open, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true, - false, - $open, - 'visualmodal' - ); - $row++; } +$row++; + // Title Header. -$table_styles->data[$row][0] = __('Title (header)'); -$table_styles->data[$row][1] = html_print_input_text('custom_title_header', $config['custom_title_header'], '', 50, 40, true); -$row++; +$table_styles->data[$row][] = html_print_label_input_block( + __('Title (header)'), + html_print_input_text('custom_title_header', $config['custom_title_header'], '', 50, 40, true) +); // Subtitle Header. -$table_styles->data[$row][0] = __('Subtitle (header)'); -$table_styles->data[$row][1] = html_print_input_text('custom_subtitle_header', $config['custom_subtitle_header'], '', 50, 40, true); +$table_styles->data[$row][] = html_print_label_input_block( + __('Subtitle (header)'), + html_print_input_text('custom_subtitle_header', $config['custom_subtitle_header'], '', 50, 40, true) +); $row++; -// Login title1. if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Title 1 (login)'); - $table_styles->data[$row][1] = html_print_input_text('custom_title1_login', $config['custom_title1_login'], '', 50, 50, true); + // Login title1. + $table_styles->data[$row][] = html_print_label_input_block( + __('Title 1 (login)'), + html_print_input_text('custom_title1_login', $config['custom_title1_login'], '', 50, 50, true) + ); + // Login text2. + $table_styles->data[$row][] = html_print_label_input_block( + __('Title 2 (login)'), + html_print_input_text('custom_title2_login', $config['custom_title2_login'], '', 50, 50, true) + ); $row++; -} -// Login text2. -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Title 2 (login)'); - $table_styles->data[$row][1] = html_print_input_text('custom_title2_login', $config['custom_title2_login'], '', 50, 50, true); + $table_styles->data[$row][] = html_print_label_input_block( + __('Docs URL (login)'), + html_print_input_text('custom_docs_url', $config['custom_docs_url'], '', 50, 50, true) + ); + + $table_styles->data[$row][] = html_print_label_input_block( + __('Support URL (login)'), + html_print_input_text('custom_support_url', $config['custom_support_url'], '', 50, 50, true) + ); $row++; -} -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Docs URL (login)'); - $table_styles->data[$row][1] = html_print_input_text('custom_docs_url', $config['custom_docs_url'], '', 50, 50, true); + $table_styles->data[$row][] = html_print_label_input_block( + __('Product name'), + html_print_input_text('rb_product_name', get_product_name(), '', 30, 255, true) + ); + + $table_styles->data[$row][] = html_print_label_input_block( + __('Copyright notice'), + html_print_input_text('rb_copyright_notice', get_copyright_notice(), '', 30, 255, true) + ); $row++; -} -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Support URL (login)'); - $table_styles->data[$row][1] = html_print_input_text('custom_support_url', $config['custom_support_url'], '', 50, 50, true); - $row++; -} + $table_styles->data[$row][] = html_print_label_input_block( + __('Background opacity % (login)'), + "" + ); -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Product name'); - $table_styles->data[$row][1] = html_print_input_text('rb_product_name', get_product_name(), '', 30, 255, true); - $row++; -} - -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Copyright notice'); - $table_styles->data[$row][1] = html_print_input_text('rb_copyright_notice', get_copyright_notice(), '', 30, 255, true); - $row++; -} - -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Background opacity % (login)'); - $table_styles->data[$row][1] = ""; - $row++; -} - -if (enterprise_installed() === true) { - $table_styles->data[$row][0] = __('Disable logo in graphs'); - $table_styles->data[$row][1] = html_print_checkbox_switch( - 'fixed_graph', - 1, - $config['fixed_graph'], - true + $table_styles->data[$row][] = html_print_label_input_block( + __('Disable logo in graphs'), + html_print_checkbox_switch( + 'fixed_graph', + 1, + $config['fixed_graph'], + true + ) ); $row++; } - /* - Hello there! :) - We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( - You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. - */ +/* + Hello there! :) + We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( + You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. +*/ -$table_styles->data[$row][0] = __('Disable helps'); -$table_styles->data[$row][1] = html_print_checkbox_switch( - 'disable_help', - 1, - $config['disable_help'], - true +$table_styles->data[$row][] = html_print_label_input_block( + __('Disable helps'), + html_print_checkbox_switch( + 'disable_help', + 1, + $config['disable_help'], + true + ) +); + +$table_styles->data[$row][] = html_print_label_input_block( + __('Fixed header'), + html_print_checkbox_switch( + 'fixed_header', + 1, + $config['fixed_header'], + true + ) ); $row++; -$table_styles->data[$row][0] = __('Fixed header'); -$table_styles->data[$row][1] = html_print_checkbox_switch( - 'fixed_header', - 1, - $config['fixed_header'], - true -); -$row++; - - // For 5.1 Autohidden menu feature. -$table_styles->data['autohidden'][0] = __('Automatically hide submenu'); -$table_styles->data['autohidden'][1] = html_print_checkbox_switch( - 'autohidden_menu', - 1, - $config['autohidden_menu'], - true +$table_styles->data[$row][] = html_print_label_input_block( + __('Automatically hide submenu'), + html_print_checkbox_switch( + 'autohidden_menu', + 1, + $config['autohidden_menu'], + true + ) ); -$table_styles->data[$row][0] = __('Visual effects and animation'); -$table_styles->data[$row][1] = html_print_checkbox_switch( - 'visual_animation', - 1, - $config['visual_animation'], - true +$table_styles->data[$row][] = html_print_label_input_block( + __('Visual effects and animation'), + html_print_checkbox_switch( + 'visual_animation', + 1, + $config['visual_animation'], + true + ) ); $row++; -$table_styles->data[$row][0] = __('Random background (login)'); -$table_styles->data[$row][1] = html_print_checkbox_switch( - 'random_background', - 1, - $config['random_background'], - true +$table_styles->data[$row][] = html_print_label_input_block( + __('Random background (login)'), + html_print_checkbox_switch( + 'random_background', + 1, + $config['random_background'], + true + ) ); -$row++; - // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // GIS CONFIGURATION // ---------------------------------------------------------------------- -$table_gis = new stdClass(); -$table_gis->width = '100%'; -$table_gis->class = 'databox filters'; -$table_gis->style[0] = 'font-weight: bold;'; -$table_gis->style[1] = 'display: flex; align-items: center;'; -$table_gis->size[0] = '50%'; -$table_gis->data = []; - -$table_gis->data[$row][0] = __('GIS Labels'); -$table_gis->data[$row][1] = html_print_checkbox_switch( - 'gis_label', - 1, - $config['gis_label'], - true -); -$row++; - $listIcons = gis_get_array_list_icons(); $arraySelectIcon = []; foreach ($listIcons as $index => $value) { $arraySelectIcon[$index] = $index; } -$table_gis->data[$row][0] = __('Default icon in GIS'); -$table_gis->data[$row][1] = html_print_select( - $arraySelectIcon, - 'gis_default_icon', - $config['gis_default_icon'], - '', - __('Agent icon group'), - '', - true +$table_gis = new stdClass(); +$table_gis->width = '100%'; +$table_gis->class = 'filter-table-adv'; +$table_gis->size[0] = '50%'; +$table_gis->data = []; + +$table_gis->data[$row][] = html_print_label_input_block( + __('GIS Labels'), + html_print_checkbox_switch( + 'gis_label', + 1, + $config['gis_label'], + true + ) ); -$table_gis->data[$row][1] .= ' '.html_print_button( - __('View'), - 'gis_icon_preview', - false, - '', - [ - 'icon' => 'camera', - 'mode' => 'link', - 'class' => 'logo_preview', - ], - true + +$table_gis->data[$row][] = html_print_label_input_block( + __('Default icon in GIS'), + html_print_div( + [ + 'class' => 'select-with-sibling', + 'content' => html_print_select( + $arraySelectIcon, + 'gis_default_icon', + $config['gis_default_icon'], + '', + __('Agent icon group'), + '', + true + ).html_print_button( + __('View'), + 'gis_icon_preview', + false, + '', + [ + 'icon' => 'camera', + 'mode' => 'link', + 'class' => 'logo_preview', + ], + true + ), + ], + true + ) ); $row++; @@ -801,15 +903,6 @@ $row++; // ---------------------------------------------------------------------- // FONT AND TEXT CONFIGURATION // ---------------------------------------------------------------------- -$table_font = new stdClass(); -$table_font->width = '100%'; -$table_font->class = 'databox filters'; -$table_font->style[0] = 'font-weight: bold;'; -$table_font->size[0] = '50%'; -$table_font->data = []; - -$table_font->data[$row][0] = __('Graphs font size'); - $font_size_array = [ 1 => 1, 2 => 2, @@ -828,265 +921,135 @@ $font_size_array = [ 15 => 15, ]; -$table_font->data[$row][1] = html_print_select( - $font_size_array, - 'font_size', - $config['font_size'], - '', - '', - 0, - true +$table_font = new stdClass(); +$table_font->width = '100%'; +$table_font->class = 'filter-table-adv'; +$table_font->size[0] = '50%'; +$table_font->data = []; + +$table_font->data[$row][] = html_print_label_input_block( + __('Graphs font size'), + html_print_select( + $font_size_array, + 'font_size', + $config['font_size'], + '', + '', + 0, + true, + false, + true, + '', + false, + 'width: 100%' + ) +); + + +$table_font->data[$row][] = html_print_label_input_block( + __('Show unit along with value in reports'), + html_print_checkbox_switch( + 'simple_module_value', + 1, + $config['simple_module_value'], + true + ) ); $row++; -$table_font->data[$row][0] = __('Agent size text'); -$table_font->data[$row][1] = __('Small:').html_print_input_text('agent_size_text_small', $config['agent_size_text_small'], '', 3, 3, true); -$table_font->data[$row][1] .= ' '.__('Normal:').html_print_input_text('agent_size_text_medium', $config['agent_size_text_medium'], '', 3, 3, true); -$row++; - -$table_font->data[$row][0] = __('Module size text'); -$table_font->data[$row][1] = __('Small:').html_print_input_text('module_size_text_small', $config['module_size_text_small'], '', 3, 3, true); -$table_font->data[$row][1] .= ' '.__('Normal:').html_print_input_text('module_size_text_medium', $config['module_size_text_medium'], '', 3, 3, true); -$row++; - -$table_font->data[$row][0] = __('Description size text'); -$table_font->data[$row][1] = html_print_input_text('description_size_text', $config['description_size_text'], '', 3, 3, true); -$row++; - -$table_font->data[$row][0] = __('Item title size text'); -$table_font->data[$row][1] = html_print_input_text( - 'item_title_size_text', - $config['item_title_size_text'], - '', - 3, - 3, - true +$table_font->data[$row][] = html_print_label_input_block( + __('Agent size text'), + html_print_div( + [ + 'class' => 'filter-table-adv-manual', + 'content' => html_print_div( + [ + 'class' => 'w50p', + 'content' => __('Small').html_print_input_text('agent_size_text_small', $config['agent_size_text_small'], '', 10, 3, true), + ], + true + ).html_print_div( + [ + 'class' => 'w50p', + 'content' => __('Normal').html_print_input_text('agent_size_text_medium', $config['agent_size_text_medium'], '', 10, 3, true), + ], + true + ), + ], + true + ) +); +$table_font->data[$row][] = html_print_label_input_block( + __('Module size text'), + html_print_div( + [ + 'class' => 'filter-table-adv-manual', + 'content' => html_print_div( + [ + 'class' => 'w50p', + 'content' => __('Small').html_print_input_text('module_size_text_small', $config['module_size_text_small'], '', 10, 3, true), + ], + true + ).html_print_div( + [ + 'class' => 'w50p', + 'content' => __('Normal').html_print_input_text('module_size_text_medium', $config['module_size_text_medium'], '', 10, 3, true), + ], + true + ), + ], + true + ) ); $row++; -$table_font->data[$row][0] = __('Show unit along with value in reports'); -$table_font->data[$row][1] = html_print_checkbox_switch( - 'simple_module_value', - 1, - $config['simple_module_value'], - true +$table_font->data[$row][] = html_print_label_input_block( + __('Description size text'), + html_print_input_text( + 'description_size_text', + $config['description_size_text'], + '', + 3, + 3, + true + ) +); +$table_font->data[$row][] = html_print_label_input_block( + __('Item title size text'), + html_print_input_text( + 'item_title_size_text', + $config['item_title_size_text'], + '', + 3, + 3, + true + ) ); $row++; + // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // CHARS CONFIGURATION // ---------------------------------------------------------------------- -$table_chars = new stdClass(); -$table_chars->width = '100%'; -$table_chars->class = 'databox filters'; -$table_chars->style[0] = 'font-weight: bold;'; -$table_chars->style[1] = 'display: flex;'; -$table_chars->size[0] = '50%'; -$table_chars->data = []; - -$graphColorAmount = 10; - -for ($i = 1; $i <= $graphColorAmount; $i++) { - $table_chars->data[$row][0] = __('Graph color #'.$i); - $table_chars->data[$row][1] = html_print_input_text( - 'graph_color'.$i, - $config['graph_color'.$i], - '', - 10, - 8, - true - ); - $row++; -} - -$table_chars->data[$row][0] = __('Value to interface graphics'); -$table_chars->data[$row][1] = html_print_input_text( - 'interface_unit', - $config['interface_unit'], - '', - 20, - 20, - true -); -$row++; - $disabled_graph_precision = false; if (enterprise_installed() === false) { $disabled_graph_precision = true; } -$table_chars->data[$row][0] = __('Data precision'); -$table_chars->data[$row][1] = html_print_input( - [ - 'type' => 'number', - 'size' => 5, - 'max' => $performance_variables_control['graph_precision']->max, - 'name' => 'graph_precision', - 'value' => $config['graph_precision'], - 'return' => true, - 'min' => $performance_variables_control['graph_precision']->min, - 'style' => 'width:50px', - ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', - 'onchange' => 'change_precision()', - ] -); -$row++; - if (isset($config['short_module_graph_data']) === false) { $config['short_module_graph_data'] = true; } -$table_chars->data[$row][0] = __('Data precision in graphs'); -$table_chars->data[$row][1] = html_print_input( - [ - 'type' => 'number', - 'size' => 5, - 'max' => $performance_variables_control['short_module_graph_data']->max, - 'name' => 'short_module_graph_data', - 'value' => $config['short_module_graph_data'], - 'return' => true, - 'min' => $performance_variables_control['short_module_graph_data']->min, - 'style' => 'width:50px', - ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', - 'onchange' => 'change_precision()', - ] -); - -$row++; - -$table_chars->data[$row][0] = __( - 'Default line thickness for the Custom Graph.' -); -$table_chars->data[$row][1] = html_print_input_text( - 'custom_graph_width', - $config['custom_graph_width'], - '', - 5, - 5, - true -); -$row++; - -$table_chars->data[$row][0] = __('Number of elements in Custom Graph'); -$table_chars->data[$row][1] = html_print_input_text( - 'items_combined_charts', - $config['items_combined_charts'], - '', - 5, - 5, - true, - false, - false, - '' -); -$row++; - -$table_chars->data[$row][0] = __('Use round corners'); -$table_chars->data[$row][1] = html_print_checkbox_switch( - 'round_corner', - 1, - $config['round_corner'], - true -); -$row++; - -$table_chars->data[$row][0] = __('Chart fit to content'); -$table_chars->data[$row][1] = html_print_checkbox_switch( - 'maximum_y_axis', - 1, - $config['maximum_y_axis'], - true -); -$row++; - -$table_chars->data[$row][0] = __('Type of module charts'); -$table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( - 'type_module_charts', - 'area', - '', - $config['type_module_charts'] == 'area', - true -).'  '; -$table_chars->data[$row][1] .= __('Line').' '.html_print_radio_button( - 'type_module_charts', - 'line', - '', - $config['type_module_charts'] != 'area', - true -); -$row++; - -$table_chars->data[$row][0] = __('Type of interface charts'); -$table_chars->data[$row][1] = __('Area').' '.html_print_radio_button( - 'type_interface_charts', - 'area', - '', - $config['type_interface_charts'] == 'area', - true -).'  '; -$table_chars->data[$row][1] .= __('Line').' '.html_print_radio_button( - 'type_interface_charts', - 'line', - '', - $config['type_interface_charts'] != 'area', - true -); -$row++; - -$table_chars->data[$row][0] = __('Percentile'); -$table_chars->data[$row][1] = html_print_input_text( - 'percentil', - $config['percentil'], - '', - 20, - 20, - true -); -$row++; - -$table_chars->data[$row][0] = __('Graph TIP view:'); - $options_full_escale = []; $options_full_escale[0] = __('None'); $options_full_escale[1] = __('All'); $options_full_escale[2] = __('On Boolean graphs'); -$table_chars->data[$row][1] = html_print_select( - $options_full_escale, - 'full_scale_option', - (isset($config['full_scale_option']) === true) ? $config['full_scale_option'] : 0, - '', - '', - 0, - true, - false, - false -); -$row++; - - -$table_chars->data[$row][0] = __('Graph mode'); - $options_soft_graphs = []; $options_soft_graphs[0] = __('Show only average by default'); $options_soft_graphs[1] = __('Show MAX/AVG/MIN by default'); -$table_chars->data[$row][1] = html_print_select( - $options_soft_graphs, - 'type_mode_graph', - (isset($config['type_mode_graph']) === true) ? $config['type_mode_graph'] : 0, - '', - '', - 0, - true, - false, - false -); -$row++; - -$table_chars->data[$row][0] = __('Zoom graphs:'); - $options_zoom_graphs = []; $options_zoom_graphs[1] = 'x1'; $options_zoom_graphs[2] = 'x2'; @@ -1094,16 +1057,218 @@ $options_zoom_graphs[3] = 'x3'; $options_zoom_graphs[4] = 'x4'; $options_zoom_graphs[5] = 'x5'; -$table_chars->data[$row][1] = html_print_select( - $options_zoom_graphs, - 'zoom_graph', - $config['zoom_graph'], - '', - '', - 0, - true, - false, - false +$graphColorAmount = 10; +$table_chars = new stdClass(); +$table_chars->width = '100%'; +$table_chars->class = 'filter-table-adv'; +$table_chars->size[0] = '50%'; +$table_chars->size[1] = '50%'; +$table_chars->data = []; + +for ($i = 1; $i <= $graphColorAmount; $i++) { + $table_chars->data[$row][] = html_print_label_input_block( + __('Graph color #'.$i), + html_print_input_color( + 'graph_color'.$i, + $config['graph_color'.$i], + 'graph_color'.$i, + 'w50p', + true + ) + ); + + $row = ($i % 2 === 0) ? ($row + 1) : $row; +} + +$table_chars->data[$row][] = html_print_label_input_block( + __('Data precision'), + html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => $performance_variables_control['graph_precision']->max, + 'name' => 'graph_precision', + 'value' => $config['graph_precision'], + 'return' => true, + 'min' => $performance_variables_control['graph_precision']->min, + 'style' => 'width:50%', + ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', + 'onchange' => 'change_precision()', + ] + ) +); + +$table_chars->data[$row][] = html_print_label_input_block( + __('Data precision in graphs'), + html_print_input( + [ + 'type' => 'number', + 'size' => 5, + 'max' => $performance_variables_control['short_module_graph_data']->max, + 'name' => 'short_module_graph_data', + 'value' => $config['short_module_graph_data'], + 'return' => true, + 'min' => $performance_variables_control['short_module_graph_data']->min, + 'style' => 'width:50%', + ($disabled_graph_precision) ? 'readonly' : '' => 'readonly', + 'onchange' => 'change_precision()', + ] + ) +); +$row++; + +$table_chars->data[$row][] = html_print_label_input_block( + __('Value to interface graphics'), + html_print_input_text( + 'interface_unit', + $config['interface_unit'], + '', + 20, + 20, + true + ) +); + +$table_chars->data[$row][] = html_print_label_input_block( + __('Default line thickness for the Custom Graph.'), + html_print_input_text( + 'custom_graph_width', + $config['custom_graph_width'], + '', + 5, + 5, + true + ) +); +$row++; + +$table_chars->data[$row][] = html_print_label_input_block( + __('Number of elements in Custom Graph'), + html_print_input_text( + 'items_combined_charts', + $config['items_combined_charts'], + '', + 5, + 5, + true, + false, + false, + '' + ) +); +$table_chars->data[$row][] = html_print_label_input_block( + __('Use round corners'), + html_print_checkbox_switch( + 'round_corner', + 1, + $config['round_corner'], + true + ) +); +$row++; + +$table_chars->data[$row][] = html_print_label_input_block( + __('Chart fit to content'), + html_print_checkbox_switch( + 'maximum_y_axis', + 1, + $config['maximum_y_axis'], + true + ) +); + +$table_chars->data[$row][] = html_print_label_input_block( + __('Type of module charts'), + html_print_div( + [ + 'class' => '', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Area').' '.html_print_radio_button( + 'type_module_charts', + 'area', + '', + $config['type_module_charts'] == 'area', + true + ), + ], + true + ).html_print_div( + [ + 'class' => '', + 'content' => __('Line').' '.html_print_radio_button( + 'type_module_charts', + 'line', + '', + $config['type_module_charts'] != 'area', + true + ), + ], + true + ), + ], + true + ) +); +$row++; + +$table_chars->data[$row][] = html_print_label_input_block( + __('Percentile'), + html_print_input_text( + 'percentil', + $config['percentil'], + '', + 20, + 20, + true + ) +); + +$table_chars->data[$row][] = html_print_label_input_block( + __('Graph TIP view'), + html_print_select( + $options_full_escale, + 'full_scale_option', + (isset($config['full_scale_option']) === true) ? $config['full_scale_option'] : 0, + '', + '', + 0, + true, + false, + false + ) +); +$row++; + +$table_chars->data[$row][] = html_print_label_input_block( + __('Graph mode'), + html_print_select( + $options_soft_graphs, + 'type_mode_graph', + (isset($config['type_mode_graph']) === true) ? $config['type_mode_graph'] : 0, + '', + '', + 0, + true, + false, + false + ) +); + +$table_chars->data[$row][] = html_print_label_input_block( + __('Zoom graphs'), + html_print_select( + $options_zoom_graphs, + 'zoom_graph', + $config['zoom_graph'], + '', + '', + 0, + true, + false, + false + ) ); $row++; @@ -1111,23 +1276,6 @@ $row++; // ---------------------------------------------------------------------- // Visual Consoles // ---------------------------------------------------------------------- -$table_vc = new stdClass(); -$table_vc->width = '100%'; -$table_vc->class = 'databox filters'; -$table_vc->style[0] = 'font-weight: bold'; -$table_vc->size[0] = '50%'; -$table_vc->data = []; - -// Remove when the new view reaches rock solid stability. -$table_vc->data[$row][0] = __('Legacy Visual Console View'); -$table_vc->data[$row][1] = html_print_checkbox_switch( - 'legacy_vc', - 1, - (bool) $config['legacy_vc'], - true -); -$row++; - $intervals = [ 10 => '10 '.__('seconds'), 30 => '30 '.__('seconds'), @@ -1137,71 +1285,102 @@ $intervals = [ 1800 => '30 '.__('minutes'), 3600 => '1 '.__('hour'), ]; -$table_vc->data[$row][0] = __('Default cache expiration'); -$table_vc->data[$row][1] = html_print_extended_select_for_time( - 'vc_default_cache_expiration', - $config['vc_default_cache_expiration'], - '', - __('No cache'), - 0, - false, - true, - false, - false, - '', - false, - $intervals -); -$row++; - -$table_vc->data[$row][0] = __('Default interval for refresh on Visual Console'); -$table_vc->data[$row][1] = html_print_select( - $values, - 'vc_refr', - (int) $config['vc_refr'], - '', - 'N/A', - 0, - true, - false, - false -); -$row++; $vc_favourite_view_array[0] = __('Classic view'); $vc_favourite_view_array[1] = __('View of favorites'); -$table_vc->data[$row][0] = __('Type of view of visual consoles'); -$table_vc->data[$row][1] = html_print_select( - $vc_favourite_view_array, - 'vc_favourite_view', - $config['vc_favourite_view'], - '', - '', - 0, - true + +$table_vc = new stdClass(); +$table_vc->width = '100%'; +$table_vc->class = 'filter-table-adv'; +$table_vc->style[0] = 'font-weight: bold'; +$table_vc->size[0] = '50%'; +$table_vc->data = []; + +// Remove when the new view reaches rock solid stability. +$table_vc->data[$row][] = html_print_label_input_block( + __('Legacy Visual Console View'), + html_print_checkbox_switch( + 'legacy_vc', + 1, + (bool) $config['legacy_vc'], + true + ) +); + +$table_vc->data[$row][] = html_print_label_input_block( + __('Default cache expiration'), + html_print_extended_select_for_time( + 'vc_default_cache_expiration', + $config['vc_default_cache_expiration'], + '', + __('No cache'), + 0, + false, + true, + false, + false, + '', + false, + $intervals + ) ); $row++; -$table_vc->data[$row][0] = __('Number of favorite visual consoles to show in the menu'); -$table_vc->data[$row][1] = ""; -$row++; - -$table_vc->data[$row][0] = __('Default line thickness for the Visual Console'); -$table_vc->data[$row][1] = html_print_input_text( - 'vc_line_thickness', - (int) $config['vc_line_thickness'], - '', - 5, - 5, - true +$table_vc->data[$row][] = html_print_label_input_block( + __('Default interval for refresh on Visual Console'), + html_print_select( + $values, + 'vc_refr', + (int) $config['vc_refr'], + '', + 'N/A', + 0, + true, + false, + false + ) ); -$table_vc->data[$row][0] = __('Mobile view not allow visual console orientation'); -$table_vc->data[$row][1] = html_print_checkbox_switch( - 'mobile_view_orientation_vc', - 1, - (bool) $config['mobile_view_orientation_vc'], - true +$table_vc->data[$row][] = html_print_label_input_block( + __('Type of view of visual consoles'), + html_print_select( + $vc_favourite_view_array, + 'vc_favourite_view', + $config['vc_favourite_view'], + '', + '', + 0, + true + ) +); +$row++; + +$table_vc->data[$row][] = html_print_label_input_block( + __('Number of favorite visual consoles to show in the menu'), + "" +); + +$table_vc->data[$row][] = html_print_label_input_block( + __('Default line thickness for the Visual Console'), + html_print_input_text( + 'vc_line_thickness', + (int) $config['vc_line_thickness'], + '', + 5, + 5, + true + ) +); +$row++; + +$table_vc->data[$row][] = html_print_label_input_block( + __('Mobile view not allow visual console orientation'), + html_print_checkbox_switch( + 'mobile_view_orientation_vc', + 1, + (bool) $config['mobile_view_orientation_vc'], + true + ) ); $row++; @@ -1211,123 +1390,35 @@ $row++; // ---------------------------------------------------------------------- $table_ser = new stdClass(); $table_ser->width = '100%'; -$table_ser->class = 'databox filters'; -$table_ser->style[0] = 'font-weight: bold'; +$table_ser->class = 'filter-table-adv'; $table_ser->size[0] = '50%'; $table_ser->data = []; -$table_ser->data['number'][0] = __('Number of favorite services to show in the menu'); -$table_ser->data['number'][1] = ""; +$table_ser->data[0][] = html_print_label_input_block( + __('Number of favorite services to show in the menu'), + "" +); // ---------------------------------------------------------------------- // Reports // ---------------------------------------------------------------------- -$table_report = new stdClass(); -$table_report->width = '100%'; -$table_report->class = 'databox filters'; -$table_report->style[0] = 'font-weight: bold;'; -$table_report->size[0] = '20%'; - -$table_report->data = []; - -$table_report->data[$row][0] = __('Show report info with description'); -$table_report->data[$row][1] = html_print_checkbox_switch( - 'custom_report_info', - 1, - $config['custom_report_info'], - true -); -$row++; - -$table_report->data[$row][0] = __('Custom report front page'); -$table_report->data[$row][1] = html_print_checkbox_switch( - 'custom_report_front', - 1, - $config['custom_report_front'], - true -); - -$row++; - -$table_report->data[$row][0] = __('PDF font size (px)'); -$table_report->data[$row][1] = ""; - -$row++; - -$table_report->data[$row][0] = __('HTML font size for SLA (em)'); -$table_report->data[$row][1] = ""; - -$row++; - -$table_report->data[$row][0] = __('Graph image height for HTML reports'); -$table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true); - -$row++; - $interval_description = [ 'large' => 'Long', 'tiny' => 'Short', ]; -$table_report->data[$row][0] = __('Interval description'); -$table_report->data[$row][1] = html_print_select( - $interval_description, - 'interval_description', - (isset($config['interval_description']) === true) ? $config['interval_description'] : 'large', - '', - '', - '', - true, - false, - false -); -$row++; - -// ---------------------------------------------------------------------- $dirItems = scandir($config['homedir'].'/images/custom_logo'); +$customLogos = []; foreach ($dirItems as $entryDir) { if (strstr($entryDir, '.jpg') !== false || strstr($entryDir, '.png') !== false) { $customLogos['images/custom_logo/'.$entryDir] = $entryDir; } } -// Logo. -$table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( - __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), - true -); - -$table_report->data['custom_report_front-logo'][1] = html_print_select( - $customLogos, - 'custom_report_front_logo', - io_safe_output($config['custom_report_front_logo']), - 'showPreview()', - __('Default'), - '', - true -); -// Preview. -$table_report->data['custom_report_front-preview'][0] = __('Custom report front').' - '.'Preview'; if (empty($config['custom_report_front_logo'])) { $config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg'; } -$table_report->data['custom_report_front-preview'][1] = ''.html_print_image($config['custom_report_front_logo'], true).''; - -// Header. -$table_report->data['custom_report_front-header'][0] = __('Custom report front').' - '.__('Header'); - -// Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. -$table_report->data['custom_report_front-header'][1] = html_print_textarea( - 'custom_report_front_header', - 5, - 15, - io_safe_output($config['custom_report_front_header']), - 'class="w90p height_300px"', - true -); - -// First page. // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. if ($config['custom_report_front']) { $firstpage_content = $config['custom_report_front_firstpage']; @@ -1335,194 +1426,435 @@ if ($config['custom_report_front']) { $firstpage_content = io_safe_output($config['custom_report_front_firstpage']); } -$table_report->data['custom_report_front-first_page'][0] = __('Custom report front').' - '.__('First page'); $custom_report_front_firstpage = str_replace( '(_URLIMAGE_)', ui_get_full_url(false, true, false, false), io_safe_output($firstpage_content) ); -$table_report->data['custom_report_front-first_page'][1] = html_print_textarea( - 'custom_report_front_firstpage', - 15, - 15, - $custom_report_front_firstpage, - 'class="w90p height_300px"', - true + +$table_report = new stdClass(); +$table_report->width = '100%'; +$table_report->class = 'filter-table-adv'; +$table_report->size[0] = '50%'; + +$table_report->data = []; + +$table_report->data[$row][] = html_print_label_input_block( + __('Show report info with description'), + html_print_checkbox_switch( + 'custom_report_info', + 1, + $config['custom_report_info'], + true + ) ); -// Footer. -$table_report->data['custom_report_front-footer'][0] = __('Custom report front').' - '.__('Footer'); +$table_report->data[$row][] = html_print_label_input_block( + __('Custom report front page'), + html_print_checkbox_switch( + 'custom_report_front', + 1, + $config['custom_report_front'], + true + ) +); +$row++; + +$table_report->data[$row][] = html_print_label_input_block( + __('PDF font size (px)'), + "" +); +$table_report->data[$row][] = html_print_label_input_block( + __('HTML font size for SLA (em)'), + "" +); +$row++; + +$table_report->data[$row][] = html_print_label_input_block( + __('Graph image height for HTML reports'), + html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true) +); +$table_report->data[$row][] = html_print_label_input_block( + __('Interval description'), + html_print_select( + $interval_description, + 'interval_description', + (isset($config['interval_description']) === true) ? $config['interval_description'] : 'large', + '', + '', + '', + true, + false, + false + ) +); +$row++; + +// Logo. +$table_report->data['custom_report_front-logo'][] = html_print_label_input_block( + __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( + __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), + true + ), + html_print_select( + $customLogos, + 'custom_report_front_logo', + io_safe_output($config['custom_report_front_logo']), + 'showPreview()', + __('Default'), + '', + true + ) +); +$table_report->data['custom_report_front-preview'][] = html_print_label_input_block( + __('Custom report front').' - '.__('Preview'), + ''.html_print_image($config['custom_report_front_logo'], true).'' +); + +$table_report->colspan['custom_report_front-header'][] = 2; +$table_report->data['custom_report_front-header'][] = html_print_label_input_block( + __('Custom report front').' - '.__('Header'), + html_print_textarea( + 'custom_report_front_header', + 5, + 15, + io_safe_output($config['custom_report_front_header']), + 'class="w90p height_300px"', + true + ) +); + +$table_report->colspan['custom_report_front-first_page'][] = 2; +$table_report->data['custom_report_front-first_page'][] = html_print_label_input_block( + __('Custom report front').' - '.__('First page'), + html_print_textarea( + 'custom_report_front_firstpage', + 15, + 15, + $custom_report_front_firstpage, + 'class="w90p height_300px"', + true + ) +); // Do not remove io_safe_output in textarea. TinyMCE avoids XSS injection. -$table_report->data['custom_report_front-footer'][1] = html_print_textarea( - 'custom_report_front_footer', - 5, - 15, - io_safe_output($config['custom_report_front_footer']), - 'class="w90p height_300px""', - true +$table_report->colspan['custom_report_front-footer'][] = 2; +$table_report->data['custom_report_front-footer'][] = html_print_label_input_block( + __('Custom report front').' - '.__('Footer'), + html_print_textarea( + 'custom_report_front_footer', + 5, + 15, + io_safe_output($config['custom_report_front_footer']), + 'class="w90p height_300px""', + true + ) ); // ---------------------------------------------------------------------- // OTHER CONFIGURATION // ---------------------------------------------------------------------- -$table_other = new stdClass(); -$table_other->width = '100%'; -$table_other->class = 'databox filters'; -$table_other->style[0] = 'font-weight: bold;'; -$table_other->size[0] = '50%'; -$table_other->size[1] = '26%'; -$table_other->size[2] = '12%'; -$table_other->size[3] = '12%'; -$table_other->data = []; - -$row++; - -$table_other->data[$row][0] = __('Networkmap max width'); -$table_other->data[$row][1] = html_print_input_text( - 'networkmap_max_width', - $config['networkmap_max_width'], - '', - 10, - 20, - true -); -$row++; - -$table_other->data[$row][0] = __('Show only the group name'); -$table_other->data[$row][1] = html_print_checkbox_switch( - 'show_group_name', - 1, - $config['show_group_name'], - true -); -$row++; - -$table_other->data[$row][0] = __('Show empty groups in group view'); -$table_other->data[$row][1] = html_print_checkbox_switch( - 'show_empty_groups', - 1, - $config['show_empty_groups'], - true -); -$row++; - -$table_other->data[$row][0] = __('Date format string'); -$table_other->data[$row][1] = ''.__('Example').' '.date($config['date_format']); -$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true); -$row++; - $decimal_separators = [ ',' => ',', '.' => '.', ]; -$table_other->data[$row][0] = __('Decimal separator'); -$table_other->data[$row][1] = html_print_select( - $decimal_separators, - 'decimal_separator', - $config['decimal_separator'], - '', - '', - '', - true, - false, - false +$common_dividers = [ + ';' => ';', + ',' => ',', + '|' => '|', +]; + +$switchProminentTime = html_print_radio_button( + 'prominent_time', + 'comparation', + __('Comparation in rollover'), + ($config['prominent_time'] === 'comparation'), + true +); +$switchProminentTime .= html_print_radio_button( + 'prominent_time', + 'timestamp', + __('Timestamp in rollover'), + ($config['prominent_time'] === 'timestamp'), + true +); +$switchProminentTime .= html_print_radio_button( + 'prominent_time', + 'compact', + __('Compact mode'), + ($config['prominent_time'] === 'compact'), + true ); -$row++; +$csvDividerIconEdit = 'images/edit.svg'; +$csvDividerIconFile = 'images/logs@svg.svg'; -$table_other->data[$row][0] = __('Visible time of successful notifiations'); -$table_other->data[$row][1] .= html_print_input_text('notification_autoclose_time', $config['notification_autoclose_time'], '', 10, 10, true); -$row++; +$isCommonDivider = (in_array($config['csv_divider'], $common_dividers) === true); +$csvDividerIcon = ($isCommonDivider === false) ? $csvDividerIconEdit : $csvDividerIconFile; -if ($config['prominent_time'] === 'comparation') { - $timestamp = false; - $comparation = true; - $compact = false; -} else if ($config['prominent_time'] === 'timestamp') { - $timestamp = true; - $comparation = false; - $compact = false; -} else if ($config['prominent_time'] === 'compact') { - $timestamp = false; - $comparation = false; - $compact = true; -} +$csvDividerInputsSub = html_print_div( + [ + 'class' => ($isCommonDivider === false) ? 'invisible' : '', + 'id' => 'custom_divider_input', + 'content' => html_print_input_text( + 'csv_divider', + $config['csv_divider'], + '', + 20, + 255, + true, + false, + false, + '', + '', + '', + 'off', + false, + '', + '', + '', + ($isCommonDivider === false) + ), + ], + true +); -$table_other->data[$row][0] = __('Timestamp, time comparison, or compact mode'); -$table_other->data[$row][1] = '
'; -$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', __('Comparation in rollover'), $comparation, true); -$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'timestamp', __('Timestamp in rollover'), $timestamp, true); -$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'compact', __('Compact mode'), $compact, true); -$table_other->data[$row][1] .= '
'; +$csvDividerInputsSub .= html_print_div( + [ + 'class' => ($isCommonDivider === true) ? 'invisible' : '', + 'id' => 'common_divider_input', + 'content' => html_print_select( + $common_dividers, + 'csv_divider', + $config['csv_divider'], + '', + '', + '', + true, + false, + false, + '', + ($isCommonDivider === true), + ), + ], + true +); + +$csvDividerInputs = html_print_div( + [ + 'class' => 'mrgn_right_10px', + 'content' => $csvDividerInputsSub, + ], + true +); + +$csvDividerInputs .= html_print_image( + $csvDividerIcon, + true, + [ + 'id' => 'select_csv_divider', + 'class' => 'invert_filter', + ] +); + +$csvDividerBlock = html_print_div( + [ + 'class' => 'flex-row-center', + 'content' => $csvDividerInputs, + ], + true +); + +$options_data_multiplier = []; +$options_data_multiplier[0] = __('Use 1024 when module unit are bytes'); +$options_data_multiplier[1] = __('Use always 1000'); +$options_data_multiplier[2] = __('Use always 1024'); + +$table_other = new stdClass(); +$table_other->width = '100%'; +$table_other->class = 'filter-table-adv'; +$table_other->size[0] = '50%'; +$table_other->size[1] = '50%'; +$table_other->data = []; $row++; +$table_other->data[$row][] = html_print_label_input_block( + __('Networkmap max width'), + html_print_input_text( + 'networkmap_max_width', + $config['networkmap_max_width'], + '', + 10, + 20, + true + ) +); + +$table_other->data[$row][] = html_print_label_input_block( + __('Show only the group name'), + html_print_checkbox_switch( + 'show_group_name', + 1, + $config['show_group_name'], + true + ) +); +$row++; + +$table_other->data[$row][] = html_print_label_input_block( + __('Show empty groups in group view'), + html_print_checkbox_switch( + 'show_empty_groups', + 1, + $config['show_empty_groups'], + true + ) +); + +$table_other->data[$row][] = html_print_label_input_block( + __('Date format string'), + html_print_input_text( + 'date_format', + $config['date_format'], + '', + 30, + 100, + true + ).ui_print_input_placeholder( + __('Example').': '.date($config['date_format']), + true + ) +); +$row++; + +$table_other->data[$row][] = html_print_label_input_block( + __('Decimal separator'), + html_print_select( + $decimal_separators, + 'decimal_separator', + $config['decimal_separator'], + '', + '', + '', + true, + false, + false + ) +); + +$table_other->data[$row][] = html_print_label_input_block( + __('Visible time of successful notifiations'), + html_print_input_text( + 'notification_autoclose_time', + $config['notification_autoclose_time'], + '', + 10, + 10, + true + ) +); +$row++; + +$table_other->data[$row][] = html_print_label_input_block( + __('Timestamp, time comparison, or compact mode'), + html_print_div( + [ + 'class' => 'switch_radio_button', + 'content' => $switchProminentTime, + ], + true + ) +); +$row++; // ---------------------------------------------------------------------- // CUSTOM VALUES POST PROCESS // ---------------------------------------------------------------------- -$table_other->data[$row][0] = __('Custom values post process'); -$table_other->data[$row][1] = __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true); -$table_other->data[$row][2] = __('Text').': '.html_print_input_text('custom_text', '', '', 15, 50, true); -$table_other->data[$row][2] .= ' '; -$table_other->data[$row][2] .= html_print_input_hidden( - 'custom_value_add', - '', - true -); -$table_other->data[$row][3] = html_print_button( - __('Add'), - 'custom_value_add_btn', - false, - '', - [ - 'icon' => 'next', - 'mode' => 'link', - ], - true -); - -$row++; - -$table_other->data[$row][0] = ''; -$table_other->data[$row][1] = __('Delete custom values').': '; -$table_other->data[$row][2] = html_print_select( - post_process_get_custom_values(), - 'custom_values', - '', - '', - '', - '', - true -); $count_custom_postprocess = post_process_get_custom_values(); -$table_other->data[$row][3] = html_print_button( - __('Delete'), - 'custom_values_del_btn', - empty($count_custom_postprocess), - '', - [ - 'icon' => 'delete', - 'mode' => 'link', - ], - true +$table_other->data[$row][] = html_print_label_input_block( + __('Custom values post process'), + html_print_div( + [ + 'class' => 'filter-table-adv-manual', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Value').': '.html_print_input_text('custom_value', '', '', 25, 50, true), + ], + true + ).html_print_div( + [ + 'class' => '', + 'content' => __('Text').': '.html_print_input_text('custom_text', '', '', 15, 50, true), + ], + true + ).html_print_button( + __('Add'), + 'custom_value_add_btn', + false, + '', + [ + 'icon' => 'next', + 'mode' => 'link', + 'style' => 'display: flex; justify-content: flex-end; width: 100%;', + ], + true + ).html_print_input_hidden( + 'custom_value_add', + '', + true + ), + ], + true + ).html_print_div( + [ + 'class' => '', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Delete custom values').html_print_select( + post_process_get_custom_values(), + 'custom_values', + '', + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%' + ), + ], + true + ).html_print_button( + __('Delete'), + 'custom_values_del_btn', + empty($count_custom_postprocess), + '', + [ + 'icon' => 'delete', + 'mode' => 'link', + 'style' => 'display: flex; justify-content: flex-end; width: 100%;', + ], + true + ).html_print_input_hidden( + 'custom_value_to_delete', + '', + true + ), + ], + true + ) ); -// This hidden field will be filled from jQuery before submit. -$table_other->data[$row][1] .= html_print_input_hidden( - 'custom_value_to_delete', - '', - true -); -$table_other->data[$row][3] .= '

'; // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // CUSTOM INTERVAL VALUES // ---------------------------------------------------------------------- -$row++; -$table_other->data[$row][0] = __('Interval values'); $units = [ 1 => __('seconds'), SECONDS_1MINUTE => __('minutes'), @@ -1531,166 +1863,177 @@ $units = [ SECONDS_1MONTH => __('months'), SECONDS_1YEAR => __('years'), ]; -$table_other->data[$row][1] = __('Value').': '; -$table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true); -$table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false); -$table_other->data[$row][3] = html_print_button( - __('Add'), - 'interval_add_btn', - false, - '', - [ - 'icon' => 'next', - 'mode' => 'link', - ], - true -); - -$row++; - -$table_other->data[$row][0] = ''; -$table_other->data[$row][1] = __('Delete interval').': '; -$table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true); -$table_other->data[$row][3] = html_print_button( - __('Delete'), - 'interval_del_btn', - empty($config['interval_values']), - '', - [ - 'icon' => 'delete', - 'mode' => 'link', - ], - true -); - -$table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true); -// This hidden field will be filled from jQuery before submit. -$table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true); -$table_other->data[$row][3] .= '

'; -// ---------------------------------------------------------------------- -$row++; - -$table_other->data[$row][0] = __('Module units'); -$table_other->data[$row][1] = __('Value').': '; -$table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true); -$table_other->data[$row][2] = ''; -$table_other->data[$row][3] = html_print_button( - __('Add'), - 'module_unit_add_btn', - false, - '', - [ - 'icon' => 'next', - 'mode' => 'link', - ], - true -); - -$row++; -$table_other->data[$row][0] = ''; -$table_other->data[$row][1] = __('Delete custom values').': '; -$table_other->data[$row][2] = html_print_select(get_custom_module_units(), 'module_units', '', '', '', '', true, false, true, 'w100p'); -$table_other->data[$row][3] = html_print_button( - __('Delete'), - 'custom_module_unit_del_btn', - empty($count_custom_postprocess), - '', - [ - 'icon' => 'delete', - 'mode' => 'link', - ], - true -); - -$table_other->data[$row][3] .= html_print_input_hidden( - 'custom_module_unit_to_delete', - '', - true -); - -$row++; - -$common_dividers = [ - ';' => ';', - ',' => ',', - '|' => '|', -]; -$table_other->data[$row][0] = __('CSV divider'); -if ($config['csv_divider'] != ';' && $config['csv_divider'] != ',' && $config['csv_divider'] != '|') { - $table_other->data[$row][1] = html_print_input_text( - 'csv_divider', - $config['csv_divider'], - '', - 20, - 255, +$table_other->data[$row][] = html_print_label_input_block( + __('Interval values'), + html_print_div( + [ + 'class' => 'filter-table-adv-manual', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Value').html_print_input_text('interval_value', '', '', 5, 5, true), + ], + true + ).html_print_div( + [ + 'class' => '', + 'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), + ], + true + ).html_print_button( + __('Add'), + 'interval_add_btn', + false, + '', + [ + 'mode' => 'link', + 'style' => 'display: flex; justify-content: flex-end; width: 100%;', + ], + true + ).html_print_input_hidden( + 'interval_values', + $config['interval_values'], + true + ), + ], true - ); - $table_other->data[$row][1] .= ''.html_print_image( - 'images/logs@svg.svg', - true, + ).html_print_div( [ - 'id' => 'select', - 'class' => 'main_menu_icon invert_filter', - ] - ).''; -} else { - $table_other->data[$row][1] = html_print_select( - $common_dividers, - 'csv_divider', - $config['csv_divider'], - '', - '', - '', - true, - false, - false - ); - $table_other->data[$row][1] .= ''.html_print_image( - 'images/edit.svg', - true, - [ - 'id' => 'pencil', - 'class' => 'main_menu_icon invert_filter', - ] - ).''; -} - + 'class' => empty($config['interval_values']) === true ? 'invisible' : '', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Delete interval values').html_print_select( + get_periods( + false, + false + ), + 'intervals', + '', + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%' + ), + ], + true + ).html_print_button( + __('Delete'), + 'interval_del_btn', + empty($config['interval_values']), + '', + [ + 'mode' => 'link', + 'style' => 'display: flex; justify-content: flex-end; width: 100%;', + ], + true + ).html_print_input_hidden( + 'interval_to_delete', + '', + true + ), + ], + true + ) +); $row++; -$decimal_separator = [ - '.' => '.', - ',' => ',', -]; -$table_other->data[$row][0] = __('CSV decimal separator'); -$table_other->data[$row][1] = html_print_select($decimal_separator, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false); + +$table_other->data[$row][] = html_print_label_input_block( + __('Module units'), + html_print_div( + [ + 'class' => 'filter-table-adv-manual', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Value').html_print_input_text('custom_module_unit', '', '', 15, 50, true), + ], + true + ).html_print_div( + [ + 'class' => '', + 'content' => __('Interval').html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false, '', false, 'width: 100%'), + ], + true + ).html_print_button( + __('Add'), + 'module_unit_add_btn', + false, + '', + [ + 'style' => 'display: flex; justify-content: flex-end; width: 100%;', + 'mode' => 'link', + ], + true + ), + ], + true + ).html_print_div( + [ + 'class' => (empty($count_custom_postprocess) === true ? 'invisible' : ''), + 'content' => html_print_div( + [ + 'class' => '', + 'content' => __('Delete custom values').html_print_select( + get_custom_module_units(), + 'module_units', + '', + '', + '', + '', + true, + false, + true, + '', + false, + 'width: 100%' + ), + ], + true + ).html_print_button( + __('Delete'), + 'custom_module_unit_del_btn', + empty($count_custom_postprocess), + '', + [ + 'style' => 'display: flex; justify-content: flex-end; width: 100%;', + 'mode' => 'link', + ], + true + ).html_print_input_hidden( + 'custom_module_unit_to_delete', + '', + true + ), + ], + true + ) +); $row++; -$table_other->data[$row][0] = __('Data multiplier to use in graphs/data'); -$options_data_multiplier = []; -$options_data_multiplier[0] = __('Use 1024 when module unit are bytes'); -$options_data_multiplier[1] = __('Use always 1000'); -$options_data_multiplier[2] = __('Use always 1024'); +$table_other->data[$row][] = html_print_label_input_block( + __('CSV divider'), + $csvDividerBlock +); +$table_other->data[$row][] = html_print_label_input_block( + __('CSV decimal separator'), + html_print_select($decimal_separators, 'csv_decimal_separator', $config['csv_decimal_separator'], '', '', '', true, false, false) +); +$row++; -$table_other->data[$row][1] = html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false);function load_fonts() -{ - global $config; - - $home = str_replace('\\', '/', $config['homedir']); - $dir = scandir($home.'/include/fonts/'); - - $fonts = []; - - foreach ($dir as $file) { - if (strstr($file, '.ttf') !== false) { - $fonts[$home.'/include/fonts/'.$file] = $file; - } - } - - return $fonts; -} - +$table_other->data[$row][] = html_print_label_input_block( + __('Data multiplier to use in graphs/data'), + html_print_select($options_data_multiplier, 'use_data_multiplier', $config['use_data_multiplier'], '', '', 1, true, false, false) +); +$row++; /* * @@ -1743,17 +2086,14 @@ echo ''.__('Other configuration').' '.ui_print_help_icon('other_conf_tab html_print_table($table_other); echo ''; -html_print_div( - [ - 'class' => 'action-buttons w100p', - 'content' => html_print_submit_button( - __('Update'), - 'update_button', - false, - [ 'icon' => 'next' ], - true - ), - ] +html_print_action_buttons( + html_print_submit_button( + __('Update'), + 'update_button', + false, + [ 'icon' => 'next' ], + true + ) ); echo ''; @@ -1768,26 +2108,21 @@ ui_require_javascript_file('pandora'); ?>