Fixed style of visual mapwidget in dashboards. Gitlab: #374

This commit is contained in:
m-lopez-f 2017-03-03 12:50:03 +01:00
parent a1667fd129
commit b8f6b9fad4
3 changed files with 155 additions and 256 deletions

View File

@ -124,105 +124,83 @@ function visual_map_print_item($mode = "read", $layoutData,
$text = '<span id="text_' . $id . '" class="text">' . $label .'</span>';
if($height == 0){
switch($type){
case 0:
case 11:
$tableheight0 = '70';
break;
case 3:
$tableheight0 = '30';
break;
case 9:
$tableheight0 = '130';
break;
case 1:
$tableheight0 = '180';
break;
case SERVICE:
$tableheight0 = '50';
break;
if ($height == 0) {
switch($type) {
case 0:
case 11:
$tableheight0 = '70';
break;
case 3:
$tableheight0 = '30';
break;
case 9:
$tableheight0 = '130';
break;
case 1:
$tableheight0 = '180';
break;
case SERVICE:
$tableheight0 = '50';
break;
}
}
else {
$tableheight0 = $height;
}
}
else{
$tableheight0 = $height;
}
if ($layoutData['width'] == 0 || $layoutData['height'] == 0){
switch($type){
case 0:
case 11:
$himg = '70';
$wimg ='70';
break;
case 3:
if(get_parameter('action') == 'edit'){
$himg = '30';
$wimg = '150';
}
else{
$himg = '15';
$wimg = '150';
}
break;
case 9:
$himg = '130';
$wimg = '130';
break;
case 1:
$himg = '180';
$wimg = '300';
break;
case SERVICE:
$himg = '50';
$wimg = '150';
break;
}
}
else{
$wimg = $layoutData['width'];
$himg = $layoutData['height'];
if($type == 3){
if(get_parameter('action') == 'edit'){
$himg = '30';
}
else{
$himg = '15';
if ($layoutData['width'] == 0 || $layoutData['height'] == 0) {
switch($type) {
case 0:
case 11:
$himg = '70';
$wimg ='70';
break;
case 3:
if (get_parameter('action') == 'edit') {
$himg = '30';
$wimg = '150';
}
else{
$himg = '15';
$wimg = '150';
}
break;
case 9:
$himg = '130';
$wimg = '130';
break;
case 1:
$himg = '180';
$wimg = '300';
break;
case SERVICE:
$himg = '50';
$wimg = '150';
break;
}
}
if($type == 9){
$himg = $wimg;
else {
$wimg = $layoutData['width'];
$himg = $layoutData['height'];
if ($type == 3) {
if(get_parameter('action') == 'edit')
$himg = '30';
else
$himg = '15';
}
if ($type == 9) {
$himg = $wimg;
}
}
}
if($label_position == 'left'){
if ($label_position == 'left') {
$text = '<table style="float:left;height:'.$himg.'px;"><tr><td></td></tr><tr><td><span id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
}
else if($label_position == 'right'){
elseif ($label_position == 'right') {
$text = '<table style="float:right;height:'.$himg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
}
else{
else {
$text = '<table style="width:'.$wimg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
}
@ -276,9 +254,7 @@ else{
case GROUP_ITEM:
if ($layoutData['enable_link']
&& can_user_access_node()) {
$link = true;
}
break;
case LABEL:
@ -1013,10 +989,11 @@ else{
false, $type_graph) . '</div>';
}
else {
$img = grafico_modulo_sparse($id_module, $period, 0,300,180,
'',null,
false, 1, false, 0, '', 0, 0, true, $only_image, '', 1, false,
'', false, false, false, $layoutData['image'], null, true, false,$type_graph);
$img = grafico_modulo_sparse($id_module,
$period, 0, 300, 180, '',null, false, 1,
false, 0, '', 0, 0, true, $only_image, '',
1, false, '', false, false, false,
$layoutData['image'], null, true, false, $type_graph);
}
}
else{
@ -1237,72 +1214,66 @@ else{
break;
case PERCENTILE_BAR:
$imgpos = '';
if($layoutData['label_position']=='left'){
$imgpos = 'float:right;';
}
else if($layoutData['label_position']=='right'){
$imgpos = 'float:left;';
}
$progress_bar_heigh = 15;
if (!empty($proportion)) {
if ($width != 0) {
$width = (integer)($proportion['proportion_width'] * $width);
$imgpos = '';
if($layoutData['label_position']=='left'){
$imgpos = 'float:right;';
}
else {
$width = (integer)($proportion['proportion_width'] * $infoImage[0]);
else if($layoutData['label_position']=='right'){
$imgpos = 'float:left;';
}
if ($height != 0) {
$height = (integer)($proportion['proportion_height'] * $height);
$progress_bar_heigh = $progress_bar_heigh * $proportion['proportion_height'];
}
else {
$height = (integer)($proportion['proportion_height'] * $infoImage[1]);
}
}
if($layoutData['label_position']=='up'){
echo io_safe_output($text);
}
ob_start();
if ($type == PERCENTILE_BUBBLE) {
echo progress_bubble($percentile, $width, $width, '', 1, $value_text, $colorStatus,$imgpos);
}
else {
echo progress_bar($percentile, $width, $progress_bar_heigh, '', 1, $value_text, $colorStatus,$imgpos);
}
$img = ob_get_clean();
if(get_parameter('action') == 'edit'){
if($width == 0){
$img = '<img src="images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
}
}
else{
$img = str_replace('>', 'class="image" style="height:'.$himg.'px;width:'.$wimg.'px;'.$imgpos.'" id="image_' . $id . '" />', $img);
}
echo $img;
if($layoutData['label_position']=='down'){
echo io_safe_output($text);
}
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
echo io_safe_output($text);
}
$progress_bar_heigh = 15;
if (!empty($proportion)) {
if ($width != 0) {
$width = (integer)($proportion['proportion_width'] * $width);
}
else {
$width = (integer)($proportion['proportion_width'] * $infoImage[0]);
}
if ($height != 0) {
$height = (integer)($proportion['proportion_height'] * $height);
$progress_bar_heigh = $progress_bar_heigh * $proportion['proportion_height'];
}
else {
$height = (integer)($proportion['proportion_height'] * $infoImage[1]);
}
}
if($layoutData['label_position']=='up'){
echo io_safe_output($text);
}
ob_start();
if ($type == PERCENTILE_BUBBLE) {
echo progress_bubble($percentile, $width, $width, '', 1, $value_text, $colorStatus,$imgpos);
}
else {
echo progress_bar($percentile, $width, $progress_bar_heigh, '', 1, $value_text, $colorStatus,$imgpos);
}
$img = ob_get_clean();
if (get_parameter('action') == 'edit') {
if ($width == 0) {
$img = '<img src="images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
}
else {
$img = '<img src="images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
}
}
else{
$img = str_replace('>', 'class="image" style="height:'.$himg.'px;width:'.$wimg.'px;'.$imgpos.'" id="image_' . $id . '" />', $img);
}
echo $img;
if($layoutData['label_position']=='down'){
echo io_safe_output($text);
}
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
echo io_safe_output($text);
}
break;

View File

@ -399,7 +399,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
false,
'',
$menu,
$background_color,
$backgroundColor,
$dashboard,
$vconsole);
}

View File

@ -100,7 +100,10 @@ if ($vconsole_write || $vconsole_manage) {
$hash = md5($config["dbpass"] . $id_layout . $config["id_user"]);
$options['public_link']['text'] = '<a href="' . ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]) . '" target="_blank">'.
$options['public_link']['text'] = '<a href="' .
ui_get_full_url('operation/visual_console/public_console.php?hash=' .
$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]) .
'" target="_blank">'.
html_print_image ("images/camera_mc.png", true,
array ("title" => __('Show link to public Visual Console'))).'</a>';
$options['public_link']['active'] = false;
@ -234,35 +237,13 @@ $ignored_params['refr'] = '';
url = js_html_entity_decode( href ) + duration;
//$(document).attr ("location", url);
$.get(window.location.href.replace("render_view","pure_ajax"), function(respuestaSolicitud){
$('#background_<?php echo $id_layout; ?>').html(respuestaSolicitud);
$('#background_<?php echo $id_layout; ?>').html(respuestaSolicitud);
startCountDown(refr, false);
});
}
});
}
//~ var fetchMap = function () {
//~ $.ajax({
//~ url: 'ajax.php',
//~ type: 'GET',
//~ dataType: 'html',
//~ data: {
//~ page: 'include/ajax/visual_console.ajax',
//~ render_map: true,
//~ keep_aspect_ratio: true,
//~ id_visual_console: <?php echo $id_layout; ?>,
//~ graph_javascript: <?php echo (int) $graph_javascript; ?>,
//~ width: $(window).width(),
//~ height: $(window).height()
//~ }
//~ })
//~ .done(function (data, textStatus, xhr) {
//~ $('div#vc-container').html(data);
//~ startCountDown(refr, false);
//~ });
//~ }
startCountDown(refr, false);
//~ // Auto hide controls
var controls = document.getElementById('vc-controls');
@ -272,9 +253,6 @@ $ignored_params['refr'] = '';
refr = Number.parseInt(event.target.value, 10);
startCountDown(refr, false);
});
//~ // Start the map fetch
//~ fetchMap();
}
else {
$('#refr').change(function () {
@ -282,96 +260,46 @@ $ignored_params['refr'] = '';
});
}
/*
$(".module_graph").each(function(){
left = parseInt($(this).css("left")) + 150 + ((parseInt($(this).css("width"))-300)/2);
$(this).css('left', left);
});
$('.item:not([class~="module_graph"])').each(function(){
left = parseInt($(this).css('left')) + ((parseInt($('#' + $(this).attr('id')).css('width')) - parseInt($('#' + $(this).attr('id') + " img").css('width')))*0.5);
$(this).css('left', left);
});
*/
$(".module_graph .menu_graph").css('display','none');
$(".parent_graph").each(function(){
if($(this).css('background-color') != 'rgb(255, 255, 255)'){
$(this).css('color', '#999');
}
});
$(".parent_graph").each( function() {
if ($(this).css('background-color') != 'rgb(255, 255, 255)')
$(this).css('color', '#999');
});
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
$('.item:not(.icon) img').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
$(this).css('margin-left','');
$('.item:not(.icon) img').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
$(this).css('margin-left','');
}
else{
else {
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
$('.item > div').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2-15)+'px');
$(this).css('margin-left','');
$('.item > div').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2-15)+'px');
$(this).css('margin-left','');
}
else{
else {
$(this).css('margin-left',(parseInt($(this).parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
$('.item > a > div').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2-5)+'px');
$(this).css('margin-left','');
$('.item > a > div').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2-5)+'px');
$(this).css('margin-left','');
}
else{
else {
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
/*
$('.percentile_item a > img').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
$(this).css('margin-left','');
}
else{
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
*/
});
</script>