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>
<?= $this->qlink( <td class="count-col">
$c->contact_alias, <span class="badge"><?= count($groupInfo['contacts']) ?></span>
'monitoring/show/contact', </td>
array('contact_name' => $c->contact_name), <td>
array('title' => sprintf( <?= $this->qlink(
$this->translate('Show detailed information about %s'), $groupName,
$c->contact_alias 'monitoring/list/contacts',
)) array('contactgroup' => $groupName),
); ?> array('title' => sprintf(
<p> $this->translate('Show detailed information about %s'),
<?php if ($c->contact_email): ?> $groupName
<?= $c->contact_email; ?> ))
<?php endif; ); ?>
if ($c->contact_pager): ?> </td>
<br> <td>
<?= $c->contact_pager; ?> <?php if ($groupInfo['alias'] !== $groupName): ?>
<?php endif ?> <?= $groupInfo['alias'] ?>
</p> <?php endif ?>
</div> </td>
<?php endforeach ?> </tr>
</div> <?php endforeach ?>
</div> </tbody>
<?php endforeach ?> </table>
</div>
</div> </div>

View File

@ -7,62 +7,72 @@
<?= $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->escape($contact->contact_email); ?> <?= $this->translate('Email'); ?>:
</a> <a href="mailto:<?= $contact->contact_email; ?>"
</div> 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); ?>
</a>
</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) ?> </td>
</div> <?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) ?> </td>
</div> <?php endif; ?>
<?php endif; ?> </tr>
</div> <?php endforeach ?>
</div> </tbody>
<?php </table>
endforeach;
if (true): /* The following piece of HTML MUST be nested in <?php */ ?> <?php if (! $contacts->hasResult()): ?>
<div style="clear: both;"></div> <?= $this->translate('No contacts found matching the filter'); ?>
<?php endif; ?> <?php elseif ($contacts->hasMore()): ?>
<?php if (! $contacts->hasResult()): ?> <?= $this->qlink(
<?= $this->translate('No contacts found matching the filter'); ?> $this->translate('Show More'),
<?php elseif ($contacts->hasMore()): ?> $this->url()->without(array('view', 'limit')),
<?= $this->qlink( null,
$this->translate('Show More'), array(
$this->url()->without(array('view', 'limit')), 'data-base-target' => '_next',
null, 'class' => 'pull-right show-more'
array( )
'data-base-target' => '_next', ); ?>
'class' => 'pull-right show-more' <?php endif ?>
)
); ?>
<?php endif ?>
</div>