Fixed problems with backgrounds when add visual console in dashboards. Gitlab: #533

This commit is contained in:
m-lopez-f 2017-03-15 17:18:53 +01:00
parent def9172bb9
commit 4563ef34a4
1 changed files with 24 additions and 28 deletions

View File

@ -2434,12 +2434,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
$proportion_height = 0; $proportion_height = 0;
$proportion_width = 0; $proportion_width = 0;
if (!is_null($height) && !is_null($width)) { if (!is_null($height) && !is_null($width)) {
$resizedMap = true; $resizedMap = true;
if ($keep_aspect_ratio) { if ($keep_aspect_ratio) {
$ratio = min($width / $layout['width'], $height / $layout['height']); $ratio = min($width / $layout['width'], $height / $layout['height']);
$mapWidth = $ratio * $layout['width']; $mapWidth = $ratio * $layout['width'];
@ -2453,11 +2450,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
$dif_height = $layout["height"] - $mapHeight; $dif_height = $layout["height"] - $mapHeight;
$dif_width = $layout["width"] - $mapWidth; $dif_width = $layout["width"] - $mapWidth;
$proportion_height = $mapHeight / $layout["height"]; $proportion_height = $mapHeight / $layout["height"];
$proportion_width = $mapWidth / $layout["width"]; $proportion_width = $mapWidth / $layout["width"];
if ($layout["background"] != 'None.png' ) {
if (is_metaconsole()) { if (is_metaconsole()) {
$backgroundImage = $backgroundImage =
'/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' . '/include/Image/image_functions.php?getFile=1&thumb=1&thumb_size=' . $mapWidth . 'x' . $mapHeight . '&file=' .
@ -2471,9 +2467,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
($layout["background"]); ($layout["background"]);
} }
} }
}
else { else {
$mapWidth = $layout["width"]; $mapWidth = $layout["width"];
$mapHeight = $layout["height"]; $mapHeight = $layout["height"];
$backgroundImage = '';
if ($layout["background"] != 'None.png' )
$backgroundImage = $metaconsole_hack . 'images/console/background/' . $backgroundImage = $metaconsole_hack . 'images/console/background/' .
$layout["background"]; $layout["background"];
} }
@ -2482,18 +2481,15 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
echo "<div style='width: 100%; overflow:auto; margin: 0 auto; padding:5px;'>"; echo "<div style='width: 100%; overflow:auto; margin: 0 auto; padding:5px;'>";
} }
echo '<div style="'; echo '<div id="background_'.$id_layout.'"
if(get_parameter('pure')==1){
echo 'width:100%;height:100%;position:absolute;';
}
echo 'background-color:'.$layout["background_color"].';"><div id="background_'.$id_layout.'"
style="margin:0px auto;text-align: style="margin:0px auto;text-align:
z-index: 0; z-index: 0;
position:relative; position:relative;
width:' . $mapWidth . 'px; width:' . $mapWidth . 'px;
height:' . $mapHeight . 'px;">'; height:' . $mapHeight . 'px;
background-color:'.$layout["background_color"].';">';
if ($layout["background"] != 'None.png' )
echo "<img src='" . echo "<img src='" .
ui_get_full_url($backgroundImage) . "' width='100%' height='100%' />"; ui_get_full_url($backgroundImage) . "' width='100%' height='100%' />";