2013-04-04 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/functions_flot.php, operation/agentes/stat_win.php: cleaned source code style. * mobile/include/ui.class.php, mobile/include/style/main.css, mobile/index.php, mobile/operation/module_graph.php, mobile/operation/modules.php: more changes for the mobile in the view of graph module. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7931 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6e9c93defa
commit
b657a0c23a
|
@ -1,3 +1,13 @@
|
||||||
|
2013-04-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/graphs/functions_flot.php, operation/agentes/stat_win.php:
|
||||||
|
cleaned source code style.
|
||||||
|
|
||||||
|
* mobile/include/ui.class.php, mobile/include/style/main.css,
|
||||||
|
mobile/index.php, mobile/operation/module_graph.php,
|
||||||
|
mobile/operation/modules.php: more changes for the mobile in the
|
||||||
|
view of graph module.
|
||||||
|
|
||||||
2013-04-04 Mario Pulido <mario.pulido@artica.es>
|
2013-04-04 Mario Pulido <mario.pulido@artica.es>
|
||||||
|
|
||||||
* extensions/update_manager/main.php: Fixed information bug and
|
* extensions/update_manager/main.php: Fixed information bug and
|
||||||
|
|
|
@ -197,9 +197,9 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
|
||||||
$values2 = array();
|
$values2 = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$max_x = 0;
|
$max_x = 0;
|
||||||
foreach($data as $jsvar => $values) {
|
foreach ($data as $jsvar => $values) {
|
||||||
$n_values = count($values);
|
$n_values = count($values);
|
||||||
if($n_values > $max_x) {
|
if ($n_values > $max_x) {
|
||||||
$max_x = $n_values;
|
$max_x = $n_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ tr.group_view_crit, .group_view_crit {
|
||||||
}
|
}
|
||||||
.ui-btn-up-group_view_crit {
|
.ui-btn-up-group_view_crit {
|
||||||
background: linear-gradient(#D50505, #FA3030) repeat scroll 0 0 #FA3030;
|
background: linear-gradient(#D50505, #FA3030) repeat scroll 0 0 #FA3030;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#D50505), to(#FA3030));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -49,6 +50,7 @@ tr.group_view_crit, .group_view_crit {
|
||||||
}
|
}
|
||||||
.ui-btn-hover-group_view_crit {
|
.ui-btn-hover-group_view_crit {
|
||||||
background: linear-gradient(#C41616, #E94141) repeat scroll 0 0 #E94141;
|
background: linear-gradient(#C41616, #E94141) repeat scroll 0 0 #E94141;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#C41616), to(#E94141));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -68,6 +70,7 @@ tr.group_view_crit, .group_view_crit {
|
||||||
.ui-btn-up-group_view_normal,
|
.ui-btn-up-group_view_normal,
|
||||||
.ui-btn-up-group_view_norm {
|
.ui-btn-up-group_view_norm {
|
||||||
background: linear-gradient(#D7D7D7, #FFFFFF) repeat scroll 0 0 #FFFFFF;
|
background: linear-gradient(#D7D7D7, #FFFFFF) repeat scroll 0 0 #FFFFFF;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#D7D7D7), to(#FFFFFF));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -76,6 +79,7 @@ tr.group_view_crit, .group_view_crit {
|
||||||
.ui-btn-hover-group_view_normal,
|
.ui-btn-hover-group_view_normal,
|
||||||
.ui-btn-hover-group_view_normal {
|
.ui-btn-hover-group_view_normal {
|
||||||
background: linear-gradient(#D7D7D7, #FFFFFF) repeat scroll 0 0 #FFFFFF;
|
background: linear-gradient(#D7D7D7, #FFFFFF) repeat scroll 0 0 #FFFFFF;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#D7D7D7), to(#FFFFFF));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -93,6 +97,7 @@ tr.group_view_crit, .group_view_crit {
|
||||||
}
|
}
|
||||||
.ui-btn-up-group_view_ok {
|
.ui-btn-up-group_view_ok {
|
||||||
background: linear-gradient(#007000, #00C000) repeat scroll 0 0 #00C000;
|
background: linear-gradient(#007000, #00C000) repeat scroll 0 0 #00C000;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#007000), to(#00C000));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -100,6 +105,7 @@ tr.group_view_crit, .group_view_crit {
|
||||||
}
|
}
|
||||||
.ui-btn-hover-group_view_ok {
|
.ui-btn-hover-group_view_ok {
|
||||||
background: linear-gradient(#096709, #0FB10F) repeat scroll 0 0 #0FB10F;
|
background: linear-gradient(#096709, #0FB10F) repeat scroll 0 0 #0FB10F;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#096709), to(#0FB10F));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -116,6 +122,7 @@ a.group_view_warn {
|
||||||
}
|
}
|
||||||
.ui-btn-up-group_view_warn {
|
.ui-btn-up-group_view_warn {
|
||||||
background: linear-gradient(#D0BF0A, #F5E535) repeat scroll 0 0 #F5E535;
|
background: linear-gradient(#D0BF0A, #F5E535) repeat scroll 0 0 #F5E535;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#D0BF0A), to(#F5E535));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -123,6 +130,7 @@ a.group_view_warn {
|
||||||
}
|
}
|
||||||
.ui-btn-hover-group_view_warn {
|
.ui-btn-hover-group_view_warn {
|
||||||
background: linear-gradient(#BFB11B, #E4D746) repeat scroll 0 0 #E4D746;
|
background: linear-gradient(#BFB11B, #E4D746) repeat scroll 0 0 #E4D746;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#BFB11B), to(#E4D746));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -139,6 +147,7 @@ tr.group_view_alrm, .group_view_alrm {
|
||||||
}
|
}
|
||||||
.ui-btn-up-group_view_alrm {
|
.ui-btn-up-group_view_alrm {
|
||||||
background: linear-gradient(#9D5A01, #ED8701) repeat scroll 0 0 #ED8701;
|
background: linear-gradient(#9D5A01, #ED8701) repeat scroll 0 0 #ED8701;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#9D5A01), to(#ED8701));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -146,6 +155,7 @@ tr.group_view_alrm, .group_view_alrm {
|
||||||
}
|
}
|
||||||
.ui-btn-hover-group_view_alrm {
|
.ui-btn-hover-group_view_alrm {
|
||||||
background: linear-gradient(#91580D, #DA8414) repeat scroll 0 0 #DA8414;
|
background: linear-gradient(#91580D, #DA8414) repeat scroll 0 0 #DA8414;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#91580D), to(#DA8414));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -162,6 +172,7 @@ tr.group_view_unk, .group_view_unk {
|
||||||
}
|
}
|
||||||
.ui-btn-up-group_view_unk {
|
.ui-btn-up-group_view_unk {
|
||||||
background: linear-gradient(#9C9C9C, #C4C4C4) repeat scroll 0 0 #C4C4C4;
|
background: linear-gradient(#9C9C9C, #C4C4C4) repeat scroll 0 0 #C4C4C4;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#9C9C9C), to(#C4C4C4));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -169,6 +180,7 @@ tr.group_view_unk, .group_view_unk {
|
||||||
}
|
}
|
||||||
.ui-btn-hover-group_view_unk {
|
.ui-btn-hover-group_view_unk {
|
||||||
background: linear-gradient(#888888, #B0B0B0) repeat scroll 0 0 #ECECEC;
|
background: linear-gradient(#888888, #B0B0B0) repeat scroll 0 0 #ECECEC;
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#888888), to(#B0B0B0));
|
||||||
border: 1px solid #111111;
|
border: 1px solid #111111;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -437,6 +437,27 @@ class Ui {
|
||||||
$this->formAddInput($options);
|
$this->formAddInput($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function formAddInpuDate($options) {
|
||||||
|
$options['type'] = 'date';
|
||||||
|
$options['data-clear-btn'] = "false";
|
||||||
|
|
||||||
|
$this->formAddInput($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function formAddCheckbox($options) {
|
||||||
|
$options['type'] = 'checkbox';
|
||||||
|
|
||||||
|
if (isset($options['checked'])) {
|
||||||
|
if ($options['checked']) {
|
||||||
|
$options['checked'] = 'checked';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
unset($options['checked']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->formAddInput($options);
|
||||||
|
}
|
||||||
|
|
||||||
public function formAddSubmitButton($options) {
|
public function formAddSubmitButton($options) {
|
||||||
$options['type'] = 'submit';
|
$options['type'] = 'submit';
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ require_once('operation/events.php');
|
||||||
require_once('operation/alerts.php');
|
require_once('operation/alerts.php');
|
||||||
require_once('operation/agents.php');
|
require_once('operation/agents.php');
|
||||||
require_once('operation/modules.php');
|
require_once('operation/modules.php');
|
||||||
|
require_once('operation/module_graph.php');
|
||||||
$enterpriseHook = enterprise_include('mobile/include/enterprise.class.php');
|
$enterpriseHook = enterprise_include('mobile/include/enterprise.class.php');
|
||||||
|
|
||||||
$system = System::getInstance();
|
$system = System::getInstance();
|
||||||
|
@ -62,6 +63,10 @@ switch ($action) {
|
||||||
$modules = new Modules();
|
$modules = new Modules();
|
||||||
$modules->ajax($parameter2);
|
$modules->ajax($parameter2);
|
||||||
break;
|
break;
|
||||||
|
case 'module_graph':
|
||||||
|
$module_graph = new ModuleGraph();
|
||||||
|
$module_graph->ajax($parameter2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
@ -115,6 +120,10 @@ switch ($action) {
|
||||||
$modules = new Modules();
|
$modules = new Modules();
|
||||||
$modules->show();
|
$modules->show();
|
||||||
break;
|
break;
|
||||||
|
case 'module_graph':
|
||||||
|
$module_graph = new ModuleGraph();
|
||||||
|
$module_graph->show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,406 @@
|
||||||
|
<?php
|
||||||
|
// Pandora FMS - http://pandorafms.com
|
||||||
|
// ==================================================
|
||||||
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||||
|
// Please see http://pandorafms.org for full contribution list
|
||||||
|
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License
|
||||||
|
// as published by the Free Software Foundation for version 2.
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
class ModuleGraph {
|
||||||
|
private $correct_acl = false;
|
||||||
|
private $acl = "AR";
|
||||||
|
|
||||||
|
private $id = 0;
|
||||||
|
private $graph_type = "sparse";
|
||||||
|
private $period = SECONDS_1DAY;
|
||||||
|
private $draw_events = 0;
|
||||||
|
private $width = 0;
|
||||||
|
private $height = 0;
|
||||||
|
private $draw_alerts = 0;
|
||||||
|
private $avg_only = 0;
|
||||||
|
private $start_date = 0;
|
||||||
|
private $time_compare_separated = 0;
|
||||||
|
private $time_compare_overlapped = 0;
|
||||||
|
private $unknown_graph = 1;
|
||||||
|
private $zoom = 1;
|
||||||
|
private $baseline = 0;
|
||||||
|
|
||||||
|
private $module = null;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$system = System::getInstance();
|
||||||
|
|
||||||
|
$this->start_date = date("Y-m-d");
|
||||||
|
|
||||||
|
if ($system->checkACL($this->acl)) {
|
||||||
|
$this->correct_acl = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->correct_acl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getFilters() {
|
||||||
|
$system = System::getInstance();
|
||||||
|
|
||||||
|
$this->id = (int)$system->getRequest('id', 0);
|
||||||
|
$this->module = modules_get_agentmodule($this->id);
|
||||||
|
$this->graph_type = return_graphtype($this->module["id_tipo_modulo"]);
|
||||||
|
|
||||||
|
$period_hours = $system->getRequest('period_hours', false);
|
||||||
|
if ($period_hours === false) {
|
||||||
|
$this->period = SECONDS_1DAY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->period = $period_hours * SECONDS_1HOUR;
|
||||||
|
}
|
||||||
|
$this->draw_events = (int)$system->getRequest('draw_events', 0);
|
||||||
|
$this->draw_alerts = (int)$system->getRequest('draw_alerts', 0);
|
||||||
|
$this->avg_only = (int)$system->getRequest('avg_only', 0);
|
||||||
|
$this->start_date = $system->getRequest('start_date', false);
|
||||||
|
if ($this->start_date === false) {
|
||||||
|
$this->start_date = date("Y-m-d");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->start_date = date("Y-m-d", strtotime($this->start_date));
|
||||||
|
}
|
||||||
|
$this->time_compare_separated = (int)$system->getRequest('time_compare_separated', 0);
|
||||||
|
$this->time_compare_overlapped = (int)$system->getRequest('time_compare_overlapped', 0);
|
||||||
|
$this->unknown_graph = (int)$system->getRequest('unknown_graph', 0);
|
||||||
|
$this->zoom = (int)$system->getRequest('zoom', 1);
|
||||||
|
$this->baseline = (int)$system->getRequest('baseline', 0);
|
||||||
|
|
||||||
|
$this->width = (int)$system->getRequest('width', 0);
|
||||||
|
$this->width -= 20; //Correct the width
|
||||||
|
$this->height = (int)$system->getRequest('height', 0);
|
||||||
|
|
||||||
|
//Sancho says "put the height to 1/2 for to make more beautyful"
|
||||||
|
$this->height = $this->height / 2;
|
||||||
|
|
||||||
|
$this->height -= 80; //Correct the height
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ajax($parameter2 = false) {
|
||||||
|
$system = System::getInstance();
|
||||||
|
|
||||||
|
if (!$this->correct_acl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch ($parameter2) {
|
||||||
|
case 'get_graph':
|
||||||
|
$this->getFilters();
|
||||||
|
$correct = 0;
|
||||||
|
$graph = '';
|
||||||
|
|
||||||
|
$correct = 1;
|
||||||
|
|
||||||
|
$label = $this->module["nombre"];
|
||||||
|
$unit = db_get_value('unit', 'tagente_modulo',
|
||||||
|
'id_agente_modulo', $this->id);
|
||||||
|
|
||||||
|
$utime = get_system_time ();
|
||||||
|
$current = date("Y-m-d", $utime);
|
||||||
|
|
||||||
|
if ($this->start_date != $current)
|
||||||
|
$date = strtotime($this->start_date);
|
||||||
|
else
|
||||||
|
$date = $utime;
|
||||||
|
|
||||||
|
$urlImage = ui_get_full_url(false);
|
||||||
|
|
||||||
|
if ($this->time_compare_separated) {
|
||||||
|
$time_compare = 'separated';
|
||||||
|
}
|
||||||
|
else if ($this->time_compare_overlapped) {
|
||||||
|
$time_compare = 'overlapped';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
switch ($this->graph_type) {
|
||||||
|
case 'boolean':
|
||||||
|
$graph = grafico_modulo_boolean ($this->id,
|
||||||
|
$this->period, $this->draw_events,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$label, $unit, $this->draw_alerts,
|
||||||
|
$this->avg_only, false, $date, false,
|
||||||
|
$urlImage, 'adapter_' . $this->graph_type,
|
||||||
|
$time_compare, $this->unknown_graph);
|
||||||
|
if ($show_events_graph) {
|
||||||
|
$graph .= '<br>';
|
||||||
|
$graph .= graphic_module_events($this->id,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$this->period, $config['homeurl'],
|
||||||
|
$this->zoom,
|
||||||
|
'adapted_' . $this->graph_type, $date);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'sparse':
|
||||||
|
$graph = grafico_modulo_sparse ($this->id,
|
||||||
|
$this->period, $this->draw_events,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$label, null, $this->draw_alerts,
|
||||||
|
$this->avg_only, false, $date, $unit,
|
||||||
|
$this->baseline, 0, true, false,
|
||||||
|
$urlImage, 1, false,
|
||||||
|
'adapter_' . $this->graph_type,
|
||||||
|
$time_compare, $this->unknown_graph);
|
||||||
|
if ($show_events_graph) {
|
||||||
|
$graph .= '<br>';
|
||||||
|
$graph .= graphic_module_events($this->id,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$this->period, $config['homeurl'],
|
||||||
|
$this->zoom, 'adapted_'.$this->graph_type, $date);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'string':
|
||||||
|
$graph = grafico_modulo_string ($this->id,
|
||||||
|
$this->period, $this->draw_events,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$label, null, $this->draw_alerts, 1,
|
||||||
|
false, $date, false, $urlImage,
|
||||||
|
'adapter_' . $this->graph_type);
|
||||||
|
if ($show_events_graph) {
|
||||||
|
$graph .= '<br>';
|
||||||
|
$graph .= graphic_module_events($this->id,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$this->period, $config['homeurl'],
|
||||||
|
$this->zoom, 'adapted_' . $this->graph_type, $date);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'log4x':
|
||||||
|
$graph .= grafico_modulo_log4x ($this->id,
|
||||||
|
$this->period, $this->draw_events,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$label, $unit_name, $this->draw_alerts,
|
||||||
|
1, $pure, $date);
|
||||||
|
if ($show_events_graph) {
|
||||||
|
$graph .= '<br>';
|
||||||
|
$graph .= graphic_module_events($this->id,
|
||||||
|
$this->width, $this->height,
|
||||||
|
$this->period, $config['homeurl'], $this->zoom, '', $date);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$graph .= fs_error_image ('../images');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$graph = ob_get_clean() . $graph;
|
||||||
|
|
||||||
|
echo json_encode(array('correct' => $correct, 'graph' => $graph));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show() {
|
||||||
|
if (!$this->correct_acl) {
|
||||||
|
$this->show_fail_acl();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->getFilters();
|
||||||
|
$this->showModuleGraph();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function show_fail_acl() {
|
||||||
|
$ui = Ui::getInstance();
|
||||||
|
|
||||||
|
$ui->createPage();
|
||||||
|
|
||||||
|
$options['type'] = 'onStart';
|
||||||
|
$options['title_text'] = __('You don\'t have access to this page');
|
||||||
|
$options['content_text'] = __('Access to this page is restricted to authorized users only, please contact system administrator if you need assistance. <br><br>Please know that all attempts to access this page are recorded in security logs of Pandora System Database');
|
||||||
|
$ui->addDialog($options);
|
||||||
|
|
||||||
|
$ui->showPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function javascript_code() {
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).bind('ready', function() {
|
||||||
|
$("#graph_content")
|
||||||
|
.height(($(window).height()
|
||||||
|
- $(".ui-header").height()
|
||||||
|
- $(".ui-collapsible").height()
|
||||||
|
- 55) + "px");
|
||||||
|
|
||||||
|
ajax_get_graph($("#id_module").val());
|
||||||
|
});
|
||||||
|
|
||||||
|
function ajax_get_graph(id) {
|
||||||
|
postvars = {};
|
||||||
|
postvars["action"] = "ajax";
|
||||||
|
postvars["parameter1"] = "module_graph";
|
||||||
|
postvars["parameter2"] = "get_graph";
|
||||||
|
postvars["width"] = $("#graph_content").width();
|
||||||
|
postvars["height"] = $("#graph_content").height();
|
||||||
|
|
||||||
|
postvars["draw_alerts"] = ($("input[name = 'draw_alerts']").is(":checked"))?1:0;
|
||||||
|
postvars["draw_events"] = ($("input[name = 'draw_events']").is(":checked"))?1:0;
|
||||||
|
postvars["time_compare_separated"] = ($("input[name = 'time_compare_separated']").is(":checked"))?1:0;
|
||||||
|
postvars["time_compare_overlapped"] = ($("input[name = 'time_compare_overlapped']").is(":checked"))?1:0;
|
||||||
|
postvars["unknown_graph"] = ($("input[name = 'unknown_graph']").is(":checked"))?1:0;;
|
||||||
|
postvars["avg_only"] = ($("input[name = 'avg_only']").is(":checked"))?1:0;;
|
||||||
|
|
||||||
|
postvars["period_hours"] = $("input[name = 'period_hours']").val();
|
||||||
|
postvars["zoom"] = $("input[name = 'zoom']").val();
|
||||||
|
postvars["start_date"] = $("input[name = 'start_date']").val();
|
||||||
|
|
||||||
|
postvars["id"] = id;
|
||||||
|
|
||||||
|
$.ajax ({
|
||||||
|
type: "POST",
|
||||||
|
url: "index.php",
|
||||||
|
dataType: "json",
|
||||||
|
data: postvars,
|
||||||
|
success:
|
||||||
|
function (data) {
|
||||||
|
$("#loading_graph").hide();
|
||||||
|
if (data.correct) {
|
||||||
|
$("#graph_content").show();
|
||||||
|
$("#graph_content").html(data.graph);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#error_graph").show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error:
|
||||||
|
function (jqXHR, textStatus, errorThrown) {
|
||||||
|
$("#loading_graph").hide();
|
||||||
|
$("#error_graph").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
$javascript_code = ob_get_clean();
|
||||||
|
|
||||||
|
return $javascript_code;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function showModuleGraph() {
|
||||||
|
$ui = Ui::getInstance();
|
||||||
|
|
||||||
|
$ui->createPage();
|
||||||
|
|
||||||
|
$ui->createDefaultHeader(sprintf(__("PandoraFMS: %s"), $this->module["nombre"]));
|
||||||
|
$ui->showFooter(false);
|
||||||
|
$ui->beginContent();
|
||||||
|
$ui->contentAddHtml($ui->getInput(array(
|
||||||
|
'id' => 'id_module',
|
||||||
|
'value' => $this->id,
|
||||||
|
'type' => 'hidden'
|
||||||
|
)));
|
||||||
|
$ui->contentBeginCollapsible("Options");
|
||||||
|
$ui->beginForm("index.php?page=module_graph&id=" . $this->id);
|
||||||
|
$options = array(
|
||||||
|
'name' => 'draw_alerts',
|
||||||
|
'value' => 1,
|
||||||
|
'checked' => (bool)$this->draw_alerts,
|
||||||
|
'label' => __('Show Alerts')
|
||||||
|
);
|
||||||
|
$ui->formAddCheckbox($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'name' => 'draw_events',
|
||||||
|
'value' => 1,
|
||||||
|
'checked' => (bool)$this->draw_events,
|
||||||
|
'label' => __('Show Events')
|
||||||
|
);
|
||||||
|
$ui->formAddCheckbox($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'name' => 'time_compare_separated',
|
||||||
|
'value' => 1,
|
||||||
|
'checked' => (bool)$this->time_compare_separated,
|
||||||
|
'label' => __('Time compare (Separated)')
|
||||||
|
);
|
||||||
|
$ui->formAddCheckbox($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'name' => 'time_compare_overlapped',
|
||||||
|
'value' => 1,
|
||||||
|
'checked' => (bool)$this->time_compare_overlapped,
|
||||||
|
'label' => __('Time compare (Overlapped)')
|
||||||
|
);
|
||||||
|
$ui->formAddCheckbox($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'name' => 'unknown_graph',
|
||||||
|
'value' => 1,
|
||||||
|
'checked' => (bool)$this->unknown_graph,
|
||||||
|
'label' => __('Show unknown graph')
|
||||||
|
);
|
||||||
|
$ui->formAddCheckbox($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'name' => 'avg_only',
|
||||||
|
'value' => 1,
|
||||||
|
'checked' => (bool)$this->avg_only,
|
||||||
|
'label' => __('Avg Only')
|
||||||
|
);
|
||||||
|
$ui->formAddCheckbox($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'label' => __('Time range (hours)'),
|
||||||
|
'name' => 'period_hours',
|
||||||
|
'value' => ($this->period / SECONDS_1HOUR),
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 24 * 30,
|
||||||
|
'step' => 4
|
||||||
|
);
|
||||||
|
$ui->formAddSlider($options);
|
||||||
|
|
||||||
|
/*
|
||||||
|
$items = array('1' => __('x1'),
|
||||||
|
'2' => __('x2'),
|
||||||
|
'3' => __('x3'),
|
||||||
|
'4' => __('x4'));
|
||||||
|
$options = array(
|
||||||
|
'name' => 'zoom',
|
||||||
|
'title' => __('Zoom'),
|
||||||
|
'label' => __('Zoom'),
|
||||||
|
'items' => $items,
|
||||||
|
'selected' => $this->zoom
|
||||||
|
);
|
||||||
|
$ui->formAddSelectBox($options);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'name' => 'start_date',
|
||||||
|
'value' => $this->start_date,
|
||||||
|
'label' => __('Begin date')
|
||||||
|
);
|
||||||
|
$ui->formAddInpuDate($options);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'icon' => 'refresh',
|
||||||
|
'icon_pos' => 'right',
|
||||||
|
'text' => __('Update graph')
|
||||||
|
);
|
||||||
|
$ui->formAddSubmitButton($options);
|
||||||
|
|
||||||
|
$html = $ui->getEndForm();
|
||||||
|
$ui->contentCollapsibleAddItem($html);
|
||||||
|
$ui->contentEndCollapsible();
|
||||||
|
$ui->contentAddHtml('<div id="graph_content" style="display: none; width: 100%; height: 100%;"></div>
|
||||||
|
<div id="loading_graph" style="width: 100%; text-align: center;">' . __('Loading...') . '<br /><img src="images/ajax-loader.gif" /></div>
|
||||||
|
<div id="error_graph" style="display: none; color: red; width: 100%; text-align: center;">' . __('Error get the graph') . '</div>');
|
||||||
|
$ui->contentAddHtml($this->javascript_code());
|
||||||
|
$ui->endContent();
|
||||||
|
$ui->showPage();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
}
|
|
@ -440,7 +440,10 @@ class Modules {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$row[7] = $row[__('Data')] = $output;
|
$row[7] = $row[__('Data')] =
|
||||||
|
'<a data-ajax="false" href="index.php?page=module_graph&id=' . $module['id_agente_modulo'] . '">' .
|
||||||
|
html_print_image('images/chart_curve.png', true, array ("style" => 'vertical-align: middle;')) . '</a>' .
|
||||||
|
' ' . $output;
|
||||||
|
|
||||||
if (!$ajax) {
|
if (!$ajax) {
|
||||||
unset($row[0]);
|
unset($row[0]);
|
||||||
|
|
|
@ -130,10 +130,10 @@ $label = base64_decode(get_parameter('label', ''));
|
||||||
|
|
||||||
$time_compare = false;
|
$time_compare = false;
|
||||||
|
|
||||||
if($time_compare_separated) {
|
if ($time_compare_separated) {
|
||||||
$time_compare = 'separated';
|
$time_compare = 'separated';
|
||||||
}
|
}
|
||||||
else if($time_compare_overlapped) {
|
else if ($time_compare_overlapped) {
|
||||||
$time_compare = 'overlapped';
|
$time_compare = 'overlapped';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue