diff --git a/library/Businessprocess/ImportedNode.php b/library/Businessprocess/ImportedNode.php index cf40346..3f0b460 100644 --- a/library/Businessprocess/ImportedNode.php +++ b/library/Businessprocess/ImportedNode.php @@ -53,6 +53,11 @@ class ImportedNode extends BpNode return $this->nodeName; } + public function getIdentifier() + { + return $this->getName(); + } + public function getBpConfig() { if ($this->bp === null) { diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index 11cd69e..f796d77 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -343,18 +343,18 @@ abstract class Node */ public function getPaths() { - if ($this->getBpConfig()->hasRootNode($this->getName())) { - return array(array($this->getName())); - } - - $paths = array(); + $paths = []; foreach ($this->parents as $parent) { foreach ($parent->getPaths() as $path) { - $path[] = $this->getName(); + $path[] = $this->getIdentifier(); $paths[] = $path; } } + if (! $this instanceof ImportedNode && $this->getBpConfig()->hasRootNode($this->getName())) { + $paths[] = [$this->getIdentifier()]; + } + return $paths; } @@ -408,6 +408,16 @@ abstract class Node return $this->name; } + public function getIdentifier() + { + $prefix = ''; + if ($this->getBpConfig()->isImported()) { + $prefix = '@' . $this->getBpConfig()->getName() . ':'; + } + + return $prefix . $this->getName(); + } + public function __toString() { return $this->getName(); diff --git a/library/Businessprocess/Renderer/Renderer.php b/library/Businessprocess/Renderer/Renderer.php index 08898e4..431272e 100644 --- a/library/Businessprocess/Renderer/Renderer.php +++ b/library/Businessprocess/Renderer/Renderer.php @@ -194,7 +194,7 @@ abstract class Renderer extends HtmlDocument } /** - * @return string|null + * @return array */ public function getPath() { @@ -205,7 +205,7 @@ abstract class Renderer extends HtmlDocument { $path = $this->getPath(); if ($this->rendersSubNode()) { - $path[] = (string) $this->parent; + $path[] = $this->parent->getIdentifier(); } return $path; } diff --git a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php index 9535da2..18dc7c4 100644 --- a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php +++ b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php @@ -117,21 +117,12 @@ class NodeTile extends BaseHtmlElement protected function buildBaseNodeUrl(Node $node) { - $path = $this->path; - $renderer = $this->renderer; + $url = $this->renderer->getBaseUrl(); - $params = [ - 'config' => $node->getBpConfig()->getName(), - 'node' => $node instanceof ImportedNode - ? $node->getNodeName() - : $this->name - ]; - - $url = $renderer->getBaseUrl(); $p = $url->getParams(); - $p->mergeValues($params); - if (! empty($path) && !$node instanceof ImportedNode) { - $p->addValues('path', $path); + $p->set('node', $node->getIdentifier()); + if (! empty($this->path)) { + $p->addValues('path', $this->path); } return $url; @@ -142,31 +133,6 @@ class NodeTile extends BaseHtmlElement return $this->buildBaseNodeUrl($node); } - protected function makeMonitoredNodeUrl(MonitoredNode $node) - { - $path = $this->path; - $name = $this->name; // TODO: ?? - $renderer = $this->renderer; - - $bp = $renderer->getBusinessProcess(); - $params = array( - 'config' => $bp->getName() - ); - - if ($name !== null) { - $params['node'] = $node->getName(); - } - - $url = $renderer->getBaseUrl(); - $p = $url->getParams(); - $p->mergeValues($params); - if (! empty($path)) { - $p->addValues('path', $path); - } - - return $url; - } - /** * @return BaseHtmlElement */ @@ -180,11 +146,7 @@ class NodeTile extends BaseHtmlElement $link = Html::tag('a', ['href' => $url, 'data-base-target' => '_next'], $node->getHostname()); } else { $link = Html::tag('a', ['href' => $url], $node->getAlias()); - if ($node->getBpConfig()->getName() !== $this->renderer->getBusinessProcess()->getName()) { - $link->getAttributes()->add('data-base-target', '_next'); - } else { - $link->getAttributes()->add('data-base-target', '_self'); - } + $link->getAttributes()->add('data-base-target', '_self'); } return $link; diff --git a/library/Businessprocess/Renderer/TreeRenderer.php b/library/Businessprocess/Renderer/TreeRenderer.php index 5dce546..ca82b54 100644 --- a/library/Businessprocess/Renderer/TreeRenderer.php +++ b/library/Businessprocess/Renderer/TreeRenderer.php @@ -198,7 +198,7 @@ class TreeRenderer extends Renderer ]); $li->add($ul); - $path[] = (string) $node; + $path[] = $node->getIdentifier(); foreach ($node->getChildren() as $name => $child) { if ($child instanceof BpNode) { $ul->add($this->renderNode($bp, $child, $path));