Respect newlines in host and service notes

fixes #12313
This commit is contained in:
Alexander A. Klimov 2016-12-05 13:20:27 +01:00
parent 4205eb4cc9
commit cdc3d43a04
1 changed files with 11 additions and 12 deletions

View File

@ -2,16 +2,10 @@
use Icinga\Web\Navigation\Navigation;
$navigation = new Navigation();
//$navigation->load($object->getType() . '-note');
foreach ($navigation as $item) {
$item->setObject($object);
}
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
$notes = trim($object->getNotes());
if ($notes) {
$navigation->addItem($notes);
}
$navigation = new Navigation();
$notes = trim($object->notes);
$links = $object->getNotesUrls();
if (! empty($links)) {
@ -35,11 +29,16 @@ if (! empty($links)) {
}
}
if ($navigation->isEmpty() || !$navigation->hasRenderableItems()) {
if (($navigation->isEmpty() || ! $navigation->hasRenderableItems()) && $notes === '') {
return;
}
?>
<tr>
<th><?= $this->translate('Notes'); ?></th>
<?= $navigation->getRenderer()->setElementTag('td')->setCssClass('notes'); ?>
<th><?= $this->translate('Notes') ?></th>
<td>
<?= $navigation->getRenderer() ?>
<?php if ($notes !== ''): ?>
<p><?= $this->nl2br($this->escape($notes)) ?></p>
<?php endif ?>
</td>
</tr>