Imported Upstream version 0.6.24+dfsg1

This commit is contained in:
Mario Fetka
2017-05-20 15:26:21 +02:00
commit 32a360eca6
705 changed files with 87250 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
$basket = $this->session->get('basket');
echo "<div class=\"ui-widget\">\n";
echo "<div class=\"p2 ui-widget-header ui-corner-top\">\n";
echo Kohana::lang('common.basket-box-header')."</div>\n";
echo "<div class=\"p4 ui-widget-content ui-corner-bottom\">\n";
echo "<div id=\"basket_items\">\n";
if(is_array($basket) && sizeof($basket) > 0 ){
foreach($basket as $key=>$item){
echo "<li class=\"ui-state-default basket_action_remove\" id=\"".
$item."\"><a title=\"".Kohana::lang('common.basket-remove', $item)."\"".
"id=\"".$item.
"\"><img width=12px height=12px src=\"".url::base().
"media/images/remove.png\"></a>".
pnp::shorten($item)."</li>\n";
}
}
if(is_array($basket) && sizeof($basket) > 0 ){
echo "<div align=\"center\" class=\"p2\">\n";
echo "<button id=\"basket-show\">".Kohana::lang('common.basket-show')."</button>\n";
echo "<button id=\"basket-clear\">".Kohana::lang('common.basket-clear')."</button>\n";
echo "</div>\n";
#echo "<div><a class=\"multi0\" href=\"".url::base(TRUE)."page/basket\">".Kohana::lang('common.basket-show')."</a></div>\n";
}else{
echo "<div>".Kohana::lang('common.basket-empty')."</div>\n";
}
echo "</div>\n";
echo "</div>\n";
echo "</div><br>\n";
?>
<div id="basket_box"></div>

View File

@@ -0,0 +1,38 @@
<div class="pagebody">
<table class="body">
<tr valign="top"><td>
<div class="left ui-widget">
<div class="p4 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.color-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" style="width: 600px">
<?php if (!empty($this->scheme)) {
foreach( $this->scheme as $key => $colors ){
print "<h3>\"" . $key . "\"</h3><ul class=\"colorscheme\">";
foreach($colors as $color){
print "<li class=\"colorscheme\"><span class=\"colorscheme\" style=\"background-color:".$color."\">" . "</span></li>\n";
}
print "</ul>";
}
print "<br><br>";
} ?>
</div>
</td><td>
<div class="right">
<?php if (!empty($color_box)) {
echo $color_box;
} ?>
<?php if (!empty($logo_box)) {
echo $logo_box;
} ?>
</div>
</td></tr>
<tr valign="top"><td colspan="2">
<div class="cb p4 ui-widget-content ui-corner-all">
<?php echo pnp::print_version(); ?>
</div>
</div>
</td></tr></table>
</div>

View File

@@ -0,0 +1,15 @@
<!-- Docs Menu Start -->
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.icon-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
<?php
echo "<a title=\"".Kohana::lang('common.title-home-link')."\" href=\"".url::base(TRUE)."graph\"><img class=\"icon\" src=\"".url::base()."media/images/home.png\"></a>\n";
echo "<a title=\"".Kohana::lang('common.title-docs-link')."\" href=\"".url::base(TRUE)."docs\"><img class=\"icon\" src=\"".url::base()."media/images/docs.png\"></a>\n";
echo "<a title=\"".Kohana::lang('common.title-color-link')."\" href=\"".url::base(TRUE)."color\"><img class=\"icon\" src=\"".url::base()."media/images/color.png\"></a>\n";
?>
</div>
</div>
<p>
<!-- Color Box End -->

View File

@@ -0,0 +1,74 @@
<?php
if($this->is_authorized === FALSE){
print "<div class=\"pagebody b1\"><h2>Your are not authorized to view this site</h2></div>";
return;
}
?>
<div class="pagebody b1">
<script type="text/javascript">
jQuery(function() {
jQuery("#tabs").tabs();
});
</script>
<table class="body"><tr><td valign="top">
<div class="gw left ui-corner-all">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Data Structure</a></li>
<li><a href="#tabs-2">RRD Datasource</a></li>
<li><a href="#tabs-3">Nagios Macros</a></li>
<li><a href="#tabs-4">PHP Session </a></li>
</ul>
<div id="tabs-1">
<h3>$this->data->STRUCT</h3>
<pre>
<?php print_r($this->data->STRUCT);?>
</pre>
</div>
<div id="tabs-2">
<h3>$this->data->DS</h3>
<pre>
<?php print_r($this->data->DS);?>
</pre>
</div>
<div id="tabs-3">
<h3>$this->data->MACRO</h3>
<pre>
<?php print_r($this->data->MACRO);?>
</pre>
</div>
<div id="tabs-4">
<h3>$this->session->get()</h3>
<pre>
<?php print_r($this->session->get());?>
</pre>
</div>
</div>
</div>
</td><td valign="top">
<div class="right ui-corner-all">
<?php if (!empty($search_box)) {
echo $search_box;
} ?>
<?php if (!empty($icon_box)) {
echo $icon_box;
} ?>
<?php if (!empty($status_box)) {
echo $status_box;
} ?>
<?php if (!empty($service_box)) {
echo $service_box;
} ?>
</div>
</td></tr></table>
<div class="left w99 cb ui-corner-all">
<?php if (!empty($footer)) {
echo $footer . pnp::print_version();
} ?>
<?php echo pnp::print_version(); ?>
</div>

View File

@@ -0,0 +1,31 @@
<div class="pagebody">
<table class="body">
<tr valign="top"><td>
<div class="left ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.docs-header',PNP_VERSION) ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" style="width: <?php echo $this->graph_width ?>px">
<?php if (!empty($this->content)) {
echo $this->content;
} ?>
</div>
</div>
</td><td>
<div class="right">
<?php if (!empty($docs_box)) {
echo $docs_box;
} ?>
<?php if (!empty($logo_box)) {
echo $logo_box;
} ?>
</div>
</td></tr>
<tr valign="top"><td colspan="2">
<div class="cb p4 ui-widget-content ui-corner-all">
<?php echo pnp::print_version(); ?>
</div>
</td></tr></table>
</div>

View File

