diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index 05668797ec..300ea33f40 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -182,7 +182,7 @@ if ($layoutDatas === false) { $alternativeStyle = true; $parents = visual_map_get_items_parents($idVisualConsole); - +$x = 0; foreach ($layoutDatas as $layoutData) { $idLayoutData = $layoutData['id']; @@ -537,7 +537,8 @@ foreach ($layoutDatas as $layoutData) { $table->data[($i + 1)][5] = ''; $table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true); - $table->data[($i + 1)][5] .= ''.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).''; + $table->data[($i + 1)][5] .= ''.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).''; + $table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true); // Second row $table->data[($i + 2)]['icon'] = ''; @@ -778,6 +779,12 @@ foreach ($layoutDatas as $layoutData) { $alternativeStyle = !$alternativeStyle; $i = ($i + 3); + $x++; +} + +$x = (($x * 13) + 14); +if ($x > ini_get('max_input_vars')) { + ui_print_warning_message(__('You have to change the "max_input_vars" and set bigger value on php.ini for update, there is too much elements to update')); } $pure = get_parameter('pure', 0); @@ -888,6 +895,16 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/'); return false; }); + $('select[id^="image_"], input[name^="width_"], input[name^="height"], input[name^="left_"], input[name^="top_"], select[id^="parent_"], input[id^="agent_"], select[id^="module_"]').change(function(){ + var id = $(this).attr('id').split('_')[1]; + $('#hidden-updated_'+id).val('1'); + }); + + $('select[id^="map_linked"]').change(function(){ + var id = $(this).attr('id').split('_')[2]; + $('#hidden-updated_'+id).val('1'); + }); + defineTinyMCE('#tinyMCE_editor'); $("#dialog_label_editor").hide () diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 9988704695..c7da988cd0 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -418,7 +418,6 @@ switch ($activeTab) { case 'update': // Update background $background = get_parameter('background'); - $background_color = get_parameter('background_color'); $width = get_parameter('width'); $height = get_parameter('height'); @@ -433,10 +432,9 @@ switch ($activeTab) { db_process_sql_update( 'tlayout', [ - 'background' => $background, - 'background_color' => $background_color, - 'width' => $width, - 'height' => $height, + 'background' => $background, + 'width' => $width, + 'height' => $height, ], ['id' => $idVisualConsole] ); @@ -463,62 +461,65 @@ switch ($activeTab) { foreach ($idsElements as $idElement) { $id = $idElement['id']; - $values = []; - $values['label'] = get_parameter('label_'.$id, ''); - $values['image'] = get_parameter('image_'.$id, ''); - $values['width'] = get_parameter('width_'.$id, 0); - $values['height'] = get_parameter('height_'.$id, 0); - $values['pos_x'] = get_parameter('left_'.$id, 0); - $values['pos_y'] = get_parameter('top_'.$id, 0); - switch ($idElement['type']) { - case NETWORK_LINK: - case LINE_ITEM: - continue 2; + $update = get_parameter('updated_'.$id, 0); + if ($update === '1') { + $values = []; + $values['label'] = get_parameter('label_'.$id, ''); + $values['image'] = get_parameter('image_'.$id, ''); + $values['width'] = get_parameter('width_'.$id, 0); + $values['height'] = get_parameter('height_'.$id, 0); + $values['pos_x'] = get_parameter('left_'.$id, 0); + $values['pos_y'] = get_parameter('top_'.$id, 0); + switch ($idElement['type']) { + case NETWORK_LINK: + case LINE_ITEM: + continue 2; - break; + break; - case SIMPLE_VALUE_MAX: - case SIMPLE_VALUE_MIN: - case SIMPLE_VALUE_AVG: - $values['period'] = get_parameter('period_'.$id, 0); - break; + case SIMPLE_VALUE_MAX: + case SIMPLE_VALUE_MIN: + case SIMPLE_VALUE_AVG: + $values['period'] = get_parameter('period_'.$id, 0); + break; - case MODULE_GRAPH: - $values['period'] = get_parameter('period_'.$id, 0); - unset($values['image']); - break; + case MODULE_GRAPH: + $values['period'] = get_parameter('period_'.$id, 0); + unset($values['image']); + break; - case GROUP_ITEM: - $values['id_group'] = get_parameter('group_'.$id, 0); - break; + case GROUP_ITEM: + $values['id_group'] = get_parameter('group_'.$id, 0); + break; - case CIRCULAR_PROGRESS_BAR: - case CIRCULAR_INTERIOR_PROGRESS_BAR: - case PERCENTILE_BUBBLE: - case PERCENTILE_BAR: - unset($values['height']); - break; + case CIRCULAR_PROGRESS_BAR: + case CIRCULAR_INTERIOR_PROGRESS_BAR: + case PERCENTILE_BUBBLE: + case PERCENTILE_BAR: + unset($values['height']); + break; + } + + $agentName = get_parameter('agent_'.$id, ''); + if (defined('METACONSOLE')) { + $values['id_metaconsole'] = (int) get_parameter('id_server_id_'.$id, ''); + $values['id_agent'] = (int) get_parameter('id_agent_'.$id, 0); + } else { + $agent_id = (int) get_parameter('id_agent_'.$id, 0); + $values['id_agent'] = $agent_id; + } + + $values['id_agente_modulo'] = get_parameter('module_'.$id, 0); + $values['id_custom_graph'] = get_parameter('custom_graph_'.$id, 0); + $values['parent_item'] = get_parameter('parent_'.$id, 0); + $values['id_layout_linked'] = get_parameter('map_linked_'.$id, 0); + + if (enterprise_installed()) { + enterprise_visual_map_update_action_from_list_elements($type, $values, $id); + } + + db_process_sql_update('tlayout_data', $values, ['id' => $id]); } - - $agentName = get_parameter('agent_'.$id, ''); - if (defined('METACONSOLE')) { - $values['id_metaconsole'] = (int) get_parameter('id_server_id_'.$id, ''); - $values['id_agent'] = (int) get_parameter('id_agent_'.$id, 0); - } else { - $agent_id = (int) get_parameter('id_agent_'.$id, 0); - $values['id_agent'] = $agent_id; - } - - $values['id_agente_modulo'] = get_parameter('module_'.$id, 0); - $values['id_custom_graph'] = get_parameter('custom_graph_'.$id, 0); - $values['parent_item'] = get_parameter('parent_'.$id, 0); - $values['id_layout_linked'] = get_parameter('map_linked_'.$id, 0); - - if (enterprise_installed()) { - enterprise_visual_map_update_action_from_list_elements($type, $values, $id); - } - - db_process_sql_update('tlayout_data', $values, ['id' => $id]); } break;