From c41dd035d6cb26fa3857e789a2938450060c9cef Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 18 Feb 2011 11:31:09 +0000 Subject: [PATCH] 2011-02-18 Miguel de Dios * include/ajax/visual_console_builder.ajax.php, godmode/reporting/visual_console_builder.editor.js: fixed bug that erase the label of items when moving in other position. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3919 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ .../reporting/visual_console_builder.editor.js | 17 ++++++++++++++--- .../ajax/visual_console_builder.ajax.php | 7 +++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 96e89ce8e3..ed2f6bfb81 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-02-18 Miguel de Dios + + * include/ajax/visual_console_builder.ajax.php, + godmode/reporting/visual_console_builder.editor.js: fixed bug that erase the + label of items when moving in other position. + 2011-02-18 Javier Lanz * godmode/gis_maps/configure_gis_map.php: Adding layer, group combo only displays user's groups. diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 5fb52b7e26..4d7dee8dd0 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -778,10 +778,21 @@ function insertDB(type, values) { }); } -function updateDB(type, idElement , values) { +function updateDB(type, idElement , values, event) { + action = "update"; + + //Check if the event parameter in function is passed in the call. + if (event != null) { + switch (event) { + case 'dragstop': + action = "move"; + break; + } + } + parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); - parameter.push ({name: "action", value: "update"}); + parameter.push ({name: "action", value: action}); parameter.push ({name: "id_visual_console", value: id_visual_console}); parameter.push ({name: "type", value: type}); parameter.push ({name: "id_element", value: idElement}); @@ -1053,7 +1064,7 @@ function eventsItems() { values['mov_left'] = ui.position.left; values['mov_top'] = ui.position.top; - updateDB(selectedItem, idItem, values); + updateDB(selectedItem, idItem, values, 'dragstop'); }); } diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 6484f19e12..51efa86783 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -84,6 +84,7 @@ switch ($action) { echo json_encode($return); break; case 'update': + case 'move': switch ($type) { case 'background': $values = array(); @@ -160,6 +161,12 @@ switch ($action) { } break; } + + if ($action == 'move') { + //Don't change the label because only change the positions + unset($values['label']); + } + $result = process_sql_update('tlayout_data', $values, array('id' => $id_element)); break; }