diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index bc1d1e3daa..ab737ff36d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.749-201005 +Version: 7.0NG.749-201006 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 28a9e6d2fa..4fe12ce31c 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.749-201005" +pandora_version="7.0NG.749-201006" 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 84cd94f28a..b55209fed9 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -55,7 +55,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.749'; -use constant AGENT_BUILD => '201005'; +use constant AGENT_BUILD => '201006'; # 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 a5a990d6e6..0f0a04cbbf 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.749 -%define release 201005 +%define release 201006 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 04ce74c9bf..95f9026cc8 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.749 -%define release 201005 +%define release 201006 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 b05175fc4d..048f64ba12 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.749" -PI_BUILD="201005" +PI_BUILD="201006" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 9308d0d994..239772ab28 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{201005} +{201006} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 635cd5088e..dc043b0018 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.749(Build 201005)") +#define PANDORA_VERSION ("7.0NG.749(Build 201006)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 4ceed10dc3..5e8175e1e7 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.749(Build 201005))" + VALUE "ProductVersion", "(7.0NG.749(Build 201006))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 28686ad891..88fb874920 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.749-201005 +Version: 7.0NG.749-201006 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 d4496a9afa..f0005f36d4 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.749-201005" +pandora_version="7.0NG.749-201006" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index c0ed354631..4fd7be94ae 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -92,7 +92,9 @@ function mainAgentsAlerts() $groups = users_get_groups(); $filter_groups .= ''.__('Group').''; + $filter_groups .= '
'; $filter_groups .= html_print_select_groups(false, 'AR', true, 'group_id', $group_id, false, '', '', true, false, true, '', false, 'margin-right: 10px; margin-top: 5px;'); + $filter_groups .= '
'; $check = ''.__('Show modules without alerts').''; $check .= html_print_checkbox('slides_ids[]', $d['id'], $show_modules, true, false, '', true); diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 3c576fecf2..8aa032c9a8 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -389,8 +389,8 @@ function mainAgentsModules() $filter_groups_label = ''.__('Group').''; $filter_groups = html_print_select_groups(false, 'AR', true, 'group_id', $group_id, '', '', '', true, false, true, '', false, 'width: auto;'); - $filter_recursion_label = ''.__('Recursion').''; - $filter_recursion = html_print_checkbox('recursion', 1, 0, true); + $filter_recursion_label = ''.__('Recursion').''; + $filter_recursion = html_print_checkbox('recursion', 1, 0, true).''; // Groups module. $filter_module_groups_label = ''.__('Module group').''; $filter_module_groups = html_print_select_from_sql( diff --git a/pandora_console/extensions/files_repo/files_repo_form.php b/pandora_console/extensions/files_repo/files_repo_form.php index b8e6a084b9..212d9e399a 100644 --- a/pandora_console/extensions/files_repo/files_repo_form.php +++ b/pandora_console/extensions/files_repo/files_repo_form.php @@ -53,7 +53,28 @@ foreach ($groups as $id => $name) { $row = []; $row[0] = __('Groups'); -$row[1] = html_print_select($groups, 'groups[]', $groups_selected, '', '', '', true, true, '', '', ''); +$row[1] = '
'.html_print_select_groups( + // Id_user. + false, + // Privilege. + 'AR', + // ReturnAllGroup. + true, + // Name. + 'groups[]', + // Selected. + $groups_selected, + // Script. + '', + // Nothing. + '', + // Nothing_value. + 0, + // Return. + true, + // Multiple. + true +).'
'; $table->data[] = $row; $table->colspan[][1] = 3; diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 195574040e..f4014de907 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -322,7 +322,16 @@ $table_primary_group = '

'.__('P $table_primary_group .= '

'; // Cannot change primary group if user have not permission for that group. if (isset($groups[$grupo]) || $new_agent) { - $table_primary_group .= html_print_select_groups(false, 'AR', false, 'grupo', $grupo, '', '', 0, true); + $table_primary_group .= html_print_input( + [ + 'type' => 'select_groups', + 'returnAllGroup' => false, + 'name' => 'grupo', + 'selected' => $grupo, + 'return' => true, + 'required' => true, + ] + ); } else { $table_primary_group .= groups_get_name($grupo); $table_primary_group .= html_print_input_hidden('grupo', $grupo, true); @@ -424,44 +433,66 @@ if (enterprise_installed()) { $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $adv_secondary_groups_label = '

'.__('Secondary groups').'

