diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index 667ceaaae..27e4c47ad 100755 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -1,39 +1,43 @@ - - - + + + - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + + diff --git a/application/layouts/scripts/parts/navigation.phtml b/application/layouts/scripts/parts/navigation.phtml index 04dbf801e..a540de768 100755 --- a/application/layouts/scripts/parts/navigation.phtml +++ b/application/layouts/scripts/parts/navigation.phtml @@ -1,19 +1,19 @@ getRequest()->getRequestUri(); - $currentKey = isset($this->navkey) ? $this->navkey : $url; +// determine current key +$url = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(); +$currentKey = isset($this->navkey) ? $this->navkey : $url; - $item = $this->navigation->keys("menu"); +$item = $this->navigation->keys("menu"); ?> auth()->isAuthenticated()): ?> - + ?> + diff --git a/application/layouts/scripts/parts/topbar.phtml b/application/layouts/scripts/parts/topbar.phtml index 57e5b0dd8..d8beab354 100755 --- a/application/layouts/scripts/parts/topbar.phtml +++ b/application/layouts/scripts/parts/topbar.phtml @@ -18,8 +18,11 @@ diff --git a/application/views/helpers/QUrl.php b/application/views/helpers/Href.php similarity index 60% rename from application/views/helpers/QUrl.php rename to application/views/helpers/Href.php index c54e49e09..2a4e36adf 100644 --- a/application/views/helpers/QUrl.php +++ b/application/views/helpers/Href.php @@ -1,45 +1,48 @@ - * @author Icinga Development Team + * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 + * @author Icinga Development Team */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Web\Url; -class Zend_View_Helper_QUrl extends Zend_View_Helper_Abstract +/** + * Helper class for creating absolute links from relative strings + * + */ +class Zend_View_Helper_Href extends Zend_View_Helper_Abstract { - public function qUrl() - { - $params = func_get_args(); - $url = array_shift($params); - if (isset($params[0])) { - $params = $params[0]; - } else { - $params = array(); - } - return Url::fromPath($url, $params); + + /** + * Turn the relative link $link into absolute one + * + * @param $link + */ + public function href($link, array $params = array()) { + return Url::fromPath($link, $params)->getAbsoluteUrl(); } } - -// @codingStandardsIgnoreStop +// @codingStandardsIgnoreEnd diff --git a/application/views/helpers/Qlink.php b/application/views/helpers/Qlink.php deleted file mode 100755 index 8c870a4e5..000000000 --- a/application/views/helpers/Qlink.php +++ /dev/null @@ -1,124 +0,0 @@ - - * @author Icinga Development Team - */ -// {{{ICINGA_LICENSE_HEADER}}} - -use Icinga\Web\Url; - -/** - * Class Zend_View_Helper_Qlink - * TODO: Search for the best and safest quoting - * TODO: Check whether attributes are safe. Script, title in combination with - * Hover-Tips etc. Eventually create a whitelist for a few options only. - */ -class Zend_View_Helper_Qlink extends Zend_View_Helper_Abstract -{ - - public function qlink($htmlContent, $urlFormat, array $uriParams = array(), - array $properties = array()) - { - $quote = true; - $attributes = array(); - $baseUrl = null; - foreach ($properties as $key => $val) { - if ($key === 'baseUrl' ) { - // $baseUrl = filter_var($val, FILTER_SANITIZE_URL) . '/'; - $baseUrl = $val; //rawurlencode($val) . '/'; - continue; - } - if ($key === 'quote') { - $quote = $val; - continue; - } - if ($key === 'target') { - $attributes[] = 'target="'.$val.'"'; - } - if ($key === 'style' && is_array($val)) { - if (empty($val)) { - continue; - } - $parts = array(); - foreach ($val as $k => $v) { - $parts[] = "$k: $v"; - } - $attributes[] = 'style="' . implode('; ', $parts) . '"'; - continue; - } - $attributes[] = sprintf( - '%s="%s"', - //filter_var($key, FILTER_SANITIZE_URL), - rawurlencode($key), - //filter_var($val, FILTER_SANITIZE_FULL_SPECIAL_CHARS) - rawurlencode($val) - ); - - } - if ($urlFormat instanceof Url) { - $url = $urlFormat; - $uriParams = $url->getParams() + $uriParams; - } else { - $url = Url::fromPath($urlFormat); - } - $url->setParams($uriParams); - if ($baseUrl) { - $url->setBaseUrl($baseUrl); - } - return sprintf( - '%s', -// $this->getFormattedUrl($urlFormat, $uriParams, $baseUrl), - $url, - !empty($attributes) ? ' ' . implode(' ', $attributes) : '', - $quote - ? filter_var( - $htmlContent, - FILTER_SANITIZE_FULL_SPECIAL_CHARS, - FILTER_FLAG_NO_ENCODE_QUOTES - ) - // Alternativ: htmlentities($htmlContent) - : $htmlContent - ); - } -/* - public function getFormattedUrl($urlFormat, $uriParams, $baseUrl = null) - { - $params = $args = array(); - foreach ($uriParams as $name => $value) { - if (is_int($name)) { - $params[] = rawurlencode($value); - } else { - $args[] = rawurlencode($name) . '=' . rawurlencode($value); - } - } - $url = $urlFormat; - $url = vsprintf($url, $params); - if (! empty($args)) { - $url .= '?' . implode('&', $args); - } - return is_null($baseUrl) ? $this->view->baseUrl($url) : $baseUrl.$url; - } -*/ -} - -// @codingStandardsIgnoreStop diff --git a/application/views/helpers/layout/Container.php b/application/views/helpers/layout/Container.php deleted file mode 100644 index 12cb1ddab..000000000 --- a/application/views/helpers/layout/Container.php +++ /dev/null @@ -1,140 +0,0 @@ -view = $view; - $this->id = $containerid; - - foreach ($flags as $type => $value) { - if ($type === 'elementId') { - $this->elementId = $value; - continue; - } - if ($type === 'refreshInterval') { - $this->refreshInterval = intval($type); - continue; - } - if ($type == 'detachable' && $value == true) { - $this->features["detachable"] = true; - continue; - } - if ($type == 'expandable' && $value == true) { - $this->features["expandable"] = true; - continue; - } - - if ($type == "icingaUrl") { - $this->url = $value; - continue; - } - if ($type == "iframeFallback") { - $this->iframeFallback = true; - } - if ($type == 'class') { - $this->class = $value; - continue; - } - } - return $this; - } - public function beginContent() - { - ob_start(); - return $this; - - } - - public function endContent() - { - $content = ob_get_contents(); - ob_end_clean(); - return $this->buildDOM($content); - } - - public function buildDOM($content = "") - { - $additional = ""; - if ($this->refreshInterval > 0) - $additional .= " container-refresh-interval='{$this->refreshInterval}' "; - if ($this->elementId) - $additional .= " id='$this->elementId'"; - $url = ""; - if ($this->url) { - $url = $this->view->baseUrl($this->url); - $additional .= "icinga-url='{$url}'"; - if($this->iframeFallback) { - $content = " - - "; - } - } - - $controls = $this->getControlDOM(); - - $html = " -
- $controls - $content -
- "; - - return $html; - } - - private function getControlDOM() - { - if(empty($this->features)) - return ""; - $features = ""; - foreach($this->features as $feature=>$enabled) { - if(!$enabled) - continue; - if($feature == "detachable") { - $url = $this->view->baseUrl($this->url ? $this->url : Zend_Controller_Front::getInstance()->getRequest()->getRequestUri()); - $features .= " - "; - } - if($feature == "expandable") { - $url = $this->url ? $this->url : Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(); - $features .= " - "; - } - } - return "
$features
"; - } - - public function registerTabs($tabHelper) - { - - } - - public function __toString() { - return $this->endContent(); - } -} - -class Zend_View_Helper_Container extends Zend_View_Helper_Abstract -{ - - /** - * @param $id - * @param array $flags - * @return Zend_View_Helper_Container - */ - public function container($containerid, $flags = array()) - { - return new Zend_View_Helper_Container_State($containerid,$flags,$this->view); - - } - - -} diff --git a/application/views/helpers/layout/DetailTabs.php b/application/views/helpers/layout/DetailTabs.php deleted file mode 100644 index 7a33cbdb1..000000000 --- a/application/views/helpers/layout/DetailTabs.php +++ /dev/null @@ -1,65 +0,0 @@ - $settings->qlink( - 'Host', - $module.'/detail/show', - $urlParams + array('active' => 'host') - ), - ); - - if ($settings->service) { - $tabs['service'] = $settings->qlink( - 'Service', - $module.'/detail/show', - $urlParams - ); - } - - $tabs['history'] = $settings->qlink( - 'History', - $module.'/history', - $urlParams - ); - - - $tabs['hostservices'] = $settings->qlink( - 'Services', - $module.'/hostservices', - $urlParams - ); - - - $html = '"; - - - return $html; - } - -} diff --git a/application/views/helpers/layout/Expandable.php b/application/views/helpers/layout/Expandable.php deleted file mode 100644 index 3c36bd22f..000000000 --- a/application/views/helpers/layout/Expandable.php +++ /dev/null @@ -1,58 +0,0 @@ - -
$title
- "; - } - $controls = $this->getControlDOM(); - $skeleton = " - "; - return $skeleton; - } - - public function getControlDOM() { - - $features = " - - - - - - - "; - - - return "
$features
"; - } -} diff --git a/application/views/scripts/index/welcome.phtml b/application/views/scripts/index/welcome.phtml index 566aea19e..982e45304 100644 --- a/application/views/scripts/index/welcome.phtml +++ b/application/views/scripts/index/welcome.phtml @@ -1,2 +1,2 @@

