commit
9c3405e2eb
|
@ -30,11 +30,8 @@ namespace Icinga\Form\Config;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use \Icinga\Application\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use \Icinga\Application\Icinga;
|
|
||||||
use \Icinga\Application\Logger;
|
use \Icinga\Application\Logger;
|
||||||
use \Icinga\Application\DbAdapterFactory;
|
|
||||||
use \Icinga\Web\Form;
|
use \Icinga\Web\Form;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
use \Icinga\Web\Form\Decorator\ConditionalHidden;
|
use \Icinga\Web\Form\Decorator\ConditionalHidden;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -280,15 +277,7 @@ class AuthenticationForm extends Form
|
||||||
$order = $this->getAuthenticationOrder();
|
$order = $this->getAuthenticationOrder();
|
||||||
|
|
||||||
foreach ($order as $name) {
|
foreach ($order as $name) {
|
||||||
$this->addElement(
|
$this->addNote('Backend ' . $name, 4);
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'escape' => false,
|
|
||||||
'name' => 'title_backend_' . $name,
|
|
||||||
'value' => '<h4>Backend ' . $name . '</h4>'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addRemoveHint($this->filterName($name));
|
$this->addRemoveHint($this->filterName($name));
|
||||||
$backend = $this->config->get($name, null);
|
$backend = $this->config->get($name, null);
|
||||||
if ($backend === null) {
|
if ($backend === null) {
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
*/
|
*/
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
use \DateTime;
|
|
||||||
use \Zend_View_Helper_FormElement;
|
use \Zend_View_Helper_FormElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +62,7 @@ class Zend_View_Helper_FormDateTime extends Zend_View_Helper_FormElement
|
||||||
// Build the element
|
// Build the element
|
||||||
$xhtml = '<div class="datetime">'
|
$xhtml = '<div class="datetime">'
|
||||||
. '<input type="text" name="' . $this->view->escape($name) . '"'
|
. '<input type="text" name="' . $this->view->escape($name) . '"'
|
||||||
. ' id="' . $this->view->escape($id) . '"'
|
. ' id="' . $this->view->escape($name) . '"'
|
||||||
. $value
|
. $value
|
||||||
. $disabled
|
. $disabled
|
||||||
. $this->_htmlAttribs($attribs)
|
. $this->_htmlAttribs($attribs)
|
||||||
|
|
|
@ -33,6 +33,7 @@ use \Zend_View_Interface;
|
||||||
use \Icinga\Exception\ProgrammingError;
|
use \Icinga\Exception\ProgrammingError;
|
||||||
use \Icinga\Web\Form\Decorator\HelpText;
|
use \Icinga\Web\Form\Decorator\HelpText;
|
||||||
use \Icinga\Web\Form\InvalidCSRFTokenException;
|
use \Icinga\Web\Form\InvalidCSRFTokenException;
|
||||||
|
use \Icinga\Web\Form\Element\Note;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for forms providing CSRF protection, confirmation logic and auto submission
|
* Base class for forms providing CSRF protection, confirmation logic and auto submission
|
||||||
|
@ -94,6 +95,15 @@ abstract class Form extends Zend_Form
|
||||||
*/
|
*/
|
||||||
private $cancelLabel;
|
private $cancelLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Last used note-id
|
||||||
|
*
|
||||||
|
* Helper to generate unique names for note elements
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $last_note_id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the session ID
|
* Getter for the session ID
|
||||||
*
|
*
|
||||||
|
@ -259,14 +269,37 @@ abstract class Form extends Zend_Form
|
||||||
$this->addElement($submitButton);
|
$this->addElement($submitButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add message to form
|
||||||
|
*
|
||||||
|
* @param string $message The message to be displayed
|
||||||
|
* @param int $headingType Whether it should be displayed as heading (1-6) or not (null)
|
||||||
|
*/
|
||||||
|
public function addNote($message, $headingType = null)
|
||||||
|
{
|
||||||
|
$this->addElement(
|
||||||
|
new Note(
|
||||||
|
array(
|
||||||
|
'escape' => $headingType === null ? false : true,
|
||||||
|
'name' => sprintf('note_%s', $this->last_note_id++),
|
||||||
|
'value' => $headingType === null ? $message : sprintf(
|
||||||
|
'<h%1$s>%2$s</h%1$s>',
|
||||||
|
$headingType,
|
||||||
|
$message
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable automatic form submission on the given elements
|
* Enable automatic form submission on the given elements
|
||||||
*
|
*
|
||||||
* Enables automatic submission of this form once the user edits specific elements
|
* Enables automatic submission of this form once the user edits specific elements
|
||||||
*
|
*
|
||||||
* @param array $triggerElements The element names which should auto-submit the form
|
* @param array $triggerElements The element names which should auto-submit the form
|
||||||
*
|
*
|
||||||
* @throws ProgrammingError When an element is found which does not yet exist
|
* @throws ProgrammingError When an element is found which does not yet exist
|
||||||
*/
|
*/
|
||||||
final public function enableAutoSubmit($triggerElements)
|
final public function enableAutoSubmit($triggerElements)
|
||||||
{
|
{
|
||||||
|
@ -322,7 +355,7 @@ abstract class Form extends Zend_Form
|
||||||
*
|
*
|
||||||
* This method should be used for testing purposes only
|
* This method should be used for testing purposes only
|
||||||
*
|
*
|
||||||
* @param bool $disabled
|
* @param bool $disabled Set true in order to disable CSRF tokens in this form (default: true), otherwise false
|
||||||
*
|
*
|
||||||
* @see tokenDisabled
|
* @see tokenDisabled
|
||||||
*/
|
*/
|
||||||
|
@ -355,9 +388,9 @@ abstract class Form extends Zend_Form
|
||||||
/**
|
/**
|
||||||
* Test the submitted data for a correct CSRF token
|
* Test the submitted data for a correct CSRF token
|
||||||
*
|
*
|
||||||
* @param array $checkData The POST data send by the user
|
* @param array $checkData The POST data send by the user
|
||||||
*
|
*
|
||||||
* @throws InvalidCSRFTokenException When CSRF Validation fails
|
* @throws InvalidCSRFTokenException When CSRF Validation fails
|
||||||
*/
|
*/
|
||||||
final public function assertValidCsrfToken(array $checkData)
|
final public function assertValidCsrfToken(array $checkData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
namespace Monitoring\Form\Command;
|
namespace Monitoring\Form\Command;
|
||||||
|
|
||||||
use \Icinga\Web\Form\Element\DateTimePicker;
|
use \Icinga\Web\Form\Element\DateTimePicker;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
use \Icinga\Protocol\Commandpipe\Acknowledgement;
|
use \Icinga\Protocol\Commandpipe\Acknowledgement;
|
||||||
use \Icinga\Protocol\Commandpipe\Comment;
|
use \Icinga\Protocol\Commandpipe\Comment;
|
||||||
use \Icinga\Util\DateTimeFactory;
|
use \Icinga\Util\DateTimeFactory;
|
||||||
|
@ -44,16 +43,11 @@ class AcknowledgeForm extends CommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(
|
||||||
new Note(
|
t(
|
||||||
array(
|
'This command is used to acknowledge host or service problems. When a problem is '
|
||||||
'name' => 'commanddescription',
|
. 'acknowledged, future notifications about problems are temporarily disabled until the '
|
||||||
'value' => t(
|
. 'host/service changes from its current state.'
|
||||||
'This command is used to acknowledge host or service problems. When a problem is '
|
|
||||||
. 'acknowledged, future notifications about problems are temporarily disabled until the '
|
|
||||||
. 'host/service changes from its current state.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -65,18 +59,11 @@ class AcknowledgeForm extends CommandForm
|
||||||
array(
|
array(
|
||||||
'label' => t('Comment'),
|
'label' => t('Comment'),
|
||||||
'rows' => 4,
|
'rows' => 4,
|
||||||
'required' => true
|
'required' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
' If you work with other administrators you may find it useful to share information '
|
||||||
$this->addElement(
|
. 'about a host or service that is having problems if more than one of you may be working on '
|
||||||
new Note(
|
. 'it. Make sure you enter a brief description of what you are doing.'
|
||||||
array(
|
|
||||||
'name' => 'commentnote',
|
|
||||||
'value' => t(
|
|
||||||
' If you work with other administrators you may find it useful to share information '
|
|
||||||
. 'about a host or service that is having problems if more than one of you may be working on '
|
|
||||||
. 'it. Make sure you enter a brief description of what you are doing.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -85,18 +72,11 @@ class AcknowledgeForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'persistent',
|
'persistent',
|
||||||
array(
|
array(
|
||||||
'label' => t('Persistent Comment'),
|
'label' => t('Persistent Comment'),
|
||||||
'value' => false
|
'value' => false,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you would like the comment to remain even when the acknowledgement is removed, '
|
||||||
$this->addElement(
|
. 'check this option.'
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'persistentnote',
|
|
||||||
'value' => t(
|
|
||||||
'If you would like the comment to remain even when the acknowledgement is removed, '
|
|
||||||
. 'check this option.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -105,34 +85,21 @@ class AcknowledgeForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'expire',
|
'expire',
|
||||||
array(
|
array(
|
||||||
'label' => t('Use Expire Time')
|
'label' => t('Use Expire Time'),
|
||||||
|
'helptext' => t('If the acknowledgement should expire, check this option.')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->enableAutoSubmit(array('expire'));
|
$this->enableAutoSubmit(array('expire'));
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'expirenote',
|
|
||||||
'value' => t('If the acknowledgement should expire, check this option.')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($this->getRequest()->getPost('expire', '0') === '1') {
|
if ($this->getRequest()->getPost('expire', '0') === '1') {
|
||||||
$now = DateTimeFactory::create();
|
$now = DateTimeFactory::create();
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
new DateTimePicker(
|
new DateTimePicker(
|
||||||
array(
|
array(
|
||||||
'name' => 'expiretime',
|
'name' => 'expiretime',
|
||||||
'label' => t('Expire Time'),
|
'label' => t('Expire Time'),
|
||||||
'value' => $now->getTimestamp() + 3600
|
'value' => $now->getTimestamp() + 3600,
|
||||||
)
|
'helptext' => t(
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'expiretimenote',
|
|
||||||
'value' => t(
|
|
||||||
'Enter the expire date/time for this acknowledgement here. Icinga will '
|
'Enter the expire date/time for this acknowledgement here. Icinga will '
|
||||||
. ' delete the acknowledgement after this date expired.'
|
. ' delete the acknowledgement after this date expired.'
|
||||||
)
|
)
|
||||||
|
@ -145,18 +112,11 @@ class AcknowledgeForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'sticky',
|
'sticky',
|
||||||
array(
|
array(
|
||||||
'label' => t('Sticky Acknowledgement'),
|
'label' => t('Sticky Acknowledgement'),
|
||||||
'value' => true
|
'value' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you want the acknowledgement to disable notifications until the host/service '
|
||||||
$this->addElement(
|
. 'recovers, check this option.'
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'stickynote',
|
|
||||||
'value' => t(
|
|
||||||
'If you want the acknowledgement to disable notifications until the host/service '
|
|
||||||
. 'recovers, check this option.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -165,18 +125,11 @@ class AcknowledgeForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'notify',
|
'notify',
|
||||||
array(
|
array(
|
||||||
'label' => t('Send Notification'),
|
'label' => t('Send Notification'),
|
||||||
'value' => true
|
'value' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you do not want an acknowledgement notification to be sent out to the appropriate '
|
||||||
$this->addElement(
|
. 'contacts, uncheck this option.'
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'sendnotificationnote',
|
|
||||||
'value' => t(
|
|
||||||
'If you do not want an acknowledgement notification to be sent out to the appropriate '
|
|
||||||
. 'contacts, uncheck this option.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,53 +29,16 @@
|
||||||
namespace Monitoring\Form\Command;
|
namespace Monitoring\Form\Command;
|
||||||
|
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Form\Element\Note;
|
|
||||||
use \Zend_Form_Element_Hidden;
|
use \Zend_Form_Element_Hidden;
|
||||||
use \Zend_Validate_Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple confirmation command
|
* Simple confirmation command
|
||||||
*/
|
*/
|
||||||
class CommandForm extends Form
|
class CommandForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Array of messages
|
|
||||||
*
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
private $notes = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add message to stack
|
|
||||||
*
|
|
||||||
* @param string $message
|
|
||||||
*/
|
|
||||||
public function addNote($message)
|
|
||||||
{
|
|
||||||
$this->notes[] = $message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Purge messages from stack
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function clearNotes()
|
|
||||||
{
|
|
||||||
$this->notes = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for notes
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
*/
|
|
||||||
public function getNotes()
|
|
||||||
{
|
|
||||||
return $this->notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance name containing hidden field
|
* Create an instance name containing hidden field
|
||||||
|
*
|
||||||
* @return Zend_Form_Element_Hidden
|
* @return Zend_Form_Element_Hidden
|
||||||
*/
|
*/
|
||||||
private function createInstanceHiddenField()
|
private function createInstanceHiddenField()
|
||||||
|
@ -93,24 +56,13 @@ class CommandForm extends Form
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
if (count($this->getNotes())) {
|
|
||||||
foreach ($this->getNotes() as $nodeid => $note) {
|
|
||||||
$element = new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'note_'. $nodeid,
|
|
||||||
'value' => $note
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement($element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addElement($this->createInstanceHiddenField());
|
$this->addElement($this->createInstanceHiddenField());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the author name
|
* Get the author name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getAuthorName()
|
protected function getAuthorName()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
namespace Monitoring\Form\Command;
|
namespace Monitoring\Form\Command;
|
||||||
|
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
use \Icinga\Protocol\Commandpipe\Comment;
|
use \Icinga\Protocol\Commandpipe\Comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,14 +40,7 @@ class CommentForm extends CommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(t('This command is used to add a comment to hosts or services.'));
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'commanddescription',
|
|
||||||
'value' => t('This command is used to add a comment to hosts or services.')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->addElement($this->createAuthorField());
|
$this->addElement($this->createAuthorField());
|
||||||
|
|
||||||
|
@ -58,18 +50,11 @@ class CommentForm extends CommandForm
|
||||||
array(
|
array(
|
||||||
'label' => t('Comment'),
|
'label' => t('Comment'),
|
||||||
'rows' => 4,
|
'rows' => 4,
|
||||||
'required' => true
|
'required' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you work with other administrators, you may find it useful to share information '
|
||||||
$this->addElement(
|
. 'about a host or service that is having problems if more than one of you may be working on '
|
||||||
new Note(
|
. 'it. Make sure you enter a brief description of what you are doing.'
|
||||||
array(
|
|
||||||
'name' => 'commentnote',
|
|
||||||
'value' => t(
|
|
||||||
'If you work with other administrators, you may find it useful to share information '
|
|
||||||
. 'about a host or service that is having problems if more than one of you may be working on '
|
|
||||||
. 'it. Make sure you enter a brief description of what you are doing.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -78,18 +63,11 @@ class CommentForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'persistent',
|
'persistent',
|
||||||
array(
|
array(
|
||||||
'label' => t('Persistent'),
|
'label' => t('Persistent'),
|
||||||
'value' => true
|
'value' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you uncheck this option, the comment will automatically be deleted the next time '
|
||||||
$this->addElement(
|
. 'Icinga is restarted.'
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'persistentnote',
|
|
||||||
'value' => t(
|
|
||||||
'If you uncheck this option, the comment will automatically be deleted the next time '
|
|
||||||
. 'Icinga is restarted.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
namespace Monitoring\Form\Command;
|
namespace Monitoring\Form\Command;
|
||||||
|
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
use \Icinga\Protocol\Commandpipe\CustomNotification;
|
use \Icinga\Protocol\Commandpipe\CustomNotification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,16 +40,11 @@ class CustomNotificationForm extends CommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(
|
||||||
new Note(
|
t(
|
||||||
array(
|
'This command is used to send a custom notification about hosts or services. Useful in '
|
||||||
'name' => 'commanddescription',
|
. 'emergencies when you need to notify admins of an issue regarding a monitored system or '
|
||||||
'value' => t(
|
. 'service.'
|
||||||
'This command is used to send a custom notification about hosts or services. Useful in '
|
|
||||||
. 'emergencies when you need to notify admins of an issue regarding a monitored system or '
|
|
||||||
. 'service.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -62,18 +56,11 @@ class CustomNotificationForm extends CommandForm
|
||||||
array(
|
array(
|
||||||
'label' => t('Comment'),
|
'label' => t('Comment'),
|
||||||
'rows' => 4,
|
'rows' => 4,
|
||||||
'required' => true
|
'required' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you work with other administrators, you may find it useful to share information '
|
||||||
$this->addElement(
|
. 'about a host or service that is having problems if more than one of you may be working on '
|
||||||
new Note(
|
. 'it. Make sure you enter a brief description of what you are doing.'
|
||||||
array(
|
|
||||||
'name' => 'commentnote',
|
|
||||||
'value' => t(
|
|
||||||
'If you work with other administrators, you may find it useful to share information '
|
|
||||||
. 'about a host or service that is having problems if more than one of you may be working on '
|
|
||||||
. 'it. Make sure you enter a brief description of what you are doing.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -82,18 +69,11 @@ class CustomNotificationForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'forced',
|
'forced',
|
||||||
array(
|
array(
|
||||||
'label' => t('Forced')
|
'label' => t('Forced'),
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'Custom notifications normally follow the regular notification logic in Icinga. Selecting this '
|
||||||
$this->addElement(
|
. 'option will force the notification to be sent out, regardless of time restrictions, '
|
||||||
new Note(
|
. 'whether or not notifications are enabled, etc.'
|
||||||
array(
|
|
||||||
'name' => 'forcenote',
|
|
||||||
'value' => t(
|
|
||||||
'Custom notifications normally follow the regular notification logic in Icinga. Selecting this '
|
|
||||||
. 'option will force the notification to be sent out, regardless of time restrictions, '
|
|
||||||
. 'whether or not notifications are enabled, etc.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -102,18 +82,11 @@ class CustomNotificationForm extends CommandForm
|
||||||
'checkbox',
|
'checkbox',
|
||||||
'broadcast',
|
'broadcast',
|
||||||
array(
|
array(
|
||||||
'label' => t('Broadcast')
|
'label' => t('Broadcast'),
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'Selecting this option causes the notification to be sent out to all normal (non-escalated) '
|
||||||
$this->addElement(
|
. ' and escalated contacts. These options allow you to override the normal notification logic '
|
||||||
new Note(
|
. 'if you need to get an important message out.'
|
||||||
array(
|
|
||||||
'name' => 'broadcastnote',
|
|
||||||
'value' => t(
|
|
||||||
'Selecting this option causes the notification to be sent out to all normal (non-escalated) '
|
|
||||||
. ' and escalated contacts. These options allow you to override the normal notification logic '
|
|
||||||
. 'if you need to get an important message out.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -126,7 +99,7 @@ class CustomNotificationForm extends CommandForm
|
||||||
/**
|
/**
|
||||||
* Create Custom Notification from request data
|
* Create Custom Notification from request data
|
||||||
*
|
*
|
||||||
* @return \Icinga\Protocol\Commandpipe\CustomNotification
|
* @return CustomNotification
|
||||||
*/
|
*/
|
||||||
public function getCustomNotification()
|
public function getCustomNotification()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
namespace Monitoring\Form\Command;
|
namespace Monitoring\Form\Command;
|
||||||
|
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for the delay notification command
|
* Form for the delay notification command
|
||||||
*/
|
*/
|
||||||
|
@ -45,14 +43,8 @@ class DelayNotificationForm extends CommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(t('This command is used to delay the next problem notification that is sent out.'));
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'commanddescription',
|
|
||||||
'value' => t('This command is used to delay the next problem notification that is sent out.')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'text',
|
'text',
|
||||||
'minutes',
|
'minutes',
|
||||||
|
@ -70,15 +62,13 @@ class DelayNotificationForm extends CommandForm
|
||||||
'max' => self::MAX_DELAY
|
'max' => self::MAX_DELAY
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
'helptext' => t(
|
||||||
|
'The notification delay will be disregarded if the host/service changes state before the next '
|
||||||
|
. 'notification is scheduled to be sent out.'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addNote(
|
|
||||||
t(
|
|
||||||
'The notification delay will be disregarded if the host/service changes state before the next '
|
|
||||||
. 'notification is scheduled to be sent out.'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->setSubmitLabel(t('Delay Notification'));
|
$this->setSubmitLabel(t('Delay Notification'));
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ namespace Monitoring\Form\Command;
|
||||||
use \Zend_Form_Element_Checkbox;
|
use \Zend_Form_Element_Checkbox;
|
||||||
use \Icinga\Web\Form\Element\DateTimePicker;
|
use \Icinga\Web\Form\Element\DateTimePicker;
|
||||||
use \Icinga\Util\DateTimeFactory;
|
use \Icinga\Util\DateTimeFactory;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for scheduling checks
|
* Form for scheduling checks
|
||||||
|
@ -43,33 +42,21 @@ class RescheduleNextCheckForm extends WithChildrenCommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(
|
||||||
new Note(
|
t(
|
||||||
array(
|
'This command is used to schedule the next check of hosts/services. Icinga will re-queue the '
|
||||||
'name' => 'commanddescription',
|
. 'check at the time you specify.'
|
||||||
'value' => t(
|
|
||||||
'This command is used to schedule the next check of hosts/services. Icinga will re-queue the '
|
|
||||||
. 'check at the time you specify.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
new DateTimePicker(
|
new DateTimePicker(
|
||||||
array(
|
array(
|
||||||
'name' => 'checktime',
|
'name' => 'checktime',
|
||||||
'label' => t('Check Time'),
|
'label' => t('Check Time'),
|
||||||
'value' => DateTimeFactory::create()->getTimestamp(),
|
'value' => DateTimeFactory::create()->getTimestamp(),
|
||||||
'required' => !$this->getRequest()->getPost('forcecheck')
|
'required' => !$this->getRequest()->getPost('forcecheck'),
|
||||||
)
|
'helptext' => t('Set the date/time when this check should be executed.')
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'checktimenote',
|
|
||||||
'value' => t('Set the date/time when this check should be executed.')
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -77,17 +64,10 @@ class RescheduleNextCheckForm extends WithChildrenCommandForm
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
new Zend_Form_Element_Checkbox(
|
new Zend_Form_Element_Checkbox(
|
||||||
array(
|
array(
|
||||||
'name' => 'forcecheck',
|
'name' => 'forcecheck',
|
||||||
'label' => t('Force Check'),
|
'label' => t('Force Check'),
|
||||||
'value' => true
|
'value' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'forcechecknote',
|
|
||||||
'value' => t(
|
|
||||||
'If you select this option, Icinga will force a check regardless of both what time the '
|
'If you select this option, Icinga will force a check regardless of both what time the '
|
||||||
. 'scheduled check occurs and whether or not checks are enabled.'
|
. 'scheduled check occurs and whether or not checks are enabled.'
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,7 +35,6 @@ use \Icinga\Web\Form\Element\DateTimePicker;
|
||||||
use \Icinga\Protocol\Commandpipe\Downtime;
|
use \Icinga\Protocol\Commandpipe\Downtime;
|
||||||
use \Icinga\Protocol\Commandpipe\Comment;
|
use \Icinga\Protocol\Commandpipe\Comment;
|
||||||
use \Icinga\Util\DateTimeFactory;
|
use \Icinga\Util\DateTimeFactory;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for scheduling downtimes
|
* Form for scheduling downtimes
|
||||||
|
@ -78,17 +77,12 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(
|
||||||
new Note(
|
t(
|
||||||
array(
|
'This command is used to schedule downtime for hosts/services. During the specified downtime, '
|
||||||
'name' => 'commanddescription',
|
. 'Icinga will not send notifications out about the affected objects. When the scheduled '
|
||||||
'value' => t(
|
. 'downtime expires, Icinga will send out notifications as it normally would. Scheduled '
|
||||||
'This command is used to schedule downtime for hosts/services. During the specified downtime, '
|
. 'downtimes are preserved across program shutdowns and restarts.'
|
||||||
. 'Icinga will not send notifications out about the affected objects. When the scheduled '
|
|
||||||
. 'downtime expires, Icinga will send out notifications as it normally would. Scheduled '
|
|
||||||
. 'downtimes are preserved across program shutdowns and restarts.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -100,18 +94,11 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
array(
|
array(
|
||||||
'label' => t('Comment'),
|
'label' => t('Comment'),
|
||||||
'rows' => 4,
|
'rows' => 4,
|
||||||
'required' => true
|
'required' => true,
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you work with other administrators, you may find it useful to share information '
|
||||||
$this->addElement(
|
. 'about a host or service that is having problems if more than one of you may be working on '
|
||||||
new Note(
|
. 'it. Make sure you enter a brief description of what you are doing.'
|
||||||
array(
|
|
||||||
'name' => 'commentnote',
|
|
||||||
'value' => t(
|
|
||||||
'If you work with other administrators, you may find it useful to share information '
|
|
||||||
. 'about a host or service that is having problems if more than one of you may be working on '
|
|
||||||
. 'it. Make sure you enter a brief description of what you are doing.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -147,34 +134,20 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
new DateTimePicker(
|
new DateTimePicker(
|
||||||
array(
|
array(
|
||||||
'name' => 'starttime',
|
'name' => 'starttime',
|
||||||
'label' => t('Start Time'),
|
'label' => t('Start Time'),
|
||||||
'value' => $now->getTimestamp()
|
'value' => $now->getTimestamp(),
|
||||||
)
|
'helptext' => t('Set the start date/time for the downtime.')
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'stattimenote',
|
|
||||||
'value' => t('Set the start date/time for the downtime.')
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
new DateTimePicker(
|
new DateTimePicker(
|
||||||
array(
|
array(
|
||||||
'name' => 'endtime',
|
'name' => 'endtime',
|
||||||
'label' => t('End Time'),
|
'label' => t('End Time'),
|
||||||
'value' => $now->getTimestamp() + 3600
|
'value' => $now->getTimestamp() + 3600,
|
||||||
)
|
'helptext' => t('Set the end date/time for the downtime.')
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'endtimenote',
|
|
||||||
'value' => t('Set the end date/time for the downtime.')
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -183,10 +156,10 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
'select',
|
'select',
|
||||||
'type',
|
'type',
|
||||||
array(
|
array(
|
||||||
'label' => t('Downtime Type'),
|
'label' => t('Downtime Type'),
|
||||||
'multiOptions' => $this->getDowntimeTypeOptions(),
|
'multiOptions' => $this->getDowntimeTypeOptions(),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
array(
|
array(
|
||||||
'InArray',
|
'InArray',
|
||||||
true,
|
true,
|
||||||
|
@ -194,19 +167,12 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
array_keys($this->getDowntimeTypeOptions())
|
array_keys($this->getDowntimeTypeOptions())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
)
|
'helptext' => t(
|
||||||
);
|
'If you select the fixed option, the downtime will be in effect between the start and end '
|
||||||
$this->addElement(
|
. 'times you specify whereas a flexible downtime starts when the service enters a non-OK state '
|
||||||
new Note(
|
. '(sometime between the start and end times you specified) and lasts as long as the duration '
|
||||||
array(
|
. 'of time you enter. The duration fields do not apply for fixed downtime.'
|
||||||
'name' => 'typenote',
|
|
||||||
'value' => t(
|
|
||||||
'If you select the fixed option, the downtime will be in effect between the start and end '
|
|
||||||
. 'times you specify whereas a flexible downtime starts when the service enters a non-OK state '
|
|
||||||
. '(sometime between the start and end times you specified) and lasts as long as the duration '
|
|
||||||
. 'of time you enter. The duration fields do not apply for fixed downtime.'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -242,15 +208,10 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$this->addElements(array($hoursText, $minutesText));
|
$this->addElements(array($hoursText, $minutesText));
|
||||||
$this->addElement(
|
$this->addNote(
|
||||||
new Note(
|
t(
|
||||||
array(
|
'Enter here the duration of the downtime. Icinga will automatically delete the downtime '
|
||||||
'name' => 'flexiblenote',
|
. 'after this time expired.'
|
||||||
'value' => t(
|
|
||||||
'Enter here the duration of the downtime. Icinga will automatically delete the downtime '
|
|
||||||
. 'after this time expired.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -297,8 +258,9 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm
|
||||||
/**
|
/**
|
||||||
* Change validators at runtime
|
* Change validators at runtime
|
||||||
*
|
*
|
||||||
|
* @param array $data The user provided data that will go into validation
|
||||||
|
*
|
||||||
* @see Form::preValidation
|
* @see Form::preValidation
|
||||||
* @param array $data
|
|
||||||
*/
|
*/
|
||||||
protected function preValidation(array $data)
|
protected function preValidation(array $data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
namespace Monitoring\Form\Command;
|
namespace Monitoring\Form\Command;
|
||||||
|
|
||||||
use \Icinga\Exception\ProgrammingError;
|
use \Icinga\Exception\ProgrammingError;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for submitting passive check results
|
* Form for submitting passive check results
|
||||||
|
@ -125,16 +124,11 @@ class SubmitPassiveCheckResultForm extends CommandForm
|
||||||
*/
|
*/
|
||||||
protected function create()
|
protected function create()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote(
|
||||||
new Note(
|
t(
|
||||||
array(
|
'This command is used to submit a passive check result for particular hosts/services. It is '
|
||||||
'name' => 'commanddescription',
|
. 'particularly useful for resetting security-related objects to OK states once they have been '
|
||||||
'value' => t(
|
. 'dealt with.'
|
||||||
'This command is used to submit a passive check result for particular hosts/services. It is '
|
|
||||||
. 'particularly useful for resetting security-related objects to OK states once they have been '
|
|
||||||
. 'dealt with.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,10 +136,10 @@ class SubmitPassiveCheckResultForm extends CommandForm
|
||||||
'select',
|
'select',
|
||||||
'pluginstate',
|
'pluginstate',
|
||||||
array(
|
array(
|
||||||
'label' => t('Check Result'),
|
'label' => t('Check Result'),
|
||||||
'multiOptions' => $this->getOptions(),
|
'multiOptions' => $this->getOptions(),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
array(
|
array(
|
||||||
'Digits',
|
'Digits',
|
||||||
true
|
true
|
||||||
|
@ -157,15 +151,8 @@ class SubmitPassiveCheckResultForm extends CommandForm
|
||||||
array_keys($this->getOptions())
|
array_keys($this->getOptions())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
)
|
'helptext' => t('Set the state which should be send to Icinga for this objects.')
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'checkresultnote',
|
|
||||||
'value' => t('Set the state which should be send to Icinga for this objects.')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -173,17 +160,10 @@ class SubmitPassiveCheckResultForm extends CommandForm
|
||||||
'textarea',
|
'textarea',
|
||||||
'checkoutput',
|
'checkoutput',
|
||||||
array(
|
array(
|
||||||
'label' => t('Check Output'),
|
'label' => t('Check Output'),
|
||||||
'rows' => 2,
|
'rows' => 2,
|
||||||
'required' => true
|
'required' => true,
|
||||||
)
|
'helptext' => t('Fill in the check output string which should be send to Icinga.')
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'checkoutputnote',
|
|
||||||
'value' => t('Fill in the check output string which should be send to Icinga.')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -191,16 +171,9 @@ class SubmitPassiveCheckResultForm extends CommandForm
|
||||||
'textarea',
|
'textarea',
|
||||||
'performancedata',
|
'performancedata',
|
||||||
array(
|
array(
|
||||||
'label' => t('Performance Data'),
|
'label' => t('Performance Data'),
|
||||||
'rows' => 2
|
'rows' => 2,
|
||||||
)
|
'helptext' => t('Fill in the performance data string which should be send to Icinga.')
|
||||||
);
|
|
||||||
$this->addElement(
|
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'performancedatanote',
|
|
||||||
'value' => t('Fill in the performance data string which should be send to Icinga.')
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -29,14 +29,9 @@
|
||||||
namespace Monitoring\Form\Config\Backend;
|
namespace Monitoring\Form\Config\Backend;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
|
|
||||||
use \Icinga\Application\Config as IcingaConfig;
|
|
||||||
use \Icinga\Application\Icinga;
|
|
||||||
use \Icinga\Application\Logger;
|
|
||||||
use \Icinga\Application\DbAdapterFactory;
|
|
||||||
|
|
||||||
use \Icinga\Web\Form;
|
use \Icinga\Web\Form;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
use \Icinga\Application\Icinga;
|
||||||
|
use \Icinga\Application\DbAdapterFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for modifying a monitoring backend
|
* Form for modifying a monitoring backend
|
||||||
|
@ -88,7 +83,6 @@ class EditBackendForm extends Form
|
||||||
/**
|
/**
|
||||||
* Set a custom array of resources to be used in this form instead of the ones from DbAdapterFactory
|
* Set a custom array of resources to be used in this form instead of the ones from DbAdapterFactory
|
||||||
* (used for testing)
|
* (used for testing)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function setResources($resources)
|
public function setResources($resources)
|
||||||
{
|
{
|
||||||
|
@ -249,14 +243,7 @@ class EditBackendForm extends Form
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->removeElement('backend_type');
|
$this->removeElement('backend_type');
|
||||||
$this->addElement(
|
$this->addNote('Unknown Backend Type "' . $this->backend->type. '"');
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'error_note',
|
|
||||||
'value' => 'Unknown Backend Type "' . $this->backend->type. '"'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->addDisableButton();
|
$this->addDisableButton();
|
||||||
|
|
|
@ -31,7 +31,6 @@ namespace Monitoring\Form\Config\Instance;
|
||||||
|
|
||||||
use \Zend_Config;
|
use \Zend_Config;
|
||||||
use \Icinga\Web\Form;
|
use \Icinga\Web\Form;
|
||||||
use \Icinga\Web\Form\Element\Note;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for editing existing instances
|
* Form for editing existing instances
|
||||||
|
@ -91,14 +90,8 @@ class EditInstanceForm extends Form
|
||||||
*/
|
*/
|
||||||
private function addRemoteInstanceForm()
|
private function addRemoteInstanceForm()
|
||||||
{
|
{
|
||||||
$this->addElement(
|
$this->addNote('When configuring a remote host, you need to setup passwordless key authentication');
|
||||||
new Note(
|
|
||||||
array(
|
|
||||||
'name' => 'note_ssh_info',
|
|
||||||
'value' => 'When configuring a remote host, you need to setup passwordless key authentication'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'text',
|
'text',
|
||||||
'instance_remote_host',
|
'instance_remote_host',
|
||||||
|
|
|
@ -8,7 +8,6 @@ require_once __DIR__. '/../../../../../application/forms/Command/CommandForm.php
|
||||||
|
|
||||||
|
|
||||||
use \Zend_View;
|
use \Zend_View;
|
||||||
use \Zend_Test_PHPUnit_ControllerTestCase;
|
|
||||||
use \Test\Icinga\Web\Form\BaseFormTest;
|
use \Test\Icinga\Web\Form\BaseFormTest;
|
||||||
|
|
||||||
use Monitoring\Form\Command\CommandForm;
|
use Monitoring\Form\Command\CommandForm;
|
||||||
|
@ -32,18 +31,4 @@ class CommandFormTest extends BaseFormTest
|
||||||
$this->assertContains('444 NOTE 1</dd>', $content);
|
$this->assertContains('444 NOTE 1</dd>', $content);
|
||||||
$this->assertContains('555 NOTE 2</dd>', $content);
|
$this->assertContains('555 NOTE 2</dd>', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormNotes()
|
|
||||||
{
|
|
||||||
$form = new CommandForm();
|
|
||||||
$form->addNote('test1');
|
|
||||||
$form->addNote('test2');
|
|
||||||
|
|
||||||
$reference = array('test1', 'test2');
|
|
||||||
$this->assertCount(2, $form->getNotes());
|
|
||||||
$this->assertEquals($reference, $form->getNotes());
|
|
||||||
|
|
||||||
$form->clearNotes();
|
|
||||||
$this->assertCount(0, $form->getNotes());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue