is displayed. Either on a listing or in detail.
***********************
** FILE NAME : notification.php
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
***********************
** 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
**
** DESCRIPTION : Display and handle notifications.
** There are two major views to this page: either a list of
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Dec 12, 2002
********************************
** 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 $
** 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
All web interface pages use the page class.
Revision 1.1 2003/02/05 09:48:14 arjen
******************************/
******************************/
-// 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');
ini_set('include_path', '.:./classes:../phpclasses');
function add_action($db, $note, $actionid, $remark)
{
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)
$action = pg_fetch_object($r, 0);
if ($action->statuscode != "" && $note->statuscode != $action->statuscode)
function display_notification($note)
{
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 "<h1>Notification " . $note->notificationid . " for " . $obj->objectname . "</h1><hr>";
$obj = pg_fetch_object($res, 0);
echo "<h1>Notification " . $note->notificationid . " for " . $obj->objectname . "</h1><hr>";
- $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
$issue = pg_fetch_object($r, 0);
$r = pg_exec($this->database, "SELECT statusname FROM status
echo "<tr><th>Time</th><th>User</th><th>Remarks</th></tr>";
$r = pg_exec($this->database, "SELECT actionid, username, timestamp, remarks
echo "<tr><th>Time</th><th>User</th><th>Remarks</th></tr>";
$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);
for ($row = 0; $row < pg_numrows($r); $row++)
{
$action_user = pg_fetch_object($r, $row);
+ echo "<tr><td class='time'>";
echo $action_user->timestamp;
echo "</td><td>";
echo $action_user->username;
echo $action_user->timestamp;
echo "</td><td>";
echo $action_user->username;
$r = pg_exec($this->database, "SELECT * FROM parameter WHERE paramid IN
( SELECT paramid FROM parameter_notification
$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 "<h2>Parameters involved in this notification</h2>";
if (pg_numrows($r) > 0)
{
echo "<h2>Parameters involved in this notification</h2>";
for ($row = 0; $row < pg_numrows($r); $row++)
{
$p = pg_fetch_object($r, $row);
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 "<tr><td>";
echo $p->class;
echo "<tr><td>";
echo $p->class;
$r = pg_exec($this->database, "SELECT * FROM log WHERE logid IN
( SELECT logid FROM log_notification
$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 "<h2>Log entries involved in this notification</h2>";
if (pg_numrows($r) > 0)
{
echo "<h2>Log entries involved in this notification</h2>";
/* Display a list of possible actions */
/* Display a list of possible actions */
- echo "<h2>Select on of the actions to take below</h2>";
+ echo "<h2>Select one of the actions to take below</h2>";
$first = true;
foreach ($possible_action[$note->statuscode] as $act)
{
$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 "<input type='radio' name='actionid'";
if ($first)
{
echo "<input type='radio' name='actionid'";
if ($first)
{
$res = pg_exec($this->database, "SELECT notificationid, timestamp, type_of_issueid,
statuscode, priority
$res = pg_exec($this->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 "<table>";
$row = 0;
while ($row < pg_numrows($res))
{
$note = pg_fetch_object($res, $row);
echo "<table>";
$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 "<tr><td align='center'>\n";
echo $note->timestamp;
$issue = pg_fetch_object($r, 0);
echo "<tr><td align='center'>\n";
echo $note->timestamp;
echo $note->priority;
echo "</td></tr>\n";
$row++;
echo $note->priority;
echo "</td></tr>\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");
// Display all information about a single notification['notid']
// 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);
$note = pg_fetch_object($res, 0);
+ //Gather proof that the notification has been presented
if ($note->statuscode == 'new')
{
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 "<hr>";
$this->notification_form($note);
$this->display_notification($note);
echo "<hr>";
$this->notification_form($note);