From 3ffbce070996b3f745cc6976fdb0bdc17bd7e9f6 Mon Sep 17 00:00:00 2001 From: mdkamijo <56912475+mdkamijo@users.noreply.github.com> Date: Wed, 26 Feb 2020 14:53:34 +0100 Subject: [PATCH] Make it possible to delete imported nodes (#248) It is possible to import process nodes from other processes. But there are no way, via the GUI, to remove the imported process nodes from the current process/process node. This commit makes it possible to remove imported process nodes, no matter where which process they comes from. --- .../Renderer/TileRenderer/NodeTile.php | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php index 1ba16f4..e4f378f 100644 --- a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php +++ b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php @@ -286,52 +286,52 @@ class NodeTile extends BaseHtmlElement )); } - if (! $this->renderer->getBusinessProcess()->getMetadata()->canModify() - || $this->node->getBpConfig()->getName() !== $this->renderer->getBusinessProcess()->getName() - || $this->node->getName() === '__unbound__' + if ($this->renderer->getBusinessProcess()->getMetadata()->canModify() + && $this->node->getBpConfig()->getName() === $this->renderer->getBusinessProcess()->getName() + && $this->node->getName() !== '__unbound__' ) { - return; + if ($this->node instanceof BpNode) { + $this->actions()->add(Html::tag( + 'a', + [ + 'href' => $baseUrl + ->with('action', 'edit') + ->with('editnode', $this->node->getName()), + 'title' => mt('businessprocess', 'Modify this business process node') + ], + Html::tag('i', ['class' => 'icon icon-edit']) + )); + + $addUrl = $baseUrl->with([ + 'node' => $this->node->getName(), + 'action' => 'add' + ]); + $addUrl->getParams()->addValues('path', $this->path); + $this->actions()->add(Html::tag( + 'a', + [ + 'href' => $addUrl, + 'title' => mt('businessprocess', 'Add a new sub-node to this business process') + ], + Html::tag('i', ['class' => 'icon icon-plus']) + )); + } } - if ($this->node instanceof BpNode) { + if ($this->renderer->getBusinessProcess()->getMetadata()->canModify()) { + $params = array( + 'action' => 'delete', + 'deletenode' => $this->node->getName(), + ); + $this->actions()->add(Html::tag( 'a', [ - 'href' => $baseUrl - ->with('action', 'edit') - ->with('editnode', $this->node->getName()), - 'title' => mt('businessprocess', 'Modify this business process node') + 'href' => $baseUrl->with($params), + 'title' => mt('businessprocess', 'Delete this node') ], - Html::tag('i', ['class' => 'icon icon-edit']) - )); - - $addUrl = $baseUrl->with([ - 'node' => $this->node->getName(), - 'action' => 'add' - ]); - $addUrl->getParams()->addValues('path', $this->path); - $this->actions()->add(Html::tag( - 'a', - [ - 'href' => $addUrl, - 'title' => mt('businessprocess', 'Add a new sub-node to this business process') - ], - Html::tag('i', ['class' => 'icon icon-plus']) + Html::tag('i', ['class' => 'icon icon-cancel']) )); } - - $params = array( - 'action' => 'delete', - 'deletenode' => $this->node->getName(), - ); - - $this->actions()->add(Html::tag( - 'a', - [ - 'href' => $baseUrl->with($params), - 'title' => mt('businessprocess', 'Delete this node') - ], - Html::tag('i', ['class' => 'icon icon-cancel']) - )); } }