'; $adv_secondary_groups_left = html_print_select_groups( - false, + // Id_user. // Use the current user to select the groups. - 'AR', - // ACL permission. false, + // Privilege. + // ACL permission. + 'AR', + // ReturnAllGroup. // Not all group. - 'secondary_groups', + false, + // Name. // HTML id. - '', + 'secondary_groups', + // Selected. // No select any by default. '', + // Script. // Javascript onChange code. '', + // Nothing. // Do not user no selected value. - 0, + false, + // Nothing_value. // Do not use no selected value. - true, + 0, + // Return. // Return HTML (not echo). true, + // Multiple. // Multiple selection. true, + // Sort. // Sorting by default. - '', + true, + // Class. // CSS classnames (default). - false, + '', + // Disabled. // Not disabled (default). - 'min-width:170px;', - // Inline styles (default). false, + // Style. + // Inline styles (default). + 'min-width:170px;', + // Option_style. // Option style select (default). false, + // Id_group. // Do not truncate the users tree (default). - 'id_grupo', - // Key to get as value (default). false, + // Keys_field. + // Key to get as value (default). + 'id_grupo', + // Strict_user. // Not strict user (default). - $secondary_groups_selected['plain'] + false, + // Delete_groups. // Do not show the primary group in this selection. + array_merge($secondary_groups_selected['plain'], [$agent['id_grupo']]) + // Include_groups. + // Size. + // Simple_multiple_options. ); $adv_secondary_groups_arrows = html_print_input_image( @@ -489,30 +520,30 @@ if (enterprise_installed()) { ); $adv_secondary_groups_right .= html_print_select( - $secondary_groups_selected['for_select'], // Values. - 'secondary_groups_selected', + $secondary_groups_selected['for_select'], // HTML id. - '', + 'secondary_groups_selected', // Selected. '', // Javascript onChange code. '', // Nothing selected. - 0, + false, // Nothing selected. - true, + 0, // Return HTML (not echo). true, // Multiple selection. true, // Sort. - '', + true, // Class. - false, + '', // Disabled. - 'min-width:170px;' + false, // Style. + 'min-width:170px;' ); // Safe operation mode. diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 989d8e7cec..d4036bd68c 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -173,8 +173,9 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_ $return_all_group = true; } +echo '
'; html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false); - +echo '
'; echo ''; echo __('Show Agents').' '; $fields = [ diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 3a055678e8..b3e7029dbd 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -645,7 +645,7 @@ $table->data[0][1] = html_print_input_text( $disabled_in_execution ); $table->data[1][0] = __('Group'); -$table->data[1][1] = html_print_select_groups( +$table->data[1][1] = '
'.html_print_select_groups( false, $access, true, @@ -659,7 +659,7 @@ $table->data[1][1] = html_print_select_groups( true, '', $disabled_in_execution -); +).'
'; $table->data[2][0] = __('Description'); $table->data[2][1] = html_print_textarea( 'description', diff --git a/pandora_console/godmode/alerts/alert_special_days.php b/pandora_console/godmode/alerts/alert_special_days.php index 11e9732773..a27c02ea9a 100644 --- a/pandora_console/godmode/alerts/alert_special_days.php +++ b/pandora_console/godmode/alerts/alert_special_days.php @@ -296,7 +296,9 @@ if (!users_can_manage_group_all('LM')) { $can_manage_group_all = true; } +echo '
'; html_print_select_groups(false, 'LM', $can_manage_group_all, 'id_group', $id_group, false, '', 0, false, false, true, '', false, 'width:100px;'); +echo '
'; echo ''; echo __('Overwrite'); ui_print_help_tip(__('Check this box, if you want to overwrite existing same days.'), false); diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 0c9f2c6931..4d49cdd22b 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -168,7 +168,7 @@ $table->data[1][0] = __('Group'); $own_info = get_user_info($config['id_user']); -$table->data[1][1] = html_print_select_groups( +$table->data[1][1] = '
'.html_print_select_groups( false, 'LW', true, @@ -182,7 +182,7 @@ $table->data[1][1] = html_print_select_groups( true, '', $is_central_policies_on_node -); +).'
'; $table->colspan[1][1] = 2; $table->data[2][0] = __('Command'); diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 9300dc038b..99b676ccd7 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -218,7 +218,7 @@ $table->data['command'][1] = html_print_textarea( $table->colspan['group'][1] = 3; $table->data['group'][0] = __('Group'); -$table->data['group'][1] = html_print_select_groups( +$table->data['group'][1] = '
'.html_print_select_groups( false, 'LM', true, @@ -232,7 +232,7 @@ $table->data['group'][1] = html_print_select_groups( true, '', $is_central_policies_on_node -); +).'
'; $table->colspan['description'][1] = 3; $table->data['description'][0] = __('Description'); diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 16957efbe4..be0948ee97 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -1099,7 +1099,7 @@ if ($step == 2) { } $table->data[0][1] .= ' '; - $table->data[0][1] .= html_print_select_groups( + $table->data[0][1] .= '
'.html_print_select_groups( false, 'AR', $display_all_group, @@ -1113,7 +1113,7 @@ if ($step == 2) { true, '', $is_central_policies_on_node - ); + ).'
'; $table->data[1][0] = __('Description'); diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index a677c6f801..56201e3a28 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -241,7 +241,7 @@ if ($returnAllGroup === false && $id_group_filter == 0) { $returnAllGroup = true; } -$table->data[1][1] = html_print_select_groups( +$table->data[1][1] = '
'.html_print_select_groups( $config['id_user'], $access, $returnAllGroup, @@ -260,21 +260,21 @@ $table->data[1][1] = html_print_select_groups( false, 'id_grupo', $strict_user -); +).'
'; $table->data[2][0] = ''.__('Group').''; $display_all_group = (users_is_admin() || users_can_manage_group_all('AR')); -$table->data[2][1] = html_print_select_groups( +$table->data[2][1] = '
'.html_print_select_groups( $config['id_user'], 'AR', $display_all_group, 'id_group', - $idGroup, + $id_group, '', '', '', true -); +).'
'; $types = get_event_types(); // Expand standard array to add not_normal (not exist in the array, used only for searches) diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 7fe4d6e876..72fe425fca 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -145,7 +145,8 @@ if ($id_group) { $table->data[2][1] = __('You have not access to the parent.').html_print_input_hidden('id_parent', $id_parent, true); } else { - $table->data[2][1] = html_print_select_groups( + $table->data[2][1] = '
'; + $table->data[2][1] .= html_print_select_groups( false, 'AR', true, @@ -163,9 +164,12 @@ if ($id_group) { false, $id_group ); + $table->data[2][1] .= '
'; } } else { - $table->data[2][1] = html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true); + $table->data[2][1] = '
'; + $table->data[2][1] .= html_print_select_groups(false, 'AR', true, 'id_parent', $id_parent, '', '', '', true); + $table->data[2][1] .= '
'; } if ($acl_parent) { diff --git a/pandora_console/godmode/reporting/create_container.php b/pandora_console/godmode/reporting/create_container.php index 5cfcb14338..e35b1f7a54 100644 --- a/pandora_console/godmode/reporting/create_container.php +++ b/pandora_console/godmode/reporting/create_container.php @@ -222,12 +222,14 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) { } echo "".__('Group').''; +echo '
'; if ($id_container === '1') { echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', true); } else { echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', false); } +echo '
'; echo ''; echo ''; @@ -500,7 +502,7 @@ if ($edit_container) { $data = []; $data[0] = __('Group'); - $data[1] = html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true); + $data[1] = '
'.html_print_select_groups($config['id_user'], 'RW', $return_all_groups, 'container_id_group', $id_group, '', '', '', true).'
'; $table->data[] = $data; $table->rowclass[] = ''; diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php index e6e0bcb862..d50a5d8b55 100644 --- a/pandora_console/godmode/reporting/graph_builder.main.php +++ b/pandora_console/godmode/reporting/graph_builder.main.php @@ -1,29 +1,44 @@ "; - +$url = 'index.php?sec=reporting&sec2=godmode/reporting/graph_builder'; if ($edit_graph) { - echo "
"; + $output = ""; } else { - echo ""; + $output = ""; } -echo ''; -echo "".__('Name').''; -echo "'; +$output .= "'; +$output .= '>'; $own_info = get_user_info($config['id_user']); -echo ''.__('Group').''; +$output .= ''.__('Group').''; if (check_acl($config['id_user'], 0, 'RW')) { - echo html_print_select_groups($config['id_user'], 'RW', true, 'graph_id_group', $id_group, '', '', '', true); + $output .= html_print_select_groups( + $config['id_user'], + 'RW', + true, + 'graph_id_group', + $id_group, + '', + '', + '', + true + ); } else if (check_acl($config['id_user'], 0, 'RM')) { - echo html_print_select_groups($config['id_user'], 'RM', true, 'graph_id_group', $id_group, '', '', '', true); + $output .= html_print_select_groups( + $config['id_user'], + 'RM', + true, + 'graph_id_group', + $id_group, + '', + '', + '', + true + ); } -echo ''; -echo ''; -echo "".__('Description').''; -echo "'; -echo ''; +$output .= ''; +$output .= ''; if ($stacked == CUSTOM_GRAPH_GAUGE) { $hidden = ' style="display:none;" '; } else { $hidden = ''; } -echo ''; -echo ""; -echo ''.__('Period').''; -echo ""; -html_print_extended_select_for_time('period', $period, '', '', '0', 10); -echo ""; -echo ''.__('Type of graph').''; -echo "
"; +$output .= ''; +$output .= ""; +$output .= ''.__('Period').''; +$output .= ""; +$output .= html_print_extended_select_for_time( + 'period', + $period, + '', + '', + '0', + 10, + true +); +$output .= ""; +$output .= ''.__('Type of graph').''; +$output .= "
"; require_once $config['homedir'].'/include/functions_graph.php'; @@ -158,85 +205,149 @@ $stackeds = [ CUSTOM_GRAPH_VBARS => __('Vertical bars'), CUSTOM_GRAPH_PIE => __('Pie'), ]; -html_print_select($stackeds, 'stacked', $stacked); +$output .= html_print_select($stackeds, 'stacked', $stacked, '', '', 0, true); -echo '
'; +$output .= '
'; -echo "".__('Percentil').''; -echo "".html_print_checkbox('percentil', 1, $percentil, true).''; -echo "".__('Equalize maximum thresholds').''; -echo "".html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, true, false, '', false); -echo ''; -echo "".__('Add summatory series').''; -echo "".html_print_checkbox('summatory_series', 1, $summatory_series, true)." -".__('Add average series').''; -echo "".html_print_checkbox('average_series', 1, $average_series, true).''; -echo "".__('Modules and series').''; +$output .= ''; +$output .= ""; +$output .= __('Equalize maximum thresholds'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'threshold', + CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, + $check, + true, + false, + '', + false +); +$output .= ''; -echo "".html_print_checkbox('modules_series', 1, $modules_series, true).''; -echo "".__('Show full scale graph (TIP)').''; -echo "".html_print_checkbox('fullscale', 1, $fullscale, true).''; -echo ''; -echo ''; +$output .= ""; +$output .= __('Percentil'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'percentil', + 1, + $percentil, + true +); +$output .= ''; +$output .= ''; + +$output .= ""; +$output .= __('Add summatory series'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'summatory_series', + 1, + $summatory_series, + true +); +$output .= ""; +$output .= __('Add average series'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox( + 'average_series', + 1, + $average_series, + true +); +$output .= ''; +$output .= ""; +$output .= __('Modules and series'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox('modules_series', 1, $modules_series, true); +$output .= ''; +$output .= ""; +$output .= __('Show full scale graph (TIP)'); +$output .= ''; +$output .= ""; +$output .= html_print_checkbox('fullscale', 1, $fullscale, true); +$output .= ''; +$output .= ''; + +$output .= ''; if ($edit_graph) { - echo "
"; + $output .= "
"; + $output .= ""; + $output .= '
'; } else { - echo "
"; + $output .= "
"; + $output .= ""; + $output .= '
'; } -echo ''; +$output .= ''; +echo $output; +?> +'; + $("#checkbox-summatory_series").change(function() { + if( $("#checkbox-summatory_series").is(":checked") && + $("#checkbox-modules_series").is(":disabled") + ) { + $("#checkbox-modules_series").removeAttr("disabled"); + } else if(!$("#checkbox-average_series").is(":checked")) { + $("#checkbox-modules_series").attr("disabled", true); + $("#checkbox-modules_series").attr("checked", false); + } + }); + + $("#checkbox-average_series").change(function() { + if( $("#checkbox-average_series").is(":checked") && + $("#checkbox-modules_series").is(":disabled") + ) { + $("#checkbox-modules_series").removeAttr("disabled"); + } else if(!$("#checkbox-summatory_series").is(":checked")) { + $("#checkbox-modules_series").attr("disabled", true); + $("#checkbox-modules_series").attr("checked", false); + } + }); + }); + diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php index 23aa4b0771..f0262f6e5f 100644 --- a/pandora_console/godmode/reporting/graph_builder.php +++ b/pandora_console/godmode/reporting/graph_builder.php @@ -1,16 +1,31 @@ $config['id_user'], 'name' => $name, @@ -114,7 +131,7 @@ if ($add_graph) { if (trim($name) != '') { $id_graph = db_process_sql_insert('tgraph', $values); if ($id_graph !== false) { - db_pandora_audit('Report management', "Create graph #$id_graph"); + db_pandora_audit('Report management', 'Create graph #'.$id_graph); } else { db_pandora_audit('Report management', 'Fail try to create graph'); } @@ -166,9 +183,15 @@ if ($update_graph) { ['id_graph' => $id_graph] ); if ($success !== false) { - db_pandora_audit('Report management', "Update graph #$id_graph"); + db_pandora_audit( + 'Report management', + 'Update graph #'.$id_graph + ); } else { - db_pandora_audit('Report management', "Fail try to update graph #$id_graph"); + db_pandora_audit( + 'Report management', + 'Fail try to update graph #'.$id_graph + ); } } else { $success = false; @@ -188,12 +211,12 @@ if ($add_module) { $id_agents = get_parameter('id_agents'); $weight = get_parameter('weight'); - // Id modules has double entities conversion - // Safe output remove all entities + // Id modules has double entities conversion. + // Safe output remove all entities. io_safe_output_array($id_modules, ''); // We need to put the entities again - // to browse in db + // to browse in db. io_safe_input_array($id_modules); $id_agent_modules = db_get_all_rows_sql( @@ -304,23 +327,39 @@ switch ($tab) { } if ($add_graph) { - ui_print_result_message($id_graph, __('Graph stored successfully'), __('There was a problem storing Graph')); + ui_print_result_message( + $id_graph, + __('Graph stored successfully'), + __('There was a problem storing Graph') + ); } if ($add_module) { - ui_print_result_message($result, __('Module added successfully'), __('There was a problem adding Module')); + ui_print_result_message( + $result, + __('Module added successfully'), + __('There was a problem adding Module') + ); } if ($update_graph) { - ui_print_result_message($success, __('Update the graph'), __('Bad update the graph')); + ui_print_result_message( + $success, + __('Update the graph'), + __('Bad update the graph') + ); } if ($delete_module) { - ui_print_result_message($result, __('Graph deleted successfully'), __('There was a problem deleting Graph')); + ui_print_result_message( + $result, + __('Graph deleted successfully'), + __('There was a problem deleting Graph') + ); } -// Parse CHUNK information into showable information -// Split id to get all parameters +// Parse CHUNK information into showable information. +// Split id to get all parameters. if (!$delete_module) { if (isset($_POST['period'])) { $period = $_POST['period']; diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 75aaa35d2d..9f8b8f0162 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -307,8 +307,9 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'VR')) { $return_all_group = true; } +echo '
'; html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false); - +echo '
'; echo ""; echo __('Group Recursion').' '; html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()'); diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index ed12e6b714..db1303d907 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1264,6 +1264,7 @@ $class = 'databox filters'; '; if (check_acl($config['id_user'], 0, 'RW')) { html_print_select_groups( $config['id_user'], @@ -1284,6 +1285,8 @@ $class = 'databox filters'; ); } + echo '
'; + echo '   '.__('Recursion').'   '.html_print_checkbox_switch( 'recursion', 1, @@ -2122,7 +2125,7 @@ $class = 'databox filters'; diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index 652de3552c..b8b375bed1 100755 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -92,122 +92,113 @@ $table->data['group'][0] = __('Group'); $write_groups = users_get_groups_for_select(false, 'AR', true, true, false, 'id_grupo'); - html_print_select_groups( - $config['id_user'], - 'AR', - true, - 'id_group', - $idGroup, + + + +// If the report group is not among the RW groups (special permission) we add it +if (!isset($write_groups[$idGroupReport]) && $idGroupReport) { + $write_groups[$idGroupReport] = groups_get_name($idGroupReport); +} + +$table->data['group'][1] = '
'; +$table->data['group'][1] .= html_print_select_groups( + $config['id_user'], + 'AR', + true, + 'id_group', + $idGroupReport, + '', + '', + '', + true +); +$table->data['group'][1] .= '
'; + +if ($report_id_user == $config['id_user'] + || is_user_admin($config['id_user']) +) { + // S/he is the creator of report (or admin) and s/he can change the access. + $type_access = [ + 'group_view' => __('Only the group can view the report'), + 'group_edit' => __('The next group can edit the report'), + 'user_edit' => __('Only the user and admin user can edit the report'), + ]; + $table->data['access'][0] = __('Write Access').ui_print_help_tip(__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'), true); + $table->data['access'][1] = html_print_select( + $type_access, + 'type_access', + $type_access_selected, + 'change_type_access(this)', '', + 0, + true + ); + + $style = 'display: none;'; + if ($type_access_selected == 'group_edit') { + $style = ''; + } + + $table->data['access'][1] .= ''; + $table->data['access'][1] .= '
'; + $table->data['access'][1] .= html_print_select_groups( + false, + 'RW', + false, + 'id_group_edit', + $id_group_edit, + false, '', '', true ); + $table->data['access'][1] .= '
'; + $table->data['access'][1] .= '
'; +} - - // If the report group is not among the RW groups (special permission) we add it - if (!isset($write_groups[$idGroupReport]) && $idGroupReport) { - $write_groups[$idGroupReport] = groups_get_name($idGroupReport); +if ($enterpriseEnable) { + $non_interactive_check = false; + if (isset($non_interactive)) { + $non_interactive_check = $non_interactive; } - $table->data['group'][1] = html_print_select( - $write_groups, - 'id_group', - $idGroupReport, - false, + $table->data['interactive_report'][0] = __('Non interactive report'); + $table->data['interactive_report'][1] = __('Yes').'   '.html_print_radio_button( + 'non_interactive', + 1, '', + $non_interactive_check, + true + ).'  '; + $table->data['interactive_report'][1] .= __('No').'   '.html_print_radio_button( + 'non_interactive', + 0, '', - true, - false, - false + $non_interactive_check, + true ); +} - if ($report_id_user == $config['id_user'] - || is_user_admin($config['id_user']) - ) { - // S/he is the creator of report (or admin) and s/he can change the access. - $type_access = [ - 'group_view' => __('Only the group can view the report'), - 'group_edit' => __('The next group can edit the report'), - 'user_edit' => __('Only the user and admin user can edit the report'), - ]; - $table->data['access'][0] = __('Write Access').ui_print_help_tip(__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'), true); - $table->data['access'][1] = html_print_select( - $type_access, - 'type_access', - $type_access_selected, - 'change_type_access(this)', - '', - 0, - true - ); +$table->data['description'][0] = __('Description'); +$table->data['description'][1] = html_print_textarea('description', 5, 15, $description, '', true); - $style = 'display: none;'; - if ($type_access_selected == 'group_edit') { - $style = ''; - } +echo '
'; +html_print_table($table); - $table->data['access'][1] .= ' - '.html_print_select_groups( - false, - 'RW', - false, - 'id_group_edit', - $id_group_edit, - false, - '', - '', - true - ).' - '; - } - - if ($enterpriseEnable) { - $non_interactive_check = false; - if (isset($non_interactive)) { - $non_interactive_check = $non_interactive; - } - - $table->data['interactive_report'][0] = __('Non interactive report'); - $table->data['interactive_report'][1] = __('Yes').'   '.html_print_radio_button( - 'non_interactive', - 1, - '', - $non_interactive_check, - true - ).'  '; - $table->data['interactive_report'][1] .= __('No').'   '.html_print_radio_button( - 'non_interactive', - 0, - '', - $non_interactive_check, - true - ); - } - - $table->data['description'][0] = __('Description'); - $table->data['description'][1] = html_print_textarea('description', 5, 15, $description, '', true); - - echo ''; - html_print_table($table); - - echo '
'; - echo $actionButtonHtml; - html_print_input_hidden('action', $hiddenFieldAction); - html_print_input_hidden('id_report', $idReport); - echo '
'; - ?> +echo '
'; +echo $actionButtonHtml; +html_print_input_hidden('action', $hiddenFieldAction); +html_print_input_hidden('id_report', $idReport); +echo '
'; +?> diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index 0b765debad..5a0d4fb0f5 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -136,7 +136,7 @@ if ($action == 'new') { $table->data[1][0] = __('Group:'); -$table->data[1][1] = html_print_select_groups( +$table->data[1][1] = '
'.html_print_select_groups( $config['id_user'], 'RW', true, @@ -146,7 +146,7 @@ $table->data[1][1] = html_print_select_groups( '', '', true -); +).'
'; $backgrounds_list = list_files( $config['homedir'].'/images/console/background/', 'jpg', diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 6079d4bb1d..9f34ddd042 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -381,7 +381,7 @@ if (is_metaconsole()) { $table->rowstyle['all_3'] = 'display: none;'; $table->data['all_3'][0] = __('Groups'); $table->colspan['all_3'][1] = '3'; -$table->data['all_3'][1] = html_print_select_groups( +$table->data['all_3'][1] = '
'.html_print_select_groups( $config['id_user'], 'AR', true, @@ -391,7 +391,7 @@ $table->data['all_3'][1] = html_print_select_groups( '', 0, true -); +).'
'; $table->rowstyle['all_one_item_per_agent'] = 'display: none'; diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index 864add252b..146eae9b79 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -176,7 +176,9 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) { $data[0] .= ''; $data[1] = __('Group').'
'; + $data[1] .= '
'; $data[1] .= html_print_select_groups($config['id_user'], 'ER', users_can_manage_group_all(), 'id_group', $id_group, '', '', 0, true, false, false, ''); + $data[1] .= '
'; $data[2] = __('Modal screen').'
'; $data[2] .= html_print_checkbox_extended('modal', 1, $modal, false, '', 'style="margin-top: 5px;margin-bottom: 7px;"', true); diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index e21c3b6e55..8c07381452 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -917,6 +917,15 @@ $row++; ); $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', diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 20f275071e..ee6ad32a26 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -776,6 +776,7 @@ if ($create_alert || $update_alert) { // Group echo ''.__('Group').''; + echo '
'; html_print_select_groups( $config['id_user'], 'AR', @@ -796,6 +797,7 @@ if ($create_alert || $update_alert) { 'id_grupo', false ); + echo '
'; echo ''; // Trap type diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index 80810b7cf2..2a15affd94 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -934,7 +934,6 @@ class HostDevices extends Wizard 'selected' => $this->task['id_group'], 'return' => true, 'class' => 'discovery_list_input', - 'size' => 9, 'simple_multiple_options' => true, ] ); diff --git a/pandora_console/include/ajax/group.php b/pandora_console/include/ajax/group.php new file mode 100644 index 0000000000..0d13cd108f --- /dev/null +++ b/pandora_console/include/ajax/group.php @@ -0,0 +1,71 @@ + 'noaccess']); + } else { + include 'general/noaccess.php'; + } + + exit; +} + + +// AJAX controller. +if (is_ajax()) { + $method = get_parameter('method'); + + if (method_exists('PandoraFMS\Group', $method) === true) { + if (Group::ajaxMethod($method) === true) { + Group::{$method}(); + } else { + Group::error('Unavailable method.'); + } + } else { + Group::error('Method not found. ['.$method.']'); + } + + // Stop any execution. + exit; +} else { + // Run. + $cs->run(); +} diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index adf9d6ed06..073f0831a3 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -765,17 +765,16 @@ class CredentialStore extends Wizard 'form' => [ 'inputs' => [ [ - 'label' => __('Group'), - 'type' => 'select', - 'id' => 'filter_id_group', - 'name' => 'filter_id_group', - 'options' => users_get_groups_for_select( - $config['id_user'], - 'AR', - true, - true, - false - ), + 'label' => __('Group'), + 'type' => 'select_groups', + 'id' => 'filter_id_group', + 'name' => 'filter_id_group', + 'privilege' => 'AR', + 'type' => 'select_groups', + 'nothing' => false, + 'selected' => (defined($id_group_filter) ? $id_group_filter : 0), + 'return' => true, + 'size' => '80%', ], [ 'label' => __('Free search'), @@ -852,13 +851,14 @@ class CredentialStore extends Wizard $inputs[] = [ 'label' => __('Group'), 'arguments' => [ - 'name' => 'id_group', - 'id' => 'id_group', - 'input_class' => 'flex-row', - 'type' => 'select_groups', - 'selected' => $values['id_group'], - 'return' => true, - 'class' => 'w50p', + 'name' => 'id_group', + 'id' => 'id_group', + 'input_class' => 'flex-row', + 'type' => 'select_groups', + 'returnAllGroup' => true, + 'selected' => $values['id_group'], + 'return' => true, + 'class' => 'w50p', ], ]; diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index 43f1e047cb..57887b1cd7 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -504,6 +504,7 @@ class CustomNetScan extends Wizard 'type' => 'select_groups', 'selected' => $this->task['id_group'], 'return' => true, + 'size' => '400px', ], ]; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index e42d704f97..50c26f4e27 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC201005'; +$build_version = 'PC201006'; $pandora_version = 'v7.0NG.749'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index c1c539e8d3..6401910faa 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -1851,7 +1851,9 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3) } if (is_metaconsole()) { - if (!check_acl($config['id_user'], 0, 'PM')) { + if (!check_acl($config['id_user'], 0, 'PM') + && !check_acl($config['id_user'], 0, 'AW') + ) { returnError('forbidden', 'string'); return; } diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 3922e0ddf4..ea94b3a7da 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -925,6 +925,10 @@ function config_update_config() $error_update[] = __('Use round corners'); } + if (!config_update_value('maximum_y_axis', (bool) get_parameter('maximum_y_axis'))) { + $error_update[] = __('Chart fit to content'); + } + if (!config_update_value('show_qr_code_header', (bool) get_parameter('show_qr_code_header'))) { $error_update[] = __('Show QR code header'); } @@ -1772,6 +1776,10 @@ function config_process_config() config_update_value('round_corner', false); } + if (isset($config['maximum_y_axis']) === false) { + config_update_value('maximum_y_axis', false); + } + if (!isset($config['show_qr_code_header'])) { config_update_value('show_qr_code_header', false); } diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index a7e5545d55..212098e23f 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -56,7 +56,17 @@ function forecast_projection_graph( 'projection' => true, ]; - $module_data = grafico_modulo_sparse($params, $server_name); + if (is_metaconsole()) { + $id_meta = metaconsole_get_id_server($server_name); + $server = metaconsole_get_connection_by_id($id_meta); + metaconsole_connect($server); + } + + $module_data = grafico_modulo_sparse($params); + + if (is_metaconsole()) { + metaconsole_restore_db(); + } if (empty($module_data)) { return []; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 9747cb1033..b4505df1a0 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -629,172 +629,177 @@ function grafico_modulo_sparse_data( * 'graph_render' => 0, * 'zoom' => 1, * 'server_id' => null, - * 'stacked' => 0. + * 'stacked' => 0 + * 'maximum_y_axis' => 0. * * @return string html Content graphs. */ -function grafico_modulo_sparse($params, $server_name='') +function grafico_modulo_sparse($params) { global $config; - if (!isset($params) || !is_array($params)) { + if (isset($params) === false || is_array($params) === false) { return false; } - if (!isset($params['period'])) { + if (isset($params['period']) === false) { return false; } - if (!isset($params['show_events'])) { + if (isset($params['show_events']) === false) { $params['show_events'] = false; } - if (!isset($params['width'])) { + if (isset($params['width']) === false) { $params['width'] = '90%'; } - if (!isset($params['height'])) { + if (isset($params['height']) === false) { $params['height'] = 450; } - if (!isset($params['title'])) { + if (isset($params['title']) === false) { $params['title'] = ''; } - if (!isset($params['unit_name'])) { + if (isset($params['unit_name']) === false) { $params['unit_name'] = null; } - if (!isset($params['show_alerts'])) { + if (isset($params['show_alerts']) === false) { $params['show_alerts'] = false; } - if (!isset($params['date']) || !$params['date']) { + if (isset($params['date']) === false || !$params['date']) { $params['date'] = get_system_time(); } - if (!isset($params['unit'])) { + if (isset($params['unit']) === false) { $params['unit'] = ''; } - if (!isset($params['baseline'])) { + if (isset($params['baseline']) === false) { $params['baseline'] = 0; } - if (!isset($params['return_data'])) { + if (isset($params['return_data']) === false) { $params['return_data'] = 0; } - if (!isset($params['show_title'])) { + if (isset($params['show_title']) === false) { $show_title = true; } - if (!isset($params['only_image'])) { + if (isset($params['only_image']) === false) { $params['only_image'] = false; } - if (!isset($params['homeurl'])) { + if (isset($params['homeurl']) === false) { $params['homeurl'] = $config['homeurl']; } - if (!isset($params['ttl'])) { + if (isset($params['ttl']) === false) { $params['ttl'] = 1; } - if (!isset($params['adapt_key'])) { + if (isset($params['adapt_key']) === false) { $params['adapt_key'] = ''; } - if (!isset($params['compare'])) { + if (isset($params['compare']) === false) { $params['compare'] = false; } - if (!isset($params['show_unknown'])) { + if (isset($params['show_unknown']) === false) { $params['show_unknown'] = false; } - if (!isset($params['menu'])) { + if (isset($params['menu']) === false) { $params['menu'] = true; } - if (!isset($params['show_legend'])) { + if (isset($params['show_legend']) === false) { $params['show_legend'] = true; } - if (!isset($params['show_overview'])) { + if (isset($params['show_overview']) === false) { $params['show_overview'] = true; } - if (!isset($params['show_export_csv'])) { + if (isset($params['show_export_csv']) === false) { $params['show_export_csv'] = true; } - if (!isset($params['backgroundColor'])) { + if (isset($params['backgroundColor']) === false) { $params['backgroundColor'] = 'white'; } - if (!isset($params['percentil'])) { + if (isset($params['percentil']) === false) { $params['percentil'] = null; } - if (!isset($params['dashboard'])) { + if (isset($params['dashboard']) === false) { $params['dashboard'] = false; } - if (!isset($params['vconsole']) || $params['vconsole'] == false) { + if (isset($params['vconsole']) === false || $params['vconsole'] == false) { $params['vconsole'] = false; } else { $params['menu'] = false; } - if (!isset($params['type_graph'])) { + if (isset($params['type_graph']) === false) { $params['type_graph'] = $config['type_module_charts']; } - if (!isset($params['fullscale'])) { + if (isset($params['fullscale']) === false) { $params['fullscale'] = false; } - if (!isset($params['id_widget_dashboard'])) { + if (isset($params['id_widget_dashboard']) === false) { $params['id_widget_dashboard'] = false; } - if (!isset($params['force_interval'])) { + if (isset($params['force_interval']) === false) { $params['force_interval'] = ''; } - if (!isset($params['time_interval'])) { + if (isset($params['time_interval']) === false) { $params['time_interval'] = 300; } - if (!isset($params['array_data_create'])) { + if (isset($params['array_data_create']) === false) { $params['array_data_create'] = 0; } - if (!isset($params['return_img_base_64'])) { + if (isset($params['return_img_base_64']) === false) { $params['return_img_base_64'] = false; } - if (!isset($params['image_treshold'])) { + if (isset($params['image_treshold']) === false) { $params['image_treshold'] = false; } - if (!isset($params['graph_combined'])) { + if (isset($params['graph_combined']) === false) { $params['graph_combined'] = false; } - if (!isset($params['zoom'])) { + if (isset($params['zoom']) === false) { $params['zoom'] = ($config['zoom_graph']) ? $config['zoom_graph'] : 1; } - if (!isset($params['type_mode_graph'])) { + if (isset($params['type_mode_graph']) === false) { $params['type_mode_graph'] = $config['type_mode_graph']; if (isset($params['graph_render']) === true) { $params['type_mode_graph'] = $params['graph_render']; } } - if (!isset($params['projection'])) { + if (isset($params['maximum_y_axis']) === false) { + $params['maximum_y_axis'] = $config['maximum_y_axis']; + } + + if (isset($params['projection']) === false) { $params['projection'] = false; } @@ -802,7 +807,7 @@ function grafico_modulo_sparse($params, $server_name='') $params['pdf'] = false; } - if (!isset($params['agent_module_id'])) { + if (isset($params['agent_module_id']) === false) { return graph_nodata_image( $params['width'], $params['height'], @@ -815,14 +820,12 @@ function grafico_modulo_sparse($params, $server_name='') $agent_module_id = $params['agent_module_id']; } - if (!isset($params['stacked'])) { + if (isset($params['stacked']) === false) { $params['stacked'] = 0; } - // TODO: Configurable. $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; - $params['font'] = $config['fontpath']; $params['font_size'] = $config['font_size']; $params['short_data'] = $config['short_module_graph_data']; @@ -880,14 +883,14 @@ function grafico_modulo_sparse($params, $server_name='') } // Format of the graph. - if (empty($params['unit'])) { + if (empty($params['unit']) === true) { $params['unit'] = $module_data['unit']; if (modules_is_unit_macro($params['unit'])) { $params['unit'] = ''; } } - if (empty($params['divisor'])) { + if (empty($params['divisor']) === true) { $params['divisor'] = get_data_multiplier($params['unit']); } @@ -986,7 +989,7 @@ function grafico_modulo_sparse($params, $server_name='') // Check available data. if ($params['compare'] === 'separated') { - if (!empty($array_data)) { + if (empty($array_data) === false) { $return = area_graph( $agent_module_id, $array_data, @@ -1011,7 +1014,7 @@ function grafico_modulo_sparse($params, $server_name='') } $return .= '
'; - if (!empty($array_data_prev)) { + if (empty($array_data_prev) === false) { $series_type_array = series_type_graph_array( $array_data_prev, $params @@ -1116,11 +1119,11 @@ function graphic_combined_module( ) { global $config; - if (!isset($params_combined['from_interface'])) { + if (isset($params_combined['from_interface']) === false) { $params_combined['from_interface'] = false; } - if (!isset($params_combined['stacked'])) { + if (isset($params_combined['stacked']) === false) { if ($params_combined['from_interface']) { if ($config['type_interface_charts'] == 'line') { $params_combined['stacked'] = CUSTOM_GRAPH_LINE; @@ -1131,155 +1134,165 @@ function graphic_combined_module( if ($params_combined['id_graph'] == 0) { $params_combined['stacked'] = CUSTOM_GRAPH_AREA; } else { - $params_combined['stacked'] = db_get_row('tgraph', 'id_graph', $params_combined['id_graph']); + $params_combined['stacked'] = db_get_row( + 'tgraph', + 'id_graph', + $params_combined['id_graph'] + ); } } } $params['stacked'] = $params_combined['stacked']; - if (!isset($params_combined['projection']) || $params_combined['projection'] == false) { + if (isset($params_combined['projection']) === false + || $params_combined['projection'] == false + ) { $params_combined['projection'] = false; } else { $params['stacked'] = 'area'; $params['projection'] = true; } - if (!isset($params_combined['labels'])) { + if (isset($params_combined['labels']) === false) { $params_combined['labels'] = []; } - if (!isset($params_combined['summatory'])) { + if (isset($params_combined['summatory']) === false) { $params_combined['summatory'] = 0; } - if (!isset($params_combined['average'])) { + if (isset($params_combined['average']) === false) { $params_combined['average'] = 0; } - if (!isset($params_combined['modules_series'])) { + if (isset($params_combined['modules_series']) === false) { $params_combined['modules_series'] = 0; } - if (!isset($params_combined['return'])) { + if (isset($params_combined['return']) === false) { $params_combined['return'] = 1; } - if (!isset($params_combined['id_graph'])) { + if (isset($params_combined['id_graph']) === false) { $params_combined['id_graph'] = 0; } - if (!isset($params_combined['type_report'])) { + if (isset($params_combined['type_report']) === false) { $params_combined['type_report'] = ''; } - if (!isset($params['percentil'])) { + if (isset($params['percentil']) === false) { $params_combined['percentil'] = null; } else { $params_combined['percentil'] = $params['percentil']; } - if (!isset($params['period'])) { + if (isset($params['period']) === false) { return false; } - if (!isset($params['width'])) { + if (isset($params['width']) === false) { $params['width'] = '90%'; } - if (!isset($params['height'])) { + if (isset($params['height']) === false) { $params['height'] = 450; } - if (!isset($params['title'])) { + if (isset($params['title']) === false) { $params['title'] = ''; } - if (!isset($params['unit_name'])) { + if (isset($params['unit_name']) === false) { $params['unit_name'] = null; } - if (!isset($params['show_alerts'])) { + if (isset($params['show_alerts']) === false) { $params['show_alerts'] = false; } - if (!isset($params['date']) || !$params['date']) { + if (isset($params['date']) === false || !$params['date']) { $params['date'] = get_system_time(); } - if (!isset($params['only_image'])) { + if (isset($params['only_image']) === false) { $params['only_image'] = false; } - if (!isset($params['ttl'])) { + if (isset($params['ttl']) === false) { $params['ttl'] = 1; } - if (!isset($params['backgroundColor'])) { + if (isset($params['backgroundColor']) === false) { $params['backgroundColor'] = 'white'; } - if (!isset($params['dashboard'])) { + if (isset($params['dashboard']) === false) { $params['dashboard'] = false; } - if (!isset($params['menu']) || $params['only_image']) { + if (isset($params['menu']) === false + || $params['only_image'] + ) { $params['menu'] = true; } else { $params['menu'] = false; } - if (!isset($params['vconsole']) || $params['vconsole'] == false) { + if (isset($params['vconsole']) === false + || $params['vconsole'] == false + ) { $params['vconsole'] = false; } else { $params['menu'] = false; } - if (!isset($params['type_graph'])) { + if (isset($params['type_graph']) === false) { $params['type_graph'] = $config['type_module_charts']; } - if (!isset($params['percentil'])) { + if (isset($params['percentil']) === false) { $params['percentil'] = null; } - if (!isset($params['fullscale'])) { + if (isset($params['fullscale']) === false) { $params['fullscale'] = false; } - if (!isset($params['id_widget_dashboard'])) { + if (isset($params['id_widget_dashboard']) === false) { $params['id_widget_dashboard'] = false; } - if (!isset($params['homeurl'])) { + if (isset($params['homeurl']) === false) { $params['homeurl'] = ui_get_full_url(false, false, false, false); } - if (!isset($params['show_legend'])) { + if (isset($params['show_legend']) === false) { $params['show_legend'] = true; } - if (!isset($params['show_overview'])) { + if (isset($params['show_overview']) === false) { $params['show_overview'] = true; } - if (!isset($params['show_export_csv'])) { + if (isset($params['show_export_csv']) === false) { $params['show_export_csv'] = true; } - if (!isset($params['return_img_base_64'])) { + if (isset($params['return_img_base_64']) === false) { $params['return_img_base_64'] = false; } - if (!isset($params['image_treshold'])) { + if (isset($params['image_treshold']) === false) { $params['image_treshold'] = false; } - if (!isset($params['show_unknown'])) { + if (isset($params['show_unknown']) === false) { $params['show_unknown'] = false; } - if (!isset($params['type_mode_graph'])) { + if (isset($params['type_mode_graph']) === false) { $params['type_mode_graph'] = 0; if (isset($params['graph_render']) === true) { $params['type_mode_graph'] = $params['graph_render']; @@ -1293,6 +1306,10 @@ function graphic_combined_module( $params_combined['fullscale'] = $params['fullscale']; } + if (isset($params['maximum_y_axis']) === false) { + $params['maximum_y_axis'] = $config['maximum_y_axis']; + } + $params['graph_combined'] = true; $params_combined['graph_combined'] = true; @@ -1305,11 +1322,10 @@ function graphic_combined_module( ); } - if (!isset($params['zoom'])) { + if (isset($params['zoom']) === false) { $params['zoom'] = 1; } - // TODO: Configurable. $params['grid_color'] = '#C1C1C1'; $params['legend_color'] = '#636363'; @@ -1454,23 +1470,23 @@ function graphic_combined_module( $params_combined['modules_id'] = $modules; } - if (isset($summatory)) { + if (isset($summatory) === true) { $params_combined['summatory'] = $summatory; } - if (isset($average)) { + if (isset($average) === true) { $params_combined['average'] = $average; } - if (isset($modules_series)) { + if (isset($modules_series) === true) { $params_combined['modules_series'] = $modules_series; } - if (isset($labels)) { + if (isset($labels) === true) { $params_combined['labels'] = $labels; } - if (isset($weights)) { + if (isset($weights) === true) { $params_combined['weight_list'] = $weights; } @@ -1660,7 +1676,7 @@ function graphic_combined_module( } } - if (empty($array_data)) { + if (empty($array_data) === true) { if ($params_combined['return']) { return graph_nodata_image($width, $height); } @@ -4392,7 +4408,7 @@ function fullscale_data( // Avg count total. $count_data_total++; - if ($type_mode_graph && !$params['baseline']) { + if (!$params['baseline']) { // MIN. // max min. if ($min_value >= $min_value_max @@ -4460,7 +4476,7 @@ function fullscale_data( } } - if ($type_mode_graph && !$params['baseline']) { + if (!$params['baseline']) { if ((int) $type_mode_graph === 1 || (int) $type_mode_graph === 3) { $data['min'.$series_suffix]['min'] = $min_value_min; $data['min'.$series_suffix]['max'] = $min_value_max; diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index cc1a8b6424..b6c1a5e6c9 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -341,7 +341,7 @@ function groups_get_children($parent, $ignorePropagate=false) /** - * XXX: This is not working. Expects 'propagate' on CHILD not on PARENT!!! + * @deprecated This is not working. Expects 'propagate' on CHILD not on PARENT!!! * * Return a array of id_group of childrens (to branches down) * @@ -575,14 +575,18 @@ function groups_get_id_recursive($id_parent, $all=false) function groups_flatten_tree_groups($tree, $deep) { - foreach ($tree as $key => $group) { - $return[$key] = $group; - unset($return[$key]['branch']); - $return[$key]['deep'] = $deep; + if (is_array($tree) === true) { + foreach ($tree as $key => $group) { + $return[$key] = $group; + unset($return[$key]['branch']); + $return[$key]['deep'] = $deep; - if (!empty($group['branch'])) { - $return = ($return + groups_flatten_tree_groups($group['branch'], ($deep + 1))); + if (empty($group['branch']) === false) { + $return = ($return + groups_flatten_tree_groups($group['branch'], ($deep + 1))); + } } + } else { + $return = []; } return $return; @@ -618,7 +622,7 @@ function groups_get_groups_tree_recursive($groups, $trash=0, $trash2=0) $tree[$group['parent']]['branch'][$key] = &$tree[$key]; } - // Depends on the All group we give different format + // Depends on the All group we give different format. if (isset($groups[0])) { $tree = [$tree[0]]; } else { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 6b66357652..6dedb85927 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -410,25 +410,32 @@ function html_print_select_style($fields, $name, $selected='', $style='', $scrip /** - * Prints the groups of user of fields in a popup menu of a form. + * Print or return selector for groups. * - * @param string User id - * @param string The privilege to evaluate - * @param boolean $returnAllGroup Flag the return group, by default true. - * @param boolean $returnAllColumns Flag to return all columns of groups. - * @param array Array with dropdown values. Example: $fields["value"] = "label" - * @param string Select form name - * @param variant Current selected value. Can be a single value or an - * array of selected values (in combination with multiple) - * @param string Javascript onChange code. - * @param string Label when nothing is selected. - * @param variant Value when nothing is selected - * @param bool Whether to return an output string or echo now (optional, echo by default). - * @param bool Set the input to allow multiple selections (optional, single selection by default). - * @param bool Whether to sort the options or not (optional, unsorted by default). - * @param string $style The string of style. - * @param integer $id_group The id of node that must do not show the children and own. - * @param string $keys_field The field of the group used in the array keys. By default ID + * @param string $id_user User id. + * @param string $privilege The privilege to evaluate. + * @param boolean $returnAllGroup Flag the return group, (true). + * @param boolean $name Name of input field. + * @param array $selected Array with dropdown values. Example: + * $fields["value"] = "label". + * @param string $script Javascript onChange code. + * @param mixed $nothing Label when nothing is selected. + * @param array $nothing_value Value when nothing is selected. + * @param string $return Return string or dump to output. + * @param boolean $multiple Enable multiple select. + * @param mixed $sort Sort values or not (default false). + * @param boolean $class CSS classes to apply. + * @param boolean $disabled Disabled or enabled. + * @param boolean $style CSS inline style. + * @param string $option_style CSS inline style in array format. + * @param array $id_group Groups to be manually added. + * @param string $keys_field Field to be used as array key, (id). + * @param boolean $strict_user Strict. + * @param array $delete_groups Remove groups from select. + * @param array $include_groups Add groups to select. + * @param string $size Style, size (width) of element. + * @param boolean $simple_multiple_options Discovery simple multiple inputs. + * @param boolean $required Required input. * * @return string HTML code if return parameter is true. */ @@ -436,14 +443,14 @@ function html_print_select_groups( $id_user=false, $privilege='AR', $returnAllGroup=true, - $name, + $name=null, $selected='', $script='', $nothing='', $nothing_value=0, $return=false, $multiple=false, - $sort=true, + $sort=false, $class='', $disabled=false, $style=false, @@ -454,39 +461,68 @@ function html_print_select_groups( $delete_groups=false, $include_groups=false, $size=false, - $simple_multiple_options=false + $simple_multiple_options=false, + $required=false ) { - global $config; + $output = ''; - $fields = users_get_groups_for_select( - $id_user, - $privilege, - $returnAllGroup, - true, - $id_group, - $keys_field - ); + if (is_ajax()) { + $output .= ''; - if ($delete_groups && is_array($delete_groups)) { - foreach ($delete_groups as $value) { - unset($fields[$value]); + $output .= ''; + } else { + ui_require_css_file('select2.min'); + ui_require_javascript_file('select2.min'); + } + + if ($name === null) { + static $idcounter = []; + if (isset($idcounter[$name]) === true) { + $idcounter[$name]++; + } else { + $idcounter[$name] = 0; + } + + $name = 'group_select'.$idcounter[$name]; + } + + $fields = []; + // Preload selector. + if (is_array($selected) === false) { + if (empty($selected) === false) { + $fields = [ $selected => groups_get_name($selected) ]; + } else if ($returnAllGroup === true && $multiple === false) { + $fields = [ $selected => groups_get_name(null, true) ]; + } + } else { + foreach ($selected as $k) { + $fields[$k] = groups_get_name($k); } } - if (is_array($include_groups)) { - $field = []; - foreach ($include_groups as $value) { - $field[$value] = $fields[$value]; - } - - $fields = array_intersect($fields, $field); + if (is_array($delete_groups) === true) { + $json_exclusions = json_encode($delete_groups); } - if ($strict_user) { - $fields = users_get_strict_mode_groups($config['id_user'], $returnAllGroup); + if (is_array($include_groups) === true) { + $json_inclusions = json_encode($include_groups); } - $output = html_print_select( + $output .= html_print_select( $fields, $name, $selected, @@ -495,7 +531,7 @@ function html_print_select_groups( $nothing_value, $return, $multiple, - false, + $sort, $class, $disabled, $style, @@ -504,9 +540,82 @@ function html_print_select_groups( false, '', false, - $simple_multiple_options + $simple_multiple_options, + $required ); + if (empty($size) === true) { + $size = '100%'; + } + + ob_start(); + ?> + + + + + '; + if ($required) { + $required = 'required'; + } + + $output .= '');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('
  • '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f(""),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=ai.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1 __('Groups'), 'arguments' => [ @@ -275,7 +280,7 @@ class SystemGroupStatusWidget extends Widget 'name' => 'groupId[]', 'returnAllGroup' => true, 'privilege' => 'ER', - 'selected' => explode(',', $values['groupId'][0]), + 'selected' => $selected_groups, 'return' => true, 'multiple' => true, ], diff --git a/pandora_console/include/lib/Group.php b/pandora_console/include/lib/Group.php index c6f7312330..d054f67abe 100644 --- a/pandora_console/include/lib/Group.php +++ b/pandora_console/include/lib/Group.php @@ -38,6 +38,13 @@ require_once $config['homedir'].'/include/functions_groups.php'; class Group extends Entity { + /** + * List of available ajax methods. + * + * @var array + */ + private static $ajaxMethods = ['getGroupsForSelect']; + /** * Builds a PandoraFMS\Group object from a group id. @@ -79,7 +86,7 @@ class Group extends Entity public function getChildren( bool $ids_only=false, bool $ignorePropagationState=false - ) { + ):array { $available_groups = \groups_get_children( $this->id_grupo(), $ignorePropagationState @@ -98,20 +105,108 @@ class Group extends Entity } + /** + * Retrieves a list of groups fitered. + * + * @param array $filter Filters to be applied. + * + * @return array With all results or false if error. + * @throws Exception On error. + */ + private static function search(array $filter):array + { + // Default values. + if (empty($filter['id_user']) === true) { + // By default query current user groups. + $filter['id_user'] = false; + } else if (!\users_is_admin()) { + // Override user queried if user is not an admin. + $filter['id_user'] = false; + } + + if (empty($filter['id_user']) === true) { + $filter['id_user'] = false; + } + + if (empty($filter['keys_field']) === true) { + $filter['keys_field'] = 'id_grupo'; + } + + if (isset($filter['returnAllColumns']) === false) { + $filter['returnAllColumns'] = true; + } + + $groups = \users_get_groups( + $filter['id_user'], + $filter['privilege'], + $filter['returnAllGroup'], + // Return all columns. + $filter['returnAllColumns'], + // Field id_groups is not being used anymore. + null, + $filter['keys_field'], + // Cache. + true, + // Search term. + $filter['search'] + ); + + if (is_array($groups) === false) { + return []; + } + + return $groups; + + } + + + /** + * Returns an hierarchical ordered array. + * + * @param array $groups All groups available. + * + * @return array Groups ordered. + */ + private static function prepareGroups(array $groups):array + { + $return = []; + $groups = \groups_get_groups_tree_recursive($groups); + foreach ($groups as $k => $v) { + $return[] = [ + 'id' => $k, + 'text' => \io_safe_output( + \ui_print_truncate_text( + $v['nombre'], + GENERIC_SIZE_TEXT, + false, + true, + false + ) + ), + 'level' => $v['deep'], + ]; + } + + return $return; + + } + + /** * Saves current group definition to database. * * @return mixed Affected rows of false in case of error. + * @throws \Exception On error. */ public function save() { global $config; - if (isset($config['centralized_management']) + if (isset($config['centralized_management']) === true && $config['centralized_management'] > 0 ) { throw new \Exception( - get_class($this).' error, cannot be modified in a centralized management environment.' + get_class($this).' error, cannot be modified while centralized management environment.' ); } @@ -132,4 +227,123 @@ class Group extends Entity } + /** + * Return error message to target. + * + * @param string $msg Error message. + * + * @return void + */ + public static function error(string $msg) + { + echo json_encode(['error' => $msg]); + } + + + /** + * Verifies target method is allowed to be called using AJAX call. + * + * @param string $method Method to be invoked via AJAX. + * + * @return boolean Available (true), or not (false). + */ + public static function ajaxMethod(string $method):bool + { + return in_array($method, self::$ajaxMethods) === true; + } + + + /** + * This method is being invoked by select2 to improve performance while + * installation has a lot of groups (more than 5k). + * + * Security applied in controller include/ajax/group.php. + * + * @return void + * @throws \Exception On error. + */ + public static function getGroupsForSelect() + { + $id_user = get_parameter('id_user', false); + $privilege = get_parameter('privilege', 'AR'); + $returnAllGroup = get_parameter('returnAllGroup', false); + $id_group = get_parameter('id_group', false); + $keys_field = get_parameter('keys_field', 'id_grupo'); + $search = get_parameter('search', ''); + $step = get_parameter('step', 1); + $limit = get_parameter('limit', false); + $exclusions = get_parameter('exclusions', '[]'); + $inclusions = get_parameter('inclusions', '[]'); + + if (empty($id_user) === true) { + $id_user = false; + } + + $groups = self::search( + [ + 'id_user' => $id_user, + 'privilege' => $privilege, + 'returnAllGroup' => $returnAllGroup, + 'returnAllColumns' => true, + 'id_group' => $id_group, + 'keys_field' => $keys_field, + 'search' => $search, + ] + ); + + $exclusions = json_decode(\io_safe_output($exclusions)); + if (empty($exclusions) === false) { + foreach ($exclusions as $ex) { + unset($groups[$ex]); + } + } + + $inclusions = json_decode(\io_safe_output($inclusions)); + if (empty($inclusions) === false) { + foreach ($inclusions as $g) { + if (empty($groups[$g]) === true) { + $groups[$g] = \groups_get_name($g); + } + } + } + + $return = self::prepareGroups($groups); + + if (is_array($return) === false) { + return; + } + + // Use global block size configuration. + global $config; + $limit = $config['block_size']; + $offset = (($step - 1) * $limit); + + // Pagination over effective groups retrieved. + // Calculation is faster than transference. + $count = count($return); + if (is_numeric($offset) === true && $offset >= 0) { + if (is_numeric($limit) === true && $limit > 0) { + $return = array_splice($return, $offset, $limit); + } + } + + if ($step > 2) { + $processed = (($step - 2) * $limit); + } else { + $processed = 0; + } + + $current_ammount = (count($return) + $processed); + + echo json_encode( + [ + 'results' => $return, + 'pagination' => [ + 'more' => $current_ammount < $count, + ], + ] + ); + } + + } diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index a0b2fdf89c..4938877637 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -5,7 +5,7 @@ div.criticity { text-align: center; border-radius: 5px; font-size: 0.8em; - padding: 3px; + padding: 5px; margin: 0; display: table-cell; vertical-align: middle; @@ -32,7 +32,7 @@ form.flex-row ul { width: 30%; display: flex; flex-direction: row; - align-items: baseline; + align-items: center; flex-wrap: wrap; align-content: center; justify-content: space-between; @@ -124,6 +124,7 @@ table.dataTable tbody td { max-width: 450px; } +.filter_input .select2, .filter_input_little > select, .filter_input_little > input, .filter_input > select, @@ -310,16 +311,3 @@ div.multi-response-buttons { width: 100%; text-align: right; } - -div.criticity { - width: 150px; - height: 2em; - color: #fff; - text-align: center; - border-radius: 5px; - font-size: 0.8em; - padding: 5px; - margin: 0; - display: table-cell; - vertical-align: middle; -} diff --git a/pandora_console/include/styles/multiselect_filtered.css b/pandora_console/include/styles/multiselect_filtered.css index 5c36df522d..a938422456 100644 --- a/pandora_console/include/styles/multiselect_filtered.css +++ b/pandora_console/include/styles/multiselect_filtered.css @@ -23,11 +23,17 @@ } .multi-select-container .filter input, -.multi-select-container .filter select { +.multi-select-container .filter select, +.multi-select-container .filter .select2 { float: right; width: 50%; text-align: left; } + +.multi-select-container .filter .select2 { + width: 50% !important; +} + .multi-select-container .filter input[type="checkbox"] { width: auto; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 2ee0735edc..3cd5e8cd86 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -453,6 +453,18 @@ select:-internal-list-box { width: 120px; max-width: 120px; } +.w240px { + width: 240px; + max-width: 240px; +} +.w250px { + width: 250px; + max-width: 250px; +} +.w290px { + width: 290px; + max-width: 290px; +} .mw120px { min-width: 120px; } @@ -474,6 +486,12 @@ select:-internal-list-box { .w20px { width: 20px; } +.nowrap { + white-space: nowrap; +} +.inline { + display: inline-block; +} .w10p { width: 10%; } @@ -565,10 +583,12 @@ select:-internal-list-box { justify-content: space-between; align-content: center; } +.flex-nowrap { + flex-wrap: nowrap; +} .flex-row-baseline { display: flex; flex-direction: row; - flex-wrap: wrap; align-items: baseline; } @@ -590,11 +610,6 @@ select:-internal-list-box { .flex-start { justify-content: flex-start; } - -.nowrap { - flex-wrap: nowrap; -} - .padding-2 { padding: 2em; } @@ -604,6 +619,12 @@ select:-internal-list-box { .padding-6 { padding: 6em; } +.padding-right-2 { + padding-right: 2em; +} +.padding-right-2-imp { + padding-right: 2em !important; +} .margin-right-1 { margin-right: 1em; } @@ -6151,3 +6172,7 @@ form#form-filter-interfaces ul li.select-interfaces { flex-direction: row-reverse; justify-content: flex-end; } + +li .select2 { + max-width: 400px !important; +} diff --git a/pandora_console/include/styles/select2.min.css b/pandora_console/include/styles/select2.min.css new file mode 100644 index 0000000000..7c18ad59df --- /dev/null +++ b/pandora_console/include/styles/select2.min.css @@ -0,0 +1 @@ +.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb} diff --git a/pandora_console/install.php b/pandora_console/install.php index 66ab87c388..15ce5f7548 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
    '; -echo ''; +echo ''; echo __('Group').' '; @@ -221,17 +221,17 @@ $groups = users_get_groups(false, $access); html_print_select_groups(false, $access, true, 'group_id', $group_id, 'this.form.submit()', '', '', false, false, true, '', false); -echo ''; +echo ''; echo __('Recursion').' '; html_print_checkbox('recursion', 1, $recursion, false, false, 'this.form.submit()'); -echo ''; +echo ''; echo __('Search').' '; html_print_input_text('search', $search, '', 15); -echo ''; +echo ''; $fields = []; $fields[AGENT_STATUS_NORMAL] = __('Normal'); @@ -244,12 +244,12 @@ $fields[AGENT_STATUS_NOT_INIT] = __('Not init'); echo __('Status').' '; html_print_select($fields, 'status', $status, 'this.form.submit()', __('All'), AGENT_STATUS_ALL, false, false, true, '', false, 'width: 90px;'); -echo ''; +echo ''; echo __('Search in custom fields').' '; html_print_input_text('search_custom', $search_custom, '', 15); -echo ''; +echo ''; html_print_submit_button( __('Search'), diff --git a/pandora_console/operation/agentes/exportdata.php b/pandora_console/operation/agentes/exportdata.php index 5743084f6a..402b409e42 100644 --- a/pandora_console/operation/agentes/exportdata.php +++ b/pandora_console/operation/agentes/exportdata.php @@ -227,7 +227,7 @@ if (empty($export_btn) || $show_form) { $groups = users_get_groups($config['id_user'], 'RR', users_can_manage_group_all()); - $table->data[0][1] = html_print_select_groups( + $table->data[0][1] = '
    '.html_print_select_groups( $config['id_user'], 'RR', true, @@ -241,7 +241,7 @@ if (empty($export_btn) || $show_form) { true, '', false - ); + ).'
    '; // Agent selector. $table->data[1][0] = ''.__('Source agent').''; diff --git a/pandora_console/operation/agentes/interface_traffic_graph_win.php b/pandora_console/operation/agentes/interface_traffic_graph_win.php index 6e7e9f8098..fdd53c0bc3 100644 --- a/pandora_console/operation/agentes/interface_traffic_graph_win.php +++ b/pandora_console/operation/agentes/interface_traffic_graph_win.php @@ -233,8 +233,9 @@ $table->data[] = $data; $table->rowclass[] = ''; $data = []; -$data[0] = __('Show full scale graph (TIP)').ui_print_help_tip( - __('This option may cause performance issues'), +$data[0] = __('Show full scale graph (TIP)'); +$data[0] .= ui_print_help_tip( + __('TIP mode charts do not support average - maximum - minimum series, you can only enable TIP or average, maximum or minimum series'), true, 'images/tip.png', true diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 16a26257ac..a16874705c 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -266,17 +266,26 @@ if ($not_found) { ); $table->data[1][0] = __('Group'); - $table->data[1][1] = html_print_select_groups( + $table->data[1][1] = '
    '.html_print_select_groups( + // Id_user. $config['id_user'], + // Privilege. 'AR', + // ReturnAllGroup. true, + // Name. 'id_group_map', + // Selected. $id_group_map, + // Script. '', + // Nothing. '', + // Nothing_value. '', + // Return. true - ); + ).'
    '; $table->data[2][0] = __('Node radius'); $table->data[2][1] = html_print_input_text( @@ -333,7 +342,7 @@ if ($not_found) { $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); $table->data['source_data_group'][0] = __('Source group'); - $table->data['source_data_group'][1] = html_print_select_groups( + $table->data['source_data_group'][1] = '
    '.html_print_select_groups( $config['id_user'], 'AR', true, @@ -343,7 +352,7 @@ if ($not_found) { '', '', true - ); + ).'
    '; $table->data['source_data_group'][1] .= html_print_image( 'images/error.png', true, diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 3cade2cdbb..1d26666b57 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -80,6 +80,18 @@ $label = db_get_value( 'id_agente_modulo', $id ); + +ui_require_css_file('register', 'include/styles/', true); +// Connection lost alert. +$conn_title = __('Connection with server has been lost'); +$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.'); +ui_print_message_dialog( + $conn_title, + $conn_text, + 'connection', + '/images/error_1.png' +); + ?> @@ -171,6 +183,11 @@ $label = db_get_value( $fullscale = get_parameter('fullscale', 0); } + $type_mode_graph = get_parameter_checkbox( + 'type_mode_graph', + ($fullscale === 1) ? 0 : $config['type_mode_graph'] + ); + $time_compare = false; if ($time_compare_separated) { @@ -294,14 +311,8 @@ $label = db_get_value( true ); - $table->data[3][2] = __('Show full scale graph (TIP)'); - $table->data[3][3] = html_print_checkbox_switch( - 'fullscale', - 1, - (bool) $fullscale, - true, - false - ); + $table->data[3][2] = ''; + $table->data[3][3] = ''; if (!modules_is_boolean($id)) { $table->data[4][0] = __('Zoom'); @@ -349,6 +360,29 @@ $label = db_get_value( true ); + + $table->data[6][0] = __('Show AVG/MAX/MIN data series in graph'); + $table->data[6][1] = html_print_checkbox_switch( + 'type_mode_graph', + 1, + (bool) $type_mode_graph, + true, + false + ); + + $table->data[6][2] = __('Show full scale graph (TIP)'); + $table->data[6][2] .= ui_print_help_tip( + __('TIP mode charts do not support average - maximum - minimum series, you can only enable TIP or average, maximum or minimum series'), + true + ); + $table->data[6][3] = html_print_checkbox_switch( + 'fullscale', + 1, + (bool) $fullscale, + true, + false + ); + $form_table = html_print_table($table, true); $form_table .= '
    '; $form_table .= html_print_submit_button( @@ -433,6 +467,7 @@ $label = db_get_value( 'fullscale' => $fullscale, 'zoom' => $zoom, 'height' => 300, + 'type_mode_graph' => $type_mode_graph, ]; $output .= grafico_modulo_sparse($params); $output .= '
    '; @@ -479,51 +514,68 @@ ui_include_time_picker(true); ?> diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index e5f06f357b..3ca4123b4f 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -878,24 +878,17 @@ if (is_metaconsole() !== true) { */ // Group. -$user_groups_array = users_get_groups_for_select( - $config['id_user'], - $access, - true, - true, - false -); -$data = html_print_select( - $user_groups_array, - 'id_group_filter', - $id_group_filter, - '', - '', - 0, - true, - false, - false, - 'w130' +$data = html_print_input( + [ + 'name' => 'id_group_filter', + 'returnAllGroup' => true, + 'privilege' => 'AR', + 'type' => 'select_groups', + 'selected' => (defined($id_group_filter) ? $id_group_filter : 0), + 'nothing' => false, + 'return' => true, + 'size' => '80%', + ] ); $in = '
    '; $in .= $data.'
    '; diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 6d337abc28..4377faaa63 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -37,9 +37,11 @@ if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'], } $agents = agents_get_group_agents(0, false, 'none', false, true); - +ob_start('ui_process_page_head'); +ob_start(); echo ''; echo ''; + echo ''.__('Sound Events').''; ?>