CloneObject: use modern loading
This commit is contained in:
parent
649fff7486
commit
b675d37b6f
|
@ -3,19 +3,20 @@
|
|||
namespace Icinga\Module\Director\Forms;
|
||||
|
||||
use Icinga\Module\Director\Objects\IcingaObject;
|
||||
use Icinga\Module\Director\Web\Form\QuickForm;
|
||||
use Icinga\Module\Director\Web\Form\DirectorForm;
|
||||
|
||||
class IcingaCloneObjectForm extends QuickForm
|
||||
class IcingaCloneObjectForm extends DirectorForm
|
||||
{
|
||||
/** @var IcingaObject */
|
||||
protected $object;
|
||||
|
||||
public function setup()
|
||||
{
|
||||
$name = $this->object->getObjectName();
|
||||
$this->addElement('text', 'new_object_name', array(
|
||||
'label' => $this->translate('New name'),
|
||||
'required' => true,
|
||||
'value' => $this->object->getObjectName(),
|
||||
'value' => $name,
|
||||
));
|
||||
|
||||
$this->addElement('select', 'clone_type', array(
|
||||
|
@ -29,7 +30,7 @@ class IcingaCloneObjectForm extends QuickForm
|
|||
|
||||
$this->submitLabel = sprintf(
|
||||
$this->translate('Clone "%s"'),
|
||||
$this->object->getObjectName()
|
||||
$name
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Director\Deployment\DeploymentInfo;
|
|||
use Icinga\Module\Director\Exception\DuplicateKeyException;
|
||||
use Icinga\Module\Director\Exception\NestingError;
|
||||
use Icinga\Module\Director\Forms\DeploymentLinkForm;
|
||||
use Icinga\Module\Director\Forms\IcingaCloneObjectForm;
|
||||
use Icinga\Module\Director\Forms\IcingaObjectFieldForm;
|
||||
use Icinga\Module\Director\Objects\IcingaObject;
|
||||
use Icinga\Module\Director\Objects\IcingaObjectGroup;
|
||||
|
@ -234,14 +235,15 @@ abstract class ObjectController extends ActionController
|
|||
$this->assertPermission('director/' . $ltype);
|
||||
$this->tabs()->activate('modify');
|
||||
$this->addTitle($this->translate('Clone Icinga %s'), ucfirst($type));
|
||||
$form = $this->loadForm('icingaCloneObject')->setObject($this->object);
|
||||
$form->handleRequest();
|
||||
$form = IcingaCloneObjectForm::load()
|
||||
->setObject($this->object)
|
||||
->handleRequest();
|
||||
$this->content()->add($form);
|
||||
$this->actions()->add(Link::create(
|
||||
$this->translate('back'),
|
||||
'director/' . $ltype,
|
||||
array('name' => $this->object->object_name),
|
||||
array('class' => 'icon-left-big')
|
||||
['name' => $this->object->getObjectName()],
|
||||
['class' => 'icon-left-big']
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue