From a4ed32d3579ef226540364ecf2ece9d81fc43b97 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 7 Mar 2014 10:41:59 +0100 Subject: [PATCH] Using new PHP icon helper --- .../Config/Authentication/ReorderForm.php | 4 +- application/forms/Config/GeneralForm.php | 2 +- .../views/scripts/config/authentication.phtml | 8 +- .../views/scripts/config/resource.phtml | 6 +- .../forms/Config/ConfirmRemovalForm.php | 2 +- .../views/scripts/config/index.phtml | 12 +- .../views/scripts/list/comments.phtml | 6 +- .../views/scripts/list/hosts.phtml | 32 ++--- .../views/scripts/list/servicegroups.phtml | 115 ------------------ .../views/scripts/list/services.phtml | 11 +- .../scripts/multi/components/comments.phtml | 6 +- .../scripts/multi/components/downtimes.phtml | 4 +- .../scripts/show/components/comments.phtml | 95 +++++++++------ .../scripts/show/components/downtime.phtml | 2 +- .../scripts/show/components/statusIcons.phtml | 39 ++++-- 15 files changed, 122 insertions(+), 222 deletions(-) delete mode 100644 modules/monitoring/application/views/scripts/list/servicegroups.phtml diff --git a/application/forms/Config/Authentication/ReorderForm.php b/application/forms/Config/Authentication/ReorderForm.php index 0b8a42626..f81ee5b0d 100644 --- a/application/forms/Config/Authentication/ReorderForm.php +++ b/application/forms/Config/Authentication/ReorderForm.php @@ -116,7 +116,7 @@ class ReorderForm extends Form 'escape' => false, 'value' => 'btn_' . $this->getBackendName() . '_reorder_up', 'name' => 'btn_' . $this->getBackendName() . '_reorder_up', - 'label' => $this->getView()->img('img/icons/up.png', array('title' => 'Move up in authentication order')), + 'label' => $this->getView()->icon('up.png', 'Move up in authentication order'), ) ); } @@ -138,7 +138,7 @@ class ReorderForm extends Form 'escape' => false, 'value' => 'btn_' . $this->getBackendName() . '_reorder_down', 'name' => 'btn_' . $this->getBackendName() . '_reorder_down', - 'label' => $this->getView()->img('img/icons/down.png', array('title' => 'Move down in authentication order')), + 'label' => $this->getView()->icon('down.png', 'Move down in authentication order'), ) ); diff --git a/application/forms/Config/GeneralForm.php b/application/forms/Config/GeneralForm.php index 179bd541a..ab3610ab8 100644 --- a/application/forms/Config/GeneralForm.php +++ b/application/forms/Config/GeneralForm.php @@ -397,7 +397,7 @@ class GeneralForm extends Form 'type' => 'submit', 'escape' => false, 'value' => '1', - 'label' => $this->getView()->img('img/icons/save.png', array('title' => 'Save Changes')) + 'label' => $this->getView()->icon('save.png', 'Save Changes') . ' Save changes', ) ); diff --git a/application/views/scripts/config/authentication.phtml b/application/views/scripts/config/authentication.phtml index e8bf9bd3b..a6f3688d3 100644 --- a/application/views/scripts/config/authentication.phtml +++ b/application/views/scripts/config/authentication.phtml @@ -14,9 +14,9 @@ $createDbBackend = $this->href('/config/createAuthenticationBackend', array('typ

Create Authentication Provider

- img('img/icons/create.png'); ?> Create A New LDAP Authentication Backend + icon('create.png'); ?> Create A New LDAP Authentication Backend
- img('img/icons/create.png'); ?> Create A New DB Authentication Backend + icon('create.png'); ?> Create A New DB Authentication Backend

@@ -31,10 +31,10 @@ $createDbBackend = $this->href('/config/createAuthenticationBackend', array('typ reorderForm; ?> - img('img/icons/edit.png'); ?> Edit  + icon('edit.png'); ?> Edit  backends) > 1): ?> - img('img/icons/remove.png'); ?> Remove  + icon('remove.png'); ?> Remove  diff --git a/application/views/scripts/config/resource.phtml b/application/views/scripts/config/resource.phtml index feb8da9c3..f489ad087 100644 --- a/application/views/scripts/config/resource.phtml +++ b/application/views/scripts/config/resource.phtml @@ -12,7 +12,7 @@ $createResource = $this->href('/config/createresource');

Create Resource

-

img('img/icons/create.png'); ?> Create A New Resource

+

icon('create.png'); ?> Create A New Resource

resources as $name => $resource): ?> @@ -23,10 +23,10 @@ $createResource = $this->href('/config/createresource');
- img('img/icons/edit.png'); ?> Edit  + icon('edit.png'); ?> Edit  resources) > 1): ?> - img('img/icons/remove.png'); ?> Remove  + icon('remove.png'); ?> Remove 
diff --git a/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php b/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php index 26661e5c9..f2c5c1237 100644 --- a/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php +++ b/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php @@ -86,7 +86,7 @@ class ConfirmRemovalForm extends Form 'escape' => false, 'value' => '1', 'class' => 'btn btn-cta btn-common', - 'label' => $this->view->img('img/icons/remove.png') . ' Confirm Removal' + 'label' => $this->view->icon('remove.png') . ' Confirm Removal' ) ); } diff --git a/modules/monitoring/application/views/scripts/config/index.phtml b/modules/monitoring/application/views/scripts/config/index.phtml index 7a741ddc9..34e928563 100644 --- a/modules/monitoring/application/views/scripts/config/index.phtml +++ b/modules/monitoring/application/views/scripts/config/index.phtml @@ -12,7 +12,7 @@

