Code

Also display new created variables
[gosa.git] / plugins / admin / fai / class_faiTemplate.inc
index 0c4fa51df2effc68ff5c0c9a0b2c13b199f3a09a..8de436e3a7a23ad1b1d037305a8b40c6a43ccf8f 100644 (file)
@@ -67,6 +67,14 @@ class faiTemplate extends plugin
       $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
 
       while($object = $ldap->fetch()){
+
+        /* Skip objects, that are tagged as removed */
+        if(isset($object['FAIstate'][0])){
+          if(preg_match("/removed$/",$object['FAIstate'][0])){
+            continue;
+          }
+        }
+
         /* Set status for save management */
         $objects = array();
         $objects['status']      = "FreshLoaded";
@@ -74,6 +82,8 @@ class faiTemplate extends plugin
         $objects                = $this->get_object_attributes($objects,$this->subAttributes);
         $this->SubObjects[$objects['cn']] = $objects;
       }
+  
+      @log::log("view","fai/".get_class($this),$this->dn);
     }
     $this->ui = get_userinfo();
   }
@@ -153,7 +163,8 @@ class faiTemplate extends plugin
         $acl_dn = $this->acl_base_for_current_object($obj['dn']);
         $acl = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry");
         if(preg_match("/d/",$acl)){
-          if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){
+          $status = $this->SubObjects[$entry]['status'];
+          if($status == "edited" || $status == "FreshLoaded"){
             $this->SubObjects[$entry]['status']= "delete";
           }else{
             unset($this->SubObjects[$entry]);
@@ -246,8 +257,13 @@ class faiTemplate extends plugin
 
     $tmp = $this->getList(true);
   
+    /* Create div list with all sub entries listed */
     foreach($this->SubObjects as $key => $name){
 
+      /* Skip removed entries */ 
+      if($name['status'] == "delete") continue;
+
+      /* Get permissions */
       $dn  = $this->acl_base_for_current_object($name['dn']);
       $acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry")  ;
       $act = "";
@@ -357,6 +373,7 @@ class faiTemplate extends plugin
     }
 
     prepare_to_save_FAI_object($use_dn,array(),true);
+    @log::log("remove","fai/".get_class($this),$use_dn,$this->attributes);
 
     foreach($this->SubObjects as $name => $obj){
 #      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
@@ -400,6 +417,12 @@ class faiTemplate extends plugin
     prepare_to_save_FAI_object($this->dn,$this->attrs);
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/template with dn '%s' failed."),$this->dn));
 
+    if($this->initially_was_account){
+      @log::log("modify","fai/".get_class($this),$this->dn,$this->attributes);
+    }else{
+      @log::log("create","fai/".get_class($this),$this->dn,$this->attributes);
+    }
+
     /* Do object tagging */
     $this->handle_object_tagging();