@@ -0,0 +1,28 @@
<!-- Docs Menu Start -->
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.icon-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
<?php
echo "<a title=\"".Kohana::lang('common.title-home-link')."\" href=\"".url::base(TRUE)."graph\"><img class=\"icon\" src=\"".url::base()."media/images/home.png\"></a>\n";
echo "<a title=\"".Kohana::lang('common.title-docs-link')."\" href=\"".url::base(TRUE)."docs\"><img class=\"icon\" src=\"".url::base()."media/images/docs.png\"></a>\n";
echo "<a title=\"".Kohana::lang('common.title-color-link')."\" href=\"".url::base(TRUE)."color\"><img class=\"icon\" src=\"".url::base()."media/images/color.png\"></a>\n";
foreach ( $this->doc_language as $lang ){
echo "<a href=\"".url::base(TRUE)."docs/view/".$lang."/start\"><img class=\"icon\" src=\"".url::base()."media/images/".$lang.".png\"></a> \n";
}
?>
</div>
</div>
<p>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.docs-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
<ul><li class="level1"><a href="start"><strong><?php echo Kohana::lang('common.docs-home')?></strong></a></li></ul>
<?php echo $this->toc ?>
</div>
</div>
<p>
<!-- Docs Menu End -->

View File

@@ -0,0 +1,56 @@
<div class="pagebody">
<table class="body"><tr valign="top"><td colspan="2">
<?php if (!empty($header)) {
echo $header;
} ?>
</td></tr>
<tr valign="top"><td>
<div class="left ui-widget-content ui-corner-all">
<?php if (!empty($graph_content)) {
echo $graph_content;
} ?>
</div>
</td><td>
<div class="right ui-widget-content ui-corner-all">
<?php if (!empty($search_box)) {
echo $search_box;
} ?>
<?php if (!empty($icon_box)) {
echo $icon_box;
} ?>
<?php if (!empty($basket_box)) {
echo $basket_box;
} ?>
<?php if (!empty($status_box)) {
echo $status_box;
} ?>
<?php if (!empty($multisite_box)) {
echo $multisite_box;
} ?>
<?php if (!empty($widget_menu)) {
echo $widget_menu;
} ?>
<?php if (!empty($timerange_box)) {
echo $timerange_box;
} ?>
<?php if (!empty($service_box)) {
echo $service_box;
} ?>
<?php if (!empty($logo_box)) {
echo $logo_box;
} ?>
</div>
</td></tr>
<tr valign="top"><td colspan="2">
<div class="cb p4 ui-widget-content ui-corner-all">
<?php echo pnp::print_version()?>
</div>
</td></tr></table>
</div>

View File

@@ -0,0 +1,102 @@
<!-- Graph Content Start-->
<?php
if (!empty($timerange_select)) {
echo $timerange_select;
}
if (!empty($widget_graph)) {
echo $widget_graph;
}
echo "<div class=\"ui-widget\" style=\"min-width:".$graph_width."px\">\n";
if($this->is_authorized == FALSE){
echo "<div style=\"padding: 0pt 0.7em;\" class=\"ui-state-error ui-corner-all\">\n";
echo "<p><span style=\"float: left; margin-right: 0.3em;\" class=\"ui-icon ui-icon-alert\"></span>\n";
echo "<strong>Alert:&nbsp;</strong>".Kohana::lang('error.not_authorized')."</p>\n";
echo "</div></div>\n";
return;
}
if($this->data->ERROR != NULL){
echo "<div style=\"padding: 0pt 0.7em;\" class=\"ui-state-error ui-corner-all\">\n";
echo "<p><span style=\"float: left; margin-right: 0.3em;\" class=\"ui-icon ui-icon-alert\"></span>\n";
echo "<strong>Alert:&nbsp;</strong>".$this->data->ERROR."</p>\n";
echo "</div></div>\n";
return;
}
$count = 0;
foreach($this->data->STRUCT as $key=>$value){
if($value['LEVEL'] == 0){
echo "<strong>Host: </strong>".$value['MACRO']['DISP_HOSTNAME']. " <strong>Service: </strong>".$value['MACRO']['DISP_SERVICEDESC']."<p>\n";
echo "<strong>".$value['TIMERANGE']['title']. "</strong> " .$value['TIMERANGE']['f_start']. " - " . $value['TIMERANGE']['f_end']. "\n";
$count = 0;
}
if($value['VERSION'] != "valid" && $count == 0){
$count++;
echo "<div class=\"ui-widget\">\n";
echo "<div class=\"ui-state-error ui-corner-all\">\n";
echo "<p><span class=\"ui-icon ui-icon-alert\" style=\"float: left;\"></span>".$value['VERSION']."</p>\n";
echo "</div>\n";
echo "</div><br>\n";
}
echo "<div class=\"ui-widget-header ui-corner-top\">";
echo "<table border=0 width=100%><tr>\n";
echo "<td width=100% align=left>";
echo Kohana::lang('common.datasource',$value['ds_name'])."</td>\n";
echo "<td align=right>";
echo nagios::SummaryLink($value['MACRO']['DISP_HOSTNAME'],
$value['TIMERANGE']['start'],
$value['TIMERANGE']['end'])."</td>\n";
echo "<td align=right>";
echo nagios::AvailLink($value['MACRO']['DISP_HOSTNAME'],
$value['MACRO']['DISP_SERVICEDESC'],
$value['TIMERANGE']['start'],
$value['TIMERANGE']['end'])."</td>\n";
echo "<td align=right>";
echo pnp::add_to_basket_icon(
$value['MACRO']['HOSTNAME'],
$value['MACRO']['SERVICEDESC'],
$value['SOURCE']
);
echo "</td>\n";
echo "<td align=right>";
echo pnp::zoom_icon($value['MACRO']['HOSTNAME'],
$value['MACRO']['SERVICEDESC'],
$value['TIMERANGE']['start'],
$value['TIMERANGE']['end'],
$value['SOURCE'],
$value['VIEW'],
$value['GRAPH_WIDTH'],
$value['GRAPH_HEIGHT'])."</td>\n";
echo "</tr></table>\n";
echo "</div>\n";
echo "<div class=\"p4 gh ui-widget-content ui-corner-bottom\">\n";
echo "<div style=\"position:relative;\">\n";
$path = pnp::addToUri( array(
'host' => $value['MACRO']['HOSTNAME'],
'srv' => $value['MACRO']['SERVICEDESC'],
), FALSE
);
echo "<a href=\"".url::base(TRUE)."graph".$path
."\" title=\""
.Kohana::lang('common.host',$value['MACRO']['DISP_HOSTNAME']) . " "
.Kohana::lang('common.service',$value['MACRO']['DISP_SERVICEDESC']) . " "
.Kohana::lang('common.datasource',$value['ds_name']) . " "
."\">\n";
echo "<div start=".$value['TIMERANGE']['start']." end=".$value['TIMERANGE']['end']." style=\"width:".$value['GRAPH_WIDTH']."px; height:".$value['GRAPH_HEIGHT']."px; position:absolute; top:33px\" class=\"graph\" id=\"".$this->url."\" ></div>";
$path = pnp::addToUri( array(
'host' => $value['MACRO']['HOSTNAME'],
'srv' => $value['MACRO']['SERVICEDESC'],
'view' => $value['VIEW'],
'source' => $value['SOURCE'],
'start' => $value['TIMERANGE']['start'],
'end' => $value['TIMERANGE']['end']
), FALSE
);
echo "<img class=\"graph\" src=\"".url::base(TRUE)."image" . $path . "\"></a>\n";
echo "</div>\n";
echo "</div><p>\n";
}
echo "</div>\n";
?>
<!-- Graph Content End-->

