icingaweb2/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml

69 lines
2.8 KiB
PHTML

<div class="comment-author">
<?php if ($comment->objecttype === 'service') {
echo $this->icon('service', $this->translate('Service'));
echo $this->qlink(
$comment->host_display_name . ': ' . $comment->service_display_name,
'monitoring/service/show',
array(
'host' => $comment->host_name,
'service' => $comment->service_description
),
array(
'title' => sprintf(
$this->translate('Show detailed information for this comment about service %s on host %s'),
$comment->service_display_name,
$comment->host_display_name
)
)
);
} else {
echo $this->icon('host', $this->translate('Host'));
echo $this->qlink(
$comment->host_display_name,
'monitoring/host/show',
array('host' => $comment->host_name),
array(
'title' => sprintf(
$this->translate('Show detailed information for this comment about host %s'),
$comment->host_display_name
)
)
);
} ?>
<span class="comment-time">
<?= $this->translate('by') ?>
<?= $this->escape($comment->author) ?>
<?= $this->timeAgo($comment->timestamp) ?>
</span>
<span class="comment-icons" data-base-target="_self">
<?= $comment->persistent ? $this->icon('attach', 'This comment is persistent') : '' ?>
<?= $comment->expiration ? $this->icon('clock', sprintf(
$this->translate('This comment expires on %s at %s'),
$this->formatDate($comment->expiration),
$this->formatTime($comment->expiration)
)) : '' ?>
<?php if (isset($delCommentForm)) {
// Form is unset if the current user lacks the respective permission
$uniqId = uniqid();
$buttonId = 'delete-comment-' . $uniqId;
$textId = 'comment-' . $uniqId;
$deleteButton = clone $delCommentForm;
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm $deleteButton */
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action');
$deleteButton->populate(
array(
'comment_id' => $comment->id,
'comment_is_service' => isset($comment->service_description),
'comment_name' => $comment->name
)
);
$deleteButton->getElement('btn_submit')
->setAttrib('aria-label', $this->translate('Delete comment'))
->setAttrib('id', $buttonId)
->setAttrib('aria-describedby', $buttonId . ' ' . $textId);
echo $deleteButton;
} ?>
</span>
</div>
<?= $this->nl2br($this->markdown($comment->comment, isset($textId) ? ['id' => $textId] : null)) ?>