mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
notes.phtml: Use the new Navigation to load and render notes urls
refs #5600
This commit is contained in:
parent
4983d46dd7
commit
716e532d16
@ -1,26 +1,38 @@
|
|||||||
<?php
|
<?php
|
||||||
$notes = trim($object->getNotes());
|
|
||||||
$links = $object->getNotesUrls();
|
|
||||||
|
|
||||||
if (! empty($links) || ! empty($notes)): ?>
|
use Icinga\Web\Navigation\Navigation;
|
||||||
|
|
||||||
|
$navigation = new Navigation();
|
||||||
|
|
||||||
|
$notes = trim($object->getNotes());
|
||||||
|
if ($notes) {
|
||||||
|
$navigation->addItem($notes);
|
||||||
|
}
|
||||||
|
|
||||||
|
$links = $object->getNotesUrls();
|
||||||
|
if (! empty($links)) {
|
||||||
|
// add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
|
||||||
|
$newTabInfo = sprintf(
|
||||||
|
'<span class="info-box display-on-hover"> %s </span>',
|
||||||
|
$this->translate('opens in new window')
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($links as $link) {
|
||||||
|
$navigation->addItem(
|
||||||
|
$this->escape($link) . $newTabInfo,
|
||||||
|
array(
|
||||||
|
'url' => $link,
|
||||||
|
'target' => '_blank'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($navigation->isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->translate('Notes') ?></th>
|
<th><?= $this->translate('Notes'); ?></th>
|
||||||
<td>
|
<?= $navigation->getRenderer()->setElementTag('td'); ?>
|
||||||
<?php
|
</tr>
|
||||||
if (! empty($notes)) {
|
|
||||||
echo $notes . '<br>';
|
|
||||||
}
|
|
||||||
// add warning to links that open in new tabs to improve accessibility, as recommended by WCAG20 G201
|
|
||||||
$newTabInfo = sprintf(
|
|
||||||
'<span class="info-box display-on-hover"> %s </span>',
|
|
||||||
$this->translate('opens in new window')
|
|
||||||
);
|
|
||||||
$linkText = '<a href="%s" target="_blank">%s ' . $newTabInfo . '</a>';
|
|
||||||
foreach ($links as $i => $link) {
|
|
||||||
$links[$i] = sprintf($linkText, $this->escape($link), $this->escape($link));
|
|
||||||
}
|
|
||||||
echo implode('<br>', $links);
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endif ?>
|
|
Loading…
x
Reference in New Issue
Block a user