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'); $this->addTitleTab('contactgroups');
$query = ContactgroupView::fromRequest( $query = ContactgroupView::fromRequest(
$this->_request, $this->_request,
array( array(
'contactgroup_name', 'contactgroup_name',
@ -298,8 +298,20 @@ class Monitoring_ListController extends MonitoringController
'contact_pager', 'contact_pager',
) )
)->getQuery()->order('contactgroup_alias'); )->getQuery()->order('contactgroup_alias');
$this->view->contactgroups = $query->fetchAll(); $contactgroups = $query->fetchAll();
$this->handleFormatRequest($query); $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() public function commentsAction()

View File

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

View File

@ -296,6 +296,14 @@ a.critical {
font-weight: bold; font-weight: bold;
} }
.boxview div.box h3 {
margin-top: 0;
margin-bottom: 0.4em;
font-size: 0.8em;
color: #eee;
}
/* Box body of contents */ /* Box body of contents */
.boxview div.box.contents { .boxview div.box.contents {
background: #eee; background: #eee;
@ -396,6 +404,34 @@ div.box.entry.handled {
color: inherit; 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 */ /* End of monitoring box element styles */