From 0f4f36dcf96f27eb3449de8d2d38c59ad2d3d3e3 Mon Sep 17 00:00:00 2001 From: guruevi Date: Tue, 17 Feb 2009 21:37:39 +0000 Subject: [PATCH] 2009-02-17 Evi Vanoost * general/login_ok.php, operation/visual_console/index.php, operation/visual_console/render_view.php: Small cosmetic fixes * include/functions_visual_map.php: Cosmetic fixes and put the if/elseif statements in a simpler switch statement * include/functions_db.php: dame_grupo_icono is now get_group_icon git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1465 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++ pandora_console/general/logon_ok.php | 2 +- pandora_console/include/functions_db.php | 12 ++- pandora_console/include/functions_html.php | 4 +- .../include/functions_visual_map.php | 88 +++++++++---------- .../operation/visual_console/index.php | 11 ++- .../operation/visual_console/render_view.php | 32 ++++--- 7 files changed, 87 insertions(+), 72 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5fa3ba95e8..cafd60fb55 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2009-02-17 Evi Vanoost + + * general/login_ok.php, operation/visual_console/index.php, + operation/visual_console/render_view.php: Small cosmetic fixes + + * include/functions_visual_map.php: Cosmetic fixes and put the if/elseif + statements in a simpler switch statement + + * include/functions_db.php: dame_grupo_icono is now get_group_icon + 2009-02-17 Sancho Lerena * pandoradb.sql: treport_content, changed report type to string to allow diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index ab153c5c42..b4a786bd1d 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -40,7 +40,7 @@ echo ''; $sql = sprintf ("SELECT COUNT(id_mensaje) FROM tmensajes WHERE id_usuario_destino='%s' AND estado='FALSE';", $config["id_user"]); $resultado = get_db_sql ($sql); if ($resultado > 0) { - echo '

'.__('You have ').''.$resultado. + echo '

'.__('You have ').''.$resultado. ''.__(' unread message(s).').'

'; } diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index f09729083b..cd3b31eeac 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -466,10 +466,20 @@ function get_reports ($id_user) { * * @return string Icon path of the given group */ -function dame_grupo_icono ($id_group) { +function get_group_icon ($id_group) { return (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group); } + +/** + * DEPRECATED in favor of get_group_icon + */ +function dame_grupo_icono ($id_group) { + return get_group_icon ($id_group); +} + + + /** * Get agent id from an agent name. * diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 814d391589..14749213f0 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -53,7 +53,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing = $attributes .= ' disabled="disabled"'; } - $output .= ''; if ($nothing != '') { $output .= ''; } if (!empty ($fields)) { diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 3621a1ebd0..c4e3c2f9a3 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -29,7 +29,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = global $config; $layout = get_db_row ('tlayout', 'id', $id_layout); - echo "
"; + echo '
'; $layout_datas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout); $lines = array (); @@ -98,56 +98,53 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = // Link to an agent if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) { - echo ""; + echo ''; // Link to a map } elseif ($layout_data['id_layout_linked']>0){ - echo ''; + echo ''; // A void object } else { - echo ""; + echo ''; } } - // Critical (BAD) or ALERT - if (($status == 1) OR ($status == 4)){ - if ($layout_data['width'] != "" && $layout_data['width'] != 0) - echo ''; - else - echo ''; - - // Normal (OK) - } elseif ($status == 0){ - if ($layout_data['width'] != "" && $layout_data['width'] != 0) - echo ''; - else - echo ''; - - // Warning - } elseif ($status == 2){ - if ($layout_data['width'] != "" && $layout_data['width'] != 0) - echo ''; - else - echo ''; - - // Other (GREY) - } else { - if ($layout_data['width'] != "" && $layout_data['width'] != 0) - echo ''; - else - echo ''; + $img_style = array (); + $img_style["title"] = $layout_data["label"]; + + if (!empty ($layout_data["width"])) { + $img_style["width"] = $layout_data["width"]; + } + if (!empty ($layout_data["height"])) { + $img_style["height"] = $layout_data["height"]; } + + $img = "images/console/icons/".$layout_data["image"]; + switch ($status) { + case 1: + case 4: + //Critical (BAD or ALERT) + $img .= "_bad.png"; + break; + case 0: + //Normal (OK) + $img .= "_ok.png"; + break; + case 2: + //Warning + $img .= "_warning.png"; + break; + default: + $img .= ".png"; + // Default is Grey (Other) + } + + print_image ($img, false, $img_style); + echo ""; - // Draw label + // Print label echo "
"; echo $layout_data['label']; echo "
"; @@ -160,12 +157,12 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = echo '"; @@ -194,13 +191,14 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = /* If you want lines in the map, call using Javascript: draw_lines (lines, id_div); on body load, where id_div is the id of the div which holds the map */ - echo "\n".''."\n"; + echo '/* ]]> */'; } // End main div echo "
"; diff --git a/pandora_console/operation/visual_console/index.php b/pandora_console/operation/visual_console/index.php index d3b3f9b6f0..8a76c14fcf 100644 --- a/pandora_console/operation/visual_console/index.php +++ b/pandora_console/operation/visual_console/index.php @@ -29,7 +29,7 @@ $layouts = get_db_all_rows_in_table ('tlayout','name'); if ($layouts === false) $layouts = array (); -$table->width = '500px'; +$table->width = 500; $table->data = array (); $table->head = array (); $table->head[0] = __('Name'); @@ -44,11 +44,10 @@ foreach ($layouts as $layout) { } $data = array (); - $data[0] = ''.$layout['name'].''; - $data[1] = ' '; - $data[1] .= get_group_name ($layout["id_group"]); + $data[0] = ''.$layout['name'].' '; + $data[1] = print_image ("images/".get_group_icon ($layout["id_group"]).".png", true, array ("title" => get_group_name ($layout["id_group"]))); + $data[1] .= " ".get_group_name ($layout["id_group"]); $data[2] = get_db_value ('COUNT(*)', 'tlayout_data', 'id_layout', $layout['id']); array_push ($table->data, $data); diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index e10ba14629..3041623e3b 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -58,12 +58,12 @@ if (! give_acl ($config["id_user"], $id_group, "AR")) { echo "

