DirectorObjectForm: redirect figured out by form

refs #11251
This commit is contained in:
Thomas Gelf 2016-02-28 17:11:11 +01:00
parent 0f1e0c182f
commit f818cb3eb6
2 changed files with 6 additions and 12 deletions

View File

@ -122,12 +122,6 @@ abstract class ObjectController extends ActionController
$this->view->form = $form = $this->loadForm($formName)->setDb($this->db());
$form->setObject($object);
$url = Url::fromPath(
sprintf('director/%s', $type),
array('name' => $object->object_name)
);
$form->setSuccessUrl($url);
$this->view->title = sprintf($this->translate('Modify %s'), ucfirst($ltype));
$this->view->form->handleRequest();

View File

@ -507,12 +507,6 @@ abstract class DirectorObjectForm extends QuickForm
if (! $object->hasBeenLoadedFromDb()) {
$this->setHttpResponseCode(201);
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
$this->setSuccessUrl(
'director/' . strtolower($this->getObjectName()),
array('name' => $object->object_name)
);
}
}
$msg = sprintf(
$object->hasBeenLoadedFromDb()
@ -527,6 +521,12 @@ abstract class DirectorObjectForm extends QuickForm
}
$msg = $this->translate('No action taken, object has not been modified');
}
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
$this->setSuccessUrl(
'director/' . strtolower($this->getObjectName()),
array('name' => $object->object_name)
);
}
$this->redirectOnSuccess($msg);
}