From e07eba7fe8320d6ab0491ed27dd11063dcd7887d Mon Sep 17 00:00:00 2001 From: arjen Date: Thu, 14 Aug 2003 10:35:07 +0000 Subject: [PATCH] Added editing of detailed object information. --- src/web/objects.php | 174 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 61 deletions(-) diff --git a/src/web/objects.php b/src/web/objects.php index 7222e7b..90cdafd 100644 --- a/src/web/objects.php +++ b/src/web/objects.php @@ -9,11 +9,11 @@ *********************** ** FILE NAME : objects.php ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.7 $ +** VERSION NUMBER : $Revision: 1.8 $ ** ** DESCRIPTION : Objects Administration page. ** Input parameters: action (POST) : empty, 'Create' -** objname (POST) : name of the object to create or remove +** objname (POST) : name of the object to create or remove ** ** EXPORTED OBJECTS : ** LOCAL OBJECTS : @@ -23,13 +23,16 @@ ******************************** ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl ** CREATION DATE : Dec 04, 2002 -** LAST UPDATE : Feb 14, 2003 +** LAST UPDATE : Aug 04, 2003 ** MODIFICATIONS : **************************************************************************/ /***************************** $Log: objects.php,v $ - Revision 1.7 2003-07-15 11:02:25 arjen + Revision 1.8 2003-08-14 10:35:07 arjen + Added editing of detailed object information. + + Revision 1.7 2003/07/15 11:02:25 arjen Use the new object_statistics table. Revision 1.6 2003/02/21 08:46:58 arjen @@ -52,7 +55,7 @@ ******************************/ -// RCSID = "$Id: objects.php,v 1.7 2003-07-15 11:02:25 arjen Exp $"; +// RCSID = "$Id: objects.php,v 1.8 2003-08-14 10:35:07 arjen Exp $"; ini_set('include_path', '.:./classes:../phpclasses'); @@ -134,8 +137,6 @@ class object_page extends page { clientscripts(); - echo "

Objects Administration


"; - if (isset($_POST['action']) && $_POST['action'] == 'Create' && !empty($_POST['objectname'])) { pg_exec($this->database, "INSERT INTO object (objectname, log_count, parameter_count, notification_count) @@ -147,64 +148,113 @@ class object_page extends page pg_exec($this->database, "DELETE FROM object WHERE objectname='" . $_POST['objectname'] . "'"); } - $res = pg_exec($this->database, "SELECT objectid,objectname, log_count, notification_count - FROM object ORDER BY objectname"); + if (isset($_GET['oid'])) + { + echo "

Detailed information for object " . $_GET['oid'] . "


"; + + if (isset($_POST['action']) && $_POST['action'] == 'Save Changes') + { + $qry = "UPDATE object SET objectname='" . $_POST['oname'] . "'"; + $qry .= ", objectcode='" . $_POST['ocode'] . "'"; + $qry .= ", object_description='" . $_POST['odescription'] . "'"; + $qry .= ", object_owner='" . $_POST['oowner'] . "'"; + $qry .= ", physical_location='" . $_POST['olocation'] . "'"; + $qry .= ", remark='" . $_POST['oremark'] . "'"; + $qry .= ", timezone='" . $_POST['otimezone'] . "'"; + $qry .= " WHERE objectid=" . $_GET['oid']; + + pg_exec($this->database, $qry); + } + + $res = pg_exec($this->database, "SELECT * FROM object + WHERE objectid='" . $_GET['oid'] . "'"); + $obj = pg_fetch_object($res, 0); + + echo "
"; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo "
Name
Identification code
Description
Owner
Physical location
Remarks
Timezone
"; + echo ""; + echo "
"; + } + else + { + echo "

Objects Administration


"; + + $res = pg_exec($this->database, "SELECT * FROM object ORDER BY objectname"); ?> - - - - +
ObjectLog entriesParametersNotifications
+ + GatherStatistics($u->objectid); - - $count_parameters += $this->nr_parameters; - $removed_parameters += $this->removed_parameters; - $count_logs = $count_logs + $this->nr_logs; - - //$nr_notifications = $u->notification_count; - $count_notifications += $this->nr_notifications; - $closed_notifications += $this->closed_notifications; - ?> - - "; - echo ""; - echo ""; - echo ""; - echo "
ObjectDescriptionLog entriesParametersNotifications

- objectname ?>
-
- objectid'> $this->nr_logs " ?> - - objectid'>" . $this->nr_parameters - . " (" . $this->removed_parameters . " removed)" ?> - - objectid'>" . $this->nr_notifications . " (" . $this->closed_notifications . " closed)" ?> - -
- - -
-


TOTALS
$count_logs$count_parameters ($removed_parameters removed)$count_notifications ($closed_notifications closed)
"; + $obj = 0; + + //The counters are set to zero + $count_logs = 0; + $count_notifications = 0; + $closed_notifications = 0; + $count_parameters = 0; + $removed_parameters = 0; + + while ($obj < pg_numrows($res)) + { + $u = pg_fetch_object($res, $obj); + + $this->GatherStatistics($u->objectid); + + $count_parameters += $this->nr_parameters; + $removed_parameters += $this->removed_parameters; + $count_logs = $count_logs + $this->nr_logs; + + $count_notifications += $this->nr_notifications; + $closed_notifications += $this->closed_notifications; + ?> +

+ objectname ?>
+ + object_description) ?> + + objectid'> $this->nr_logs " ?> + + objectid'>" . $this->nr_parameters + . " (" . $this->removed_parameters . " removed)" ?> + + objectid'>" . $this->nr_notifications + . " (" . $this->closed_notifications . " closed)" ?> + +
+ + +
+ +

TOTALS
"; + echo " "; + echo "$count_logs"; + echo "$count_parameters ($removed_parameters removed)"; + echo "$count_notifications ($closed_notifications closed)"; + echo ""; ?> @@ -217,9 +267,11 @@ Object's name (FQDN):

+