From dcb33813df21d66f347f670e5325992ac5192c33 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Wed, 6 Oct 2010 15:35:49 +0000 Subject: [PATCH] 2010-10-06 Sergio Martin * godmode/reporting/visual_console_builder.php godmode/reporting/visual_console_builder.editor.js godmode/reporting/visual_console_builder.editor.php: Fixed the bad icon change in visual console editor when update an item for bug 3078016 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3355 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 +++++ .../visual_console_builder.editor.js | 30 +++++++++++++++++-- .../visual_console_builder.editor.php | 3 +- .../reporting/visual_console_builder.php | 1 + 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index da2a1397eb..8d7ed208ea 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-10-06 Sergio Martin + + * godmode/reporting/visual_console_builder.php + godmode/reporting/visual_console_builder.editor.js + godmode/reporting/visual_console_builder.editor.php: Fixed the + bad icon change in visual console editor when update an item + for bug 3078016 + 2010-10-06 Miguel de Dios * extras/pandoradb_migrate_v3.1_to_v3.2.sql: added default sound events in diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index d185e1b141..274d74c6fb 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -130,8 +130,32 @@ function updateAction() { $("#text_" + idItem).html(values['label']); $("#" + idItem).css('color', values['label_color']); - - $("#image_" + idItem).attr('src', getImageElement(idItem)); + + switch ($('#hidden-status_' + idItem).val()) { + case '1': + //Critical (BAD) + suffix = "_bad.png"; + break; + case '4': + //Critical (ALERT) + suffix = "_bad.png"; + break; + case '0': + //Normal (OK) + suffix = "_ok.png"; + break; + case '2': + //Warning + suffix = "_warning.png"; + break; + case '3': + //Unknown + default: + suffix = ".png"; + // Default is Grey (Other) + } + + $("#image_" + idItem).attr('src', 'images/console/icons/' + values['image'] + suffix); if ((values['width'] != 0) && (values['height'] != 0)) { $("#image_" + idItem).attr('width', values['width']); $("#image_" + idItem).attr('height', values['height']); @@ -187,7 +211,7 @@ function readFields() { var values = {}; values['label'] = $("input[name=label]").val(); - values['image'] = $("select[name=image]").val(); + values['image'] = $("select[name=image]").val(); values['left'] = $("input[name=left]").val(); values['top'] = $("input[name=top]").val(); values['agent'] = $("input[name=agent]").val(); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 226b11124a..86f8aabfa0 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -68,7 +68,7 @@ $heightBackground = $visualConsole['height']; $layoutDatas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $idVisualConsole); if ($layoutDatas === false) $layoutDatas = array(); - + /* Layout_data editor form */ $intervals = array (); $intervals[3600] = "1 ".__('hour'); @@ -235,6 +235,7 @@ foreach ($layoutDatas as $layoutData) { continue; printItemInVisualConsole($layoutData); + print_input_hidden('status_'.$layoutData['id'], getStatusElement($layoutData)); } echo ''; diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 1b230fb4cd..009b32245d 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -117,6 +117,7 @@ switch ($activeTab) { foreach ($idsElements as $idElement) { $id = $idElement['id']; $values = array(); + //$values['label'] = get_parameter('label_' . $id, ''); $values['label'] = get_parameter('label_' . $id, ''); $values['image'] = get_parameter('image_' . $id, ''); $values['width'] = get_parameter('width_' . $id, 0);