DirectorObjectForm: handle data from/for assigns

This commit is contained in:
Thomas Gelf 2016-03-24 11:42:58 +01:00
parent 98a5be4e68
commit ec97306e66

View File

@ -761,14 +761,24 @@ abstract class DirectorObjectForm extends QuickForm
} }
$post = $this->getRequest()->getPost(); $post = $this->getRequest()->getPost();
// ?? $this->populate($post);
if (array_key_exists('assignlist', $post)) {
$object->assignments()->setFormValues($post['assignlist']);
}
foreach ($post as $key => $value) { foreach ($post as $key => $value) {
$el = $this->getElement($key); $el = $this->getElement($key);
if ($el && ! $el->getIgnore()) { if ($el && ! $el->getIgnore()) {
$values[$key] = $value; $values[$key] = $value;
} }
} }
} }
if ($object instanceof IcingaObject) { if ($object instanceof IcingaObject) {
if ($object->isApplyRule()) {
$this->setElementValue('assignlist', $object->assignments()->getFormValues());
}
$this->handleProperties($object, $values); $this->handleProperties($object, $values);
$this->handleCustomVars($object, $post); $this->handleCustomVars($object, $post);
$this->handleRanges($object, $values); $this->handleRanges($object, $values);
@ -1037,7 +1047,7 @@ abstract class DirectorObjectForm extends QuickForm
'description' => $this->translate( 'description' => $this->translate(
'Icinga cluster zone. Allows to manually override Directors decisions' 'Icinga cluster zone. Allows to manually override Directors decisions'
. ' of where to deploy your config to. You should consider not doing so' . ' of where to deploy your config to. You should consider not doing so'
. ' unless you gained enough knowledge of you an Icinga Cluster stack' . ' unless you gained deep understanding of how an Icinga Cluster stack'
. ' works' . ' works'
), ),
'multiOptions' => $this->optionalEnum($zones) 'multiOptions' => $this->optionalEnum($zones)