Show "Remove problem acknowledgement" in multi-select views
fixes #10469
This commit is contained in:
parent
23b5777b05
commit
102ed40378
|
@ -12,8 +12,40 @@ use Icinga\Web\Notification;
|
|||
class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
||||
{
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Zend_Form::init() For the method documentation.
|
||||
* Whether to show the submit label next to the remove icon
|
||||
*
|
||||
* The submit label is disabled in detail views but should be enabled in multi-select views.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $labelEnabled = false;
|
||||
|
||||
/**
|
||||
* Whether to show the submit label next to the remove icon
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isLabelEnabled()
|
||||
{
|
||||
return $this->labelEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to show the submit label next to the remove icon
|
||||
*
|
||||
* @param bool $labelEnabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLabelEnabled($labelEnabled)
|
||||
{
|
||||
$this->labelEnabled = (bool) $labelEnabled;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
|
@ -36,7 +68,7 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
|||
),
|
||||
'escape' => false,
|
||||
'ignore' => true,
|
||||
'label' => $this->getView()->icon('cancel'),
|
||||
'label' => $this->getSubmitLabel(),
|
||||
'title' => $this->translatePlural(
|
||||
'Remove problem acknowledgement',
|
||||
'Remove problem acknowledgements',
|
||||
|
@ -45,12 +77,29 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
|||
'type' => 'submit'
|
||||
)
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSubmitLabel()
|
||||
{
|
||||
$label = $this->getView()->icon('cancel');
|
||||
if ($this->isLabelEnabled()) {
|
||||
$label .= $this->translatePlural(
|
||||
'Remove problem acknowledgement',
|
||||
'Remove problem acknowledgements',
|
||||
count($this->objects)
|
||||
);
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function onSuccess()
|
||||
{
|
||||
|
@ -66,6 +115,7 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
|||
'Removing problem acknowledgements..',
|
||||
count($this->objects)
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
'<b>' . $acknowledgedCount . '</b>'
|
||||
); ?> </th>
|
||||
<td>
|
||||
<?= $removeAckForm ?>
|
||||
<?= $removeAckForm->setLabelEnabled(true) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
) ?>
|
||||
</th>
|
||||
<td>
|
||||
<?= $removeAckForm ?>
|
||||
<?= $removeAckForm->setLabelEnabled(true) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
|
|
Loading…
Reference in New Issue