2015-07-23 16:40:32 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
use Icinga\Web\Hook;
|
|
|
|
|
|
|
|
class SyncRuleForm extends DirectorObjectForm
|
|
|
|
{
|
|
|
|
public function setup()
|
|
|
|
{
|
|
|
|
$this->addElement('text', 'rule_name', array(
|
|
|
|
'label' => $this->translate('Rule name'),
|
2015-07-24 09:51:31 +02:00
|
|
|
'description' => $this->translate('Please provide a rule name'),
|
2015-07-23 16:40:32 +02:00
|
|
|
'required' => true,
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->addElement('select', 'object_type', array(
|
2015-07-23 20:51:29 +02:00
|
|
|
'label' => $this->translate('Object Type'),
|
2015-07-24 09:51:31 +02:00
|
|
|
'description' => $this->translate('Choose a object type'),
|
2015-07-23 16:40:32 +02:00
|
|
|
'required' => true,
|
|
|
|
'multiOptions' => array(
|
|
|
|
'null' => '- please choose -',
|
|
|
|
'host' => 'host',
|
|
|
|
'user' => 'user'
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->addElement('select', 'update_policy', array(
|
2015-07-23 20:00:31 +02:00
|
|
|
'label' => $this->translate('Update Policity'),
|
|
|
|
'description' => $this->translate('Whether the field should be merged, overriden or ignored'),
|
2015-07-23 16:40:32 +02:00
|
|
|
'required' => true,
|
|
|
|
'multiOptions' => array(
|
|
|
|
'null' => '- please choose -',
|
|
|
|
'merge' => 'merge',
|
|
|
|
'override' => 'override',
|
|
|
|
'ignore' => 'ignore'
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
2015-07-23 20:00:31 +02:00
|
|
|
$this->addElement('select', 'purge_existing', array(
|
|
|
|
'label' => $this->translate('Purge'),
|
|
|
|
'description' => $this->translate('Purge existing values.'),
|
2015-07-23 16:40:32 +02:00
|
|
|
'required' => true,
|
|
|
|
'multiOptions' => array(
|
|
|
|
'null' => '- please choose -',
|
|
|
|
'y' => 'yes',
|
|
|
|
'n' => 'no'
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
2015-07-23 20:00:31 +02:00
|
|
|
$this->addElement('text', 'filter_expression', array(
|
2015-07-23 16:40:32 +02:00
|
|
|
'label' => $this->translate('Filter Expression'),
|
2015-07-23 20:00:31 +02:00
|
|
|
'description' => $this->translate('This allows to filter for specific parts.'),
|
2015-07-23 16:40:32 +02:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loadObject($id)
|
|
|
|
{
|
|
|
|
parent::loadObject($id);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function onSuccess()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
$this->getElement('owner')->setValue(
|
|
|
|
self::username()
|
|
|
|
);
|
|
|
|
*/
|
|
|
|
parent::onSuccess();
|
|
|
|
}
|
|
|
|
}
|