From 5d63bc547e58f8abc687999d72c21a344293497c Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 29 Sep 2020 14:22:58 +0200 Subject: [PATCH] Group selection review --- .../extensions/files_repo/files_repo_form.php | 23 ++- .../agentes/planned_downtime.editor.php | 4 +- .../godmode/reporting/create_container.php | 4 +- .../reporting_builder.item_editor.php | 56 +++--- .../reporting/reporting_builder.main.php | 189 +++++++++--------- pandora_console/include/functions_html.php | 12 +- pandora_console/include/styles/pandora.css | 4 + .../operation/events/sound_events.php | 12 +- .../operation/incidents/incident_detail.php | 2 + 9 files changed, 173 insertions(+), 133 deletions(-) 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/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/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/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 9ccbf834b0..a5f9239906 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1125,11 +1125,11 @@ $class = 'databox filters'; - @@ -1145,16 +1145,16 @@ $class = 'databox filters';

- "; + '; html_print_checkbox_switch('monday', 1, $monday); - ?> + ?>

"; + echo __('Tuesday').'
'; html_print_checkbox_switch('tuesday', 1, $tuesday); ?>

@@ -1162,7 +1162,7 @@ $class = 'databox filters';

"; + echo __('Wednesday').'
'; html_print_checkbox_switch('wednesday', 1, $wednesday); ?>

@@ -1170,7 +1170,7 @@ $class = 'databox filters';

"; + echo __('Thursday').'
'; html_print_checkbox_switch('thursday', 1, $thursday); ?>

@@ -1178,7 +1178,7 @@ $class = 'databox filters';

"; + echo __('Friday').'
'; html_print_checkbox_switch('friday', 1, $friday); ?>

@@ -1186,7 +1186,7 @@ $class = 'databox filters';

"; + echo __('Saturday').'
'; html_print_checkbox_switch('saturday', 1, $saturday); ?>

@@ -1194,7 +1194,7 @@ $class = 'databox filters';

"; + echo __('Sunday').'
'; html_print_checkbox_switch('sunday', 1, $sunday); ?>

@@ -1260,6 +1260,7 @@ $class = 'databox filters'; '; if (check_acl($config['id_user'], 0, 'RW')) { html_print_select_groups( $config['id_user'], @@ -1280,6 +1281,8 @@ $class = 'databox filters'; ); } + echo ''; + echo '   '.__('Recursion').'   '.html_print_checkbox_switch( 'recursion', 1, @@ -2117,13 +2120,14 @@ $class = 'databox filters'; ); ?> - + + @@ -2194,7 +2198,7 @@ $class = 'databox filters';

"; + echo __('Total time').'
'; html_print_checkbox_switch('total_time', 1, $total_time); ?>

@@ -2202,7 +2206,7 @@ $class = 'databox filters';

"; + echo __('Time failed').'
'; html_print_checkbox_switch('time_failed', 1, $time_failed); ?>

@@ -2210,7 +2214,7 @@ $class = 'databox filters';

"; + echo __('Time in OK status').'
'; html_print_checkbox_switch('time_in_ok_status', 1, $time_in_ok_status); ?>

@@ -2218,7 +2222,7 @@ $class = 'databox filters';

"; + echo __('Time in unknown status').'
'; html_print_checkbox_switch( 'time_in_unknown_status', 1, @@ -2230,7 +2234,7 @@ $class = 'databox filters';

"; + echo __('Time of not initialized module').'
'; html_print_checkbox_switch( 'time_of_not_initialized_module', 1, @@ -2242,7 +2246,7 @@ $class = 'databox filters';

"; + echo __('Time of downtime').'
'; html_print_checkbox_switch('time_of_downtime', 1, $time_of_downtime); ?>

diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index 652de3552c..61fba9a08f 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', + $idGroup, + '', + '', + '', + 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/include/functions_html.php b/pandora_console/include/functions_html.php index f0cdfeaba6..7beced680d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -493,7 +493,7 @@ function html_print_select_groups( if (is_array($selected) === false) { if (empty($selected) === false) { $fields = [ $selected => groups_get_name($selected) ]; - } else if ($returnAllGroup === true) { + } else if ($returnAllGroup === true && $multiple === false) { $fields = [ $selected => groups_get_name(null, true) ]; } } else { @@ -551,6 +551,8 @@ function html_print_select_groups( $('select[name=""]').each( function() { $(this).select2({ + multiple: , + placeholder: "", debug: 0, width: '', templateResult: function(node) { @@ -582,6 +584,14 @@ function html_print_select_groups( }); } ); + + + $('select[name=""]').val(null).trigger("change"); + }); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index b8c8f4b296..4e6c8bac4e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -461,6 +461,10 @@ select:-internal-list-box { width: 250px; max-width: 250px; } +.w290px { + width: 290px; + max-width: 290px; +} .mw120px { min-width: 120px; } 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').''; ?>