X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=blobdiff_plain;f=src%2Fweb%2Fnotification.php;h=c687b6db9e47962f01f4949eae94459c13e50a2c;hp=c2791e8293034ecdbd87b17c3de28361efed184b;hb=80c6c9145265010ce6387958ae4be46121d4bcec;hpb=e8222652419f36701ef87f6bd808d9a0bc0465a7
diff --git a/src/web/notification.php b/src/web/notification.php
index c2791e8..c687b6d 100644
--- a/src/web/notification.php
+++ b/src/web/notification.php
@@ -9,7 +9,7 @@
***********************
** FILE NAME : notification.php
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.2 $
+** VERSION NUMBER : $Revision: 1.3 $
**
** DESCRIPTION : Display and handle notifications.
** There are two major views to this page: either a list of
@@ -30,13 +30,17 @@
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Dec 12, 2002
-** LAST UPDATE : Feb 04, 2003
+** LAST UPDATE : Feb 16, 2003
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: notification.php,v $
- Revision 1.2 2003-02-13 09:01:29 arjen
+ Revision 1.3 2003-02-21 08:49:16 arjen
+ Keep a record of each time a notification
+ is displayed. Either on a listing or in detail.
+
+ Revision 1.2 2003/02/13 09:01:29 arjen
All web interface pages use the page class.
Revision 1.1 2003/02/05 09:48:14 arjen
@@ -44,7 +48,7 @@
******************************/
-// RCSID = "$Id: notification.php,v 1.2 2003-02-13 09:01:29 arjen Exp $";
+// RCSID = "$Id: notification.php,v 1.3 2003-02-21 08:49:16 arjen Exp $";
ini_set('include_path', '.:./classes:../phpclasses');
@@ -78,7 +82,7 @@ function CheckRemark(f)
function add_action($db, $note, $actionid, $remark)
{
- $r = pg_exec($db, "SELECT statuscode FROM action WHERE actionid=" . $actionid);
+ $r = pg_exec($db, "SELECT statuscode FROM action WHERE actionid=CAST('" . $actionid."' AS BIGINT)");
$action = pg_fetch_object($r, 0);
if ($action->statuscode != "" && $note->statuscode != $action->statuscode)
@@ -107,12 +111,12 @@ class notification_page extends page
function display_notification($note)
{
- $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid=" . $note->objectid);
+ $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid= CAST ('" . $note->objectid . "' AS BIGINT)");
$obj = pg_fetch_object($res, 0);
echo "
";
- $r = pg_exec($this->database, "SELECT description from type_of_issue WHERE type_of_issueid ="
- . $note->type_of_issueid);
+ $r = pg_exec($this->database, "SELECT description FROM type_of_issue WHERE type_of_issueid = CAST ('"
+ . $note->type_of_issueid . "' AS BIGINT)");
$issue = pg_fetch_object($r, 0);
$r = pg_exec($this->database, "SELECT statusname FROM status
@@ -131,13 +135,14 @@ class notification_page extends page
echo "
Time
User
Remarks
";
$r = pg_exec($this->database, "SELECT actionid, username, timestamp, remarks
- FROM action_user WHERE notificationid=" . $note->notificationid
- ." ORDER BY timestamp");
+ FROM action_user WHERE notificationid= CAST ('"
+ . $note->notificationid . "' AS BIGINT )"
+ ." ORDER BY timestamp");
for ($row = 0; $row < pg_numrows($r); $row++)
{
$action_user = pg_fetch_object($r, $row);
- echo "
";
+ echo "
";
echo $action_user->timestamp;
echo "
";
echo $action_user->username;
@@ -151,7 +156,8 @@ class notification_page extends page
$r = pg_exec($this->database, "SELECT * FROM parameter WHERE paramid IN
( SELECT paramid FROM parameter_notification
- WHERE notificationid = " . $note->notificationid . ")");
+ WHERE notificationid = CAST ('" . $note->notificationid
+ . "' AS BIGINT) )");
if (pg_numrows($r) > 0)
{
echo "
Parameters involved in this notification
";
@@ -161,8 +167,8 @@ class notification_page extends page
for ($row = 0; $row < pg_numrows($r); $row++)
{
$p = pg_fetch_object($r, $row);
- $res = pg_exec($this->database, "SELECT * from history WHERE paramid=" . $p->paramid
- . " ORDER BY modified");
+ $res = pg_exec($this->database, "SELECT * from history WHERE paramid= CAST('" . $p->paramid
+ . "' AS BIGINT) ORDER BY modified");
echo "
";
echo $p->class;
@@ -190,7 +196,8 @@ class notification_page extends page
$r = pg_exec($this->database, "SELECT * FROM log WHERE logid IN
( SELECT logid FROM log_notification
- WHERE notificationid = " . $note->notificationid . ")");
+ WHERE notificationid = CAST ('"
+ . $note->notificationid . "' AS BIGINT))");
if (pg_numrows($r) > 0)
{
echo "
Log entries involved in this notification
";
@@ -239,13 +246,14 @@ class notification_page extends page
/* Display a list of possible actions */
- echo "
Select on of the actions to take below
";
+ echo "
Select one of the actions to take below
";
$first = true;
foreach ($possible_action[$note->statuscode] as $act)
{
- $action = pg_fetch_object(pg_exec("SELECT description FROM action WHERE actionid=$act"),0);
+ $action = pg_fetch_object(pg_exec("SELECT description FROM action WHERE actionid= CAST('"
+ . $act . "' AS BIGINT)"),0);
echo "database, "SELECT notificationid, timestamp, type_of_issueid,
statuscode, priority
- FROM notification WHERE objectid=" . $_GET['oid']
- . " ORDER BY notificationid");
+ FROM notification WHERE objectid= CAST ('"
+ . $_GET['oid'] ."' AS BIGINT) AND statuscode != 'cls'"
+ . " ORDER BY notificationid");
echo "
";
$row = 0;
while ($row < pg_numrows($res))
{
$note = pg_fetch_object($res, $row);
- $r = pg_exec($this->database, "SELECT name from type_of_issue WHERE type_of_issueid ="
- . $note->type_of_issueid);
+ $r = pg_exec($this->database, "SELECT name from type_of_issue WHERE type_of_issueid = CAST('"
+ . $note->type_of_issueid . "' AS BIGINT)");
$issue = pg_fetch_object($r, 0);
echo "
\n";
$row++;
+
+ //Save evidence that this notification was presented to the user.
+ $note->statuscode = add_action($this->database, $note, 21,
+ "This notification was displayed with others from the same object");
}
echo "
";
}
@@ -309,15 +322,22 @@ class notification_page extends page
// Display all information about a single notification['notid']
- $res = pg_exec($this->database, "SELECT * from notification
- WHERE notificationid=" . $_GET['notid']);
+ $local_sql = "SELECT * from notification
+ WHERE notificationid = CAST('" . $_GET['notid'] . "' AS BIGINT)";
+ $res = pg_exec($this->database, $local_sql);
$note = pg_fetch_object($res, 0);
+ //Gather proof that the notification has been presented
if ($note->statuscode == 'new')
{
- $note->statuscode = add_action($this->database, $note, 2, "Displayed through web interface");
+ $note->statuscode = add_action($this->database, $note, 2,
+ "Notification displayed in detail through web interface");
}
-
+ else
+ {
+ $note->statuscode = add_action($this->database, $note, 20,
+ "Notification redisplayed in detail through web interface");
+ }
$this->display_notification($note);
echo "";
$this->notification_form($note);