View File

@@ -0,0 +1,53 @@
<!-- Graph Content Start-->
<?php
if (!empty($timerange_select)) {
echo $timerange_select;
}
if (!empty($widget_graph)) {
echo $widget_graph;
}
echo "<div class=\"ui-widget\" style=\"min-width:".$graph_width."px\">\n";
$count = 0;
if($this->data->MACRO['TITLE'])
echo "<strong>".$this->data->MACRO['TITLE']."</strong><p>\n";
if($this->data->MACRO['COMMENT'])
echo $this->data->MACRO['COMMENT']."<p>\n";
foreach($this->data->STRUCT as $key=>$value){
if($value['LEVEL'] == 0 ){
echo "<strong>".$value['TIMERANGE']['title']. "</strong> " .$value['TIMERANGE']['f_start']. " - " . $value['TIMERANGE']['f_end']. "\n";
$count = 0;
}
echo "<div class=\"ui-widget-header ui-corner-top\">";
echo "<table border=0 width=100%><tr>\n";
echo "<td width=100% align=left>";
echo Kohana::lang('common.datasource',$value['ds_name'])."</td>\n";
echo "<td align=right>";
echo pnp::zoom_icon_special($this->tpl,
$value['TIMERANGE']['start'],
$value['TIMERANGE']['end'],
$value['SOURCE'],
$value['VIEW'],
$value['GRAPH_WIDTH'],
$value['GRAPH_HEIGHT'])."</td>\n";
echo "</tr></table>\n";
echo "</div>\n";
echo "<div class=\"p4 gh ui-widget-content ui-corner-bottom\">\n";
echo "<div style=\"position:relative;\">\n";
$path = pnp::addToUri( array('tpl' => $this->tpl, 'view' => NULL ) );
echo "<a href=\"". $path . "\">\n";
echo "<div start=".$value['TIMERANGE']['start']." end=".$value['TIMERANGE']['end']." style=\"width:".$value['GRAPH_WIDTH']."px; height:".$value['GRAPH_HEIGHT']."px; position:absolute; top:33px;\" class=\"graph\" id=\"".$this->url."\"></div>\n";
$path = pnp::addToUri( array('tpl' => $this->tpl,
'view' => $value['VIEW'],
'source' => $value['SOURCE'],
'start' => $value['TIMERANGE']['start'],
'end' => $value['TIMERANGE']['end']), FALSE
);
echo "<img class=\"graph\" src=\"".url::base(TRUE)."image" . $path . "\">\n";
echo "</div>\n";
echo "</a></div><p>\n";
}
echo "</div>\n";
?>
<!-- Graph Content End-->

View File

@@ -0,0 +1,19 @@
<div style="padding:4px">
<div style="display: table; margin: 0 auto;">
<table class="body">
<tr valign="top">
<td>
<div class="left ui-widget-content ui-corner-all" align="center">
<?php if (!empty($icon_box)) {
echo $icon_box;
} ?>
<?php if (!empty($graph_content)) {
echo $graph_content;
} ?>
</div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,4 @@
<!-- Header Template -->
<div class="p4 ui-widget-header ui-corner-all">
<?php echo $title ?>
</div>

View File

@@ -0,0 +1,11 @@
<div class="left b1 w99">
Status Box<br>
<?php if (!empty($hosts)) {
foreach($hosts as $host){
echo html::anchor('graph?host='.$host['name'], $host['name'], array('class'=>$host['state']))."</p>";
}
}
?>
</div>

View File

@@ -0,0 +1,39 @@
<!-- Icon Box Start -->
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.icon-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
<?php
$qsa = pnp::addToUri(array('start' => $this->start,'end' => $this->end, 'view' => $this->view), False);
if($this->config->conf['use_calendar']){
echo "<a title=\"".Kohana::lang('common.title-calendar-link')."\" href=\"#\" id=\"button\"><img class=\"icon\" src=\"".url::base()."media/images/calendar.png\"></a>";
}
if($this->config->conf['use_fpdf'] == 1 && ( $position == "graph" || $position == "special") ){
echo "<a title=\"".Kohana::lang('common.title-pdf-link')."\" href=\"".url::base(TRUE)."pdf".$qsa."\"><img class=\"icon\" src=\"".url::base()."media/images/pdf.png\"></a>\n";
}
if($this->config->conf['use_fpdf'] == 1 && $position == "basket"){
echo "<a title=\"".Kohana::lang('common.title-pdf-link')."\" href=\"".url::base(TRUE)."pdf/basket/".$qsa."\"><img class=\"icon\" src=\"".url::base()."media/images/pdf.png\"></a>\n";
}
if($this->config->conf['use_fpdf'] == 1 && $position == "page"){
echo "<a title=\"".Kohana::lang('common.title-pdf-link')."\" href=\"".url::base(TRUE)."pdf/page/".$this->page.$qsa."\"><img class=\"icon\" src=\"".url::base()."media/images/pdf.png\"></a>\n";
}
if($this->config->conf['show_xml_icon'] == 1 && $position == "graph" && $xml_icon == TRUE){
$qsa = pnp::addToUri(array(), False);
echo "<a title=\"".Kohana::lang('common.title-xml-link')."\" href=\"".url::base(TRUE)."xml".$qsa."\"><img class=\"icon\" src=\"".url::base()."media/images/xml.png\"></a>\n";
}
if($this->data->getFirstPage() && $this->isAuthorizedFor('pages') ){
echo "<a title=\"".Kohana::lang('common.title-pages-link')."\" href=\"".url::base(TRUE)."page\"><img class=\"icon\" src=\"".url::base()."media/images/pages.png\"></a>\n";
}
echo "<a title=\"".Kohana::lang('common.title-statistics-link')."\" href=\"".url::base(TRUE)."graph?host=.pnp-internal&srv=runtime\"><img class=\"icon\" src=\"".url::base()."media/images/stats.png\"></a>\n";
if($this->data->getFirstSpecialTemplate() ){
echo "<a title=\"".Kohana::lang('common.title-special-templates-link')."\" href=\"".url::base(TRUE)."special\"><img class=\"icon\" src=\"".url::base()."media/images/special.png\"></a>\n";
}
echo "<a title=\"".Kohana::lang('common.title-docs-link')."\" href=\"".url::base(TRUE)."docs\"><img class=\"icon\" src=\"".url::base()."media/images/docs.png\"></a>\n";
?>
</div>
</div><p>
<!-- Icon Box End -->

