Fix contactgroups overview style

This commit is contained in:
Johannes Meyer 2014-03-07 10:35:11 +01:00
parent d963fdf02c
commit 49127e3ac8
3 changed files with 82 additions and 48 deletions

View File

@ -287,7 +287,7 @@ class Monitoring_ListController extends MonitoringController
{
$this->addTitleTab('contactgroups');
$query = ContactgroupView::fromRequest(
$query = ContactgroupView::fromRequest(
$this->_request,
array(
'contactgroup_name',
@ -298,8 +298,20 @@ class Monitoring_ListController extends MonitoringController
'contact_pager',
)
)->getQuery()->order('contactgroup_alias');
$this->view->contactgroups = $query->fetchAll();
$contactgroups = $query->fetchAll();
$this->handleFormatRequest($query);
$groupData = array();
foreach ($contactgroups as $c) {
if (!array_key_exists($c->contactgroup_name, $groupData)) {
$groupData[$c->contactgroup_name] = array(
'alias' => $c->contactgroup_alias,
'contacts' => array()
);
}
$groupData[$c->contactgroup_name]['contacts'][] = $c;
}
$this->view->groupData = $groupData;
}
public function commentsAction()

View File

@ -1,52 +1,38 @@
<?php
$viewHelper = $this->getHelper('MonitoringState');
$knownGroups = array();
$contactgroups;
?>
<div class="controls">
<?= $this->tabs ?>
</div>
<div class="content">
<div class="summary">
<?php
foreach($contactgroups as $c):
$group = $c->contactgroup_name;
$periodLink = $this->href('monitoring/show/contacts', array('contact' => $c->contact_name));
if (! array_key_exists($group, $knownGroups)) {
$knownGroups[$group] = true;
$newRow = true;
if (! empty($knownGroups)) {
echo '</span>';
}
echo '<span class="state" style="background: #555; color: white">' . $this->escape($c->contactgroup_alias) . '<br />';
if ($c->contactgroup_alias !== $group) {
echo '(' . $this->escape($group) . ')';
} else {
echo '&nbsp;';
}
}
$methods = array();
foreach (array('email', 'pager') as $method) {
$prop = 'contact_' . $method;
if (isset($c->$prop) && ! empty($c->$prop)) {
$methods[] = $c->$prop;
}
}
?>
<span class="state" style="display:block; width: 90%; height: 80px; text-align: left; background: #eee; color: black; margin: 1em;">
<img style="border: 3px solid white; margin: 0.5em;" src="<?= $this->href('/static/gravatar', array('email' => $c->contact_email )) ?>" width="60" height="60" align="left" />
<a style="color: black; font-size: 1.1em; font-weight: bold;" href="<?= $periodLink ?>"><?= $this->escape($c->contact_alias) ?></a>
<p class="pluginoutput"><?= implode('<br />', $methods) ?></p>
</span>
<?php endforeach; ?>
<?php if (! empty($knownGroups)): ?>
</span>
<? endif ?>
</div>
<div class="boxview" data-base-target="col2">
<?php foreach ($groupData as $groupName => $groupInfo): ?>
<div class="box contactgroup">
<h2><?= $groupInfo['alias']; ?></h2>
<?php if ($groupInfo['alias'] !== $groupName): ?>
<h3><?= $groupName; ?></h3>
<?php endif ?>
<div class="box contents">
<?php foreach ($groupInfo['contacts'] as $c): ?>
<div class="box entry">
<img src="<?= $this->href('/static/gravatar', array('email' => $c->contact_email )) ?>" />
<a href="<?= $this->href(
'monitoring/show/contacts',
array('contact' => $c->contact_name)
); ?>">
<?= $this->escape($c->contact_alias) ?>
</a>
<p>
<?php if ($c->contact_email): ?>
<?= $c->contact_email; ?>
<?php endif ?>
<?php if ($c->contact_pager): ?>
<br />
<?= $c->contact_pager; ?>
<?php endif ?>
</p>
</div>
<?php endforeach ?>
</div>
</div>
<?php endforeach ?>
</div>
</div>

View File

@ -296,6 +296,14 @@ a.critical {
font-weight: bold;
}
.boxview div.box h3 {
margin-top: 0;
margin-bottom: 0.4em;
font-size: 0.8em;
color: #eee;
}
/* Box body of contents */
.boxview div.box.contents {
background: #eee;
@ -396,6 +404,34 @@ div.box.entry.handled {
color: inherit;
}
div.box.contactgroup {
width: 18em;
}
div.box.contactgroup div.box.entry {
overflow: hidden;
clear: left;
}
div.box.contactgroup div.box.entry img {
width: 60px;
height: 60px;
margin: 0.4em;
float: left;
border: 2px solid white;
}
div.box.contactgroup div.box.entry a {
margin-top: 0.4em;
font-weight: bold;
}
div.box.contactgroup div.box.entry p {
margin: 0.4em 0 0;
}
/* End of monitoring box element styles */