From 6d1121602ab990ddc2ec8265167a4a68f58ff9df Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Tue, 28 Jun 2022 11:09:47 +0200 Subject: [PATCH] delete item into widget pandora_enterprise#9213 --- pandora_console/include/lib/Dashboard/Widget.php | 3 +-- .../lib/Dashboard/Widgets/maps_made_by_user.php | 13 ++++++++++++- .../include/lib/Dashboard/Widgets/reports.php | 11 +++++++++++ pandora_console/views/dashboard/list.php | 11 +++++------ pandora_console/views/dashboard/listWidgets.php | 1 - 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php index 1c5904e74a..2065c2d92a 100644 --- a/pandora_console/include/lib/Dashboard/Widget.php +++ b/pandora_console/include/lib/Dashboard/Widget.php @@ -474,11 +474,10 @@ class Widget } else if ($this->loadError === true) { $output .= '
'; $output .= \ui_print_error_message( - __('Widget cannot be loaded'), + __('Widget cannot be loaded').'. '.__('Please, configure the widget again to recover it'), '', true ); - $output .= __('Please, configure the widget again to recover it'); $output .= '
'; } else { $output .= $this->load(); 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..84cd900ac0 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 @@ -182,6 +182,17 @@ class MapsMadeByUser extends Widget $this->configurationRequired = false; if (empty($this->values['vcId']) === true) { $this->configurationRequired = true; + } else { + $check_exist = db_get_value( + 'id', + 'tlayout', + 'id', + $this->values['vcId'] + ); + + if ($check_exist === false) { + $this->loadError = true; + } } $this->overflow_scrollbars = false; @@ -368,7 +379,7 @@ class MapsMadeByUser extends Widget $visualConsole = VisualConsole::fromDB( ['id' => $this->values['vcId']] ); - } catch (Throwable $e) { + } catch (\Throwable $e) { db_pandora_audit( AUDIT_LOG_ACL_VIOLATION, 'Trying to access visual console without Id' diff --git a/pandora_console/include/lib/Dashboard/Widgets/reports.php b/pandora_console/include/lib/Dashboard/Widgets/reports.php index 8611665128..4328eb66f4 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/reports.php +++ b/pandora_console/include/lib/Dashboard/Widgets/reports.php @@ -172,6 +172,17 @@ class ReportsWidget extends Widget $this->configurationRequired = false; if (empty($this->values['reportId']) === true) { $this->configurationRequired = true; + } else { + $check_exist = db_get_value( + 'id_report', + 'treport', + 'id_report', + $this->values['reportId'] + ); + + if ($check_exist === false) { + $this->loadError = true; + } } $this->overflow_scrollbars = false; diff --git a/pandora_console/views/dashboard/list.php b/pandora_console/views/dashboard/list.php index ade98dc91c..c1117e3f36 100644 --- a/pandora_console/views/dashboard/list.php +++ b/pandora_console/views/dashboard/list.php @@ -220,12 +220,11 @@ if ($writeDashboards === 1) { $output = ' $text, - 'btn_text' => __('Ok'), - 'btn_cancel' => __('Cancel'), - 'url' => $ajaxController, - 'url_ajax' => ui_get_full_url('ajax.php'), - 'dashboardId' => $dashboardId, + 'title' => $text, + 'btn_text' => __('Ok'), + 'btn_cancel' => __('Cancel'), + 'url' => $ajaxController, + 'url_ajax' => ui_get_full_url('ajax.php'), ] ); $output .= ')\'>'; diff --git a/pandora_console/views/dashboard/listWidgets.php b/pandora_console/views/dashboard/listWidgets.php index 4b227cc947..ee8f2d7885 100644 --- a/pandora_console/views/dashboard/listWidgets.php +++ b/pandora_console/views/dashboard/listWidgets.php @@ -31,7 +31,6 @@ require_once $config['homedir'].'/include/class/HTML.class.php'; $form = [ 'id' => 'form-search-widget', - 'action' => $url, 'onsubmit' => 'return false;', 'class' => 'modal-dashboard', 'enctype' => 'multipart/form-data',