View File

@@ -0,0 +1,77 @@
<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php if(isset ( $_SERVER['REQUEST_URI'])):?>
<meta http-equiv="refresh" content="60">
<?php endif ?>
<title><?php echo $error ?></title>
<?php echo html::stylesheet('media/css/common.css') ?>
<?php echo html::stylesheet('media/css/ui-'.Kohana::config('core.theme').'/jquery-ui.css') ?>
<?php echo html::link('media/images/favicon.ico','icon','image/ico') ?>
<?php echo html::script('media/js/jquery-min.js')?>
<?php echo html::script('media/js/jquery-ui.min.js')?>
<style type="text/css">
<?php #include Kohana::find_file('views', 'kohana_errors', FALSE, 'css') ?>
</style>
</head>
<body>
<div class="pagebody">
<table class="body">
<tr valign="top"><td>
<div class="left ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo "PNP4Nagios Version ".PNP_VERSION ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" style="width: 640px">
<div style="padding: 0pt 0.7em;" class="ui-state-error ui-corner-all">
<h3>Please check the documentation for information about the following error.</h3>
<p><?php echo html::specialchars($message) ?></p>
<?php if ( ! empty($line) AND ! empty($file)): ?>
<h3>file [line]:</h3>
<p><?php echo Kohana::lang('core.error_file_line', $file, $line) ?></p>
<?php endif ?>
<?php if ( ! empty($trace)): ?>
<h3><?php echo Kohana::lang('core.stack_trace') ?></h3>
<?php echo $trace ?>
<?php endif ?>
<p>
<a href="javascript:history.back()"><?php echo Kohana::lang('common.back') ?></a>
</div>
</div>
</td><td>
<div class="right">
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.icon-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
<?php
echo "<a title=\"".Kohana::lang('common.back')."\" href=\"javascript:history.back()\"><img class=\"icon\" src=\"".url::base()."media/images/back.png\"></a>\n";
echo "<a title=\"".Kohana::lang('common.title-home-link')."\" href=\"".url::base(TRUE)."graph\"><img class=\"icon\" src=\"".url::base()."media/images/home.png\"></a>\n";
echo "<a title=\"".Kohana::lang('common.title-docs-link')."\" href=\"".url::base(TRUE)."docs\"><img class=\"icon\" src=\"".url::base()."media/images/docs.png\"></a>\n";
?>
</div>
</div>
</div>
</td></tr>
<tr valign="top"><td colspan="2">
<div class="left">
<div class="cb p4 ui-widget-content ui-corner-all">
<?php echo pnp::print_version(); ?>
</div>
</div>
</div>
</td></tr></table>
</div>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<!-- Logo Box Start -->
<div class="ui-widget">
<div class="logo ui-widget-content ui-corner-all" >
<a href="http://www.pnp4nagios.org"><img src="<?php echo url::base()?>media/images/pnp.png"></a>
<a href="http://www.rrdtool.org"><img src="<?php echo url::base()?>media/images/rrdtool.png"></a>
</div>
</div>
<!-- Logo Box End -->

View File

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<?php echo html::link('media/images/home.png', 'apple-touch-icon', "") ?>
<?php echo html::stylesheet('media/css/jquery.mobile.min.css') ?>
<?php echo html::stylesheet('media/css/mobile.css') ?>
<?php echo html::script('media/js/jquery-min.js')?>
<?php echo html::script('media/js/jquery.mobile.min.js')?>
</head>
<body>
<div data-role="page" data-theme="b" data-add-back-btn="true">
<div data-role="header">
<h1>PNP4Nagios</h1>
<a href="<?php echo url::base(TRUE)?>/mobile" data-icon="home" class="ui-btn-right">Home</a>
</div><!-- /header -->
<?php if (!empty($home)) {
echo $home;
} ?>
<?php if (!empty($about)) {
echo $about;
} ?>
<?php if (!empty($overview)) {
echo $overview;
} ?>
<?php if (!empty($host)) {
echo $host;
} ?>
<?php if (!empty($graph)) {
echo $graph;
} ?>
<?php if (!empty($search)) {
echo $search;
} ?>
<?php if (!empty($query)) {
echo $query;
} ?>
<?php if (!empty($pages)){
echo $pages;
} ?>
<?php if (!empty($special)){
echo $special;
} ?>
<div data-role="footer">
</div><!-- /footer -->
</div><!-- /page -->
</body>
</html>

View File

@@ -0,0 +1,3 @@
<div data-role="content">
PNP4Nagios mobile interface based on jQuery Mobile
</div>

View File

@@ -0,0 +1,43 @@
<?php
if($this->is_authorized == FALSE){
?>
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="e">
<li><strong>Alert:&nbsp;</strong><?php echo Kohana::lang('error.not_authorized')?></li>
</ul>
</div><!-- /content -->
<?php
return;
}
?>
<div data-role="content" data-inset="true">
<?php
$last_view = -1;
foreach($this->data->STRUCT as $d){
if($d['VIEW'] > $last_view){ # a new header begins
if($last_view != -1 ){ # close last div
print "</div>\n";
}
printf("<div class=\"timerange ui-bar-b ui-corner-top\">%s</div>\n", $d['TIMERANGE']['title'] );
printf("<div class=\"datasource ui-bar-c ui-corner-bottom\">%s\n", $d['ds_name']);
printf("<div><img style=\"max-width: 100%%\" src=\"".url::base(TRUE)."image?host=%s&srv=%s&view=%s&source=%s\"></div>\n",
$d['MACRO']['HOSTNAME'],
$d['MACRO']['SERVICEDESC'],
$d['VIEW'],
$d['SOURCE']
);
$last_view++;
}else{
printf("<div>%s</div>\n", $d['ds_name']);
printf("<div><img style=\"max-width: 100%%\" src=\"".url::base(TRUE)."image?host=%s&srv=%s&view=%s&source=%s\"></div>\n",
$d['MACRO']['HOSTNAME'],
$d['MACRO']['SERVICEDESC'],
$d['VIEW'],
$d['SOURCE']
);
}
}
?>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<div data-role="content" data-inset="true">
<?php
if($this->data->MACRO['TITLE'])
echo "<strong>".$this->data->MACRO['TITLE']."</strong><p>\n";
if($this->data->MACRO['COMMENT'])
echo $this->data->MACRO['COMMENT']."<p>\n";
$last_view = -1;
foreach($this->data->STRUCT as $d){
if($d['VIEW'] > $last_view){ # a new header begins
if($last_view != -1 ){ # close last div
print "</div>\n";
}
printf("<div class=\"timerange ui-bar-b ui-corner-top\">%s</div>\n", $d['TIMERANGE']['title'] );
printf("<div class=\"datasource ui-bar-c ui-corner-bottom\">%s\n", $d['ds_name']);
printf("<div><img style=\"max-width: 100%%\" src=\"".url::base(TRUE)."image?tpl=%s&view=%s&source=%s\"></div>\n",
$this->tpl,
$d['VIEW'],
$d['SOURCE']
);
$last_view++;
}else{
printf("<div>%s</div>\n", $d['ds_name']);
printf("<div><img style=\"max-width: 100%%\" src=\"".url::base(TRUE)."image?tpl=%s&view=%s&source=%s\"></div>\n",
$this->tpl,
$d['VIEW'],
$d['SOURCE']
);
}
}
?>
</div>

