diff --git a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php index a9c1549af..f54c8bdb2 100644 --- a/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AcknowledgeProblemCommandForm.php @@ -18,11 +18,13 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm { /** * (non-PHPDoc) - * @see \Zend_Form::init() For the method documentation. + * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. */ - public function init() + public function getSubmitLabel() { - $this->setSubmitLabel(mt('monitoring', 'Acknowledge Problem')); + return mtp( + 'monitoring', 'Acknowledge problem', 'Acknowledge problems', count($this->objects) + ); } /** @@ -118,7 +120,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'description' => mt( 'monitoring', 'If you want the acknowledgement to disable notifications until the host or service recovers,' - . 'check this option.' + . ' check this option.' ) ) ), @@ -131,7 +133,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm 'description' => mt( 'monitoring', 'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,' - . 'uncheck this option.' + . ' uncheck this option.' ) ) ) @@ -160,7 +162,12 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm } $this->getTransport($request)->send($ack); } - Notification::success(mt('monitoring', 'Acknowledging problem..')); + Notification::success(mtp( + 'monitoring', + 'Acknowledging problem..', + 'Acknowledging problems..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php index 1183070fc..a89353d52 100644 --- a/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/AddCommentCommandForm.php @@ -15,11 +15,13 @@ class AddCommentCommandForm extends ObjectsCommandForm { /** * (non-PHPDoc) - * @see \Zend_Form::init() For the method documentation. + * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. */ - public function init() + public function getSubmitLabel() { - $this->setSubmitLabel(mt('monitoring', 'Add Comment')); + return mtp( + 'monitoring', 'Add comment', 'Add comments', count($this->objects) + ); } /** @@ -82,10 +84,15 @@ class AddCommentCommandForm extends ObjectsCommandForm $comment->setObject($object); $comment->setComment($this->getElement('comment')->getValue()); $comment->setAuthor($request->getUser()->getUsername()); - $comment->setPersistent((bool) $this->getElement('persistent')->getValue()); + $comment->setPersistent($this->getElement('persistent')->isChecked()); $this->getTransport($request)->send($comment); } - Notification::success(mt('monitoring', 'Adding comment..')); + Notification::success(mtp( + 'monitoring', + 'Adding comment..', + 'Adding comments..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php index 6cdf620f4..a77040ee5 100644 --- a/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/CheckNowCommandForm.php @@ -45,7 +45,7 @@ class CheckNowCommandForm extends ObjectsCommandForm 'btn_submit', array( 'ignore' => true, - 'label' => mt('monitoring', 'Check Now'), + 'label' => mt('monitoring', 'Check now'), 'decorators' => array('ViewHelper') ) ) @@ -72,7 +72,12 @@ class CheckNowCommandForm extends ObjectsCommandForm ->setCheckTime(time()); $this->getTransport($request)->send($check); } - Notification::success(mt('monitoring', 'Scheduling check..')); + Notification::success(mtp( + 'monitoring', + 'Scheduling check..', + 'Scheduling checks..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php index c1a24ef50..4c7df0141 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php @@ -19,7 +19,6 @@ class DeleteCommentCommandForm extends ObjectsCommandForm */ public function init() { - $this->setSubmitLabel(mt('monitoring', 'X')); $this->setAttrib('class', 'inline link-like'); } @@ -36,11 +35,34 @@ class DeleteCommentCommandForm extends ObjectsCommandForm array( 'required' => true ) + ), + array( + 'hidden', + 'redirect' ) )); return $this; } + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::addSubmitButton() For the method documentation. + */ + public function addSubmitButton() + { + $this->addElement( + 'submit', + 'btn_submit', + array( + 'ignore' => true, + 'label' => 'X', + 'title' => mt('monitoring', 'Delete comment'), + 'decorators' => array('ViewHelper') + ) + ); + return $this; + } + /** * (non-PHPDoc) * @see \Icinga\Web\Form::onSuccess() For the method documentation. @@ -55,6 +77,10 @@ class DeleteCommentCommandForm extends ObjectsCommandForm ->setCommentId($this->getElement('comment_id')->getValue()); $this->getTransport($request)->send($delComment); } + $redirect = $this->getElement('redirect')->getValue(); + if (! empty($redirect)) { + $this->setRedirectUrl($redirect); + } Notification::success(mt('monitoring', 'Deleting comment..')); return true; } diff --git a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php index 4558b71da..ae712eddb 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteDowntimeCommandForm.php @@ -19,7 +19,6 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm */ public function init() { - $this->setSubmitLabel(mt('monitoring', 'X')); $this->setAttrib('class', 'inline link-like'); } @@ -36,11 +35,34 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm array( 'required' => true ) + ), + array( + 'hidden', + 'redirect' ) )); return $this; } + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::addSubmitButton() For the method documentation. + */ + public function addSubmitButton() + { + $this->addElement( + 'submit', + 'btn_submit', + array( + 'ignore' => true, + 'label' => 'X', + 'title' => mt('monitoring', 'Delete downtime'), + 'decorators' => array('ViewHelper') + ) + ); + return $this; + } + /** * (non-PHPDoc) * @see \Icinga\Web\Form::onSuccess() For the method documentation. @@ -55,6 +77,10 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm ->setDowntimeId($this->getElement('downtime_id')->getValue()); $this->getTransport($request)->send($delDowntime); } + $redirect = $this->getElement('redirect')->getValue(); + if (! empty($redirect)) { + $this->setRedirectUrl($redirect); + } Notification::success(mt('monitoring', 'Deleting downtime..')); return true; } diff --git a/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php b/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php index c76cca19c..6ccd0633d 100644 --- a/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/RemoveAcknowledgementCommandForm.php @@ -19,10 +19,20 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm */ public function init() { - $this->setSubmitLabel(mt('monitoring', 'Remove Problem Acknowledgement')); $this->setAttrib('class', 'inline link-like'); } + /** + * (non-PHPDoc) + * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. + */ + public function getSubmitLabel() + { + return mtp( + 'monitoring', 'Remove problem acknowledgement', 'Remove problem acknowledgements', count($this->objects) + ); + } + /** * (non-PHPDoc) * @see \Icinga\Web\Form::onSuccess() For the method documentation. @@ -35,7 +45,12 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm $removeAck->setObject($object); $this->getTransport($request)->send($removeAck); } - Notification::success(mt('monitoring', 'Removing problem acknowledgement..')); + Notification::success(mtp( + 'monitoring', + 'Removing problem acknowledgement..', + 'Removing problem acknowledgements..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php index 81a277004..e7d71b9f2 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostCheckCommandForm.php @@ -51,7 +51,12 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm ->setOfAllServices($this->getElement('all_services')->isChecked()); $this->scheduleCheck($check, $request); } - Notification::success(mt('monitoring', 'Scheduling host check..')); + Notification::success(mtp( + 'monitoring', + 'Scheduling host check..', + 'Scheduling host checks..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php index a56d11a5c..ee7dff5bb 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleHostDowntimeCommandForm.php @@ -87,7 +87,12 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm $hostDowntime->setObject($object); $this->scheduleDowntime($hostDowntime, $request); } - Notification::success(mt('monitoring', 'Scheduling host downtime..')); + Notification::success(mtp( + 'monitoring', + 'Scheduling host downtime..', + 'Scheduling host downtimes..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php index ae8f23384..0a54e2af4 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php @@ -18,11 +18,13 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm { /** * (non-PHPDoc) - * @see \Zend_Form::init() For the method documentation. + * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. */ - public function init() + public function getSubmitLabel() { - $this->setSubmitLabel(mt('monitoring', 'Schedule Check')); + return mtp( + 'monitoring', 'Schedule check', 'Schedule checks', count($this->objects) + ); } /** @@ -62,7 +64,7 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm 'description' => mt( 'monitoring', '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.' ) ) ) @@ -70,6 +72,12 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm return $this; } + /** + * Schedule a check + * + * @param ScheduleServiceCheckCommand $check + * @param Request $request + */ public function scheduleCheck(ScheduleServiceCheckCommand $check, Request $request) { $check @@ -90,7 +98,12 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm $check->setObject($object); $this->scheduleCheck($check, $request); } - Notification::success(mt('monitoring', 'Scheduling service check..')); + Notification::success(mtp( + 'monitoring', + 'Scheduling service check..', + 'Scheduling service checks..', + count($this->objects) + )); return true; } } diff --git a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php index 508c3eed0..86e06f071 100644 --- a/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/ScheduleServiceDowntimeCommandForm.php @@ -29,11 +29,13 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm /** * (non-PHPDoc) - * @see \Zend_Form::init() For the method documentation. + * @see \Icinga\Web\Form::getSubmitLabel() For the method documentation. */ - public function init() + public function getSubmitLabel() { - $this->setSubmitLabel(mt('monitoring', 'Schedule Downtime')); + return mtp( + 'monitoring', 'Schedule downtime', 'Schedule downtimes', count($this->objects) + ); } /** @@ -205,7 +207,12 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm $downtime->setObject($object); $this->scheduleDowntime($downtime, $request); } - Notification::success(mt('monitoring', 'Scheduling service downtime..')); + Notification::success(mtp( + 'monitoring', + 'Scheduling service downtime..', + 'Scheduling service downtimes..', + count($this->objects) + )); return true; } }