From 598ef1e8f409b61e47ee1070009bc40d2484fef9 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 21 May 2015 14:59:12 +0200 Subject: [PATCH 1/3] Add alt-text to icon_images Print alt-text as title and alt-attribute in the helper class and add the alt-column to the backend query. refs #9300 --- .../controllers/HostsController.php | 2 ++ .../application/controllers/ListController.php | 2 ++ .../controllers/ServicesController.php | 4 ++++ .../application/views/helpers/IconImage.php | 18 ++++++++++++++++-- .../Backend/Ido/Query/StatusQuery.php | 2 ++ .../Monitoring/DataView/ServiceStatus.php | 2 -- .../library/Monitoring/Object/Host.php | 1 + .../library/Monitoring/Object/Service.php | 2 ++ 8 files changed, 29 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/controllers/HostsController.php b/modules/monitoring/application/controllers/HostsController.php index ac55ade9b..78c8eaa7e 100644 --- a/modules/monitoring/application/controllers/HostsController.php +++ b/modules/monitoring/application/controllers/HostsController.php @@ -54,6 +54,7 @@ class Monitoring_HostsController extends Controller { $this->hostList->setColumns(array( 'host_icon_image', + 'host_icon_image_alt', 'host_name', 'host_state', 'host_problem', @@ -96,6 +97,7 @@ class Monitoring_HostsController extends Controller $this->view->checkNowForm = $checkNowForm; $this->hostList->setColumns(array( 'host_icon_image', + 'host_icon_image_alt', 'host_name', 'host_state', 'host_problem', diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 92c42d4ad..6b864be24 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -70,6 +70,7 @@ class Monitoring_ListController extends Controller $this->setAutorefreshInterval(10); $query = $this->backend->select()->from('hostStatus', array_merge(array( 'host_icon_image', + 'host_icon_image_alt', 'host_name', 'host_display_name', 'host_state' => $stateColumn, @@ -162,6 +163,7 @@ class Monitoring_ListController extends Controller 'service_attempt', 'service_last_state_change' => $stateChangeColumn, 'service_icon_image', + 'service_icon_image_alt', 'service_is_flapping', 'service_state_type', 'service_handled', diff --git a/modules/monitoring/application/controllers/ServicesController.php b/modules/monitoring/application/controllers/ServicesController.php index 6877aca02..1a8ec9a58 100644 --- a/modules/monitoring/application/controllers/ServicesController.php +++ b/modules/monitoring/application/controllers/ServicesController.php @@ -51,12 +51,14 @@ class Monitoring_ServicesController extends Controller { $this->serviceList->setColumns(array( 'host_icon_image', + 'host_icon_image_alt', 'host_name', 'host_output', 'host_state', 'host_problem', 'host_handled', 'service_icon_image', + 'service_icon_image_alt', 'service_description', 'service_state', 'service_problem', @@ -96,12 +98,14 @@ class Monitoring_ServicesController extends Controller $this->view->checkNowForm = $checkNowForm; $this->serviceList->setColumns(array( 'host_icon_image', + 'host_icon_image_alt', 'host_name', 'host_output', 'host_state', 'host_problem', 'host_handled', 'service_icon_image', + 'service_icon_image_alt', 'service_output', 'service_description', 'service_state', diff --git a/modules/monitoring/application/views/helpers/IconImage.php b/modules/monitoring/application/views/helpers/IconImage.php index 2ed3b1d25..416a4f335 100644 --- a/modules/monitoring/application/views/helpers/IconImage.php +++ b/modules/monitoring/application/views/helpers/IconImage.php @@ -25,7 +25,14 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract public function host($object) { if ($object->host_icon_image && ! preg_match('/[\'"]/', $object->host_icon_image)) { - return $this->view->icon($this->view->resolveMacros($object->host_icon_image, $object)); + return $this->view->img( + 'img/icons/' . $this->view->resolveMacros($object->host_icon_image, $object), + null, + array( + 'alt' => $object->host_icon_image_alt, + 'title' => $object->host_icon_image_alt + ) + ); } return ''; } @@ -39,7 +46,14 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract public function service($object) { if ($object->service_icon_image && ! preg_match('/[\'"]/', $object->service_icon_image)) { - return $this->view->icon($this->view->resolveMacros($object->service_icon_image, $object)); + return $this->view->img( + 'img/icons/' . $this->view->resolveMacros($object->service_icon_image, $object), + null, + array( + 'alt' => $object->service_icon_image_alt, + 'title' => $object->service_icon_image_alt + ) + ); } return ''; } diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php index 17a12259e..14ffb438b 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusQuery.php @@ -41,6 +41,7 @@ class StatusQuery extends IdoQuery 'host_address' => 'h.address', 'host_ipv4' => 'INET_ATON(h.address)', 'host_icon_image' => 'h.icon_image', + 'host_icon_image_alt' => 'h.icon_image_alt', 'host_action_url' => 'h.action_url', 'host_notes_url' => 'h.notes_url' ), @@ -176,6 +177,7 @@ class StatusQuery extends IdoQuery 'service_description' => 'so.name2', 'service_display_name' => 's.display_name', 'service_icon_image' => 's.icon_image', + 'service_icon_image_alt' => 's.icon_image_alt', 'service_action_url' => 's.action_url', 'service_notes_url' => 's.notes_url', 'object_type' => '(\'service\')' diff --git a/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php b/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php index b4f1038da..18bf1aa80 100644 --- a/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php +++ b/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php @@ -40,7 +40,6 @@ class ServiceStatus extends DataView 'service_unhandled', 'service_output', 'service_last_state_change', - 'service_icon_image', 'service_long_output', 'service_is_flapping', 'service_state_type', @@ -60,7 +59,6 @@ class ServiceStatus extends DataView 'service_last_notification', 'service_check_command', 'service_current_notification_number', - 'host_icon_image', 'host_acknowledged', 'host_output', 'host_long_output', diff --git a/modules/monitoring/library/Monitoring/Object/Host.php b/modules/monitoring/library/Monitoring/Object/Host.php index 2c01fe0eb..a158625b5 100644 --- a/modules/monitoring/library/Monitoring/Object/Host.php +++ b/modules/monitoring/library/Monitoring/Object/Host.php @@ -90,6 +90,7 @@ class Host extends MonitoredObject { $columns = array( 'host_icon_image', + 'host_icon_image_alt', 'host_acknowledged', 'host_action_url', 'host_active_checks_enabled', diff --git a/modules/monitoring/library/Monitoring/Object/Service.php b/modules/monitoring/library/Monitoring/Object/Service.php index fec5de238..0e8c975f2 100644 --- a/modules/monitoring/library/Monitoring/Object/Service.php +++ b/modules/monitoring/library/Monitoring/Object/Service.php @@ -107,6 +107,7 @@ class Service extends MonitoredObject { return $this->backend->select()->from('serviceStatus', array( 'host_icon_image', + 'host_icon_image_alt', 'host_acknowledged', 'host_active_checks_enabled', 'host_address', @@ -120,6 +121,7 @@ class Service extends MonitoredObject 'host_passive_checks_enabled', 'host_state', 'service_icon_image', + 'service_icon_image_alt', 'service_acknowledged', 'service_action_url', 'service_active_checks_enabled', From f808d373ea8124df7101639b0ea650a1cecf8097 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 21 May 2015 15:02:23 +0200 Subject: [PATCH 2/3] Display image icon tooltip instantly refs #9300 --- modules/monitoring/application/views/helpers/IconImage.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/helpers/IconImage.php b/modules/monitoring/application/views/helpers/IconImage.php index 416a4f335..e0e969db4 100644 --- a/modules/monitoring/application/views/helpers/IconImage.php +++ b/modules/monitoring/application/views/helpers/IconImage.php @@ -30,7 +30,8 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract null, array( 'alt' => $object->host_icon_image_alt, - 'title' => $object->host_icon_image_alt + 'title' => $object->host_icon_image_alt, + 'data-tooltip-delay' => 0 ) ); } @@ -51,7 +52,8 @@ class Zend_View_Helper_IconImage extends Zend_View_Helper_Abstract null, array( 'alt' => $object->service_icon_image_alt, - 'title' => $object->service_icon_image_alt + 'title' => $object->service_icon_image_alt, + 'data-tooltip-delay' => 0 ) ); } From 54f72377c5cb9e3ac388dced40dda61a64032d9b Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Thu, 21 May 2015 16:28:00 +0200 Subject: [PATCH 3/3] Do not display mouse-over effect in comment multi-view --- .../views/scripts/partials/comment/comment-detail.phtml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml b/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml index 98ee0534b..46de949d2 100644 --- a/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml +++ b/modules/monitoring/application/views/scripts/partials/comment/comment-detail.phtml @@ -1,11 +1,10 @@ objecttype === 'service'): ?> icon('service', $this->translate('Service')); ?> - link()->service( - $comment->service_description, + translate('%s on %s', 'Service running on host'), $comment->service_display_name, - $comment->host_name, $comment->host_display_name - ); ?> + ) ?> icon('host', $this->translate('Host')); ?> link()->host($comment->host_name, $comment->host_display_name); ?>