All web interface pages use the page class.
[gnucomo.git] / src / web / log.php
index 96ac2cd..aa5ca97 100644 (file)
@@ -1,96 +1,84 @@
 <?php 
 
 /**************************************************************************
+**  (c) Copyright 2003, Andromeda Technology & Automation
 ** This is free software; you can redistribute it and/or modify it under the
 ** terms of the GNU General Public License, see the file COPYING.
-***************************************************************************/
+***************************************************************************
+** MODULE INFORMATION *
+***********************
+**      FILE NAME      : log.php
+**      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
+**      VERSION NUMBER : $Revision: 1.2 $
+**
+**  DESCRIPTION      : Logs page
+**
+**  EXPORTED OBJECTS : 
+**  LOCAL    OBJECTS : 
+**  MODULES  USED    :
+***************************************************************************
+**  ADMINISTRATIVE INFORMATION *
+********************************
+**      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
+**      CREATION DATE   : Dec 04, 2002
+**      LAST UPDATE     : Feb 08, 2003
+**      MODIFICATIONS   : 
+**************************************************************************/
 
-/*
- *
- * Objects Administration page.
- * Input parameters: action (POST) : empty, 'Create'
- *                   objname (POST) : name of the object to create or remove
- */
+/*****************************
+   $Log: log.php,v $
+   Revision 1.2  2003-02-13 09:01:29  arjen
+   All web interface pages use the page class.
 
-session_start();
-require_once('classes/gnucomo_config.php');
-?>
+   Revision 1.2  2003/02/05 09:48:14  arjen
+   Added display and handling of notifications
 
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel='stylesheet' href='gnucomo.css' type='text/css'>
-<title>GNUCoMo login</title>
+******************************/
 
-<script language='JavaScript'>
-function CheckCreate(f)
-{
-   if (f.objectname.value == "")
-   {
-      alert("You must supply a name");
-      return false;
-   }
-   return true;
-}
+// RCSID = "$Id: log.php,v 1.2 2003-02-13 09:01:29 arjen Exp $";
 
-function CheckRemove(f)
-{
-   var message = "Are you sure you want to remove object ";
-   message += f.objectname.value;
-   message += " ?";
+ini_set('include_path', '.:./classes:../phpclasses');
 
-   return confirm(message);
-}
+require_once('page.class.php');
 
-</script>
 
-</head>
-<body>
-<?php
-if (empty($_SESSION['username']))
-{
-   echo "Please log in first.";
-}
-else
+class log_page extends page
 {
 
-   $config = new gnucomo_config;
-
-   $config->read("gnucomo");
-
-   //  Connect to the database
-   $conn = pg_connect($config->Database($_SESSION['username'], $_SESSION['password']));
-
-   if (!empty($_GET['oid']))
+   function Body()
    {
-      $res = pg_exec("SELECT objectname FROM object WHERE objectid=" . $_GET['oid']);
-      $obj = pg_fetch_object($res, 0);
-      echo "<h1>Log for " . $obj->objectname . "</h1><hr>";
+      if (!empty($_GET['oid']))
+      {
+         $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid=" . $_GET['oid']);
+         $obj = pg_fetch_object($res, 0);
+         echo "<h1>Log for " . $obj->objectname . "</h1><hr>";
 
-      $res = pg_exec("SELECT object_timestamp, servicecode, rawdata FROM log "
-                     ."WHERE objectid=" . $_GET['oid']);
+         $res = pg_exec($this->database, "SELECT object_timestamp, servicecode, rawdata FROM log "
+                        ."WHERE objectid=" . $_GET['oid']);
       
-      echo "<table>";
-      $row = 0;
-      while ($row < pg_numrows($res))
-      {
-         $log = pg_fetch_object($res, $row);
-         ?>
-         <tr><td align='center'>
-            <?php echo $log->object_timestamp?>
-         </td><td>
-            <?php echo $log->servicecode?>
-         </td><td>
-            <?php echo $log->rawdata?>
-         </td></tr>
-         <?php
-         $row++;
+         echo "<table>";
+         $row = 0;
+         while ($row < pg_numrows($res))
+         {
+            $log = pg_fetch_object($res, $row);
+            ?>
+            <tr><td align='center'>
+               <?php echo $log->object_timestamp?>
+            </td><td>
+               <?php echo $log->servicecode?>
+            </td><td>
+               <?php echo $log->rawdata?>
+            </td></tr>
+            <?php
+            $row++;
+         }
+         echo "</table>";
       }
-      echo "</table>";
    }
 }
-?>
 
-</body>
-</html>
+$page = new log_page("Gnucomo system logs");
+
+$page->Showpage();
+
+?>