diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 6a8ea04e0f..55b967aa08 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -135,6 +135,7 @@ $current_month = true; // Only avg is selected by default for the simple graphs. $fullscale = false; $percentil = false; +$image_threshold = false; $time_compare_overlapped = false; // Added for events items. @@ -307,6 +308,7 @@ switch ($action) { case 'simple_graph': $fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0; $percentil = isset($style['percentil']) ? (bool) $style['percentil'] : 0; + $image_threshold = (isset($style['image_threshold']) === true) ? (bool) $style['image_threshold'] : false; $graph_render = $item['graph_render']; // The break hasn't be forgotten. case 'simple_baseline_graph': @@ -2504,6 +2506,23 @@ $class = 'databox filters'; + + + + + + + + + head = []; $table_modules->head[0] = __('Module name'); $table_modules->head[1] = __('Data'); - $table_modules->head[2] = __('Treshold'); + $table_modules->head[2] = __('Threshold'); $table_modules->head[3] = __('Current interval'); $table_modules->head[4] = __('Timestamp'); $table_modules->head[5] = __('Status'); diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index b60e58d940..77d9647a4b 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -2227,121 +2227,77 @@ if ($process_buffers === true) { if ($get_events_fired) { global $config; - $id = get_parameter('id_row'); - $idGroup = get_parameter('id_group'); - $agents = get_parameter('agents', null); + $filter_id = (int) get_parameter('filter_id', 0); + $interval = (int) get_parameter('interval', 10); - $query = ' AND id_evento > '.$id; - - $type = []; - $alert = get_parameter('alert_fired'); - if ($alert == 'true') { - $resultAlert = alerts_get_event_status_group( - $idGroup, - [ - 'alert_fired', - 'alert_ceased', - ], - $query, - $agents - ); - } - - $critical = get_parameter('critical'); - if ($critical == 'true') { - $resultCritical = alerts_get_event_status_group( - $idGroup, - [ - 'going_up_critical', - 'going_down_critical', - ], - $query, - $agents - ); - } - - $warning = get_parameter('warning'); - if ($warning == 'true') { - $resultWarning = alerts_get_event_status_group( - $idGroup, - [ - 'going_up_warning', - 'going_down_warning', - ], - $query, - $agents - ); - } - - $unknown = get_parameter('unknown'); - if ($unknown == 'true') { - $resultUnknown = alerts_get_event_status_group( - $idGroup, - 'going_unknown', - $query, - $agents - ); - } - - if ($resultAlert) { - $return = [ - 'fired' => $resultAlert, - 'sound' => $config['sound_alert'], + if (empty($filter_id) === true) { + $filter = [ + 'id_group' => 0, + 'event_type' => '', + 'severity' => -1, + 'status' => -1, + 'search' => '', + 'text_agent' => '', + 'id_agent' => 0, + 'id_agent_module' => 0, + 'pagination' => 0, + 'id_user_ack' => 0, + 'group_rep' => 0, + 'tag_with' => [], + 'tag_without' => [], + 'filter_only_alert' => -1, + 'source' => '', + 'id_extra' => '', + 'user_comment' => '', + 'id_source_event' => 0, + 'server_id' => 0, + 'custom_data' => '', + 'custom_data_filter_type' => 0, ]; - $event = events_get_event($resultAlert); - - $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $agent_name = agents_get_alias($event['id_agente']); - - $return['message'] = io_safe_output($agent_name).' - '; - $return['message'] .= __('Alert fired in module '); - $return['message'] .= io_safe_output($module_name).' - '; - $return['message'] .= $event['timestamp']; - } else if ($resultCritical) { - $return = [ - 'fired' => $resultCritical, - 'sound' => $config['sound_critical'], - ]; - $event = events_get_event($resultCritical); - - $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $agent_name = agents_get_alias($event['id_agente']); - - $return['message'] = io_safe_output($agent_name).' - '; - $return['message'] .= __('Module ').io_safe_output($module_name); - $return['message'] .= __(' is going to critical').' - '; - $return['message'] .= $event['timestamp']; - } else if ($resultWarning) { - $return = [ - 'fired' => $resultWarning, - 'sound' => $config['sound_warning'], - ]; - $event = events_get_event($resultWarning); - - $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $agent_name = agents_get_alias($event['id_agente']); - - $return['message'] = io_safe_output($agent_name).' - '; - $return['message'] .= __('Module ').io_safe_output($module_name); - $return['message'] .= __(' is going to warning').' - '; - $return['message'] .= $event['timestamp']; - } else if ($resultUnknown) { - $return = [ - 'fired' => $resultUnknown, - 'sound' => $config['sound_alert'], - ]; - $event = events_get_event($resultUnknown); - - $module_name = modules_get_agentmodule_name($event['id_agentmodule']); - $agent_name = agents_get_alias($event['id_agente']); - - $return['message'] = io_safe_output($agent_name).' - '; - $return['message'] .= __('Module ').io_safe_output($module_name); - $return['message'] .= __(' is going to unknown').' - '; - $return['message'] .= $event['timestamp']; } else { - $return = ['fired' => 0]; + $filter = events_get_event_filter($filter_id); + } + + // Set time. + $filter['event_view_hr'] = 0; + + $start = (time() - $interval); + $end = time(); + + $filter['date_from'] = date('Y-m-d', $start); + $filter['date_to'] = date('Y-m-d', $end); + $filter['time_from'] = date('H:i:s', $start); + $filter['time_to'] = date('H:i:s', $end); + $data = events_get_all( + ['te.*'], + $filter + ); + + $return = []; + if (empty($data) === false) { + foreach ($data as $event) { + $return[] = [ + 'fired' => $event['id_evento'], + 'message' => ui_print_string_substr( + strip_tags(io_safe_output($event['evento'])), + 75, + true, + '9' + ), + 'priority' => ui_print_event_priority($event['criticity'], true, true), + 'type' => events_print_type_img( + $event['event_type'], + true + ), + 'timestamp' => ui_print_timestamp( + $event['timestamp'], + true, + ['style' => 'font-size: 9pt; letter-spacing: 0.3pt;'] + ), + ]; + } } echo io_json_mb_encode($return); + return; } diff --git a/pandora_console/include/class/AgentWizard.class.php b/pandora_console/include/class/AgentWizard.class.php index 802f73a341..f97324dfc4 100644 --- a/pandora_console/include/class/AgentWizard.class.php +++ b/pandora_console/include/class/AgentWizard.class.php @@ -1196,7 +1196,7 @@ class AgentWizard extends HTML $table->head[1] = ''.__('Server').''; $table->head[2] = ''.__('Type').''; $table->head[3] = ''.__('Description').''; - $table->head[4] = ''.__('Treshold').''; + $table->head[4] = ''.__('Threshold').''; $table->data = []; diff --git a/pandora_console/include/class/CalendarManager.class.php b/pandora_console/include/class/CalendarManager.class.php index fdd4fb963c..af7e51848f 100644 --- a/pandora_console/include/class/CalendarManager.class.php +++ b/pandora_console/include/class/CalendarManager.class.php @@ -260,6 +260,8 @@ class CalendarManager */ public function deleteCalendar() { + global $config; + $id = (int) get_parameter('id'); try { $calendar = new Calendar($id); @@ -278,6 +280,22 @@ class CalendarManager return; } + if (is_numeric($id) === true) { + if ((bool) check_acl( + $config['id_user'], + $calendar->id_group(), + 'LM' + ) === false + ) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to access calendar delete' + ); + include 'general/noaccess.php'; + exit; + } + } + // Remove. $calendar->delete(); $this->message = \ui_print_success_message( @@ -480,6 +498,35 @@ class CalendarManager $new = true; } + $group_id = null; + + if ($new === true) { + if (is_numeric(get_parameter('id_group')) === true) { + $group_id = get_parameter('id_group'); + } + } else { + if (is_numeric($calendar->id_group()) === true) { + $group_id = $calendar->id_group(); + } + } + + if (is_numeric($group_id) === true) { + // Check for permissions before rendering edit view or performing save action. + if ((bool) check_acl( + $config['id_user'], + $group_id, + 'LM' + ) === false + ) { + db_pandora_audit( + AUDIT_LOG_ACL_VIOLATION, + 'Trying to access calendar editor' + ); + include 'general/noaccess.php'; + exit; + } + } + $action = get_parameter('action'); if ($action === 'save') { $success = false; @@ -604,19 +651,23 @@ class CalendarManager $is_management_allowed = \is_management_allowed(); if ((bool) $data === true) { - $manage = check_acl( - $config['id_user'], - 0, - 'LM', - true - ); + $user_id = $config['id_user']; $data = array_reduce( $data, - function ($carry, $item) use ($manage, $is_management_allowed) { + function ($carry, $item) use ($user_id, $is_management_allowed) { // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps // Transforms array of arrays $data into an array // of objects, making a post-process of certain fields. + // Users must only be able to manage items that belong to their groups. + // IMPORTANT: if user does not have permission over 'All' group, items belonging to such + // group must be listed but they must not allow for edition. + $manage = check_acl_restricted_all( + $user_id, + $item['id_group'], + 'LM' + ); + $tmp = (object) $item; if ((bool) $manage === true) { diff --git a/pandora_console/include/class/HTML.class.php b/pandora_console/include/class/HTML.class.php index 7396f813b5..6b4d153a7a 100644 --- a/pandora_console/include/class/HTML.class.php +++ b/pandora_console/include/class/HTML.class.php @@ -777,6 +777,7 @@ class HTML ) { $form = ($data['form'] ?? null); $inputs = ($data['inputs'] ?? []); + $blocks = ($data['blocks'] ?? []); $rawInputs = ($data['rawInputs'] ?? null); $js = ($data['js'] ?? null); $rawjs = ($data['js_block'] ?? null); @@ -843,36 +844,59 @@ class HTML $output_submit = ''; $output = ''; - if ($print_white_box === true) { - $output .= '
'; - } + if (empty($blocks) === false) { + $output .= '
'; + foreach ($blocks as $valueblock) { + $output .= ''; - - // There is possible add raw inputs for this form. - if (empty($rawInputs) === false) { - $output .= $rawInputs; - } - - if ($print_white_box === true) { $output .= '
'; + } else { + if ($print_white_box === true) { + $output .= '
'; + } + + $output .= ''; + + // There is possible add raw inputs for this form. + if (empty($rawInputs) === false) { + $output .= $rawInputs; + } + + if ($print_white_box === true) { + $output .= '
'; + } + + $output .= ''; } - $output .= ''; $output .= html_print_csrf_hidden(true); $output .= ''; $output .= ''; diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index c9c3ec9e2e..8b18fe6417 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2399,9 +2399,9 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true) * LM - Alert Management * PM - Pandora Management * - * @param integer $id_user User id - * @param integer $id_group Agents group id to check from - * @param string $access Access privilege + * @param integer $id_user User id. + * @param integer $id_group Agents group id to check from. + * @param string $access Access privilege. * @param boolean $onlyOneGroup Flag to check acl for specified group only (not to roots up, or check acl for 'All' group when $id_group is 0). * * @return boolean 1 if the user has privileges, 0 if not. @@ -2409,7 +2409,7 @@ function check_acl_one_of_groups($id_user, $groups, $access, $cache=true) function check_acl_restricted_all($id_user, $id_group, $access, $onlyOneGroup=false) { if (empty($id_user)) { - // User ID needs to be specified + // User ID needs to be specified. trigger_error('Security error: check_acl got an empty string for user id', E_USER_WARNING); return 0; } else if (is_user_admin($id_user)) { diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index c5de8c5b78..09a3430f98 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -14699,7 +14699,7 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) 'type_graph' => $config['type_module_charts'], 'fullscale' => false, 'return_img_base_64' => true, - 'image_treshold' => $graph_threshold, + 'image_threshold' => $graph_threshold, 'graph_font_size' => $graph_font_size, ]; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 336426f1b2..0e4239e8ab 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -626,7 +626,7 @@ function grafico_modulo_sparse_data( * 'show_legend' => true, * 'show_overview' => true, * 'return_img_base_64' => false, - * 'image_treshold' => false, + * 'image_threshold' => false, * 'graph_combined' => false, * 'graph_render' => 0, * 'zoom' => 1, @@ -782,8 +782,8 @@ function grafico_modulo_sparse($params) $params['return_img_base_64'] = false; } - if (isset($params['image_treshold']) === false) { - $params['image_treshold'] = false; + if (isset($params['image_threshold']) === false) { + $params['image_threshold'] = false; } if (isset($params['graph_combined']) === false) { @@ -1305,8 +1305,8 @@ function graphic_combined_module( $params['return_img_base_64'] = false; } - if (isset($params['image_treshold']) === false) { - $params['image_treshold'] = false; + if (isset($params['image_threshold']) === false) { + $params['image_threshold'] = false; } if (isset($params['show_unknown']) === false) { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 51160d6437..a2bf84eabe 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1685,7 +1685,9 @@ function html_print_select_multiple_modules_filtered(array $data):string ); } - if ($data['mAgents'] !== null) { + if (empty($data['mAgents']) === false + && empty($data['mModuleGroup'] === false) + ) { $all_modules = get_modules_agents( $data['mModuleGroup'], explode(',', $data['mAgents']), diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 07c8ad0460..e78f1ccc8b 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -10159,6 +10159,11 @@ function reporting_simple_graph( $fullscale = (bool) $content['style']['fullscale']; } + $image_threshold = false; + if (isset($content['style']['image_threshold'])) { + $image_threshold = (bool) $content['style']['image_threshold']; + } + $return['chart'] = ''; // Get chart. @@ -10213,6 +10218,7 @@ function reporting_simple_graph( 'backgroundColor' => 'transparent', 'return_img_base_64' => true, 'graph_render' => $content['graph_render'], + 'image_threshold' => $image_threshold, ]; if ($only_image === false) { diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index a1d9f22981..16e1b31a82 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1017,7 +1017,7 @@ function pandoraFlotArea( var max_x = date_array["final_date"] * 1000; var type = parseInt(params.stacked); var show_legend = params.show_legend; - var image_treshold = params.image_treshold; + var image_threshold = params.image_threshold; var short_data = params.short_data != "" ? params.short_data : 3; var grid_color = params.grid_color; var background_color = params.backgroundColor; @@ -2212,7 +2212,7 @@ function pandoraFlotArea( } if (thresholded) { - var data_base_treshold = add_threshold( + var data_base_threshold = add_threshold( data_base, threshold_data, ranges.yaxis.from, @@ -2225,7 +2225,7 @@ function pandoraFlotArea( plot = $.plot( $("#" + graph_id), - data_base_treshold, + data_base_threshold, $.extend(true, {}, options, { grid: { borderWidth: 1, @@ -2611,7 +2611,7 @@ function pandoraFlotArea( $("#overview_" + graph_id).bind("mouseout", resetInteractivity); } - if (image_treshold) { + if (image_threshold) { var y_recal = plot.getAxes().yaxis.max; if (!thresholded) { // Recalculate the y axis @@ -2625,7 +2625,7 @@ function pandoraFlotArea( ); } - var datas_treshold = add_threshold( + var datas_threshold = add_threshold( data_base, threshold_data, plot.getAxes().yaxis.min, @@ -2638,7 +2638,7 @@ function pandoraFlotArea( plot = $.plot( $("#" + graph_id), - datas_treshold, + datas_threshold, $.extend(true, {}, options, { yaxis: { max: y_recal.max @@ -2772,7 +2772,7 @@ function pandoraFlotArea( ); } - datas_treshold = add_threshold( + datas_threshold = add_threshold( data_base, threshold_data, plot.getAxes().yaxis.min, @@ -2785,7 +2785,7 @@ function pandoraFlotArea( plot = $.plot( $("#" + graph_id), - datas_treshold, + datas_threshold, $.extend(true, {}, options, { yaxis: { min: max_draw["min"], @@ -3096,7 +3096,7 @@ function axis_thresholded( return y; } -//add treshold +//add threshold function add_threshold( data_base, threshold_data, @@ -3216,13 +3216,13 @@ function add_threshold( } }); - var extreme_treshold_array = []; + var extreme_threshold_array = []; var i = 0; var flag = true; $.each(threshold_array, function(index, value) { flag = true; - extreme_treshold_array[i] = { + extreme_threshold_array[i] = { below: value["max"], color: value["color"] }; @@ -3233,7 +3233,7 @@ function add_threshold( } }); if (flag) { - extreme_treshold_array[i] = { + extreme_threshold_array[i] = { below: value["min"], color: datas[0].color }; @@ -3241,7 +3241,7 @@ function add_threshold( } }); - datas[0].threshold = extreme_treshold_array; + datas[0].threshold = extreme_threshold_array; return datas; } diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 9415183170..be6aac2818 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -2090,6 +2090,60 @@ function selection_multiple_change(info) { ); } +/* + * Creates a progressbar. + * @param id the id of the div we want to transform in a progressbar. + * @param duration the duration of the timer example: '10s'. + * @param iteration. + * @param callback, optional function which is called when the progressbar reaches 0. + */ +function createProgressTimeBar(id, duration, iteration, callback) { + // We select the div that we want to turn into a progressbar + var progressbar = document.getElementById(id); + progressbar.className = "progressbar"; + + // We create the div that changes width to show progress + var progressbarinner = document.createElement("div"); + progressbarinner.className = "inner"; + + // Now we set the animation parameters + progressbarinner.style.animationDuration = duration; + + progressbarinner.style.animationIterationCount = iteration; + + // Eventually couple a callback + if (typeof callback === "function") { + if (iteration === "infinite") { + progressbarinner.addEventListener("animationiteration", callback); + } else { + progressbarinner.addEventListener("animationend", callback); + } + } + + // Append the progressbar to the main progressbardiv + progressbar.appendChild(progressbarinner); + + // When everything is set up we start the animation + progressbarinner.style.animationPlayState = "running"; + + return progressbarinner; +} + +function progressTimeBar(id, interval, iteration, callback) { + var progress = createProgressTimeBar(id, interval + "s", iteration, callback); + + var controls = { + start: function() { + progress.style.animationPlayState = "running"; + }, + paused: function() { + progress.style.animationPlayState = "paused"; + } + }; + + return controls; +} + /** * Filter selector item by text based on a text input. * diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index e8240443d8..f6e4445744 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -254,7 +254,7 @@ function initialiceLayout(data) { confirmDialog({ title: "Are you sure?", message: - "

