Code

Added Copy & Paste to Scripts/Hooks/Templates/Variables.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Dec 2007 14:03:49 +0000 (14:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Dec 2007 14:03:49 +0000 (14:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8046 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiHook.inc
plugins/admin/fai/class_faiScript.inc
plugins/admin/fai/class_faiTemplate.inc
plugins/admin/fai/class_faiTemplateEntry.inc
plugins/admin/fai/class_faiVariable.inc

index a4fdd56402579a52ca1b31cf497f9bb965eb258e..ce60202a3a8428ca8d599923753986228012be02 100644 (file)
@@ -551,6 +551,41 @@ class faiHook extends plugin
     }
   }
 
+
+  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 */ 
   static function plInfo()
   {
index 8a985da959605fbfd15b378f3d88c3b8a3af207a..928aa0e94a41384702d3ca74a21bc5228caf36d6 100644 (file)
@@ -600,6 +600,40 @@ class faiScript 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 */ 
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 */ 
index b24901c048af2f19857a836c5bab387dec6ca868..05c6b72acc303e30832adefe168fdf9b8cfc91b4 100644 (file)
@@ -208,9 +208,10 @@ class faiTemplateEntry extends plugin
       $message[] = _("Please enter a file name.");
     }
 
-    if(preg_match('/\//', $this->cn)){
-      $message[] = _("The file name should not contain / characters.");
-    }
+#    echo $this->cn;
+#    if(preg_match('/\//', $this->cn)){
+#      $message[] = _("The file name should not contain / characters.");
+# #   }
 
     if(empty($this->user)){
       $message[] = _("Please enter a user.");
index c2eba3e0072773dba346cbf96ee43865b63780a2..ae6b79a99fa36686b6ac0c409ae3fd66f1817e93 100644 (file)
@@ -415,7 +415,44 @@ class faiVariable extends plugin
     }
   }
 
-  
+
+  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 */
+      foreach($this->subAttributes as $attrs){
+        if(!isset($object[$attrs][0])){
+          $this->SubObjects[$object['cn'][0]][$attrs]="";
+        }else{
+          $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+        }
+      }
+      foreach($this->sub64coded as $codeIt){
+        $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+      }
+      $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+      $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+    }
+  } 
+
   /* Return plugin informations for acl handling */ 
   static function plInfo()
   {