ContactQuery: Provide ci query columns for aliases and email addresses

refs #8613
This commit is contained in:
Johannes Meyer 2015-04-10 09:45:23 +02:00
parent 3c47ba11eb
commit f00adc2138
8 changed files with 37 additions and 35 deletions

View File

@ -350,8 +350,8 @@ class Monitoring_ListController extends Controller
$query = $this->backend->select()->from('contact', array(
'contact_name',
'contact_id',
'contact_alias',
'contact_email',
'contact_alias_name',
'contact_email_address',
'contact_pager',
'contact_notify_service_timeperiod',
'contact_notify_service_recovery',
@ -365,18 +365,18 @@ class Monitoring_ListController extends Controller
'contact_notify_host_down',
'contact_notify_host_unreachable',
'contact_notify_host_flapping',
'contact_notify_host_downtime',
'contact_notify_host_downtime'
));
$this->filterQuery($query);
$this->view->contacts = $query->paginate();
$this->setupSortControl(array(
'contact_name' => $this->translate('Name'),
'contact_alias' => $this->translate('Alias'),
'contact_email' => $this->translate('Email'),
'contact_pager' => $this->translate('Pager Address / Number'),
'contact_name' => $this->translate('Name'),
'contact_alias_name' => $this->translate('Alias'),
'contact_email_address' => $this->translate('Email'),
'contact_pager' => $this->translate('Pager Address / Number'),
'contact_notify_service_timeperiod' => $this->translate('Service Notification Timeperiod'),
'contact_notify_host_timeperiod' => $this->translate('Host Notification Timeperiod')
'contact_notify_host_timeperiod' => $this->translate('Host Notification Timeperiod')
));
}

View File

@ -124,8 +124,8 @@ class Monitoring_ShowController extends Controller
$query = $this->backend->select()->from('contact', array(
'contact_name',
'contact_id',
'contact_alias',
'contact_email',
'contact_alias_name',
'contact_email_address',
'contact_pager',
'contact_object_id',
'contact_notify_service_timeperiod',
@ -140,7 +140,7 @@ class Monitoring_ShowController extends Controller
'contact_notify_host_down',
'contact_notify_host_unreachable',
'contact_notify_host_flapping',
'contact_notify_host_downtime',
'contact_notify_host_downtime'
));
$query->where('contact_name', $contactName);

View File

@ -14,19 +14,19 @@
}
foreach ($contacts as $contact): ?>
<div class="contact">
<?= $this->img('/static/gravatar', array('email' => $contact->contact_email)); ?>
<?= $this->img('/static/gravatar', array('email' => $contact->contact_email_address)); ?>
<strong><?= $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
$contact->contact_alias_name
))
); ?></strong> (<?= $contact->contact_alias; ?>)
); ?></strong> (<?= $contact->contact_alias_name; ?>)
<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); ?>
<?= $this->translate('Email'); ?>: <a href="mailto:<?= $contact->contact_email_address; ?>" title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias_name); ?>" aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias_name); ?>">
<?= $this->escape($contact->contact_email_address); ?>
</a>
</div>
<?php if ($contact->contact_pager): ?>

View File

@ -5,10 +5,10 @@ if (! empty($object->contacts)) {
$list = array();
foreach ($object->contacts as $contact) {
$list[] = $this->qlink(
$contact->contact_alias,
$contact->contact_alias_name,
'monitoring/show/contact',
array('contact_name' => $contact->contact_name),
array('title' => sprintf($this->translate('Show detailed information about %s'), $contact->contact_alias))
array('title' => sprintf($this->translate('Show detailed information about %s'), $contact->contact_alias_name))
);
}

View File

@ -3,7 +3,7 @@
<?= $this->tabs ?>
<h1><?= $this->translate('Contact details') ?></h1>
<div class="circular" style="background-image: url('<?=
$this->href('static/gravatar', array('email' => $contact->contact_email))
$this->href('static/gravatar', array('email' => $contact->contact_email_address))
?>')"></div>
<?php if (! $contact): ?>
@ -15,14 +15,14 @@
<tbody>
<tr>
<th style="width: 20%"></th>
<td><strong><?= $this->escape($contact->contact_alias) ?></strong> (<?= $contact->contact_name ?>)</td>
<td><strong><?= $this->escape($contact->contact_alias_name) ?></strong> (<?= $contact->contact_name ?>)</td>
</tr>
<?php if ($contact->contact_email): ?>
<?php if ($contact->contact_email_address): ?>
<tr>
<th><?= $this->translate('Email') ?></th>
<td>
<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 href="mailto:<?= $contact->contact_email_address; ?>" title="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias_name); ?>" aria-label="<?= sprintf($this->translate('Send a mail to %s'), $contact->contact_alias_name); ?>">
<?= $this->escape($contact->contact_email_address); ?>
</a>
</td>
</tr>

View File

@ -9,8 +9,10 @@ class ContactQuery extends IdoQuery
'contacts' => array(
'contact_id' => 'c.contact_id',
'contact_name' => 'co.name1 COLLATE latin1_general_ci',
'contact_alias' => 'c.alias COLLATE latin1_general_ci',
'contact_email' => 'c.email_address COLLATE latin1_general_ci',
'alias' => 'c.alias COLLATE latin1_general_ci',
'contact_alias_name' => 'c.alias',
'email' => 'c.email_address COLLATE latin1_general_ci',
'contact_email_address' => 'c.email_address',
'contact_pager' => 'c.pager_address',
'contact_object_id' => 'c.contact_object_id',
'contact_has_host_notfications' => 'c.host_notifications_enabled',

View File

@ -19,8 +19,8 @@ class Contact extends DataView
return array(
'contact',
'contact_name',
'contact_alias',
'contact_email',
'contact_alias_name',
'contact_email_address',
'contact_pager',
'contact_notify_hosts',
'contact_notify_services',
@ -57,7 +57,7 @@ class Contact extends DataView
public function getSortRules()
{
return array(
'contact_alias' => array(
'contact_alias_name' => array(
'order' => self::SORT_DESC
)
);

View File

@ -185,10 +185,10 @@ abstract class MonitoredObject implements Filterable
$this->contacts = array();
foreach (preg_split('~,~', $this->properties->host_contacts) as $contact) {
$this->contacts[] = (object) array(
'contact_name' => $contact,
'contact_alias' => $contact,
'contact_email' => null,
'contact_pager' => null,
'contact_name' => $contact,
'contact_alias_name' => $contact,
'contact_email_address' => null,
'contact_pager' => null
);
}
}
@ -385,9 +385,9 @@ abstract class MonitoredObject implements Filterable
$contacts = $this->backend->select()->from('contact', array(
'contact_name',
'contact_alias',
'contact_email',
'contact_pager',
'contact_alias_name',
'contact_email_address',
'contact_pager'
));
if ($this->type === self::TYPE_SERVICE) {
$contacts