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">
<table class="action action-table listing-table" data-base-target="_next">
<thead>
<tr>
<th></th>
<th><?= $this->translate('Hostgroup') ?></th>
<th><?= $this->translate('Alias') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($groupData as $groupName => $groupInfo): ?> <?php foreach ($groupData as $groupName => $groupInfo): ?>
<div class="box contactgroup"> <tr>
<div class="box header"> <td class="count-col">
<h2><?= $groupInfo['alias']; ?></h2> <span class="badge"><?= count($groupInfo['contacts']) ?></span>
<?php if ($groupInfo['alias'] !== $groupName): ?> </td>
<h2><?= $groupName; ?></h2> <td>
<?php endif ?>
</div>
<div class="box contents">
<?php foreach ($groupInfo['contacts'] as $c): ?>
<div class="box entry">
<?= $this->img('static/gravatar', array('email' => $c->contact_email)); ?>
<?= $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): ?>
<br>
<?= $c->contact_pager; ?>
<?php endif ?> <?php endif ?>
</p> </td>
</div> </tr>
<?php endforeach ?> <?php endforeach ?>
</div> </tbody>
</div> </table>
<?php endforeach ?>
</div>
</div> </div>

View File

@ -7,51 +7,61 @@
<?= $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; ?>
</div>
</div>
<?php
endforeach;
if (true): /* The following piece of HTML MUST be nested in <?php */ ?>
<div style="clear: both;"></div>
<?php endif; ?> <?php endif; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if (! $contacts->hasResult()): ?> <?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()): ?>
@ -65,4 +75,4 @@
) )
); ?> ); ?>
<?php endif ?> <?php endif ?>
</div>