diff --git a/pandora_console/general/cg_items.php b/pandora_console/general/cg_items.php new file mode 100644 index 0000000000..bb76299e07 --- /dev/null +++ b/pandora_console/general/cg_items.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index dbca48c15c..268720fb80 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -298,6 +298,26 @@ function update_button_palette_callback() { break; case 'module_graph': + + if($('#dir_items').html() == 'horizontal'){ + if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width')) + || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){ + + alert($('#count_items').html()+' joined graph items are wider than background'); + return false; + + } + } + + if($('#dir_items').html() == 'vertical'){ + if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){ + alert($('#count_items').html()+' joined graph items are higher than background'); + return false; + + } + } + + if($('input[name=width_module_graph]').val() == ''){ alert('Undefined width'); return false; @@ -1151,6 +1171,8 @@ function loadFieldsFromDB(item) { }); + $('#count_items').html(1); + if (data.type == 6 || data.type == 7 || data.type == 8 || data.type == 1) { $("#period_row." + item).css('display', ''); @@ -1169,6 +1191,20 @@ function loadFieldsFromDB(item) { } else { + + jQuery.get ("ajax.php", + {"page": "general/cg_items","data": data.id_custom_graph}, + function (data, status) { + if(data.split(",")[0] == 4){ + $('#count_items').html(data.split(",")[1]); + $('#dir_items').html('vertical'); + } + else if (data.split(",")[0] == 5) { + $('#count_items').html(data.split(",")[1]); + $('#dir_items').html('horizontal'); + + } + }); $("input[name='radio_choice'][value='custom_graph']") .prop('checked', true); diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 8fa3306927..47ce7665ce 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -446,7 +446,10 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { html_print_input_text('width_module_graph', 300, '', 3, 5, true) . ' X ' . html_print_input_text('height_module_graph', 180, '', 3, 5, true) . - ''; + ' X ' . + '1 '. + ' item/s + '; //Insert and modify before the buttons to create or update. @@ -587,6 +590,49 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $(".border_color").attachColorPicker(); $(".fill_color").attachColorPicker(); $(".line_color").attachColorPicker(); + + $("input[name=radio_choice]").change(function(){ + $('#count_items').html(1); + }); + + $("#custom_graph").click(function(){ + $('#count_items').html(1); + jQuery.get ("ajax.php", + {"page": "general/cg_items","data": $(this).val()}, + function (data, status) { + if(data.split(",")[0] == 8){ + size = 400+(data.split(",")[1] * 50); + if(data.split(",")[1]>3){ + size = 400+(3 * 50); + } + $('#text-width_module_graph').val(size); + $('#text-height_module_graph').val(180); + + } + else if (data.split(",")[0] == 4) { + size = data.split(",")[1]; + if(data.split(",")[1] > 1){ + $('#count_items').html(data.split(",")[1]); + $('#dir_items').html('vertical'); + } + $('#text-width_module_graph').val(300); + $('#text-height_module_graph').val(50); + } + else if (data.split(",")[0] == 5) { + size = data.split(",")[1]; + if(data.split(",")[1] > 1){ + $('#count_items').html(data.split(",")[1]); + $('#dir_items').html('horizontal'); + } + $('#text-width_module_graph').val(100); + $('#text-height_module_graph').val(100); + } + + }); + + }); + + }); "; + $return = "
"; if ($water_mark != '') { $return .= ""; diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index fa507a1d55..5aff41f3e2 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -302,9 +302,8 @@ $ignored_params['refr'] = ''; } }); - $(".graph").each(function(){ - height = parseInt($(this).css("height")) - 30; - + $(".graph:not([class~='noresizevc'])").each(function(){ + height = parseInt($(this).css("height")) - 30; $(this).css('height', height); });