- img('img/icons/create.png'); ?> Create New Monitoring Backend + icon('create.png'); ?> Create New Monitoring Backend

@@ -27,8 +27,8 @@ escape($backendName); ?>(Type: escape($config['type'] === 'ido' ? 'IDO' : ucfirst($config['type'])); ?>)
- img('img/icons/remove.png'); ?> Remove  - img('img/icons/edit.png'); ?> Edit + icon('remove.png'); ?> Remove  + icon('edit.png'); ?> Edit
@@ -39,7 +39,7 @@

- img('img/icons/create.png'); ?> Create New Instance + icon('create.png'); ?> Create New Instance

@@ -55,8 +55,8 @@ escape($instanceName); ?>(Type: )
- img('img/icons/remove.png'); ?> Remove  - img('img/icons/edit.png'); ?> Edit + icon('remove.png'); ?> Remove  + icon('edit.png'); ?> Edit
diff --git a/modules/monitoring/application/views/scripts/list/comments.phtml b/modules/monitoring/application/views/scripts/list/comments.phtml index dea31d80d..86df4c364 100644 --- a/modules/monitoring/application/views/scripts/list/comments.phtml +++ b/modules/monitoring/application/views/scripts/list/comments.phtml @@ -45,9 +45,9 @@ $viewHelper = $this->getHelper('MonitoringState'); diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 63c7ed254..e08a96fd8 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -32,52 +32,36 @@ if ($hosts->count() === 0) { $icons = array(); if (!$host->host_handled && $host->host_state > 0){ - $icons[] = $this->img('img/icons/unhandled.png', array( - 'title' => 'Unhandled' - )); + $icons[] = $this->icon('unhandled.png', 'Unhandled'); } if ($host->host_acknowledged && !$host->host_in_downtime) { - $icons[] = $this->img('img/icons/acknowledgement.png', array( - 'title' => 'Acknowledged' - )); + $icons[] = $this->icon('acknowledgement.png', 'Acknowledged'); } if ($host->host_is_flapping) { - $icons[] = $this->img('img/icons/flapping.png', array( - 'title' => 'Flapping' - )); + $icons[] = $this->icon('flapping.png', 'Flapping'); } if (!$host->host_notifications_enabled) { - $icons[] = $this->img('img/icons/notification_disabled.png', array( - 'title' => 'Notifications Disabled' - )); + $icons[] = $this->icon('notification_disabled.png', 'Notifications Disabled'); } if (!$host->host_in_downtime) { - $icons[] = $this->img('img/icons/in_downtime.png', array( - 'title' => 'In Downtime' - )); + $icons[] = $this->icon('in_downtime.png', 'In Downtime'); } if (!$host->host_active_checks_enabled) { if (!$host->host_passive_checks_enabled) { - $icons[] = $this->img('img/icons/active_passive_checks_disabled.png', array( - 'title' => 'Active And Passive Checks Disabled' - )); + $icons[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled'); } else { - $icons[] = $this->img('img/icons/active_checks_disabled.png', array( - 'title' => 'Active Checks Disabled' - )); + $icons[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled'); } } // Not available right now: if (isset($host->host_last_comment) && $host->host_last_comment !== null) { - $icons[] = $this->img('img/icons/comment.png', array( - 'title' => 'Comments' - )); + $icons[] = $this->icon('comment.png', 'Comments'); } ?> diff --git a/modules/monitoring/application/views/scripts/list/servicegroups.phtml b/modules/monitoring/application/views/scripts/list/servicegroups.phtml deleted file mode 100644 index ca0d23786..000000000 --- a/modules/monitoring/application/views/scripts/list/servicegroups.phtml +++ /dev/null @@ -1,115 +0,0 @@ -
-
-

Servicegroups

-
-
- tabs->render($this); ?> -
-
-
- -
-
-
- sortControl->render($this); ?> -
-
- -
-
- paginationControl($servicegroups, null, null, array('preserve' => $this->preserve)); ?> -
-
- -
-
- selectionToolbar('single'); ?> -
-
- -
comment_objecttype_id === '1'): ?> - img('img/icons/host.png', array('title' => 'Host comment')) ?> + icon('host.png', 'Host comment') ?> comment_objecttype_id === '2'): ?> - img('img/icons/service.png', array('title' => 'Service comment')) ?> + icon('service.png', 'Service comment') ?> getHelper('MonitoringState'); $tooltip = 'Comment was caused by an acknowledgement.'; } ?> - img('img/icons/' . $icon . '.png', array('title' => $tooltip)) ?> + icon($icon . '.png', $tooltip) ?>
- - - - - - - - - -
- - servicegroup; ?> - - - - - -
- -
- paginationControl($servicegroups, null, null, array('preserve' => $this->preserve)); ?> -
- diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 3833b8011..9dccf269b 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -73,21 +73,18 @@ foreach ($services as $service): service_active_checks_enabled): ?> service_passive_checks_enabled): ?> - icon( - 'active_passive_checks_disabled.png', - 'Active And Passive Checks Disabled' - ) ?> + icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled') ?> - icon('active_checks_disabled.png', 'Active Checks Disabled') ?> + icon('active_checks_disabled.png', 'Active Checks Disabled') ?> service_icon_image): ?> - icon($this->resolveMacros($service->service_icon_image, $service)) ?> + img($this->resolveMacros($service->service_icon_image, $service), array('align' => 'left')) ?> service_display_name ?> on host_name; ?> host_state != 0): ?> - (monitoringState($service, 'host')); ?>) +(monitoringState($service, 'host')); ?>)

