2007-06-12 Sancho Lerena <slerena@artica.es>

* include/functions_reporting.php: Added event reporting and alert
        reporting items for user reports. Now user reports is fully
        operative !

        * include/functions.php: Added new function to manage human
        strings datetime timestamps with differences.

        * index.php: UTF-8 is now the codeset by default, also a few
        comments adjusted, included last version number, now in index.php

        * operation/events/events.php: More minor adjusts in HTML.

        * operation/agentes/estado_alertas.php,
        operation/agentes/status_monitor.php
        operation/agentes/estado_agente.php: Agent names are in UPPERCASE
        and other minor adjustements.

        * operation/messages/message.php: Fixed code, now uses table
        styles and more width. Fixes many table endings !!

        * operation/reporting/reporting_viewer.php: Finished.

        * operation/menu.php: Removed old agent statistics from menu.

        * general/logon_ok.php: Better render of new messages. News shown
        by timestamp order.

        * godmode/agentes/modificar_agente.php: Agent name in uppercase.

        * godmode/agentes/alert_manager.php: Threshold timestamp now uses
        better function to do this.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@505 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-06-12 18:10:57 +00:00
parent e147922f36
commit b3fad7dbd4
14 changed files with 261 additions and 126 deletions

View File

@ -1,5 +1,37 @@
2007-06-12 Sancho Lerena <slerena@artica.es>
* include/functions_reporting.php: Added event reporting and alert
reporting items for user reports. Now user reports is fully
operative !
* include/functions.php: Added new function to manage human
strings datetime timestamps with differences.
* index.php: UTF-8 is now the codeset by default, also a few
comments adjusted, included last version number, now in index.php
* operation/events/events.php: More minor adjusts in HTML.
* operation/agentes/estado_alertas.php,
operation/agentes/status_monitor.php
operation/agentes/estado_agente.php: Agent names are in UPPERCASE
and other minor adjustements.
* operation/messages/message.php: Fixed code, now uses table
styles and more width. Fixes many table endings !!
* operation/reporting/reporting_viewer.php: Finished.
* operation/menu.php: Removed old agent statistics from menu.
* general/logon_ok.php: Better render of new messages. News shown
by timestamp order.
* godmode/agentes/modificar_agente.php: Agent name in uppercase.
* godmode/agentes/alert_manager.php: Threshold timestamp now uses
better function to do this.
* include/languages/language_en.php: New text
* include/functions.php: Now all functions to render timeframes

View File

