2014-10-09 10:20:07 +02:00
|
|
|
<?php
|
2014-11-18 09:45:54 +01:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2014-10-09 10:20:07 +02:00
|
|
|
|
2014-11-14 10:57:14 +01:00
|
|
|
namespace Icinga\Forms;
|
2014-10-09 10:20:07 +02:00
|
|
|
|
|
|
|
use Icinga\Web\Form;
|
|
|
|
|
|
|
|
class LdapDiscoveryForm extends Form
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Initialize this page
|
|
|
|
*/
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->setName('form_ldap_discovery');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see Form::createElements()
|
|
|
|
*/
|
|
|
|
public function createElements(array $formData)
|
|
|
|
{
|
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'domain',
|
|
|
|
array(
|
|
|
|
'required' => true,
|
|
|
|
'label' => t('Search Domain'),
|
|
|
|
'description' => t('Search this domain for records of available servers.'),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (false) {
|
|
|
|
$this->addElement(
|
2014-11-14 10:15:11 +01:00
|
|
|
'note',
|
|
|
|
'additional_description',
|
|
|
|
array(
|
|
|
|
'value' => t('No Ldap servers found on this domain.'
|
|
|
|
. ' You can try to specify host and port and try again, or just skip this step and '
|
|
|
|
. 'configure the server manually.'
|
2014-10-09 10:20:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'hostname',
|
|
|
|
array(
|
|
|
|
'required' => false,
|
|
|
|
'label' => t('Host'),
|
|
|
|
'description' => t('IP or host name to search.'),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
$this->addElement(
|
|
|
|
'text',
|
|
|
|
'port',
|
|
|
|
array(
|
|
|
|
'required' => false,
|
|
|
|
'label' => t('Port'),
|
|
|
|
'description' => t('Port', 389),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isValid($data)
|
|
|
|
{
|
|
|
|
if (false === parent::isValid($data)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2014-11-18 13:21:18 +01:00
|
|
|
}
|