escape(substr(strip_tags($service->service_output), 0, 10000)); ?>

diff --git a/modules/monitoring/application/views/scripts/multi/components/comments.phtml b/modules/monitoring/application/views/scripts/multi/components/comments.phtml index 97e174076..9ac0d768b 100644 --- a/modules/monitoring/application/views/scripts/multi/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/comments.phtml @@ -8,7 +8,7 @@ $this->target ); ?>" class="btn-common btn-small button"> - img('img/icons/comment.png') ?> + icon('comment.png') ?> - img('img/icons/notification.png') ?>"> + icon('notification.png') ?>"> @@ -43,7 +43,7 @@ $this->target ); ?>" class="button btn-common btn-small input-sm pull-right"> - img('img/icons/remove.png') ?>"> + icon('remove.png') ?>"> There are 0 comments assigned to the selected items. diff --git a/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml b/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml index 08e7abfa3..ffbf73640 100644 --- a/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/multi/components/downtimes.phtml @@ -8,7 +8,7 @@ $this->target ); ?>" class="button btn-common btn-small input-sm pull-right"> - img('img/icons/in_downtime.png') ?> + icon('in_downtime.png') ?> @@ -30,7 +30,7 @@ $this->target ); ?>" class="button btn-common btn-small input-sm pull-right"> - img('img/icons/remove.png') ?> + icon('remove.png') ?> 0 Selected items are currently in downtime. diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml index c142d7e5d..905a9b56d 100644 --- a/modules/monitoring/application/views/scripts/show/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -1,5 +1,6 @@ getHelper('CommandForm'); $data = array('host' => $object->host_name); @@ -7,43 +8,59 @@ if ($object->service_description) { $data['service'] = $object->service_description; } -$list = array(); -foreach ($object->comments as $comment) { - - // 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') ?> - - - +
+ +
+
+ + + comments)): ?> + + + + + comments as $comment): ?> + + + + + +
No comments
+
+ comment_internal_id; + + 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); ?> +
+
+
+
diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml index 8c4827778..b3747588d 100644 --- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml +++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml @@ -12,7 +12,7 @@ $scheduleDowntimeHref = $this->href('monitoring/command/scheduleDowntime', $scheduleDowntimeData); ?> - img('img/icons/in_downtime.png') ?> + icon('in_downtime.png') ?> Downtimes diff --git a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml index 40f889ea8..db6778e25 100644 --- a/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml +++ b/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml @@ -1,10 +1,6 @@ object; - - $isService = $o instanceof Service; + $isService = (isset($o->service_description)) ? true : false; $obj = new \stdClass(); $obj->handled = ($isService) ? $o->service_handled : $o->host_handled; @@ -14,36 +10,57 @@ use Icinga\Module\Monitoring\Object\Service; ($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; $i = array(); if (! $obj->handled && $obj->state > 0) { - $i[] = $this->icon('unhandled.png', 'Unhandled'); + $i[] = $this->img('img/icons/unhandled.png', array('title' => '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->icon('notification_disabled.png', 'Notifications Disabled'); + $i[] = $this->img('img/icons/notification_disabled.png', array('title' => 'Notifications Disabled')); } if ($obj->in_downtime) { - $i[] = $this->icon('in_downtime.png', 'In Downtime'); + $i[] = $this->img('img/icons/in_downtime.png', array('title' => 'In Downtime')); } if (! $obj->active_checks_enabled) { if ($obj->passive_checks_enabled) { - $i[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled'); + $i[] = $this->img( + 'img/icons/active_checks_disabled.png', + array('title' => 'Active Checks Disabled') + ); } else { - $i[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled'); + $i[] = $this->img( + 'img/icons/active_passive_checks_disabled.png', + array('title' => 'Active And Passive Checks Disabled') + ); } } -?> \ No newline at end of file +if ($obj->last_comment !== null) { + $i[] = $this->icon('comment.png', 'Comments'); +} + +?> + + +