Welcome to Icinga!

-You should install/configure some qlink('modules', 'modules/overview') ?> now! +You should install/configure some modules now! diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index c0395a4ce..5698de2d0 100755 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -235,6 +235,8 @@ class ActionController extends ZfController { if ($url instanceof Url) { $url = $url->getRelativeUrl(); + } else { + $url = Url::fromPath($url)->getRelativeUrl(); } $this->_helper->Redirector->gotoUrlAndExit($url); } diff --git a/modules/monitoring/application/controllers/CommandController.php b/modules/monitoring/application/controllers/CommandController.php index 3f243d7a7..1796bcf3e 100644 --- a/modules/monitoring/application/controllers/CommandController.php +++ b/modules/monitoring/application/controllers/CommandController.php @@ -29,7 +29,7 @@ use Icinga\Application\Benchmark; use Icinga\Application\Icinga; -use \Monitoring\Backend; +use \Icinga\Module\Monitoring\Backend; use \Icinga\Application\Config; use Icinga\Application\Logger; use Icinga\Authentication\Manager; diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 231760ddd..9c9ffda19 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -85,7 +85,6 @@ class Monitoring_ShowController extends ModuleActionController } $this->view->object = $object; $this->createTabs(); - $this->prepareTicketHook(); } /** @@ -302,7 +301,6 @@ class Monitoring_ShowController extends ModuleActionController ->where('object_type', 'host') ->fetchPairs(); $this->view->object->prefetch(); - $this->prepareTicketHook(); $this->prepareGrapherHook(); } @@ -359,52 +357,6 @@ class Monitoring_ShowController extends ModuleActionController )); } - /** - * Ticets actions - */ - public function ticketAction() - { - if (Hook::has('ticket')) { - // TODO: Still hardcoded, should ask for URL: - $id = $this->_getParam('ticket'); - $ticketModule = 'rt'; - $this->render(); - $this->redirect( - 'ticket', - 'show', - $ticketModule, - array( - 'id' => $id - ) - ); - } - } - - protected function prepareTicketHook() - { - if (Hook::has('ticket')) { - $object = $this->view->object; - $params = array( - 'host' => $object->host_name - ); - if ($object instanceof Service) { - $params['service'] = $object->service_description; - } - - $params['ticket'] = '__ID__'; - $this->view->ticket_link = preg_replace( - '~__ID__~', - '\$1', - $this->view->qlink('#__ID__', - 'monitoring/show/ticket', - $params - ) - ); - // TODO: Global ticket pattern config (or per environment) - $this->view->ticket_pattern = '~#(\d{4,6})~'; - } - } - protected function prepareGrapherHook() { if ($grapher = Hook::get('grapher')) { @@ -482,18 +434,9 @@ class Monitoring_ShowController extends ModuleActionController 'urlParams' => $params, ) ); - if ($this->action_name === 'ticket') { - $tabs->add( - 'ticket', - array( - 'title' => 'Ticket', - 'icon' => 'img/classic/ticket.gif', - 'url' => 'monitoring/show/ticket', - 'urlParams' => $params + array('ticket' => $this->_getParam('ticket')), - ) - ); - } - + + + $tabs->extend(new OutputFormat()) ->extend(new DashboardAction()) ->extend(new BasketAction); diff --git a/modules/monitoring/application/views/scripts/command/list.phtml b/modules/monitoring/application/views/scripts/command/list.phtml index f37ae4db1..31a77bd5e 100644 --- a/modules/monitoring/application/views/scripts/command/list.phtml +++ b/modules/monitoring/application/views/scripts/command/list.phtml @@ -2,7 +2,9 @@ \ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index de4ef74b2..75412addb 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -16,143 +16,121 @@ function formatDateString($self,$dateString){ $paginator = $downtimes->paginate(); $downtimes = $downtimes->fetchAll(); ?> -
- Sort by formSelect( - 'sort', - $this->sort, - array('class' => 'autosubmit'), - array( - 'downtime_is_in_effect' => 'Is In Effect', - 'object_type' => 'Service/Host', - 'host_name' => 'Host Name', - 'service_description' => 'Service Name', - 'downtime_entry_time' => 'Entry Time', - 'downtime_author_name' => 'Author', - 'downtime_comment_data' => 'Comment', - 'downtime_scheduled_start_time' => 'Start', - 'downtime_scheduled_end_time' => 'End', - 'downtime_trigger_time' => 'Trigger Time', - 'downtime_internal_downtime_id' => 'Downtime ID', - 'downtime_duration' => 'Duration', - ) - ) ?> - + Sort by formSelect( + 'sort', + $this->sort, + array('class' => 'autosubmit'), + array( + 'downtime_is_in_effect' => 'Is In Effect', + 'object_type' => 'Service/Host', + 'host_name' => 'Host Name', + 'service_description' => 'Service Name', + 'downtime_entry_time' => 'Entry Time', + 'downtime_author_name' => 'Author', + 'downtime_comment_data' => 'Comment', + 'downtime_scheduled_start_time' => 'Start', + 'downtime_scheduled_end_time' => 'End', + 'downtime_trigger_time' => 'Trigger Time', + 'downtime_internal_downtime_id' => 'Downtime ID', + 'downtime_duration' => 'Duration', + ) + ) ?> +
paginationControl( - $paginator, - null, - array( - 'mixedPagination.phtml', - 'default'), - array('preserve' => $this->preserve)) +$paginator, +null, +array( +'mixedPagination.phtml', +'default'), +array('preserve' => $this->preserve)) ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Is In Effect Object Host Name Service Name Entry Time Author Comment Start Time End Time Type Trigger Time Downtime ID Trigger ID Duration
- downtime_is_in_effect == 0 ? 'False' : 'True'; ?> - -
- object_type == 'service'): ?> - - - object_type == 'host'): ?> - - -
-
- host_name ?> - - service_description ?> - - downtime_entry_time); ?> - - downtime_author_name ?> - - downtime_comment_data ?> - - downtime_scheduled_start_time); ?> - - downtime_scheduled_end_time); ?> - - downtime_is_fixed == 1 ? 'Fixed' : 'Not Fixed' ?> - - downtime_trigger_time); - echo $date != 'undef' ? $date : 'N/A'; - ?> - - downtime_internal_downtime_id ?> - - downtime_triggered_by_id == 0 ? - 'N/A' : $downtime->downtime_triggered_by_id ?> - - util()->showHourMin(intval($downtime->downtime_duration)); ?> - - service_description)) { - echo $this->qlink( - '', - 'monitoring/show/host', - array( - 'host' => $downtime->host_name - ), - array( - 'class' => 'row-action' - ) - ); - } else { - echo $this->qlink( - '', - 'monitoring/show/service', - array( - 'host' => $downtime->host_name, - 'service' => $downtime->service_description - ), - array( - 'class' => 'row-action' - ) - ); - } - ?> -
Is In Effect Object Host Name Service Name Entry Time Author Comment Start Time End Time Type Trigger Time Downtime ID Trigger ID Duration
+ downtime_is_in_effect == 0 ? 'False' : 'True'; ?> + +
+ + object_type == 'service'): ?> + + + + object_type == 'host'): ?> + + + +
+
+ host_name ?> + + service_description ?> + + downtime_entry_time); ?> + + downtime_author_name ?> + + downtime_comment_data ?> + + downtime_scheduled_start_time); ?> + + downtime_scheduled_end_time); ?> + + downtime_is_fixed == 1 ? 'Fixed' : 'Not Fixed' ?> + + downtime_trigger_time); + echo $date != 'undef' ? $date : 'N/A'; + ?> + + downtime_internal_downtime_id ?> + + downtime_triggered_by_id == 0 ? + 'N/A' : $downtime->downtime_triggered_by_id ?> + + util()->showHourMin(intval($downtime->downtime_duration)); ?> + +
diff --git a/modules/monitoring/application/views/scripts/list/hosts-compact.phtml b/modules/monitoring/application/views/scripts/list/hosts-compact.phtml index bb7401421..3da1a7c7a 100644 --- a/modules/monitoring/application/views/scripts/list/hosts-compact.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts-compact.phtml @@ -4,106 +4,108 @@ $viewHelper = $this->getHelper('MonitoringState'); $trimArea = $this->getHelper('Trim'); ?> -paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?> +paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?> + + + + + + + + + + + + + - - - - - - - - - - - - - - - + - - - - + + + + + + + + +
StatusHostOutput
+
start(); ?> + host_icon_image) : ?> + + + end(); ?> +
+
+
start(); ?> -
StatusHostOutput
-
start(); ?> - host_icon_image) : ?> - - - end(); ?>
-
-
start(); ?> - host_handled && $host->host_state > 0): ?> - - - - - host_acknowledged && !$host->host_in_downtime): ?> - - - - - host_is_flapping): ?> - - - - - host_notifications_enabled): ?> - - - - - host_in_downtime): ?> - - - - - end(); ?>
-
-
- qlink( - "".ucfirst($viewHelper->monitoringState($host, 'host')).''. - '
since '. - $this->timeSince($host->host_last_state_change), - 'monitoring/show/history', array( - 'host' => $host->host_name - ), - array('quote' => false) - );?> - host_state_type == 0): ?> - - - - -
-
- host_last_comment !== null): ?> - - - - - qlink( - ''.$host->host_name.'
'. - ''.$host->host_address.'', - 'monitoring/show/host', array( - 'host' => $host->host_name - ), array( - 'class' => 'row-action', - 'quote' => false - ) - ); ?> + host_handled && $host->host_state > 0): ?> + + + + + + host_acknowledged && !$host->host_in_downtime): ?> + + + + + + host_is_flapping): ?> + + + + + + host_notifications_enabled): ?> + + + + + + host_in_downtime): ?> + + + + + + end(); ?> + +
+ - escape(substr(strip_tags($host->host_output), 0, 500)); ?> -
+ host_last_comment !== null): ?> + + + + + + host_name; ?> +
+ host_address; ?> +
+ + host_action_url != ''): ?> + Action + + + host_notes_url != ''): ?> + Notes + +
+ escape(substr(strip_tags($host->host_output), 0, 500)); ?> +
diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 325c3800b..f7b2a6d0b 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -5,123 +5,127 @@ $hosts = $this->hosts->paginate(); $viewHelper = $this->getHelper('MonitoringState'); $trimArea = $this->getHelper('Trim'); ?> -
- Sort by formSelect( - 'sort', - $this->sort, - array('class' => 'autosubmit'), - array( - 'host_severity' => 'Severity', - 'host_last_state_change' => 'Last state change', - 'host_name' => 'Host', - ) - ) ?> - + + Sort by formSelect( + 'sort', + $this->sort, + array('class' => 'autosubmit'), + array( + 'host_severity' => 'Severity', + 'host_last_state_change' => 'Last state change', + 'host_name' => 'Host', + ) + ); ?> +
paginationControl($hosts, null, null, array('preserve' => $this->preserve)) ?> - - - - - - - - - - - - - - + + + + + + + + + - + + + - - - - + + + + + + + + +
StatusHostOutput
-
start(); ?> - host_icon_image) : ?> - - - end(); ?>
-
-
start(); ?> - host_handled && $host->host_state > 0): ?> - - - - - host_acknowledged && !$host->host_in_downtime): ?> - - - - - host_is_flapping): ?> - - - - - host_notifications_enabled): ?> - - - - - host_in_downtime): ?> - - - - - end(); ?>
-
-
- qlink( - "".ucfirst($viewHelper->monitoringState($host, 'host'))."". - '
since '. - $this->timeSince($host->host_last_state_change), - 'monitoring/show/history', array( - 'host' => $host->host_name - ), - array('quote' => false) - );?> - host_state_type == 0): ?> - - - - -
-
StatusHostOutput
- host_last_comment !== null): ?> - - - - - qlink( - "".$host->host_name."
". - "".$host->host_address."", - 'monitoring/show/host', array( - 'host' => $host->host_name - ), array( - 'class' => 'row-action', - 'quote' => false - ) - ); ?> + +
+
+ start(); ?> + + host_icon_image) : ?> + + + + end(); ?> +
+
+
+ start(); ?> + + host_handled && $host->host_state > 0): ?> + + + + + + host_acknowledged && !$host->host_in_downtime): ?> + + + + + + host_is_flapping): ?> + + + + + + host_notifications_enabled): ?> + + + + + + host_in_downtime): ?> + + + + + + end(); ?> + +
+
+
+ monitoringState($host, 'host')); ?> + +
since  + timeSince($host->host_last_state_change); ?> - host_action_url != ""): ?> - Action - + host_state_type == 0): ?> + + + + - host_notes_url != ""): ?> - Notes - -
- escape(substr(strip_tags($host->host_output), 0, 10000)); ?> -
+ + host_last_comment !== null): ?> + + + + + + host_name ?>
+ host_address ?> +
+ + host_action_url != ""): ?> + Action + + + host_notes_url != ""): ?> + Notes + + +
+ escape(substr(strip_tags($host->host_output), 0, 10000)); ?> +
diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index 41bf12f3b..5271200ec 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -7,23 +7,24 @@ $formatter = $this->getHelper('MonitoringProperties'); ?>
- Sort by formSelect( - 'sort', - $this->sort, - array( - 'class' => 'autosubmit' - ), - array( - 'notification_start_time' => 'Time' - ) ); -?> - +?>"> + Sort by formSelect( + 'sort', + $this->sort, + array( + 'class' => 'autosubmit' + ), + array( + 'notification_start_time' => 'Time' + ) + ); + ?> +
paginationControl($notifications, null, null, array('preserve' => $t ?> - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
HostServiceTypeTimeContactNotification commandInformation
- host_name ?> - - service_description) ? '' : $notification->service_description; ?> - getNotificationType($notification); ?> - - notification_start_time ?> - - notification_contact ?> - - notification_command ?> - - escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?> - - notification_type) === 0): ?> - - - - - -
HostServiceTypeTimeContactNotification commandInformation
+ host_name ?> + + service_description) ? '' : $notification->service_description; ?> + getNotificationType($notification); ?> + + notification_start_time ?> + + notification_contact ?> + + notification_command ?> + + escape(substr(strip_tags($notification->notification_information), 0, 10000)); ?> +
diff --git a/modules/monitoring/application/views/scripts/list/services-bak.phtml b/modules/monitoring/application/views/scripts/list/services-bak.phtml deleted file mode 100644 index 3af9b2173..000000000 --- a/modules/monitoring/application/views/scripts/list/services-bak.phtml +++ /dev/null @@ -1,171 +0,0 @@ -tabs ?> -paginate(); - -function getRowProperties(&$service, &$last_host, $scope) { - if ($last_host !== $service->host_name) { - $host_col = '' . $scope->qlink( - $service->host_name, - 'monitoring/show/host', - array('host' => $service->host_name) - ) . ':' - . (isset($service->host->address) ? ' ( ' . $scope->escape($service->host->address) . ')' : '') - . ''; - $last_host = $service->host_name; - } else { - $host_col = '  '; - } - $icons = array(); - if ($service->service_acknowledged) { - $icons['ack.gif'] = 'Problem has been acknowledged'; - } - - if ($service->service_in_downtime) { - $icons['downtime.gif'] = 'Service is in a scheduled downtime'; - } - - if ($service->host_problems) { - $icons['server.png'] = 'This services host has a problem'; - } - - $state_classes = array($scope->monitoringState($service)); - - if ($service->service_handled) { - $state_classes[] = 'handled'; - } - if ($service->service_last_state_change > (time() - 600)) { - $state_classes[] = 'new'; - } - $state_title = strtoupper($scope->monitoringState($service)) - . ' since ' - . date('Y-m-d H:i:s', $service->service_last_state_change); - if ($scope->grapher && $scope->grapher->hasGraph($service->host_name, $service->service_description)) { - $graph = $scope->grapher->getSmallPreviewImage( - $service->host_name, - $service->service_description - ); - } else { - $graph = ''; - } - return array($host_col,$icons,$state_classes,$state_title,$graph); -} - -$fparams = $this->services->getAppliedFilter()->toParams(); -if ($this->preserve === null) { - $this->preserve = $fparams; -} else { - $this->preserve += $fparams; -} - $last_host = null; -$always = array(); -if (isset($_GET['sort'])) { - $always['sort'] = $_GET['sort']; -} -if (isset($_GET['dir'])) { - $always['dir'] = $_GET['dir']; -} -?> -
- -
Filters
- $v): ?> -qlink( - 'x', - 'monitoring/list/services', - $this->services->getAppliedFilter()->without($k)->toParams() + $always, - array( - 'style' => array('color' => 'red') - ) -) ?> escape("$k = $v") ?>
- -
- -
-Sort by formSelect( - 'sort', - $this->sort, - array( - 'class' => 'autosubmit', - ), - array( - 'severity' => 'Severity', - 'service_last_state_change' => 'Last state change', - 'service_last_time_unknown' => 'Last UNKNOWN', - 'service_last_time_critical' => 'Last CRITICAL', - 'service_last_time_warning' => 'Last WARNING', - 'service_last_time_ok' => 'Last OK', - 'host_name' => 'Host', - 'service_description' => 'Service', - ) -) ?> -formText( - 'search', - $this->search, - array( - 'placeholder' => 'Add filllter...', - ) -) ?> -
-
- - -
- Sorry, no services found for this search -
- - -paginationControl($paginator, null, null, array('preserve' => $this->preserve )); ?> - - -fetchAll() as $service): - list($host_col,$icons,$state_classes,$state_title,$graph) = getRowProperties($service,$last_host,$this); ?> - - - - -extraColumns as $col): ?> - - - - - -
- qlink( - - $service->service_state == 99 ? 'PENDING' : - substr(strtoupper($this->monitoringState($service)), 0, 4) - . ' since
' - . $this->timeSince($service->service_last_state_change), - 'monitoring/show/history', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), array('quote' => false)) ?> -
- $alt) { - echo $this->img('img/classic/' . $icon, array( - 'class' => 'icon', - 'title' => $alt - )); - } ?> - - qlink($service->service_description, 'monitoring/show/service', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), array('class' => 'row-action') - ) - ?> - -
-     - escape(substr(strip_tags($service->service_output), 0, 900)) ?> - - -
escape($service->$col) ?>
diff --git a/modules/monitoring/application/views/scripts/list/services-compact.phtml b/modules/monitoring/application/views/scripts/list/services-compact.phtml index 1ce5a87a5..f89bc772b 100644 --- a/modules/monitoring/application/views/scripts/list/services-compact.phtml +++ b/modules/monitoring/application/views/scripts/list/services-compact.phtml @@ -1,137 +1,130 @@ paginate(); - $viewHelper = $this->getHelper('MonitoringState'); $trimArea = $this->getHelper('Trim'); ?> -
- Sorry, no services found for this search -
+
+ Sorry, no services found for this search +
paginationControl($paginator, null, null, array('preserve' => $this->preserve)) ?> - - - - - - - - - - fetchAll() as $service): ?> - - - + + + + + + + + + + + fetchAll() as $service): ?> + + + + - + + + service_notes_url != ""): ?> + Notes + + service_state_type == 0): ?> + + + + - - - - + + + + + + +
StatusServiceOutput
-
start(); ?> - service_icon_image) : ?> - - - end(); ?>
-
-
start(); ?> - service_handled && $service->service_state > 0): ?> - - - - - service_acknowledged && !$service->service_in_downtime): ?> - - - - - service_is_flapping): ?> - - - - - service_notifications_enabled): ?> - - - - - service_in_downtime): ?> - - - - - end(); ?>
-
StatusServiceOutput
+
start(); ?> + + service_icon_image) : ?> + + + + end(); ?> +
+
+
start(); ?> + + service_handled && $service->service_state > 0): ?> + + + + + + service_acknowledged && !$service->service_in_downtime): ?> + + + + + + service_is_flapping): ?> + + + + + + service_notifications_enabled): ?> + + + + + + service_in_downtime): ?> + + + + + + end(); ?> +
+
-
- qlink( - "".ucfirst($viewHelper->monitoringState($service, 'service'))."". - '
since '. - $this->timeSince($service->service_last_state_change), - 'monitoring/show/history', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), - array('quote' => false) - );?> - service_state_type == 0): ?> - - - - -
-
+
+ monitoringState($service, 'service')); ?> +
since ' + timeSince($service->service_last_state_change); ?> + + service_state_type == 0): ?> + + + + +
+
+
+ + service_last_comment !== null): ?> + + + + - - service_last_comment !== null): ?> - - - - - qlink( - "".$service->service_display_name."
", - 'monitoring/show/service', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), array( - 'class' => 'row-action', - 'quote' => false - ) - ); ?> - qlink( - $service->host_name, - 'monitoring/show/host', array( - 'host' => $service->host_name - ), array( - 'class' => 'row-action', - 'quote' => false - ) - ); ?> + service_display_name; ?> +
+ host_name; ?> - service_action_url != ""): ?> - Action - + service_action_url != ""): ?> + Action + - service_notes_url != ""): ?> - Notes - - service_state_type == 0): ?> - - - - -
- escape(substr(strip_tags($service->service_output), 0, 10000)); ?> -
+ escape(substr(strip_tags($service->service_output), 0, 10000)); ?> +
diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 2b2ff07e7..824443245 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -8,172 +8,150 @@ $trimArea = $this->getHelper('Trim'); ?> -
- Sorry, no services found for this search -
+
+ Sorry, no services found for this search +
-
- Sort by formSelect( - 'sort', - $this->sort, - array('class' => 'autosubmit'), - array( - 'service_severity' => 'Severity', - 'service_last_state_change' => 'Last state change', - 'service_last_time_unknown' => 'Last UNKNOWN', - 'service_last_time_critical' => 'Last CRITICAL', - 'service_last_time_warning' => 'Last WARNING', - 'service_last_time_ok' => 'Last OK', - 'service_description' => 'Service', - ) - ) ?> - + + Sort by formSelect( + 'sort', + $this->sort, + array('class' => 'autosubmit'), + array( + 'service_severity' => 'Severity', + 'service_last_state_change' => 'Last state change', + 'service_last_time_unknown' => 'Last UNKNOWN', + 'service_last_time_critical' => 'Last CRITICAL', + 'service_last_time_warning' => 'Last WARNING', + 'service_last_time_ok' => 'Last OK', + 'service_description' => 'Service', + ) + ) ?> +
paginationControl($paginator, null, null, array('preserve' => $this->preserve)) ?> - - - - - - - - - - - fetchAll() as $service): ?> - - - + + + + + + + + + + + + fetchAll() as $service): ?> + + + - + + - service_notes_url != ""): ?> - Notes - - service_state_type == 0): ?> - - - - - + -
- qlink( - "(".ucfirst($viewHelper->monitoringState($service, 'host')).")", - 'monitoring/show/history', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), - array('quote' => false) - );?> -
- - host_address ?> - - - - - - - + + + +
StatusServiceHostOutput
-
start(); ?> - service_icon_image) : ?> - - - end(); ?>
-
-
start(); ?> - service_handled && $service->service_state > 0): ?> - - - - - service_acknowledged && !$service->service_in_downtime): ?> - - - - - service_is_flapping): ?> - - - - - service_notifications_enabled): ?> - - - - - service_in_downtime): ?> - - - - - end(); ?>
-
StatusServiceHostOutput
+
start(); ?> + + service_icon_image) : ?> + + + + end(); ?> +
+
+
start(); ?> + + service_handled && $service->service_state > 0): ?> + + + + + + service_acknowledged && !$service->service_in_downtime): ?> + + + + + + service_is_flapping): ?> + + + + + + service_notifications_enabled): ?> + + + + + + service_in_downtime): ?> + + + + + + end(); ?> +
+
-
- qlink( - "".ucfirst($viewHelper->monitoringState($service, 'service'))."". - '
since '. - $this->timeSince($service->service_last_state_change), - 'monitoring/show/history', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), - array('quote' => false) - );?> - service_state_type == 0): ?> - - - - -
-
+
+ monitoringState($service, 'service')); ?> +
since  + timeSince($service->service_last_state_change); ?> + + service_state_type == 0): ?> + + + + +
+
+
+ service_last_comment !== null): ?> + + + + + service_display_name; ?> +
-
- service_last_comment !== null): ?> - - - - - qlink( - "".$service->service_display_name."
", - 'monitoring/show/service', array( - 'host' => $service->host_name, - 'service' => $service->service_description - ), array( - 'class' => 'row-action', - 'quote' => false - ) - ); ?> + service_action_url != ""): ?> + Action + + service_notes_url != ""): ?> + Notes + - service_action_url != ""): ?> - Action - + service_state_type == 0): ?> + + + + +
+ host_name; ?> - - qlink( - $service->host_name, - 'monitoring/show/host', array( - 'host' => $service->host_name - ), array( - 'class' => 'row-action', - 'quote' => false - ) - ); ?> +
+ (monitoringState($service, 'host')); ?>) +
+ + host_address ?> + +
- escape(substr(strip_tags($service->service_output), 0, 10000)); ?> -
+ escape(substr(strip_tags($service->service_output), 0, 10000)); ?> +
diff --git a/modules/monitoring/application/views/scripts/show/components/contacts.phtml b/modules/monitoring/application/views/scripts/show/components/contacts.phtml index de9e0b62b..02f84b08b 100644 --- a/modules/monitoring/application/views/scripts/show/components/contacts.phtml +++ b/modules/monitoring/application/views/scripts/show/components/contacts.phtml @@ -2,15 +2,15 @@ if (!empty($this->contacts)) { $contactList = array(); foreach ($this->contacts as $contact) { - $contactList[] = $this->qlink( - $contact->contact_alias, - 'monitoring/show/contact', - array( - 'contact_name' => $contact->contact_name - ) - ); + $contactList[] = '' . $contact->contact_alias . ''; } + echo 'Contacts: '; echo implode(', ', $contactList); } @@ -18,15 +18,13 @@ if (!empty($this->contactgroups)) { $contactGroupList = array(); foreach ($this->contactgroups as $contactgroup) { - $contactGroupList[] = $this->qlink( - $contactgroup->contactgroup_alias, + $contactGroupList[] = '' . $contactgroup->contactgroup_alias . ''; } - echo 'Contactgroups: '; echo implode(', ', $contactGroupList); } diff --git a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml index 79767c463..23f5b725c 100644 --- a/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/show/components/hostgroups.phtml @@ -4,9 +4,9 @@ if (empty($object->hostgroups)) return; $list = array(); foreach ($object->hostgroups as $name => $alias) { - $list[] = $this->qlink($alias, 'monitoring/list/services', array( - 'hostgroups' => $name - )); + $list[] = '' + . $alias + . ''; } echo 'Hostgroups: ' . implode(', ', $list) . "
\n"; diff --git a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml index 7d0e31101..3fc7d7ac4 100644 --- a/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml +++ b/modules/monitoring/application/views/scripts/show/components/servicegroups.phtml @@ -4,9 +4,9 @@ if (empty($object->servicegroups)) return; $list = array(); foreach ($object->servicegroups as $name => $alias) { - $list[] = $this->qlink($alias, 'monitoring/list/services', array( - 'servicegroups' => $name - )); + $list[] = '' + . $alias + . ''; } echo 'Servicegroups: ' . implode(', ', $list) . "
\n"; diff --git a/modules/monitoring/application/views/scripts/show/history.phtml b/modules/monitoring/application/views/scripts/show/history.phtml index 92d25fd07..2397bd0e2 100644 --- a/modules/monitoring/application/views/scripts/show/history.phtml +++ b/modules/monitoring/application/views/scripts/show/history.phtml @@ -10,40 +10,39 @@ There are no matching history entries right now paginationControl($hhistory, null, null, array('preserve' => $preserve)); ?> - - - + + object_type == 'host') { - $states = array('up', 'down', 'unreachable', 'unknown', 99 => 'pending', null => 'pending'); -} else { - $states = array('ok', 'warning', 'critical', 'unknown', 99 => 'pending', null => 'pending'); -} + if ($event->object_type == 'host') { + $states = array('up', 'down', 'unreachable', 'unknown', 99 => 'pending', null => 'pending'); + } else { + $states = array('ok', 'warning', 'critical', 'unknown', 99 => 'pending', null => 'pending'); + } -$row_class = array_key_exists($event->state, $states) ? $states[$event->state] : 'invalid'; + $row_class = array_key_exists($event->state, $states) ? $states[$event->state] : 'invalid'; -?> - - - + ?> + + + + + + + + - - - - - + attempt !== null): ?> + [ attempt ?>/max_attempts ?> ] + + + - +
timestamp ) ?>escape($event->host_name) ?>
timestamp ) ?>escape($event->host_name) ?> + + service_description; ?> + + + escape($event->service_description) ?> + + -qlink( - $event->service_description, - 'monitoring/show/service', - array( - 'host' => $object->host_name, - 'service' => $event->service_description - ) -) ?> - -escape($event->service_description) ?> - - 16, 'height' => 16, @@ -80,17 +79,12 @@ switch ($event->type) { break; } ?> -attempt !== null): ?> - [ attempt ?>/max_attempts ?> ] - - pluginOutput($event->output) - ) : $this->pluginOutput($event->output) ?> -
diff --git a/modules/monitoring/application/views/scripts/show/host.phtml b/modules/monitoring/application/views/scripts/show/host.phtml index 94dd72371..523aeea29 100644 --- a/modules/monitoring/application/views/scripts/show/host.phtml +++ b/modules/monitoring/application/views/scripts/show/host.phtml @@ -2,13 +2,12 @@ $hostgroupLinkList = array(); if (!empty($this->hostgroups)) { foreach ($this->hostgroups as $name => $alias) { - $hostgroupLinkList[] = $this->qlink( - $alias, - 'monitoring/list/services', + $hostgroupLinkList[] = ''.$alias. ''; } } ?> @@ -27,40 +26,40 @@ $this->partial( preview_image ?>
-
- Plugin output -
-
- pluginOutput($this->host->host_output); ?> - pluginOutput($this->host->host_long_output); ?> -
+
+ Plugin output +
+
+ pluginOutput($this->host->host_output); ?> + pluginOutput($this->host->host_long_output); ?> +
-
- Command -
+
+ Command +
-
- Command: - + Command: + host->host_check_command, 2); - array_shift($explodedCommand); - ?> - commandArguments($this->host->host_check_command); ?> -
+ array_shift($explodedCommand); + ?> + commandArguments($this->host->host_check_command); ?> +
-
- Groups and Contacts -
- - Hostgroups: - - +
+ Groups and Contacts +
+ + Hostgroups: + + - render('show/components/contacts.phtml') ?> + render('show/components/contacts.phtml') ?>
render('show/components/comments.phtml'); ?> @@ -70,39 +69,39 @@ $this->partial( render('show/components/customvars.phtml'); ?> host->host_perfdata): ?> -
-
- Perfdata -
-
- perfdata($this->host->host_perfdata); ?> -
-
+
+
+ Perfdata +
+
+ perfdata($this->host->host_perfdata); ?> +
+
-
- Flags -
-
- render('show/components/flags.phtml'); ?> -
+
+ Flags +
+
+ render('show/components/flags.phtml'); ?> +
-
- Properties -
-
- render('show/components/properties.phtml'); ?> -
+
+ Properties +
+
+ render('show/components/properties.phtml'); ?> +
-
- Commands -
-
- monitoringCommands($this->host, 'full'); ?> -
+
+ Commands +
+
+ monitoringCommands($this->host, 'full'); ?> +
\ No newline at end of file diff --git a/modules/monitoring/application/views/scripts/show/service.phtml b/modules/monitoring/application/views/scripts/show/service.phtml index 2315affbe..ebab7b9f8 100644 --- a/modules/monitoring/application/views/scripts/show/service.phtml +++ b/modules/monitoring/application/views/scripts/show/service.phtml @@ -3,13 +3,12 @@ $servicegroupLinkList = array(); if (!empty($this->servicegroups)) { foreach ($this->servicegroups as $name => $alias) { - $servicegroupLinkList[] = $this->qlink( - $alias, + $servicegroupLinkList[] = '' . $alias . ''; } } ?> @@ -26,42 +25,41 @@ $this->partial( ?> preview_image ?> -
-
- Plugin output -
-
- pluginOutput($this->service->service_output); ?> - pluginOutput($this->service->service_long_output); ?> -
+
+ Plugin output +
+
+ pluginOutput($this->service->service_output); ?> + pluginOutput($this->service->service_long_output); ?> +
-
- Command -
+
+ Command +
-
- Command: - + Command: + service->service_check_command, 2); - echo array_shift($explodedCommand); - ?> - commandArguments($this->service->service_check_command); ?> -
+ echo array_shift($explodedCommand); + ?> + commandArguments($this->service->service_check_command); ?> +
-
- Groups and Contacts -
- - Servicegroups: - - +
+ Groups and Contacts +
+ + Servicegroups: + + - render('show/components/contacts.phtml') ?> + render('show/components/contacts.phtml') ?>
render('show/components/comments.phtml'); ?> @@ -71,40 +69,40 @@ $this->partial( render('show/components/customvars.phtml'); ?> service->service_perfdata): ?> -
+
-
- Perfdata -
-
- perfdata($this->service->service_perfdata); ?> -
-
+
+ Perfdata +
+
+ perfdata($this->service->service_perfdata); ?> +
+
-
- Flags -
-
- render('show/components/flags.phtml'); ?> -
+
+ Flags +
+
+ render('show/components/flags.phtml'); ?> +
-
- Properties -
-
- render('show/components/properties.phtml'); ?> -
+
+ Properties +
+
+ render('show/components/properties.phtml'); ?> +
-
- Commands -
-
- monitoringCommands($this->service, 'full'); ?> -
+
+ Commands +
+
+ monitoringCommands($this->service, 'full'); ?> +
\ No newline at end of file