The buttonbar at the top of each page is now a fixed 'div' element
[gnucomo.git] / src / web / objects.php
index 6a9c434..b2a4bfc 100644 (file)
@@ -9,7 +9,7 @@
 ***********************
 **      FILE NAME      : objects.php
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.10 $
+**      VERSION NUMBER : $Revision: 1.11 $
 **
 **  DESCRIPTION      : Objects Administration page.
 **                     Input parameters: action (POST) : empty, 'Create'
 
 /*****************************
    $Log: objects.php,v $
-   Revision 1.10  2005-06-04 07:24:38  arjen
+   Revision 1.11  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.
+
+   Revision 1.10  2005/06/04 07:24:38  arjen
    New page: Abuse list
 
    Revision 1.9  2003/09/01 06:55:00  arjen
@@ -62,7 +67,7 @@
 
 ******************************/
 
-// RCSID = "$Id: objects.php,v 1.10 2005-06-04 07:24:38 arjen Exp $";
+// RCSID = "$Id: objects.php,v 1.11 2007-11-21 14:38:06 arjen Exp $";
 
 ini_set('include_path', '.:./classes:../phpclasses');
 
@@ -72,7 +77,7 @@ function clientscripts()
 {
 ?>
 
-<script language='JavaScript'>
+<script type='text/ecmascript'>
 
 function CheckCreate(f)
 {
@@ -157,7 +162,7 @@ class object_page extends page
 
    if (isset($_GET['oid']))
    {
-      echo "<h1>Detailed information for object " . $_GET['oid'] . "</h1><hr>";
+      echo "<script type='text/ecmascript'>document.getElementById('menu_title').innerHTML = \"<h1>Detailed information for object " . $_GET['oid'] . "<\/h1>\"</script><br>\n";
 
       if (isset($_POST['action']) && $_POST['action'] == 'Save Changes')
       {
@@ -260,13 +265,13 @@ class object_page extends page
       echo $obj->objectname . "'></td></tr>";
       echo "<tr><td>Identification code</td><td><input name='ocode' type='text' value='";
       echo $obj->objectcode . "'></td></tr>";
-      echo "<tr><td>Description</td><td><textarea name='odescription'>";
+      echo "<tr><td>Description</td><td><textarea name='odescription' rows='3' cols='30'>";
       echo $obj->object_description . "</textarea></td></tr>";
-      echo "<tr><td>Owner</td><td><textarea name='oowner'>";
+      echo "<tr><td>Owner</td><td><textarea name='oowner' rows='3' cols='30'>";
       echo $obj->object_owner . "</textarea></td></tr>";
-      echo "<tr><td>Physical location</td><td><textarea name='olocation'>";
+      echo "<tr><td>Physical location</td><td><textarea name='olocation' rows='3' cols='30'>";
       echo $obj->physical_location . "</textarea></td></tr>";
-      echo "<tr><td>Remarks</td><td><textarea name='oremark'>";
+      echo "<tr><td>Remarks</td><td><textarea name='oremark' rows='3' cols='30'>";
       echo $obj->remark . "</textarea></td></tr>";
       echo "<tr><td>Timezone</td><td><input name='otimezone' type='text' value='";
       echo $obj->timezone . "'></td></tr>";
@@ -287,7 +292,8 @@ class object_page extends page
          $srv_obj_res = pg_exec($this->database, "SELECT * FROM object_service WHERE objectid='"
                                    . $obj->objectid . "' AND servicecode='" . $srv->servicecode . "'");
 
-         echo "<tr><form action='objects.php?oid=" . $obj->objectid . "' method='POST'>";
+         echo "<tr>";
+         echo "<form action='objects.php?oid=" . $obj->objectid . "' method='POST'>";
          echo "<input type='hidden' name='servcode' value='" . $srv->servicecode . "'>";
 
          if (pg_numrows($srv_obj_res) == 0)
@@ -321,7 +327,8 @@ class object_page extends page
          $usr_obj_res = pg_exec($this->database, "SELECT * FROM object_user WHERE objectid='"
                                    . $obj->objectid . "' AND username='" . $usr->username . "'");
 
-         echo "<tr><form action='objects.php?oid=" . $obj->objectid . "' method='POST'>";
+         echo "<tr>";
+         echo "<form action='objects.php?oid=" . $obj->objectid . "' method='POST'>";
          echo "<input type='hidden' name='username' value='" . $usr->username . "'>";
 
          if (pg_numrows($usr_obj_res) == 0)
@@ -343,7 +350,11 @@ class object_page extends page
    }
    else
    {
-      echo "<h1>Objects Administration</h1><hr>";
+      echo "<script type='text/ecmascript'>
+            document.getElementById('menu_title').innerHTML = \"<h1>Objects Administration<\/h1>\"
+            </script>
+            <br>";
+
 
       $res = pg_exec($this->database, "SELECT * FROM object ORDER BY objectname");
 ?>
@@ -375,18 +386,34 @@ class object_page extends page
          $count_notifications += $this->nr_notifications;
          $closed_notifications += $this->closed_notifications;
          ?>
-         <tr><td><center><a href='objects.php?oid=<?php echo $u->objectid?>'><img src='server.png'></a><br>
+         <tr><td><center><a href='objects.php?oid=<?php echo $u->objectid?>'><img src='server.png' alt='server'></a><br>
                 <b><?php echo $u->objectname ?></b></center>
          </td><td>
                <?php echo nl2br($u->object_description) ?>
          </td><td class='number'>
-             <?php echo "<a href='log.php?oid=$u->objectid'> $this->nr_logs </a>" ?>
+             <?php if ( $this->nr_logs > 0 )
+                   { 
+                       echo "<a href='log.php?oid=$u->objectid'> $this->nr_logs </a>";
+                   }
+                   else
+                   { 
+                      echo "0";
+                   }
+              ?>
          </td><td class='number'>
              <?php echo "<a href='parameter.php?oid=$u->objectid'>" . $this->nr_parameters
                       . " (" . $this->removed_parameters . " removed)</a>" ?>
          </td><td class='number'>
-             <?php echo "<a href='notification.php?oid=$u->objectid'>" . $this->nr_notifications
-                      . " (" . $this->closed_notifications . " closed)</a>" ?>
+             <?php if( $this->nr_notifications == $this->closed_notifications )
+                   {
+                      echo $this->nr_notifications . " (" . $this->closed_notifications . " closed)"; 
+                  }
+                   else
+                   {
+                      echo "<a href='notification.php?oid=$u->objectid'>" . $this->nr_notifications
+                      . " (" . $this->closed_notifications . " closed)</a>"; 
+                   }
+              ?>
          </td><td class='number'>
              <?php echo "<a href='abuse.php?oid=$u->objectid'>" . "Abuse list"
                       . " </a>" ?>
@@ -413,14 +440,12 @@ class object_page extends page
 ?>
 
 <h2>Create new object:</h2>
-<p>
 
 <form action='objects.php' method='post' onSubmit='return CheckCreate(this)'>
 Object's name (FQDN): <input name='objectname' type='text'>
 <br>
 <input type='submit' name='action' value='Create'>
 </form>
-</p>
 
 <?php