2012-03-15 Sergio Martin <sergio.martin@artica.es>
* include/javascript/pandora.js: Fix a little bug of default value in time advance control * operation/reporting/graph_viewer.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.preview.php: Remove the preview graphs and replace it by link of the operation mode git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5779 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6724671bae
commit
3534f3747c
|
@ -1,3 +1,14 @@
|
||||||
|
2012-03-15 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* include/javascript/pandora.js: Fix a little bug
|
||||||
|
of default value in time advance control
|
||||||
|
|
||||||
|
* operation/reporting/graph_viewer.php
|
||||||
|
godmode/reporting/graph_builder.php
|
||||||
|
godmode/reporting/graph_builder.preview.php: Remove
|
||||||
|
the preview graphs and replace it by link of the
|
||||||
|
operation mode
|
||||||
|
|
||||||
2012-03-15 Sergio Martin <sergio.martin@artica.es>
|
2012-03-15 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/javascript/pandora.js
|
* include/javascript/pandora.js
|
||||||
|
|
|
@ -160,15 +160,15 @@ if($change_weight){
|
||||||
|
|
||||||
if($edit_graph) {
|
if($edit_graph) {
|
||||||
$buttons = array(
|
$buttons = array(
|
||||||
|
'view' => array('active' => false,
|
||||||
|
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=' . $id_graph . '">' .
|
||||||
|
html_print_image("images/chart_curve.png", true, array ("title" => __('View graph'))) .'</a>'),
|
||||||
'main' => array('active' => false,
|
'main' => array('active' => false,
|
||||||
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=main&edit_graph=1&id=' . $id_graph . '">' .
|
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=main&edit_graph=1&id=' . $id_graph . '">' .
|
||||||
html_print_image("images/setup.png", true, array ("title" => __('Setup'))) .'</a>'),
|
html_print_image("images/setup.png", true, array ("title" => __('Setup'))) .'</a>'),
|
||||||
'graph_editor' => array('active' => false,
|
'graph_editor' => array('active' => false,
|
||||||
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=' . $id_graph . '">' .
|
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=' . $id_graph . '">' .
|
||||||
html_print_image("images/config.png", true, array ("title" => __('Graph editor'))) .'</a>'),
|
html_print_image("images/config.png", true, array ("title" => __('Graph editor'))) .'</a>')
|
||||||
'preview' => array('active' => false,
|
|
||||||
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=preview&edit_graph=1&id=' . $id_graph . '">' .
|
|
||||||
html_print_image("images/chart_curve.png", true, array ("title" => __('Preview'))) .'</a>')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$buttons[$active_tab]['active'] = true;
|
$buttons[$active_tab]['active'] = true;
|
||||||
|
@ -194,9 +194,6 @@ switch ($tab){
|
||||||
case "graph_editor":
|
case "graph_editor":
|
||||||
ui_print_page_header ($head, "", false, "graph_editor", true, $buttons);
|
ui_print_page_header ($head, "", false, "graph_editor", true, $buttons);
|
||||||
break;
|
break;
|
||||||
case "preview":
|
|
||||||
ui_print_page_header ($head, "", false, "graph_view", true, $buttons);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
ui_print_page_header ($head, "", false, "graph_builder", true, $buttons);
|
ui_print_page_header ($head, "", false, "graph_builder", true, $buttons);
|
||||||
break;
|
break;
|
||||||
|
@ -254,8 +251,5 @@ switch ($active_tab) {
|
||||||
case 'graph_editor':
|
case 'graph_editor':
|
||||||
require_once('godmode/reporting/graph_builder.graph_editor.php');
|
require_once('godmode/reporting/graph_builder.graph_editor.php');
|
||||||
break;
|
break;
|
||||||
case 'preview':
|
|
||||||
require_once('godmode/reporting/graph_builder.preview.php');
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,223 +0,0 @@
|
||||||
<?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.
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
require_once ('include/functions_custom_graphs.php');
|
|
||||||
|
|
||||||
if (is_ajax ()) {
|
|
||||||
$search_agents = (bool) get_parameter ('search_agents');
|
|
||||||
|
|
||||||
if ($search_agents) {
|
|
||||||
|
|
||||||
require_once ('include/functions_agents.php');
|
|
||||||
|
|
||||||
$id_agent = (int) get_parameter ('id_agent');
|
|
||||||
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
|
|
||||||
$id_group = (int) get_parameter('id_group');
|
|
||||||
|
|
||||||
$filter = array ();
|
|
||||||
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
|
|
||||||
$filter['id_grupo'] = $id_group;
|
|
||||||
|
|
||||||
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));
|
|
||||||
if ($agents === false)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach ($agents as $agent) {
|
|
||||||
echo $agent['nombre']."|".$agent['direccion']."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
check_login ();
|
|
||||||
|
|
||||||
if (! check_acl ($config['id_user'], 0, "IW")) {
|
|
||||||
db_pandora_audit("ACL Violation",
|
|
||||||
"Trying to access graph builder");
|
|
||||||
include ("general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = (integer) get_parameter('id');
|
|
||||||
|
|
||||||
$sql="SELECT * FROM tgraph_source WHERE id_graph = $id_graph";
|
|
||||||
$sources = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
$sql="SELECT * FROM tgraph WHERE id_graph = $id_graph";
|
|
||||||
$graph = db_get_row_sql($sql);
|
|
||||||
|
|
||||||
$id_user = $graph["id_user"];
|
|
||||||
$private = $graph["private"];
|
|
||||||
$width = $graph["width"];
|
|
||||||
$height = $graph["height"] + count($sources) * 10;
|
|
||||||
|
|
||||||
$zoom = (int) get_parameter ('zoom', 0);
|
|
||||||
//Increase the height to fix the leyend rise
|
|
||||||
if ($zoom > 0) {
|
|
||||||
switch ($zoom) {
|
|
||||||
case 1:
|
|
||||||
$width = 500;
|
|
||||||
$height = 200 + count($sources) * 15;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$width = 650;
|
|
||||||
$height = 300 + count($sources) * 10;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$width = 770;
|
|
||||||
$height = 400 + count($sources) * 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get different date to search the report.
|
|
||||||
$date = (string) get_parameter ('date', date ('Y-m-j'));
|
|
||||||
$time = (string) get_parameter ('time', date ('h:iA'));
|
|
||||||
$unixdate = strtotime ($date.' '.$time);
|
|
||||||
|
|
||||||
$period = (int) get_parameter ('period');
|
|
||||||
if (! $period)
|
|
||||||
$period = $graph["period"];
|
|
||||||
else
|
|
||||||
$period = $period;
|
|
||||||
|
|
||||||
$events = $graph["events"];
|
|
||||||
$description = $graph["description"];
|
|
||||||
$stacked = (int) get_parameter ('stacked', -1);
|
|
||||||
if ($stacked == -1)
|
|
||||||
$stacked = $graph["stacked"];
|
|
||||||
|
|
||||||
$name = $graph["name"];
|
|
||||||
|
|
||||||
$graphRows = db_get_all_rows_sql("SELECT t1.*,
|
|
||||||
(SELECT t3.nombre
|
|
||||||
FROM tagente AS t3
|
|
||||||
WHERE t3.id_agente =
|
|
||||||
(SELECT t2.id_agente
|
|
||||||
FROM tagente_modulo AS t2
|
|
||||||
WHERE t2.id_agente_modulo = t1.id_agent_module))
|
|
||||||
AS agent_name
|
|
||||||
FROM tgraph_source AS t1
|
|
||||||
WHERE t1.id_graph = " . $id);
|
|
||||||
$module_array = array();
|
|
||||||
$weight_array = array();
|
|
||||||
$agent_array = array();
|
|
||||||
|
|
||||||
if($graphRows === false) {
|
|
||||||
$graphRows = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($graphRows as $graphRow) {
|
|
||||||
$module_array[] = $graphRow['id_agent_module'];
|
|
||||||
$weight_array[] = $graphRow['weight'];
|
|
||||||
$agent_array[] = $graphRow['agent_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$modules = implode(',', $module_array);
|
|
||||||
$weights = implode(',', $weight_array);
|
|
||||||
|
|
||||||
echo "<table class='databox_frame' cellpadding='0' cellspacing='0' style='width:98%'>";
|
|
||||||
echo "<tr><td>";
|
|
||||||
|
|
||||||
if(!empty($modules)) {
|
|
||||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
|
||||||
|
|
||||||
echo graphic_combined_module(explode (',', $modules), explode (',', $weights), $period, $width, $height,
|
|
||||||
'Combined%20Sample%20Graph', '', $events, 0, 0, $stacked, $unixdate);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "<div class='nf' style='width: 98%'>".__('Empty graph')."</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</td></tr></table>";
|
|
||||||
|
|
||||||
echo "<form method = 'POST' action='index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=preview&edit_graph=1&id=$id_graph'>";
|
|
||||||
echo "<table class='databox_frame' cellpadding='4' cellspacing='4' style='width: 98%'>";
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td>";
|
|
||||||
echo "<b>".__('Date')."</b>"." ";
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td>";
|
|
||||||
echo html_print_input_text ('date', $date, '', 12, 10, true). ' ';
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td>";
|
|
||||||
echo html_print_input_text ('time', $time, '', 7, 7, true). ' ';
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='datos'>";
|
|
||||||
echo "<b>".__('Period')."</b>";
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='datos'>";
|
|
||||||
|
|
||||||
echo html_print_extended_select_for_time ('period', $period, '', '', '0', 10, true);
|
|
||||||
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='datos'>";
|
|
||||||
$stackeds = array ();
|
|
||||||
$stackeds[0] = __('Graph defined');
|
|
||||||
$stackeds[0] = __('Area');
|
|
||||||
$stackeds[1] = __('Stacked area');
|
|
||||||
$stackeds[2] = __('Line');
|
|
||||||
$stackeds[3] = __('Stacked line');
|
|
||||||
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
|
|
||||||
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='datos'>";
|
|
||||||
$zooms = array();
|
|
||||||
$zooms[0] = __('Graph defined');
|
|
||||||
$zooms[1] = __('Zoom x1');
|
|
||||||
$zooms[2] = __('Zoom x2');
|
|
||||||
$zooms[3] = __('Zoom x3');
|
|
||||||
html_print_select ($zooms, 'zoom', $zoom , '', '', 0);
|
|
||||||
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='datos'>";
|
|
||||||
echo "<input type=submit value='".__('Update')."' class='sub upd'>";
|
|
||||||
echo "</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</form>";
|
|
||||||
|
|
||||||
/* We must add javascript here. Otherwise, the date picker won't
|
|
||||||
work if the date is not correct because php is returning. */
|
|
||||||
|
|
||||||
ui_require_css_file ('datepicker');
|
|
||||||
ui_require_jquery_file ('ui.core');
|
|
||||||
ui_require_jquery_file ('ui.datepicker');
|
|
||||||
ui_require_jquery_file ('timeentry');
|
|
||||||
?>
|
|
||||||
<script language="javascript" type="text/javascript">
|
|
||||||
|
|
||||||
$(document).ready (function () {
|
|
||||||
$("#loading").slideUp ();
|
|
||||||
$("#text-time").timeEntry ({spinnerImage: 'images/time-entry.png', spinnerSize: [20, 20, 0]});
|
|
||||||
$("#text-date").datepicker ();
|
|
||||||
$.datepicker.regional["<?php echo $config['language']; ?>"];
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$datetime = strtotime ($date.' '.$time);
|
|
||||||
$report["datetime"] = $datetime;
|
|
||||||
|
|
||||||
if ($datetime === false || $datetime == -1) {
|
|
||||||
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
?>
|
|
|
@ -610,10 +610,12 @@ function agent_autocomplete (id_agent_name, id_server_name, id_agent_id ) {
|
||||||
* @param name string with the name of the select for time
|
* @param name string with the name of the select for time
|
||||||
*/
|
*/
|
||||||
function period_select_events(name) {
|
function period_select_events(name) {
|
||||||
// If the text input is empty, we put on it 5 minutes by defaults
|
// If the text input is empty, we put on it 5 minutes by default
|
||||||
if($('#text-'+name+'_text').val() == '') {
|
if($('#text-'+name+'_text').val() == '') {
|
||||||
$('#text-'+name+'_text').val(300);
|
$('#text-'+name+'_text').val(300);
|
||||||
|
$('#'+name+'_select option:eq(1)').attr('selected', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjustTextUnits() {
|
function adjustTextUnits() {
|
||||||
var restPrev;
|
var restPrev;
|
||||||
var unitsSelected = false;
|
var unitsSelected = false;
|
||||||
|
|
|
@ -105,6 +105,10 @@ if ($view_graph) {
|
||||||
|
|
||||||
$url = "index.php?sec=reporting&sec2=operation/reporting/graph_viewer&id=$id_graph&view_graph=1";
|
$url = "index.php?sec=reporting&sec2=operation/reporting/graph_viewer&id=$id_graph&view_graph=1";
|
||||||
|
|
||||||
|
$options['setup'] = "<a href='index.php?sec=greporting&sec2=godmode/reporting/graph_builder&tab=graph_editor&edit_graph=1&id=$id_graph'>"
|
||||||
|
. html_print_image ("images/setup.png", true, array ("title" => __('Back to normal mode')))
|
||||||
|
. "</a>";
|
||||||
|
|
||||||
if ($config["pure"] == 0) {
|
if ($config["pure"] == 0) {
|
||||||
$options['screen'] = "<a href='$url&pure=1'>"
|
$options['screen'] = "<a href='$url&pure=1'>"
|
||||||
. html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode')))
|
. html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode')))
|
||||||
|
|
Loading…
Reference in New Issue