Skip to content

Commit

Permalink
Turn contact and contactgroup view into list
Browse files Browse the repository at this point in the history
refs #5543
  • Loading branch information
majentsch authored and lippserd committed Sep 29, 2015
1 parent 8f33fca commit f23aeba
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 87 deletions.
@@ -1,4 +1,7 @@
<?php if (! $this->compact): ?>
<?php
use Icinga\Module\Monitoring\Web\Widget\StateBadges;

if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs; ?>
<?= $this->sortBox; ?>
Expand All @@ -15,41 +18,40 @@ if (count($groupData) === 0) {
return;
}
?>
<div class="boxview" data-base-target="_next">
<?php foreach ($groupData as $groupName => $groupInfo): ?>
<div class="box contactgroup">
<div class="box header">
<h2><?= $groupInfo['alias']; ?></h2>
<?php if ($groupInfo['alias'] !== $groupName): ?>
<h2><?= $groupName; ?></h2>
<?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(
$c->contact_alias,
'monitoring/show/contact',
array('contact_name' => $c->contact_name),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$c->contact_alias
))
); ?>
<p>
<?php if ($c->contact_email): ?>
<?= $c->contact_email; ?>
<?php endif;
if ($c->contact_pager): ?>
<br>
<?= $c->contact_pager; ?>
<?php endif ?>
</p>
</div>
<?php endforeach ?>
</div>
</div>
<?php endforeach ?>
</div>

<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): ?>
<tr>
<td class="count-col">
<span class="badge"><?= count($groupInfo['contacts']) ?></span>
</td>
<td>
<?= $this->qlink(
$groupName,
'monitoring/list/contacts',
array('contactgroup' => $groupName),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$groupName
))
); ?>
</td>
<td>
<?php if ($groupInfo['alias'] !== $groupName): ?>
<?= $groupInfo['alias'] ?>
<?php endif ?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
108 changes: 59 additions & 49 deletions modules/monitoring/application/views/scripts/list/contacts.phtml
Expand Up @@ -7,62 +7,72 @@
<?= $this->filterEditor; ?>
</div>
<?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): ?>
<div class="contact">
<?= $this->img('static/gravatar', array('email' => $contact->contact_email)); ?>
<strong><?= $this->qlink(
<tr>
<td>
<?= $this->qlink(
$contact->contact_name,
'monitoring/show/contact',
array('contact_name' => $contact->contact_name),
array('title' => sprintf(
$this->translate('Show detailed information about %s'),
$contact->contact_alias
))
); ?></strong> (<?= $contact->contact_alias; ?>)
<div>
<?= $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); ?>
</a>
</div>
), 'class' => 'rowaction')
); ?>
</td>
<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); ?>
</a>
</td>
<td>
<?php if ($contact->contact_pager): ?>
<div>
<?= $this->translate('Pager') ?>:
<?= $this->escape($contact->contact_pager) ?>
</div>
<?php endif; ?>
<div style="clear: both;"></div>
<div class="notification-periods">
<?php if ($contact->contact_notify_service_timeperiod): ?>
<div>
<?= $this->translate('Service notification period') ?>:
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
</div>
<?php endif; ?>
<?php if ($contact->contact_notify_host_timeperiod): ?>
<div>
<?= $this->translate('Host notification period') ?>:
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
<?= $this->escape($contact->contact_pager) ?>
</div>
<?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 if (! $contacts->hasResult()): ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php elseif ($contacts->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right show-more'
)
); ?>
<?php endif ?>
</div>
<?php endif; ?>
</td>

<?php if ($contact->contact_notify_service_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_service_timeperiod) ?>
</td>
<?php endif; ?>

<?php if ($contact->contact_notify_host_timeperiod): ?>
<td>
<?= $this->escape($contact->contact_notify_host_timeperiod) ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>

<?php if (! $contacts->hasResult()): ?>
<?= $this->translate('No contacts found matching the filter'); ?>
<?php elseif ($contacts->hasMore()): ?>
<?= $this->qlink(
$this->translate('Show More'),
$this->url()->without(array('view', 'limit')),
null,
array(
'data-base-target' => '_next',
'class' => 'pull-right show-more'
)
); ?>
<?php endif ?>

0 comments on commit f23aeba

Please sign in to comment.