Removed parameters are displayed in a shaded style.
[gnucomo.git] / src / web / parameter_compare.php
index 60df21c..9cc64bd 100644 (file)
@@ -9,7 +9,7 @@
 ***********************
 **      FILE NAME      : parameter_compare.php
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.3 $
+**      VERSION NUMBER : $Revision: 1.4 $
 **
 **  DESCRIPTION      : 
 **
 
 /*****************************
    $Log: parameter_compare.php,v $
-   Revision 1.3  2003-02-13 09:01:29  arjen
+   Revision 1.4  2003-07-15 11:06:45  arjen
+   Removed parameters are displayed in a shaded style.
+
+   Revision 1.3  2003/02/13 09:01:29  arjen
    All web interface pages use the page class.
 
    Revision 1.2  2003/02/05 09:47:39  arjen
@@ -35,7 +38,7 @@
 
 ******************************/
 
-// RCSID = "$Id: parameter_compare.php,v 1.3 2003-02-13 09:01:29 arjen Exp $";
+// RCSID = "$Id: parameter_compare.php,v 1.4 2003-07-15 11:06:45 arjen Exp $";
 
 ini_set('include_path', '.:./classes:../phpclasses');
 
@@ -83,8 +86,12 @@ function property_compare($prop, $comp)
 
 /*   Display a parameter in two adjecent table cells  */
 
-function display_parameter($name, $properties, $css_class = "")
+function display_parameter($name, $properties, $css_class = "", $shaded = FALSE)
 {
+   if ($shaded)
+   {
+      $css_class = 'shaded';
+   }
    echo "<td";
    if ($css_class != "")
    {
@@ -108,6 +115,16 @@ function display_parameter($name, $properties, $css_class = "")
 class param_diff extends page
 {
 
+   function is_removed($paramid)
+   {
+      $qry ="select change_nature from history where paramid= CAST('";
+      $qry .= $paramid . "' AS BIGINT) order by modified desc";
+      $rhist = pg_exec($this->database, $qry);
+      $hist = pg_fetch_object($rhist, 0);
+
+      return $hist->change_nature == "REMOVED";
+   }
+
    function Body()
    {
    if (!empty($_POST['oid']))
@@ -147,8 +164,8 @@ class param_diff extends page
             $prnext = param_properties($this->database, $nextpar->paramid);
             if (property_compare($pr, $prnext))
             {
-               display_parameter($par->name, $pr);
-               display_parameter($nextpar->name, $prnext);
+               display_parameter($par->name, $pr, "", $this->is_removed($par->paramid));
+               display_parameter($nextpar->name, $prnext, "", $this->is_removed($nextpar->paramid));
             }
             else
             {
@@ -157,13 +174,13 @@ class param_diff extends page
 
                if ($par->objectid == $obj->objectid)
                {
-                  display_parameter($par->name, $pr, "both");
-                  display_parameter($nextpar->name, $prnext, "both");
+                  display_parameter($par->name, $pr, "both", $this->is_removed($par->paramid));
+                  display_parameter($nextpar->name, $prnext, "both", $this->is_removed($nextpar->paramid));
                }
                else
                {
-                  display_parameter($nextpar->name, $prnext, "both");
-                  display_parameter($par->name, $pr, "both");
+                  display_parameter($nextpar->name, $prnext, "both", $this->is_removed($nextpar->paramid));
+                  display_parameter($par->name, $pr, "both", $this->is_removed($par->paramid));
                }
             }
          }
@@ -177,7 +194,7 @@ class param_diff extends page
             {
                /*  Parameter belongs to the object on the left */
 
-               display_parameter($par->name, $pr, "left");
+               display_parameter($par->name, $pr, "left", $this->is_removed($par->paramid));
                echo "<td>&nbsp;</td><td>&nbsp;";
             }
             else
@@ -186,7 +203,7 @@ class param_diff extends page
 
                echo "<td>";
                echo "&nbsp;</td><td>&nbsp;</td>";
-               display_parameter($par->name, $pr, "right");
+               display_parameter($par->name, $pr, "right", $this->is_removed($par->paramid));
             }
          }
          echo "</tr>\n";