From 77221c4fa1fe29803e8f53804250e846fb8547c1 Mon Sep 17 00:00:00 2001 From: arjen Date: Mon, 10 Dec 2007 16:27:33 +0000 Subject: [PATCH] Added an option to perform one action on multiple notifications at once. --- src/web/notification.php | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/web/notification.php b/src/web/notification.php index 09edc5c..efbd958 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.5 $ +** VERSION NUMBER : $Revision: 1.6 $ ** ** DESCRIPTION : Display and handle notifications. ** There are two major views to this page: either a list of @@ -36,7 +36,10 @@ /***************************** $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. @@ -57,7 +60,7 @@ ******************************/ -// 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'); @@ -136,7 +139,7 @@ class notification_page extends page echo ""; echo ''; $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('" @@ -321,6 +324,7 @@ class notification_page extends page echo " value='$act'>" . $action->description . "
"; } + echo "Perform this action on all notifications with the same issue.
"; echo ""; echo ""; } @@ -412,7 +416,29 @@ class notification_page extends page 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 "
"; $this->notification_form($note); -- 2.11.0
TimeNumberIssueStatusPriority