".$layout_name."  "; if ($config["pure"] == 0) { - echo ""; - echo ""; + echo ''; + print_image ("images/monitor.png", false, array ("title" => __('Full screen mode'))); echo ""; } else { - echo ""; - echo ""; + echo ''; + print_image ("images/monitor.png", false, array ("title" => __('Back to normal mode'))); echo ""; } @@ -71,38 +71,34 @@ echo '

'; print_pandora_visual_map ($id_layout); - $values = array (); -$values[5] = "5 ". __('Seconds'); -$values[30] = "30 ". __('Seconds'); +$values[5] = "5 ". __('seconds'); +$values[30] = "30 ". __('seconds'); $values[60] = "1 ". __('minutes'); $values[120] = "2 ". __('minutes'); $values[300] = "5 ". __('minutes'); $values[600] = "10 ". __('minutes'); $values[1800] = "30 ". __('minutes'); -$table->width = '500px'; +$table->width = 500; $table->data = array (); $table->data[0][0] = __('Autorefresh time'); -$table->data[0][1] = print_select ($values, 'refr', $refr, '', 'N/A', 0, true); +$table->data[0][1] = print_select ($values, 'refr', $refr, '', 'N/A', 0, true, false, false); $table->data[0][2] = print_submit_button (__('Refresh'), '', false, 'class="sub next"', true); -echo "
"; -echo "
"; +echo '
 
'; if ($config['pure'] && $refr != 0) { - echo '

'; - echo '
'; + echo '

'; } -echo "
"; -echo "
"; +echo '
 
'; -echo '
'; +echo ''; print_input_hidden ('pure', $config["pure"]); print_input_hidden ('id', $id_layout); print_table ($table); -echo "
"; +echo ''; if ($config["pure"] && $refr != 0) { $config['jquery'][] = 'countdown'; @@ -111,6 +107,7 @@ if ($config["pure"] && $refr != 0) { $config['js'][] = 'pandora_visual_console'; ?>