From 1c4a5ce86fa65ed6bab5a7fbc830d38e857a1c83 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 14 Nov 2014 10:15:11 +0100 Subject: [PATCH] Leave it up to Icinga\Web\Form to instantiate our own form elements --- .../forms/Config/Resource/DbResourceForm.php | 16 ++-- .../Config/Resource/LdapResourceForm.php | 16 ++-- application/forms/LdapDiscoveryForm.php | 14 ++-- library/Icinga/Web/Form/Element/Button.php | 4 +- library/Icinga/Web/Form/Element/Note.php | 4 +- library/Icinga/Web/Wizard.php | 76 +++++++++---------- .../DisableNotificationsExpireCommandForm.php | 30 ++++---- .../Object/AcknowledgeProblemCommandForm.php | 24 +++--- .../Command/Object/AddCommentCommandForm.php | 4 +- .../Command/Object/CheckNowCommandForm.php | 23 +++--- .../ScheduleServiceCheckCommandForm.php | 8 +- .../ScheduleServiceDowntimeCommandForm.php | 18 +++-- .../Config/Instance/RemoteInstanceForm.php | 6 +- .../application/forms/Setup/BackendPage.php | 29 ++++--- .../forms/Setup/IdoResourcePage.php | 31 ++++---- .../application/forms/Setup/InstancePage.php | 29 ++++--- .../forms/Setup/LivestatusResourcePage.php | 31 ++++---- .../application/forms/Setup/SecurityPage.php | 29 ++++--- .../application/forms/Setup/WelcomePage.php | 46 +++++------ .../application/forms/AdminAccountPage.php | 35 ++++----- .../application/forms/AuthBackendPage.php | 23 +++--- .../application/forms/AuthenticationPage.php | 31 ++++---- .../forms/DatabaseCreationPage.php | 33 ++++---- .../application/forms/DbResourcePage.php | 31 ++++---- .../application/forms/GeneralConfigPage.php | 29 ++++--- .../forms/LdapDiscoveryConfirmPage.php | 46 +++++------ .../application/forms/LdapDiscoveryPage.php | 31 ++++---- .../application/forms/LdapResourcePage.php | 31 ++++---- .../application/forms/PreferencesPage.php | 25 +++--- 29 files changed, 342 insertions(+), 411 deletions(-) diff --git a/application/forms/Config/Resource/DbResourceForm.php b/application/forms/Config/Resource/DbResourceForm.php index 4c0ce7740..43075579e 100644 --- a/application/forms/Config/Resource/DbResourceForm.php +++ b/application/forms/Config/Resource/DbResourceForm.php @@ -8,7 +8,6 @@ use Exception; use Icinga\Application\Config; use Icinga\Web\Form; use Icinga\Web\Request; -use Icinga\Web\Form\Element\Number; use Icinga\Data\ResourceFactory; use Icinga\Application\Platform; @@ -68,14 +67,13 @@ class DbResourceForm extends Form ) ); $this->addElement( - new Number( - array( - 'required' => true, - 'name' => 'port', - 'label' => t('Port'), - 'description' => t('The port to use'), - 'value' => 3306 - ) + 'number', + 'port', + array( + 'required' => true, + 'label' => t('Port'), + 'description' => t('The port to use'), + 'value' => 3306 ) ); $this->addElement( diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php index cd482a7fb..237df62bf 100644 --- a/application/forms/Config/Resource/LdapResourceForm.php +++ b/application/forms/Config/Resource/LdapResourceForm.php @@ -8,7 +8,6 @@ use Exception; use Icinga\Application\Config; use Icinga\Web\Form; use Icinga\Web\Request; -use Icinga\Web\Form\Element\Number; use Icinga\Data\ResourceFactory; /** @@ -49,14 +48,13 @@ class LdapResourceForm extends Form ) ); $this->addElement( - new Number( - array( - 'required' => true, - 'name' => 'port', - 'label' => t('Port'), - 'description' => t('The port of the LDAP server to use for authentication'), - 'value' => 389 - ) + 'number', + 'port', + array( + 'required' => true, + 'label' => t('Port'), + 'description' => t('The port of the LDAP server to use for authentication'), + 'value' => 389 ) ); $this->addElement( diff --git a/application/forms/LdapDiscoveryForm.php b/application/forms/LdapDiscoveryForm.php index 88f30f2c1..eccf43ae0 100644 --- a/application/forms/LdapDiscoveryForm.php +++ b/application/forms/LdapDiscoveryForm.php @@ -7,7 +7,6 @@ use Icinga\Application\Logger; use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Protocol\Ldap\Connection; use Icinga\Protocol\Dns; -use Icinga\Web\Form\Element\Note; use Icinga\Web\Form; /** @@ -68,13 +67,12 @@ class LdapDiscoveryForm extends Form if (false) { $this->addElement( - new 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.' - ) + '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.' ) ) ); diff --git a/library/Icinga/Web/Form/Element/Button.php b/library/Icinga/Web/Form/Element/Button.php index 00da28d10..1c5499373 100644 --- a/library/Icinga/Web/Form/Element/Button.php +++ b/library/Icinga/Web/Form/Element/Button.php @@ -4,14 +4,14 @@ namespace Icinga\Web\Form\Element; -use Zend_Form_Element; use Icinga\Web\Request; use Icinga\Application\Icinga; +use Icinga\Web\Form\FormElement; /** * A button */ -class Button extends Zend_Form_Element +class Button extends FormElement { /** * Use formButton view helper by default diff --git a/library/Icinga/Web/Form/Element/Note.php b/library/Icinga/Web/Form/Element/Note.php index fa003a2cf..37bc127e9 100644 --- a/library/Icinga/Web/Form/Element/Note.php +++ b/library/Icinga/Web/Form/Element/Note.php @@ -4,12 +4,12 @@ namespace Icinga\Web\Form\Element; -use Zend_Form_Element; +use Icinga\Web\Form\FormElement; /** * A note */ -class Note extends Zend_Form_Element +class Note extends FormElement { /** * Form view helper to use for rendering diff --git a/library/Icinga/Web/Wizard.php b/library/Icinga/Web/Wizard.php index 424b46b2c..faf950292 100644 --- a/library/Icinga/Web/Wizard.php +++ b/library/Icinga/Web/Wizard.php @@ -8,7 +8,6 @@ use LogicException; use InvalidArgumentException; use Icinga\Web\Session\SessionNamespace; use Icinga\Web\Form\Decorator\ElementDoubler; -use Icinga\Web\Form\Element\Button; /** * Container and controller for form based wizards @@ -427,60 +426,55 @@ class Wizard $index = array_search($page, $pages, true); if ($index === 0) { $page->addElement( - new Button( - static::BTN_NEXT, - array( - 'type' => 'submit', - 'value' => $pages[1]->getName(), - 'label' => t('Next'), - 'decorators' => array('ViewHelper') - ) + 'button', + static::BTN_NEXT, + array( + 'type' => 'submit', + 'value' => $pages[1]->getName(), + 'label' => t('Next'), + 'decorators' => array('ViewHelper') ) ); } elseif ($index < count($pages) - 1) { $page->addElement( - new Button( - static::BTN_PREV, - array( - 'type' => 'submit', - 'value' => $pages[$index - 1]->getName(), - 'label' => t('Back'), - 'decorators' => array('ViewHelper') - ) + 'button', + static::BTN_PREV, + array( + 'type' => 'submit', + 'value' => $pages[$index - 1]->getName(), + 'label' => t('Back'), + 'decorators' => array('ViewHelper') ) ); $page->addElement( - new Button( - static::BTN_NEXT, - array( - 'type' => 'submit', - 'value' => $pages[$index + 1]->getName(), - 'label' => t('Next'), - 'decorators' => array('ViewHelper') - ) + 'button', + static::BTN_NEXT, + array( + 'type' => 'submit', + 'value' => $pages[$index + 1]->getName(), + 'label' => t('Next'), + 'decorators' => array('ViewHelper') ) ); } else { $page->addElement( - new Button( - static::BTN_PREV, - array( - 'type' => 'submit', - 'value' => $pages[$index - 1]->getName(), - 'label' => t('Back'), - 'decorators' => array('ViewHelper') - ) + 'button', + static::BTN_PREV, + array( + 'type' => 'submit', + 'value' => $pages[$index - 1]->getName(), + 'label' => t('Back'), + 'decorators' => array('ViewHelper') ) ); $page->addElement( - new Button( - static::BTN_NEXT, - array( - 'type' => 'submit', - 'value' => $page->getName(), - 'label' => t('Finish'), - 'decorators' => array('ViewHelper') - ) + 'button', + static::BTN_NEXT, + array( + 'type' => 'submit', + 'value' => $page->getName(), + 'label' => t('Finish'), + 'decorators' => array('ViewHelper') ) ); } diff --git a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php index 272fb6660..0bbfbe4f8 100644 --- a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php @@ -8,8 +8,6 @@ use DateTime; use DateInterval; use Icinga\Module\Monitoring\Command\Instance\DisableNotificationsExpireCommand; 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\Request; @@ -34,27 +32,25 @@ class DisableNotificationsExpireCommandForm extends CommandForm public function createElements(array $formData = array()) { $this->addElement( - new Note( - 'command-info', - array( - 'value' => mt( - 'monitoring', - 'This command is used to disable host and service notifications for a specific time.' - ) + 'note', + 'command-info', + array( + 'value' => mt( + 'monitoring', + 'This command is used to disable host and service notifications for a specific time.' ) ) ); $expireTime = new DateTime(); $expireTime->add(new DateInterval('PT1H')); $this->addElement( - new DateTimePicker( - 'expire_time', - array( - 'required' => true, - 'label' => mt('monitoring', 'Expire Time'), - 'description' => mt('monitoring', 'Set the expire time.'), - 'value' => $expireTime - ) + 'dateTimePicker', + 'expire_time', + array( + 'required' => true, + 'label' => mt('monitoring', 'Expire Time'), + 'description' => mt('monitoring', 'Set the expire time.'), + 'value' => $expireTime ) ); return $this; diff --git a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php index c5b78e25c..7bdfbd8cc 100644 --- a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php @@ -7,8 +7,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object; use DateTime; use DateInterval; 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\Request; @@ -35,7 +33,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm public function createElements(array $formData = array()) { $this->addElements(array( - new Note( + array( + 'note', 'command-info', array( 'value' => mt( @@ -86,16 +85,15 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm $expireTime = new DateTime(); $expireTime->add(new DateInterval('PT1H')); $this->addElement( - new DateTimePicker( - 'expire_time', - array( - 'label' => mt('monitoring', 'Expire Time'), - 'value' => $expireTime, - 'description' => mt( - 'monitoring', - 'Enter the expire date and time for this acknowledgement here. Icinga will delete the' - . ' acknowledgement after this time expired.' - ) + 'dateTimePicker', + 'expire_time', + array( + 'label' => mt('monitoring', 'Expire Time'), + 'value' => $expireTime, + 'description' => mt( + 'monitoring', + 'Enter the expire date and time for this acknowledgement here. Icinga will delete the' + . ' acknowledgement after this time expired.' ) ) ); diff --git a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php index 1f6f9573e..a89353d52 100644 --- a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object; use Icinga\Module\Monitoring\Command\Object\AddCommentCommand; -use Icinga\Web\Form\Element\Note; use Icinga\Web\Notification; use Icinga\Web\Request; @@ -32,7 +31,8 @@ class AddCommentCommandForm extends ObjectsCommandForm public function createElements(array $formData = array()) { $this->addElements(array( - new Note( + array( + 'note', 'command-info', array( 'value' => mt( diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index aa109ff7f..ffc99ecdd 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -6,8 +6,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object; use Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand; 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\Request; @@ -34,17 +32,16 @@ class CheckNowCommandForm extends ObjectsCommandForm $iconUrl = $this->getView()->href('img/icons/refresh_petrol.png'); $this->addElements(array( - new Button( - 'btn_submit', - array( - 'ignore' => true, - 'type' => 'submit', - 'value' => mt('monitoring', 'Check now'), - 'label' => ' ' . mt('monitoring', 'Check now'), - 'decorators' => array('ViewHelper'), - 'escape' => false, - 'class' => 'link-like' - ) + 'button', + 'btn_submit', + array( + 'ignore' => true, + 'type' => 'submit', + 'value' => mt('monitoring', 'Check now'), + 'label' => ' ' . mt('monitoring', 'Check now'), + 'decorators' => array('ViewHelper'), + 'escape' => false, + 'class' => 'link-like' ) )); return $this; diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php index 304ccb435..dd0ad9f3e 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php @@ -7,8 +7,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object; use DateTime; use DateInterval; 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\Request; @@ -37,7 +35,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm $checkTime = new DateTime(); $checkTime->add(new DateInterval('PT1H')); $this->addElements(array( - new Note( + array( + 'note', 'command-info', array( 'value' => mt( @@ -47,7 +46,8 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm ) ) ), - new DateTimePicker( + array( + 'dateTimePicker', 'check_time', array( 'required' => true, diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php index 58b391d14..a7d5f028b 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php @@ -7,9 +7,6 @@ namespace Icinga\Module\Monitoring\Form\Command\Object; use DateTime; use DateInterval; 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\Request; @@ -49,7 +46,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm $end = clone $start; $end->add(new DateInterval('PT1H')); $this->addElements(array( - new Note( + array( + 'note', 'command-info', array( 'value' => mt( @@ -76,7 +74,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm ) ) ), - new DateTimePicker( + array( + 'dateTimePicker', 'start', array( 'required' => true, @@ -85,7 +84,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'value' => $start ) ), - new DateTimePicker( + array( + 'dateTimePicker', 'end', array( 'required' => true, @@ -134,7 +134,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm ); if (isset($formData['type']) && $formData['type'] === self::FLEXIBLE) { $this->addElements(array( - new Number( + array( + 'number', 'hours', array( 'required' => true, @@ -143,7 +144,8 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm 'min' => -1 ) ), - new Number( + array( + 'number', 'minutes', array( 'required' => true, diff --git a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php index fbd2ff14b..e2d6840eb 100644 --- a/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/RemoteInstanceForm.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Number; class RemoteInstanceForm extends Form { @@ -36,10 +35,11 @@ class RemoteInstanceForm extends Form ) ) ), - new Number( + array( + 'number', + 'port', array( 'required' => true, - 'name' => 'port', 'label' => mt('monitoring', 'Port'), 'description' => mt('monitoring', 'SSH port to connect to on the remote Icinga instance'), 'value' => 22 diff --git a/modules/monitoring/application/forms/Setup/BackendPage.php b/modules/monitoring/application/forms/Setup/BackendPage.php index 097d2586b..c5506111c 100644 --- a/modules/monitoring/application/forms/Setup/BackendPage.php +++ b/modules/monitoring/application/forms/Setup/BackendPage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Setup; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Application\Platform; class BackendPage extends Form @@ -18,25 +17,23 @@ class BackendPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('monitoring', 'Monitoring Backend', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'monitoring', - 'Please configure below how Icinga Web 2 should retrieve monitoring information.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'monitoring', + 'Please configure below how Icinga Web 2 should retrieve monitoring information.' ) ) ); diff --git a/modules/monitoring/application/forms/Setup/IdoResourcePage.php b/modules/monitoring/application/forms/Setup/IdoResourcePage.php index 3e844027c..c6fd33c46 100644 --- a/modules/monitoring/application/forms/Setup/IdoResourcePage.php +++ b/modules/monitoring/application/forms/Setup/IdoResourcePage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Setup; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\Config\Resource\DbResourceForm; class IdoResourcePage extends Form @@ -26,26 +25,24 @@ class IdoResourcePage extends Form ) ); $this->addElement( - new Note( - 'title', - array( - 'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('monitoring', 'Monitoring IDO Resource', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'monitoring', - 'Please fill out the connection details below to access' - . ' the IDO database of your monitoring environment.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'monitoring', + 'Please fill out the connection details below to access' + . ' the IDO database of your monitoring environment.' ) ) ); diff --git a/modules/monitoring/application/forms/Setup/InstancePage.php b/modules/monitoring/application/forms/Setup/InstancePage.php index 7398dae1c..af1b6df61 100644 --- a/modules/monitoring/application/forms/Setup/InstancePage.php +++ b/modules/monitoring/application/forms/Setup/InstancePage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Setup; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Module\Monitoring\Form\Config\InstanceConfigForm; class InstancePage extends Form @@ -18,25 +17,23 @@ class InstancePage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('monitoring', 'Monitoring Instance', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'monitoring', - 'Please define the settings specific to your monitoring instance below.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'monitoring', + 'Please define the settings specific to your monitoring instance below.' ) ) ); diff --git a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php index 9ae36aebf..abecd0b73 100644 --- a/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php +++ b/modules/monitoring/application/forms/Setup/LivestatusResourcePage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Setup; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\Config\Resource\LivestatusResourceForm; class LivestatusResourcePage extends Form @@ -26,26 +25,24 @@ class LivestatusResourcePage extends Form ) ); $this->addElement( - new Note( - 'title', - array( - 'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('monitoring', 'Monitoring Livestatus Resource', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'monitoring', - 'Please fill out the connection details below to access the Livestatus' - . ' socket interface for your monitoring environment.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'monitoring', + 'Please fill out the connection details below to access the Livestatus' + . ' socket interface for your monitoring environment.' ) ) ); diff --git a/modules/monitoring/application/forms/Setup/SecurityPage.php b/modules/monitoring/application/forms/Setup/SecurityPage.php index 70c90c8a3..42eed4d70 100644 --- a/modules/monitoring/application/forms/Setup/SecurityPage.php +++ b/modules/monitoring/application/forms/Setup/SecurityPage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Setup; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Module\Monitoring\Form\Config\SecurityConfigForm; class SecurityPage extends Form @@ -18,25 +17,23 @@ class SecurityPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('monitoring', 'Monitoring Security', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'monitoring', - 'To protect your monitoring environment against prying eyes please fill out the settings below.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'monitoring', + 'To protect your monitoring environment against prying eyes please fill out the settings below.' ) ) ); diff --git a/modules/monitoring/application/forms/Setup/WelcomePage.php b/modules/monitoring/application/forms/Setup/WelcomePage.php index be1f35364..c329c71aa 100644 --- a/modules/monitoring/application/forms/Setup/WelcomePage.php +++ b/modules/monitoring/application/forms/Setup/WelcomePage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Monitoring\Form\Setup; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; class WelcomePage extends Form { @@ -17,39 +16,36 @@ class WelcomePage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'welcome', - array( - 'value' => mt( - 'monitoring', - 'Welcome to the configuration of the monitoring module for Icinga Web 2!' - ), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'welcome', + array( + 'value' => mt( + 'monitoring', + 'Welcome to the configuration of the monitoring module for Icinga Web 2!' + ), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'core_hint', - array( - 'value' => mt('monitoring', 'This is the core module for Icinga Web 2.') - ) + 'note', + 'core_hint', + array( + 'value' => mt('monitoring', 'This is the core module for Icinga Web 2.') ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'monitoring', - '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.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'monitoring', + '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.' ) ) ); diff --git a/modules/setup/application/forms/AdminAccountPage.php b/modules/setup/application/forms/AdminAccountPage.php index 38101fe85..dee501113 100644 --- a/modules/setup/application/forms/AdminAccountPage.php +++ b/modules/setup/application/forms/AdminAccountPage.php @@ -9,7 +9,6 @@ use LogicException; use Icinga\Application\Config; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; -use Icinga\Web\Form\Element\Note; use Icinga\Authentication\Backend\DbUserBackend; use Icinga\Authentication\Backend\LdapUserBackend; @@ -177,28 +176,26 @@ class AdminAccountPage extends Form } $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Administration', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Administration', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => tp( - 'Now it\'s time to configure your first administrative account for Icinga Web 2.' - . ' Please follow the instructions below:', - '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:', - count($choices) - ) + 'note', + 'description', + array( + 'value' => tp( + 'Now it\'s time to configure your first administrative account for Icinga Web 2.' + . ' Please follow the instructions below:', + '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:', + count($choices) ) ) ); diff --git a/modules/setup/application/forms/AuthBackendPage.php b/modules/setup/application/forms/AuthBackendPage.php index 89a060a06..dd3e12361 100644 --- a/modules/setup/application/forms/AuthBackendPage.php +++ b/modules/setup/application/forms/AuthBackendPage.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Application\Config; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\Config\Authentication\DbBackendForm; use Icinga\Form\Config\Authentication\LdapBackendForm; use Icinga\Form\Config\Authentication\AutologinBackendForm; @@ -60,14 +59,13 @@ class AuthBackendPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Authentication Backend', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Authentication Backend', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); @@ -93,10 +91,9 @@ class AuthBackendPage extends Form } $this->addElement( - new Note( - 'description', - array('value' => $note) - ) + 'note', + 'description', + array('value' => $note) ); if (isset($formData['skip_validation']) && $formData['skip_validation']) { diff --git a/modules/setup/application/forms/AuthenticationPage.php b/modules/setup/application/forms/AuthenticationPage.php index 345625c94..c1d9fa339 100644 --- a/modules/setup/application/forms/AuthenticationPage.php +++ b/modules/setup/application/forms/AuthenticationPage.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Web\Form; use Icinga\Application\Platform; -use Icinga\Web\Form\Element\Note; /** * Wizard page to choose an authentication backend @@ -27,26 +26,24 @@ class AuthenticationPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Authentication', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Authentication', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'setup', - 'Please choose how you want to authenticate when accessing Icinga Web 2.' - . ' Configuring backend specific details follows in a later step.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'setup', + 'Please choose how you want to authenticate when accessing Icinga Web 2.' + . ' Configuring backend specific details follows in a later step.' ) ) ); diff --git a/modules/setup/application/forms/DatabaseCreationPage.php b/modules/setup/application/forms/DatabaseCreationPage.php index 556e20e28..4b5bdca0e 100644 --- a/modules/setup/application/forms/DatabaseCreationPage.php +++ b/modules/setup/application/forms/DatabaseCreationPage.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form; use PDOException; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Module\Setup\Utils\DbTool; /** @@ -88,27 +87,25 @@ class DatabaseCreationPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Database Setup', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Database Setup', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'setup', - '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 ' - . 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'setup', + '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 ' + . 'be operated by Icinga Web 2. Please provide appropriate access credentials to solve this.' ) ) ); diff --git a/modules/setup/application/forms/DbResourcePage.php b/modules/setup/application/forms/DbResourcePage.php index 326f9131d..45d256e0f 100644 --- a/modules/setup/application/forms/DbResourcePage.php +++ b/modules/setup/application/forms/DbResourcePage.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form; use PDOException; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\Config\Resource\DbResourceForm; use Icinga\Module\Setup\Utils\DbTool; @@ -37,26 +36,24 @@ class DbResourcePage extends Form ) ); $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Database Resource', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Database Resource', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'setup', - '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.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'setup', + '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.' ) ) ); diff --git a/modules/setup/application/forms/GeneralConfigPage.php b/modules/setup/application/forms/GeneralConfigPage.php index 36f138b43..e8bb6f2bc 100644 --- a/modules/setup/application/forms/GeneralConfigPage.php +++ b/modules/setup/application/forms/GeneralConfigPage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\Config\General\LoggingConfigForm; /** @@ -27,25 +26,23 @@ class GeneralConfigPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Application Configuration', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Application Configuration', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'setup', - 'Now please adjust all application and logging related configuration options to fit your needs.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'setup', + 'Now please adjust all application and logging related configuration options to fit your needs.' ) ) ); diff --git a/modules/setup/application/forms/LdapDiscoveryConfirmPage.php b/modules/setup/application/forms/LdapDiscoveryConfirmPage.php index bd312ca76..f50cf18f1 100644 --- a/modules/setup/application/forms/LdapDiscoveryConfirmPage.php +++ b/modules/setup/application/forms/LdapDiscoveryConfirmPage.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Application\Config; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; /** * 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); $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'LDAP Discovery Results', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => sprintf( - mt('setup', 'The following directory service has been found on domain "%s":'), - $this->config['domain'] - ) + 'note', + 'description', + array( + 'value' => sprintf( + mt('setup', 'The following directory service has been found on domain "%s":'), + $this->config['domain'] ) ) ); $this->addElement( - new Note( - 'suggestion', - array( - 'value' => $html, - 'decorators' => array( - 'ViewHelper', - array( - 'HtmlTag', array('tag' => 'div') - ) + 'note', + 'suggestion', + array( + 'value' => $html, + 'decorators' => array( + 'ViewHelper', + array( + 'HtmlTag', array('tag' => 'div') ) ) ) diff --git a/modules/setup/application/forms/LdapDiscoveryPage.php b/modules/setup/application/forms/LdapDiscoveryPage.php index 7fe799d19..6aa2f43d8 100644 --- a/modules/setup/application/forms/LdapDiscoveryPage.php +++ b/modules/setup/application/forms/LdapDiscoveryPage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\LdapDiscoveryForm; /** @@ -32,26 +31,24 @@ class LdapDiscoveryPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'LDAP Discovery', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'setup', - '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.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'setup', + '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.' ) ) ); diff --git a/modules/setup/application/forms/LdapResourcePage.php b/modules/setup/application/forms/LdapResourcePage.php index 9f08f75e0..b55a4e65b 100644 --- a/modules/setup/application/forms/LdapResourcePage.php +++ b/modules/setup/application/forms/LdapResourcePage.php @@ -5,7 +5,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Web\Form; -use Icinga\Web\Form\Element\Note; use Icinga\Form\Config\Resource\LdapResourceForm; /** @@ -35,26 +34,24 @@ class LdapResourcePage extends Form ) ); $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'LDAP Resource', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'LDAP Resource', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt( - 'setup', - 'Now please configure your AD/LDAP resource. This will later ' - . 'be used to authenticate users logging in to Icinga Web 2.' - ) + 'note', + 'description', + array( + 'value' => mt( + 'setup', + 'Now please configure your AD/LDAP resource. This will later ' + . 'be used to authenticate users logging in to Icinga Web 2.' ) ) ); diff --git a/modules/setup/application/forms/PreferencesPage.php b/modules/setup/application/forms/PreferencesPage.php index 276bbbff9..0916d930a 100644 --- a/modules/setup/application/forms/PreferencesPage.php +++ b/modules/setup/application/forms/PreferencesPage.php @@ -6,7 +6,6 @@ namespace Icinga\Module\Setup\Form; use Icinga\Web\Form; use Icinga\Application\Platform; -use Icinga\Web\Form\Element\Note; /** * Wizard page to choose a preference backend @@ -45,23 +44,21 @@ class PreferencesPage extends Form public function createElements(array $formData) { $this->addElement( - new Note( - 'title', - array( - 'value' => mt('setup', 'Preferences', 'setup.page.title'), - 'decorators' => array( - 'ViewHelper', - array('HtmlTag', array('tag' => 'h2')) - ) + 'note', + 'title', + array( + 'value' => mt('setup', 'Preferences', 'setup.page.title'), + 'decorators' => array( + 'ViewHelper', + array('HtmlTag', array('tag' => 'h2')) ) ) ); $this->addElement( - new Note( - 'description', - array( - 'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.') - ) + 'note', + 'description', + array( + 'value' => mt('setup', 'Please choose how Icinga Web 2 should store user preferences.') ) );