mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
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
|
class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* (non-PHPDoc)
|
* Whether to show the submit label next to the remove icon
|
||||||
* @see \Zend_Form::init() For the method documentation.
|
*
|
||||||
|
* 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()
|
public function init()
|
||||||
{
|
{
|
||||||
@ -36,7 +68,7 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
|||||||
),
|
),
|
||||||
'escape' => false,
|
'escape' => false,
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'label' => $this->getView()->icon('cancel'),
|
'label' => $this->getSubmitLabel(),
|
||||||
'title' => $this->translatePlural(
|
'title' => $this->translatePlural(
|
||||||
'Remove problem acknowledgement',
|
'Remove problem acknowledgement',
|
||||||
'Remove problem acknowledgements',
|
'Remove problem acknowledgements',
|
||||||
@ -45,12 +77,29 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
|||||||
'type' => 'submit'
|
'type' => 'submit'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-PHPDoc)
|
* {@inheritdoc}
|
||||||
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
|
*/
|
||||||
|
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()
|
public function onSuccess()
|
||||||
{
|
{
|
||||||
@ -66,6 +115,7 @@ class RemoveAcknowledgementCommandForm extends ObjectsCommandForm
|
|||||||
'Removing problem acknowledgements..',
|
'Removing problem acknowledgements..',
|
||||||
count($this->objects)
|
count($this->objects)
|
||||||
));
|
));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
'<b>' . $acknowledgedCount . '</b>'
|
'<b>' . $acknowledgedCount . '</b>'
|
||||||
); ?> </th>
|
); ?> </th>
|
||||||
<td>
|
<td>
|
||||||
<?= $removeAckForm ?>
|
<?= $removeAckForm->setLabelEnabled(true) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
) ?>
|
) ?>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<?= $removeAckForm ?>
|
<?= $removeAckForm->setLabelEnabled(true) ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user