All changes made to this widget will be lost

", + "

All changes made to this widget will be lost

", cancel: "Cancel", ok: "Ok", onAccept: function() { @@ -266,7 +266,7 @@ function initialiceLayout(data) { }); $("#configure-widget-" + id).click(function() { - configurationWidget(id, widgetId); + getSizeModalConfiguration(id, widgetId); }); }, error: function(error) { @@ -275,6 +275,29 @@ function initialiceLayout(data) { }); } + function getSizeModalConfiguration(cellId, widgetId) { + $.ajax({ + method: "post", + url: data.url, + data: { + page: data.page, + method: "getSizeModalConfiguration", + dashboardId: data.dashboardId, + cellId: cellId, + widgetId: widgetId + }, + dataType: "json", + success: function(size) { + configurationWidget(cellId, widgetId, size); + }, + error: function(error) { + console.log(error); + return []; + } + }); + return false; + } + function saveLayout() { var items = $(".grid-stack > .grid-stack-item:visible") .map(function(i, el) { @@ -370,7 +393,7 @@ function initialiceLayout(data) { }); } - function configurationWidget(cellId, widgetId) { + function configurationWidget(cellId, widgetId, size) { load_modal({ target: $("#modal-config-widget"), form: "form-config-widget", @@ -388,12 +411,9 @@ function initialiceLayout(data) { dashboardId: data.dashboardId, widgetId: widgetId }, - width: - widgetId == 14 || widgetId == 2 || widgetId == 23 || widgetId == 16 - ? 750 - : 450, - maxHeight: 650, - minHeight: widgetId == 16 ? 450 : 400 + width: size.width, + maxHeight: size.height, + minHeight: size.height }, onsubmit: { page: data.page, @@ -698,7 +718,7 @@ function initialiceLayout(data) { confirmDialog({ title: "Are you sure?", message: - "

