Merge branch '1478-Problemas_varios_en_consolas_visuales' into 'develop'

1478 problemas varios en consolas visuales

See merge request artica/pandorafms!944
This commit is contained in:
vgilc 2017-10-23 11:06:51 +02:00
commit 9de7f7591d
4 changed files with 63 additions and 54 deletions

View File

@ -205,11 +205,7 @@ switch ($activeTab) {
// If the background is changed the size is reseted
$background_now = $visualConsole['background'];
/*if ($background_now != $background && $background) {
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
$values['width'] = $sizeBackground[0];
$values['height'] = $sizeBackground[1];
}*/
$values['width'] = $width;
$values['height'] = $height;
switch ($action) {
@ -237,33 +233,31 @@ switch ($activeTab) {
break;
case 'save':
if (!defined('METACONSOLE')) {
if ($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values);
else
$idVisualConsole = false;
if ($values['name'] != "" && $values['background'])
$idVisualConsole = db_process_sql_insert('tlayout', $values);
else
$idVisualConsole = false;
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true,
'message' => ui_print_success_message(__('Successfully created.'), '', true));
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true,
'message' => ui_print_success_message(__('Successfully created.'), '', true));
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true));
}
// Return the updated visual console
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
break;
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true));
}
break;
}
break;

View File

@ -946,6 +946,9 @@ switch ($action) {
$values['image'] = $image;
$values['width'] = $width;
$values['height'] = $height;
if(defined('METACONSOLE') && $values['id_agent'] == 0){
$values['id_metaconsole'] = 1;
}
break;
case 'group_item':
$values['type'] = GROUP_ITEM;

View File

@ -421,7 +421,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
}
else if ($is_a_link_to_other_visualconsole) {
if (empty($layout_data['id_metaconsole'])) {
if (empty($layoutData['id_metaconsole'])) {
$url = $config['homeurl'] . "index.php?sec=reporting&sec2=operation/visual_console/render_view&pure=" . $config["pure"] . "&id=" . $layoutData["id_layout_linked"];
}
else {
@ -1268,9 +1268,12 @@ function visual_map_print_item($mode = "read", $layoutData,
$imgpos = 'float:left';
}
if ($layoutData['id_metaconsole'] != 0) {
$img = "../../" . $img;
}
$varsize = getimagesize($img);
if($layoutData['show_statistics'] == 1){
if (get_parameter('action') == 'edit') {
@ -1364,34 +1367,35 @@ function visual_map_print_item($mode = "read", $layoutData,
else{
if ($width == 0 || $height == 0) {
if($varsize[0] > 150 || $varsize[1] > 150){
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"width" => "70px",
"height" => "70px",
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
array("class" => "image",
"id" => "image_" . $id,
"width" => "70px",
"height" => "70px",
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
}
else{
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
array("class" => "image",
"id" => "image_" . $id,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
}
}
else{
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"width" => $width,
"height" => $height,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
echo html_print_image($img, true,
array("class" => "image",
"id" => "image_" . $id,
"width" => $width,
"height" => $height,
"title" => $img_style_title,
"style" => $borderStyle.$imgpos), false,
false, false, $isExternalLink);
}
}
@ -1646,6 +1650,13 @@ function visual_map_print_item($mode = "read", $layoutData,
}
break;
case LABEL:
if (get_parameter('action') == 'edit' || get_parameter('operation') == 'edit_visualmap') {
$aux_text1 = explode("<a href=\"", $text);
$aux_text2 = explode("\">", $aux_text1[1]);
$aux_text3 = explode("</a>", $aux_text2[1]);
$text = $aux_text1[0].$aux_text3[0].$aux_text3[1];
}
echo io_safe_output($text);
break;
case ICON:
@ -2678,9 +2689,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
$mapWidth = $layout["width"];
$mapHeight = $layout["height"];
$backgroundImage = '';
if ($layout["background"] != 'None.png' )
if ($layout["background"] != 'None.png' ){
$backgroundImage = $metaconsole_hack . 'images/console/background/' .
$layout["background"];
}
}
if (defined('METACONSOLE')) {

View File

@ -222,7 +222,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['enable_link_row']['html'] =
'<td align="left" style="">' . __('Enable link') . '</td>
<td align="left" style="">' .
html_print_checkbox('enable_link', '', !is_metaconsole(), true) . '</td>';
html_print_checkbox('enable_link', '', 1, true) . '</td>';
$form_items['preview_row'] = array();