2009-02-17 Evi Vanoost <vanooste@rcbi.rochester.edu>

* 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
This commit is contained in:
guruevi 2009-02-17 21:37:39 +00:00
parent 84358ba9a3
commit 0f4f36dcf9
7 changed files with 87 additions and 72 deletions

View File

@ -1,3 +1,13 @@
2009-02-17 Evi Vanoost <vanooste@rcbi.rochester.edu>
* 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 <slerena@artica.es> 2009-02-17 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: treport_content, changed report type to string to allow * pandoradb.sql: treport_content, changed report type to string to allow

View File

@ -40,7 +40,7 @@ echo '</div>';
$sql = sprintf ("SELECT COUNT(id_mensaje) FROM tmensajes WHERE id_usuario_destino='%s' AND estado='FALSE';", $config["id_user"]); $sql = sprintf ("SELECT COUNT(id_mensaje) FROM tmensajes WHERE id_usuario_destino='%s' AND estado='FALSE';", $config["id_user"]);
$resultado = get_db_sql ($sql); $resultado = get_db_sql ($sql);
if ($resultado > 0) { if ($resultado > 0) {
echo '<h2>'.__('You have ').'<a href="index.php?sec=messages&sec2=operation/messages/message">'.$resultado. echo '<h2>'.__('You have ').'<a href="index.php?sec=messages&amp;sec2=operation/messages/message">'.$resultado.
'<img src="images/email.png" border="0" />'.__(' unread message(s).').'</a></h2>'; '<img src="images/email.png" border="0" />'.__(' unread message(s).').'</a></h2>';
} }

View File

@ -466,10 +466,20 @@ function get_reports ($id_user) {
* *
* @return string Icon path of the given group * @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); 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. * Get agent id from an agent name.
* *

View File