All changes made to this widget will be lost

", + "

All changes made to this widget will be lost

", cancel: "Cancel", ok: "Ok", onAccept: function() { @@ -710,7 +730,7 @@ function initialiceLayout(data) { }); $("#configure-widget-" + cellId).click(function() { - configurationWidget(cellId, widgetId); + getSizeModalConfiguration(cellId, widgetId); }); saveLayout(); diff --git a/pandora_console/include/lib/Calendar.php b/pandora_console/include/lib/Calendar.php index 3b6b1560fe..598642c132 100644 --- a/pandora_console/include/lib/Calendar.php +++ b/pandora_console/include/lib/Calendar.php @@ -186,6 +186,9 @@ class Calendar extends Entity $order_by = ''; $pagination = ''; + $user_groups = users_get_groups(); + $user_groups_ids = implode(',', array_keys($user_groups)); + if (isset($filter['free_search']) === true && empty($filter['free_search']) === false ) { @@ -196,6 +199,8 @@ class Calendar extends Entity ); } + $sql_filters[] = ' AND id_group IN ('.$user_groups_ids.')'; + if (isset($order) === true) { $dir = 'asc'; if ($order === 'desc') { diff --git a/pandora_console/include/lib/Dashboard/Manager.php b/pandora_console/include/lib/Dashboard/Manager.php index 33cd0a3c2c..843f30e94a 100644 --- a/pandora_console/include/lib/Dashboard/Manager.php +++ b/pandora_console/include/lib/Dashboard/Manager.php @@ -180,6 +180,7 @@ class Manager implements PublicLogin 'imageIconDashboardAjax', 'formSlides', 'callWidgetMethod', + 'getSizeModalConfiguration', ]; @@ -1374,7 +1375,14 @@ class Manager implements PublicLogin global $config; $instance = $this->instanceWidget(); + $blocks = []; $htmlInputs = $instance->getFormInputs([]); + + if (isset($htmlInputs['blocks']) === true) { + $blocks = $htmlInputs['blocks']; + $htmlInputs = $htmlInputs['inputs']; + } + $js = $instance->getFormJS(); View::render( @@ -1382,6 +1390,7 @@ class Manager implements PublicLogin [ 'dashboardId' => $this->dashboardId, 'cellId' => $this->cellId, + 'blocks' => $blocks, 'htmlInputs' => $htmlInputs, 'js' => $js, ] @@ -1524,4 +1533,22 @@ class Manager implements PublicLogin } + /** + * Size configuration modal (ajax only). + * + * @return void. + */ + public function getSizeModalConfiguration():void + { + $result = []; + $widget = $this->instanceWidget(); + $result = $widget->getSizeModalConfiguration(); + + echo json_encode($result); + + return; + + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php index 98945354ce..21e9b1d0c6 100644 --- a/pandora_console/include/lib/Dashboard/Widget.php +++ b/pandora_console/include/lib/Dashboard/Widget.php @@ -521,7 +521,9 @@ class Widget if (empty($values['background']) === true) { $values['background'] = '#ffffff'; - if ($config['style'] === 'pandora_black' && !is_metaconsole()) { + if ($config['style'] === 'pandora_black' + && is_metaconsole() === false + ) { $values['background'] = '#222222'; } } @@ -768,4 +770,20 @@ class Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration():array + { + $size = [ + 'width' => 400, + 'height' => 650, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php index dbc0c1dcf5..bda15566ca 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php @@ -285,12 +285,12 @@ class AgentModuleWidget extends Widget 'arguments' => [ 'type' => 'select_multiple_modules_filtered', 'uniqId' => $this->cellId, - 'mGroup' => $this->values['mGroup'], - 'mRecursion' => $this->values['mRecursion'], - 'mModuleGroup' => $this->values['mModuleGroup'], - 'mAgents' => $this->values['mAgents'], - 'mShowCommonModules' => $this->values['mShowCommonModules'], - 'mModules' => $this->values['mModules'], + 'mGroup' => (isset($this->values['mGroup']) === true) ? $this->values['mGroup'] : '', + 'mRecursion' => (isset($this->values['mRecursion']) === true) ? $this->values['mRecursion'] : '', + 'mModuleGroup' => (isset($this->values['mModuleGroup']) === true) ? $this->values['mModuleGroup'] : '', + 'mAgents' => (isset($this->values['mAgents']) === true) ? $this->values['mAgents'] : '', + 'mShowCommonModules' => (isset($this->values['mShowCommonModules']) === true) ? $this->values['mShowCommonModules'] : '', + 'mModules' => (isset($this->values['mModules']) === true) ? $this->values['mModules'] : '', 'mShowSelectedOtherGroups' => true, 'mReturnAllGroup' => $return_all_group, 'mMetaFields' => ((bool) is_metaconsole()), @@ -852,4 +852,20 @@ class AgentModuleWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 800, + 'height' => 580, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php b/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php index fdb5c3648a..abdacf5322 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php +++ b/pandora_console/include/lib/Dashboard/Widgets/alerts_fired.php @@ -372,4 +372,20 @@ class AlertsFiredWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => (is_metaconsole() === true) ? 330 : 260, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/clock.php b/pandora_console/include/lib/Dashboard/Widgets/clock.php index 5d90f0f863..7567a79ac5 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/clock.php +++ b/pandora_console/include/lib/Dashboard/Widgets/clock.php @@ -322,4 +322,20 @@ class ClockWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 270, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/custom_graph.php b/pandora_console/include/lib/Dashboard/Widgets/custom_graph.php index c2515d1088..ed9f1fd4bd 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/custom_graph.php +++ b/pandora_console/include/lib/Dashboard/Widgets/custom_graph.php @@ -533,4 +533,20 @@ class CustomGraphWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 440, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index acdf98ccb8..d0cccd3d73 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -289,8 +289,19 @@ class EventsListWidget extends Widget // Retrieve global - common inputs. $inputs = parent::getFormInputs(); + $blocks = [ + 'row1', + 'row2', + ]; + + $inputs['blocks'] = $blocks; + + foreach ($inputs as $kInput => $vInput) { + $inputs['inputs']['row1'][] = $vInput; + } + // Select pre built filter. - $inputs[] = [ + $inputs['inputs']['row1'][] = [ 'label' => \__('Custom filters'), 'arguments' => [ 'type' => 'select', @@ -317,7 +328,7 @@ class EventsListWidget extends Widget } // Event Type. - $inputs[] = [ + $inputs['inputs']['row1'][] = [ 'label' => \__('Event type'), 'arguments' => [ 'type' => 'select', @@ -332,7 +343,7 @@ class EventsListWidget extends Widget ]; // Max. hours old. Default 8. - $inputs[] = [ + $inputs['inputs']['row1'][] = [ 'label' => \__('Max. hours old'), 'arguments' => [ 'name' => 'maxHours', @@ -355,7 +366,7 @@ class EventsListWidget extends Widget ($config['block_size'] * 3) => ($config['block_size'] * 3), ]; - $inputs[] = [ + $inputs['inputs']['row1'][] = [ 'label' => \__('Limit'), 'arguments' => [ 'type' => 'select', @@ -374,7 +385,7 @@ class EventsListWidget extends Widget 0 => \__('Only pending'), ]; - $inputs[] = [ + $inputs['inputs']['row1'][] = [ 'label' => \__('Event status'), 'arguments' => [ 'type' => 'select', @@ -389,7 +400,7 @@ class EventsListWidget extends Widget // Severity. $fields = \get_priorities(); - $inputs[] = [ + $inputs['inputs']['row1'][] = [ 'label' => \__('Severity'), 'arguments' => [ 'type' => 'select', @@ -416,7 +427,7 @@ class EventsListWidget extends Widget } // Groups. - $inputs[] = [ + $inputs['inputs']['row2'][] = [ 'label' => \__('Groups'), 'arguments' => [ 'type' => 'select_groups', @@ -432,7 +443,7 @@ class EventsListWidget extends Widget ]; // Group recursion. - $inputs[] = [ + $inputs['inputs']['row2'][] = [ 'label' => \__('Group recursion'), 'arguments' => [ 'type' => 'switch', @@ -446,7 +457,7 @@ class EventsListWidget extends Widget // Tags. $fields = \tags_get_user_tags($config['id_user'], 'AR'); - $inputs[] = [ + $inputs['inputs']['row2'][] = [ 'label' => \__('Tags'), 'arguments' => [ 'type' => 'select', @@ -668,7 +679,6 @@ class EventsListWidget extends Widget 'columns' => $fields, 'ajax_return_operation' => 'buffers', 'ajax_return_operation_function' => 'process_buffers', - // 'drawCallback' => 'process_datatables_callback(this, settings)', 'return' => true, 'csv' => 0, ] @@ -700,4 +710,20 @@ class EventsListWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 800, + 'height' => (is_metaconsole() === true) ? 600 : 550, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/example.php b/pandora_console/include/lib/Dashboard/Widgets/example.php index 3a4ec40fb6..e7ca6e5ada 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/example.php +++ b/pandora_console/include/lib/Dashboard/Widgets/example.php @@ -289,4 +289,20 @@ class WelcomeWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 500, + 'height' => 220, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php b/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php index dba9035877..2918c73f5d 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php +++ b/pandora_console/include/lib/Dashboard/Widgets/graph_module_histogram.php @@ -443,4 +443,20 @@ class GraphModuleHistogramWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 480, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/groups_status.php b/pandora_console/include/lib/Dashboard/Widgets/groups_status.php index af25b2c056..c250da93da 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/groups_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/groups_status.php @@ -493,4 +493,20 @@ class GroupsStatusWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 270, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php b/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php index 0b5667e491..40b47dce4b 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php +++ b/pandora_console/include/lib/Dashboard/Widgets/maps_made_by_user.php @@ -535,4 +535,20 @@ class MapsMadeByUser extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => (is_metaconsole() === true) ? 330 : 270, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php index 2f59a29f0a..2c2faa3147 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/maps_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/maps_status.php @@ -400,4 +400,20 @@ class MapsStatusWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 425, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php index cb3d8086e8..a4ec3a09c6 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_icon.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_icon.php @@ -552,4 +552,20 @@ class ModuleIconWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 700, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_status.php b/pandora_console/include/lib/Dashboard/Widgets/module_status.php index 0a0fe65615..c022d09018 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_status.php @@ -550,4 +550,20 @@ class ModuleStatusWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 650, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_table_value.php b/pandora_console/include/lib/Dashboard/Widgets/module_table_value.php index 0039768a30..2281553b73 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_table_value.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_table_value.php @@ -409,4 +409,20 @@ class ModuleTableValueWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 430, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/module_value.php b/pandora_console/include/lib/Dashboard/Widgets/module_value.php index b005863b24..ecc770eb01 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/module_value.php +++ b/pandora_console/include/lib/Dashboard/Widgets/module_value.php @@ -378,7 +378,7 @@ class ModuleValueWidget extends Widget { global $config; - $output .= ''; + $output = ''; $id_agent = $this->values['agentId']; $id_group = agents_get_agent_group($id_agent); @@ -445,4 +445,20 @@ class ModuleValueWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 490, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/monitor_health.php b/pandora_console/include/lib/Dashboard/Widgets/monitor_health.php index c8a62feafa..03d54700be 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/monitor_health.php +++ b/pandora_console/include/lib/Dashboard/Widgets/monitor_health.php @@ -319,7 +319,7 @@ class MonitorHealthWidget extends Widget 20 ); - $output = '
'; + $output = '
'; $output .= \html_print_table($table, true); $output .= '
'; @@ -349,4 +349,20 @@ class MonitorHealthWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 220, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/network_map.php b/pandora_console/include/lib/Dashboard/Widgets/network_map.php index c07e09758f..f295a1cb7c 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/network_map.php +++ b/pandora_console/include/lib/Dashboard/Widgets/network_map.php @@ -490,4 +490,20 @@ class NetworkMapWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 430, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php b/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php index c1bad5c63f..892d1f219a 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php +++ b/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php @@ -347,4 +347,20 @@ class OsQuickReportWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 205, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/post.php b/pandora_console/include/lib/Dashboard/Widgets/post.php index 584c1af782..b6d35b24dd 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/post.php +++ b/pandora_console/include/lib/Dashboard/Widgets/post.php @@ -288,4 +288,20 @@ class PostWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 500, + 'height' => 500, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/reports.php b/pandora_console/include/lib/Dashboard/Widgets/reports.php index 8611665128..81422c41c3 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/reports.php +++ b/pandora_console/include/lib/Dashboard/Widgets/reports.php @@ -499,4 +499,20 @@ class ReportsWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => (is_metaconsole() === true) ? 330 : 260, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/service_map.php b/pandora_console/include/lib/Dashboard/Widgets/service_map.php index 9fafaf6751..2b4487b93a 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/service_map.php +++ b/pandora_console/include/lib/Dashboard/Widgets/service_map.php @@ -258,6 +258,9 @@ class ServiceMapWidget extends Widget $inputs = parent::getFormInputs(); $services_res = services_get_services(); + if ($services_res === false) { + $services_res = []; + } // If currently selected report is not included in fields array (it belongs to a group over which user has no permissions), then add it to fields array. // This is aimed to avoid overriding this value when a user with narrower permissions edits widget configuration. @@ -358,6 +361,7 @@ class ServiceMapWidget extends Widget $size = parent::getSize(); $output = ''; + if (check_acl($config['id_user'], 0, 'AR') === 0) { $output .= '
'; $output .= \ui_print_error_message( @@ -449,4 +453,20 @@ class ServiceMapWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 320, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/service_view.php b/pandora_console/include/lib/Dashboard/Widgets/service_view.php index d838861659..e588e01d69 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/service_view.php +++ b/pandora_console/include/lib/Dashboard/Widgets/service_view.php @@ -468,4 +468,20 @@ class ServiceViewWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 270, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php index 6c3bf6102a..c35681219d 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php +++ b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php @@ -405,4 +405,20 @@ class SingleGraphWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 430, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php b/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php index ae1434891e..33d89b7489 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php +++ b/pandora_console/include/lib/Dashboard/Widgets/sla_percent.php @@ -494,4 +494,20 @@ class SLAPercentWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 550, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php b/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php index 57b4f90fb3..c3b768424c 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php +++ b/pandora_console/include/lib/Dashboard/Widgets/system_group_status.php @@ -634,4 +634,20 @@ class SystemGroupStatusWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 520, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/tactical.php b/pandora_console/include/lib/Dashboard/Widgets/tactical.php index 74d72d0c5c..f5f664fb70 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/tactical.php +++ b/pandora_console/include/lib/Dashboard/Widgets/tactical.php @@ -494,4 +494,20 @@ class TacticalWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 370, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php index 0406a4e214..8e5aba52c0 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php @@ -540,4 +540,20 @@ class TopNWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 530, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php index 9329fb749a..9e84cbbc31 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php @@ -514,4 +514,20 @@ class TopNEventByGroupWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 520, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php index f110c4ea52..e5400f6b3b 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php @@ -549,4 +549,20 @@ class TopNEventByModuleWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 400, + 'height' => 540, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php index fe76b94ec0..9327c7c132 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php +++ b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php @@ -726,4 +726,20 @@ class TreeViewWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => (is_metaconsole() === true) ? 500 : 590, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/url.php b/pandora_console/include/lib/Dashboard/Widgets/url.php index 41a3420d0a..7b1e4043fa 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/url.php +++ b/pandora_console/include/lib/Dashboard/Widgets/url.php @@ -298,4 +298,20 @@ class UrlWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 270, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php index 5026a240f5..cf64cfa222 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php +++ b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction.php @@ -176,7 +176,7 @@ class WuxWidget extends Widget // Must be configured before using. $this->configurationRequired = false; if (empty($this->options) === true) { - $this->configuration_required = true; + $this->configurationRequired = true; } $this->overflow_scrollbars = false; @@ -430,4 +430,20 @@ class WuxWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 330, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php index e75a0012d3..f53ea0e135 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php +++ b/pandora_console/include/lib/Dashboard/Widgets/wux_transaction_stats.php @@ -390,4 +390,20 @@ class WuxStatsWidget extends Widget } + /** + * Get size Modal Configuration. + * + * @return array + */ + public function getSizeModalConfiguration(): array + { + $size = [ + 'width' => 450, + 'height' => 370, + ]; + + return $size; + } + + } diff --git a/pandora_console/include/lib/SpecialDay.php b/pandora_console/include/lib/SpecialDay.php index bd7816b94c..b93ceb95f4 100644 --- a/pandora_console/include/lib/SpecialDay.php +++ b/pandora_console/include/lib/SpecialDay.php @@ -206,7 +206,7 @@ class SpecialDay extends Entity && empty($filter['id_group']) === false ) { $sql_filters[] = sprintf( - ' AND `talert_special_days`.`id_group` IN ("%s")', + ' AND `talert_special_days`.`id_group` IN (%s)', implode(',', $filter['id_group']) ); } diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index ca1243c61b..308e085ac8 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -668,3 +668,17 @@ form.modal-dashboard width: 98%; margin-top: 5px; } + +.ui-dialog .ui-dialog-title { + top: 0px !important; +} + +.ui-dialog .ui-dialog-content { + padding: 0em 1em !important; + margin-bottom: 0 !important; +} + +.ui-dialog .ui-dialog-buttonpane { + margin-top: 0px !important; + padding: 0.5em 1em 0em 0em !important; +} diff --git a/pandora_console/include/styles/form.css b/pandora_console/include/styles/form.css index 56e872aab6..935b796b76 100644 --- a/pandora_console/include/styles/form.css +++ b/pandora_console/include/styles/form.css @@ -289,6 +289,19 @@ ul.wizard li > textarea { display: inline-block; } +.container-block-column { + display: flex; + flex-direction: row; + width: 100%; + height: 100%; + align-items: center; + justify-content: space-around; +} + +.container-block-column ul.wizard { + width: 100%; +} + .hidden { display: none; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index d49361fae6..df6792dccd 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -6256,7 +6256,7 @@ div.graph div.legend table { .sound_events { background-color: #494949; - margin: 40px 2em 0; + margin: 1em 2em; min-height: auto; } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index caecc587dd..e70607e4dd 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1475,12 +1475,20 @@ if ($pure) { ?> '; echo ''; echo ''.__('Sound Events').''; +ui_require_css_file('wizard'); +ui_require_css_file('discovery'); ?> '; @@ -98,106 +176,121 @@ ui_print_message_dialog( '/images/error_1.png' ); -$table = new StdClass; -$table->width = '100%'; -$table->class = 'w16px sound_div_background '; -$table->size[0] = '10%'; -$table->rowclass[0] = 'bold_top'; -$table->rowclass[1] = 'bold_top'; -$table->rowclass[2] = 'bold_top'; +$inputs = []; -$table->data[0][0] = __('Group'); -$table->data[0][1] = html_print_select_groups( - false, - $access, - true, - 'group', - '', - 'changeGroup();', - '', - 0, - true, - false, - true, - '', - false, - 'max-width:200px;' -).'

