Code

Added Copy & Paste to Scripts/Hooks/Templates/Variables.
[gosa.git] / plugins / admin / fai / class_faiTemplate.inc
index 7d8e5ed7353a1296469dee89e796322facc098c2..5f4fcbf14509115508ad4e98578618488d741cac 100644 (file)
@@ -521,6 +521,40 @@ class faiTemplate extends plugin
       $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
     }
   }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+     */
+    $ldap     = $this->config->get_ldap_link();
+    $ldap->cd ($source['dn']);
+
+    $attrs_to_search = $this->subAttributes;
+    $attrs_to_search[] = "FAIstate";
+    $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']      = "edited";
+      $objects['dn']          = $object['dn'];
+      $objects                = $this->get_object_attributes($objects,$this->subAttributes);
+      $objects                = $this->get_object_attributes($objects,$this->sub_Load_Later);
+
+      $this->SubObjects[$objects['cn']] = $objects;
+    }
+  }
   
 
   /* Return plugin informations for acl handling */