ObjectController: combine preview & external info

This commit is contained in:
Thomas Gelf 2016-03-21 21:24:22 +01:00
parent 417caf22ea
commit c36093d350
2 changed files with 4 additions and 34 deletions

View File

@ -1,17 +0,0 @@
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
<span>
<?= $this->actionLinks ?>
</span>
</div>
<div class="content">
<p><?= $this->translate(
'This is an external object. It has been imported from Icinga 2 throught the'
. ' Core API and cannot be managed with the Icinga Director. It is however'
. ' perfectly valid to create objects using this or referring to this object.'
. ' You might also want to define related Fields to make work based on this'
. ' object more enjoyable'
) ?></p>
</div>

View File

@ -26,11 +26,7 @@ abstract class ObjectController extends ActionController
$params = $object->getUrlParams();
if ($object->isExternal()) {
$tabs = $this->getTabs()->add('modify', array(
'url' => sprintf('director/%s', $type),
'urlParams' => $params,
'label' => $this->translate(ucfirst($type))
));
$tabs = $this->getTabs();
} else {
$tabs = $this->getTabs()->add('modify', array(
'url' => sprintf('director/%s', $type),
@ -91,7 +87,9 @@ abstract class ObjectController extends ActionController
&& $this->object->isExternal()
&& ! in_array($this->object->getShortTableName(), $allowedExternals)
) {
return $this->externalObjectInfo();
$this->redirectNow(
$this->getRequest()->getUrl()->setPath(sprintf('director/%s/render', $this->getType()))
);
}
return $this->editAction();
@ -283,17 +281,6 @@ abstract class ObjectController extends ActionController
);
}
protected function externalObjectInfo()
{
$this->view->title = sprintf(
$this->translate('External object: %s'),
$this->object->object_name
);
$this->getTabs()->activate('modify');
$this->render('object/externalinfo', null, true);
}
protected function loadObject()
{
if ($this->object === null) {