fixed errors in graph delete to image pdf

This commit is contained in:
daniel 2018-06-08 08:58:18 +02:00
parent 7834869977
commit eb7cdc7c90
12 changed files with 41 additions and 102 deletions

View File

@ -12,15 +12,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// XXX
/*
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
*/
// Global & session manageme
session_id($_GET["session_id"]);
session_start();
session_write_close();
require_once ('config.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');
@ -32,8 +28,9 @@ require_once ($config['homedir'] . '/include/functions_modules.php');
require_once ($config['homedir'] . '/include/functions_agents.php');
require_once ($config['homedir'] . '/include/functions_tags.php');
// XXX
//check_login();
check_login();
global $config;
/*
$params_json = base64_decode((string) get_parameter('params'));
@ -55,14 +52,14 @@ if ($config["metaconsole"] && !empty($server_id)) {
exit;
}
}
*/
$user_language = get_user_language($config['id_user']);
if (file_exists ('languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('languages/'.$user_language.'.mo'));
$l10n->load_tables();
}
*/
?>
<!DOCTYPE>
<html>
@ -95,12 +92,10 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<?php
$params = json_decode($_GET['data'], true);
//XXXXXX
$params['only_image'] = false;
$params['width'] = '1048';
$params['menu'] = false;
//cominadasssss
$params_combined = json_decode($_GET['data_combined'], true);
$module_list = json_decode($_GET['data_module_list'], true);
$type_graph_pdf = $_GET['type_graph_pdf'];

View File

@ -3147,7 +3147,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$url = $config["homeurl"] . "/include/chart_generator.php";
$img_file = "img_". uniqid() .".png";
$img_path = $config["homedir"] . "/attachment/" . $img_file;
$img_url = $config["homeurl"] . "/attachment/" . $img_file;
$img_url = $config["homeurl"] . "attachment/" . $img_file;
$width_img = 500;
$height_img = 450;
@ -3162,6 +3162,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$module_list = urlencode(json_encode($module_list));
}
$session_id = session_id();
$result = exec(
"phantomjs " . $file_js . " " .
$url . " '" .
@ -3171,7 +3173,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$module_list . "' " .
$img_path . " " .
$width_img . " " .
$height_img . " " .
$height_img . " '" .
$session_id . "' " .
$params['return_img_base_64']
);
@ -3179,7 +3182,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
return $result;
}
else{
$config["temp_images"][] = $img_url;
$config["temp_images"][] = $img_path;
return '<img src="' . $img_url . '" />';
}
}

View File

