***********************
** FILE NAME : notification.php
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.5 $
+** VERSION NUMBER : $Revision: 1.6 $
**
** DESCRIPTION : Display and handle notifications.
** There are two major views to this page: either a list of
/*****************************
$Log: notification.php,v $
- Revision 1.5 2007-11-21 14:38:06 arjen
+ Revision 1.6 2007-12-10 16:27:33 arjen
+ Added an option to perform one action on multiple notifications at once.
+
+ Revision 1.5 2007/11/21 14:38:06 arjen
The buttonbar at the top of each page is now a fixed 'div' element
instead of a framed page.
Contributed by Edwin Nadorp.
******************************/
-// RCSID = "$Id: notification.php,v 1.5 2007-11-21 14:38:06 arjen Exp $";
+// RCSID = "$Id: notification.php,v 1.6 2007-12-10 16:27:33 arjen Exp $";
ini_set('include_path', '.:./classes:../phpclasses');
echo "<table>";
echo '<tr><th>Time</th><th>Number</th><th>Issue</th><th>Status</th><th>Priority</th></tr>';
$row = 0;
- while ($row < pg_numrows($res))
+ while ($row < pg_num_rows($res))
{
$note = pg_fetch_object($res, $row);
$r = pg_exec($this->database, "SELECT name from type_of_issue WHERE type_of_issueid = CAST('"
echo " value='$act'>" . $action->description . "<br>";
}
+ echo "<input type='checkbox' name='act_on_all'>Perform this action on all notifications with the same issue.<br>";
echo "<input type='submit' value='Submit action'>";
echo "</form>";
}
WHERE notificationid=" . $_GET['notid']);
$note = pg_fetch_object($res, 0);
- $note->statuscode = add_action($this->database, $note, $_POST['actionid'], $_POST['remark']);
+ if (!empty($_POST['act_on_all']))
+ {
+ // Perform the action on all notifications with the same object and issue.
+ $res = pg_exec($this->database, "SELECT notificationid, timestamp, type_of_issueid, statuscode
+ FROM notification WHERE objectid= CAST ('"
+ . $note->objectid ."' AS BIGINT) AND statuscode != 'cls'
+ AND type_of_issueid = '" . $note->type_of_issueid
+ . "' ORDER BY notificationid");
+ for ($row = 0; $row < pg_num_rows($res); $row++)
+ {
+ $similar_note = pg_fetch_object($res, $row);
+ $new_statuscode = add_action($this->database, $similar_note,
+ $_POST['actionid'], $_POST['remark']);
+ if ($similar_note->notificationid == $note->notificationid)
+ {
+ $note->statuscode = $new_statuscode;
+ }
+ }
+ }
+ else
+ {
+ $note->statuscode = add_action($this->database, $note, $_POST['actionid'], $_POST['remark']);
+ }
$this->display_notification($note);
echo "<hr>";
$this->notification_form($note);