From 174f6dce511ce3753f3554d1baeecd872d2871a6 Mon Sep 17 00:00:00 2001 From: Calvo Date: Tue, 22 Mar 2022 18:02:53 +0100 Subject: [PATCH] Fix dashboard event list, Removed missing debugger in code --- pandora_console/include/ajax/events.php | 2 ++ pandora_console/include/functions_events.php | 2 +- .../javascript/multiselect_filtered.js | 1 - .../include/javascript/pandora_dashboards.js | 29 +++++++++++++++++-- .../include/javascript/pandora_events.js | 2 +- .../lib/Dashboard/Widgets/events_list.php | 6 ++++ 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 988c458a1c..45b159dae5 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1588,6 +1588,8 @@ if ($get_extended_event) { $notifications .= '
'.ui_print_success_message(__('Event status changed successfully'), '', true).'
'; $notifications .= '
'.ui_print_error_message(__('Error changing event owner'), '', true).'
'; $notifications .= '
'.ui_print_success_message(__('Event owner changed successfully'), '', true).'
'; + $notifications .= '
'.ui_print_error_message(__('Error deleting event'), '', true).'
'; + $loading = '
'.html_print_image('images/spinner.gif', true).'
'; diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 1861134e3f..879c36c38e 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3752,7 +3752,7 @@ function events_page_responses($event, $childrens_ids=[]) $data = []; $data[0] = __('Delete event'); $data[1] = ''; - $data[2] = '
'; + $data[2] = ''; $data[2] .= html_print_button( __('Delete event'), 'delete_button', diff --git a/pandora_console/include/javascript/multiselect_filtered.js b/pandora_console/include/javascript/multiselect_filtered.js index 74f24f5a0a..dcaee528b0 100644 --- a/pandora_console/include/javascript/multiselect_filtered.js +++ b/pandora_console/include/javascript/multiselect_filtered.js @@ -232,7 +232,6 @@ function fmModuleChange(uniqId, isMeta) { selection: showCommonModules }, function(data) { - debugger; $("#filtered-module-modules-" + uniqId).html(""); if (data) { jQuery.each(data, function(id, value) { diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index 104073ef84..a0f8f0a5d5 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -651,7 +651,7 @@ function initialiceLayout(data) { url: data.url, data: { page: data.page, - method: "drawCell", + method: "drawWidget", dashboardId: data.dashboardId, cellId: cellId, newWidth: newWidth, @@ -1326,10 +1326,35 @@ function dashboardShowEventDialog(settings) { resizable: true, draggable: true, modal: true, + create: function() { + $("#button-delete_button").removeAttr("onclick"); + $("#button-delete_button").click(function() { + var confirm_message = $("#hidden-delete_confirm_message").val(); + if (confirm(confirm_message) == false) { + return false; + } + $.ajax({ + method: "post", + url: settings.ajaxUrl, + data: { + page: "include/ajax/events", + delete_event: 1, + id_evento: settings.event.id_evento, + filter: [] + }, + success: function() { + $("#notification_delete_error").show(); + $("#event_details_window").dialog("close"); + }, + error: function(error) { + console.error(error); + } + }); + }); + }, close: function() { //$("#refrcounter").countdown("resume"); //$("div.vc-countdown").countdown("resume"); - debugger; $.ajax({ method: "post", url: settings.ajaxUrl, diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 6826eb3eed..86107bb03d 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -504,7 +504,7 @@ function event_change_status(event_ids) { if ($("#notification_status_error").length) { $("#notification_status_error").hide(); } - debugger; + if (data.status == "status_ok") { if (typeof dt_events !== "undefined") { dt_events.draw(false); diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index c3b01a177e..21336e7419 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -669,6 +669,12 @@ class EventsListWidget extends Widget true ); + $output .= \html_print_input_hidden( + 'delete_confirm_message', + __('Are you sure?'), + true + ); + $table = new \StdClass; $table->class = 'widget_groups_status databox'; $table->cellspacing = '1';