diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 419bde43b3..0449f91046 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2013-06-24 Miguel de Dios + + * godmode/reporting/visual_console_builder.editor.js, + godmode/reporting/visual_console_builder.editor.php, + include/functions_visual_map_editor.php: changed the code to show + the list of parent in the select, now this selectbox doesn't show + the same item. + + MERGED FROM THE BRANCH PANDORA_4.0 + 2013-06-20 Mario Pulido *include/help/es/help_module_tokens.php diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index ca44f3cb2f..655b6ace9b 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -20,6 +20,7 @@ var toolbuttonActive = null; var autosave = true; var list_actions_pending_save = []; var temp_id_item = 0; +var parents = {}; var SIZE_GRID = 16; //Const the size (for width and height) of grid. @@ -40,6 +41,10 @@ function toggle_advance_options_palette(close) { function visual_map_main() { $(".label_color").attachColorPicker(); + //Get the list of posible parents + parents = Base64.decode($("input[name='parents_load']").val()); + parents = eval("(" + parents + ")"); + eventsBackground(); eventsItems(); @@ -388,6 +393,21 @@ function toggle_item_palette() { } } +function fill_parent_select(id_item) { + //Populate the parent widget + $("#parent option") + .filter(function() { if ($(this).attr('value') != 0) return true; }) + .remove(); + jQuery.each(parents, function(key, value) { + if (id_item == key) { + return; //continue + } + + $("#parent").append($('')); + }); +} + function loadFieldsFromDB(item) { metaconsole = $("input[name='metaconsole']").val(); @@ -416,6 +436,8 @@ function loadFieldsFromDB(item) { { var moduleId = 0; + fill_parent_select(idItem); + jQuery.each(data, function(key, val) { if (key == 'background') $("#background_image").val(val); if (key == 'width') $("input[name=width]").val(val); @@ -692,6 +714,8 @@ function cleanFields() { $("input[name=height_module_graph]").val(180); $("#preview").empty(); + fill_parent_select(); + var anyText = $("#any_text").html(); //Trick for catch the translate text. $("#module").empty().append($('')); } @@ -1179,7 +1203,8 @@ function createItem(type, values, id_data) { } function addItemSelectParents(id_data, text) { - $("#parent").append($('')); + parents[id_data] = text; + //$("#parent").append($('')); } function insertDB(type, values) { diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index faed161d74..a4bae164e9 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -72,14 +72,16 @@ echo "
"; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 8e75049009..e9dbbd9eaf 100644 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -302,6 +302,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['parent_row']['html'] = '' . __('Parent') . ' ' . + html_print_input_hidden('parents_load', base64_encode(json_encode($parents)), true) . html_print_select($parents, 'parent', '', '', __('None'), 0, true) . '';