Merge branch 'feature/allow-changing-default-of-command-options-11952'

resolves #11952
This commit is contained in:
Eric Lippmann 2016-12-08 14:23:03 +01:00
commit aee4c4e6a8
5 changed files with 19 additions and 7 deletions

View File

@ -5,6 +5,7 @@ namespace Icinga\Module\Monitoring\Forms\Command\Object;
use DateTime;
use DateInterval;
use Icinga\Application\Config;
use Icinga\Module\Monitoring\Command\Object\AcknowledgeProblemCommand;
use Icinga\Web\Notification;
@ -40,6 +41,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
*/
public function createElements(array $formData = array())
{
$config = Config::module('monitoring');
$this->addElements(array(
array(
'textarea',
@ -59,6 +62,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'persistent',
array(
'label' => $this->translate('Persistent Comment'),
'value' => (bool) $config->get('settings', 'acknowledge_persistent', false),
'description' => $this->translate(
'If you would like the comment to remain even when the acknowledgement is removed, check this'
. ' option.'
@ -70,6 +74,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'expire',
array(
'label' => $this->translate('Use Expire Time'),
'value' => (bool) $config->get('settings', 'acknowledge_expire', false),
'description' => $this->translate(
'If the acknowledgement should expire, check this option.'
),
@ -109,7 +114,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'sticky',
array(
'label' => $this->translate('Sticky Acknowledgement'),
'value' => false,
'value' => (bool) $config->get('settings', 'acknowledge_sticky', false),
'description' => $this->translate(
'If you want the acknowledgement to remain until the host or service recovers even if the host'
. ' or service changes state, check this option.'
@ -121,7 +126,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
'notify',
array(
'label' => $this->translate('Send Notification'),
'value' => true,
'value' => (bool) $config->get('settings', 'acknowledge_notify', true),
'description' => $this->translate(
'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,'
. ' uncheck this option.'

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Monitoring\Forms\Command\Object;
use Icinga\Application\Config;
use Icinga\Module\Monitoring\Command\Object\AddCommentCommand;
use Icinga\Web\Notification;
@ -53,7 +54,7 @@ class AddCommentCommandForm extends ObjectsCommandForm
'persistent',
array(
'label' => $this->translate('Persistent'),
'value' => true,
'value' => (bool) Config::module('monitoring')->get('settings', 'comment_persistent', true),
'description' => $this->translate(
'If you uncheck this option, the comment will automatically be deleted the next time Icinga is'
. ' restarted.'

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Monitoring\Forms\Command\Object;
use Icinga\Application\Config;
use Icinga\Module\Monitoring\Command\Object\ScheduleHostCheckCommand;
use Icinga\Web\Notification;
@ -17,6 +18,8 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm
*/
public function createElements(array $formData = array())
{
$config = Config::module('monitoring');
parent::createElements($formData);
$this->addElements(array(
array(
@ -24,6 +27,7 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm
'all_services',
array(
'label' => $this->translate('All Services'),
'value' => (bool) $config->get('settings', 'hostcheck_all_services', false),
'description' => $this->translate(
'Schedule check for all services on the hosts and the hosts themselves.'
)

View File

@ -29,8 +29,7 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
'description' => $this->translate(
'Schedule downtime for all services on the hosts and the hosts themselves.'
),
'label' => $this->translate('All Services'),
'value' => false
'label' => $this->translate('All Services')
)
);

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Monitoring\Forms\Command\Object;
use Icinga\Application\Config;
use Icinga\Module\Monitoring\Command\Object\SendCustomNotificationCommand;
use Icinga\Web\Notification;
@ -34,6 +35,8 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
*/
public function createElements(array $formData = array())
{
$config = Config::module('monitoring');
$this->addElements(array(
array(
'textarea',
@ -53,7 +56,7 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
'forced',
array(
'label' => $this->translate('Forced'),
'value' => false,
'value' => (bool) $config->get('settings', 'custom_notification_forced', false),
'description' => $this->translate(
'If you check this option, the notification is sent out regardless of time restrictions and'
. ' whether or not notifications are enabled.'
@ -68,7 +71,7 @@ class SendCustomNotificationCommandForm extends ObjectsCommandForm
'broadcast',
array(
'label' => $this->translate('Broadcast'),
'value' => false,
'value' => (bool) $config->get('settings', 'custom_notification_broadcast', false),
'description' => $this->translate(
'If you check this option, the notification is sent out to all normal and escalated contacts.'
)