monitoring: Use View::nl2br() and new comment-list style in the comment overview

refs #10603
This commit is contained in:
Eric Lippmann 2015-11-20 15:18:29 +01:00
parent 91e576d530
commit 24d43899a7

View File

@ -1,10 +1,11 @@
<div class="comment-header"> <div class="comment-author">
<?php if ($comment->objecttype === 'service'): ?> <?php if ($comment->objecttype === 'service') {
<?= $this->icon('service', $this->translate('Service')) ?> <?= $this->qlink( echo $this->icon('service', $this->translate('Service'));
echo $this->qlink(
$comment->host_display_name . ': ' . $comment->service_display_name, $comment->host_display_name . ': ' . $comment->service_display_name,
'monitoring/service/show', 'monitoring/service/show',
array( array(
'host' => $comment->host_name, 'host' => $comment->host_name,
'service' => $comment->service_description 'service' => $comment->service_description
), ),
array( array(
@ -14,9 +15,10 @@
$comment->host_display_name $comment->host_display_name
) )
) )
) ?> );
<?php else: ?> } else {
<?= $this->icon('host', $this->translate('Host')) ?> <?= $this->qlink( echo $this->icon('host', $this->translate('Host'));
echo $this->qlink(
$comment->host_display_name, $comment->host_display_name,
'monitoring/host/show', 'monitoring/host/show',
array('host' => $comment->host_name), array('host' => $comment->host_name),
@ -26,33 +28,33 @@
$comment->host_display_name $comment->host_display_name
) )
) )
) ?> );
<?php endif ?> } ?>
<span class="comment-meta"> <span class="comment-time">
<?= $this->translate('by') ?> <?= $this->translate('by') ?>
<?= $this->escape($comment->author) ?> <?= $this->escape($comment->author) ?>
<?= $this->timeAgo($comment->timestamp) ?> <?= $this->timeAgo($comment->timestamp) ?>
<span class="meta-icons" data-base-target="_self"> </span>
<?= $comment->persistent ? $this->icon('attach', 'This comment is persistent.') : '' ?> <span class="comment-icons" data-base-target="_self">
<?= $comment->expiration ? $this->icon('clock', sprintf( <?= $comment->persistent ? $this->icon('attach', 'This comment is persistent.') : '' ?>
$this->translate('This comment expires %s.'), <?= $comment->expiration ? $this->icon('clock', sprintf(
$this->timeUntil($comment->expiration) $this->translate('This comment expires %s.'),
)) : '' ?> $this->timeUntil($comment->expiration)
<?php if (isset($delCommentForm)) { )) : '' ?>
$deleteButton = clone $delCommentForm; <?php if (isset($delCommentForm)) {
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm $deleteButton */ $deleteButton = clone $delCommentForm;
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action'); /** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm $deleteButton */
$deleteButton->populate( $deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action');
array( $deleteButton->populate(
'comment_id' => $comment->id, array(
'comment_is_service' => isset($comment->service_description) 'comment_id' => $comment->id,
) 'comment_is_service' => isset($comment->service_description)
); )
echo $deleteButton; );
} ?> echo $deleteButton;
</span> } ?>
</span> </span>
</div> </div>
<p class="comment-text"> <p class="comment-text">
<?= $this->escape($comment->comment) ?> <?= $this->nl2br($this->escape($comment->comment)) ?>
</p> </p>