'; +// Load filter. +$fields = \events_get_event_filter_select(); +$inputs[] = [ + 'label' => \__('Load filter'), + 'class' => 'flex-row', + 'arguments' => [ + 'type' => 'select', + 'fields' => $fields, + 'name' => 'filter_id', + 'selected' => 0, + 'return' => true, + 'nothing' => \__('All new events'), + 'nothing_value' => 0, + 'class' => 'fullwidth', + ], +]; -$table->data[0][2] = __('Type'); -$table->data[0][3] = html_print_checkbox( - 'alert_fired', - 'alert_fired', - true, - true, - false, - 'changeType();' -); -$table->data[0][3] .= __('Alert fired').'
'; -$table->data[0][3] .= html_print_checkbox( - 'critical', - 'critical', - true, - true, - false, - 'changeType();' -); -$table->data[0][3] .= __('Monitor critical').'
'; -$table->data[0][3] .= html_print_checkbox( - 'unknown', - 'unknown', - true, - true, - false, - 'changeType();' -); -$table->data[0][3] .= __('Monitor unknown').'
'; -$table->data[0][3] .= html_print_checkbox( - 'warning', - 'warning', - true, - true, - false, - 'changeType();' -); -$table->data[0][3] .= __('Monitor warning').'
'; +$times_interval = [ + 10 => '10 '.__('seconds'), + 15 => '15 '.__('seconds'), + 30 => '30 '.__('seconds'), + 60 => '60 '.__('seconds'), +]; -$table->data[1][0] = __('Agent'); -$table->data[1][1] = html_print_select( - $agents, - 'id_agents[]', - true, +$times_sound = [ + 2 => '2 '.__('seconds'), + 5 => '5 '.__('seconds'), + 10 => '10 '.__('seconds'), + 15 => '15 '.__('seconds'), + 30 => '30 '.__('seconds'), + 60 => '60 '.__('seconds'), +]; + +$inputs[] = [ + 'class' => 'flex-row flex-row-center', + 'direct' => 1, + 'block_content' => [ + [ + 'label' => __('Interval'), + 'arguments' => [ + 'type' => 'select', + 'fields' => $times_interval, + 'name' => 'interval', + 'selected' => 10, + 'return' => true, + ], + ], + [ + 'label' => __('Time Sound'), + 'arguments' => [ + 'type' => 'select', + 'fields' => $times_sound, + 'name' => 'time_sound', + 'selected' => 10, + 'return' => true, + ], + ], + ], +]; + +$sounds = [ + 'aircraftalarm.wav' => 'Air craft alarm', + 'air_shock_alarm.wav' => 'Air shock alarm', + 'alien_alarm.wav' => 'Alien alarm', + 'alien_beacon.wav' => 'Alien beacon', + 'bell_school_ringing.wav' => 'Bell school ringing', + 'Door_Alarm.wav' => 'Door alarm', + 'EAS_beep.wav' => 'EAS beep', + 'Firewarner.wav' => 'Fire warner', + 'HardPCMAlarm.wav' => 'Hard PCM Alarm', + 'negativebeep.wav' => 'Negative beep', + 'Star_Trek_emergency_simulation.wav' => 'StarTrek emergency simulation', +]; + +$inputs[] = [ + 'label' => \__('Sounds'), + 'class' => 'flex-row', + 'arguments' => [ + 'type' => 'select', + 'fields' => $sounds, + 'name' => 'sound_id', + 'selected' => 'Star_Trek_emergency_simulation.wav', + 'return' => true, + 'class' => 'fullwidth', + ], +]; + +// Print form. +HTML::printForm( + [ + 'form' => [ + 'action' => '', + 'method' => 'POST', + ], + 'inputs' => $inputs, + ], false, - '', - '', - true, - true, - '', - '', - '', - 'max-width:200px; height:100px', - '', - false, - '', - '', true ); -$table->data[1][2] = __('Event'); -$table->data[1][3] = html_print_textarea( - 'events_fired', - 200, - 20, - '', - 'readonly="readonly" style="max-height:100px; resize:none;"', - true -); +$result = '
    '; +$result .= '
  • '; +$result .= ui_print_info_message(__('Events not found'), '', true); +$result .= '
  • '; +$result .= '