@ -53,7 +53,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$attributes .= ' disabled="disabled"'; $attributes .= ' disabled="disabled"';
} }
$output .= '<select id="'.$name.'" name="'.$name.'"'.$attributes.'>'; $output .= '<select id="select-'.$name.'" name="'.$name.'"'.$attributes.'>';
if ($nothing != '') { if ($nothing != '') {
$output .= '<option value="'.$nothing_value.'"'; $output .= '<option value="'.$nothing_value.'"';
@ -61,7 +61,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$output .= ' selected="selected"'; $output .= ' selected="selected"';
} }
//You should pass a translated string already //You should pass a translated string already
$output .= '>'.$nothing."</option>"; $output .= '>'.$nothing.'</option>';
} }
if (!empty ($fields)) { if (!empty ($fields)) {

View File

@ -29,7 +29,7 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
global $config; global $config;
$layout = get_db_row ('tlayout', 'id', $id_layout); $layout = get_db_row ('tlayout', 'id', $id_layout);
echo "<div id='layout_map' style='z-index: 0; position:relative; background: url(images/console/background/".$layout["background"]."); width:".$layout["width"]."px; height:".$layout["height"]."px;'>"; echo '<div id="layout_map" style="z-index: 0; position:relative; background: url(images/console/background/'.$layout["background"].'); width:'.$layout["width"].'px; height:'.$layout["height"].'px;">';
$layout_datas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout); $layout_datas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout);
$lines = array (); $lines = array ();
@ -98,56 +98,53 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
// Link to an agent // Link to an agent
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) { if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agent'>"; echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
// Link to a map // Link to a map
} elseif ($layout_data['id_layout_linked']>0){ } elseif ($layout_data['id_layout_linked']>0){
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layout_data['id_layout_linked'].'">'; echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
// A void object // A void object
} else { } else {
echo "<a href='#'>"; echo '<a href="#">';
} }
} }
// Critical (BAD) or ALERT $img_style = array ();
if (($status == 1) OR ($status == 4)){ $img_style["title"] = $layout_data["label"];
if ($layout_data['width'] != "" && $layout_data['width'] != 0)
echo '<img src="images/console/icons/'.$layout_data['image'].'_bad.png" width="'.$layout_data['width'].'" height="'.$layout_data['height'].'" title="'.$layout_data['label'].'">'; if (!empty ($layout_data["width"])) {
else $img_style["width"] = $layout_data["width"];
echo '<img src="images/console/icons/'.$layout_data['image'].'_bad.png" }
title="'.$layout_data['label'].'">'; if (!empty ($layout_data["height"])) {
$img_style["height"] = $layout_data["height"];
// Normal (OK)
} elseif ($status == 0){
if ($layout_data['width'] != "" && $layout_data['width'] != 0)
echo '<img src="images/console/icons/'.$layout_data['image'].'_ok.png" width="'.$layout_data['width'].'"
height="'.$layout_data['height'].'" title="'.$layout_data['label'].'">';
else
echo '<img src="images/console/icons/'.$layout_data['image'].'_ok.png"
title="'.$layout_data['label'].'">';
// Warning
} elseif ($status == 2){
if ($layout_data['width'] != "" && $layout_data['width'] != 0)
echo '<img src="images/console/icons/'.$layout_data['image'].'_warning.png" width="'.$layout_data['width'].'"
height="'.$layout_data['height'].'" title="'.$layout_data['label'].'">';
else
echo '<img src="images/console/icons/'.$layout_data['image'].'_warning.png"
title="'.$layout_data['label'].'">';
// Other (GREY)
} else {
if ($layout_data['width'] != "" && $layout_data['width'] != 0)
echo '<img src="images/console/icons/'.$layout_data['image'].'.png" width="'.$layout_data['width'].'"
height="'.$layout_data['height'].'" title="'.$layout_data['label'].'">';
else
echo '<img src="images/console/icons/'.$layout_data['image'].'.png"
title="'.$layout_data['label'].'">';
} }
$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 "</a>"; echo "</a>";
// Draw label // Print label
echo "<br />"; echo "<br />";
echo $layout_data['label']; echo $layout_data['label'];
echo "</div>"; echo "</div>";
@ -160,12 +157,12 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
echo '<div style="z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">'; echo '<div style="z-index: 1; color: '.$layout_data['label_color'].'; position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
if ($show_links) { if ($show_links) {
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) { if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) {
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'&tab=data">'; echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'&amp;tab=data">';
} else { } else {
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layout_data['id_layout_linked'].'">'; echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data['id_layout_linked'].'">';
} }
} }
echo '<img src="reporting/fgraph.php?tipo=sparse&id='.$layout_data['id_agente_modulo'].'&label='.$layout_data['label'].'&height='.$layout_data['height'].'&width='.$layout_data['width'].'&period='.$layout_data['period'].'" title="'.$layout_data['label'].'" border="0">'; print_image ("reporting/fgraph.php?tipo=sparse&amp;id=".$layout_data['id_agente_modulo']."&amp;label=".$layout_data['label']."&amp;height=".$layout_data['height']."&amp;width=".$layout_data['width']."&amp;period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0));
echo "</a>"; echo "</a>";
echo "</div>"; echo "</div>";
@ -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: /* If you want lines in the map, call using Javascript:
draw_lines (lines, id_div); draw_lines (lines, id_div);
on body load, where id_div is the id of the div which holds the map */ on body load, where id_div is the id of the div which holds the map */
echo "\n".'<script type="text/javascript">'."\n"; echo '<script type="text/javascript">/* <![CDATA[ */'."\n";
echo 'var lines = Array ();'."\n"; echo 'var lines = Array ();'."\n";
foreach ($lines as $line) { foreach ($lines as $line) {
echo 'lines.push (eval ('.json_encode ($line)."));\n"; echo 'lines.push (eval ('.json_encode ($line).'));'."\n";
} }
echo '</script>'."\n"; echo '/* ]]> */</script>';
} }
// End main div // End main div
echo "</div>"; echo "</div>";

View File

@ -29,7 +29,7 @@ $layouts = get_db_all_rows_in_table ('tlayout','name');
if ($layouts === false) if ($layouts === false)
$layouts = array (); $layouts = array ();
$table->width = '500px'; $table->width = 500;
$table->data = array (); $table->data = array ();
$table->head = array (); $table->head = array ();
$table->head[0] = __('Name'); $table->head[0] = __('Name');
@ -44,11 +44,10 @@ foreach ($layouts as $layout) {
} }
$data = array (); $data = array ();
$data[0] = '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='. $data[0] = '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;id='.
$layout['id'].'">'.$layout['name'].'</a>'; $layout['id'].'">'.$layout['name'].'</a> ';
$data[1] = '<img src="images/'.dame_grupo_icono($layout["id_group"]).'.png" $data[1] = print_image ("images/".get_group_icon ($layout["id_group"]).".png", true, array ("title" => get_group_name ($layout["id_group"])));
title="'.get_group_name ($layout["id_group"]).'"> '; $data[1] .= " ".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']); $data[2] = get_db_value ('COUNT(*)', 'tlayout_data', 'id_layout', $layout['id']);
array_push ($table->data, $data); array_push ($table->data, $data);

