ImportsourceController: fix redirect after delete
This commit is contained in:
parent
177982fba3
commit
97e52b231d
|
@ -84,15 +84,14 @@ class ImportsourceController extends ActionController
|
|||
{
|
||||
$id = $this->params->get('id');
|
||||
|
||||
$form = $this->view->form = $this->loadForm('importSource')
|
||||
->setSuccessUrl('director/list/importsource')
|
||||
->setDb($this->db());
|
||||
$form = $this->view->form = $this->loadForm('importSource')->setDb($this->db());
|
||||
|
||||
if ($id) {
|
||||
$form->loadObject($id);
|
||||
$form->loadObject($id)->setListUrl('director/list/importsource');
|
||||
$this->prepareTabs($id)->activate('edit');
|
||||
$this->view->title = $this->translate('Edit import source');
|
||||
} else {
|
||||
$form->setSuccessUrl('director/list/importsource');
|
||||
$this->view->title = $this->translate('Add import source');
|
||||
$this->prepareTabs()->activate('add');
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
|
||||
protected $resolvedImports = false;
|
||||
|
||||
protected $listUrl;
|
||||
|
||||
private $allowsExperimental;
|
||||
|
||||
private $api;
|
||||
|
@ -625,6 +627,12 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
}
|
||||
}
|
||||
|
||||
public function setListUrl($url)
|
||||
{
|
||||
$this->listUrl = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
{
|
||||
$object = $this->object();
|
||||
|
@ -854,7 +862,9 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
);
|
||||
}
|
||||
|
||||
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
|
||||
if ($this->listUrl) {
|
||||
$url = $this->listUrl;
|
||||
} elseif ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
|
||||
$url = $object->getOnDeleteUrl();
|
||||
} else {
|
||||
$url = $this->getSuccessUrl()->without(
|
||||
|
|
Loading…
Reference in New Issue