mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed errors in graphs
This commit is contained in:
parent
73567f1859
commit
aa4f13d17a
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
// Global & session manageme
|
// Global & session manageme
|
||||||
session_id($_REQUEST["session_id"]);
|
session_id($_REQUEST["session_id"]);
|
||||||
if (file_exists(session_save_path() . "/pansess_" . session_id())) {
|
if (file_exists(session_save_path() . "/pansess_" . session_id()) ) {
|
||||||
$user = file_request_contents(session_save_path() . "/pansess_" . session_id());
|
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
|
||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
if (isset($user)) {
|
if (isset($user)) {
|
||||||
@ -24,6 +24,7 @@ if (isset($user)) {
|
|||||||
session_write_close();
|
session_write_close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once ('config.php');
|
require_once ('config.php');
|
||||||
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
||||||
require_once ($config['homedir'] . '/include/functions.php');
|
require_once ($config['homedir'] . '/include/functions.php');
|
||||||
@ -38,13 +39,15 @@ require_once ($config['homedir'] . '/include/functions_tags.php');
|
|||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
//get_parameter(array)('data', '');
|
||||||
|
|
||||||
$params = json_decode($_REQUEST['data'], true);
|
$params = json_decode($_REQUEST['data'], true);
|
||||||
|
|
||||||
// Metaconsole connection to the node
|
// Metaconsole connection to the node
|
||||||
$server_id = $params['server_id'];
|
$server_id = $params['server_id'];
|
||||||
|
|
||||||
if ($config["metaconsole"] && !empty($server_id)) {
|
if ($config["metaconsole"] && !empty($server_id)) {
|
||||||
$server = metaconsole_request_connection_by_id($server_id);
|
$server = metaconsole_get_connection_by_id($server_id);
|
||||||
// Error connecting
|
// Error connecting
|
||||||
if (metaconsole_connect($server) !== NOERR) {
|
if (metaconsole_connect($server) !== NOERR) {
|
||||||
echo "<html>";
|
echo "<html>";
|
||||||
@ -68,7 +71,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<title>Pandora FMS Graph (<?php echo agents_request_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
|
<title>Pandora FMS Graph (<?php echo agents_get_alias($agent_id) . ' - ' . $interface_name; ?>)</title>
|
||||||
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
<link rel="stylesheet" href="styles/pandora.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
<link rel="stylesheet" href="styles/pandora_minimal.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="styles/jquery-ui-1.10.0.custom.css" type="text/css" />
|
<link rel="stylesheet" href="styles/jquery-ui-1.10.0.custom.css" type="text/css" />
|
||||||
@ -94,12 +97,11 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$params['only_image'] = false;
|
||||||
$params['only_image'] = false;
|
|
||||||
$params['width'] = (int) $_REQUEST['viewport_width'];
|
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||||
$params['menu'] = false;
|
$params['menu'] = false;
|
||||||
|
|
||||||
if((!isset($params['width']) || ($params['width'] <= 0)) {
|
if((!isset($params['width']) || ($params['width'] <= 0))) {
|
||||||
$params['width'] = 1048;
|
$params['width'] = 1048;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,6 +109,9 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||||
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||||
|
|
||||||
|
$aux_font_size = $config['font_size'];
|
||||||
|
$config['font_size'] = $config['font_size'] + 3;
|
||||||
|
|
||||||
if($type_graph_pdf == 'combined'){
|
if($type_graph_pdf == 'combined'){
|
||||||
echo '<div>';
|
echo '<div>';
|
||||||
echo graphic_combined_module(
|
echo graphic_combined_module(
|
||||||
@ -121,6 +126,8 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
echo grafico_modulo_sparse($params);
|
echo grafico_modulo_sparse($params);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$config['font_size'] = $aux_font_size;
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
@ -3217,7 +3217,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$file_js = $config["homedir"] . "/include/web2image.js";
|
$file_js = $config["homedir"] . "/include/web2image.js";
|
||||||
$url = $config["homeurl"] . "/include/chart_generator.php";
|
$url = $config["homeurl"] . "include/chart_generator.php";
|
||||||
$img_file = "img_". uniqid() .".png";
|
$img_file = "img_". uniqid() .".png";
|
||||||
$img_path = $config["homedir"] . "/attachment/" . $img_file;
|
$img_path = $config["homedir"] . "/attachment/" . $img_file;
|
||||||
$img_url = $config["homeurl"] . "attachment/" . $img_file;
|
$img_url = $config["homeurl"] . "attachment/" . $img_file;
|
||||||
@ -3225,6 +3225,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||||||
$width_img = 500;
|
$width_img = 500;
|
||||||
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 350;
|
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 350;
|
||||||
|
|
||||||
|
$params['height'] = $height_img;
|
||||||
|
|
||||||
$params_encode_json = urlencode(json_encode($params));
|
$params_encode_json = urlencode(json_encode($params));
|
||||||
|
|
||||||
if($params_combined){
|
if($params_combined){
|
||||||
@ -3259,7 +3261,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||||||
else{
|
else{
|
||||||
// to be used in PDF files
|
// to be used in PDF files
|
||||||
$config["temp_images"][] = $img_path;
|
$config["temp_images"][] = $img_path;
|
||||||
return '<img style="width: 100%;height: ' . $height_img . '" src="' . $img_url . '" />';
|
return '<img src="' . $img_url . '" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,7 +1638,8 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||||||
font: {
|
font: {
|
||||||
size: font_size + 2,
|
size: font_size + 2,
|
||||||
color: legend_color,
|
color: legend_color,
|
||||||
family: font+'Font'
|
family: font+'Font',
|
||||||
|
variant: "small-caps"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
yaxes: [{
|
yaxes: [{
|
||||||
@ -1933,9 +1934,8 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||||||
$('#legend_' + graph_id).height());
|
$('#legend_' + graph_id).height());
|
||||||
|
|
||||||
$('#timestamp_'+graph_id).css('color', legend_color);
|
$('#timestamp_'+graph_id).css('color', legend_color);
|
||||||
$('#timestamp_'+graph_id).css('font-size', font_size + 2);
|
$('#timestamp_'+graph_id).css('font-size', font_size + 2+'px');
|
||||||
$('#timestamp_'+graph_id).css('font-family', font + 'Font');
|
$('#timestamp_'+graph_id).css('font-family', font + 'Font');
|
||||||
$('#timestamp_'+graph_id).css('color', legend_color);
|
|
||||||
|
|
||||||
if (timesize+timenewpos > canvaslimit) {
|
if (timesize+timenewpos > canvaslimit) {
|
||||||
$('#timestamp_'+graph_id).css('left', timenewpos - timesize);
|
$('#timestamp_'+graph_id).css('left', timenewpos - timesize);
|
||||||
@ -1998,6 +1998,8 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('color', legend_color);
|
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('color', legend_color);
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('font-size', font_size + 2 +'px');
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('font-family', font + 'Font');
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -2164,6 +2166,9 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||||||
.eq(i).html(label_aux);
|
.eq(i).html(label_aux);
|
||||||
}
|
}
|
||||||
$('#legend_' + graph_id + ' .legendLabel').css('color', legend_color);
|
$('#legend_' + graph_id + ' .legendLabel').css('color', legend_color);
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').css('font-size', font_size + 2 +'px');
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').css('font-family', font + 'Font');
|
||||||
|
|
||||||
plot.clearCrosshair();
|
plot.clearCrosshair();
|
||||||
if(!vconsole){
|
if(!vconsole){
|
||||||
overview.clearCrosshair();
|
overview.clearCrosshair();
|
||||||
|
@ -137,7 +137,7 @@ function flot_area_graph (
|
|||||||
$return = "<div class='parent_graph' style='width: " . ($params['width']) . ";" . $background_style . "'>";
|
$return = "<div class='parent_graph' style='width: " . ($params['width']) . ";" . $background_style . "'>";
|
||||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||||
if($params['show_legend']){
|
if($params['show_legend']){
|
||||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $params['font_size'] ."pt !important; color:" . $params['legend_color'] . " !important;'></p>";
|
$return .= "<p id='legend_$graph_id'></p>";
|
||||||
}
|
}
|
||||||
if(isset($params['graph_combined']) && $params['graph_combined'] &&
|
if(isset($params['graph_combined']) && $params['graph_combined'] &&
|
||||||
(!isset($params['from_interface']) || !$params['from_interface']) ){
|
(!isset($params['from_interface']) || !$params['from_interface']) ){
|
||||||
|
@ -31,20 +31,23 @@ if(type_graph_pdf == 'combined'){
|
|||||||
"&data_combined=" + url_params_comb +
|
"&data_combined=" + url_params_comb +
|
||||||
"&data_module_list=" + url_module_list +
|
"&data_module_list=" + url_module_list +
|
||||||
"&type_graph_pdf=" + type_graph_pdf +
|
"&type_graph_pdf=" + type_graph_pdf +
|
||||||
"&session_id=" + session_id +
|
"&session_id=" + session_id;
|
||||||
"&viewport_width=" + viewport_width;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
post_data = "data=" + url_params +
|
post_data = "data=" + url_params +
|
||||||
"&type_graph_pdf=" + type_graph_pdf +
|
"&type_graph_pdf=" + type_graph_pdf +
|
||||||
"&session_id=" + session_id +
|
"&session_id=" + session_id;
|
||||||
"&viewport_width=" + viewport_width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
page.viewportSize = { width: _width, height: _height };
|
page.viewportSize = {
|
||||||
//page.zoomFactor = 1.75;
|
width: viewport_width,
|
||||||
|
height: viewport_height
|
||||||
|
};
|
||||||
|
page.zoomFactor = 1;
|
||||||
|
|
||||||
page.open(post_data, 'POST', post_data, function start(status) {});
|
page.open(url, 'POST', post_data, function start(status) {
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
page.onLoadFinished = function (status) {
|
page.onLoadFinished = function (status) {
|
||||||
if(!base_64){
|
if(!base_64){
|
||||||
@ -52,6 +55,7 @@ page.onLoadFinished = function (status) {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var base64 = page.renderBase64('png');
|
var base64 = page.renderBase64('png');
|
||||||
|
//XXXX
|
||||||
console.log(base64);
|
console.log(base64);
|
||||||
}
|
}
|
||||||
phantom.exit();
|
phantom.exit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user