From 70618169f17b14addd208ebd74ace52ff1a2cd26 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 12 Apr 2019 11:58:09 +0200 Subject: [PATCH] ObjectsTabs: fix tabs for Choices --- application/controllers/TemplatechoicesController.php | 2 +- library/Director/Web/Tabs/ObjectsTabs.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/application/controllers/TemplatechoicesController.php b/application/controllers/TemplatechoicesController.php index 30831908..753591aa 100644 --- a/application/controllers/TemplatechoicesController.php +++ b/application/controllers/TemplatechoicesController.php @@ -31,7 +31,7 @@ class TemplatechoicesController extends ActionController protected function prepare($type, $title) { - $this->tabs(new ObjectsTabs($type, $this->Auth()))->activate('choices'); + $this->tabs(new ObjectsTabs($type, $this->Auth(), $type))->activate('choices'); $this->setAutorefreshInterval(10)->addTitle($title); $this->actions(new ChoicesActionBar($type, $this->url())); ChoicesTable::create($type, $this->db())->renderTo($this); diff --git a/library/Director/Web/Tabs/ObjectsTabs.php b/library/Director/Web/Tabs/ObjectsTabs.php index 017d042d..0a309642 100644 --- a/library/Director/Web/Tabs/ObjectsTabs.php +++ b/library/Director/Web/Tabs/ObjectsTabs.php @@ -17,8 +17,9 @@ class ObjectsTabs extends Tabs if ($object->isGroup()) { $object = IcingaObject::createByType(substr($typeUrl, 0, -5)); } + $shortName = $object->getShortTableName(); - $plType = strtolower(preg_replace('/cys$/', 'cies', $typeUrl . 's')); + $plType = strtolower(preg_replace('/cys$/', 'cies', $shortName . 's')); if ($auth->hasPermission("director/${plType}")) { $this->add('index', array( 'url' => sprintf('director/%s', $plType), @@ -65,7 +66,7 @@ class ObjectsTabs extends Tabs if ($auth->hasPermission('director/admin')) { if ($object->supportsChoices()) { $this->add('choices', array( - 'url' => sprintf('director/templatechoices/%s', $typeUrl), + 'url' => sprintf('director/templatechoices/%s', $shortName), 'label' => $this->translate('Choices') )); }