Skip to content

Commit

Permalink
Fix for #2606 and saving new items on blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Aug 15, 2024
1 parent e987a99 commit 6764016
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 34 deletions.
4 changes: 2 additions & 2 deletions app/Domain/Canvas/Controllers/BoardDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function run()
$currentCanvasId = (int)$_GET['id'];
$singleCanvas = $this->canvasRepo->getSingleCanvas($currentCanvasId);
$canvasTitle = $singleCanvas[0]["title"] ?? "";
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

// Add Canvas
Expand Down Expand Up @@ -94,7 +94,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_created'), 'success', static::CANVAS_NAME . "board_created");

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/'.static::CANVAS_NAME.'canvas/boardDialog/'.$currentCanvasId);
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Canvas/Controllers/DelCanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function run()
$this->canvasRepo->deleteCanvas($id);

$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $allCanvas[0]['id'] ?? -1]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $allCanvas[0]['id'] ?? -1]);

$this->tpl->setNotification($this->language->__('notification.board_deleted'), 'success', strtoupper(static::CANVAS_NAME) . 'canvas_deleted');

Expand Down
1 change: 1 addition & 0 deletions app/Domain/Canvas/Controllers/EditCanvasItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public function post($params)
{

if (isset($params['changeItem'])) {

if (isset($params['itemId']) && !empty($params['itemId'])) {
if (isset($params['description']) && !empty($params['description'])) {
$currentCanvasId = (int)session("current" . strtoupper(static::CANVAS_NAME) . "Canvas");
Expand Down
16 changes: 8 additions & 8 deletions app/Domain/Canvas/Controllers/ShowCanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,26 @@ public function run()

if (!$found) {
$currentCanvasId = -1;
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => '']);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => '']);
}
} else {
$currentCanvasId = -1;
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => '']);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => '']);
}

if (count($allCanvas) > 0 && session("current" . strtoupper(static::CANVAS_NAME) . "Canvas") == '') {
$currentCanvasId = $allCanvas[0]['id'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

if (isset($_GET['id']) === true) {
$currentCanvasId = (int)$_GET['id'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

if (isset($_REQUEST['searchCanvas']) === true) {
$currentCanvasId = (int)$_REQUEST['searchCanvas'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_created'), 'success', static::CANVAS_NAME . "board_created");

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down Expand Up @@ -174,7 +174,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_copied'), 'success');

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down Expand Up @@ -219,7 +219,7 @@ public function run()
if ($importCanvasId !== false) {
$currentCanvasId = $importCanvasId;
$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);

$mailer = app()->make(MailerCore::class);
$this->projectService = app()->make(ProjectService::class);
Expand Down
4 changes: 4 additions & 0 deletions app/Domain/Canvas/Templates/showCanvasBottom.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
new SlimSelect({ select: '#searchCanvas' });
}

<?php if (isset($_GET['closeModal'])) { ?>
jQuery.nmTop().close();
<?php } ?>

leantime.<?=$canvasName ?>CanvasController.setRowHeights();
leantime.canvasController.setCanvasName('<?=$canvasName ?>');
leantime.canvasController.initFilterBar();
Expand Down
16 changes: 8 additions & 8 deletions app/Domain/Goalcanvas/Controllers/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,26 @@ public function run()

if (!$found) {
$currentCanvasId = -1;
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => '']);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => '']);
}
} else {
$currentCanvasId = -1;
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => '']);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => '']);
}

if (count($allCanvas) > 0 && session("current" . strtoupper(static::CANVAS_NAME) . "Canvas") == '') {
$currentCanvasId = $allCanvas[0]['id'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

if (isset($_GET['id']) === true) {
$currentCanvasId = (int)$_GET['id'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

if (isset($_REQUEST['searchCanvas']) === true) {
$currentCanvasId = (int)$_REQUEST['searchCanvas'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
}

Expand Down Expand Up @@ -182,7 +182,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_created'), 'success');

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down Expand Up @@ -223,7 +223,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_copied'), 'success');

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down Expand Up @@ -268,7 +268,7 @@ public function run()
if ($importCanvasId !== false) {
$currentCanvasId = $importCanvasId;
$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);

$mailer = app()->make(Mailer::class);
$this->projectService = app()->make(Projects::class);
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Goalcanvas/Controllers/DelCanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function run()
$this->canvasRepo->deleteCanvas($id);

$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $allCanvas[0]['id'] ?? -1]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $allCanvas[0]['id'] ?? -1]);

$this->tpl->setNotification($this->language->__('notification.board_deleted'), 'success', strtoupper(static::CANVAS_NAME) . 'canvas_deleted');

Expand Down
16 changes: 8 additions & 8 deletions app/Domain/Goalcanvas/Controllers/ShowCanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,26 @@ public function run()

if (!$found) {
$currentCanvasId = -1;
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => '']);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => '']);
}
} else {
$currentCanvasId = -1;
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => '']);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => '']);
}

