Code

Enabled copy & paste
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 6 Jan 2010 12:14:42 +0000 (12:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 6 Jan 2010 12:14:42 +0000 (12:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15084 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc

index f148505b1d4f019d6d9cc03be996f80fb4163c28..c65f150a4eb2f2152f44ae0f6291ae845ae44410 100644 (file)
@@ -120,6 +120,50 @@ class faiManagement extends management
   }
 
 
+  function copyPasteHandler($action="",$target=array(),$all=array(),
+      $altTabClass ="", $altTabType = "", $altAclCategory="",$altAclPlugin="")
+  {
+
+    // Collect real dns, the listed objects are grouped by their cn
+    $headpage = $this->getHeadpage();
+    if($action == "copy"){
+      foreach($target as $t){
+        $entry = $headpage->getEntry($t);
+        
+        // Check for valid FAI objects
+        if(in_array('FAKE_OC_FAI', $entry['objectClass'])){
+          foreach($entry['GROUPS'] as $g){
+            $type = $this->get_type($g);
+            $this->cpHandler->add_to_queue($g['dn'],"copy",$type[0],$type[2],'fai',$this);
+            @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$dn,"Entry copied!");
+          }
+        }
+      }
+    }
+
+    // Initiate pasting
+    if($action == "paste"){
+      $this->cpPastingStarted = TRUE;
+    }
+
+    // Display any c&p dialogs, eg. object modifications required before pasting.
+    if($this->cpPastingStarted && $this->cpHandler->entries_queued()){
+      $this->cpHandler->SetVar("base",$headpage->getBase());
+      $data = $this->cpHandler->execute();
+      FAI::save_release_changes_now();
+      if(!empty($data)){
+        return($data);
+      }
+    }
+
+    // Automatically disable pasting process since there is no entry left to paste.
+    if(!$this->cpHandler->entries_queued()){
+      $this->cpPastingStarted = FALSE;
+    }
+    return("");
+  }
+
+
   function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
   {
     /****************