'; -html_print_table($table); +$result .= '
'; + +echo $result; $table = new StdClass; $table->width = '100%'; -$table->class = 'w16px sound_div_background text_center'; +$table->class = 'sound_div_background text_center'; $table->data[0][0] = ''; $table->data[0][0] .= html_print_image( @@ -239,18 +332,11 @@ html_print_table($table); ?> '; // devicePixelRatio knows how much zoom browser applied. var windowScale = parseFloat(window.devicePixelRatio); - var defaultWidth = 600; - var defaultHeight = 450; + var defaultWidth = 630; + var defaultHeight = 630; // If the scale is 1, no zoom has been applied. var windowWidth = windowScale <= 1 ? defaultWidth : windowScale*defaultWidth; var windowHeight = windowScale <= 1 ? defaultHeight : windowScale*defaultHeight + (defaultHeight*0.1); - + window.open( url, '', diff --git a/pandora_console/views/calendar/edit.php b/pandora_console/views/calendar/edit.php index 17d25fa97b..c6c686ecf1 100644 --- a/pandora_console/views/calendar/edit.php +++ b/pandora_console/views/calendar/edit.php @@ -73,6 +73,12 @@ if (empty($message) === false) { echo $message; } +$return_all_group = false; + +if (users_can_manage_group_all('LM') === true) { + $return_all_group = true; +} + $inputs = []; // Name. @@ -91,7 +97,7 @@ $inputs[] = [ 'label' => __('Group'), 'arguments' => [ 'type' => 'select_groups', - 'returnAllGroup' => true, + 'returnAllGroup' => $return_all_group, 'name' => 'id_group', 'selected' => $calendar->id_group(), 'required' => true, diff --git a/pandora_console/views/dashboard/configurationWidgets.php b/pandora_console/views/dashboard/configurationWidgets.php index d912027d53..a48a3acd8e 100644 --- a/pandora_console/views/dashboard/configurationWidgets.php +++ b/pandora_console/views/dashboard/configurationWidgets.php @@ -50,6 +50,7 @@ $form = [ HTML::printForm( [ 'form' => $form, + 'blocks' => $blocks, 'inputs' => $htmlInputs, 'js' => $js, ]