Fix that LDAP discovery suggestions are not populated

I've broke this when re-commiting the changes made by Matthias and fixed
this by populating dependent pages directly in WebSetup::setupPage.

refs #7163
This commit is contained in:
Johannes Meyer 2014-10-09 10:47:45 +02:00
parent e29a568bff
commit 169a646a1a
3 changed files with 3 additions and 51 deletions

View File

@ -23,13 +23,6 @@ class AuthBackendPage extends Form
*/
protected $config;
/**
* Suggested configuration settings
*
* @var array
*/
protected $suggestions;
/**
* Initialize this page
*/
@ -61,19 +54,6 @@ class AuthBackendPage extends Form
return new Zend_Config($this->config);
}
/**
* Set suggested configuration settings
*
* @param array $suggestions
*
* @return self
*/
public function setSuggestions(array $suggestions)
{
$this->suggestions = $suggestions;
return $this;
}
/**
* @see Form::createElements()
*/
@ -105,10 +85,6 @@ class AuthBackendPage extends Form
$backendForm = new DbBackendForm();
$backendForm->createElements($formData)->removeElement('resource');
} elseif ($this->config['type'] === 'ldap') {
if ($this->suggestions !== null) {
$formData += $this->suggestions;
}
$backendForm = new LdapBackendForm();
$backendForm->createElements($formData)->removeElement('resource');
} else { // $this->config['type'] === 'autologin'

View File

@ -13,13 +13,6 @@ use Icinga\Form\Config\Resource\LdapResourceForm;
*/
class LdapResourcePage extends Form
{
/**
* Suggested configuration settings
*
* @var array
*/
protected $suggestions;
/**
* Initialize this page
*/
@ -28,19 +21,6 @@ class LdapResourcePage extends Form
$this->setName('setup_ldap_resource');
}
/**
* Set suggested configuration settings
*
* @param array $suggestions
*
* @return self
*/
public function setSuggestions(array $suggestions)
{
$this->suggestions = $suggestions;
return $this;
}
/**
* @see Form::createElements()
*/
@ -79,10 +59,6 @@ class LdapResourcePage extends Form
);
}
if ($this->suggestions !== null) {
$formData += $this->suggestions;
}
$resourceForm = new LdapResourceForm();
$this->addElements($resourceForm->createElements($formData)->getElements());
}

View File

@ -89,7 +89,7 @@ class WebSetup extends Wizard implements SetupWizard
$suggestions = $this->getPageData('setup_ldap_discovery_confirm');
if (isset($suggestions['backend'])) {
$page->setSuggestions($suggestions['backend']);
$page->populate($suggestions['backend']);
}
}
} else if ($page->getName() === 'setup_ldap_discovery_confirm') {
@ -120,11 +120,11 @@ class WebSetup extends Wizard implements SetupWizard
t('The given resource name must be unique and is already in use by the database resource')
);
}
$suggestion = $this->getPageData('setup_ldap_discovery_confirm');
if (isset($suggestion['resource'])) {
$page->setSuggestions($suggestion['resource']);
$page->populate($suggestion['resource']);
}
} elseif ($page->getName() === 'setup_authentication_type') {
$authData = $this->getPageData($page->getName());
if ($authData !== null && $request->getPost('type') !== $authData['type']) {