Turn contact and contactgroup view into list

refs #5543
This commit is contained in:
Matthias Jentsch 2015-09-29 10:37:32 +02:00 committed by Eric Lippmann
parent 8f33fca3d4
commit f23aebaf95
2 changed files with 100 additions and 88 deletions

View File

@ -1,4 +1,7 @@
<?php if (! $this->compact): ?> <?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;
if (! $this->compact): ?>
<div class="controls"> <div class="controls">
<?= $this->tabs; ?> <?= $this->tabs; ?>
<?= $this->sortBox; ?> <?= $this->sortBox; ?>
@ -15,41 +18,40 @@ if (count($groupData) === 0) {
return; return;
} }
?> ?>
<div class="boxview" data-base-target="_next">
<?php foreach ($groupData as $groupName => $groupInfo): ?> <table class="action action-table listing-table" data-base-target="_next">
<div class="box contactgroup"> <thead>
<div class="box header"> <tr>
<h2><?= $groupInfo['alias']; ?></h2> <th></th>
<?php if ($groupInfo['alias'] !== $groupName): ?> <th><?= $this->translate('Hostgroup') ?></th>
<h2><?= $groupName; ?></h2> <th><?= $this->translate('Alias') ?></th>
<?php endif ?> </tr>
</div> </thead>
<div class="box contents"> <tbody>
<?php foreach ($groupInfo['contacts'] as $c): ?>
<div class="box entry"> <?php foreach ($groupData as $groupName => $groupInfo): ?>
<?= $this->img('static/gravatar', array('email' => $c->contact_email)); ?> <tr>
<td class="count-col">
<span class="badge"><?= count($groupInfo['contacts']) ?></span>
</td>
<td>
<?= $this->qlink( <?= $this->qlink(
$c->contact_alias, $groupName,
'monitoring/show/contact', 'monitoring/list/contacts',
array('contact_name' => $c->contact_name), array('contactgroup' => $groupName),
array('title' => sprintf( array('title' => sprintf(
$this->translate('Show detailed information about %s'), $this->translate('Show detailed information about %s'),
$c->contact_alias $groupName
)) ))
); ?> ); ?>
<p> </td>
<?php if ($c->contact_email): ?> <td>
<?= $c->contact_email; ?> <?php if ($groupInfo['alias'] !== $groupName): ?>
<?php endif; <?= $groupInfo['alias'] ?>
if ($c->contact_pager): ?> <?php endif ?>
<br> </td>
<?= $c->contact_pager; ?> </tr>
<?php endif ?> <?php endforeach ?>
</p> </tbody>
</div> </table>
<?php endforeach ?>
</div>
</div>
<?php endforeach ?>
</div>
</div> </div>

View File

@ -7,54 +7,64 @@
<?= $this->filterEditor; ?> <?= $this->filterEditor; ?>
</div> </div>
<?php endif ?> <?php endif ?>
<div data-base-target="_next" class="content contacts">
<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<th><?= $this->translate('Name') ?></th>
<th><?= $this->translate('Email') ?></th>
<th><?= $this->translate('Pager') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($contacts->peekAhead($this->compact) as $contact): ?> <?php foreach ($contacts->peekAhead($this->compact) as $contact): ?>
<div class="contact"> <tr>
<?= $this->img('static/gravatar', array('email' => $contact->contact_email)); ?> <td>
<strong><?= $this->qlink( <?= $this->qlink(
$contact->contact_name, $contact->contact_name,
'monitoring/show/contact', 'monitoring/show/contact',
array('contact_name' => $contact->contact_name), array('contact_name' => $contact->contact_name),
array('title' => sprintf( array('title' => sprintf(
$this->translate('Show detailed information about %s'), $this->translate('Show detailed information about %s'),
$contact->contact_alias $contact->contact_alias
)) ), 'class' => 'rowaction')
); ?></strong> (<?= $contact->contact_alias; ?>) ); ?>
<div> </td>
<?= $this->translate('Email'); ?>: <a href="mailto:<?= $contact->contact_email; ?>" title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>" aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"> <td>
<?= $this->translate('Email'); ?>:
<a href="mailto:<?= $contact->contact_email; ?>"
title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>"
aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias); ?>">
<?= $this->escape($contact->contact_email); ?> <?= $this->escape($contact->contact_email); ?>
</a> </a>
</div> </td>
<td>
<?php if ($contact->contact_pager): ?> <?php if ($contact->contact_pager): ?>
<div> <div>
<?= $this->translate('Pager') ?>:
<?= $this->escape($contact->contact_pager) ?> <?= $this->escape($contact->contact_pager) ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<div style="clear: both;"></div> </td>
<div class="notification-periods">
<?php if ($contact->contact_notify_service_timeperiod): ?> <?php if ($contact->contact_notify_service_timeperiod): ?>
<div> <td>
<?= $this->translate('Service notification period') ?>:
<?= $this->escape($contact->contact_notify_service_timeperiod) ?> <?= $this->escape($contact->contact_notify_service_timeperiod) ?>
</div> </td>
<?php endif; ?> <?php endif; ?>
<?php if ($contact->contact_notify_host_timeperiod): ?> <?php if ($contact->contact_notify_host_timeperiod): ?>
<div> <td>
<?= $this->translate('Host notification period') ?>:
<?= $this->escape($contact->contact_notify_host_timeperiod) ?> <?= $this->escape($contact->contact_notify_host_timeperiod) ?>
</div> </td>
<?php endif; ?> <?php endif; ?>
</div> </tr>
</div> <?php endforeach ?>
<?php </tbody>
endforeach; </table>
if (true): /* The following piece of HTML MUST be nested in <?php */ ?>
<div style="clear: both;"></div> <?php if (! $contacts->hasResult()): ?>
<?php endif; ?>
<?php if (! $contacts->hasResult()): ?>
<?= $this->translate('No contacts found matching the filter'); ?> <?= $this->translate('No contacts found matching the filter'); ?>
<?php elseif ($contacts->hasMore()): ?> <?php elseif ($contacts->hasMore()): ?>
<?= $this->qlink( <?= $this->qlink(
$this->translate('Show More'), $this->translate('Show More'),
$this->url()->without(array('view', 'limit')), $this->url()->without(array('view', 'limit')),
@ -64,5 +74,5 @@
'class' => 'pull-right show-more' 'class' => 'pull-right show-more'
) )
); ?> ); ?>
<?php endif ?> <?php endif ?>
</div>