1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<div class="comment-author">
<?php if ($comment->objecttype === 'service') {
echo '<span class="service-on">';
echo sprintf(
$this->translate('%s on %s', 'service on host'),
$this->qlink(
$comment->service_display_name,
'monitoring/service/show',
[
'host' => $comment->host_name,
'service' => $comment->service_description
],
[
'title' => sprintf(
$this->translate('Show detailed information for service %s on host %s'),
$comment->service_display_name,
$comment->host_display_name
)
]
),
$this->qlink(
$comment->host_display_name,
'monitoring/host/show',
['host' => $comment->host_name],
[
'title' => sprintf(
$this->translate('Show detailed information for host %s'),
$comment->host_display_name
)
]
)
);
echo '</span>';
} else {
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 dont-print');
$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->markdownLine($comment->comment, isset($textId) ? ['id' => $textId, 'class' => 'caption'] : [ 'class' => 'caption'])) ?>
|