2012-02-13 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/visual_console_builder.editor.js: fixed the resize
	background.
	
	Fixes: #3483645



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5580 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-02-13 17:56:50 +00:00
parent 65726fae5e
commit fda3463d7c
2 changed files with 53 additions and 42 deletions

View File

@ -1,3 +1,10 @@
2012-02-13 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js: fixed the resize
background.
Fixes: #3483645
2012-02-13 Miguel de Dios <miguel.dedios@artica.es> 2012-02-13 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: cleaned source code style, and fixed the * include/functions_reporting.php: cleaned source code style, and fixed the

View File

@ -486,18 +486,18 @@ function loadFieldsFromDB(item) {
function setOriginalSizeBackground() { function setOriginalSizeBackground() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
data: "page=godmode/reporting/visual_console_builder.editor&get_original_size_background=1&background=" + $("#background_img").attr('src'), data: "page=godmode/reporting/visual_console_builder.editor&get_original_size_background=1&background=" + $("#background_img").attr('src'),
async:false, async: false,
dataType: "json", dataType: "json",
success: function(data){ success: function(data) {
var values = {}; var values = {};
values['width'] = data[0]; values['width'] = data[0];
values['height'] = data[1]; values['height'] = data[1];
updateDB('background', 0, values); updateDB('background', 0, values);
} }
}); });
actionClick(); actionClick();
@ -505,31 +505,31 @@ function setOriginalSizeBackground() {
function setAspectRatioBackground(side) { function setAspectRatioBackground(side) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "ajax.php", url: "ajax.php",
data: "page=godmode/reporting/visual_console_builder.editor&get_original_size_background=1&background=" + $("#background_img").attr('src'), data: "page=godmode/reporting/visual_console_builder.editor&get_original_size_background=1&background=" + $("#background_img").attr('src'),
async:false, async: false,
dataType: "json", dataType: "json",
success: function(data){ success: function(data){
old_width = parseInt($("#background").css('width').replace('px', '')); old_width = parseInt($("#background").css('width').replace('px', ''));
old_height = parseInt($("#background").css('height').replace('px', '')); old_height = parseInt($("#background").css('height').replace('px', ''));
img_width = data[0]; img_width = data[0];
img_height = data[1]; img_height = data[1];
if (side == 'width') { if (side == 'width') {
ratio = old_width / img_width; ratio = old_width / img_width;
width = old_width; width = old_width;
height = img_height * ratio; height = img_height * ratio;
} }
else if (side == 'height') { else if (side == 'height') {
ratio = old_height / img_height; ratio = old_height / img_height;
width = img_width * ratio; width = img_width * ratio;
height = old_height; height = old_height;
} }
var values = {}; var values = {};
values['width'] = width; values['width'] = width;
@ -538,7 +538,7 @@ function setAspectRatioBackground(side) {
updateDB('background', 0, values); updateDB('background', 0, values);
} }
}); });
actionClick(); actionClick();
@ -979,6 +979,9 @@ function updateDB(type, idElement , values, event) {
//Check if the event parameter in function is passed in the call. //Check if the event parameter in function is passed in the call.
if (event != null) { if (event != null) {
switch (event) { switch (event) {
case 'resizestop':
//Force to move action when resize a background, for to avoid
//lost the label.
case 'dragstop': case 'dragstop':
action = "move"; action = "move";
break; break;
@ -1287,7 +1290,8 @@ function move_elements_resize(original_width, original_height, width, height) {
jQuery.each($(".item"), function(key, value) { jQuery.each($(".item"), function(key, value) {
item = value; item = value;
idItem = $(item).attr('id'); idItem = $(item).attr('id');
classItem = $(item).attr('class').replace('item', '').replace('ui-draggable', '').replace(/^\s+/g,'').replace(/\s+$/g,'') classItem = $(item).attr('class').replace('item', '')
.replace('ui-draggable', '').replace(/^\s+/g,'').replace(/\s+$/g,'')
old_height = parseInt($(item).css('margin-top').replace('px', '')); old_height = parseInt($(item).css('margin-top').replace('px', ''));
old_width = parseInt($(item).css('margin-left').replace('px', '')); old_width = parseInt($(item).css('margin-left').replace('px', ''));
@ -1306,7 +1310,7 @@ function move_elements_resize(original_width, original_height, width, height) {
values['absolute_left'] = new_width; values['absolute_left'] = new_width;
values['absolute_top'] = new_height; values['absolute_top'] = new_height;
updateDB(classItem, idItem, values); updateDB(classItem, idItem, values, "resizestop");
}); });
} }