monitoring/commands: Use translate plurar in the object command forms

refs #6593
This commit is contained in:
Eric Lippmann 2014-09-19 14:25:49 +02:00
parent 5b5f553d0d
commit 72a9a53201
10 changed files with 144 additions and 28 deletions

View File

@ -18,11 +18,13 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
{ {
/** /**
* (non-PHPDoc) * (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( 'description' => mt(
'monitoring', 'monitoring',
'If you want the acknowledgement to disable notifications until the host or service recovers,' '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( 'description' => mt(
'monitoring', 'monitoring',
'If you do not want an acknowledgement notification to be sent out to the appropriate contacts,' '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); $this->getTransport($request)->send($ack);
} }
Notification::success(mt('monitoring', 'Acknowledging problem..')); Notification::success(mtp(
'monitoring',
'Acknowledging problem..',
'Acknowledging problems..',
count($this->objects)
));
return true; return true;
} }
} }

View File

@ -15,11 +15,13 @@ class AddCommentCommandForm extends ObjectsCommandForm
{ {
/** /**
* (non-PHPDoc) * (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->setObject($object);
$comment->setComment($this->getElement('comment')->getValue()); $comment->setComment($this->getElement('comment')->getValue());
$comment->setAuthor($request->getUser()->getUsername()); $comment->setAuthor($request->getUser()->getUsername());
$comment->setPersistent((bool) $this->getElement('persistent')->getValue()); $comment->setPersistent($this->getElement('persistent')->isChecked());
$this->getTransport($request)->send($comment); $this->getTransport($request)->send($comment);
} }
Notification::success(mt('monitoring', 'Adding comment..')); Notification::success(mtp(
'monitoring',
'Adding comment..',
'Adding comments..',
count($this->objects)
));
return true; return true;
} }
} }

View File

@ -45,7 +45,7 @@ class CheckNowCommandForm extends ObjectsCommandForm
'btn_submit', 'btn_submit',
array( array(
'ignore' => true, 'ignore' => true,
'label' => mt('monitoring', 'Check Now'), 'label' => mt('monitoring', 'Check now'),
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
) )
) )
@ -72,7 +72,12 @@ class CheckNowCommandForm extends ObjectsCommandForm
->setCheckTime(time()); ->setCheckTime(time());
$this->getTransport($request)->send($check); $this->getTransport($request)->send($check);
} }
Notification::success(mt('monitoring', 'Scheduling check..')); Notification::success(mtp(
'monitoring',
'Scheduling check..',
'Scheduling checks..',
count($this->objects)
));
return true; return true;
} }
} }

View File

@ -19,7 +19,6 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
*/ */
public function init() public function init()
{ {
$this->setSubmitLabel(mt('monitoring', 'X'));
$this->setAttrib('class', 'inline link-like'); $this->setAttrib('class', 'inline link-like');
} }
@ -36,11 +35,34 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
array( array(
'required' => true 'required' => true
) )
),
array(
'hidden',
'redirect'
) )
)); ));
return $this; 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) * (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation. * @see \Icinga\Web\Form::onSuccess() For the method documentation.
@ -55,6 +77,10 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
->setCommentId($this->getElement('comment_id')->getValue()); ->setCommentId($this->getElement('comment_id')->getValue());
$this->getTransport($request)->send($delComment); $this->getTransport($request)->send($delComment);
} }
$redirect = $this->getElement('redirect')->getValue();
if (! empty($redirect)) {
$this->setRedirectUrl($redirect);
}
Notification::success(mt('monitoring', 'Deleting comment..')); Notification::success(mt('monitoring', 'Deleting comment..'));
return true; return true;
} }

View File

@ -19,7 +19,6 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
*/ */
public function init() public function init()
{ {
$this->setSubmitLabel(mt('monitoring', 'X'));
$this->setAttrib('class', 'inline link-like'); $this->setAttrib('class', 'inline link-like');
} }
@ -36,11 +35,34 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
array( array(
'required' => true 'required' => true
) )
),
array(
'hidden',
'redirect'
) )
)); ));
return $this; 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) * (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation. * @see \Icinga\Web\Form::onSuccess() For the method documentation.
@ -55,6 +77,10 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
->setDowntimeId($this->getElement('downtime_id')->getValue()); ->setDowntimeId($this->getElement('downtime_id')->getValue());
$this->getTransport($request)->send($delDowntime); $this->getTransport($request)->send($delDowntime);
} }
$redirect = $this->getElement('redirect')->getValue();
if (! empty($redirect)) {
$this->setRedirectUrl($redirect);
}
Notification::success(mt('monitoring', 'Deleting downtime..')); Notification::success(mt('monitoring', 'Deleting downtime..'));
return true; return true;
} }

View File

@ -19,10 +19,20 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
*/ */
public function init() public function init()
{ {
$this->setSubmitLabel(mt('monitoring', 'Remove Problem Acknowledgement'));
$this->setAttrib('class', 'inline link-like'); $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) * (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation. * @see \Icinga\Web\Form::onSuccess() For the method documentation.
@ -35,7 +45,12 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
$removeAck->setObject($object); $removeAck->setObject($object);
$this->getTransport($request)->send($removeAck); $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; return true;
} }
} }

View File

@ -51,7 +51,12 @@ class ScheduleHostCheckCommandForm extends ScheduleServiceCheckCommandForm
->setOfAllServices($this->getElement('all_services')->isChecked()); ->setOfAllServices($this->getElement('all_services')->isChecked());
$this->scheduleCheck($check, $request); $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; return true;
} }
} }

View File

@ -87,7 +87,12 @@ class ScheduleHostDowntimeCommandForm extends ScheduleServiceDowntimeCommandForm
$hostDowntime->setObject($object); $hostDowntime->setObject($object);
$this->scheduleDowntime($hostDowntime, $request); $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; return true;
} }
} }

View File

@ -18,11 +18,13 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
{ {
/** /**
* (non-PHPDoc) * (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( 'description' => mt(
'monitoring', 'monitoring',
'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.'
) )
) )
) )
@ -70,6 +72,12 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
return $this; return $this;
} }
/**
* Schedule a check
*
* @param ScheduleServiceCheckCommand $check
* @param Request $request
*/
public function scheduleCheck(ScheduleServiceCheckCommand $check, Request $request) public function scheduleCheck(ScheduleServiceCheckCommand $check, Request $request)
{ {
$check $check
@ -90,7 +98,12 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
$check->setObject($object); $check->setObject($object);
$this->scheduleCheck($check, $request); $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; return true;
} }
} }

View File

@ -29,11 +29,13 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
/** /**
* (non-PHPDoc) * (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); $downtime->setObject($object);
$this->scheduleDowntime($downtime, $request); $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; return true;
} }
} }