diff --git a/application/views/scripts/config/resource.phtml b/application/views/scripts/config/resource.phtml index c4eb9360f..342320ab9 100644 --- a/application/views/scripts/config/resource.phtml +++ b/application/views/scripts/config/resource.phtml @@ -26,21 +26,25 @@ qlink( - $this->icon('edit') . ' ' . $this->escape($name), + $name, 'config/editresource', array('resource' => $name), - array('title' => sprintf($this->translate('Edit resource %s'), $name)), - false + array( + 'icon' => 'edit', + 'title' => sprintf($this->translate('Edit resource %s'), $name) + ) ); ?>
qlink( - $this->icon('cancel'), + '', 'config/removeresource', array('resource' => $name), - array('title' => sprintf($this->translate('Remove resource %s'), $name)), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove resource %s'), $name) + ) ); ?>
diff --git a/application/views/scripts/dashboard/settings.phtml b/application/views/scripts/dashboard/settings.phtml index 10ad613de..d1ed998d1 100644 --- a/application/views/scripts/dashboard/settings.phtml +++ b/application/views/scripts/dashboard/settings.phtml @@ -24,11 +24,13 @@ qlink( - $this->icon('cancel'), + '', 'dashboard/remove-pane', array('pane' => $pane->getName()), - array('title' => sprintf($this->translate('Remove pane %s'), $pane->getName())), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove pane %s'), $pane->getName()) + ) ); ?> @@ -61,11 +63,13 @@ qlink( - $this->icon('cancel'), + '', 'dashboard/remove-dashlet', array('pane' => $pane->getName(), 'dashlet' => $dashlet->getTitle()), - array('title' => sprintf($this->translate('Remove dashlet %s from pane %s'), $dashlet->getTitle(), $pane->getName())), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove dashlet %s from pane %s'), $dashlet->getTitle(), $pane->getName()) + ) ); ?> diff --git a/application/views/scripts/form/reorder-authbackend.phtml b/application/views/scripts/form/reorder-authbackend.phtml index 23a6a67f5..02f62572d 100644 --- a/application/views/scripts/form/reorder-authbackend.phtml +++ b/application/views/scripts/form/reorder-authbackend.phtml @@ -11,20 +11,24 @@ qlink( - $this->icon('edit') . ' ' . $this->escape($backendNames[$i]), + $backendNames[$i], 'config/editAuthenticationBackend', array('auth_backend' => $backendNames[$i]), - array('title' => sprintf($this->translate('Edit authentication backend %s'), $backendNames[$i])), - false + array( + 'icon' => 'edit', + 'title' => sprintf($this->translate('Edit authentication backend %s'), $backendNames[$i]) + ) ); ?> qlink( - $this->icon('cancel'), + '', 'config/removeAuthenticationBackend', array('auth_backend' => $backendNames[$i]), - array('title' => sprintf($this->translate('Remove authentication backend %s'), $backendNames[$i])), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove authentication backend %s'), $backendNames[$i]) + ) ); ?> diff --git a/application/views/scripts/joystickPagination.phtml b/application/views/scripts/joystickPagination.phtml index ef0acdb60..9549fc2b0 100644 --- a/application/views/scripts/joystickPagination.phtml +++ b/application/views/scripts/joystickPagination.phtml @@ -29,12 +29,13 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : qlink( - $this->icon('up-open'), + '', Url::fromRequest(), array( 'page' => $currentXAxisPage . ',' . $prevYAxisPage ), array( + 'icon' => 'up-open', 'data-base-target' => '_self', 'title' => sprintf( $showText, @@ -44,8 +45,7 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : $prevYAxisPage * $yAxisPages->itemCountPerPage, $yAxisPages->totalItemCount ) - ), - false + ) ); ?> icon('up-open'); ?> @@ -57,12 +57,13 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : qlink( - $this->icon('left-open'), + '', Url::fromRequest(), array( 'page' => $prevXAxisPage . ',' . $currentYAxisPage ), array( + 'icon' => 'left-open', 'data-base-target' => '_self', 'title' => sprintf( $showText, @@ -72,8 +73,7 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : $prevXAxisPage * $xAxisPages->itemCountPerPage, $xAxisPages->totalItemCount ) - ), - false + ) ); ?> icon('left-open'); ?> @@ -83,12 +83,13 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : qlink( - $this->icon('right-open'), + '', Url::fromRequest(), array( 'page' => $nextXAxisPage . ',' . $currentYAxisPage ), array( + 'icon' => 'right-open', 'data-base-target' => '_self', 'title' => sprintf( $showText, @@ -111,12 +112,13 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : qlink( - $this->icon('down-open'), + '', Url::fromRequest(), array( 'page' => $currentXAxisPage . ',' . $nextYAxisPage ), array( + 'icon' => 'down-open', 'data-base-target' => '_self', 'title' => sprintf( $showText, @@ -126,8 +128,7 @@ $nextXAxisPage = $currentXAxisPage < $totalXAxisPages ? $currentXAxisPage + 1 : $nextYAxisPage === $yAxisPages->last ? $yAxisPages->totalItemCount : $nextYAxisPage * $yAxisPages->itemCountPerPage, $yAxisPages->totalItemCount ) - ), - false + ) ); ?> icon('down-open'); ?> diff --git a/application/views/scripts/roles/index.phtml b/application/views/scripts/roles/index.phtml index fa1297396..350fb3343 100644 --- a/application/views/scripts/roles/index.phtml +++ b/application/views/scripts/roles/index.phtml @@ -56,11 +56,13 @@ escape($role->groups) ?> qlink( - $this->icon('cancel'), + '', 'roles/remove', array('role' => $name), - array('title' => sprintf($this->translate('Remove role %s'), $name)), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove role %s'), $name) + ) ); ?> diff --git a/library/Icinga/Web/View/helpers/url.php b/library/Icinga/Web/View/helpers/url.php index d4518d2aa..925a225f9 100644 --- a/library/Icinga/Web/View/helpers/url.php +++ b/library/Icinga/Web/View/helpers/url.php @@ -28,15 +28,23 @@ $this->addHelperFunction('url', function ($path = null, $params = null) { }); $this->addHelperFunction('qlink', function ($title, $url, $params = null, $properties = null, $escape = true) use ($view) { - if ($properties && array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) { - $properties['aria-label'] = $properties['title']; + $icon = ''; + if ($properties) { + if (array_key_exists('title', $properties) && !array_key_exists('aria-label', $properties)) { + $properties['aria-label'] = $properties['title']; + } + + if (array_key_exists('icon', $properties)) { + $icon = $view->icon($properties['icon']); + unset($properties['icon']); + } } return sprintf( '%s', $view->url($url, $params), $view->propertiesToString($properties), - $escape ? $view->escape($title) : $title + $icon . ($escape ? $view->escape($title) : $title) ); }); diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php index 21dd0f04a..0a8de5586 100644 --- a/library/Icinga/Web/Widget/FilterEditor.php +++ b/library/Icinga/Web/Widget/FilterEditor.php @@ -310,8 +310,8 @@ class FilterEditor extends AbstractWidget $this->preservedUrl()->with('removeFilter', $filter->getId()), null, array( - 'title' => t('Remove this part of your filter'), - 'class' => 'icon-cancel' + 'icon' => 'icon-cancel', + 'title' => t('Remove this part of your filter') ) ); } @@ -323,8 +323,8 @@ class FilterEditor extends AbstractWidget $this->preservedUrl()->with('addFilter', $filter->getId()), null, array( - 'title' => t('Add another filter'), - 'class' => 'icon-plus' + 'icon' => 'icon-plus', + 'title' => t('Add another filter') ) ); } @@ -336,8 +336,8 @@ class FilterEditor extends AbstractWidget $this->preservedUrl()->with('stripFilter', $filter->getId()), null, array( - 'title' => t('Strip this filter'), - 'class' => 'icon-minus' + 'icon' => 'icon-minus', + 'title' => t('Strip this filter') ) ); } @@ -349,8 +349,8 @@ class FilterEditor extends AbstractWidget $this->preservedUrl()->without('addFilter'), null, array( - 'title' => t('Cancel this operation'), - 'class' => 'icon-cancel' + 'icon' => 'icon-cancel', + 'title' => t('Cancel this operation') ) ); } diff --git a/modules/monitoring/application/views/scripts/config/index.phtml b/modules/monitoring/application/views/scripts/config/index.phtml index 0fdb5f8c3..634da957c 100644 --- a/modules/monitoring/application/views/scripts/config/index.phtml +++ b/modules/monitoring/application/views/scripts/config/index.phtml @@ -19,11 +19,13 @@ qlink( - $this->icon('edit') . ' ' . $this->escape($backendName), + $backendName, '/monitoring/config/editbackend', array('backend' => $backendName), - array('title' => sprintf($this->translate('Edit monitoring backend %s'), $backendName)), - false + array( + 'icon' => 'edit', + 'title' => sprintf($this->translate('Edit monitoring backend %s'), $backendName) + ) ); ?> (translate('Type: %s'), @@ -32,11 +34,13 @@ qlink( - $this->icon('cancel'), + '', '/monitoring/config/removebackend', array('backend' => $backendName), - array('title' => sprintf($this->translate('Remove monitoring backend %s'), $backendName)), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove monitoring backend %s'), $backendName) + ) ); ?> @@ -59,11 +63,13 @@ qlink( - $this->icon('edit') . ' ' . $this->escape($instanceName), + $instanceName, '/monitoring/config/editinstance', array('instance' => $instanceName), - array('title' => sprintf($this->translate('Edit monitoring instance %s'), $instanceName)), - false + array( + 'icon' => 'edit', + 'title' => sprintf($this->translate('Edit monitoring instance %s'), $instanceName) + ) ); ?> (translate('Type: %s'), @@ -72,11 +78,13 @@ qlink( - $this->icon('cancel'), + '', '/monitoring/config/removeinstance', array('instance' => $instanceName), - array('title' => sprintf($this->translate('Remove monitoring instance %s'), $instanceName)), - false + array( + 'icon' => 'cancel', + 'title' => sprintf($this->translate('Remove monitoring instance %s'), $instanceName) + ) ); ?> diff --git a/modules/monitoring/application/views/scripts/hosts/show.phtml b/modules/monitoring/application/views/scripts/hosts/show.phtml index 5e2417335..8655a31b1 100644 --- a/modules/monitoring/application/views/scripts/hosts/show.phtml +++ b/modules/monitoring/application/views/scripts/hosts/show.phtml @@ -14,31 +14,22 @@
qlink( - $this->icon('reschedule') . ' ' . sprintf( - $this->translate('Reschedule the next check for all %u hosts'), - $hostCount - ), + sprintf($this->translate('Reschedule the next check for all %u hosts'), $hostCount), $rescheduleAllLink, null, - null, - false + array('icon' => 'reschedule') ); ?>
qlink( - $this->icon('plug') . ' ' . sprintf($this->translate('Schedule a downtime for all %u hosts'), $hostCount), + sprintf($this->translate('Schedule a downtime for all %u hosts'), $hostCount), $downtimeAllLink, null, - null, - false + array('icon' => 'plug') ); ?>
qlink( - $this->icon('reply') . ' ' . sprintf( - $this->translate('Submit a passive check result for all %u hosts'), - $hostCount - ), + sprintf($this->translate('Submit a passive check result for all %u hosts'), $hostCount), $processCheckResultAllLink, null, - null, - false + array('icon' => 'reply') ); ?>
0): ?>
@@ -51,7 +42,7 @@ $unhandledCount ); ?>
qlink( - $this->icon('plug') . ' ' . sprintf( + sprintf( $this->translatePlural( 'Schedule a downtime for %u unhandled host problem', 'Schedule a downtime for %u unhandled host problems', @@ -61,11 +52,10 @@ ), $downtimeUnhandledLink, null, - null, - false + array('icon' => 'plug') ); ?>
qlink( - $this->icon('ok') . ' ' . sprintf( + sprintf( $this->translatePlural( 'Acknowledge %u unhandled host problem', 'Acknowledge %u unhandled host problems', @@ -75,8 +65,7 @@ ), $acknowledgeUnhandledLink, null, - null, - false + array('icon' => 'ok') ); ?>
@@ -95,7 +84,7 @@ 0): ?>

qlink( - $this->icon('plug') . ' ' . sprintf( + sprintf( $this->translatePlural( 'List %u host currently in downtime', 'List %u hosts currently in downtime', @@ -105,13 +94,12 @@ ), $inDowntimeLink, null, - null, - false + array('icon' => 'plug') ); ?>

getComments())) > 0): ?>

qlink( - $this->icon('comment') . ' ' . sprintf( + sprintf( $this->translatePlural( 'List %u host comment', 'List %u host comments', @@ -121,8 +109,7 @@ ), $commentsLink, null, - null, - false + array('icon' => 'comment') ); ?>

diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index 78435fa3e..878b394c7 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -17,16 +17,15 @@ foreach ($contacts as $contact): ?>
img('/static/gravatar', array('email' => $contact->contact_email)); ?> - qlink( - '' . $this->escape($contact->contact_name) . '', + qlink( + $contact->contact_name, 'monitoring/show/contact', array('contact' => $contact->contact_name), array('title' => sprintf( $this->translate('Show detailed information about %s'), $contact->contact_alias - )), - false - ); ?> (contact_alias; ?>) + )) + ); ?> (contact_alias; ?>)
translate('Email'); ?>: escape($contact->contact_email); ?> diff --git a/modules/monitoring/application/views/scripts/services/show.phtml b/modules/monitoring/application/views/scripts/services/show.phtml index cc88b09e3..015fecb95 100644 --- a/modules/monitoring/application/views/scripts/services/show.phtml +++ b/modules/monitoring/application/views/scripts/services/show.phtml @@ -14,31 +14,22 @@
qlink( - $this->icon('reschedule') . ' ' . sprintf( - $this->translate('Reschedule the next check for all %u services'), - $serviceCount - ), + sprintf($this->translate('Reschedule the next check for all %u services'), $serviceCount), $rescheduleAllLink, null, - null, - false + array('icon' => 'reschedule') ); ?>
qlink( - $this->icon('plug') . ' ' . sprintf($this->translate('Schedule a downtime for all %u services'), $serviceCount), + sprintf($this->translate('Schedule a downtime for all %u services'), $serviceCount), $downtimeAllLink, null, - null, - false + array('icon' => 'plug') ); ?>
qlink( - $this->icon('reply') . ' ' . sprintf( - $this->translate('Submit a passive check result for all %u services'), - $serviceCount - ), + sprintf($this->translate('Submit a passive check result for all %u services'), $serviceCount), $processCheckResultAllLink, null, - null, - false + array('icon' => 'reply') ); ?>
0): ?>
@@ -51,7 +42,7 @@ $unhandledCount ); ?>
qlink( - $this->icon('plug') . ' ' . sprintf( + sprintf( $this->translatePlural( 'Schedule a downtime for %u unhandled service problem', 'Schedule a downtime for %u unhandled service problems', @@ -61,11 +52,10 @@ ), $downtimeUnhandledLink, null, - null, - false + array('icon' => 'plug') ); ?>
qlink( - $this->icon('ok') . ' ' . sprintf( + sprintf( $this->translatePlural( 'Acknowledge %u unhandled service problem', 'Acknowledge %u unhandled service problems', @@ -75,8 +65,7 @@ ), $acknowledgeUnhandledLink, null, - null, - false + array('icon' => 'ok') ); ?>
@@ -95,7 +84,7 @@ 0): ?>

qlink( - $this->icon('plug') . ' ' . sprintf( + sprintf( $this->translatePlural( 'List %u service currently in downtime', 'List %u services currently in downtime', @@ -105,13 +94,12 @@ ), $inDowntimeLink, null, - null, - false + array('icon' => 'plug') ); ?>

getComments())) > 0): ?>

qlink( - $this->icon('comment') . ' ' . sprintf( + sprintf( $this->translatePlural( 'List %u service comment', 'List %u service comments', @@ -121,8 +109,7 @@ ), $commentsLink, null, - null, - false + array('icon' => 'comment') ); ?>

diff --git a/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml b/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml index e5f85c021..22a372151 100644 --- a/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml +++ b/modules/monitoring/application/views/scripts/show/components/acknowledgement.phtml @@ -36,13 +36,15 @@ if ($object->acknowledged): ?> } ?> qlink( - $this->icon('ok') . ' ' . $this->translate('Acknowledge'), + $this->translate('Acknowledge'), $ackLink, null, - array('title' => $this->translate( - 'Acknowledge this problem, suppress all future notifications for it and tag it as being handled' - )), - false + array( + 'icon' => 'ok', + 'title' => $this->translate( + 'Acknowledge this problem, suppress all future notifications for it and tag it as being handled' + ) + ) ); ?> getType() === $object::TYPE_HOST) { hasPermission('monitoring/command/schedule-check')) { if ($isService) { echo $this->qlink( - $this->icon('reschedule') . ' ' . $this->translate('Reschedule'), + $this->translate('Reschedule'), 'monitoring/service/reschedule-check', array('host' => $object->getHost()->getName(), 'service' => $object->getName()), array( + 'icon' => 'reschedule', 'data-base-target' => '_self', 'title' => $this->translate( 'Schedule the next active check at a different time than the current one' ) - ), - false + ) ); } else { echo $this->qlink( - $this->icon('reschedule') . ' ' . $this->translate('Reschedule'), + $this->translate('Reschedule'), 'monitoring/host/reschedule-check', array('host' => $object->getName()), array( + 'icon' => 'reschedule', 'data-base-target' => '_self', 'title' => $this->translate( 'Schedule the next active check at a different time than the current one' ) - ), - false + ) ); } } ?> timeUntil($object->next_check) ?> diff --git a/modules/monitoring/application/views/scripts/show/components/command.phtml b/modules/monitoring/application/views/scripts/show/components/command.phtml index 771e0812c..d7fca7cfa 100644 --- a/modules/monitoring/application/views/scripts/show/components/command.phtml +++ b/modules/monitoring/application/views/scripts/show/components/command.phtml @@ -13,19 +13,25 @@ $command = array_shift($parts); $title = sprintf($this->translate('Submit a one time or so called passive result for the %s check'), $command); if ($object->getType() === $object::TYPE_HOST) { echo $this->qlink( - $this->icon('reply') . ' ' . $this->translate('Process check result'), + $this->translate('Process check result'), 'monitoring/host/process-check-result', array('host' => $object->getName()), - array('data-base-target' => '_self', 'title' => $title), - false + array( + 'icon' => 'reply', + 'data-base-target' => '_self', + 'title' => $title + ) ); } else { echo $this->qlink( - $this->icon('reply') . ' ' . $this->translate('Process check result'), + $this->translate('Process check result'), 'monitoring/service/process-check-result', array('host' => $object->getHost()->getName(), 'service' => $object->getName()), - array('data-base-target' => '_self', 'title' => $title), - false + array( + 'icon' => 'reply', + 'data-base-target' => '_self', + 'title' => $title + ) ); } } ?> diff --git a/modules/monitoring/application/views/scripts/show/components/comments.phtml b/modules/monitoring/application/views/scripts/show/components/comments.phtml index 74da7d054..fa7d4606a 100644 --- a/modules/monitoring/application/views/scripts/show/components/comments.phtml +++ b/modules/monitoring/application/views/scripts/show/components/comments.phtml @@ -5,25 +5,25 @@ /** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */ if ($object->getType() === $object::TYPE_HOST) { echo $this->qlink( - $this->icon('comment') . ' ' . $this->translate('Add comment'), + $this->translate('Add comment'), 'monitoring/host/add-comment', array('host' => $object->getName()), array( + 'icon' => 'comment', 'data-base-target' => '_self', 'title' => $this->translate('Add a new comment to this host') - ), - false + ) ); } else { echo $this->qlink( - $this->icon('comment') . ' ' . $this->translate('Add comment'), + $this->translate('Add comment'), 'monitoring/service/add-comment', array('host' => $object->getHost()->getName(), 'service' => $object->getName()), array( + 'icon' => 'comment', 'data-base-target' => '_self', 'title' => $this->translate('Add a new comment to this service') - ), - false + ) ); } } else { diff --git a/modules/monitoring/application/views/scripts/show/components/downtime.phtml b/modules/monitoring/application/views/scripts/show/components/downtime.phtml index 16f12f6ba..76a4be005 100644 --- a/modules/monitoring/application/views/scripts/show/components/downtime.phtml +++ b/modules/monitoring/application/views/scripts/show/components/downtime.phtml @@ -5,29 +5,29 @@ /** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */ if ($object->getType() === $object::TYPE_HOST) { echo $this->qlink( - $this->icon('plug') . ' ' . $this->translate('Schedule downtime'), + $this->translate('Schedule downtime'), 'monitoring/host/schedule-downtime', array('host' => $object->getName()), array( + 'icon' => 'plug', 'data-base-target' => '_self', 'title' => $this->translate( 'Schedule a downtime to suppress all problem notifications within a specific period of time' ) - ), - false + ) ); } else { echo $this->qlink( - $this->icon('plug') . ' ' . $this->translate('Schedule downtime'), + $this->translate('Schedule downtime'), 'monitoring/service/schedule-downtime', array('host' => $object->getHost()->getName(), 'service' => $object->getName()), array( + 'icon' => 'plug', 'data-base-target' => '_self', 'title' => $this->translate( 'Schedule a downtime to suppress all problem notifications within a specific period of time' ) - ), - false + ) ); } } else { diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index d55258d90..0542294d6 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -141,7 +141,7 @@ $output = $this->tickets ? preg_replace_callback( translate('%s on %s', 'Service running on host'), $hostContext ? $this->qlink( - $this->escape($event->service_display_name), + $event->service_display_name, 'monitoring/show/service', array( 'host' => $event->host_name,