Skip to content

Commit

Permalink
monitoring: Use comment-list markup for downtimes instead of feed-list
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
lippserd committed Oct 28, 2015
1 parent bb33a43 commit 0b332bb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 49 deletions.
Expand Up @@ -30,7 +30,6 @@ if (! $this->compact): ?>
$this->stateName = Host::getStateText($downtime->host_state);
}
$this->downtime = $downtime;
$this->displayComment = true;
?>
<tr href="<?= $this->href('monitoring/downtime/show', array('downtime_id' => $downtime->id)) ?>">
<?= $this->render('partials/downtime/downtime-header.phtml'); ?>
Expand Down
Expand Up @@ -8,7 +8,7 @@
<?php endif; ?>
</td>
<td>
<span class="comment-header">
<div class="comment-header">
<?php if ($isService): ?>
<?= $this->icon('service', $this->translate('Service')); ?> <?= $this->qlink(
$downtime->host_display_name . ': ' . $downtime->service_display_name,
Expand Down Expand Up @@ -38,11 +38,10 @@
)
); ?>
<?php endif ?>

<?= $this->translate('by') ?>
<?= $this->escape($downtime->author_name) ?>

<span class="pull-right">
<span class="comment-meta">
<?= $this->translate('by') ?>
<?= $this->escape($downtime->author_name) ?>
<span class="meta-icons">
<?php if ($downtime->is_flexible): ?>
<?= $this->icon('magic', $this->translate('This downtime is flexible')); ?>
<?php endif ?>
Expand All @@ -52,22 +51,23 @@
<?php endif ?>

<?php if (isset($delDowntimeForm)): // Form is unset if the current user lacks the respective permission ?>
<?php
$delDowntimeForm = clone $delDowntimeForm;
$delDowntimeForm->populate(
array(
'downtime_id' => $downtime->id,
'downtime_is_service' => isset($downtime->service_description)
)
);
echo $delDowntimeForm;
?>
<?php
$deleteButton = clone $delDowntimeForm;
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm $deleteButton */
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-comment');
$deleteButton->populate(
array(
'downtime_id' => $downtime->id,
'downtime_is_service' => isset($downtime->service_description)
)
);
echo $deleteButton;
?>
<?php endif ?>
</span>
</span>
</span>
<?php if (isset ($displayComment) && $displayComment): ?>
<p class="comment-text">
<?= $this->escape($downtime->comment) ?>
</p>
<?php endif ?>
</div>
<p class="comment-text">
<?= $this->escape($downtime->comment) ?>
</p>
</td>
Expand Up @@ -40,14 +40,14 @@ if (empty($object->comments) && ! $addLink) {
<th><?php
echo $this->translate('Downtimes');
if (! empty($object->downtimes) && $addLink) {
echo '<br />' . $addLink;
echo '<br>' . $addLink;
}
?></th>
<td data-base-target="_self">
<?php if (empty($object->downtimes)):
echo $addLink;
else: ?>
<dl class="feed-list">
<dl class="comment-list">
<?php foreach ($object->downtimes as $downtime):
if ((bool) $downtime->is_in_effect) {
$state = sprintf(
Expand All @@ -72,30 +72,34 @@ if (empty($object->comments) && ! $addLink) {
);
}
}
// Form is unset if the current user lacks the respective permission
if (isset($delDowntimeForm)) {
$deleteButton = clone($delDowntimeForm);
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' pull-right');
$deleteButton->populate(
array(
'downtime_id' => $downtime->id,
'downtime_is_service' => $object->getType() === $object::TYPE_SERVICE
)
);
} else {
$deleteButton = '';
}
?>
<dt class="clearfix feed-author">
<span class="author"><?= $this->escape($downtime->author_name) ?></span>
<?= $this->timeAgo($downtime->entry_time) ?>
<?= $deleteButton ?>
</dt>
<dd class="comment-text">
<?= str_replace(array('\r\n', '\n'), '<br>', $this->createTicketLinks($downtime->comment)) ?>
</dd>
<dd class="text-small">
<?= $state ?>
?>
<dt class="comment-header">
<?= $this->escape($downtime->author_name) ?>
<span class="comment-meta">
<?= $this->translate('created') ?>
<?= $this->timeAgo($downtime->entry_time) ?>
<span aria-hidden="true">&#448;</span>
<?= $state ?>
<?php if (isset($delDowntimeForm)): // Form is unset if the current user lacks the respective permission ?>
<span class="meta-icons">
<?php
$deleteButton = clone($delDowntimeForm);
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm $deleteButton */
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-comment');
$deleteButton->populate(
array(
'downtime_id' => $downtime->id,
'downtime_is_service' => $object->getType() === $object::TYPE_SERVICE
)
);
echo $deleteButton;
?>
</span>
<?php endif ?>
</span>
</dt>
<dd class="comment-text">
<p><?= str_replace(array('\r\n', '\n'), '<br>', $this->createTicketLinks($downtime->comment)) ?></p>
</dd>
<?php endforeach ?>
</dl>
Expand Down

0 comments on commit 0b332bb

Please sign in to comment.