View File

@ -58,12 +58,12 @@ if (! give_acl ($config["id_user"], $id_group, "AR")) {
echo "<h1>".$layout_name."&nbsp;&nbsp;"; echo "<h1>".$layout_name."&nbsp;&nbsp;";
if ($config["pure"] == 0) { if ($config["pure"] == 0) {
echo "<a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$id_layout&refr=$refr&pure=1'>"; echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.$refr.'&amp;pure=1">';
echo "<img src='images/monitor.png' title='".__('Full screen mode')."'>"; print_image ("images/monitor.png", false, array ("title" => __('Full screen mode')));
echo "</a>"; echo "</a>";
} else { } else {
echo "<a href='index.php?sec=visualc&sec2=operation/visual_console/render_view&id=$id_layout&pure=0&refr=$refr'>"; echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;id='.$id_layout.'&amp;refr='.$refr.'">';
echo "<img src='images/monitor.png' title='".__('Back to normal mode')."'>"; print_image ("images/monitor.png", false, array ("title" => __('Back to normal mode')));
echo "</a>"; echo "</a>";
} }
@ -71,38 +71,34 @@ echo '</h1>';
print_pandora_visual_map ($id_layout); print_pandora_visual_map ($id_layout);
$values = array (); $values = array ();
$values[5] = "5 ". __('Seconds'); $values[5] = "5 ". __('seconds');
$values[30] = "30 ". __('Seconds'); $values[30] = "30 ". __('seconds');
$values[60] = "1 ". __('minutes'); $values[60] = "1 ". __('minutes');
$values[120] = "2 ". __('minutes'); $values[120] = "2 ". __('minutes');
$values[300] = "5 ". __('minutes'); $values[300] = "5 ". __('minutes');
$values[600] = "10 ". __('minutes'); $values[600] = "10 ". __('minutes');
$values[1800] = "30 ". __('minutes'); $values[1800] = "30 ". __('minutes');
$table->width = '500px'; $table->width = 500;
$table->data = array (); $table->data = array ();
$table->data[0][0] = __('Autorefresh time'); $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); $table->data[0][2] = print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
echo "<div style='height:30px'>"; echo '<div style="height:30px">&nbsp;</div>';
echo "</div>";
if ($config['pure'] && $refr != 0) { if ($config['pure'] && $refr != 0) {
echo '<div id="countdown"><br />'; echo '<div id="countdown"><br /></div>';
echo '</div>';
} }
echo "<div style='height:30px'>"; echo '<div style="height:30px">&nbsp;</div>';
echo "</div>";
echo '<form method="post" action="index.php?sec=visualc&sec2=operation/visual_console/render_view">'; echo '<form method="post" action="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view">';
print_input_hidden ('pure', $config["pure"]); print_input_hidden ('pure', $config["pure"]);
print_input_hidden ('id', $id_layout); print_input_hidden ('id', $id_layout);
print_table ($table); print_table ($table);
echo "</form>"; echo '</form>';
if ($config["pure"] && $refr != 0) { if ($config["pure"] && $refr != 0) {
$config['jquery'][] = 'countdown'; $config['jquery'][] = 'countdown';
@ -111,6 +107,7 @@ if ($config["pure"] && $refr != 0) {
$config['js'][] = 'pandora_visual_console'; $config['js'][] = 'pandora_visual_console';
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () { $(document).ready (function () {
<?php if ($config["pure"] && $refr != 0): ?> <?php if ($config["pure"] && $refr != 0): ?>
t = new Date(); t = new Date();
@ -119,4 +116,5 @@ $(document).ready (function () {
<?php endif; ?> <?php endif; ?>
draw_lines (lines, 'layout_map'); draw_lines (lines, 'layout_map');
}); });
/* ]]> */
</script> </script>