@ -33,12 +33,10 @@
$resultado = mysql_query ($sql);
$row = mysql_fetch_array ($resultado);
if ($row["COUNT(*)"] != 0){
echo '
<div style="margin-left: 8px">' . $lang_label["new_message_bra"] . '
<b><a href="index.php?sec=messages&sec2=operation/messages/message">'
.$row["COUNT(*)"] . '</b> <img src="images/mail.gif" border="0">'
.$lang_label["new_message_ket"] . '</a>
</div>';
echo "<h2>". $lang_label["new_message_bra"] . '
<a href="index.php?sec=messages&sec2=operation/messages/message">'
.$row["COUNT(*)"] . ' <img src="images/email.png" border="0">'
.$lang_label["new_message_ket"] . '</a></h2>';
}
echo "<table width=95%>";
@ -47,7 +45,7 @@
// Site news !
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo '<h2>' . $lang_label["site_news"] . '</h2>';
$sql_news = "SELECT * FROM tnews ORDER by timestamp LIMIT 3";
$sql_news = "SELECT * FROM tnews ORDER by timestamp DESC LIMIT 3";
if ($result_news = mysql_query ($sql_news)){
echo '<table cellpadding="4" cellspacing="4" width="270" class="databox">';
while ($row = mysql_fetch_array ($result_news)) {

View File

@ -210,7 +210,7 @@ _data_<br>
<select name="time_threshold" style="margin-right: 60px;">
<?php
if ($alerta_time_threshold != ""){
echo "<option value='".$alerta_time_threshold."'>".give_human_time($alerta_time_threshold)."</option>";
echo "<option value='".$alerta_time_threshold."'>".human_time_description($alerta_time_threshold)."</option>";
}
?>
<option value=300>5 Min.</option>

View File

@ -172,7 +172,7 @@ if (mysql_num_rows($result)){
echo "<tr><td class='$tdcolor'>
<b><a href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=main&
id_agente=".$row["id_agente"]."'>".$row["nombre"]."</a></b></td>";
id_agente=".$row["id_agente"]."'>".strtoupper($row["nombre"])."</a></b></td>";
// Operating System icon
echo "<td class='$tdcolor' align='center'>
<img src='images/".dame_so_icon($row["id_os"])."'></td>";

View File

@ -482,4 +482,14 @@ function human_time_description ($period){
return $period_label;
}
// This function returns MYSQL Date from now - seconds passed as parameter
function human_date_relative ( $seconds ) {
$ahora=date("Y/m/d H:i:s");
$ahora_s = date("U");
$ayer = date ("Y/m/d H:i:s", $ahora_s - $seconds);
return $ayer;
}
?>

View File

@ -140,4 +140,98 @@ function general_stats ( $id_user, $id_group = 0) {
return $data;
}
function event_reporting ($id_agent, $period){
require("config.php");
require ("include/languages/language_".$language_code.".php");
$id_user=$_SESSION["id_usuario"];
global $REMOTE_ADDR;
$ahora = date("U");
$mytimestamp = $ahora - $period;
echo "<table cellpadding='4' cellspacing='4' width='100%' class='databox'>";
echo "<tr>";
echo "<th>".$lang_label["status"]."</th>";
echo "<th>".$lang_label["event_name"]."</th>";
echo "<th>".$lang_label["id_user"]."</th>";
echo "<th>".$lang_label["timestamp"]."</th>";
$color = 1;
$id_evento = 0;
$sql2="SELECT * FROM tevento WHERE id_agente = $id_agent AND utimestamp > '$mytimestamp'";
// Make query for data (all data, not only distinct).
$result2=mysql_query($sql2);
while ($row2=mysql_fetch_array($result2)){
$id_grupo = $row2["id_grupo"];
if (give_acl($id_user, $id_grupo, "IR") == 1){ // Only incident read access to view data !
$id_group = $row2["id_grupo"];
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr><td class='$tdcolor' align='center'>";
if ($row2["estado"] == 0)
echo "<img src='images/dot_red.gif'>";
else
echo "<img src='images/dot_green.gif'>";
echo "<td class='$tdcolor'>".$row2["evento"];
echo "<td class='$tdcolor'>";
if ($row2["estado"] <> 0)
echo substr($row2["id_usuario"],0,8)."<a href='#' class='tip'> <span>".dame_nombre_real($row2["id_usuario"])."</span></a>";
echo "<td class='".$tdcolor."f9'>".$row2["timestamp"];
echo "</td></tr>";
}
}
echo "</table>";
}
function alert_reporting ($id_agent_module){
require("config.php");
require ("include/languages/language_".$language_code.".php");
$query_gen='SELECT talerta_agente_modulo.alert_text, talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, tagente_modulo.nombre, talerta_agente_modulo.dis_max, talerta_agente_modulo.dis_min, talerta_agente_modulo.max_alerts, talerta_agente_modulo.time_threshold, talerta_agente_modulo.min_alerts, talerta_agente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo FROM tagente_modulo, talerta_agente_modulo WHERE tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo and talerta_agente_modulo.id_agente_modulo = '.$id_agent_module.' ORDER BY tagente_modulo.nombre';
$result_gen=mysql_query($query_gen);
if (mysql_num_rows ($result_gen)) {
echo "<table cellpadding='4' cellspacing='4' width='100%' border=0 class='databox'>";
echo "<tr>
<th>".$lang_label["status"]."</th>
<th>".$lang_label["description"]."</th>
<th>".$lang_label["time_threshold"]."</th>
<th>".$lang_label["last_fired"]."</th>
<th>".$lang_label["times_fired"]."</th>";
$color=1;
while ($data=mysql_fetch_array($result_gen)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "<tr>";
if ($data["times_fired"] <> 0)
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_red.gif'></td>";
else
echo "<td class='".$tdcolor."' align='center'><img src='images/dot_green.gif'></td>";
echo "<td class='".$tdcolor."'>".$data["descripcion"]."</td>";
echo "<td align='center' class='".$tdcolor."'>".human_time_description($data["time_threshold"]);
if ($data["last_fired"] == "0000-00-00 00:00:00") {
echo "<td align='center' class='".$tdcolor."f9'>".$lang_label["never"]."</td>";
}
else {
echo "<td align='center' class='".$tdcolor."f9'>".human_time_comparation ($data["last_fired"])."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".$data["times_fired"]."</td>";
}
echo '</table>';
}
}
?>

View File

@ -3,16 +3,15 @@
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Main PHP/SQL code development, project architecture and management.
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP code additions
// Copyright (c) 2006 Jose Navarro <jnavarro@jnavarro.net>
// Additions to code for Pandora FMS 1.2 graph code
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ -24,16 +23,14 @@
// Pandora FMS 1.x uses icons from famfamfam, licensed under CC Atr. 2.5
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
// Pandora FMS 1.x uses Pear Image::Graph code
// Pandora FMS shares much of it's code with project Babel Enterprise, also a
// FreeSoftware Project coded by some of the people who makes Pandora FMS
//Pandora Version
$build_version="PC070529";
//Pandora Version, if not defined here it would take from config.php
$build_version="PC070612";
$pandora_version="v1.3 devel";
global $build_version;
global $pandora_version;
// Set to 1 to do not check for installer or config file
// Set to 1 to do not check for installer or config file (for development!).
$develop_bypass = 1;
if ($develop_bypass != 1){
@ -70,8 +67,6 @@ require "include/functions.php"; // Including funcions.
require "include/functions_db.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
@ -95,7 +90,7 @@ if ( (isset ($_GET["refr"])) || (isset($_POST["refr"])) ){
?>
<title>Pandora FMS - <?php echo $lang_label["header_title"]; ?></title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
<meta http-equiv="content-type" content="text/html; charset=utf8">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="author" content="Sancho Lerena, Raul Mateos">

View File

@ -124,7 +124,7 @@ if (comprueba_login() == 0) {
while ($row=mysql_fetch_array($result)){
$intervalo = $row["intervalo"]; // Interval in seconds
$id_agente = $row['id_agente'];
$nombre_agente = $row["nombre"];
$nombre_agente = strtoupper($row["nombre"]);
$direccion_agente =$row["direccion"];
$id_grupo=$row["id_grupo"];
$id_os = $row["id_os"];

View File

@ -99,7 +99,7 @@ if (isset($_GET["id_agente"])){
echo "<td class='".$tdcolor."'>".$mymin."</td>";
echo "<td class='".$tdcolor."'>".$mymax."</td>";
}
echo "<td align='center' class='".$tdcolor."'>".human_time_comparation($data["time_threshold"]);
echo "<td align='center' class='".$tdcolor."'>".human_time_description($data["time_threshold"]);
if ($data["last_fired"] == "0000-00-00 00:00:00") {
@ -169,7 +169,7 @@ if (isset($_GET["id_agente"])){
while ($row=mysql_fetch_array($result)){ //while there are agents
if ($row["disabled"] == 0) {
$id_agente = $row['id_agente'];
$nombre_agente = $row["nombre"];
$nombre_agente = strtoupper($row["nombre"]);
$query_gen='SELECT talerta_agente_modulo.id_alerta,
talerta_agente_modulo.descripcion,
talerta_agente_modulo.last_fired,

View File

@ -151,7 +151,7 @@ if (comprueba_login() == 0) {
$string=$string."<a href='index.php?sec=estado&
sec2=operation/agentes/ver_agente&
id_agente=".$data["id_agente"]."'>".
substr(dame_nombre_agente($data["id_agente"]),0,21)."</a></b></td>";
strtoupper(substr(dame_nombre_agente($data["id_agente"]),0,21))."</a></b></td>";
$string=$string."<td class='$tdcolor'>";
$string=$string."
<img src='images/".show_icon_type($data["id_tipo_modulo"])."' border=0>

View File

@ -237,7 +237,7 @@ if ($total_events > 0){
echo "<br>";
echo "<br>";
echo "<table cellpadding='3' cellspacing='3' width='775'>";
echo "<table cellpadding='4' cellspacing='4' width='750' class='databox'>";
echo "<tr>";
echo "<th>".$lang_label["status"]."</th>";
echo "<th>".$lang_label["event_name"]."</th>";
@ -319,7 +319,6 @@ if ($total_events > 0){
$offset_counter++;
}
echo "<tr><td colspan='8'><div class='raya'></div></td></tr>";
echo "<tr><td colspan='8' align='right'>";
echo "<input class='sub' type='submit' name='updatebt' value='".$lang_label["validate"]."'> ";

View File

@ -81,12 +81,14 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/exportdata' class='mn'>".$lang_label["export_data"]."</a></li></ul></div>";
/*
if (isset($_GET["sec2"]) && $_GET["sec2"] == "operation/agentes/estadisticas") {
echo "<div class='arrows'>";
} else {
echo "<div class='arrow'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=estado&amp;sec2=operation/agentes/estadisticas' class='mn'>". $lang_label["statistics"]. "</a></li></ul></div>";
*/
}
// Visual console

View File

@ -51,8 +51,7 @@ function create_message_g($usuario_origen, $usuario_destino, $subject, $mensaje)
//First Queries
$iduser=$_SESSION['id_usuario'];
$sql1='SELECT * FROM tusuario WHERE id_usuario !="'.$iduser.'"';
$resultado=mysql_query($sql1);
$sql2='SELECT COUNT(*) FROM tmensajes WHERE id_usuario_destino="'.$iduser.'" AND estado="FALSE";';
$resultado2=mysql_query($sql2);
$row2=mysql_fetch_array($resultado2);
@ -61,17 +60,17 @@ $resultado3=mysql_query($sql3);
if (isset($_GET["nuevo_mensaje"])){
// Create message
$usuario_destino = entrada_limpia($_POST["u_destino"]);
$subject = entrada_limpia($_POST["subject"]);
$mensaje = entrada_limpia($_POST["mensaje"]);
$usuario_destino = give_parameter_post ("u_destino");
$subject = give_parameter_post ("subject");
$mensaje = give_parameter_post ("mensaje");
create_message($iduser, $usuario_destino, $subject, $mensaje);
}
if (isset($_GET["nuevo_mensaje_g"])){
// Create message to groups
$grupo_destino = entrada_limpia($_POST["g_destino"]);
$subject = entrada_limpia($_POST["subject"]);
$mensaje = entrada_limpia($_POST["mensaje"]);
$grupo_destino = give_parameter_post ("g_destino");
$subject = give_parameter_post ("subject");
$mensaje = give_parameter_post ("mensaje");
$sql= 'SELECT id_usuario FROM tusuario_perfil WHERE id_grupo ='. $grupo_destino;
$result = mysql_query($sql);
@ -79,104 +78,100 @@ if (isset($_GET["nuevo_mensaje_g"])){
while ($row=mysql_fetch_array($result)){
$error=create_message_g($iduser, $row["id_usuario"], $subject, $mensaje);
}
if ($error==0) {
echo "<h3 class='suc'>".$lang_label["message_ok"]."</h3>";
} else {
echo "<h3 class='error'>".$lang_label["message_no"]."</h3>";
}
} else {
echo "<h3 class='error'>".$lang_label["message_no"]."</h3>";
if ($error==0) echo "<h3 class='suc'>".$lang_label["message_ok"]."</h3>";
else echo "<h3 class='error'>".$lang_label["message_no"]."</h3>";
}
else {echo "<h3 class='error'>".$lang_label["message_no"]."</h3>";}
}
if (isset($_GET["nuevo"]) || isset($_GET["nuevo_g"])){
if (isset($_GET["nuevo"])){ //create message
echo '<h2>'.$lang_label["messages"].' &gt; ';
echo $lang_label["new_message"].'<a href="help/'.$help_code.'/chap2.php#25" target="_help" class="help">&nbsp;<span>'.$lang_label["help"].'</span></a></h2>';
echo '<h2>'.$lang_label["new_message"].'</h2>';
echo '
<form name="new_mes" method="POST" action="index.php?sec=messages&sec2=operation/messages/message&nuevo_mensaje=1">
<table>
<table width=600 class="databox_color" cellpadding=4 cellspacing=4>
<tr><td class="datos">'.$lang_label["m_from"].':</td><td class="datos"><b>'.$iduser.'</b></td></tr>
<tr><td class="datos2">'.$lang_label["m_to"].':</td><td class="datos2">';
<tr><td class="datos2">'.$lang_label["m_to"].':</td><td>';
if (isset($_POST["u_destino"])) {
echo '<b>'.$_POST["u_destino"].'</b><input type="hidden" name="u_destino" value='.$_POST["u_destino"].'>';
}
else{
echo '<select name="u_destino" class="w120">';
while ($row=mysql_fetch_array($resultado))
{echo "<option value='".$row["id_usuario"]."'>".$row["id_usuario"]."</option>";}
echo '<select name="u_destino" width="120">';
$sql_1="SELECT * FROM tusuario_perfil WHERE id_usuario = '$iduser'";
$result_1=mysql_query($sql_1);
while ($row_1=mysql_fetch_array($result_1)){
$sql_2="SELECT * FROM tusuario_perfil WHERE id_grupo = ".$row_1["id_grupo"];
$result_2=mysql_query($sql_2);
while ($row_2=mysql_fetch_array($result_2)){
if (give_acl($row_2["id_usuario"], $row_2["id_grupo"], "IR")==1)
echo "<option value='".$row_2["id_usuario"]."'>".$row_2["id_usuario"]."&nbsp;&nbsp;";
}
}
echo '</select>';
}
echo '</td></tr>
<tr><td class="datos">'.$lang_label["subject"].':</td><td class="datos">';
if (isset($_POST["subject"])) {
echo '</b><input name="subject" value="'.$_POST["subject"].'" width="255px">';
}
else echo '<input name="subject" width="255px">';
if (isset($_POST["subject"]))
echo '</b><input name="subject" value="'.$_POST["subject"].'" size=70>';
else
echo '<input name="subject" size=60>';
echo '</td></tr>
<tr><td class="datos2" colspan="2">'.$lang_label["message"].':</td></tr>
<tr><td class="datos" colspan="4"><textarea name="mensaje" rows="10" width="540px">';
<tr><td class="datos2">'.$lang_label["message"].':</td>
<td class="datos2"><textarea name="mensaje" rows="15" cols=70 >';
if (isset($_POST["mensaje"])) {
echo $_POST["mensaje"];
}
echo '</textarea></td></tr>
<tr><td colspan="2"><div class="noraya"></div></td></tr>
<tr><td colspan="2" align="right">
<input type="submit" class="sub wand" name="send_mes" value="'.$lang_label["send_mes"].'"></form></td></tr>';
</table>
<table width=600 cellspacing=4 cellpadding=4><tr><td align=right>
<input type="submit" class="sub next" name="send_mes" value="'.$lang_label["send_mes"].'"></form></table>';
}
if (isset($_GET["nuevo_g"])){
echo '<h2>'.$lang_label["messages"].' &gt; ';
echo $lang_label["new_message_g"].'<a href="help/'.$help_code.'/chap2.php#251" target="_help" class="help">&nbsp;<span>'.$lang_label["help"].'</span></a></h2>';
echo '<h2>'.$lang_label["new_message_g"].'<a href="help/'.$help_code.'/chap2.php#251" target="_help" class="help">&nbsp;<span>'.$lang_label["help"].'</span></a></h2>';
echo '
<form name="new_mes" method="post" action="index.php?sec=messages&sec2=operation/messages/message&nuevo_mensaje_g=1">
<table>
<table class="databox_color" cellpadding=4 cellspacing=4>
<tr><td class="datos">'.$lang_label["m_from"].':</td><td class="datos"><b>'.$iduser.'</b></td></tr>
<tr><td class="datos2">'.$lang_label["m_to"].':</td><td class="datos2">';
echo '<select name="g_destino" class="w130">';
while ($row3=mysql_fetch_array($resultado3))
#if ($row3["id_grupo"] != 1){
{echo "<option value='".$row3["id_grupo"]."'>".$row3["nombre"]."</option>";}
#}
$sql_1="SELECT id_grupo FROM tusuario_perfil WHERE id_usuario = '$iduser'";
$result_1=mysql_query($sql_1);
while ($row_1=mysql_fetch_array($result_1)){
echo "<option value=".$row_1["id_grupo"].">".dame_nombre_grupo($row_1["id_grupo"]);
}
echo '</select>';
echo '</td></tr>
<tr><td class="datos">'.$lang_label["subject"].':</td><td class="datos"><input name="subject" width="255px"></td></tr>
<tr><td class="datos2">'.$lang_label["message"].':</td></tr>
<tr><td class="datos" colspan="4"><textarea name="mensaje" rows="10" width="540px"></textarea></td></tr>
<tr><td colspan="2" align="right">
<input type="submit" class="sub wand" name="send_mes" value="'.$lang_label["send_mes"].'"></form></td></tr>';
<tr><td class="datos">'.$lang_label["subject"].':</td><td class="datos"><input name="subject" size=60></td></tr>
<tr><td class="datos2">'.$lang_label["message"].':</td>
<td class="datos"><textarea name="mensaje" rows="12" cols=60></textarea></td></tr>
</table>
<input type="submit" class="sub create" name="send_mes" value="'.$lang_label["send_mes"].'"></form>';
}
}
else {
// Get list of messages for this user
if (isset($_GET["borrar"])){
$id_mensaje = $_GET["id_mensaje"];
$sql5='DELETE FROM tmensajes WHERE id_usuario_destino="'.$iduser.'" AND id_mensaje="'.$id_mensaje.'"';
$resultado5=mysql_query($sql5);
if ($resultado5) {
echo "<h3 class='suc'>".$lang_label["del_message_ok"]."</h3>";
} else {
echo "<h3 class='suc'>".$lang_label["del_message_no"]."</h3>";
}
if ($resultado5) {echo "<h3 class='suc'>".$lang_label["del_message_ok"]."</h3>";}
else {echo "<h3 class='suc'>".$lang_label["del_message_no"]."</h3>";}
}
//List
echo '<h2>'.$lang_label["messages"].' &gt; ';
echo $lang_label["read_mes"]."<a href='help/".$help_code."/chap2.php#25' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h2>";
echo "<h2>".$lang_label["read_mes"]."</h2>";
if ($row2["COUNT(*)"]!=0){
echo $lang_label["new_message_bra"]."<b> ".$row2["COUNT(*)"]."</b> <img src='images/mail.gif'>".$lang_label["new_message_ket"]."<br><br>";
echo "<p>";
echo $lang_label["new_message_bra"]."<b> ".$row2["COUNT(*)"]."</b> <img src='images/mail.gif'>".$lang_label["new_message_ket"]."</p>";
}
$sql3='SELECT * FROM tmensajes WHERE id_usuario_destino="'.$iduser.'"';
$sql3='SELECT * FROM tmensajes WHERE id_usuario_destino="'.$iduser.'" ORDER BY timestamp desc';
$resultado3=mysql_query($sql3);
$color=1;
if (mysql_num_rows($resultado3)) {
echo "
<table width='550px'><tr>
<th>".$lang_label["read"]."</th>
<th>".$lang_label["sender"]."</th>
<th>".$lang_label["subject"]."</th>
<th>".$lang_label["timestamp"]."</th>
<th>".$lang_label["delete"]."</th></tr>";
echo "<table width=650 class='databox' cellpadding=4 cellspacing=4><tr><th>".$lang_label["read"]."</th><th>".$lang_label["sender"]."</th><th>".$lang_label["subject"]."</th><th>".$lang_label["timestamp"]."</th><th>".$lang_label["delete"]."</th></tr>";
while ($row3=mysql_fetch_array($resultado3)){
if ($color == 1){
$tdcolor = "datos";
@ -187,31 +182,28 @@ else {
$color = 1;
}
echo "<tr>";
if ($row3["estado"]==1) {
echo "<td align='center' class='$tdcolor'>
<img src='images/read.gif' border=0></td>";
} else {
echo "<td align='center' class='$tdcolor'>
<img src='images/unread.gif' border=0></td>";
}
if ($row3["estado"]==1)
echo "<td align='center' class='$tdcolor'><img src='images/email_open.png' border=0></td>";
else
echo "<td align='center' class='$tdcolor'><img src='images/email_go.png' border=0></td>";
echo "<td class='$tdcolor'>";
echo "<b><a href=index.php?sec=usuarios&sec2=operation/users/user_edit&ver=".$row3["id_usuario_origen"].">".$row3["id_usuario_origen"]."</b></td>
<td class='".$tdcolor."'><a href='index.php?sec=messages&sec2=operation/messages/message&leer=1&id_mensaje=".$row3["id_mensaje"]."'>";
echo "<a href=index.php?sec=usuarios&sec2=operation/users/user_edit&ver=".$row3["id_usuario_origen"].">".$row3["id_usuario_origen"]."</td><td class='".$tdcolor."'><a href='index.php?sec=messages&sec2=operation/messages/message&leer=1&id_mensaje=".$row3["id_mensaje"]."'>";
if ($row3["subject"])
echo $row3["subject"]."</a>";
echo "<b>".$row3["subject"]."</b></a>";
else
echo "<i>".$lang_label["no_subject"]."</i></a>";
echo "<b>".$lang_label["no_subject"]."</b></a>";
echo "</a></td><td class='".$tdcolor."'>".$row3["timestamp"]."</td>";
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=messages&sec2=operation/messages/message&borrar=1&id_mensaje=".$row3["id_mensaje"]."'><img src='images/cross.png' border='0'></a></td></tr>";
}
echo "<tr><td colspan='5'><div class='raya'></div></td></tr>";
echo "</table>";
}
else
echo "<div class='nf'>".$lang_label["no_messages"]."</div><table>"; //no messages
echo "<p>".$lang_label["no_messages"]."</p>"; //no messages
//read mess
// Read message
if (isset($_GET["leer"])){
$id_mensaje = $_GET["id_mensaje"];
$sql4='SELECT * FROM tmensajes WHERE id_usuario_destino="'.$iduser.'" AND id_mensaje="'.$id_mensaje.'"';
@ -219,28 +211,39 @@ else {
$resultado4=mysql_query($sql4);
$row4=mysql_fetch_array($resultado4);
$resultado41=mysql_query($sql41);
echo '<table class="databox_color" width=650 cellpadding=4 cellspacing=4>';
echo '<form method="post" name="reply_mes" action="index.php?sec=messages&sec2=operation/messages/message&nuevo">';
echo '<tr><td class="datos">'.$lang_label["from"].':</td><td class="datos"><b>'.$row4["id_usuario_origen"].'</b></td></tr>';
// Subject
echo '<tr><td class="datos2">'.$lang_label["subject"].':</td><td class="datos2" valign="top"><b>'.$row4["subject"].'</b></td></tr>';
// text
echo '<tr><td class="datos" valign="top">'.$lang_label["message"].':</td>
<td class="datos"><textarea name="mensaje" rows="15" cols=70 readonly>'.$row4["mensaje"].'</textarea></td></tr>
</table>';
echo '
<table>
<form method="post" name="reply_mes" action="index.php?sec=messages&sec2=operation/messages/message&nuevo">
<tr><td></td></tr><tr><td class="datos">'.$lang_label["from"].':</td><td class="datos"><b>'.$row4["id_usuario_origen"].'</b></td></tr>
<tr><td class="datos2">'.$lang_label["subject"].':</td><td class="datos2"><b>'.$row4["subject"].'</b></td></tr>
<tr><td class="datos" colspan="2">'.$lang_label["message"].':</td>
<tr><td class="datos2" colspan="2"><textarea name="mensaje" rows="10" width="540px" readonly>'.$row4["mensaje"].'</textarea></td></tr>
<tr><td colspan="2" align="right">
<input type="hidden" name="u_destino" value="'.$row4["id_usuario_origen"].'">
<input type="hidden" name="subject" value="Re: '.$row4["subject"].'">
<input type="hidden" name="mensaje" value="'.$row4["id_usuario_origen"].$lang_label["wrote"].': '.$row4["mensaje"].'">
<input type="submit" class="sub" name="send_mes" value="'.$lang_label["reply"].'">
</form></td></tr>';
<input type="hidden" name="mensaje" value="'.$row4["id_usuario_origen"].$lang_label["wrote"].': '.$row4["mensaje"].'">';
echo "</table>";
echo '<table width=650 cellpadding=4 cellspacing=4>';
echo "<tr><td colspan=2 align=right>";
echo '<input type="submit" class="sub create" name="send_mes" value="'.$lang_label["reply"].'">';
echo '</form>';
echo "</table>";
}
else {
echo '
<tr><td colspan="5"><div class="noraya"></div></td></tr>
<tr><td colspan="5" align="right">
echo '</table>';
echo '<table width=650 cellpadding=4 cellspacing=4>
<tr><td colspan=2 align=right>
<form method="post" name="new_mes" action="index.php?sec=messages&sec2=operation/messages/message&nuevo">
<input type="submit" class="sub next" name="send_mes" value="'.$lang_label["new_message"].'"></form>
</td></tr>';
</td></tr></table>';
}
echo "<br><br>";
echo "<table>";
echo "<tr><td><img src='images/email_open.png'> Message already opened";
echo "<tr><td><img src='images/email_go.png'> Message unreaded";
echo "</table>";
}
echo '</table>';
?>
?>

View File

@ -214,6 +214,8 @@ while ($row = mysql_fetch_array($res)){
$module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module);
$agent_name = dame_nombre_agente_agentemodulo ($id_agent_module);
$id_agent = dame_agente_id ($agent_name);
echo "<tr><td class='datos3'>";
echo "<h4>".$lang_label["event_report"]."</h4>";
echo "<td class='datos3' >";
@ -221,14 +223,15 @@ while ($row = mysql_fetch_array($res)){
echo "<td class='datos3' >";
echo "<h4>".human_time_description($period)."</h4>";
echo "<tr>";
echo "<td colspan=2 class=datos>";
echo "<td class=datos valign='middle' align='right' >";
echo "Not ready yet ;-)";
echo "<td colspan=3 class=datos>";
event_reporting ($id_agent, $period);
echo "</td></tr>";
break;
case 4: // Alert report
$module_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $id_agent_module);
$agent_name = dame_nombre_agente_agentemodulo ($id_agent_module);
echo "<tr><td class='datos3'>";
echo "<h4>".$lang_label["alert_report"]."</h4>";
echo "<td class='datos3' >";
@ -236,9 +239,8 @@ while ($row = mysql_fetch_array($res)){
echo "<td class='datos3' >";
echo "<h4>".human_time_description($period)."</h4>";
echo "<tr>";
echo "<td colspan=2 class=datos>";
echo "<td class=datos valign='middle' align='right' >";
echo "Not ready yet ;-)";
echo "<td colspan=3 class=datos>";
alert_reporting ($id_agent_module);
echo "</td></tr>";
break;
}