From 4f7bfea51cb626d947ad9c1915fc7f94dd8de726 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 2 Dec 2014 11:26:43 +0100 Subject: [PATCH] Added the lost fields for item group in the element list. (cherry picked from commit c0e767dcbf03d9f0a535c047408168f7347cb353) Conflicts: pandora_console/godmode/reporting/visual_console_builder.elements.php --- .../visual_console_builder.elements.php | 52 ++++++++++++++++--- .../reporting/visual_console_builder.php | 5 +- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.elements.php b/pandora_console/godmode/reporting/visual_console_builder.elements.php index 68164a1913..20abbdaab7 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.elements.php +++ b/pandora_console/godmode/reporting/visual_console_builder.elements.php @@ -55,7 +55,7 @@ else { } $table->head = array(); $table->head['icon'] = ''; -$table->head[0] = __('Label') . ' / ' . __('Agent'); +$table->head[0] = __('Label') . ' / ' . __('Agent') . ' / ' . __('Group'); $table->head[1] = __('Image') . ' / ' . __('Module'); $table->head[2] = __('Width x Height
Max value'); $table->head[3] = __('Period') . ' / ' . __('Position'); @@ -146,6 +146,10 @@ foreach ($layoutDatas as $layoutData) { $table->data[$i + 1]['icon'] = html_print_image('images/photo.png', true, array('title' => __('Icon'))); break; + case GROUP_ITEM: + $table->data[$i + 1]['icon'] = + html_print_image('images/group_green.png', true, array('title' => __('Group'))); + break; default: if (enterprise_installed()) { $table->data[$i + 1]['icon'] = @@ -177,11 +181,19 @@ foreach ($layoutDatas as $layoutData) { //Image - if (($layoutData['type'] == STATIC_GRAPH) || ($layoutData['type'] == ICON)) { - $table->data[$i + 1][1] = html_print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true, false, true, '', false, "width: 120px"); - } - else { - $table->data[$i + 1][1] = ''; + switch ($layoutData['type']) { + case STATIC_GRAPH: + case ICON: + case GROUP_ITEM: + $table->data[$i + 1][1] = + html_print_select ($images_list, + 'image_' . $idLayoutData, $layoutData['image'], '', + 'None', '', true, false, true, '', false, + "width: 120px"); + break; + default: + $table->data[$i + 1][1] = ''; + break; } @@ -197,8 +209,21 @@ foreach ($layoutDatas as $layoutData) { ')'; //Parent - $table->data[$i + 1][4] = html_print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData, - 'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true, false, true, false, 'width: 120px;'); + switch ($layoutData['type']) { + case BOX_ITEM: + case LINE_ITEM: + $table->data[$i + 1][4] = ""; + break; + default: + $table->data[$i + 1][4] = html_print_select_from_sql( + 'SELECT id, label + FROM tlayout_data + WHERE id_layout = '. $idVisualConsole . ' + AND id !=' . $idLayoutData, + 'parent_' . $idLayoutData, $layoutData['parent_item'], + '', 'None', 0, true, false, true, false, + 'width: 120px;'); + } //Delete row button if (!defined('METACONSOLE')) { @@ -220,6 +245,16 @@ foreach ($layoutDatas as $layoutData) { //Agent switch ($layoutData['type']) { + case GROUP_ITEM: + $own_info = get_user_info($config['id_user']); + if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, "PM")) + $return_all_group = false; + else + $return_all_group = true; + $table->data[$i + 2][0] = html_print_select_groups(false, "AR", + $return_all_group, 'group_' . $idLayoutData, + $layoutData['id_group'], '', '', 0, true); + break; case ICON: case LABEL: $table->data[$i + 2][0] = ''; @@ -271,6 +306,7 @@ foreach ($layoutDatas as $layoutData) { switch ($layoutData['type']) { case ICON: case LABEL: + case GROUP_ITEM: $table->data[$i + 2][1] = ''; break; default: diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 1b86e7586f..f25d493710 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -175,13 +175,16 @@ switch ($activeTab) { $values['pos_x'] = get_parameter('left_' . $id, 0); $values['pos_y'] = get_parameter('top_' . $id, 0); $type = db_get_value('type', 'tlayout_data', 'id', $id); - switch($type) { + switch ($type) { case MODULE_GRAPH: case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MIN: case SIMPLE_VALUE_AVG: $values['period'] = get_parameter('period_' . $id, 0); break; + case GROUP_ITEM: + $values['id_group'] = get_parameter('group_' . $id, 0); + break; } $agentName = get_parameter('agent_' . $id, ''); if (defined('METACONSOLE')) {