View File

@@ -0,0 +1,17 @@
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="a">
<li><a href="<?php echo url::base(TRUE)?>mobile/overview" data-transition="pop"><?php echo Kohana::lang('common.mobile-all-hosts')?></a></li>
<li><a href="<?php echo url::base(TRUE)?>mobile/search" data-transition="pop"><?php echo Kohana::lang('common.mobile-search-hosts')?></a></li>
<?php
if($this->data->getFirstPage() && $this->isAuthorizedFor('pages') ){
echo "<li><a href=\"".url::base(TRUE)."mobile/pages\" data-transition=\"pop\">".Kohana::lang('common.mobile-pages')."</a></li>";
}
if($this->data->getFirstSpecialTemplate() ){
echo "<li><a href=\"".url::base(TRUE)."mobile/special\" data-transition=\"pop\">".Kohana::lang('common.mobile-special-templates')."</a></li>";
}
?>
<li><a href="<?php echo url::base(TRUE)?>mobile/graph/.pnp-internal/runtime" data-transition="pop"><?php echo Kohana::lang('common.mobile-statistics')?></a></li>
<li><a href="<?php echo url::base(TRUE)?>mobile/go/classic" data-ajax="false" data-transition="pop"><?php echo Kohana::lang('common.mobile-go-classic')?></a></li>
</ul>
</div><!-- /content -->

View File

@@ -0,0 +1,30 @@
<?php
if($this->is_authorized == FALSE){
?>
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="e">
<li><strong>Alert:&nbsp;</strong><?php echo Kohana::lang('error.not_authorized')?></li>
</ul>
</div><!-- /content -->
<?php
return;
}
?>
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<?php
foreach($services as $key=>$service){
if($key == 0)
printf("<li data-role=\"list-divider\">%s</li>\n", $service['hostname'] );
printf("<li><a href=\"".url::base(TRUE)."mobile/graph/%s/%s\" data-transition=\"pop\"><img src=\"".url::base(TRUE)."image?host=%s&srv=%s&h=80&w=80&view=1\">%s</a></li>",
urlencode($service['hostname']),
urlencode($service['name']),
urlencode($service['hostname']),
urlencode($service['name']),
$service['servicedesc']);
}
?>
</ul>
</div><!-- /content -->

View File

@@ -0,0 +1,14 @@
<div data-role="content">
<ul data-filter="true" data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
<?php
$l = '';
foreach($hosts as $host){
if( substr($host['name'], 0, 1) != $l ){
printf("<li data-role=\"list-divider\">%s</li>\n", strtoupper(substr($host['name'], 0, 1)) );
}
printf("<li><a href=\"".url::base(TRUE)."mobile/host/%s\" data-transition=\"pop\">%s</a></li>", $host['name'], $host['name']);
$l = substr($host['name'], 0, 1);
}
?>
</ul>
</div><!-- /content -->

View File

@@ -0,0 +1,10 @@
<div data-role="content">
<ul data-role="listview" data-filter="true" data-inset="true" data-theme="c" data-dividertheme="a">
<?php
foreach($pages as $page){
$this->data->getPageDetails($page);
printf("<li><a href=\"".url::base(TRUE)."mobile/pages/%s\" data-transition=\"pop\">%s</a></li>", $page, $this->data->PAGE_DEF['page_name']);
}
?>
</ul>
</div><!-- /content -->

View File

@@ -0,0 +1,24 @@
<?php if( $this->isAuthorizedFor('host_search') ){ ?>
<!-- Search Box Start -->
<div data-role="content">
<div data-role="fieldcontain">
<form action="search" method="post">
<input type="search" name="term" id="search" value="" />
<button type="submit"><?php echo Kohana::lang('common.mobile-submit')?></button>
</form>
</div>
</div>
<!-- Search Box End -->
<?php } ?>
<div data-role="content">
<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="a">
<?php
foreach($this->result as $host){
printf("<li><a href=\"".url::base(TRUE)."mobile/host/%s\" data-transition=\"pop\">%s</a></li>", $host, $host);
}
?>
</ul>
</div><!-- /content -->

View File

@@ -0,0 +1,9 @@
<div data-role="content">
<ul data-role="listview" data-filter="true" data-inset="true" data-theme="c" data-dividertheme="a">
<?php
foreach($templates as $template){
printf("<li><a href=\"".url::base(TRUE)."mobile/special/%s\" data-transition=\"pop\">%s</a></li>", $template, $template);
}
?>
</ul>
</div><!-- /content -->

View File

@@ -0,0 +1,17 @@
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.multisite-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php
if(isset($host)){
echo "<strong>Host: </strong><a href=".pnp::multisite_link($base_url,$site,$host).">".html::specialchars(pnp::shorten($host))."</a><br>\n";
}
if(isset($service) && $service != "Host Perfdata"){
echo "<strong>Service: </strong><a href=".pnp::multisite_link($base_url,$site,$host, $service).">".html::specialchars(pnp::shorten($service))."</a>\n";
}
?>
</div>
</div>
<p>

View File

@@ -0,0 +1,48 @@
<div class="pagebody">
<table class="body"><tr valign="top"><td colspan="2">
<?php if (!empty($header)) {
echo $header;
} ?>
</tr></td>
<tr valign="top"><td>
<div class="left ui-widget-content ui-corner-all">
<?php if (!empty($graph_content)) {
echo $graph_content;
} ?>
</div>
</td><td>
<div class="right ui-widget-content ui-corner-all">
<?php if (!empty($search_box)) {
echo $search_box;
} ?>
<?php if (!empty($icon_box)) {
echo $icon_box;
} ?>
<?php if (!empty($timerange_box)) {
echo $timerange_box;
} ?>
<?php if (!empty($basket_box)) {
echo $basket_box;
} ?>
<?php if (!empty($pages_box)) {
echo $pages_box;
} ?>
<?php if (!empty($service_box)) {
echo $service_box;
} ?>
<?php if (!empty($logo_box)) {
echo $logo_box;
} ?>
</div>
</td></tr>
<tr valign="top"><td colspan="2">
<div class="cb p4 w99 ui-widget-content ui-corner-all">
<?php echo pnp::print_version(); ?>
</div>
</td></tr></table>
</div>