@ -240,7 +240,7 @@ function grafico_modulo_sparse_data_chart (
$data_module_graph['id_module_type'] == 10 ||
$data_module_graph['id_module_type'] == 33 ){
//XXXXXXXXXXX
//XXXXXXXXXXX SLICES
/*
"SELECT count(*) as data, min(utimestamp) as utimestamp
FROM tagente_datos_string
@ -865,7 +865,6 @@ function grafico_modulo_sparse ($params) {
$params['font'] = $config['fontpath'];
$params['font-size'] = $config['font_size'];
//XXXXXXXXXXXX se devuelve phantom.js
if($params['only_image']){
return generator_chart_to_pdf('sparse', $params);
}
@ -1151,7 +1150,7 @@ function graphic_combined_module (
$params,
$params_combined
) {
//XXX seteo todos los parametros
if(!isset($params_combined['from_interface'])){
$params_combined['from_interface'] = false;
}
@ -1216,7 +1215,6 @@ function graphic_combined_module (
}
//XXX seteo los parametros
if(!isset($params['period'])){
return false;
}
@ -1320,7 +1318,7 @@ function graphic_combined_module (
}
$params['graph_combined'] = true;
//XXXX
if($params['only_image']){
return generator_chart_to_pdf('combined', $params, $params_combined, $module_list);
}
@ -1436,7 +1434,7 @@ function graphic_combined_module (
);
}
//XXX no se que hacen
//XXX arreglar estas
$long_index = '';
$color = array();
@ -1765,7 +1763,6 @@ function graphic_combined_module (
}
}
//XXXX
$graph_values = $temp;
$width = 1024;
@ -1857,7 +1854,6 @@ function graphic_combined_module (
$i++;
}
//XXXX
$graph_values = $temp;
$width = 200;
@ -1926,7 +1922,6 @@ function graphic_combined_module (
}
}
//XXXX
$graph_values = $temp;
$width = 1024;
@ -2046,7 +2041,6 @@ function graphic_combined_module (
}
$i++;
//XXXX
$graph_values = $temp;
return stacked_thermometers(
@ -2129,7 +2123,6 @@ function graphic_combined_module (
$temp['total_modules'] = $total_modules;
//XXXX
$graph_values = $temp;
$width = 1024;
@ -2319,7 +2312,6 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
}
}
//XXXXX
if($config["fixed_graph"] == false){
$water_mark = array('file' =>
$config['homedir'] . "/images/logo_vertical_water.png",

View File

@ -2805,21 +2805,6 @@ function agents_get_network_interfaces_array(
$row_interface['status'] = $interface['status_image'];
$row_interface['chart'] = null;
//XXXX ancho y largo
// Get chart
/*
reporting_set_conf_charts($width, $height, $only_image,
$type, $content, $ttl);
if (!empty($force_width_chart)) {
$width = $force_width_chart;
}
if (!empty($force_height_chart)) {
$height = $force_height_chart;
}
*/
$width = null;
$height = null;
@ -3631,11 +3616,6 @@ function reporting_projection_graph($report, $content,
set_time_limit(500);
// Get chart
//reporting_set_conf_charts($width, $height, $only_image, $type,
// $content, $ttl);
//XXXX width y height
switch ($type) {
case 'dinamic':
case 'static':
@ -6505,7 +6485,7 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
'period' => $content['period'],
'title' => $label,
'avg_only' => $only_avg,
'pure' => false, //XXX
'pure' => false,
'date' => $report["datetime"],
'only_image' => $only_image,
'homeurl' => ui_get_full_url(false, false, false, false),

View File

@ -172,8 +172,7 @@ function vbar_graph(
$backgroundColor = 'white',
$from_ux = false,
$from_wux = false,
$tick_color = 'white'
) {
$tick_color = 'white') {
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
@ -224,13 +223,12 @@ function area_graph(
$agent_module_id, $array_data,
$legend, $series_type, $date_array,
$data_module_graph, $params, $water_mark,
$array_events_alerts
) {
$array_events_alerts) {
global $config;
include_once('functions_flot.php');
//setup_watermark($water_mark, $water_mark_file, $water_mark_url);
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
return flot_area_graph(
$agent_module_id,
@ -276,15 +274,15 @@ function stacked_thermometers($flash_chart, $chart_data, $width, $height,
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') {
include_once('functions_d3.php');
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
return d3_thermometers(
$chart_data,
$width,
@ -323,23 +321,6 @@ function stacked_gauge($chart_data, $width, $height,
);
}
function kiviat_graph($graph_type, $flash_chart, $chart_data, $width,
$height, $no_data_image, $ttl = 1, $homedir="") {
if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />';
}
$graph = array();
$graph['data'] = $chart_data;
$graph['width'] = $width;
$graph['height'] = $height;
$id_graph = serialize_in_temp($graph, null, $ttl);
return "<img src='".$homedir."include/graphs/functions_pchart.php?static_graph=1&graph_type=".$graph_type."&ttl=".$ttl."&id_graph=" . $id_graph . "' />";
}
function hbar_graph($flash_chart, $chart_data, $width, $height,
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',

View File

@ -859,9 +859,8 @@ function pandoraFlotArea(
graph_id, values, legend, agent_module_id,
series_type, water_mark, date_array,
data_module_graph, params,
force_integer,
background_color, legend_color, short_data,
events_array
force_integer, background_color,
legend_color, short_data, events_array
) {
//diferents vars
@ -2397,8 +2396,6 @@ function get_event_details (event_ids) {
return table;
}
//XXXXXXXXXX
//Ajusta la grafica pequenña con el desplazamiento del eje y
function adjust_left_width_canvas(adapter_id, adapted_id) {
var adapter_left_margin = $('#'+adapter_id+' .yAxis .tickLabel').width();
@ -2408,8 +2405,6 @@ function adjust_left_width_canvas(adapter_id, adapted_id) {
$('#'+adapted_id).css('margin-left', adapter_left_margin);
}
//XXXXXXXXXXX
//Ajusta el ancho de la grafica pequeña con respecto a la grande
function update_left_width_canvas(graph_id) {
$('#overview_'+graph_id).width($('#'+graph_id).width());

View File

@ -129,7 +129,6 @@ function flot_area_graph (
break;
}
///XXXXXXX los px caca
// Parent layer
$return = "<div class='parent_graph' style='width: " . ($params['width']) . ";" . $background_style . "'>";
// Set some containers to legend, graph, timestamp tooltip, etc.
@ -205,7 +204,7 @@ function flot_area_graph (
if($params['type'] == 'area_simple'){
$return .= "noresizevc ";
}
//XXXXXX height: ".$params['height']."px;'
$return .= "graph" .$params['adapt_key'] ."'
style=' width: ".$params['width']."px;
height: ".$params['height']."px;'></div>";
@ -257,7 +256,6 @@ function flot_area_graph (
$legend_color = "#A4A4A4";
}
//XXXX force_integer TODO
$force_integer = 0;
// Trick to get translated string from javascript

View File

@ -136,16 +136,17 @@ function setup_watermark($water_mark, &$water_mark_file, &$water_mark_url) {
if (!is_array($water_mark)) {
$water_mark_file = $water_mark;
$water_mark_url = '';
return;
}
if (isset($water_mark['file'])) {
$water_mark_file = $water_mark['file'];
}
else {
$water_mark_file = '';
}
if (isset($water_mark['url'])) {
$water_mark_url = $water_mark['url'];
}

View File

@ -1,6 +1,6 @@
var system = require('system');
if (system.args.length < 3 || system.args.length > 10) {
if (system.args.length < 3 || system.args.length > 11) {
phantom.exit(1);
}
@ -14,7 +14,9 @@ var url_module_list = system.args[5];
var output_filename = system.args[6];
var _width = system.args[7];
var _height = system.args[8];
var base_64 = system.args[9];
var session_id = system.args[9];
var base_64 = system.args[10];
if (!_width) {
_width = 750;
@ -28,11 +30,13 @@ if(type_graph_pdf == 'combined'){
finish_url = url + "?" + "data=" + url_params +
"&data_combined=" + url_params_comb +
"&data_module_list=" + url_module_list +
"&type_graph_pdf=" + type_graph_pdf;
"&type_graph_pdf=" + type_graph_pdf +
"&session_id=" + session_id;
}
else{
finish_url = url + "?" + "data=" + url_params +
"&type_graph_pdf=" + type_graph_pdf;
"&type_graph_pdf=" + type_graph_pdf +
"&session_id=" + session_id;
}
page.viewportSize = { width: _width, height: _height };

View File

@ -192,7 +192,6 @@ $interface_traffic_modules = array(
else
echo '<div style="margin-left: 50px; padding-top: 10px;">';
//XXXXXXX width and height
$height = 400;
$width = '90%';

View File

@ -154,13 +154,6 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$period = get_parameter ("period");
$id = get_parameter ("id", 0);
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*
$width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH);
$height = get_parameter ("height", STATWIN_DEFAULT_CHART_HEIGHT);
*/
$label = get_parameter ("label", "");
$label_graph = base64_decode(get_parameter ("label", ""));
$start_date = get_parameter ("start_date", date("Y/m/d"));

View File

@ -190,8 +190,6 @@ if ($view_graph) {
$options
);
//XXXX el width y height
$width = null;
$height = null;
$params =array(