diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 99917c5f40..f1c525832e 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -374,8 +374,7 @@ function update_button_palette_callback() { } - - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).attr('width', 70); @@ -503,7 +502,7 @@ function update_button_palette_callback() { } - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).attr('width', 70); @@ -679,7 +678,7 @@ function update_button_palette_callback() { } $("#image_" + idItem).attr('src', "images/spinner.gif"); if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if($('#preview > img').prop('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).attr('width', 70); @@ -2719,7 +2718,9 @@ function createItem(type, values, id_data) { break; case 'group_item': + class_type = "group_item"; + img_src = "images/spinner.gif"; @@ -2797,25 +2798,20 @@ function createItem(type, values, id_data) { if ((values['width'] == 0) || (values['height'] == 0)) { // Do none - if(values['image'] != '' && values['image'] != 'none'){ - - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if(values['image'] != '' && values['image'] != 'none'){ + if(values['naturalWidth'] == null || values['naturalWidth'] > 150 || values['naturalHeight'] > 150){ + $image.attr('width', '70') + .attr('height', '70'); + } + else{ + $image.attr('width', values['naturalWidth']) + .attr('height', values['naturalHeight']); + } + } + else{ $image.attr('width', '70') .attr('height', '70'); } - else{ - $image.attr('width', $('#preview > img')[0].naturalWidth) - .attr('height', $('#preview > img')[0].naturalHeight); - } - - - } - else{ - $image.attr('width', '70') - .attr('height', '70'); - } - - } else { $image.attr('width', values['width']) @@ -2917,13 +2913,13 @@ function createItem(type, values, id_data) { if(values['image'] != '' && values['image'] != 'none'){ // Do none - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if(values['naturalWidth'] == null || values['naturalWidth'] > 150 || values['naturalHeight'] > 150){ $image.attr('width', '70') .attr('height', '70'); } else{ - $image.attr('width', $('#preview > img')[0].naturalWidth) - .attr('height', $('#preview > img')[0].naturalHeight); + $image.attr('width', values['naturalWidth']) + .attr('height', values['naturalHeight']); } } else{ @@ -2962,7 +2958,7 @@ function createItem(type, values, id_data) { case 'static_graph': class_type = "static_graph"; - + img_src = "images/spinner.gif"; item = $('
') @@ -3008,13 +3004,13 @@ function createItem(type, values, id_data) { if ((values['width'] == 0) || (values['height'] == 0)) { // Do none if(values['image'] != '' && values['image'] != 'none'){ - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if(values['naturalWidth'] == null || values['naturalWidth'] > 150 || values['naturalHeight'] > 150){ $image.attr('width', '70') .attr('height', '70'); } else{ - $image.attr('width', $('#preview > img')[0].naturalWidth) - .attr('height', $('#preview > img')[0].naturalHeight); + $image.attr('width', values['naturalWidth']) + .attr('height', values['naturalHeight']); } } else{ @@ -3141,13 +3137,13 @@ function createItem(type, values, id_data) { if(values['image'] != '' && values['image'] != 'none'){ // Do none - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if(values['naturalWidth'] == null || values['naturalWidth'] > 150 || values['naturalHeight'] > 150){ $image.attr('width', '70') .attr('height', '70'); } else{ - $image.attr('width', $('#preview > img')[0].naturalWidth) - .attr('height', $('#preview > img')[0].naturalHeight); + $image.attr('width', values['naturalWidth']) + .attr('height', values['naturalHeight']); } } else{ @@ -3422,7 +3418,7 @@ function createItem(type, values, id_data) { break; case 'icon': if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img').attr('naturalWidth') == null || $('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if(values['naturalWidth'] == null || values['naturalWidth'] > 150 || values['naturalWidth'] > 150){ sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;'; imageSize = 'width="' + '70' + '" height="' + '70' + '"'; } @@ -3527,6 +3523,10 @@ function insertDB(type, values) { success: function (data) { if (data['correct']) { id = data['id_data']; + if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){ + values['naturalWidth'] = $('#preview > img')[0].naturalWidth; + values['naturalHeight'] = $('#preview > img')[0].naturalHeight; + } createItem(type, values, id); addItemSelectParents(id, data['text']); //Reload all events for the item and new item. @@ -3866,7 +3866,12 @@ function copyDB(idItem) { values = data['values']; type = data['type']; id = data['id_data']; - + + if((type === 'group_item') || (type === 'icon') || (type === 'static_graph')){ + values['naturalWidth'] = $('#image_'+idItem).prop('naturalWidth'); + values['naturalHeight'] = $('#image_'+idItem).prop('naturalHeight'); + } + createItem(type, values, id); addItemSelectParents(id, data['text']);