From 24b8937b113c7e90808d64ae81039bc6d2731dc9 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Mon, 11 Sep 2023 13:21:44 +0200 Subject: [PATCH 1/4] The hint is added to the module field. --- pandora_console/include/lib/Dashboard/Widgets/single_graph.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php index 957159824c..0f3ccddff1 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/single_graph.php +++ b/pandora_console/include/lib/Dashboard/Widgets/single_graph.php @@ -324,7 +324,7 @@ class SingleGraphWidget extends Widget // Autocomplete module. $inputs[] = [ - 'label' => __('Module'), + 'label' => __('Module').ui_print_help_tip(__('Warning, this requires to have data for a mid-term (days/weeks) of the source data, if not, projection will not be reliable.'), true), 'arguments' => [ 'type' => 'autocomplete_module', 'name' => 'moduleId', From 2c430929cbba7f9d6ee70a5e956d81c5a3009920 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Mon, 11 Sep 2023 16:53:52 +0200 Subject: [PATCH 2/4] #11831 Fixed menu option literals --- pandora_console/extensions/dbmanager.php | 2 +- pandora_console/godmode/setup/setup.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pandora_console/extensions/dbmanager.php b/pandora_console/extensions/dbmanager.php index 983e208bef..acaaadd12c 100644 --- a/pandora_console/extensions/dbmanager.php +++ b/pandora_console/extensions/dbmanager.php @@ -90,7 +90,7 @@ function dbmgr_extension_main() // Header. ui_print_standard_header( - __('Database interface'), + __('DB interface'), 'images/gm_db.png', false, '', diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 7e17f9fe4c..e6ae8d7bab 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -93,7 +93,7 @@ $buttons['general'] = [ 'images/setup.png', true, [ - 'title' => __('General'), + 'title' => __('General setup'), 'class' => 'invert_filter', ] @@ -265,7 +265,7 @@ if (enterprise_installed()) { switch ($section) { case 'general': $buttons['general']['active'] = true; - $subpage = __('General'); + $subpage = __('General setup'); $help_header = 'setup_general_tab'; break; @@ -377,7 +377,7 @@ switch ($section) { // Header. ui_print_standard_header( - $subpage, + __('Setup').' » '.$subpage, '', false, $help_header, @@ -388,6 +388,10 @@ ui_print_standard_header( 'link' => '', 'label' => __('Setup'), ], + [ + 'link' => '', + 'label' => $subpage, + ], ] ); From 2c98ee5628b03ba42ae38bff44a944aa0a085910 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 18 Sep 2023 09:09:52 +0200 Subject: [PATCH 3/4] #12036 Fix duplicate widget --- .../include/javascript/pandora_dashboards.js | 25 ++++++-------- .../include/lib/Dashboard/Manager.php | 34 ++++++++++++++++--- pandora_console/views/dashboard/cell.php | 14 +++++--- 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index 79fde538b4..471adc877a 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -310,8 +310,6 @@ function initialiceLayout(data) { } function duplicateWidget(original_cellId, original_widgetId) { - let duplicate_cellId = insertCellLayoutForDuplicate(); - $.ajax({ method: "post", url: data.url, @@ -320,16 +318,14 @@ function initialiceLayout(data) { method: "duplicateWidget", dashboardId: data.dashboardId, widgetId: original_widgetId, - cellId: original_cellId, - duplicateCellId: duplicate_cellId + cellId: original_cellId }, dataType: "json", - success: function(success) { - console.log(success); + success: function(data) { + addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true); }, - error: function(error) { - console.log(error); - return []; + error: function(xhr, textStatus, errorMessage) { + console.log("ERROR" + errorMessage + textStatus + xhr); } }); } @@ -428,8 +424,8 @@ function initialiceLayout(data) { } }); } - - function insertCellLayoutForDuplicate() { + /* + function insertCellLayoutForDuplicate(original_cell_id) { let duplicateCellId = 0; $.ajax({ async: false, @@ -441,7 +437,8 @@ function initialiceLayout(data) { dashboardId: data.dashboardId, auth_class: data.auth.class, auth_hash: data.auth.hash, - id_user: data.auth.user + id_user: data.auth.user, + copy: original_cell_id }, dataType: "json", success: function(data) { @@ -449,7 +446,7 @@ function initialiceLayout(data) { // width and height = 4 // position auto = true. if (data.cellId !== 0) { - addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true); + addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true, original_cell_id); duplicateCellId = data.cellId; } }, @@ -458,7 +455,7 @@ function initialiceLayout(data) { } }); return duplicateCellId; - } + }*/ function configurationWidget(cellId, widgetId, size) { load_modal({ diff --git a/pandora_console/include/lib/Dashboard/Manager.php b/pandora_console/include/lib/Dashboard/Manager.php index 40b6d2d1a0..dfcdfe0238 100644 --- a/pandora_console/include/lib/Dashboard/Manager.php +++ b/pandora_console/include/lib/Dashboard/Manager.php @@ -609,10 +609,25 @@ class Manager implements PublicLogin /** * Duplicate widget. * - * @return integer + * @return void */ - public function duplicateWidget():int + public function duplicateWidget():void { + global $config; + + $return = false; + + $position = [ + 'x' => 0, + 'y' => 0, + 'width' => 4, + 'height' => 4, + ]; + + $cellClass = new Cell($position, $this->dashboardId); + $dataCell = $cellClass->get(); + + // $result = ['cellId' => $dataCell['id']]; $original_widget = []; $original_cellId = $this->cellId; @@ -632,12 +647,23 @@ class Manager implements PublicLogin 'options' => $options_json, 'id_widget' => $original_widget['id_widget'], ]; + $res = \db_process_sql_update( 'twidget_dashboard', $values, - ['id' => $this->duplicateCellId] + ['id' => $dataCell['id']] ); - return $res; + + if ($res === 1) { + $return = [ + 'cellId' => $dataCell['id'], + 'widgetId' => $original_widget['id_widget'], + ]; + + $json_return = json_encode($return); + } + + echo $json_return; } diff --git a/pandora_console/views/dashboard/cell.php b/pandora_console/views/dashboard/cell.php index 919ce9e07e..7816f79351 100644 --- a/pandora_console/views/dashboard/cell.php +++ b/pandora_console/views/dashboard/cell.php @@ -34,9 +34,8 @@ if ($redraw === false) { $output .= '
'; $output .= '
'; - -if ((int) $cellData['id_widget'] !== 0) { - $options = json_decode($cellData['options'], true); +$options = json_decode($cellData['options'], true); +if ($cellData['id_widget'] !== '0') { $output .= $options['title']; } else { $output .= __('New widget'); @@ -44,10 +43,15 @@ if ((int) $cellData['id_widget'] !== 0) { $output .= '
'; $output .= '
'; - if ($manageDashboards !== 0 || $writeDashboards !== 0) { if ((int) $cellData['id_widget'] !== 0) { - $output .= ''; + $count_options = count(json_decode($cellData['options'], true)); + $invisible = ''; + if ($count_options <= 2 && $options['copy'] == 0) { + $invisible = 'invisible'; + } + + $output .= ''; $output .= html_print_image( 'images/copy.svg', true, From f2f17de6433de51bee29a80401c7f73544de14b2 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 18 Sep 2023 16:33:47 +0200 Subject: [PATCH 4/4] #12023 Fix write access group in reports --- .../godmode/reporting/reporting_builder.main.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.main.php b/pandora_console/godmode/reporting/reporting_builder.main.php index c0381acca2..d4914d2b58 100755 --- a/pandora_console/godmode/reporting/reporting_builder.main.php +++ b/pandora_console/godmode/reporting/reporting_builder.main.php @@ -180,8 +180,8 @@ if ($report_id_user == $config['id_user'] $options['div_class'] = ''; } - $table->data[2][1] = html_print_label_input_block( - __('Group'), + $table->data[3][0] = html_print_label_input_block( + __('Write Access Group'), html_print_select_groups( false, 'RW', @@ -216,7 +216,7 @@ if ($enterpriseEnable) { if (enterprise_installed() === true) { - $table->data[3][0] = html_print_label_input_block( + $table->data[4][0] = html_print_label_input_block( __('Generate cover page in PDF render'), html_print_checkbox_switch( 'cover_page_render', @@ -226,7 +226,7 @@ if (enterprise_installed() === true) { ) ); - $table->data[3][1] = html_print_label_input_block( + $table->data[4][1] = html_print_label_input_block( __('Generate index in PDF render'), html_print_checkbox_switch( 'index_render',