fixed errors in visual console

This commit is contained in:
daniel 2018-11-29 13:24:12 +01:00
parent 4b1649d5f8
commit 9bdd1af488
5 changed files with 99 additions and 133 deletions

View File

@ -220,7 +220,6 @@ function update_button_palette_callback() {
// TODO VALIDATE DATA // TODO VALIDATE DATA
switch (selectedItem) { switch (selectedItem) {
case 'background': case 'background':
if(values['width'] < 1024 || values['height'] < 768){ if(values['width'] < 1024 || values['height'] < 768){
alert('Min allowed size is 1024x768'); alert('Min allowed size is 1024x768');
return false; return false;
@ -235,7 +234,6 @@ function update_button_palette_callback() {
$("#background").css('width', values['width']); $("#background").css('width', values['width']);
$("#background").css('height', values['height']); $("#background").css('height', values['height']);
//$("#background").css('background', 'url(images/console/background/' + values['background'] + ')');
var image = values['background']; var image = values['background'];
$("#background_img").attr('src', "images/spinner.gif"); $("#background_img").attr('src', "images/spinner.gif");
set_image("background", null, image); set_image("background", null, image);
@ -243,7 +241,6 @@ function update_button_palette_callback() {
idElement = 0; idElement = 0;
break; break;
case 'box_item': case 'box_item':
if($('input[name=width_box]').val() == ''){ if($('input[name=width_box]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
@ -275,39 +272,29 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){ if(values['show_statistics'] == 1){
if (!$('#image_'+idItem).length) { if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){ if(values['label_position'] == 'left'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;'); .attr('style','float:right;');
} }
else if(values['label_position'] == 'right'){ else if(values['label_position'] == 'right'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;'); .attr('style','float:left;');
} }
else{ else{
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png"); .attr('src', 'images/console/icons/'+values["image"]+".png");
} }
$('#'+idItem).append($image); $('#'+idItem).append($image);
} }
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
@ -318,7 +305,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px'); $("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px'); $("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -329,46 +315,33 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
} }
else{ else{
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){ if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) { if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){ if(values['label_position'] == 'left'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;'); .attr('style','float:right;');
} }
else if(values['label_position'] == 'right'){ else if(values['label_position'] == 'right'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;'); .attr('style','float:left;');
} }
else{ else{
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png"); .attr('src', 'images/console/icons/'+values["image"]+".png");
} }
$('#'+idItem).append($image); $('#'+idItem).append($image);
} }
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
@ -382,15 +355,11 @@ function update_button_palette_callback() {
else{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
} }
} }
else{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -401,7 +370,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove(); $("#image_" + idItem).remove();
} }
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -411,14 +379,9 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
} }
break; break;
case 'static_graph': case 'static_graph':
if($('input[name=width]').val() == ''){ if($('input[name=width]').val() == ''){
alert('Undefined width'); alert('Undefined width');
return false; return false;
@ -435,8 +398,6 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
if(values['show_statistics'] == 1){ if(values['show_statistics'] == 1){
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
@ -445,7 +406,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', '520px'); $("#image_" + idItem).css('width', '520px');
$("#image_" + idItem).css('height', '80px'); $("#image_" + idItem).css('height', '80px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -456,49 +416,34 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
$("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png');
} }
} }
else{ else{
if ((values['width'] == 0) || (values['height'] == 0)) { if ((values['width'] == 0) || (values['height'] == 0)) {
if(values['image'] != '' && values['image'] != 'none'){ if(values['image'] != '' && values['image'] != 'none'){
if (!$('#image_'+idItem).length) { if (!$('#image_'+idItem).length) {
if(values['label_position'] == 'left'){ if(values['label_position'] == 'left'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:right;'); .attr('style','float:right;');
} }
else if(values['label_position'] == 'right'){ else if(values['label_position'] == 'right'){
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png") .attr('src', 'images/console/icons/'+values["image"]+".png")
.attr('style','float:left;'); .attr('style','float:left;');
} }
else{ else{
var $image = $('<img></img>') var $image = $('<img></img>')
.attr('id', 'image_' + idItem) .attr('id', 'image_' + idItem)
.attr('class', 'image') .attr('class', 'image')
.attr('src', 'images/console/icons/'+values["image"]+".png"); .attr('src', 'images/console/icons/'+values["image"]+".png");
} }
$('#'+idItem).append($image); $('#'+idItem).append($image);
} }
if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
@ -510,15 +455,11 @@ function update_button_palette_callback() {
else{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
$("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).removeAttr('height');
$("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight);
$("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px');
$("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px');
} }
} }
else{ else{
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -529,7 +470,6 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('height', '70px'); $("#image_" + idItem).css('height', '70px');
$("#image_" + idItem).remove(); $("#image_" + idItem).remove();
} }
} }
else { else {
$("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('width');
@ -539,9 +479,7 @@ function update_button_palette_callback() {
$("#image_" + idItem).css('width', values['width'] + 'px'); $("#image_" + idItem).css('width', values['width'] + 'px');
$("#image_" + idItem).css('height', values['height'] + 'px'); $("#image_" + idItem).css('height', values['height'] + 'px');
} }
} }
break; break;
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
@ -549,6 +487,7 @@ function update_button_palette_callback() {
alert('Undefined width'); alert('Undefined width');
return false; return false;
} }
if($('input[name=height_percentile]').val() == ''){ if($('input[name=height_percentile]').val() == ''){
alert('Undefined height'); alert('Undefined height');
return false; return false;
@ -556,6 +495,7 @@ function update_button_palette_callback() {
$("#text_" + idItem).html(values['label']); $("#text_" + idItem).html(values['label']);
$("#image_" + idItem).attr("src", "images/spinner.gif"); $("#image_" + idItem).attr("src", "images/spinner.gif");
if (values['type_percentile'] == 'bubble') { if (values['type_percentile'] == 'bubble') {
setPercentileBubble(idItem, values); setPercentileBubble(idItem, values);
} }
@ -2479,7 +2419,6 @@ function setPercentileCircular (id_data, values) {
width_percentile = values['width_percentile']; width_percentile = values['width_percentile'];
var parameter = Array(); var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
parameter.push ({name: "action", value: "get_module_value"}); parameter.push ({name: "action", value: "get_module_value"});
parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_element", value: id_data});
@ -3835,14 +3774,12 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'clock': case 'clock':
case 'auto_sla_graph': case 'auto_sla_graph':
case 'donut_graph': case 'donut_graph':
if ((typeof(values['absolute_left']) != 'undefined') &&
if ((typeof(values['mov_left']) != 'undefined') && (typeof(values['absolute_top']) != 'undefined')) {
(typeof(values['mov_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('top', top + 'px'); $("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px'); $("#" + idElement).css('left', '0px').css('left', left + 'px');
} }
else if ((typeof(values['absolute_left']) != 'undefined') && else{
(typeof(values['absolute_top']) != 'undefined')) {
$("#" + idElement).css('top', '0px').css('top', top + 'px'); $("#" + idElement).css('top', '0px').css('top', top + 'px');
$("#" + idElement).css('left', '0px').css('left', left + 'px'); $("#" + idElement).css('left', '0px').css('left', left + 'px');
} }
@ -3952,7 +3889,6 @@ function updateDB(type, idElement , values, event) {
parameter.push({name: key, value: val}); parameter.push({name: key, value: val});
}); });
switch (type) { switch (type) {
// -- line_item -- // -- line_item --
case 'handler_start': case 'handler_start':

View File

@ -3282,13 +3282,10 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
$data = array (); $data = array ();
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph $interval = 24;
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
$interval = (int) ($period / $resolution);
$date = get_system_time(); $date = get_system_time();
$datelimit = $date - $period; $datelimit = $date - $period;
$periodtime = floor ($period / $interval); $periodtime = floor ($period / $interval);
$time = array ();
$data = array (); $data = array ();
$legend = array(); $legend = array();
$full_legend = array(); $full_legend = array();

View File

@ -218,11 +218,11 @@ function reporting_make_reporting_data($report = null, $id_report,
} }
} }
if(sizeof($content['id_agent']) != 1){ if(is_array($content['id_agent']) && sizeof($content['id_agent']) != 1){
$content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']); $content['style']['name_label'] = str_replace("_agent_",sizeof($content['id_agent']).__(' agents'),$content['style']['name_label']);
} }
if(sizeof($content['id_agent_module']) != 1){ if(is_array($content['id_agent_module']) && sizeof($content['id_agent_module']) != 1){
$content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']); $content['style']['name_label'] = str_replace("_module_",sizeof($content['id_agent_module']).__(' modules'),$content['style']['name_label']);
} }
@ -6063,6 +6063,7 @@ function reporting_general($report, $content) {
$i = 0; $i = 0;
$index = 0; $index = 0;
$is_string = array(); $is_string = array();
foreach ($generals as $row) { foreach ($generals as $row) {
//Metaconsole connection //Metaconsole connection
$server_name = $row ['server_name']; $server_name = $row ['server_name'];

View File

@ -1205,7 +1205,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
400, 400, $color, array(), array(), 400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
} }
@ -1213,7 +1213,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
400, 400, $color, array(), array(), 400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
} }
@ -1223,7 +1223,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
400, 400, $color, array(), array(), 400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
} }
@ -1231,7 +1231,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
400, 400, $color, array(), array(), 400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
} }
@ -1240,14 +1240,14 @@ function visual_map_print_item($mode = "read", $layoutData,
if ($layoutData['type_graph'] == 'horizontal') { if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph($module_data, $img = hbar_graph($module_data,
400, 400, $color, array(), array(), 400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
} }
else { else {
$img = vbar_graph($module_data, $img = vbar_graph($module_data,
400, 400, $color, array(), array(), 400, 400, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
} }
@ -1259,7 +1259,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
$width, $height, $color, array(), array(), $width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
} }
@ -1267,7 +1267,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:right;height:'.$himg.'px;">'. $img = '<div style="float:right;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
$width, $height, $color, array(), array(), $width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
} }
@ -1277,7 +1277,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
hbar_graph($module_data, hbar_graph($module_data,
$width, $height, $color, array(), array(), $width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']) . '</div>';
} }
@ -1285,7 +1285,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<div style="float:left;height:'.$himg.'px;">'. $img = '<div style="float:left;height:'.$himg.'px;">'.
vbar_graph($module_data, vbar_graph($module_data,
$width, $height, $color, array(), array(), $width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>'; "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']) . '</div>';
} }
@ -1294,14 +1294,14 @@ function visual_map_print_item($mode = "read", $layoutData,
if ($layoutData['type_graph'] == 'horizontal') { if ($layoutData['type_graph'] == 'horizontal') {
$img = hbar_graph($module_data, $img = hbar_graph($module_data,
$width, $height, $color, array(), array(), $width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
} }
else { else {
$img = vbar_graph($module_data, $img = vbar_graph($module_data,
$width, $height, $color, array(), array(), $width, $height, $color, array(), array(),
ui_get_full_url("images/image_problem.opaque.png", false, false, false), ui_get_full_url("images/image_problem_area.png", false, false, false),
"", "", $water_mark, $config['fontpath'], 6, "", "", $water_mark, $config['fontpath'], 6,
"", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']); "", 0, $config['homeurl'], $layoutData['image'], true, false, $layoutData['border_color']);
} }
@ -2284,9 +2284,7 @@ function visual_map_print_item($mode = "read", $layoutData,
array('id' => $layoutData['parent_item'])); array('id' => $layoutData['parent_item']));
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
echo '$(document).ready (function() { echo 'lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});';
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});
});';
echo '</script>'; echo '</script>';
} }
} }
@ -2306,19 +2304,35 @@ function get_if_module_is_image ($id_module) {
} }
function get_bars_module_data ($id_module) { function get_bars_module_data ($id_module) {
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module)); //This charts is only serialize graphs.
//In other string show image no data to show.
$mod_values = db_get_value_filter(
'datos',
'tagente_estado',
array(
'id_agente_modulo' => $id_module
)
);
$values = false;
//avoid showing the image type modules. WUX
if(strpos($mod_values, 'data:image/png;base64') !== 0){
if (preg_match("/\r\n/", $mod_values)) { if (preg_match("/\r\n/", $mod_values)) {
$values = explode("\r\n", $mod_values); $values = explode("\r\n", $mod_values);
} }
elseif (preg_match("/\n/", $mod_values)) { elseif (preg_match("/\n/", $mod_values)) {
$values = explode("\n", $mod_values); $values = explode("\n", $mod_values);
} }
}
$values_to_return = array(); $values_to_return = array();
$index = 0; $index = 0;
$color_index = 0; $color_index = 0;
$total = 0; $total = 0;
if(!$values) return false;
foreach ($values as $val) { foreach ($values as $val) {
$data = explode(",", $val); $data = explode(",", $val);
$values_to_return[$data[0]] = array('g' =>$data[1]); $values_to_return[$data[0]] = array('g' =>$data[1]);
@ -3323,9 +3337,7 @@ function visual_map_print_user_lines($layout_data, $proportion = null) {
} }
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
echo '$(document).ready (function() { echo 'user_lines.push(' . json_encode($line) . ');';
user_lines.push(' . json_encode($line) . ');
});';
echo '</script>'; echo '</script>';
} }

View File

@ -141,7 +141,17 @@ function vbar_graph(
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />'; return html_print_image (
$no_data_image,
true,
array(
'width' => $width,
'height' => $height,
'title' => __('No data to show')
),
false,
true
);
} }
if($ttl == 2){ if($ttl == 2){
@ -271,7 +281,17 @@ function hbar_graph($chart_data, $width, $height,
setup_watermark($water_mark, $water_mark_file, $water_mark_url); setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) { if (empty($chart_data)) {
return '<img src="' . $no_data_image . '" />'; return html_print_image (
$no_data_image,
true,
array(
'width' => $width,
'height' => $height,
'title' => __('No data to show')
),
false,
true
);
} }
if($ttl == 2){ if($ttl == 2){