View File

@@ -0,0 +1,29 @@
<?php if (!empty($pages) && $this->isAuthorizedFor('pages') ) { ?>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.pages-box-header') ?>
</div>
<?php
$filter = $this->session->get('pfilter');
?>
<div class="p4 ui-widget-content">
<?php
echo "<input type=\"text\" name=\"page-filter\" id=\"page-filter\" value=\"".$filter."\" class=\"textbox\" />"
?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" id="pages">
<?php
foreach($pages as $page){
echo "<span id=\"page-".$page."\">";
$this->data->getPageDetails($page);
echo "<a class=\"multi0\" href=\"".url::base(TRUE)."page?page=".$page."\" title=\"".$this->data->PAGE_DEF['page_name']."\">".pnp::shorten($this->data->PAGE_DEF['page_name'])."</a><br>\n";
echo "</span>\n";
}
?>
</div>
</div>
<p>
<?php } ?>

View File

@@ -0,0 +1,10 @@
<table><tr><td>
<?php
foreach ( $this->data->STRUCT as $KEY=>$VAL){
$source = $VAL['SOURCE'];
echo "<tr><td>\n";
echo "<img width=\"".$imgwidth."\" src=\"".url::base(TRUE)."image?host=".urlencode($host)."&srv=".urlencode($srv)."&view=$view&source=$source\">\n";
echo "</td></tr>\n";
}
?>
</table>

View File

@@ -0,0 +1,22 @@
<?php if( $this->isAuthorizedFor('host_search') ){ ?>
<!-- Search Box Start -->
<script type="text/javascript">
jQuery(function() {
jQuery("#query").autocomplete({
source: "<?php echo url::base('true')?>/index.php/ajax/search",
select: function(event, ui) { window.location = "<?php echo url::base('true')?>" + "graph?host=" + ui.item.value }
});
});
</script>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.search-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom">
<input type="text" name="host" id="query" class="textbox" />
</div>
</div>
<p>
<!-- Search Box End -->
<?php } ?>

View File

@@ -0,0 +1,36 @@
<?php if (!empty($services) && $this->isAuthorizedFor('service_links') ) { ?>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.service-box-header') ?>
</div>
<?php
$filter = $this->session->get('sfilter');
?>
<div class="p4 ui-widget-content">
<?php
echo "<input type=\"text\" name=\"service-filter\" id=\"service-filter\" value=\"".$filter."\" class=\"textbox\" />"
?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" id="services">
<?php
foreach($services as $service){
echo "<span id=\"service-".$service['servicedesc']."\">\n";
$path = pnp::addToUri( array('host' => $host, 'srv' => $service['name']) );
echo pnp::add_to_basket_icon($host,
$service['name']);
echo "<a href=\"".$path."\" class=\"multi".$service['is_multi']. " " . $service['state'].
"\" title=\"".$service['servicedesc'].
"\">";
echo pnp::shorten($service['servicedesc']).
"</a><br>\n";
echo "</span>\n";
}
?>
</div>
</div>
<p>
<?php } ?>

View File

@@ -0,0 +1,31 @@
<?php if (!empty($this->templates) && $this->isAuthorizedFor('service_links') ) { ?>
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.special-templates-box-header') ?>
</div>
<?php
$filter = $this->session->get('spfilter');
?>
<div class="p4 ui-widget-content">
<?php
echo "<input type=\"text\" name=\"special-filter\" id=\"special-filter\" value=\"".$filter."\"class=\"textbox\" />"
?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom" id="special-templates">
<?php
foreach($this->templates as $template){
echo "<span id=\"special-".$template."\">";
$path = pnp::addToUri( array('tpl' => $template) );
echo "<a href=\"".$path."\" class=\"multi0\">".
pnp::shorten($template).
"</a><br>\n";
echo "</span>\n";
}
?>
</div>
</div>
<p>
<?php } ?>

View File

@@ -0,0 +1,19 @@
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.status-box-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom">
<?php if(isset($host)) echo "<strong>Host:&nbsp;</strong>".
html::anchor('graph'.
"?host=".$lhost,
html::specialchars(pnp::shorten($host))."<br>");?>
<?php if(isset($service)) echo "<strong>Service:&nbsp;</strong>" .
html::anchor('graph'.
"?host=".$lhost.
"&srv=".$lservice,
html::specialchars(pnp::shorten($service))."<br>");?>
<?php if(isset($timet)) echo "<strong>Last Check:&nbsp;</strong>$timet<br>"?>
</div>
</div>
<p>

View File

