2015-05-26 09:47:01 -04:00
|
|
|
<?php
|
2015-09-07 04:34:21 -04:00
|
|
|
|
|
|
|
|
use Icinga\Web\Navigation\Navigation;
|
|
|
|
|
|
2016-12-05 07:20:27 -05:00
|
|
|
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
2015-09-07 04:34:21 -04:00
|
|
|
|
2016-12-05 07:20:27 -05:00
|
|
|
$navigation = new Navigation();
|
|
|
|
|
$notes = trim($object->notes);
|
2015-09-07 04:34:21 -04:00
|
|
|
|
2015-05-26 09:47:01 -04:00
|
|
|
$links = $object->getNotesUrls();
|
2015-09-07 04:34:21 -04:00
|
|
|
if (! empty($links)) {
|
|
|
|
|
foreach ($links as $link) {
|
|
|
|
|
$navigation->addItem(
|
2015-10-01 11:49:43 -04:00
|
|
|
// add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
|
|
|
|
|
$this->icon(
|
|
|
|
|
'forward',
|
|
|
|
|
$this->translate('Link opens in new window'),
|
|
|
|
|
array('aria-label' => $this->translate('Link opens in new window'))
|
2015-10-01 11:51:42 -04:00
|
|
|
) . ' ' . $this->escape($link),
|
2015-09-07 04:34:21 -04:00
|
|
|
array(
|
|
|
|
|
'url' => $link,
|
2015-09-28 03:05:17 -04:00
|
|
|
'target' => '_blank',
|
|
|
|
|
'renderer' => array(
|
|
|
|
|
'NavigationItemRenderer',
|
|
|
|
|
'escape_label' => false
|
|
|
|
|
)
|
2015-09-07 04:34:21 -04:00
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-05-26 09:47:01 -04:00
|
|
|
|
2016-12-05 07:20:27 -05:00
|
|
|
if (($navigation->isEmpty() || ! $navigation->hasRenderableItems()) && $notes === '') {
|
2015-09-07 04:34:21 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
?>
|
2015-05-26 09:47:01 -04:00
|
|
|
<tr>
|
2016-12-05 07:20:27 -05:00
|
|
|
<th><?= $this->translate('Notes') ?></th>
|
|
|
|
|
<td>
|
|
|
|
|
<?= $navigation->getRenderer() ?>
|
|
|
|
|
<?php if ($notes !== ''): ?>
|
2019-07-25 07:20:54 -04:00
|
|
|
<?= $this->markdown($notes, [
|
|
|
|
|
'id' => $object->type . '-notes',
|
|
|
|
|
'class' => 'collapsible',
|
|
|
|
|
'data-visible-height' => 200
|
|
|
|
|
]) ?>
|
2016-12-05 07:20:27 -05:00
|
|
|
<?php endif ?>
|
|
|
|
|
</td>
|
2015-09-07 04:34:21 -04:00
|
|
|
</tr>
|