Merge branch 'ent-12036-error-en-el-nombre-de-la-copia-de-un-dashboard-cualquiera' into 'develop'
Ent 12036 error en el nombre de la copia de un dashboard cualquiera See merge request artica/pandorafms!6457
This commit is contained in:
commit
3b2c5237d1
|
@ -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({
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,8 @@ if ($redraw === false) {
|
|||
|
||||
$output .= '<div class="header-widget">';
|
||||
$output .= '<div>';
|
||||
|
||||
if ((int) $cellData['id_widget'] !== 0) {
|
||||
$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 .= '</div>';
|
||||
$output .= '<div class="header-options">';
|
||||
|
||||
if ($manageDashboards !== 0 || $writeDashboards !== 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(
|
||||
'images/copy.svg',
|
||||
true,
|
||||
|
|
Loading…
Reference in New Issue