Merge remote-tracking branch 'origin/develop' into ent-12333-anadir-tablas-dinamicas-a-pandoradb-sql

This commit is contained in:
daniel 2023-11-28 08:43:45 +01:00
commit f9e7f19771
7 changed files with 63 additions and 32 deletions

View File

@ -90,7 +90,7 @@ function dbmgr_extension_main()
// Header. // Header.
ui_print_standard_header( ui_print_standard_header(
__('Database interface'), __('DB interface'),
'images/gm_db.png', 'images/gm_db.png',
false, false,
'', '',

View File

@ -180,8 +180,8 @@ if ($report_id_user == $config['id_user']
$options['div_class'] = ''; $options['div_class'] = '';
} }
$table->data[2][1] = html_print_label_input_block( $table->data[3][0] = html_print_label_input_block(
__('Group'), __('Write Access Group'),
html_print_select_groups( html_print_select_groups(
false, false,
'RW', 'RW',
@ -216,7 +216,7 @@ if ($enterpriseEnable) {
if (enterprise_installed() === true) { 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'), __('Generate cover page in PDF render'),
html_print_checkbox_switch( html_print_checkbox_switch(
'cover_page_render', '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'), __('Generate index in PDF render'),
html_print_checkbox_switch( html_print_checkbox_switch(
'index_render', 'index_render',

View File

@ -93,7 +93,7 @@ $buttons['general'] = [
'images/setup.png', 'images/setup.png',
true, true,
[ [
'title' => __('General'), 'title' => __('General setup'),
'class' => 'invert_filter', 'class' => 'invert_filter',
] ]
@ -265,7 +265,7 @@ if (enterprise_installed()) {
switch ($section) { switch ($section) {
case 'general': case 'general':
$buttons['general']['active'] = true; $buttons['general']['active'] = true;
$subpage = __('General'); $subpage = __('General setup');
$help_header = 'setup_general_tab'; $help_header = 'setup_general_tab';
break; break;
@ -377,7 +377,7 @@ switch ($section) {
// Header. // Header.
ui_print_standard_header( ui_print_standard_header(
$subpage, __('Setup').' » '.$subpage,
'', '',
false, false,
$help_header, $help_header,
@ -388,6 +388,10 @@ ui_print_standard_header(
'link' => '', 'link' => '',
'label' => __('Setup'), 'label' => __('Setup'),
], ],
[
'link' => '',
'label' => $subpage,
],
] ]
); );

View File

@ -310,8 +310,6 @@ function initialiceLayout(data) {
} }
function duplicateWidget(original_cellId, original_widgetId) { function duplicateWidget(original_cellId, original_widgetId) {
let duplicate_cellId = insertCellLayoutForDuplicate();
$.ajax({ $.ajax({
method: "post", method: "post",
url: data.url, url: data.url,
@ -320,16 +318,14 @@ function initialiceLayout(data) {
method: "duplicateWidget", method: "duplicateWidget",
dashboardId: data.dashboardId, dashboardId: data.dashboardId,
widgetId: original_widgetId, widgetId: original_widgetId,
cellId: original_cellId, cellId: original_cellId
duplicateCellId: duplicate_cellId
}, },
dataType: "json", dataType: "json",
success: function(success) { success: function(data) {
console.log(success); addCell(data.cellId, 0, 0, 4, 4, true, 0, 2000, 0, 2000, 0, true);
}, },
error: function(error) { error: function(xhr, textStatus, errorMessage) {
console.log(error); console.log("ERROR" + errorMessage + textStatus + xhr);
return [];
} }
}); });
} }
@ -428,8 +424,8 @@ function initialiceLayout(data) {
} }
}); });
} }
/*
function insertCellLayoutForDuplicate() { function insertCellLayoutForDuplicate(original_cell_id) {
let duplicateCellId = 0; let duplicateCellId = 0;
$.ajax({ $.ajax({
async: false, async: false,
@ -441,7 +437,8 @@ function initialiceLayout(data) {
dashboardId: data.dashboardId, dashboardId: data.dashboardId,
auth_class: data.auth.class, auth_class: data.auth.class,
auth_hash: data.auth.hash, auth_hash: data.auth.hash,
id_user: data.auth.user id_user: data.auth.user,
copy: original_cell_id
}, },
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
@ -449,7 +446,7 @@ function initialiceLayout(data) {
// width and height = 4 // width and height = 4
// position auto = true. // position auto = true.
if (data.cellId !== 0) { 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; duplicateCellId = data.cellId;
} }
}, },
@ -458,7 +455,7 @@ function initialiceLayout(data) {
} }
}); });
return duplicateCellId; return duplicateCellId;
} }*/
function configurationWidget(cellId, widgetId, size) { function configurationWidget(cellId, widgetId, size) {
load_modal({ load_modal({

View File

@ -609,10 +609,25 @@ class Manager implements PublicLogin
/** /**
* Duplicate widget. * 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_widget = [];
$original_cellId = $this->cellId; $original_cellId = $this->cellId;
@ -632,12 +647,23 @@ class Manager implements PublicLogin
'options' => $options_json, 'options' => $options_json,
'id_widget' => $original_widget['id_widget'], 'id_widget' => $original_widget['id_widget'],
]; ];
$res = \db_process_sql_update( $res = \db_process_sql_update(
'twidget_dashboard', 'twidget_dashboard',
$values, $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;
} }

View File

@ -328,7 +328,7 @@ class SingleGraphWidget extends Widget
// Autocomplete module. // Autocomplete module.
$inputs[] = [ $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' => [ 'arguments' => [
'type' => 'autocomplete_module', 'type' => 'autocomplete_module',
'name' => 'moduleId', 'name' => 'moduleId',

View File

@ -34,9 +34,8 @@ if ($redraw === false) {
$output .= '<div class="header-widget">'; $output .= '<div class="header-widget">';
$output .= '<div>'; $output .= '<div>';
$options = json_decode($cellData['options'], true);
if ((int) $cellData['id_widget'] !== 0) { if ($cellData['id_widget'] !== '0') {
$options = json_decode($cellData['options'], true);
$output .= $options['title']; $output .= $options['title'];
} else { } else {
$output .= __('New widget'); $output .= __('New widget');
@ -44,10 +43,15 @@ if ((int) $cellData['id_widget'] !== 0) {
$output .= '</div>'; $output .= '</div>';
$output .= '<div class="header-options">'; $output .= '<div class="header-options">';
if ($manageDashboards !== 0 || $writeDashboards !== 0) { if ($manageDashboards !== 0 || $writeDashboards !== 0) {
if ((int) $cellData['id_widget'] !== 0) { if ((int) $cellData['id_widget'] !== 0) {
$output .= '<a id="copy-widget-'.$cellData['id'].'" class="">'; $count_options = count(json_decode($cellData['options'], true));
$invisible = '';
if ($count_options <= 2 && $options['copy'] == 0) {
$invisible = 'invisible';
}
$output .= '<a id="copy-widget-'.$cellData['id'].'" class="'.$invisible.'" >';
$output .= html_print_image( $output .= html_print_image(
'images/copy.svg', 'images/copy.svg',
true, true,