if (count($allCanvas) > 0 && session("current" . strtoupper(static::CANVAS_NAME) . "Canvas") == '') {
$currentCanvasId = $allCanvas[0]['id'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

if (isset($_GET['id']) === true) {
$currentCanvasId = (int)$_GET['id'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

if (isset($_REQUEST['searchCanvas']) === true) {
$currentCanvasId = (int)$_REQUEST['searchCanvas'];
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
}

Expand Down Expand Up @@ -134,7 +134,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_created'), 'success');

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down Expand Up @@ -175,7 +175,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_copied'), 'success');

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/' . static::CANVAS_NAME . 'canvas/showCanvas/');
} else {
$this->tpl->setNotification($this->language->__('notification.board_exists'), 'error');
Expand Down Expand Up @@ -220,7 +220,7 @@ public function run()
if ($importCanvasId !== false) {
$currentCanvasId = $importCanvasId;
$allCanvas = $this->canvasRepo->getAllCanvas(session("currentProject"));
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);

$mailer = app()->make(Mailer::class);
$users = $this->projectService->getUsersToNotify(session("currentProject"));
Expand Down
4 changes: 2 additions & 2 deletions app/Domain/Ideas/Controllers/BoardDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function run()
$currentCanvasId = (int)$_GET['id'];
$singleCanvas = $this->canvasRepo->getSingleCanvas($currentCanvasId);
$canvasTitle = $singleCanvas[0]["title"] ?? "";
session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
}

// Add Canvas
Expand Down Expand Up @@ -94,7 +94,7 @@ public function run()

$this->tpl->setNotification($this->language->__('notification.board_created'), 'success', static::CANVAS_NAME . "board_created");

session(["current' . strtoupper(static::CANVAS_NAME) . 'Canvas" => $currentCanvasId]);
session(['current' . strtoupper(static::CANVAS_NAME) . 'Canvas' => $currentCanvasId]);
return Frontcontroller::redirect(BASE_URL . '/ideas/boardDialog/'.$currentCanvasId);

} else {
Expand Down
6 changes: 4 additions & 2 deletions app/Domain/Valuecanvas/Templates/canvasDialog.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<hr style="margin-top: 5px; margin-bottom: 15px;">
<?php echo $tpl->displayNotification(); ?>

<form class="<?=$canvasName ?>CanvasModal" method="post" action="<?=BASE_URL ?>/<?=$canvasName ?>canvas/editCanvasItem/<?php echo $id;?>">
<form class="formModal" method="post" action="<?=BASE_URL ?>/<?=$canvasName ?>canvas/editCanvasItem/<?php echo $id;?>">

<input type="hidden" value="<?php echo $tpl->get('currentCanvas'); ?>" name="canvasId" />
<input type="hidden" value="<?php $tpl->e($canvasItem['box']) ?>" name="box" id="box"/>
Expand Down Expand Up @@ -126,7 +126,9 @@

<?php if ($login::userIsAtLeast($roles::$editor)) { ?>
<input type="submit" value="<?=$tpl->__("buttons.save") ?>" id="primaryCanvasSubmitButton"/>
<input type="submit" value="<?=$tpl->__("buttons.save_and_close") ?>" id="saveAndClose" onclick="leantime.<?=$canvasName ?>CanvasController.setCloseModal();"/>
<button type="submit" class="btn btn-default" value="closeModal" id="saveAndClose" onclick="leantime.<?=$canvasName ?>CanvasController.setCloseModal();"><?=$tpl->__("buttons.save_and_close") ?></button>


<?php } ?>

<?php if ($id !== '') { ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ jQuery(function($, undefined) {
data: data,
type: nm.opener.attr('method') ? nm.opener.attr('method') : 'get',
success: function(data) {
console.log(action);

if(action == "closeModal") {
nm.close();
}else{
Expand All @@ -1465,7 +1465,7 @@ jQuery(function($, undefined) {

},
error: function(content) {
console.log(content);

nm._setCont(content.responseText);
}
});
Expand Down

0 comments on commit 6764016

Please sign in to comment.