diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d48173512f..14de36cabe 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-230307 +Version: 7.0NG.769-230309 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 cb6b963504..c7bdb71c28 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-230307" +pandora_version="7.0NG.769-230309" 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 012a228cd2..aa9f3d34fc 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 => '230307'; +use constant AGENT_BUILD => '230309'; # 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 26931473af..280a0f9cf9 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 230307 +%define release 230309 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 329768dfa7..fbeaabfb83 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 230307 +%define release 230309 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 1a32864bd8..78d93e1b93 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="230307" +PI_BUILD="230309" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 48912e2ff3..be335eee78 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230307} +{230309} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 11a3383389..8ad89b00e1 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 230307") +#define PANDORA_VERSION ("7.0NG.769 Build 230309") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 3c842ed958..1f5b52a6f5 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 230307))" + VALUE "ProductVersion", "(7.0NG.769(Build 230309))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d71a8ffb94..a517d56d88 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230307 +Version: 7.0NG.769-230309 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 ecb6a40251..e4d89b8e69 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-230307" +pandora_version="7.0NG.769-230309" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 44d4bc64b6..d3467b846c 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -377,17 +377,17 @@ function mainAgentsModules() $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; + &full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else if ($full_modules_selected[0] && $full_agents_id[0]) { $full_modules = urlencode(implode(';', $full_modules_selected)); $full_agents = urlencode(implode(';', $full_agents_id)); $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; + &full_agents_id='.$full_agents.'&selection_agent_module='.$selection_a_m.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } else { $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; + offset='.$offset.'&group_id='.$group_id.'&modulegroup='.$modulegroup.'&refresh='.$refr.'&show_type='.$show_type.'">'.html_print_image('images/fullscreen@svg.svg', true, ['title' => __('Full screen mode'), 'class' => 'invert_filter']).''; } } @@ -597,11 +597,11 @@ function mainAgentsModules() echo '
  • '; echo ''; echo html_print_image( - 'images/normal_screen.png', + 'images/exit_fullscreen@svg.svg', true, [ 'title' => __('Back to normal mode'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); echo ''; diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 40b17f4903..ad6282c598 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -1,16 +1,33 @@ '', + 'label' => __('Workspace'), + ], + [ + 'link' => '', + 'label' => __('Users connected'), + ], + ] + ); $check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up'); if ($check_profile === false && !users_is_admin()) { diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index c4915e366d..81526eb129 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -471,10 +471,6 @@ echo sprintf('
    ', $menuTypeClass);
    - - - - diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 1c6cd62be4..fe27bf4bb1 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -34,7 +34,6 @@ $url = sprintf( $url_id_agente ); -enterprise_include('godmode/agentes/module_manager.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_agents.php'; @@ -51,196 +50,10 @@ if (isset($policy_page) === false) { $checked = (bool) get_parameter('checked'); $sec2 = (string) get_parameter('sec2'); -// Table for filter bar. -$filterTable = new stdClass(); -$filterTable->class = 'fixed_filter_bar'; -$filterTable->data = []; -$filterTable->cellstyle[0][0] = 'width:0'; -$filterTable->data[0][0] = __('Search'); -$filterTable->data[1][0] .= html_print_input_text( - 'search_string', - $search_string, - '', - 30, - 255, - true, - false, - false, - '', - '' -); -$filterTable->data[0][0] .= html_print_input_hidden('search', 1, true); - -if ((bool) $policy_page === false) { - $filterTable->data[0][1] = __('Show in hierachy mode'); - $filterTable->data[1][1] = html_print_checkbox_switch( - 'status_hierachy_mode', - '', - ((string) $checked === 'true'), - true, - false, - 'onChange=change_mod_filter();' - ); -} - -$filterTable->data[1][2] = html_print_submit_button( - __('Filter'), - 'filter', - false, - [ - 'icon' => 'search', - 'class' => 'float-right', - 'mode' => 'secondary mini', - ], - true -); - -// Print filter table. -echo '
    '; -html_print_table($filterTable); -echo '
    '; -// Check if there is at least one server of each type available to assign that -// kind of modules. If not, do not show server type in combo. -$network_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_NETWORK -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$wmi_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_WMI -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$plugin_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_PLUGIN -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$prediction_available = db_get_sql( - 'SELECT count(*) - FROM tserver - WHERE server_type = '.SERVER_TYPE_PREDICTION -); -// POSTGRESQL AND ORACLE COMPATIBLE. -$web_available = db_get_sql( - 'SELECT count(*) -FROM tserver -WHERE server_type = '.SERVER_TYPE_WEB -); -// POSTGRESQL AND ORACLE COMPATIBLE. -// Development mode to use all servers. -if ($develop_bypass || is_metaconsole()) { - $network_available = 1; - $wmi_available = 1; - $plugin_available = 1; - // FIXME when prediction predictions server modules can be configured. - // on metaconsole. - $prediction_available = (is_metaconsole() === true) ? 0 : 1; -} - -$modules = []; -$modules['dataserver'] = __('Create a new data server module'); -if ($network_available) { - $modules['networkserver'] = __('Create a new network server module'); -} - -if ($plugin_available) { - $modules['pluginserver'] = __('Create a new plugin server module'); -} - -if ($wmi_available) { - $modules['wmiserver'] = __('Create a new WMI server module'); -} - -if ($prediction_available) { - $modules['predictionserver'] = __('Create a new prediction server module'); -} - -if (is_metaconsole() === true || $web_available >= '1') { - $modules['webserver'] = __('Create a new web Server module'); -} - -if (enterprise_installed() === true) { - set_enterprise_module_types($modules); -} - -if (strstr($sec2, 'enterprise/godmode/policies/policies') !== false) { - // It is unset because the policies haven't a table tmodule_synth and the - // some part of code to apply this kind of modules in policy agents. - // But in the future maybe will be good to make this feature, but remember - // the modules to show in syntetic module policy form must be the policy - // modules from the same policy. - unset($modules['predictionserver']); - if (enterprise_installed() === true) { - unset($modules['webux']); - } -} - -if (($policy_page === true) || (isset($agent) === true)) { - if ($policy_page === true) { - $show_creation = is_management_allowed(); - } else { - if (isset($all_groups) === false) { - $all_groups = agents_get_all_groups_agent( - $agent['id_agente'], - $agent['id_grupo'] - ); - } - - $show_creation = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true; - } -} else { - $show_creation = false; -} - -if ($show_creation === true) { - // Create module/type combo. - $tableCreateModule = new stdClass(); - $tableCreateModule->id = 'create'; - $tableCreateModule->class = 'create_module_dialog'; - $tableCreateModule->width = '100%'; - $tableCreateModule->data = []; - $tableCreateModule->style = []; - - $tableCreateModule->data['caption_type'] = html_print_input_hidden('edit_module', 1); - $tableCreateModule->data['caption_type'] .= __('Type'); - $tableCreateModule->data['type'] = html_print_select( - $modules, - 'moduletype', - '', - '', - '', - '', - true, - false, - false, - '', - false, - 'width:380px;' - ); - - // Link for get more modules. - if ((bool) $config['disable_help'] === false) { - $tableCreateModule->data['get_more_modules'] = html_print_anchor( - [ - 'href' => 'https://pandorafms.com/Library/Library/', - 'target' => '_blank', - 'class' => 'color-black-grey', - 'content' => __('Get more modules on Monitoring Library'), - ], - true - ); - } -} - if (isset($id_agente) === false) { return; } - $module_action = (string) get_parameter('module_action'); if ($module_action === 'delete') { @@ -1256,35 +1069,6 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr [ 'type' => 'data_table' ] ); echo ''; - - - $modalCreateModule = '
    '; - $modalCreateModule .= html_print_table($tableCreateModule, true); - $modalCreateModule .= html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Create'), - 'create_module', - false, - [ - 'icon' => 'next', - 'mode' => 'mini secondary', - ], - true - ), - ], - true - ); - $modalCreateModule .= '
    '; - - html_print_div( - [ - 'id' => 'modal', - 'style' => 'display: none', - 'content' => $modalCreateModule, - ] - ); } ?> diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 66d75c98a7..c3d7563ef5 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -802,7 +802,7 @@ if ($id_agent_module) { __('Delete'), 'deleteModule', false, - 'window.location.assign(\'index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.')', + 'window.location.assign("index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'")', [ 'icon' => 'delete', 'mode' => 'secondary', diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 8f951565c2..085afcb455 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -325,7 +325,7 @@ if ($edit === false) { $table_simple->data['module_n_type'][1] = ''.modules_get_moduletype_description($id_module_type).' ('.$type_names_hash[$id_module_type].')'; } else { - $idModuleType = (isset($id_module_type) === true) ? $idModuleType : ''; + $idModuleType = (isset($id_module_type) === true) ? $id_module_type : ''; // Removed web analysis and log4x from select. $tipe_not_in = '24, 25'; if (is_metaconsole() === true) { @@ -444,7 +444,7 @@ $tableBasicThresholds->data = []; $tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').' '; -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) { +if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_warning_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text( 'min_warning', @@ -482,7 +482,7 @@ if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeM ); } -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) { +if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalWarning = []; $basicThresholdsIntervalWarning[] = ''.__('Inverse interval').''; $basicThresholdsIntervalWarning[] = html_print_checkbox_switch( @@ -531,7 +531,7 @@ $tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div( $tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width'; $tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').' '; -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) { +if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) { $tableBasicThresholds->data['caption_critical_threshold'][0] .= '('.__('Min / Max').')'; $tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text( 'min_critical', @@ -569,7 +569,7 @@ if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeM ); } -if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) { +if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) { $basicThresholdsIntervalCritical = []; $basicThresholdsIntervalCritical[] = ''.__('Inverse interval').''; $basicThresholdsIntervalCritical[] = html_print_checkbox_switch( diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 6e0af65f83..f9c1117377 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -128,6 +128,7 @@ if ($page === 'enterprise/godmode/policies/policy_modules') { // In ICMP modules, port is not configurable. if ($id_module_type !== 6 && $id_module_type !== 7) { + $tcp_port = (empty($tcp_port) === false) ? $tcp_port : get_parameter('tcp_port'); $data[1] = html_print_input_text( 'tcp_port', $tcp_port, @@ -524,7 +525,7 @@ $data[0] .= html_print_button( __('Manage credentials'), 'manage_credentials_button', false, - 'window.location.assign(\'index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox\')', + 'window.location.assign("index.php?sec=gmodules&sec2=godmode/groups/group_list&tab=credbox")', [ 'mode' => 'link' ], true ); diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 08688c623b..32fdcac6be 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -15,7 +15,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 @@ -29,8 +29,6 @@ global $config; - - check_login(); $agent_d = check_acl($config['id_user'], 0, 'AD'); @@ -54,23 +52,33 @@ require_once $config['homedir'].'/include/functions_cron.php'; // Buttons. $buttons = [ 'text' => "".html_print_image( - 'images/list.png', + 'images/logs@svg.svg', true, [ 'title' => __('List'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; // Header. -ui_print_page_header( +ui_print_standard_header( __('Scheduled Downtime'), 'images/gm_monitoring.png', false, '', true, - $buttons + $buttons, + [ + [ + 'link' => '', + 'label' => __('Tools'), + ], + [ + 'link' => '', + 'label' => __('Scheduled Downtime'), + ], + ] ); // Recursion group filter. @@ -813,227 +821,7 @@ if (users_can_manage_group_all('AW') === true || $disabled) { $return_all_group = true; } -$table = new StdClass(); -$table->class = 'databox filters'; -$table->width = '100%'; -$table->data = []; -$table->data[0][0] = __('Name'); -$table->data[0][1] = html_print_input_text( - 'name', - $name, - '', - 25, - 40, - true, - $disabled_in_execution -); -$table->data[1][0] = __('Group'); -$table->data[1][1] = '
    '.html_print_select_groups( - false, - $access, - $return_all_group, - 'id_group', - $id_group, - '', - '', - 0, - true, - false, - true, - '', - $disabled_in_execution -).'
    '; -$table->data[2][0] = __('Description'); -$table->data[2][1] = html_print_textarea( - 'description', - 3, - 35, - $description, - '', - true -); - -$table->data[3][0] = __('Type').ui_print_help_tip( - __('Quiet: Modules will not generate events or fire alerts.').'
    '.__('Disable Agents: Disables the selected agents.').'
    '.__('Disable Alerts: Disable alerts for the selected agents.'), - true -); -$table->data[3][1] = html_print_select( - [ - 'quiet' => __('Quiet'), - 'disable_agents' => __('Disabled Agents'), - 'disable_agent_modules' => __('Disable Modules'), - 'disable_agents_alerts' => __('Disabled only Alerts'), - ], - 'type_downtime', - $type_downtime, - 'change_type_downtime()', - '', - 0, - true, - false, - true, - '', - $disabled_in_execution -); -$table->data[4][0] = __('Execution'); -$table->data[4][1] = html_print_select( - [ - 'once' => __('Once'), - 'periodically' => __('Periodically'), - 'cron' => __('Cron from/to'), - ], - 'type_execution', - $type_execution, - 'change_type_execution();', - '', - 0, - true, - false, - true, - '', - $disabled_in_execution -); - $days = array_combine(range(1, 31), range(1, 31)); -$table->data[5][0] = __('Configure the time').' '; -; -$table->data[5][1] = " - - - '; - -if ($id_downtime > 0) { - echo "
    "; -} else { - echo ''; -} - -// Editor form. -html_print_table($table); - -echo ""; $filter_group = (int) get_parameter('filter_group', 0); @@ -1074,105 +862,467 @@ if (empty($agents) || $disabled_in_execution) { $disabled_add_button = true; } -// Show available agents to include into downtime + $table = new StdClass(); -$table->class = 'databox filters'; +$table->class = 'databox filter-table-adv'; +$table->id = 'principal_table_scheduled'; $table->width = '100%'; +$table->size = []; +$table->size[0] = '50%'; +$table->size[1] = '50%'; $table->data = []; -$table->size[0] = '25%'; - -$table->data[0][0] = __('Group filter'); -$table->data[0][1] = html_print_select_groups( - false, - $access, - $return_all_group, - 'filter_group', - $filter_group, - '', - '', - '', - true, - false, - true, - '', - false, - 'min-width:180px;margin-right:15px;' -); -$table->data[0][2] = __('Recursion').'  '.html_print_checkbox('recursion', 1, $recursion, true, false, ''); - -$table->data[1][0] = __('Available agents'); -$table->data[1][1] = html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, true, true, true, '', false, 'min-width: 250px;width: 70%;'); - - -$table->rowid[2] = 'available_modules_selection_mode'; - -$table->data[2][1] = html_print_select( +$table->data['first_title'][] = html_print_div( [ - 'common' => __('Show common modules'), - 'all' => __('Show all modules'), + 'class' => 'section_table_title', + 'content' => __('Editor'), ], - 'modules_selection_mode', - 'common', - false, - '', - '', - true, - false, - true, - '', - false, - 'min-width:180px;' + true +); +$table->data[0][] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, + '', + 25, + 40, + true, + $disabled_in_execution + ) ); +$table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + $access, + $return_all_group, + 'id_group', + $id_group, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) +); -$table->rowid[3] = 'available_modules'; -$table->data[3][0] = __('Available modules:').ui_print_help_tip( - __('Only for type Quiet for downtimes.'), +$table->data[1][] = html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 3, + 35, + $description, + '', + true + ) +); + +$table->data[1][] = html_print_label_input_block( + __('Type'), + html_print_select( + [ + 'quiet' => __('Quiet'), + 'disable_agents' => __('Disabled Agents'), + 'disable_agent_modules' => __('Disable Modules'), + 'disable_agents_alerts' => __('Disabled only Alerts'), + ], + 'type_downtime', + $type_downtime, + 'change_type_downtime()', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ).ui_print_input_placeholder( + __('Quiet: Modules will not generate events or fire alerts.').'
    '.__('Disable Agents: Disables the selected agents.').'
    '.__('Disable Alerts: Disable alerts for the selected agents.'), + true + ) +); + +$table->data[2][] = html_print_label_input_block( + __('Execution'), + html_print_select( + [ + 'once' => __('Once'), + 'periodically' => __('Periodically'), + 'cron' => __('Cron from/to'), + ], + 'type_execution', + $type_execution, + 'change_type_execution();', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) +); + +$timeInputs = []; + +$timeInputs[] = html_print_div( + [ + 'id' => 'once_time', + 'style' => 'display: none', + 'content' => html_print_div( + [ + 'class' => '', + 'content' => html_print_input_text( + 'once_date_from', + $once_date_from, + '', + 10, + 10, + true, + $disabled_in_execution + ).html_print_input_text( + 'once_time_from', + $once_time_from, + '', + 9, + 9, + true, + $disabled_in_execution + ).''.__( + 'To' + ).''.html_print_input_text( + 'once_date_to', + $once_date_to, + '', + 10, + 10, + true + ).html_print_input_text( + 'once_time_to', + $once_time_to, + '', + 9, + 9, + true + ), + ], + true + ), + ], true ); -$table->data[3][1] = html_print_select( - [], - 'module[]', - '', - '', - '', - 0, - true, - true, - true, - '', - false, - 'min-width: 250px;width: 70%;' +$timeInputs[] = html_print_div( + [ + 'id' => 'periodically_time', + 'style' => 'display: none', + 'content' => html_print_div( + [ + 'class' => 'filter-table-adv-manual w50p', + 'content' => html_print_label_input_block( + __('Type Periodicity'), + html_print_select( + [ + 'weekly' => __('Weekly'), + 'monthly' => __('Monthly'), + ], + 'type_periodicity', + $type_periodicity, + 'change_type_periodicity();', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ) + ), + ], + true + ).html_print_div( + [ + 'id' => 'weekly_item', + 'class' => '', + 'content' => '', + ], + true + ).html_print_div( + [ + 'id' => 'monthly_item', + 'style' => 'margin-top: 12px;', + 'class' => 'filter-table-adv-manual flex-row-start w50p', + 'content' => html_print_label_input_block( + __('From day'), + html_print_select( + $days, + 'periodically_day_from', + $periodically_day_from, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ), + [ 'div_style' => 'flex: 50; margin-right: 5px;' ] + ).html_print_label_input_block( + __('To day'), + html_print_select( + $days, + 'periodically_day_to', + $periodically_day_to, + '', + '', + 0, + true, + false, + true, + '', + $disabled_in_execution + ).ui_print_input_placeholder( + __('The end day must be higher than the start day'), + true + ), + [ 'div_style' => 'flex: 50; margin-left: 5px;' ] + ), + ], + true + ).html_print_div( + [ + 'class' => 'filter-table-adv-manual flex-row-start w50p', + 'content' => html_print_label_input_block( + __('From hour'), + html_print_input_text( + 'periodically_time_from', + $periodically_time_from, + '', + 7, + 7, + true, + $disabled_in_execution + ).ui_print_input_placeholder( + __('The start time must be lower than the end time'), + true + ), + [ 'div_style' => 'flex: 50; margin-right: 5px;' ] + ).html_print_label_input_block( + __('To hour'), + html_print_input_text( + 'periodically_time_to', + $periodically_time_to, + '', + 7, + 7, + true, + $disabled_in_execution + ).ui_print_input_placeholder( + __('The end time must be higher than the start time'), + true + ), + [ 'div_style' => 'flex: 50; margin-left: 5px;' ] + ), + ], + true + ).ui_get_using_system_timezone_warning(), + ], + true +); + +$timeInputs[] = html_print_div( + [ + 'id' => 'cron_time', + 'style' => 'display: none', + 'content' => html_print_label_input_block( + __('Cron from'), + html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, false, false, true, 'from') + ).html_print_label_input_block( + __('Cron to'), + html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, false, true, true, 'to') + ), + ], + true +); + +$table->colspan[3][0] = 2; +$table->data[3][0] = html_print_label_input_block( + __('Configure the time'), + implode('', $timeInputs) +); + +$table->data[4][] = html_print_div( + [ + 'class' => 'section_table_title', + 'content' => __('Filtering'), + ], + true +); + +$table->data[5][] = html_print_label_input_block( + __('Group filter'), + html_print_select_groups( + false, + $access, + $return_all_group, + 'filter_group', + $filter_group, + '', + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;margin-right:15px;' + ) +); + +$table->data[5][] = html_print_label_input_block( + __('Recursion'), + html_print_checkbox_switch( + 'recursion', + 1, + $recursion, + true, + false, + '' + ) +); + +$table->colspan[6][0] = 2; +$availableModules = html_print_label_input_block( + __('Available agents'), + html_print_select( + $agents, + 'id_agents[]', + -1, + '', + __('Any'), + -2, + true, + true, + true, + '', + false, + 'min-width: 250px;width: 70%;' + ), + [ + 'div_class' => 'flex-column', + 'div_style' => 'flex: 33', + ] +); + +$availableModules .= html_print_label_input_block( + __('Selection mode'), + html_print_select( + [ + 'common' => __('Show common modules'), + 'all' => __('Show all modules'), + ], + 'modules_selection_mode', + 'common', + false, + '', + '', + true, + false, + true, + '', + false, + 'min-width:180px;' + ), + [ + 'div_class' => 'available_modules_selection_mode flex-column', + 'div_style' => 'flex: 33', + ] +); + +$availableModules .= html_print_label_input_block( + __('Available modules'), + html_print_select( + [], + 'module[]', + '', + '', + '', + 0, + true, + true, + true, + '', + false, + 'min-width: 250px;width: 70%;' + ).ui_print_input_placeholder( + __('Only for type Quiet for downtimes.'), + true + ), + [ + 'div_class' => 'available_modules flex-column', + 'div_style' => 'flex: 33', + ] +); + +$table->data[6][0] = html_print_div( + [ + 'style' => 'flex-direction: row;align-items: flex-start;', + 'content' => $availableModules, + ], + true ); // Print agent table. +if ($id_downtime > 0) { + echo ""; +} else { + echo ''; +} + html_print_table($table); -echo '


    '; - +$buttons = ''; html_print_input_hidden('id_agent', $id_agent); -echo '
    '; + if ($id_downtime > 0) { html_print_input_hidden('update_downtime', 1); html_print_input_hidden('id_downtime', $id_downtime); - html_print_submit_button( + $buttons .= html_print_submit_button( __('Update'), 'updbutton', false, - 'class="sub upd"' + ['icon' => 'update'], + true ); } else { html_print_input_hidden('create_downtime', 1); - html_print_submit_button( + $buttons .= html_print_submit_button( __('Add'), 'crtbutton', false, - 'class="sub wand"' + ['icon' => 'wand'], + true ); } -echo '
    '; +html_print_action_buttons( + $buttons +); + html_print_input_hidden('all_common_modules', ''); echo '
    '; @@ -1208,11 +1358,17 @@ if (empty($downtimes_agents)) { $table->head[2] = __('OS'); $table->head[3] = __('Last contact'); $table->head['count_modules'] = __('Modules'); + $table->align = []; + $table->align[0] = 'center'; + $table->align[1] = 'center'; + $table->align[2] = 'center'; + $table->align[3] = 'center'; + $table->align[4] = 'center'; if (!$running) { $table->head[5] = __('Actions'); - $table->align[5] = 'center'; - $table->size[5] = '5%'; + $table->align[5] = 'right'; + $table->size[5] = '10%'; } foreach ($downtimes_agents as $downtime_agent) { @@ -1232,7 +1388,13 @@ if (empty($downtimes_agents)) { WHERE id_grupo = '.$downtime_agent['id_grupo'] ); - $data[2] = ui_print_os_icon($downtime_agent['id_os'], true, true); + $data[2] = html_print_div( + [ + 'class' => 'main_menu_icon invert_filter', + 'content' => ui_print_os_icon($downtime_agent['id_os'], false, true), + ], + true + ); $data[3] = $downtime_agent['ultimo_contacto']; @@ -1251,10 +1413,10 @@ if (empty($downtimes_agents)) { if (!$running) { $data[5] = ''; if ($type_downtime !== 'disable_agents') { - $data[5] = ''.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).''; + $data[5] = ''.html_print_image('images/edit.svg', true, ['alt' => __('Edit'), 'class' => 'main_menu_icon invert_filter']).''; } - $data[5] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete'), 'class' => 'invert_filter']).''; + $data[5] .= ''.html_print_image('images/delete.svg', true, ['alt' => __('Delete'), 'class' => 'main_menu_icon invert_filter']).''; } $table->data['agent_'.$downtime_agent['id_agente']] = $data; @@ -1263,17 +1425,7 @@ if (empty($downtimes_agents)) { html_print_table($table); } -$table = new stdClass(); -$table->id = 'loading'; -$table->width = '100%'; -$table->colspan['loading'][0] = '6'; -$table->style[0] = 'text-align: center;'; -$table->data = []; -$table->data['loading'] = []; -$table->data['loading'][0] = html_print_image('images/spinner.gif', true); -echo "'; +ui_print_spinner('Loading'); $table = new stdClass(); $table->id = 'editor'; @@ -1577,13 +1729,13 @@ function insert_downtime_agent($id_downtime, $user_groups_ad) switch ($("#type_downtime").val()) { case 'disable_agents_alerts': case 'disable_agents': - $("#available_modules").hide(); - $("#available_modules_selection_mode").hide(); + $(".available_modules").hide(); + $(".available_modules_selection_mode").hide(); break; case 'quiet': case 'disable_agent_modules': - $("#available_modules_selection_mode").show(); - $("#available_modules").show(); + $(".available_modules_selection_mode").show(); + $(".available_modules").show(); break; } } diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 0eda511a48..da860c1bbc 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 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 @@ -89,7 +89,7 @@ if (is_ajax() === true) { [ 'id' => 'agent_modules_affected_planned_downtime', 'class' => 'info_table', - 'style' => 'width: 100%', + 'style' => 'width: 99%', 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => 'godmode/agentes/planned_downtime.list', @@ -103,6 +103,7 @@ if (is_ajax() === true) { ], 'search_button_class' => 'sub filter float-right', 'form' => [ + 'class' => 'filter-table-adv', 'inputs' => [ [ 'label' => __('Agents'), @@ -207,13 +208,23 @@ if ($migrate_malformed === true) { } // Header. -ui_print_page_header( +ui_print_standard_header( __('Scheduled Downtime'), 'images/gm_monitoring.png', false, '', true, - '' + [], + [ + [ + 'link' => '', + 'label' => __('Tools'), + ], + [ + 'link' => '', + 'label' => __('Scheduled Downtime'), + ], + ], ); $id_downtime = (int) get_parameter('id_downtime', 0); @@ -308,34 +319,8 @@ $filter_params['module_name'] = $module_name; $filter_params_str = http_build_query($filter_params); -// Table filter. -$table_form = new StdClass(); -$table_form->class = 'databox filters'; -$table_form->width = '100%'; -$table_form->rowstyle = []; -$table_form->cellstyle[0] = ['width: 100px;']; -$table_form->cellstyle[1] = ['width: 100px;']; -$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; -$table_form->cellstyle[2] = ['width: 100px;']; -$table_form->cellstyle[3] = ['text-align: right;']; -$table_form->colspan[3][0] = 3; -$table_form->data = []; - -$row = []; - -// Search text. -$row[] = __('Search'); - -$row[] = html_print_input_text( - 'search_text', - $search_text, - '', - 50, - 250, - true -); -// Dates. -$date_inputs = __('From').' '.html_print_input_text( +// From/To inputs. +$date_inputs = html_print_input_text( 'date_from', $date_from, '', @@ -343,8 +328,8 @@ $date_inputs = __('From').' '.html_print_input_text( 10, true ); -$date_inputs .= '  '; -$date_inputs .= __('To').' '.html_print_input_text( +$date_inputs .= ' '.__('To').' '; +$date_inputs .= html_print_input_text( 'date_to', $date_to, '', @@ -352,11 +337,6 @@ $date_inputs .= __('To').' '.html_print_input_text( 10, true ); -$row[] = $date_inputs; - -$table_form->data[] = $row; - -$row = []; // Execution type. $execution_type_fields = [ @@ -364,29 +344,6 @@ $execution_type_fields = [ 'periodically' => __('Periodically'), 'cron' => __('Cron'), ]; -$row[] = __('Execution type'); -$row[] = html_print_select( - $execution_type_fields, - 'execution_type', - $execution_type, - '', - __('Any'), - '', - true, - false, - false -); -// Show past downtimes. -$row[] = __('Show past downtimes').'    '.html_print_switch( - [ - 'name' => 'archived', - 'value' => $show_archived, - ] -); - -$table_form->data[] = $row; - -$row = []; // Agent. $params = []; @@ -397,36 +354,89 @@ $params['return'] = true; $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_name'] = 'agent_id'; $params['hidden_input_idagent_value'] = $agent_id; -$row[] = __('Agent'); -$row[] = ui_print_agent_autocomplete_input($params); -// Module. -$row[] = __('Module').' '.html_print_autocomplete_modules( - 'module_name', - $module_name, - false, - true, - '', - [], - true -); - -$table_form->data[] = $row; - -$row = []; - -$row[] = html_print_submit_button( +// Table filter. +$table_form = new stdClass(); +$table_form->class = 'filter-table-adv'; +$table_form->id = 'filter_scheduled_downtime'; +$table_form->width = '100%'; +$table_form->rowstyle = []; +$table_form->cellstyle[0] = ['width: 100px;']; +$table_form->cellstyle[1] = ['width: 100px;']; +$table_form->cellstyle[1][2] = 'display: flex; align-items: center;'; +$table_form->cellstyle[2] = ['width: 100px;']; +$table_form->cellstyle[3] = ['text-align: right;']; +$table_form->data = []; +// Search text. +$table_form->data[0][] = html_print_label_input_block( __('Search'), - 'search', - false, - [ - 'icon' => 'search', - 'mode' => 'mini', - ], - true + html_print_input_text( + 'search_text', + $search_text, + '', + 50, + 250, + true + ) +); +// From / To. +$table_form->data[0][] = html_print_label_input_block( + __('Between dates'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => $date_inputs, + ], + true + ) +); +// Show past downtimes. +$table_form->data[0][] = html_print_label_input_block( + __('Show past downtimes'), + html_print_switch( + [ + 'name' => 'archived', + 'value' => $show_archived, + ] + ) +); +// Execution type. +$table_form->data[1][] = html_print_label_input_block( + __('Execution type'), + html_print_select( + $execution_type_fields, + 'execution_type', + $execution_type, + '', + __('Any'), + '', + true, + false, + false + ) +); + +$table_form->data[1][] = html_print_label_input_block( + __('Agent'), + ui_print_agent_autocomplete_input($params) +); + +$table_form->data[1][] = html_print_label_input_block( + __('Module'), + html_print_autocomplete_modules( + 'module_name', + $module_name, + false, + true, + '', + [], + true, + 0, + 30, + true + ) ); -$table_form->data[] = $row; // End of table filter. // Useful to know if the user has done a form filtering. $filter_performed = false; @@ -629,41 +639,86 @@ if ($downtimes === false && $filter_performed === false) { // No downtimes cause the user performed a search. // Filter form. echo '
    '; - html_print_table($table_form); + $outputTable = html_print_table($table_form, true); + $outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true + ); + ui_toggle( + $outputTable, + ''.__('Filters').'', + __('Filters'), + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); echo '
    '; // Info message. - echo '
    '.__('No scheduled downtime').'
    '; + ui_print_info_message(__('No scheduled downtime')); // Create button. if ($write_permisson === true) { echo '
    '; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => html_print_submit_button( - __('Create'), - 'create', - false, - ['icon' => 'next'], - true - ), - ] + html_print_action_buttons( + html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'next'], + true + ) ); echo '
    '; } } else { // Has downtimes. echo '
    '; - html_print_table($table_form); + $outputTable = html_print_table($table_form, true); + $outputTable .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Search'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true + ); + ui_toggle( + $outputTable, + ''.__('Filters').'', + __('Filters'), + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); echo '
    '; - ui_pagination( - $downtimes_number, - $url_list.'&'.$filter_params_str, - $offset - ); - // User groups with AR, AD or AW permission. $groupsAD = users_get_groups($config['id_user'], $access); $groupsAD = array_keys($groupsAD); @@ -762,17 +817,17 @@ if ($downtimes === false && $filter_performed === false) { $settings = [ 'url' => ui_get_full_url('ajax.php', false, false, false), 'loadingText' => __('Loading, this operation might take several minutes...'), - 'title' => __('Agents / Modules affected'), + 'title' => __('Elements affected'), 'id' => $downtime['id'], ]; $data['agents_modules'] = ''; $data['agents_modules'] .= html_print_image( - 'images/search_big.png', + 'images/details.svg', true, [ 'title' => __('Agents and modules affected'), - 'style' => 'width:22px; height: 22px;', + 'class' => 'main_menu_icon invert_filter', ] ); $data['agents_modules'] .= ''; @@ -789,15 +844,21 @@ if ($downtimes === false && $filter_performed === false) { $url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $data['stop'] = ''; $data['stop'] .= html_print_image( - 'images/cancel.png', + 'images/fail@svg.svg', true, - ['title' => __('Stop downtime')] + [ + 'title' => __('Stop downtime'), + 'class' => 'main_menu_icon invert_filter', + ] ); } else { $data['stop'] = html_print_image( - 'images/cancel.png', + 'images/fail@svg.svg', true, - ['title' => __('Stop downtime')] + [ + 'title' => __('Stop downtime'), + 'class' => 'main_menu_icon invert_filter', + ] ); } } else { @@ -812,11 +873,11 @@ if ($downtimes === false && $filter_performed === false) { // Copy. $data['copy'] = ''; $data['copy'] .= html_print_image( - 'images/copy.png', + 'images/copy.svg', true, [ 'title' => __('Copy'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['copy'] .= ''; @@ -824,11 +885,11 @@ if ($downtimes === false && $filter_performed === false) { // Edit. $data['edit'] = ''; $data['edit'] .= html_print_image( - 'images/config.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Update'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['edit'] .= ''; @@ -837,11 +898,11 @@ if ($downtimes === false && $filter_performed === false) { $url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str; $data['delete'] = ''; $data['delete'] .= html_print_image( - 'images/cross.png', + 'images/delete.svg', true, [ 'title' => __('Delete'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['delete'] .= ''; @@ -858,22 +919,22 @@ if ($downtimes === false && $filter_performed === false) { // Copy. $data['copy'] = ''; $data['copy'] .= html_print_image( - 'images/copy.png', + 'images/copy.svg', true, [ 'title' => __('Copy'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['copy'] .= ''; // Edit. $data['edit'] = ''; $data['edit'] .= html_print_image( - 'images/config.png', + 'images/configuration@svg.svg', true, [ 'title' => __('Update'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ); $data['edit'] .= ''; @@ -910,44 +971,47 @@ if ($downtimes === false && $filter_performed === false) { } html_print_table($table); - ui_pagination( + $tablePagination = ui_pagination( $downtimes_number, $url_list.'&'.$filter_params_str, $offset, 0, - false, - 'offset', true, - 'pagination-bottom' + 'offset', + false ); - echo '
    '; - - // CSV export button. - echo '
    '; - html_print_button( - __('Export to CSV'), - 'csv_export', - false, - 'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'', - 'class="sub next"' - ); - echo '
    '; - + $actionsButtons = ''; // Create button. if ($write_permisson === true) { - echo ' '; - echo '
    '; - html_print_submit_button( + $actionsButtons .= ''; + $actionsButtons .= html_print_submit_button( __('Create'), 'create', false, - 'class="sub next"' + ['icon' => 'next'], + true ); - echo '
    '; + $actionsButtons .= ''; } - echo '
    '; + // CSV export button. + $actionsButtons .= html_print_button( + __('Export to CSV'), + 'csv_export', + false, + 'blockResubmit($(this)); location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"', + [ + 'icon' => 'load', + 'mode' => 'secondary', + ], + true + ); + + html_print_action_buttons( + $actionsButtons, + [ 'right_content' => $tablePagination ] + ); } ui_require_jquery_file( diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index 610c503cdc..696882e133 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -171,10 +171,10 @@ if (is_ajax()) { $ffield = $editor_type_chkbx; $ffield .= html_print_textarea( 'field'.$i.'_value', - 1, + 5, 1, '', - 'class="fields"', + 'class="fields w100p"', true, '', $is_management_allowed @@ -208,7 +208,7 @@ if (is_ajax()) { $rfield = $editor_type_chkbx; $rfield .= html_print_textarea( 'field'.$i.'_recovery_value', - 1, + 5, 1, '', 'class="fields_recovery"', @@ -307,7 +307,8 @@ if (is_ajax()) { false, false, 'fields', - $is_management_allowed + $is_management_allowed, + 'width: 100%;' ); $rfield .= html_print_select( @@ -321,7 +322,8 @@ if (is_ajax()) { false, false, 'fields', - $is_management_allowed + $is_management_allowed, + 'width: 100%;' ); $ffield .= html_print_input_text('field'.$i.'_value[]', '', '', 10, 10, true, false, false, '', 'datepicker'); @@ -329,7 +331,7 @@ if (is_ajax()) { $ffield .= html_print_textarea( 'field'.$i.'_value[]', - 1, + 5, 1, '', 'style="min-height:40px; '.$style.'" class="fields"', @@ -341,7 +343,7 @@ if (is_ajax()) { $rfield .= html_print_textarea( 'field'.$i.'_recovery_value[]', - 1, + 5, 1, '', 'style="min-height:40px; '.$style.'" class="fields_recovery', @@ -484,20 +486,20 @@ if (is_ajax()) { } else { $ffield = html_print_textarea( 'field'.$i.'_value', - 1, + 5, 1, $fv[0], - 'style="'.$style.'" class="fields min-height-40px"', + 'style="'.$style.'" class="fields min-height-40px w100p"', true, '', $is_management_allowed ); $rfield = html_print_textarea( 'field'.$i.'_recovery_value', - 1, + 5, 1, $fv[0], - 'style="'.$style.'" class="fields_recovery min-height-40px', + 'style="'.$style.'" class="fields_recovery min-height-40px w100p', true, '', $is_management_allowed @@ -507,20 +509,20 @@ if (is_ajax()) { } else { $ffield = html_print_textarea( 'field'.$i.'_value', - 1, + 5, 1, '', - 'style="'.$style.'" class="fields min-height-40px"', + 'style="'.$style.'" class="fields min-height-40px w100p"', true, '', $is_management_allowed ); $rfield = html_print_textarea( 'field'.$i.'_recovery_value', - 1, + 5, 1, '', - 'style="'.$style.'" class="fields_recovery min-height-40px"', + 'style="'.$style.'" class="fields_recovery min-height-40px w100p"', true, '', $is_management_allowed @@ -533,7 +535,7 @@ if (is_ajax()) { $fields_rows[$i] = ''; } else { $fields_rows[$i] = ''; - $fields_rows[$i] .= ''.$fdesc.''; + $fields_rows[$i] .= ''.$fdesc.''; $fields_rows[$i] .= ''.$ffield.''; if ($get_recovery_fields) { $fields_rows[$i] .= ''.$rfield.''; @@ -575,12 +577,19 @@ if ($update_command) { if (defined('METACONSOLE')) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Alert commands'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Alert commands'), + ], + ] ); } @@ -811,10 +820,9 @@ foreach ($commands as $command) { array_push($table->data, $data); } -ui_pagination($total_commands, $url); if (isset($data) === true && count($table->data) > 0) { html_print_table($table); - ui_pagination($total_commands, $url, 0, 0, false, 'offset', true, 'pagination-bottom'); + $pagination = ui_pagination($total_commands, $url, 0, 0, true, 'offset', false, ''); } else { ui_print_info_message( [ @@ -826,12 +834,17 @@ if (isset($data) === true && count($table->data) > 0) { // Commands can only be created by the super administrator. if (users_is_admin() === true) { - echo '
    '; echo '
    '; - html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); + $buttonSubmit = html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'wand'], + true + ); html_print_input_hidden('create_alert', 1); + html_print_action_buttons($buttonSubmit, ['right_content' => $pagination]); echo '
    '; - echo '
    '; } ?> diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index eb1d6d32ee..de5d93a082 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -68,12 +68,19 @@ if ($al_action !== false) { if (defined('METACONSOLE')) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Configure alert action'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, - 'alert_config', - true + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configure alert action'), + ], + ] ); } } else { @@ -81,12 +88,19 @@ if ($al_action !== false) { if (defined('METACONSOLE')) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Configure alert action'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, - 'alert_config', - true + '', + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configure alert action'), + ], + ] ); } @@ -290,73 +304,99 @@ $table->data[1][1] = html_print_label_input_block( ) ); -$table->data[2][0] = html_print_label_input_block( +$table_macros = new stdClass(); +$table_macros->id = 'table_macros'; +$table_macros->width = '100%'; +$table_macros->class = 'databox filters filter-table-adv'; +$table_macros->style = []; +$table_macros->size = []; +$table_macros->size[0] = '20%'; +$table_macros->size[1] = '40%'; +$table_macros->size[2] = '40%'; +$table_macros->data = []; + +$table_macros->data[0][0] = ''; +$table_macros->data[0][1] = html_print_label_input_block( + __('Triggering'), + '' +); + +$table_macros->data[0][2] = html_print_label_input_block( __('Recovery'), '' ); -$table->data[2][1] = html_print_label_input_block( - __('Recovery'), +$table_macros->data[1][0] = html_print_label_input_block( + __('Command preview'), '' ); -$table->data[5][0] = __('Command preview'); -$table->data[5][1] = html_print_textarea( - 'command_preview', - 5, - 30, +$table_macros->data[1][1] = html_print_label_input_block( '', - 'disabled="disabled"', - true + html_print_textarea( + 'command_preview', + 5, + 30, + '', + 'disabled="disabled"', + true + ) ); -$table->data[5][2] = html_print_textarea( - 'command_recovery_preview', - 5, - 30, + +$table_macros->data[1][2] = html_print_label_input_block( '', - 'disabled="disabled"', - true + html_print_textarea( + 'command_recovery_preview', + 5, + 30, + '', + 'disabled="disabled"', + true + ) ); // Selector will work only with Integria activated. $integriaIdName = 'integria_wu'; -$table->data[$integriaIdName][0] = __('Create workunit on recovery').ui_print_help_tip( - __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), - true -); -$table->data[$integriaIdName][1] = html_print_checkbox_switch_extended( - 'create_wu_integria', - 1, - $create_wu_integria, - false, - '', - $disabled_attr, - true +$table_macros->colspan[$integriaIdName][0] = 3; +$table_macros->data[$integriaIdName][0] = html_print_label_input_block( + __('Create workunit on recovery').ui_print_help_tip( + __('If closed status is set on recovery, a workunit will be added to the ticket in Integria IMS rather that closing the ticket.'), + true + ), + html_print_checkbox_switch_extended( + 'create_wu_integria', + 1, + $create_wu_integria, + false, + '', + $disabled_attr, + true + ) ); for ($i = 1; $i <= $config['max_macro_fields']; $i++) { - $table->data['field'.$i][0] = html_print_image( + $table_macros->data['field'.$i][0] = html_print_image( 'images/spinner.gif', true ); - $table->data['field'.$i][1] = html_print_image( + $table_macros->data['field'.$i][1] = html_print_image( 'images/spinner.gif', true ); - $table->data['field'.$i][2] = html_print_image( + $table_macros->data['field'.$i][2] = html_print_image( 'images/spinner.gif', true ); // Store the value in a hidden to keep it on first execution - $table->data['field'.$i][1] .= html_print_input_hidden( + $table_macros->data['field'.$i][1] .= html_print_input_hidden( 'field'.$i.'_value', (!empty($action['field'.$i]) || $action['field'.$i] == 0) ? $action['field'.$i] : '', true, '', $disabled_attr ); - $table->data['field'.$i][2] .= html_print_input_hidden( + $table_macros->data['field'.$i][2] .= html_print_input_hidden( 'field'.$i.'_recovery_value', (!empty($action['field'.$i.'_recovery']) || $action['field'.$i] == 0) ? $action['field'.$i.'_recovery'] : '', true, @@ -369,10 +409,12 @@ $offset = (int) get_parameter('offset', 0); echo '
    '; $table_html = html_print_table($table, true); +$table_html_macros = html_print_table($table_macros, true); $backButton = ''; $submitButton = ''; echo $table_html; +echo $table_html_macros; if ($is_management_allowed === true) { if ($id) { html_print_input_hidden('id', $id); diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 4316f4a881..1631f2f24e 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -54,12 +54,19 @@ $alert = []; if (is_metaconsole() === true) { alerts_meta_print_header(); } else { - ui_print_page_header( - __('Alerts').' » '.__('Configure alert command'), + ui_print_standard_header( + __('Alerts'), 'images/gm_alerts.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configure alert command'), + ], + ] ); } @@ -199,112 +206,23 @@ if ($is_management_allowed === false) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; - -if (is_metaconsole() === true) { - $table->head[0] = ($id) ? __('Update Command') : __('Create Command'); - $table->head_colspan[0] = 4; - $table->headstyle[0] = 'text-align: center'; -} +$table->class = 'databox filters filter-table-adv'; $table->style = []; -if (is_metaconsole() === false) { - $table->style[0] = 'font-weight: bold'; - $table->style[2] = 'font-weight: bold'; - $table->style[4] = 'font-weight: bold'; -} $table->size = []; -$table->size[0] = '20%'; +$table->size[0] = '45%'; +$table->size[1] = '45%'; +$table->size[2] = '10%'; $table->data = []; -$table->colspan['name'][1] = 3; -$table->data['name'][0] = __('Name'); -$table->data['name'][2] = html_print_input_text( - 'name', - $name, - '', - 35, - 255, - true, - false, - false, - '', - '', - '', - '', - false, - '', - '', - '', - !$is_management_allowed -); - -$table->colspan['command'][1] = 3; -$table->data['command'][0] = __('Command'); -$table->data['command'][1] = html_print_textarea( - 'command', - 8, - 30, - $command, - '', - true, - '', - !$is_management_allowed -); - -$return_all_group = false; - -if (users_can_manage_group_all('LM') === true) { - $return_all_group = true; -} - -$table->colspan['group'][1] = 3; -$table->data['group'][0] = __('Group'); -$table->data['group'][1] = '
    '.html_print_select_groups( - false, - 'LM', - $return_all_group, - 'id_group', - $id_group, - false, - '', - 0, - true, - false, - true, - '', - !$is_management_allowed -).'
    '; - -$table->colspan['description'][1] = 3; -$table->data['description'][0] = __('Description'); -$table->data['description'][1] = html_print_textarea( - 'description', - 10, - 30, - $description, - '', - true, - '', - !$is_management_allowed -); - - -for ($i = 1; $i <= $config['max_macro_fields']; $i++) { - $table->data['field'.$i][0] = sprintf(__('Field %s description'), $i); - - if (empty($fields_descriptions) === false) { - $field_description = $fields_descriptions[($i - 1)]; - } else { - $field_description = ''; - } - - $table->data['field'.$i][1] = html_print_input_text( - 'field'.$i.'_description', - $field_description, +$table->data[0][0] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, '', - 30, + 35, 255, true, false, @@ -318,12 +236,91 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) { '', '', !$is_management_allowed - ); + ) +); - $table->data['field'.$i][2] = sprintf(__('Field %s values'), $i); - $table->data['field'.$i][2] .= ui_print_help_tip( - __('value1,tag1;value2,tag2;value3,tag3'), - true +if (users_can_manage_group_all('LM') === true) { + $return_all_group = true; +} + +$table->data[0][1] = html_print_label_input_block( + __('Group'), + html_print_select_groups( + false, + 'LM', + $return_all_group, + 'id_group', + $id_group, + false, + '', + 0, + true, + false, + true, + '', + !$is_management_allowed + ) +); + +$table->data[1][0] = html_print_label_input_block( + __('Command'), + html_print_textarea( + 'command', + 8, + 30, + $command, + '', + true, + '', + !$is_management_allowed + ) +); + +$return_all_group = false; + + +$table->data[1][1] = html_print_label_input_block( + __('Description'), + html_print_textarea( + 'description', + 8, + 30, + $description, + '', + true, + '', + !$is_management_allowed + ) +); + +for ($i = 1; $i <= $config['max_macro_fields']; $i++) { + if (empty($fields_descriptions) === false) { + $field_description = $fields_descriptions[($i - 1)]; + } else { + $field_description = ''; + } + + $table->data['field'.$i][0] = html_print_label_input_block( + sprintf(__('Field %s description'), $i), + html_print_input_text( + 'field'.$i.'_description', + $field_description, + '', + 30, + 255, + true, + false, + false, + '', + '', + '', + '', + false, + '', + '', + '', + !$is_management_allowed + ) ); if (empty($fields_values) === false) { @@ -338,54 +335,72 @@ for ($i = 1; $i <= $config['max_macro_fields']; $i++) { $selected = false; } - $table->data['field'.$i][3] = html_print_input_text( - 'field'.$i.'_values', - $field_values, - '', - 55, - 1000, - true, - false, - false, - '', - 'field_value', - '', - '', - false, - '', - '', - '', - !$is_management_allowed + $table->data['field'.$i][1] = html_print_label_input_block( + sprintf(__('Field %s values'), $i).ui_print_help_tip( + __('value1,tag1;value2,tag2;value3,tag3'), + true + ), + html_print_input_text( + 'field'.$i.'_values', + $field_values, + '', + 55, + 1000, + true, + false, + false, + '', + 'field_value', + '', + '', + false, + '', + '', + '', + !$is_management_allowed + ) ); - $table->data['field'.$i][4] = __('Hide'); - - $table->data['field'.$i][5] = html_print_checkbox_extended( - 'field'.$i.'_hide', - 1, - $selected, - !$is_management_allowed, - 'cursor: \'pointer\'', - 'class="hide_inputs"', - true + $table->data['field'.$i][2] = html_print_label_input_block( + __('Hide'), + html_print_checkbox_extended( + 'field'.$i.'_hide', + 1, + $selected, + !$is_management_allowed, + 'cursor: \'pointer\'', + 'class="hide_inputs"', + true + ) ); } -echo ''; +echo ''; html_print_table($table); if ($is_management_allowed === true) { - echo '
    '; if ($id) { html_print_input_hidden('id', $id); html_print_input_hidden('update_command', 1); - html_print_submit_button(__('Update'), 'create', false, 'class="sub upd"'); + $buttonSubmit = html_print_submit_button( + __('Update'), + 'create', + false, + ['icon' => 'wand'], + true + ); } else { html_print_input_hidden('create_command', 1); - html_print_submit_button(__('Create'), 'create', false, 'class="sub wand"'); + $buttonSubmit = html_print_submit_button( + __('Create'), + 'create', + false, + ['icon' => 'wand'], + true + ); } - echo '
    '; + html_print_action_buttons($buttonSubmit); } echo '
    '; diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index d598e294c0..95785a0edd 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -738,14 +738,7 @@ if ($tab == 'tree') { * Group tree view. */ - echo html_print_image( - 'images/spinner.gif', - true, - [ - 'class' => 'loading_tree', - 'style' => 'display: none;', - ] - ); + ui_print_spinner(__('Loading')); echo "
    "; } else { /* @@ -1042,7 +1035,7 @@ $tab = 'group_edition'; if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0) treeController.recipient.empty(); - $(".loading_tree").show(); + showSpinner(); var parameters = {}; parameters['page'] = "include/ajax/tree.ajax"; @@ -1066,7 +1059,7 @@ $tab = 'group_edition'; data: parameters, success: function(data) { if (data.success) { - $(".loading_tree").hide(); + hideSpinner(); treeController.init({ recipient: $("div#tree-controller-recipient"), diff --git a/pandora_console/godmode/modules/manage_inventory_modules.php b/pandora_console/godmode/modules/manage_inventory_modules.php index 5422ae451b..a8faa13a66 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules.php +++ b/pandora_console/godmode/modules/manage_inventory_modules.php @@ -332,14 +332,16 @@ if ($result === false) { if ($management_allowed === true) { // Update module. - $data[4] = ''; - $data[4] .= html_print_image('images/config.png', true, ['border' => '0', 'title' => __('Update'), 'class' => 'invert_filter']).''; + $data[4] = '
    '; + $data[4] .= ''; + $data[4] .= html_print_image('images/edit.svg', true, ['border' => '0', 'title' => __('Update'), 'class' => 'main_menu_icon invert_filter']).''; // Delete module. $data[4] .= ''; - $data[4] .= html_print_image('images/cross.png', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'invert_filter']); + $data[4] .= html_print_image('images/delete.svg', true, ['border' => '0', 'title' => __('Delete'), 'class' => 'main_menu_icon invert_filter']); $data[4] .= '  '; $data[4] .= html_print_checkbox_extended('delete_multiple[]', $row['id_module_inventory'], false, false, '', 'class="check_delete"', true); + $data[4] .= '
    '; } array_push($table->data, $data); @@ -349,22 +351,50 @@ if ($result === false) { html_print_input_hidden('multiple_delete', 1); html_print_table($table); echo ''; - $tablePagination = ui_pagination($total_modules, 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', $offset, 0, true, 'offset', false); - $actionButtons = []; + echo '
    '; + echo html_print_input_hidden('create_module_inventory', 1); + echo ''; + + $tablePagination = ui_pagination( + $total_modules, + 'index.php?sec='.$sec.'&sec2=godmode/modules/manage_inventory_modules', + $offset, + 0, + true, + 'offset', + false + ); + + $actionButtons = ''; if ($management_allowed === true) { - $actionButtons[] = html_print_submit_button(__('Delete'), 'delete_btn', false, ['icon' => 'delete', 'mode' => 'secondary', 'form' => 'form_delete'], true); - $actionButtons[] = html_print_submit_button(__('Create'), 'crt', false, ['icon' => 'wand', 'form' => 'form_create'], true); + $actionButtons .= html_print_submit_button( + __('Create'), + 'crt', + false, + [ + 'icon' => 'wand', + 'form' => 'form_create', + ], + true + ); - $actionButtons[] = ''; - $actionButtons[] = html_print_input_hidden('create_module_inventory', 1, true); - $actionButtons[] = ''; + $actionButtons .= html_print_submit_button( + __('Delete'), + 'delete_btn', + false, + [ + 'icon' => 'delete', + 'mode' => 'secondary', + 'form' => 'form_delete', + ], + true + ); } - html_print_action_buttons( - implode('', $actionButtons), + $actionButtons, [ 'type' => 'form_action', 'right_content' => $tablePagination, diff --git a/pandora_console/godmode/modules/manage_inventory_modules_form.php b/pandora_console/godmode/modules/manage_inventory_modules_form.php index 65597d7af1..32424b7f39 100644 --- a/pandora_console/godmode/modules/manage_inventory_modules_form.php +++ b/pandora_console/godmode/modules/manage_inventory_modules_form.php @@ -26,22 +26,32 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], // Header -if (defined('METACONSOLE')) { +if (is_metaconsole() === true) { $sec = 'advanced'; enterprise_include_once('meta/include/functions_components_meta.php'); components_meta_print_header(); } else { $sec = 'gmodules'; - ui_print_page_header( - __('Module management').' » '.__('Inventory modules'), + ui_print_standard_header( + __('Module management'), 'images/op_inventory.png', false, '', - true + true, + [], + [ + [ + 'link' => '', + 'label' => __('Configuration'), + ], + [ + 'link' => '', + 'label' => __('Inventory modules'), + ], + ] ); } -// Header $is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'; if ($is_windows) { ui_print_error_message(__('Not supported in Windows systems')); @@ -95,82 +105,166 @@ if ($id_os == null) { $table = new stdClass(); $table->width = '100%'; -$table->class = 'databox filters'; +$table->class = 'databox filter-table-adv'; $table->style = []; -$table->style[0] = 'font-weight: bold'; +$table->style[0] = 'width: 50%'; +$table->style[1] = 'width: 50%'; $table->data = []; -$table->data[0][0] = ''.__('Name').''; -$table->data[0][1] = html_print_input_text('name', $name, '', 45, 100, true, $disabled); -$table->data[1][0] = ''.__('Description').''; -$table->data[1][1] = html_print_input_text('description', $description, '', 60, 500, true); -$table->data[2][0] = ''.__('OS').''; -$table->data[2][1] = html_print_select_from_sql( - 'SELECT id_os, name FROM tconfig_os ORDER BY name', - 'id_os', - $id_os, - '', - '', - '', - $return = true + +$table->data[0][] = html_print_label_input_block( + __('Name'), + html_print_input_text( + 'name', + $name, + '', + 45, + 100, + true, + $disabled + ) ); -$table->data[3][0] = ''.__('Interpreter').''; -$table->data[3][1] = html_print_input_text('interpreter', $interpreter, '', 25, 100, true); -$table->data[3][1] .= ui_print_help_tip(__('Left blank for the LOCAL inventory modules'), true); +$table->data[0][] = html_print_label_input_block( + __('Description'), + html_print_input_text( + 'description', + $description, + '', + 60, + 500, + true + ) +); -$table->data['block_mode'][0] = ''.__('Block Mode').''; -$table->data['block_mode'][1] = html_print_checkbox('block_mode', 1, $block_mode, true); +$table->data[1][] = html_print_label_input_block( + __('OS'), + html_print_select_from_sql( + 'SELECT id_os, name FROM tconfig_os ORDER BY name', + 'id_os', + $id_os, + '', + '', + '', + $return = true + ) +); -$table->data[4][0] = ''.__('Format').''; -$table->data[4][0] .= ui_print_help_tip(__('separate fields with ').SEPARATOR_COLUMN, true); -$table->data[4][1] = html_print_input_text('format', $data_format, '', 50, 100, true); +$table->data[1][] = html_print_label_input_block( + __('Interpreter'), + html_print_input_text( + 'interpreter', + $interpreter, + '', + 25, + 100, + true + ).ui_print_input_placeholder( + __('Left blank for the LOCAL inventory modules'), + true + ) +); -$table->data[5][0] = ''.__('Script mode').''; -$table->data[5][0] .= ui_print_help_tip(__(''), true); -$table->data[5][1] = __('Use script'); -$table->data[5][1] .= html_print_radio_button( - 'script_mode', - 1, - '', - $script_mode, - true -).'  '; -$table->data[5][1] .= '    '.__('Use inline code'); -$table->data[5][1] .= html_print_radio_button( - 'script_mode', - 2, - '', - $script_mode, - true -).'  '; +$table->data[2][] = html_print_label_input_block( + __('Format'), + html_print_input_text( + 'format', + $data_format, + '', + 50, + 100, + true + ).ui_print_input_placeholder( + __('separate fields with ').SEPARATOR_COLUMN, + true + ) +); -$table->data[6][0] = ''.__('Script path').''; -$table->data[6][1] = html_print_input_text('script_path', $script_path, '', 50, 1000, true); +$table->data[2][] = html_print_label_input_block( + __('Block Mode'), + html_print_checkbox_switch( + 'block_mode', + 1, + $block_mode, + true + ) +); -$table->data[7][0] = ''.__('Code').''; -$table->data[7][0] .= ui_print_help_tip(__("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, true); +$radioButtons = []; +$radioButtons[] = html_print_radio_button('script_mode', 1, __('Script mode'), $script_mode, true); +$radioButtons[] = html_print_radio_button('script_mode', 2, __('Use inline code'), $script_mode, true); -$table->data[7][1] = html_print_textarea('code', 25, 80, base64_decode($code), '', true); +$table->data[3][] = html_print_label_input_block( + __('Script mode'), + html_print_div( + [ + 'class' => 'switch_radio_button', + 'content' => implode('', $radioButtons), + ], + true + ) +); -echo 'colspan[4][0] = 2; + +$table->data[4][0] = html_print_label_input_block( + __('Script path'), + html_print_input_text( + 'script_path', + $script_path, + '', + 50, + 1000, + true + ), + ['div_class' => 'script_path_inventory_modules'] +); + +$table->data[4][0] .= html_print_label_input_block( + __('Code'), + html_print_textarea( + 'code', + 25, + 80, + base64_decode($code), + '', + true + ).ui_print_input_placeholder( + __("Here is placed the script for the REMOTE inventory modules Local inventory modules don't use this field").SEPARATOR_COLUMN, + true + ), + ['div_class' => 'code_inventory_modules'] +); + +echo ''; html_print_table($table); if ($id_module_inventory) { html_print_input_hidden('update_module_inventory', 1); html_print_input_hidden('id_module_inventory', $id_module_inventory); + $buttonCaption = __('Update'); + $buttonIcon = 'update'; } else { html_print_input_hidden('create_module_inventory', 1); + $buttonCaption = __('Create'); + $buttonIcon = 'wand'; } -echo '
    '; -if ($id_module_inventory) { - html_print_submit_button(__('Update'), 'submit', false, 'class="sub next"'); -} else { - html_print_submit_button(__('Create'), 'submit', false, 'class="sub upd"'); -} +$actionButtons = ''; +$actionButtons = html_print_submit_button( + $buttonCaption, + 'submit', + false, + ['icon' => $buttonIcon], + true +); +$actionButtons .= html_print_go_back_button( + 'index.php?sec=gmodules&sec2=godmode/modules/manage_inventory_modules', + ['button_class' => ''], + true +); -echo '
    '; +html_print_action_buttons($actionButtons); echo '
    '; ?> @@ -180,21 +274,21 @@ echo ''; var mode = ; if (mode == 1) { - $('#table1-6').show(); - $('#table1-7').hide(); + $('.script_path_inventory_modules').show(); + $('.code_inventory_modules').hide(); } else { - $('#table1-7').show(); - $('#table1-6').hide(); + $('.code_inventory_modules').show(); + $('.script_path_inventory_modules').hide(); } $('input[type=radio][name=script_mode]').change(function() { if (this.value == 1) { - $('#table1-6').show(); - $('#table1-7').hide(); + $('.script_path_inventory_modules').show(); + $('.code_inventory_modules').hide(); } else if (this.value == 2) { - $('#table1-7').show(); - $('#table1-6').hide(); + $('.code_inventory_modules').show(); + $('.script_path_inventory_modules').hide(); } }); }); diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index 44d35d3f06..7ef20ca385 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -615,18 +615,6 @@ $url = ui_get_url_refresh( true, false ); -$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components'; -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; - -$table->style = []; -$table->style[0] = 'font-weight: bold'; -$table->style[2] = 'font-weight: bold'; - -$table->data = []; - -$table->data[0][0] = __('Group'); $component_groups = network_components_get_groups(); @@ -656,54 +644,81 @@ foreach ($component_groups as $component_group_key => $component_group_val) { } } -$table->data[0][1] = html_print_select( - $component_groups, - 'search_id_group', - $search_id_group, +$name_url = 'index.php?sec=templates&sec2=godmode/modules/manage_network_components'; +$table = new stdClass(); +$table->width = '100%'; +$table->class = 'filter-table-adv'; + +$table->style = []; +$table->style[0] = 'font-weight: bold'; +$table->style[2] = 'font-weight: bold'; + +$table->data = []; + +$table->data[0][] = html_print_label_input_block( + __('Group'), + html_print_select( + $component_groups, + 'search_id_group', + $search_id_group, + '', + __('All'), + 0, + true, + false, + false, + '', + false, + 'width: 100%' + ) +); + +$table->data[0][] = html_print_label_input_block( + __('Free Search'), + html_print_input_text( + 'search_string', + $search_string, + '', + 25, + 255, + true + ).ui_print_input_placeholder( + __('Search by name, description, tcp send or tcp rcv, list matches.'), + true + ) +); + +$toggleFilters = '
    '; +$toggleFilters .= html_print_table($table, true); +$toggleFilters .= html_print_div( + [ + 'class' => 'action-buttons-right-forced', + 'content' => html_print_submit_button( + __('Filter'), + 'search', + false, + [ + 'icon' => 'search', + 'mode' => 'mini', + ], + true + ), + ], + true +); +$toggleFilters .= '
    '; + +ui_toggle( + $toggleFilters, + ''.__('Filters').'', + 'filter_form', '', - __('All'), - 0, true, false, - false -); -$table->data[0][2] = __('Free Search').ui_print_help_tip( - __('Search by name, description, tcp send or tcp rcv, list matches.'), - true -); -$table->data[0][3] = html_print_input_text( - 'search_string', - $search_string, '', - 25, - 255, - true + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' ); -if (is_metaconsole() === true) { - $table->data[0][4] = '
    '; -} else { - $table->data[0][4] = '
    '; -} - -$table->data[0][4] .= html_print_submit_button( - __('Search'), - 'search', - false, - 'class="sub search"', - true -); -$table->data[0][4] .= '
    '; - -if (is_metaconsole() === true) { - $filter = '
    '; - $filter .= html_print_table($table, true); - $filter .= '
    '; - ui_toggle($filter, __('Show Options')); -} else { - echo '
    '; - html_print_table($table); - echo '
    '; -} $filter = []; if ($search_id_group) { @@ -721,7 +736,6 @@ $total_components = network_components_get_network_components( ); $total_components = $total_components[0]['total']; $offset_delete = ($offset >= ($total_components - 1)) ? ($offset - $config['block_size']) : $offset; -ui_pagination($total_components, $name_url); $filter['offset'] = (int) get_parameter('offset'); $filter['limit'] = (int) $config['block_size']; $components = network_components_get_network_components( @@ -935,30 +949,20 @@ html_print_action_buttons( ?> "; $returnString = ob_get_clean(); diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index be9ac48424..a43150c94e 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -612,8 +612,8 @@ function snmp_browser_print_oid( $table->head[1] = __('OID Information'); $output .= html_print_table($table, true); - $url = 'index.php?'.'sec=gmodules&'.'sec2=godmode/modules/manage_network_components'; - $output .= '
    '; + $url = 'index.php?sec=gmodules&sec2=godmode/modules/manage_network_components'; + $output .= ''; $output .= html_print_input_hidden('create_network_from_snmp_browser', 1, true); $output .= html_print_input_hidden('id_component_type', 2, true); $output .= html_print_input_hidden('type', 17, true); @@ -638,19 +638,21 @@ function snmp_browser_print_oid( __('Create network component'), 'create_network_component', false, - 'class="sub add float-left mrgn_right_20px"', + 'class="buttonButton mrgn_right_20px"', true ); - // Hidden by default. - $output .= html_print_button( - __('Create agent module'), - 'create_module_agent_single', - false, - 'show_add_module()', - 'class="sub add invisible"', - true - ); + if (isset($_POST['print_create_agent_module'])) { + // Hidden by default. + $output .= html_print_button( + __('Create agent module'), + 'create_module_agent_single', + false, + 'show_add_module()', + 'class="sub add invisible"', + true + ); + } // Select agent modal. $output .= snmp_browser_print_create_modules(true); @@ -685,7 +687,8 @@ function snmp_browser_print_container( $width='100%', $height='60%', $display='', - $show_massive_buttons=false + $show_massive_buttons=false, + $toggle=false ) { global $config; @@ -948,8 +951,22 @@ function snmp_browser_print_container( ); $table->data[2] .= '
    '; + if ($toggle == true) { + $print_create_agent_module = 1; + } else { + $print_create_agent_module = 0; + } + $searchForm = ''; $searchForm .= html_print_table($table, true); + $searchForm .= html_print_input_hidden( + 'print_create_agent_module', + $print_create_agent_module, + true, + false, + false, + 'print_create_agent_module' + ); $searchForm .= html_print_div( [ 'class' => 'action-buttons', @@ -969,17 +986,19 @@ function snmp_browser_print_container( $searchForm .= ''; - ui_toggle( - $searchForm, - ''.__('Filters').'', - 'filter_form', - '', - false, - false, - '', - 'white-box-content', - 'box-flat white_table_graph fixed_filter_bar' - ); + if ($toggle == true) { + ui_toggle( + $searchForm, + ''.__('Filters').'', + 'filter_form', + '', + false, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); + } // Search tools. $table2 = new stdClass(); @@ -1101,6 +1120,62 @@ function snmp_browser_print_container( ); $output .= ''; + if ($toggle === false) { + // This extra div that can be handled by jquery's dialog. + $output .= '