2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/graphs/functions_pchart.php, include/graphs/fgraph.php, include/functions_reporting.php, include/functions_visual_map.php, include/ajax/visual_console_builder.ajax.php, include/functions_api.php, operation/reporting/reporting_xml.php, mobile/operation/agents/view_agents.php, godmode/reporting/visual_console_builder.editor.js: changed the old sparse for the new engine graph sparse paint method. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4209 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f44299ffb9
commit
4bf3f498e7
|
@ -1,3 +1,16 @@
|
|||
2011-04-13 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_graph.php,
|
||||
include/graphs/functions_pchart.php,
|
||||
include/graphs/fgraph.php,
|
||||
include/functions_reporting.php,
|
||||
include/functions_visual_map.php,
|
||||
include/ajax/visual_console_builder.ajax.php, include/functions_api.php,
|
||||
operation/reporting/reporting_xml.php,
|
||||
mobile/operation/agents/view_agents.php,
|
||||
godmode/reporting/visual_console_builder.editor.js: changed the old sparse
|
||||
for the new engine graph sparse paint method.
|
||||
|
||||
2011-04-13 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/graphs/functions_pchart.php: Forgotted
|
||||
|
|
|
@ -607,8 +607,27 @@ function getModuleGraph(id_data) {
|
|||
period = data['period'];
|
||||
}
|
||||
});
|
||||
// Base64.encode function is in /include/javascript/encode_decode_base64.js
|
||||
var img = 'include/fgraph.php?tipo=sparse&id=' + id_agente_modulo + '&label=' + Base64.encode(label) + '&height=' + height + '&pure=1&width=' + width + '&period=' + period;
|
||||
|
||||
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
|
||||
parameter.push ({name: "action", value: "get_image_sparse"});
|
||||
parameter.push ({name: "id_agent_module", value: id_agente_modulo});
|
||||
parameter.push ({name: "height", value: height});
|
||||
parameter.push ({name: "width", value: width});
|
||||
parameter.push ({name: "period", value: period});
|
||||
jQuery.ajax({
|
||||
async: false,
|
||||
url: "ajax.php",
|
||||
data: parameter,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
success: function (data)
|
||||
{
|
||||
img = data;
|
||||
}
|
||||
});
|
||||
|
||||
// var img = 'include/fgraph.php?tipo=sparse&id=' + id_agente_modulo +
|
||||
// '&label=' + Base64.encode(label) + '&height=' + height + '&pure=1&width=' + width + '&period=' + period;
|
||||
|
||||
return img;
|
||||
}
|
||||
|
|
|
@ -51,11 +51,22 @@ $width_percentile = get_parameter('width_percentile', null);
|
|||
$max_percentile = get_parameter('max_percentile', null);
|
||||
$height_module_graph = get_parameter('height_module_graph', null);
|
||||
$width_module_graph = get_parameter('width_module_graph', null);
|
||||
$id_agent_module = get_parameter('id_agent_module', 0);
|
||||
|
||||
$get_element_status = get_parameter('get_element_status', 0);
|
||||
$get_image_path_status = get_parameter('get_image_path_status', 0);
|
||||
|
||||
switch ($action) {
|
||||
case 'get_image_sparse':
|
||||
$img = grafico_modulo_sparse2($id_agent_module,
|
||||
$period, false, $width, $height, '', null, false, 0, false, 0, 0, 0,
|
||||
true, true);
|
||||
|
||||
preg_match("/src='(.*)'/", $img, $matches);
|
||||
$url = $matches[1];
|
||||
|
||||
echo $url;
|
||||
break;
|
||||
case 'get_layout_data':
|
||||
$layoutData = get_db_row_filter('tlayout_data', array('id' => $id_element));
|
||||
|
||||
|
|
|
@ -784,42 +784,6 @@ function get_module_data($id, $thrash1, $other, $returnType) {
|
|||
returnData('csv', $data, $separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a image file of sparse graph of module data in a period time.
|
||||
*
|
||||
* @param integer $id id of a module data.
|
||||
* @param $thrash1 Don't use.
|
||||
* @param array $other it's array, $other as param is <period>;<width>;<height>;<label>;<start_date>; in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
* api.php?op=get&op2=graph_module_data&id=17&other=604800|555|245|pepito|2009-12-07&other_mode=url_encode_separator_|
|
||||
*
|
||||
* @param $thrash2 Don't use.
|
||||
*/
|
||||
function get_graph_module_data($id, $thrash1, $other, $thrash2) {
|
||||
|
||||
$period = $other['data'][0];
|
||||
$width = $other['data'][1];
|
||||
$height = $other['data'][2];
|
||||
$graph_type = 'sparse';
|
||||
$draw_alerts = 0;
|
||||
$draw_events = 0;
|
||||
$zoom = 1;
|
||||
$label = $other['data'][3];
|
||||
$avg_only = 0;
|
||||
$start_date = $other['data'][4];
|
||||
$date = strtotime($start_date);
|
||||
|
||||
$image = "fgraph.php?tipo=" . $graph_type .
|
||||
"&draw_alerts=" . $draw_alerts . "&draw_events=" . $draw_events .
|
||||
"&id=" . $id . "&zoom=" . $zoom . "&label=" . $label .
|
||||
"&height=" . $height . "&width=" . $width . "&period=" . $period .
|
||||
"&avg_only=" . $avg_only . "&date=" . $date;
|
||||
|
||||
header('Location: ' . $image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new user.
|
||||
*
|
||||
|
|
|
@ -23,9 +23,9 @@ define("GRAPH_LINE", 2);
|
|||
define("GRAPH_STACKED_LINE", 3);
|
||||
|
||||
function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
|
||||
$width, $height , $title, $unit_name,
|
||||
$show_alerts, $avg_only = 0, $pure = false,
|
||||
$date = 0, $baseline = 0, $return_data = 0, $show_title = true) {
|
||||
$width, $height , $title = '', $unit_name = null,
|
||||
$show_alerts = false, $avg_only = 0, $pure = false,
|
||||
$date = 0, $baseline = 0, $return_data = 0, $show_title = true, $only_image = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -290,7 +290,12 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
|
|||
$legend['min'] = __('Min') . ' (' . $min_value . ')';
|
||||
$legend['baseline'] = __('Baseline');
|
||||
|
||||
return area_graph($config['flash_charts'], $chart, $width, $height, $color,$legend, $long_index, "images/image_problem.opaque.png");
|
||||
$flash_chart = $config['flash_charts'];
|
||||
if ($only_image) {
|
||||
$flash_chart = false;
|
||||
}
|
||||
|
||||
return area_graph($flash_chart, $chart, $width, $height, $color,$legend, $long_index, "images/image_problem.opaque.png");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -311,7 +316,7 @@ function grafico_modulo_sparse2 ($agent_module_id, $period, $show_events,
|
|||
* @return Mixed
|
||||
*/
|
||||
function graphic_combined_module2 ($module_list, $weight_list, $period, $width, $height,
|
||||
$title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0) {
|
||||
$title, $unit_name, $show_events = 0, $show_alerts = 0, $pure = 0, $stacked = 0, $date = 0, $only_image = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -606,26 +611,32 @@ function graphic_combined_module2 ($module_list, $weight_list, $period, $width,
|
|||
$time_format = 'M j';
|
||||
}
|
||||
|
||||
$flash_charts = $config['flash_charts'];
|
||||
|
||||
if ($only_image) {
|
||||
$flash_charts = false;
|
||||
}
|
||||
|
||||
switch ($stacked) {
|
||||
case GRAPH_AREA:
|
||||
$color = null;
|
||||
return area_graph($config['flash_charts'], $graph_values, $width, $height,
|
||||
return area_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
|
||||
break;
|
||||
default:
|
||||
case GRAPH_STACKED_AREA:
|
||||
$color = null;
|
||||
return stacked_area_graph($config['flash_charts'], $graph_values, $width, $height,
|
||||
return stacked_area_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
|
||||
break;
|
||||
case GRAPH_LINE:
|
||||
$color = null;
|
||||
return line_graph($config['flash_charts'], $graph_values, $width, $height,
|
||||
return line_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
|
||||
break;
|
||||
case GRAPH_STACKED_LINE:
|
||||
$color = null;
|
||||
return stacked_line_graph($config['flash_charts'], $graph_values, $width, $height,
|
||||
return stacked_line_graph($flash_charts, $graph_values, $width, $height,
|
||||
$color, $module_name_list, $long_index, "images/image_problem.opaque.png");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ require_once ($config["homedir"]."/include/functions.php");
|
|||
require_once ($config["homedir"]."/include/functions_db.php");
|
||||
require_once ($config["homedir"]."/include/functions_agents.php");
|
||||
include_once ($config["homedir"]."/include/fgraph.php");
|
||||
include_once ($config["homedir"]."/include/functions_graph.php");
|
||||
require_once ('functions_graph.php');
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1898,7 +1898,11 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
}
|
||||
|
||||
$data = array ();
|
||||
$data[0] = '<img src="include/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&avg_only=1&pure=1" border="0" alt="">';
|
||||
|
||||
$data[0] = grafico_modulo_sparse2($layout_data['id_agente_modulo'], $content['period'],
|
||||
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
|
||||
$report["datetime"], 0, 0, true, true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
|
||||
break;
|
||||
|
@ -1921,7 +1925,9 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
}
|
||||
|
||||
$data = array ();
|
||||
$data[0] = '<img src="include/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.($report["datetime"] + $content['period']).'&avg_only=1&baseline=1&pure=1" border="0" alt="">';
|
||||
$data[0] = grafico_modulo_sparse2($layout_data['id_agente_modulo'], $content['period'],
|
||||
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
|
||||
$report["datetime"], true, 0, true, true);
|
||||
array_push ($table->data, $data);
|
||||
|
||||
break;
|
||||
|
@ -2118,7 +2124,10 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
|
|||
$data[0] = printSmallFont(get_agentmodule_agent_name ($sla['id_agent_module']));
|
||||
$data[0] .= "<br>";
|
||||
$data[0] .= printSmallFont(get_agentmodule_name ($sla['id_agent_module']));
|
||||
$data[1] = graph_sla_slicebar($sla['id_agent_module'], $content['period'], $sla['sla_min'], $sla['sla_max'], $daysWeek, $content['time_from'], $content['time_to'], $sla['sla_limit'], 550, 25);
|
||||
$data[1] = "<img src='include/fgraph.php?tipo=sla_horizontal_graph&id=".$sla['id_agent_module'].
|
||||
"&period=".$content['period']."&value1=".$sla['sla_min']."&value2=".$sla['sla_max'].
|
||||
"&value3=".$content['time_from']."&value4=".$content['time_to']."&percent=".$sla['sla_limit'].
|
||||
"&daysWeek=".$daysWeek."&height=25&width=550'>";
|
||||
array_push ($table2->data, $data);
|
||||
}
|
||||
$table->colspan[4][0] = 3;
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
* @subpackage Reporting
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once ('functions_graph.php');
|
||||
|
||||
function printButtonEditorVisualConsole($idDiv, $label, $float = 'left', $disabled = false, $class= '', $imageButton = false) {
|
||||
if ($float == 'left') {
|
||||
$margin = 'margin-right';
|
||||
|
@ -49,6 +53,8 @@ function printButtonEditorVisualConsole($idDiv, $label, $float = 'left', $disabl
|
|||
}
|
||||
|
||||
function printItemInVisualConsole($layoutData) {
|
||||
global $config;
|
||||
|
||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
$width = $layoutData['width'];
|
||||
|
@ -109,7 +115,9 @@ function printItemInVisualConsole($layoutData) {
|
|||
|
||||
break;
|
||||
case MODULE_GRAPH:
|
||||
$img = '<img class="image" id="image_' . $id . '" src="include/fgraph.php?tipo=sparse&id=' . $id_module . '&label=' . base64_encode ($label) . '&height=' . $height . '&pure=1&width=' . $width . '&period=' . $period . ' " style="border:1px solid #808080;" />';
|
||||
$img = grafico_modulo_sparse2($id_module, $period, 0, $width,
|
||||
$height, '', null, false, 0, false, 0, 0, 0, true, true);
|
||||
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
|
||||
|
||||
echo '<div id="' . $id . '" class="item module_graph" style="left: 0px; top: 0px; color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
||||
echo $text . '<br />';
|
||||
|
@ -385,6 +393,7 @@ function getStatusElement($layoutData) {
|
|||
*/
|
||||
function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = true, $width = null, $height = null) {
|
||||
global $config;
|
||||
|
||||
$layout = get_db_row ('tlayout', 'id', $id_layout);
|
||||
|
||||
$resizedMap = false;
|
||||
|
@ -771,14 +780,20 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
|
|||
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layout_data['id_layout_linked'].'">';
|
||||
}
|
||||
}
|
||||
if ($resizedMap)
|
||||
if ($resizedMap) {
|
||||
|
||||
// ATTENTION: DO NOT USE & here because is bad-translated and doesnt work
|
||||
// resulting fault image links :(
|
||||
|
||||
print_image ("include/fgraph.php?tipo=sparse&id=".$layout_data['id_agente_modulo']."&label=". base64_encode ($layout_data['label'])."&height=".((integer)($proportion * $layout_data['height']))."&pure=1&width=".((integer)($proportion * $layout_data['width']))."&period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0, "style" => "border:1px solid #808080;"));
|
||||
else
|
||||
print_image ("include/fgraph.php?tipo=sparse&id=".$layout_data['id_agente_modulo']."&label=". base64_encode ($layout_data['label'])."&height=".$layout_data['height']."&pure=1&width=".$layout_data['width']."&period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0, "style" => "border:1px solid #808080;"));
|
||||
echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'],
|
||||
false, ((integer)($proportion * $layout_data['width'])), ((integer)($proportion * $layout_data['height'])),
|
||||
'', null, false, 0, false, 0, 0, 0, true, true);
|
||||
}
|
||||
else {
|
||||
echo grafico_modulo_sparse2 ($layout_data['id_agente_modulo'], $layout_data['period'],
|
||||
false, $layout_data['width'], $layout_data['height'],
|
||||
'', null, false, 0, false, 0, 0, 0, true, true);
|
||||
}
|
||||
echo "</a>";
|
||||
echo "</div>";
|
||||
break;
|
||||
|
|
|
@ -25,6 +25,9 @@ else if(file_exists('../functions.php')) {
|
|||
include_once('functions_utils.php');
|
||||
}
|
||||
|
||||
include_once('functions_fsgraph.php');
|
||||
include_once('functions_utils.php');
|
||||
|
||||
$graph_type = get_parameter('graph_type', '');
|
||||
|
||||
switch($graph_type) {
|
||||
|
|
|
@ -592,10 +592,12 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height, $rgb_c
|
|||
|
||||
if (isset($size['Height'])) {
|
||||
/* Define the chart area */
|
||||
//$myPicture->setGraphArea(40,$size['Height'],$width,$height - 90);
|
||||
$myPicture->setGraphArea(40,$size['Height'],$width,$height - $margin_bottom);
|
||||
}
|
||||
else {
|
||||
/* Define the chart area */
|
||||
//$myPicture->setGraphArea(40, 5,$width,$height - 90);
|
||||
$myPicture->setGraphArea(40, 5,$width,$height - $margin_bottom);
|
||||
}
|
||||
|
||||
|
|
|
@ -404,16 +404,13 @@ class viewGraph {
|
|||
return;
|
||||
}
|
||||
|
||||
$image = "../include/fgraph.php?tipo=sparse_mobile&draw_alerts=1&draw_events=1" .
|
||||
'&id=' . $this->idAgentModule . "&zoom=1&label=".safe_output($this->agentModule['nombre']) .
|
||||
"&height=120&width=240&period=" . $this->period . "&avg_only=0";
|
||||
|
||||
$image .= "&date=" . get_system_time ();
|
||||
|
||||
echo "<h3 class='title_h3'><a href='index.php?page=agent&id=" . $this->agentModule['id_agente'] . "'>" . get_agentmodule_agent_name($this->idAgentModule)."</a> / ".safe_output($this->agentModule['nombre']) . "</h3>";
|
||||
|
||||
echo "<h3 class='title_h3'>" . __('Graph') . "</h3>";
|
||||
print_image ($image, false, array ("border" => 0));
|
||||
|
||||
echo grafico_modulo_sparse2($this->idAgentModule, $this->period, 0, 240,
|
||||
120, safe_output($this->agentModule['nombre']), null, true,
|
||||
0, true, 0, true, true, true, true);
|
||||
|
||||
echo "<h3 class='title_h3'>" . __('Data') . "</h3>";
|
||||
|
||||
|
|
|
@ -187,11 +187,28 @@ foreach ($contents as $content) {
|
|||
case 1:
|
||||
case 'simple_graph':
|
||||
$data["title"] = __('Simple graph');
|
||||
$data["objdata"]["img"] = 'include/fgraph.php?PHPSESSID='.$session_id.'&tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=720&period='.$content['period'].'&date='.$datetime.'&avg_only=1&pure=1';
|
||||
|
||||
$img = grafico_modulo_sparse2($content['id_agent_module'],
|
||||
$content['period'], 0, 720,
|
||||
230, '', null, false, true, false, $datetime, 0, 0, true, true);
|
||||
|
||||
preg_match("/src='(.*)'/", $img, $matches);
|
||||
$url = $matches[1];
|
||||
|
||||
$data["objdata"]["img"] = $url;
|
||||
|
||||
break;
|
||||
case 'simple_baseline_graph':
|
||||
$data["title"] = __('Simple baseline graph');
|
||||
$data["objdata"]["img"] = 'include/fgraph.php?PHPSESSID='.$session_id.'&tipo=sparse&id='.$content['id_agent_module'].'&height=230&width=720&period='.$content['period'].'&date='.($datetime + $content['period']).'&avg_only=1&baseline=1&pure=1';
|
||||
|
||||
$img = grafico_modulo_sparse2($content['id_agent_module'],
|
||||
$content['period'], 0, 720,
|
||||
230, '', null, false, true, false, ($datetime + $content['period']), true, 0, true, true);
|
||||
|
||||
preg_match("/src='(.*)'/", $img, $matches);
|
||||
$url = $matches[1];
|
||||
|
||||
$data["objdata"]["img"] = $url;
|
||||
break;
|
||||
case 2:
|
||||
case 'custom_graph':
|
||||
|
|
Loading…
Reference in New Issue