diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 9dccf269b..2462664c8 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -80,7 +80,7 @@ foreach ($services as $service): service_icon_image): ?> - img($this->resolveMacros($service->service_icon_image, $service), array('align' => 'left')) ?> + icon($this->resolveMacros($service->service_icon_image, $service)) ?> service_display_name ?> on host_name; ?> host_state != 0): ?> diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml index 905a9b56d..57c829c06 100644 --- a/modules/monitoring/application/views/scripts/show/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -1,6 +1,5 @@ getHelper('CommandForm'); $data = array('host' => $object->host_name); @@ -8,59 +7,43 @@ if ($object->service_description) { $data['service'] = $object->service_description; } -?> -
-
- -
-
-
- - - comments)): ?> - - - - - comments as $comment): ?> - - - - - -
No comments
-
- comment_internal_id; +$list = array(); +foreach ($object->comments as $comment) { - echo $cf->iconSubmitForm( - 'img/icons/remove.png', - 'Remove comment', - 'btn-small', - 'removecomment', - $deleteData - ); - ?> -
- escape($comment->comment_author); ?>, comment_type; ?> - (format()->timeSince($comment->comment_timestamp); ?>) -
- escape($comment->comment_data); ?> -
-
-
-
+ // Ticket hook sample + $text = $this->tickets ? preg_replace_callback( + $this->tickets->getPattern(), + array($this->tickets, 'createLink'), + $this->escape($comment->comment_data) + ) : $this->escape($comment->comment_data); + + $deleteData = $data; + $deleteData['commentid'] = $object->comment_internal_id; + + $iconForm = $cf->iconSubmitForm( + 'img/icons/remove.png', + 'Remove comment', + 'btn-small', + 'removecomment', + $deleteData + ); + + $list[] = sprintf( + "
%s [%s] %s (%s): %s\n", + //'', + '' . $this->icon('remove_petrol.png') . '' . $iconForm, // Test + $this->escape($comment->comment_author), + $this->timeSince($comment->comment_timestamp), + $comment->comment_type, + $text + ); +} + +?> + + translate('Comments') ?> + + icon('comment_petrol.png') ?> translate('Add comment') ?> + + + diff --git a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml index db6778e25..4e0f3845f 100644 --- a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml +++ b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml @@ -1,66 +1,49 @@ object; - $isService = (isset($o->service_description)) ? true : false; - $obj = new \stdClass(); - $obj->handled = - ($isService) ? $o->service_handled : $o->host_handled; - $obj->state = - ($isService) ? $o->service_state : $o->host_state; - $obj->acknowledged = - ($isService) ? $o->service_acknowledged : $o->host_acknowledged; - $obj->in_downtime = - ($isService) ? $o->in_downtime : $o->host_in_downtime; - $obj->is_flapping = - ($isService) ? $o->is_flapping : $o->host_is_flapping; - $obj->notifications_enabled = - ($isService) ? $o->notifications_enabled : $o->service_notifications_enabled; - $obj->active_checks_enabled = - ($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled; - $obj->passive_checks_enabled = - ($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled; - $obj->last_comment = - ($isService) ? $o->last_comment : $o->host_last_comment; + +use Icinga\Module\Monitoring\Object\Service; + +$o = $this->object; + +$isService = $o instanceof Service; +$obj = new \stdClass(); +$obj->handled = + ($isService) ? $o->service_handled : $o->host_handled; +$obj->state = + ($isService) ? $o->service_state : $o->host_state; +$obj->acknowledged = + ($isService) ? $o->service_acknowledged : $o->host_acknowledged; +$obj->in_downtime = + ($isService) ? $o->in_downtime : $o->host_in_downtime; +$obj->notifications_enabled = + ($isService) ? $o->notifications_enabled : $o->service_notifications_enabled; +$obj->active_checks_enabled = + ($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled; +$obj->passive_checks_enabled = + ($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled; $i = array(); if (! $obj->handled && $obj->state > 0) { - $i[] = $this->img('img/icons/unhandled.png', array('title' => 'Unhandled')); + $i[] = $this->icon('unhandled.png', 'Unhandled'); } if ($obj->acknowledged && ! $obj->in_downtime) { $i[] = $this->icon('acknowledgement.png', 'Acknowledged'); } -if ($obj->is_flapping) { - $i[] = $this->icon('flapping.png', 'Flapping'); -} - if (!$obj->notifications_enabled) { - $i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled')); + $i[] = $this->icon('notification_disabled.png', 'Notifications Disabled'); } if ($obj->in_downtime) { - $i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime')); + $i[] = $this->icon('in_downtime.png', 'In Downtime'); } if (! $obj->active_checks_enabled) { if ($obj->passive_checks_enabled) { - $i[] = $this->img( - 'img/icons/active_checks_disabled.png', - array('title' => 'Active Checks Disabled') - ); + $i[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled'); } else { - $i[] = $this->img( - 'img/icons/active_passive_checks_disabled.png', - array('title' => 'Active And Passive Checks Disabled') - ); + $i[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled'); } } -if ($obj->last_comment !== null) { - $i[] = $this->icon('comment.png', 'Comments'); -} - -?> - - - +?>