Leave it up to Icinga\Web\Form to instantiate our own form elements

This commit is contained in:
Johannes Meyer 2014-11-14 10:15:11 +01:00
parent 872dce2208
commit 1c4a5ce86f
29 changed files with 342 additions and 411 deletions

View File

@ -8,7 +8,6 @@ use Exception;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Request; use Icinga\Web\Request;
use Icinga\Web\Form\Element\Number;
use Icinga\Data\ResourceFactory; use Icinga\Data\ResourceFactory;
use Icinga\Application\Platform; use Icinga\Application\Platform;
@ -68,14 +67,13 @@ class DbResourceForm extends Form
) )
); );
$this->addElement( $this->addElement(
new Number( 'number',
array( 'port',
'required' => true, array(
'name' => 'port', 'required' => true,
'label' => t('Port'), 'label' => t('Port'),
'description' => t('The port to use'), 'description' => t('The port to use'),
'value' => 3306 'value' => 3306
)
) )
); );
$this->addElement( $this->addElement(

View File

@ -8,7 +8,6 @@ use Exception;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Request; use Icinga\Web\Request;
use Icinga\Web\Form\Element\Number;
use Icinga\Data\ResourceFactory; use Icinga\Data\ResourceFactory;
/** /**
@ -49,14 +48,13 @@ class LdapResourceForm extends Form
) )
); );
$this->addElement( $this->addElement(
new Number( 'number',
array( 'port',
'required' => true, array(
'name' => 'port', 'required' => true,
'label' => t('Port'), 'label' => t('Port'),
'description' => t('The port of the LDAP server to use for authentication'), 'description' => t('The port of the LDAP server to use for authentication'),
'value' => 389 'value' => 389
)
) )
); );
$this->addElement( $this->addElement(

View File

@ -7,7 +7,6 @@ use Icinga\Application\Logger;
use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Protocol\Ldap\Exception as LdapException;
use Icinga\Protocol\Ldap\Connection; use Icinga\Protocol\Ldap\Connection;
use Icinga\Protocol\Dns; use Icinga\Protocol\Dns;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Form; use Icinga\Web\Form;
/** /**
@ -68,13 +67,12 @@ class LdapDiscoveryForm extends Form
if (false) { if (false) {
$this->addElement( $this->addElement(
new Note( 'note',
'additional_description', 'additional_description',
array( array(
'value' => t('No Ldap servers found on this domain.' '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 ' . ' You can try to specify host and port and try again, or just skip this step and '
. 'configure the server manually.' . 'configure the server manually.'
)
) )
) )
); );

View File

@ -4,14 +4,14 @@
namespace Icinga\Web\Form\Element; namespace Icinga\Web\Form\Element;
use Zend_Form_Element;
use Icinga\Web\Request; use Icinga\Web\Request;
use Icinga\Application\Icinga; use Icinga\Application\Icinga;
use Icinga\Web\Form\FormElement;
/** /**
* A button * A button
*/ */
class Button extends Zend_Form_Element class Button extends FormElement
{ {
/** /**
* Use formButton view helper by default * Use formButton view helper by default

View File

@ -4,12 +4,12 @@
namespace Icinga\Web\Form\Element; namespace Icinga\Web\Form\Element;
use Zend_Form_Element; use Icinga\Web\Form\FormElement;
/** /**
* A note * A note
*/ */
class Note extends Zend_Form_Element class Note extends FormElement
{ {
/** /**
* Form view helper to use for rendering * Form view helper to use for rendering

View File

@ -8,7 +8,6 @@ use LogicException;
use InvalidArgumentException; use InvalidArgumentException;
use Icinga\Web\Session\SessionNamespace; use Icinga\Web\Session\SessionNamespace;
use Icinga\Web\Form\Decorator\ElementDoubler; use Icinga\Web\Form\Decorator\ElementDoubler;
use Icinga\Web\Form\Element\Button;
/** /**
* Container and controller for form based wizards * Container and controller for form based wizards
@ -427,60 +426,55 @@ class Wizard
$index = array_search($page, $pages, true); $index = array_search($page, $pages, true);
if ($index === 0) { if ($index === 0) {
$page->addElement( $page->addElement(
new Button( 'button',
static::BTN_NEXT, static::BTN_NEXT,
array( array(
'type' => 'submit', 'type' => 'submit',
'value' => $pages[1]->getName(), 'value' => $pages[1]->getName(),
'label' => t('Next'), 'label' => t('Next'),
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
)
) )
); );
} elseif ($index < count($pages) - 1) { } elseif ($index < count($pages) - 1) {
$page->addElement( $page->addElement(
new Button( 'button',
static::BTN_PREV, static::BTN_PREV,
array( array(
'type' => 'submit', 'type' => 'submit',
'value' => $pages[$index - 1]->getName(), 'value' => $pages[$index - 1]->getName(),
'label' => t('Back'), 'label' => t('Back'),
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
)
) )
); );
$page->addElement( $page->addElement(
new Button( 'button',
static::BTN_NEXT, static::BTN_NEXT,
array( array(
'type' => 'submit', 'type' => 'submit',
'value' => $pages[$index + 1]->getName(), 'value' => $pages[$index + 1]->getName(),
'label' => t('Next'), 'label' => t('Next'),
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
)
) )
); );
} else { } else {
$page->addElement( $page->addElement(
new Button( 'button',
static::BTN_PREV, static::BTN_PREV,
array( array(
'type' => 'submit', 'type' => 'submit',
'value' => $pages[$index - 1]->getName(), 'value' => $pages[$index - 1]->getName(),
'label' => t('Back'), 'label' => t('Back'),
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
)
) )
); );
$page->addElement( $page->addElement(
new Button( 'button',
static::BTN_NEXT, static::BTN_NEXT,
array( array(
'type' => 'submit', 'type' => 'submit',
'value' => $page->getName(), 'value' => $page->getName(),
'label' => t('Finish'), 'label' => t('Finish'),
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
)
) )
); );
} }

View File

@ -8,8 +8,6 @@ use DateTime;
use DateInterval; use DateInterval;
use Icinga\Module\Monitoring\Command\Instance\DisableNotificationsExpireCommand; use Icinga\Module\Monitoring\Command\Instance\DisableNotificationsExpireCommand;
use Icinga\Module\Monitoring\Form\Command\CommandForm; use Icinga\Module\Monitoring\Form\Command\CommandForm;
use Icinga\Web\Form\Element\DateTimePicker;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Request; use Icinga\Web\Request;
@ -34,27 +32,25 @@ class DisableNotificationsExpireCommandForm extends CommandForm
public function createElements(array $formData = array()) public function createElements(array $formData = array())
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'command-info', 'command-info',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'This command is used to disable host and service notifications for a specific time.' 'This command is used to disable host and service notifications for a specific time.'
)
) )
) )
); );
$expireTime = new DateTime(); $expireTime = new DateTime();
$expireTime->add(new DateInterval('PT1H')); $expireTime->add(new DateInterval('PT1H'));
$this->addElement( $this->addElement(
new DateTimePicker( 'dateTimePicker',
'expire_time', 'expire_time',
array( array(
'required' => true, 'required' => true,
'label' => mt('monitoring', 'Expire Time'), 'label' => mt('monitoring', 'Expire Time'),
'description' => mt('monitoring', 'Set the expire time.'), 'description' => mt('monitoring', 'Set the expire time.'),
'value' => $expireTime 'value' => $expireTime
)
) )
); );
return $this; return $this;

View File

@ -7,8 +7,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object;
use DateTime; use DateTime;
use DateInterval; use DateInterval;
use Icinga\Module\Monitoring\Command\Object\AcknowledgeProblemCommand; use Icinga\Module\Monitoring\Command\Object\AcknowledgeProblemCommand;
use Icinga\Web\Form\Element\DateTimePicker;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Request; use Icinga\Web\Request;
@ -35,7 +33,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
public function createElements(array $formData = array()) public function createElements(array $formData = array())
{ {
$this->addElements(array( $this->addElements(array(
new Note( array(
'note',
'command-info', 'command-info',
array( array(
'value' => mt( 'value' => mt(
@ -86,16 +85,15 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
$expireTime = new DateTime(); $expireTime = new DateTime();
$expireTime->add(new DateInterval('PT1H')); $expireTime->add(new DateInterval('PT1H'));
$this->addElement( $this->addElement(
new DateTimePicker( 'dateTimePicker',
'expire_time', 'expire_time',
array( array(
'label' => mt('monitoring', 'Expire Time'), 'label' => mt('monitoring', 'Expire Time'),
'value' => $expireTime, 'value' => $expireTime,
'description' => mt( 'description' => mt(
'monitoring', 'monitoring',
'Enter the expire date and time for this acknowledgement here. Icinga will delete the' 'Enter the expire date and time for this acknowledgement here. Icinga will delete the'
. ' acknowledgement after this time expired.' . ' acknowledgement after this time expired.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Command\Object; namespace Icinga\Module\Monitoring\Form\Command\Object;
use Icinga\Module\Monitoring\Command\Object\AddCommentCommand; use Icinga\Module\Monitoring\Command\Object\AddCommentCommand;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Request; use Icinga\Web\Request;
@ -32,7 +31,8 @@ class AddCommentCommandForm extends ObjectsCommandForm
public function createElements(array $formData = array()) public function createElements(array $formData = array())
{ {
$this->addElements(array( $this->addElements(array(
new Note( array(
'note',
'command-info', 'command-info',
array( array(
'value' => mt( 'value' => mt(

View File

@ -6,8 +6,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object;
use Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand;
use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand;
use Icinga\Web\Form\Element\Button;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Request; use Icinga\Web\Request;
@ -34,17 +32,16 @@ class CheckNowCommandForm extends ObjectsCommandForm
$iconUrl = $this->getView()->href('img/icons/refresh_petrol.png'); $iconUrl = $this->getView()->href('img/icons/refresh_petrol.png');
$this->addElements(array( $this->addElements(array(
new Button( 'button',
'btn_submit', 'btn_submit',
array( array(
'ignore' => true, 'ignore' => true,
'type' => 'submit', 'type' => 'submit',
'value' => mt('monitoring', 'Check now'), 'value' => mt('monitoring', 'Check now'),
'label' => '<img src="'.$iconUrl.'"> ' . mt('monitoring', 'Check now'), 'label' => '<img src="'.$iconUrl.'"> ' . mt('monitoring', 'Check now'),
'decorators' => array('ViewHelper'), 'decorators' => array('ViewHelper'),
'escape' => false, 'escape' => false,
'class' => 'link-like' 'class' => 'link-like'
)
) )
)); ));
return $this; return $this;

View File

@ -7,8 +7,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object;
use DateTime; use DateTime;
use DateInterval; use DateInterval;
use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand;
use Icinga\Web\Form\Element\DateTimePicker;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Request; use Icinga\Web\Request;
@ -37,7 +35,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
$checkTime = new DateTime(); $checkTime = new DateTime();
$checkTime->add(new DateInterval('PT1H')); $checkTime->add(new DateInterval('PT1H'));
$this->addElements(array( $this->addElements(array(
new Note( array(
'note',
'command-info', 'command-info',
array( array(
'value' => mt( 'value' => mt(
@ -47,7 +46,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
) )
) )
), ),
new DateTimePicker( array(
'dateTimePicker',
'check_time', 'check_time',
array( array(
'required' => true, 'required' => true,

View File

@ -7,9 +7,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object;
use DateTime; use DateTime;
use DateInterval; use DateInterval;
use Icinga\Module\Monitoring\Command\Object\ScheduleServiceDowntimeCommand; use Icinga\Module\Monitoring\Command\Object\ScheduleServiceDowntimeCommand;
use Icinga\Web\Form\Element\DateTimePicker;
use Icinga\Web\Form\Element\Note;
use Icinga\Web\Form\Element\Number;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Request; use Icinga\Web\Request;
@ -49,7 +46,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
$end = clone $start; $end = clone $start;
$end->add(new DateInterval('PT1H')); $end->add(new DateInterval('PT1H'));
$this->addElements(array( $this->addElements(array(
new Note( array(
'note',
'command-info', 'command-info',
array( array(
'value' => mt( 'value' => mt(
@ -76,7 +74,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
) )
) )
), ),
new DateTimePicker( array(
'dateTimePicker',
'start', 'start',
array( array(
'required' => true, 'required' => true,
@ -85,7 +84,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'value' => $start 'value' => $start
) )
), ),
new DateTimePicker( array(
'dateTimePicker',
'end', 'end',
array( array(
'required' => true, 'required' => true,
@ -134,7 +134,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
); );
if (isset($formData['type']) && $formData['type'] === self::FLEXIBLE) { if (isset($formData['type']) && $formData['type'] === self::FLEXIBLE) {
$this->addElements(array( $this->addElements(array(
new Number( array(
'number',
'hours', 'hours',
array( array(
'required' => true, 'required' => true,
@ -143,7 +144,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
'min' => -1 'min' => -1
) )
), ),
new Number( array(
'number',
'minutes', 'minutes',
array( array(
'required' => true, 'required' => true,

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Config\Instance; namespace Icinga\Module\Monitoring\Form\Config\Instance;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Number;
class RemoteInstanceForm extends Form class RemoteInstanceForm extends Form
{ {
@ -36,10 +35,11 @@ class RemoteInstanceForm extends Form
) )
) )
), ),
new Number( array(
'number',
'port',
array( array(
'required' => true, 'required' => true,
'name' => 'port',
'label' => mt('monitoring', 'Port'), 'label' => mt('monitoring', 'Port'),
'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'), 'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'),
'value' => 22 'value' => 22

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Setup; namespace Icinga\Module\Monitoring\Form\Setup;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Application\Platform; use Icinga\Application\Platform;
class BackendPage extends Form class BackendPage extends Form
@ -18,25 +17,23 @@ class BackendPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'), 'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'Please configure below how Icinga Web 2 should retrieve monitoring information.' 'Please configure below how Icinga Web 2 should retrieve monitoring information.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Setup; namespace Icinga\Module\Monitoring\Form\Setup;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\Config\Resource\DbResourceForm; use Icinga\Form\Config\Resource\DbResourceForm;
class IdoResourcePage extends Form class IdoResourcePage extends Form
@ -26,26 +25,24 @@ class IdoResourcePage extends Form
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'), 'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'Please fill out the connection details below to access' 'Please fill out the connection details below to access'
. ' the IDO database of your monitoring environment.' . ' the IDO database of your monitoring environment.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Setup; namespace Icinga\Module\Monitoring\Form\Setup;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Module\Monitoring\Form\Config\InstanceConfigForm; use Icinga\Module\Monitoring\Form\Config\InstanceConfigForm;
class InstancePage extends Form class InstancePage extends Form
@ -18,25 +17,23 @@ class InstancePage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'), 'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'Please define the settings specific to your monitoring instance below.' 'Please define the settings specific to your monitoring instance below.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Setup; namespace Icinga\Module\Monitoring\Form\Setup;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\Config\Resource\LivestatusResourceForm; use Icinga\Form\Config\Resource\LivestatusResourceForm;
class LivestatusResourcePage extends Form class LivestatusResourcePage extends Form
@ -26,26 +25,24 @@ class LivestatusResourcePage extends Form
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'), 'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'Please fill out the connection details below to access the Livestatus' 'Please fill out the connection details below to access the Livestatus'
. ' socket interface for your monitoring environment.' . ' socket interface for your monitoring environment.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Setup; namespace Icinga\Module\Monitoring\Form\Setup;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Module\Monitoring\Form\Config\SecurityConfigForm; use Icinga\Module\Monitoring\Form\Config\SecurityConfigForm;
class SecurityPage extends Form class SecurityPage extends Form
@ -18,25 +17,23 @@ class SecurityPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'), 'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'To protect your monitoring environment against prying eyes please fill out the settings below.' 'To protect your monitoring environment against prying eyes please fill out the settings below.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Monitoring\Form\Setup; namespace Icinga\Module\Monitoring\Form\Setup;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
class WelcomePage extends Form class WelcomePage extends Form
{ {
@ -17,39 +16,36 @@ class WelcomePage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'welcome', 'welcome',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'Welcome to the configuration of the monitoring module for Icinga Web 2!' 'Welcome to the configuration of the monitoring module for Icinga Web 2!'
), ),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'core_hint', 'core_hint',
array( array(
'value' => mt('monitoring', 'This is the core module for Icinga Web 2.') 'value' => mt('monitoring', 'This is the core module for Icinga Web 2.')
)
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'monitoring', 'monitoring',
'It offers various status and reporting views with powerful filter capabilities that allow' 'It offers various status and reporting views with powerful filter capabilities that allow'
. ' you to keep track of the most important events in your monitoring environment.' . ' you to keep track of the most important events in your monitoring environment.'
)
) )
) )
); );

View File

@ -9,7 +9,6 @@ use LogicException;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Data\ResourceFactory; use Icinga\Data\ResourceFactory;
use Icinga\Web\Form\Element\Note;
use Icinga\Authentication\Backend\DbUserBackend; use Icinga\Authentication\Backend\DbUserBackend;
use Icinga\Authentication\Backend\LdapUserBackend; use Icinga\Authentication\Backend\LdapUserBackend;
@ -177,28 +176,26 @@ class AdminAccountPage extends Form
} }
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Administration', 'setup.page.title'), 'value' => mt('setup', 'Administration', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => tp( 'value' => tp(
'Now it\'s time to configure your first administrative account for Icinga Web 2.' 'Now it\'s time to configure your first administrative account for Icinga Web 2.'
. ' Please follow the instructions below:', . ' Please follow the instructions below:',
'Now it\'s time to configure your first administrative account for Icinga Web 2.' 'Now it\'s time to configure your first administrative account for Icinga Web 2.'
. ' Below are several options you can choose from. Select one and follow its instructions:', . ' Below are several options you can choose from. Select one and follow its instructions:',
count($choices) count($choices)
)
) )
) )
); );

View File

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\Config\Authentication\DbBackendForm; use Icinga\Form\Config\Authentication\DbBackendForm;
use Icinga\Form\Config\Authentication\LdapBackendForm; use Icinga\Form\Config\Authentication\LdapBackendForm;
use Icinga\Form\Config\Authentication\AutologinBackendForm; use Icinga\Form\Config\Authentication\AutologinBackendForm;
@ -60,14 +59,13 @@ class AuthBackendPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Authentication Backend', 'setup.page.title'), 'value' => mt('setup', 'Authentication Backend', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
@ -93,10 +91,9 @@ class AuthBackendPage extends Form
} }
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array('value' => $note) array('value' => $note)
)
); );
if (isset($formData['skip_validation']) && $formData['skip_validation']) { if (isset($formData['skip_validation']) && $formData['skip_validation']) {

View File

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Application\Platform; use Icinga\Application\Platform;
use Icinga\Web\Form\Element\Note;
/** /**
* Wizard page to choose an authentication backend * Wizard page to choose an authentication backend
@ -27,26 +26,24 @@ class AuthenticationPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Authentication', 'setup.page.title'), 'value' => mt('setup', 'Authentication', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'setup', 'setup',
'Please choose how you want to authenticate when accessing Icinga Web 2.' 'Please choose how you want to authenticate when accessing Icinga Web 2.'
. ' Configuring backend specific details follows in a later step.' . ' Configuring backend specific details follows in a later step.'
)
) )
) )
); );

View File

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form;
use PDOException; use PDOException;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Module\Setup\Utils\DbTool; use Icinga\Module\Setup\Utils\DbTool;
/** /**
@ -88,27 +87,25 @@ class DatabaseCreationPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Database Setup', 'setup.page.title'), 'value' => mt('setup', 'Database Setup', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'setup', 'setup',
'It seems that either the database you defined earlier does not yet exist and cannot be created' 'It seems that either the database you defined earlier does not yet exist and cannot be created'
. ' using the provided access credentials or the database does not have the required schema to ' . ' using the provided access credentials or the database does not have the required schema to '
. 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.' . 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.'
)
) )
) )
); );

View File

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form;
use PDOException; use PDOException;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\Config\Resource\DbResourceForm; use Icinga\Form\Config\Resource\DbResourceForm;
use Icinga\Module\Setup\Utils\DbTool; use Icinga\Module\Setup\Utils\DbTool;
@ -37,26 +36,24 @@ class DbResourcePage extends Form
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Database Resource', 'setup.page.title'), 'value' => mt('setup', 'Database Resource', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'setup', 'setup',
'Now please configure your database resource. Note that the database itself does not need to' 'Now please configure your database resource. Note that the database itself does not need to'
. ' exist at this time as it is going to be created once the wizard is about to be finished.' . ' exist at this time as it is going to be created once the wizard is about to be finished.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Setup\Form; namespace Icinga\Module\Setup\Form;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\Config\General\LoggingConfigForm; use Icinga\Form\Config\General\LoggingConfigForm;
/** /**
@ -27,25 +26,23 @@ class GeneralConfigPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Application Configuration', 'setup.page.title'), 'value' => mt('setup', 'Application Configuration', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'setup', 'setup',
'Now please adjust all application and logging related configuration options to fit your needs.' 'Now please adjust all application and logging related configuration options to fit your needs.'
)
) )
) )
); );

View File

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form;
use Icinga\Application\Config; use Icinga\Application\Config;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
/** /**
* Wizard page to define the connection details for a LDAP resource * Wizard page to define the connection details for a LDAP resource
@ -80,39 +79,36 @@ EOT;
$html = str_replace('{user_class}', $backend['user_class'], $html); $html = str_replace('{user_class}', $backend['user_class'], $html);
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'), 'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => sprintf( 'value' => sprintf(
mt('setup', 'The following directory service has been found on domain "%s":'), mt('setup', 'The following directory service has been found on domain "%s":'),
$this->config['domain'] $this->config['domain']
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'suggestion', 'suggestion',
array( array(
'value' => $html, 'value' => $html,
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array( array(
'HtmlTag', array('tag' => 'div') 'HtmlTag', array('tag' => 'div')
)
) )
) )
) )

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Setup\Form; namespace Icinga\Module\Setup\Form;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\LdapDiscoveryForm; use Icinga\Form\LdapDiscoveryForm;
/** /**
@ -32,26 +31,24 @@ class LdapDiscoveryPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'), 'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'setup', 'setup',
'You can use this page to discover LDAP or ActiveDirectory servers ' . 'You can use this page to discover LDAP or ActiveDirectory servers ' .
' for authentication. If you don\' want to execute a discovery, just skip this step.' ' for authentication. If you don\' want to execute a discovery, just skip this step.'
)
) )
) )
); );

View File

@ -5,7 +5,6 @@
namespace Icinga\Module\Setup\Form; namespace Icinga\Module\Setup\Form;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Web\Form\Element\Note;
use Icinga\Form\Config\Resource\LdapResourceForm; use Icinga\Form\Config\Resource\LdapResourceForm;
/** /**
@ -35,26 +34,24 @@ class LdapResourcePage extends Form
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'LDAP Resource', 'setup.page.title'), 'value' => mt('setup', 'LDAP Resource', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt( 'value' => mt(
'setup', 'setup',
'Now please configure your AD/LDAP resource. This will later ' 'Now please configure your AD/LDAP resource. This will later '
. 'be used to authenticate users logging in to Icinga Web 2.' . 'be used to authenticate users logging in to Icinga Web 2.'
)
) )
) )
); );

View File

@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form;
use Icinga\Web\Form; use Icinga\Web\Form;
use Icinga\Application\Platform; use Icinga\Application\Platform;
use Icinga\Web\Form\Element\Note;
/** /**
* Wizard page to choose a preference backend * Wizard page to choose a preference backend
@ -45,23 +44,21 @@ class PreferencesPage extends Form
public function createElements(array $formData) public function createElements(array $formData)
{ {
$this->addElement( $this->addElement(
new Note( 'note',
'title', 'title',
array( array(
'value' => mt('setup', 'Preferences', 'setup.page.title'), 'value' => mt('setup', 'Preferences', 'setup.page.title'),
'decorators' => array( 'decorators' => array(
'ViewHelper', 'ViewHelper',
array('HtmlTag', array('tag' => 'h2')) array('HtmlTag', array('tag' => 'h2'))
)
) )
) )
); );
$this->addElement( $this->addElement(
new Note( 'note',
'description', 'description',
array( array(
'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.') 'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.')
)
) )
); );