@@ -0,0 +1,221 @@
<?php defined('SYSPATH') OR die('No direct access allowed.'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="<?php echo $this->config->conf['refresh'] ?>" />
<title><?php if (isset($this->title)) echo html::specialchars($this->title) ?></title>
<?php echo html::stylesheet('media/css/common.css') ?>
<?php echo html::stylesheet('media/css/imgareaselect-default.css') ?>
<?php echo html::stylesheet('media/css/ui-'.$this->theme.'/jquery-ui.css') ?>
<?php echo html::link('media/images/favicon.ico','icon','image/ico') ?>
<?php echo html::script('media/js/jquery-min.js')?>
<?php echo html::script('media/js/jquery.imgareaselect.min.js')?>
<?php echo html::script('media/js/jquery-ui.min.js')?>
<?php echo html::script('media/js/jquery-ui-timepicker-addon.js')?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(window).load(
function() {
jQuery('div.graph').each(function(){
var img_width = jQuery(this).next('img').width();
var rrd_width = parseInt(jQuery(this).css('width'));
var left = img_width - rrd_width - <?php echo $this->config->conf['right_zoom_offset'] ?>;
jQuery(this).css('left', left);
jQuery(this).css('cursor', 'e-resize');
jQuery(this).attr('title', 'Click to zoom in');
});
jQuery('img.goto').css('visibility', 'visible');
jQuery('div.graph').imgAreaSelect({ handles: false, autoHide: true,
fadeSpeed: 500, onSelectEnd: redirect, minHeight: '<?php echo $this->config->conf['graph_height'] ?>' });
function redirect(img, selection) {
if (!selection.width || !selection.height)
return;
var graph_width = parseInt(jQuery(img).css('width'));
var link = jQuery(img).attr('id');
var ostart = Math.abs(jQuery(img).attr('start'));
var oend = Math.abs(jQuery(img).attr('end'));
var delta = (oend - ostart);
if( delta < 600 )
delta = 600;
var sec_per_px = parseInt( delta / graph_width);
var start = ostart + Math.ceil( selection.x1 * sec_per_px );
var end = ostart + ( selection.x2 * sec_per_px );
window.location = link + '&start=' + start + '&end=' + end ;
}
var sfilter = "<?php echo $this->session->get('sfilter') ?>";
var spfilter = "<?php echo $this->session->get('spfilter') ?>";
var pfilter = "<?php echo $this->session->get('pfilter') ?>";
if(jQuery("#service-filter").length) {
console.log("send keyup")
jQuery("#service-filter").keyup()
}
if(jQuery("#special-filter").length) {
jQuery("#special-filter").keyup()
}
if(jQuery("#page-filter").length) {
jQuery("#page-filter").keyup()
}
});
jQuery(document).ready(function(){
var path = "<?php echo url::base(TRUE)."/"?>";
jQuery("img").fadeIn(1500);
jQuery("#basket_action_add a").live("click", function(){
var item = (this.id)
jQuery.ajax({
type: "POST",
url: path + "ajax/basket/add",
data: { item: item },
success: function(msg){
jQuery("#basket_items").html(msg);
window.location.reload()
}
});
});
jQuery("#basket-clear").live("click", function(){
jQuery.ajax({
type: "POST",
url: path + "ajax/basket/clear",
success: function(msg){
window.location.reload()
}
});
});
jQuery("#basket-show").live("click", function(){
window.location.href = path + 'page/basket'
});
jQuery(".basket_action_remove a").live("click", function(){
var item = (this.id)
jQuery.ajax({
type: "POST",
url: path + "ajax/basket/remove/",
data: { item: item },
success: function(msg){
jQuery("#basket_items").html(msg);
window.location.reload()
}
});
});
jQuery("#basket_items" ).sortable({
update: function(event, ui) {
var items = jQuery(this).sortable('toArray').toString();
jQuery.ajax({
type: "POST",
url: path + "ajax/basket/sort",
data: { items: items },
success: function(msg){
window.location.reload()
}
});
}
});
jQuery("#basket_items" ).disableSelection();
jQuery("#remove_timerange_session").click(function(){
jQuery.ajax({
type: "GET",
url: path + "ajax/remove/timerange",
success: function(){
location.reload();
}
});
});
jQuery("#service-filter").keyup(function () {
var sfilter = jQuery("#service-filter").val();
if(sfilter != "") {
jQuery("#service-filter").css('background-color','#ff9999');
}else{
jQuery("#service-filter").css('background-color','white');
}
jQuery.ajax({
type: "POST",
url: path + "ajax/filter/set-sfilter",
data: { sfilter: sfilter }
});
jQuery("#services span[id^='service']").each(function () {
if (jQuery(this).attr('id').search(new RegExp("service-.*" + sfilter,"i")) == 0) {
jQuery(this).show();
} else {
jQuery(this).hide();
}
});
});
jQuery("#special-filter").keyup(function () {
var spfilter = jQuery("#special-filter").val();
if(spfilter != "") {
jQuery("#special-filter").css('background-color','#ff9999');
}else{
jQuery("#special-filter").css('background-color','white');
}
jQuery.ajax({
type: "POST",
url: path + "ajax/filter/set-spfilter",
data: { spfilter: spfilter }
});
jQuery("#special-templates span[id^='special']").each(function () {
if (jQuery(this).attr('id').search(new RegExp("special-.*" + spfilter,"i")) == 0) {
jQuery(this).show();
} else {
jQuery(this).hide();
};
});
});
jQuery("#page-filter").keyup(function () {
var pfilter = jQuery("#page-filter").val();
if(pfilter != "") {
jQuery("#page-filter").css('background-color','#ff9999');
}else{
jQuery("#page-filter").css('background-color','white');
}
jQuery.ajax({
type: "POST",
url: path + "ajax/filter/set-pfilter",
data: { pfilter: pfilter }
});
jQuery("#pages span[id^='page']").each(function () {
if (jQuery(this).attr('id').search(new RegExp("page-.*" + pfilter,"i")) == 0) {
jQuery(this).show();
} else {
jQuery(this).hide();
};
});
});
});
<?php if (!empty($zoom_header)) {
echo $zoom_header;
} ?>
</script>
</head>
<body>
<?php if (!empty($graph)) {
echo $graph;
} ?>
<?php if (!empty($debug)) {
echo $debug;
} ?>
<?php if (!empty($color)) {
echo $color;
} ?>
<?php if (!empty($zoom)) {
echo $zoom;
} ?>
<?php if (!empty($page)) {
echo $page;
} ?>
<?php if (!empty($docs)) {
echo $docs;
} ?>
</body>
</html>

View File

@@ -0,0 +1,26 @@
<?php
echo "<div class=\"ui-widget\">\n";
echo "<div class=\"p2 ui-widget-header ui-corner-top\">\n";
echo Kohana::lang('common.timerange-box-header')."\n";
echo "</div>\n";
echo "<div class=\"p4 ui-widget-content ui-corner-bottom\">\n";
$start = $this->session->get('start','');
$end = $this->session->get('end','');
$path = pnp::addToUri(array('start' => $start,'end' => $end));
if($start && $end){
echo "<a class=\"multi0\" href=\"".$path."\">".Kohana::lang('common.timerange-selector-link')."</a><br>\n";
}
if($start && !$end){
echo "<a class=\"multi0\" href=\"".$path."\">".Kohana::lang('common.timerange-selector-link')."</a><br>\n";
}
$path = pnp::addToUri(array('view' => '', 'start' => '', 'end' => ''));
echo "<a class=\"multi0\" href=\"".$path."\">".Kohana::lang('common.timerange-selector-overview')."</a><br>\n";
foreach($this->config->views as $key=>$view){
$path = pnp::addToUri(array('view' => $key, 'start' => '', 'end' => ''));
echo "<a class=\"multi0\" href=\"".$path."\">".$view['title']."</a><br>\n";
}
echo "</div>\n";
echo "</div><p>\n";
?>

View File

@@ -0,0 +1,37 @@
<?php if($this->config->conf['use_calendar']){
$start = $this->session->get('start','');
$end = $this->session->get('end','');
?>
<script type="text/javascript">
jQuery(function() {
jQuery("#button").click(function() {
jQuery("#toggle-timerange").toggle("blind",500);
return false;
});
jQuery("#dpstart").datetimepicker({ showOn: 'button', buttonImage: '<?php echo url::base()?>media/images/view-calendar.png', buttonImageOnly: true, constrainInput: false });
jQuery("#dpend").datetimepicker({ showOn: 'button', buttonImage: '<?php echo url::base()?>media/images/view-calendar.png', buttonImageOnly: true, constrainInput: false });
});
</script>
<div id="toggle-timerange" class="ui-widget" style="Display: none;">
<div class="p4 ui-widget-header ui-corner-top"><?php echo Kohana::lang('common.timerange-selector-title') ?></div>
<div class="p4 ui-widget-content ui-corner-bottom">
<form method="GET" action="<?php echo url::base(TRUE).Router::$current_uri?>">
<fieldset>
<legend><?php echo Kohana::lang('common.timerange-selector-legend') ?></legend>
<?php foreach($_GET as $key=>$val){
if( $key == "start" )
continue;
if( $key == "end" )
continue;
echo "<input type=\"hidden\" name=\"".htmlspecialchars($key)."\" value=\"".htmlspecialchars($val)."\">\n";
}?>
<label for=start"><?php echo Kohana::lang('common.start') ?>: </label><input id="dpstart" type="text" size="18" maxlength="40" name="start" value="<?php echo $start?>">
<label for=end"><?php echo Kohana::lang('common.end') ?>: </label><input id="dpend" type="text" size="18" maxlength="40" name="end" value="<?php echo $end?>">
<input type="submit" id="submit" class="ui-button ui-state-default ui-corner-all" value="<?php echo Kohana::lang('common.timerange-selector-submit-button') ?>"></input>
<input type="button" id="remove_timerange_session" class="ui-button ui-state-default ui-corner-all" value="<?php echo Kohana::lang('common.timerange-selector-clear-button') ?>"></input>
</fieldset>
</form><p>
</div>
</div>
<?php } ?>

View File

@@ -0,0 +1,10 @@
<!-- Widget Graph Start -->
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
Title
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
Content
</div>
</div><p>
<!-- Widget Graph End -->

View File

@@ -0,0 +1,10 @@
<!-- Widget Menu Start -->
<div class="ui-widget">
<div class="p2 ui-widget-header ui-corner-top">
Title
</div>
<div class="p4 ui-widget-content ui-corner-bottom" >
Content
</div>
</div><p>
<!-- Widget Menu End -->

View File

@@ -0,0 +1,129 @@
<html>
<head>
<?php echo html::stylesheet('media/css/common.css') ?>
<?php echo html::stylesheet('media/css/imgareaselect-default.css') ?>
<?php echo html::stylesheet('media/css/ui-'.$this->theme.'/jquery-ui.css') ?>
<?php echo html::link('media/images/favicon.ico','icon','image/ico') ?>
<?php echo html::script('media/js/jquery-min.js')?>
<?php echo html::script('media/js/jquery.imgareaselect.min.js')?>
<?php echo html::script('media/js/jquery-ui.min.js')?>
<script type="text/javascript">
jQuery.noConflict();
jQuery(window).load(
function() {
jQuery('div.graph').each(function(){
var img_width = jQuery(this).next('img').width();
var rrd_width = parseInt(jQuery(this).css('width'));
var left = img_width - rrd_width - <?php echo $this->config->conf['right_zoom_offset'] ?>;
jQuery(this).css('left', left);
jQuery(this).css('cursor', 'e-resize');
jQuery(this).attr('title', 'Click to zoom in');
});
jQuery('img.goto').css('visibility', 'visible');
jQuery('div.graph').imgAreaSelect({ handles: false, autoHide: true,
fadeSpeed: 500, onSelectEnd: redirect, minHeight: '<?php echo $this->config->conf['zgraph_height'] ?>' });
function redirect(img, selection) {
if (!selection.width || !selection.height)
return;
var graph_width = parseInt(jQuery(img).css('width'));
var source = <?php echo $this->source?>;
var link = jQuery(img).attr('id');
var ostart = Math.abs(jQuery(img).attr('start'));
var oend = Math.abs(jQuery(img).attr('end'));
var delta = (oend - ostart);
if( delta < 600 )
delta = 600;
var sec_per_px = parseInt( delta / graph_width);
var start = ostart + Math.ceil( selection.x1 * sec_per_px );
var end = ostart + ( selection.x2 * sec_per_px );
window.location = link + '&source=' + source + '&start=' + start + '&end=' + end ;
}
});
</script>
</head>
<body>
<div class="pagebody">
<div class="ui-widget">
<div class="ui-widget-header ui-corner-top">
<?php echo Kohana::lang('common.zoom-header') ?>
</div>
<div class="p4 ui-widget-content ui-corner-bottom">
<h3> <?php echo $this->data->TIMERANGE['f_start']?> --- <?php echo $this->data->TIMERANGE['f_end']?> </h3>
<div style="position:relative;">
<?php
echo "<div start=$start end=$end style=\"width:".$graph_width."px; height:".$graph_height."px; position:absolute; top:33px\" class=\"graph\" id=\"".$this->url."\" ></div>";
if(!empty($tpl)){
echo "<img class=\"graph\" src=\"image?source=$source"
."&tpl=$tpl"
."&view=$view"
."&start=$start"
."&end=$end"
."&graph_height=$graph_height"
."&graph_width=$graph_width\">";
}else{
echo "<img src=\"image?source=$source"
."&host=$host"
."&srv=$srv"
."&view=$view"
."&start=$start"
."&end=$end"
."&graph_height=$graph_height"
."&graph_width=$graph_width\">";
}
$start_down = $this->data->TIMERANGE['start'] - intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri( array('start' => $start_down));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; left:%dpx; bottom:-28px\"></a>\n",
$path,
"Move Start to ".date($this->config->conf['date_fmt'],$start_down),
url::base()."media/images/go-left.png",
10
);
$start_up = $this->data->TIMERANGE['start'] + intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri( array('start' => $start_up));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; left:%dpx; bottom:-28px\"></a>\n",
$path,
"Move Start to ".date($this->config->conf['date_fmt'],$start_up),
url::base()."media/images/go-right.png",
60
);
$path = pnp::addToUri( array('end' => time() ));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; right:%dpx; bottom:-28px\"></a>\n",
$path,
"Move End to ".date($this->config->conf['date_fmt'],time()),
url::base()."media/images/go-now.png",
10
);
$end_up = $this->data->TIMERANGE['end'] + intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri( array('end' => $end_up));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; right:%dpx; bottom:-28px\"></a>\n",
$path,
"Move End to ".date($this->config->conf['date_fmt'],$end_up),
url::base()."media/images/go-right.png",
60
);
$end_down = $this->data->TIMERANGE['end'] - intval(($this->data->TIMERANGE['end'] - $this->data->TIMERANGE['start']) / 2);
$path = pnp::addToUri( array('end' => $end_down));
printf("<a href=\"%s\" title=\"%s\"><img class=\"goto\" src=\"%s\" style=\"visibility: hidden; position:absolute; right:%dpx; bottom:-28px\"></a>\n",
$path,
"Move End to ".date($this->config->conf['date_fmt'],$end_down),
url::base()."media/images/go-left.png",
110
);
?>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,4 @@
function Gzoom (url) {
GzoomWindow = window.open(url, "PNP4Nagios", "width=<?php echo $graph_width ?>,height=<?php echo $graph_height ?>,location=no,status=no,resizable=yes,scrollbars=yes");
GzoomWindow.focus();
}