Code

Fixed Terminal/Workstation -template string in mangement list.
[gosa.git] / plugins / admin / ogroups / class_ogroupManagement.inc
index ebc120a7a5c408454e0f13dfc51fdfe08f9344ca..09fba6b173dcf135311ce696315d78d20da52384 100644 (file)
@@ -113,37 +113,13 @@ class ogroupManagement extends plugin
 
     /* Only perform copy / paste if it is enabled
      */
-    if($this->CopyPasteHandler){
-
-      /* Paste copied/cutted object in here
-       */
-      if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
-        $this->CopyPasteHandler->save_object();
-        $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
-        return($this->CopyPasteHandler->execute());
-      }
 
-      /* Copy current object to CopyHandler
-       */
-      if($s_action == "copy"){
-        $this->CopyPasteHandler->Clear();
-        $dn       =   $this->ogrouplist[$s_entry]['dn'];
-        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
-        $objNew   =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
-        $this->CopyPasteHandler->Copy($obj,$objNew);
-      }
-
-      /* Copy current object to CopyHandler
-       */
-      if($s_action == "cut"){
-        $this->CopyPasteHandler->Clear();
-        $dn       =   $this->ogrouplist[$s_entry]['dn'];
-        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
-        $this->CopyPasteHandler->Cut($obj);
-      }
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling($s_action,$s_entry);
+    if($ret){
+      return($ret);
     }
 
-
     /****************
       Create a new object group 
      ****************/
@@ -309,7 +285,7 @@ class ogroupManagement extends plugin
      ****************/
 
     /* Cancel dialogs */
-    if (isset($_POST['edit_cancel'])){
+    if ((isset($_POST['edit_cancel'])) && (isset($this->ogroup->dn))){
       del_lock ($this->ogroup->dn);
       unset ($this->ogroup);
       $this->ogroup= NULL;
@@ -407,7 +383,7 @@ class ogroupManagement extends plugin
   function reload()
   {
     /* Set base for all searches && initialise some vars */
-    $this->oogrouplist= array();
+    $this->ogrouplist= array();
     $base     = $this->DivListOGroup->selectedBase;
     $filter   = "(gosaGroupObjects=[])";
     $Regex    = $this->DivListOGroup->Regex;
@@ -456,6 +432,45 @@ class ogroupManagement extends plugin
     $this->DivListOGroup->save_object();
   }
 
+  
+  function copyPasteHandling($s_action,$s_entry)
+  {
+
+    if($this->CopyPasteHandler){
+
+      /* Paste copied/cutted object in here
+       */
+      if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
+        $this->CopyPasteHandler->save_object();
+        $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase);
+        return($this->CopyPasteHandler->execute());
+      }
+
+      /* Copy current object to CopyHandler
+       */
+      if($s_action == "copy"){
+        $this->CopyPasteHandler->Clear();
+        $dn       =   $this->ogrouplist[$s_entry]['dn'];
+        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
+        $objNew   =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new");
+
+        $types_of_tabs = $obj->by_object['ogroup']->gosaGroupObjects;
+        $objNew->by_object['ogroup']->gosaGroupObjects = $types_of_tabs;    
+        $objNew->reload($types_of_tabs);
+
+        $this->CopyPasteHandler->Copy($obj,$objNew);
+      }
+
+      /* Copy current object to CopyHandler
+       */
+      if($s_action == "cut"){
+        $this->CopyPasteHandler->Clear();
+        $dn       =   $this->ogrouplist[$s_entry]['dn'];
+        $obj      =   new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn);
+        $this->CopyPasteHandler->Cut($obj);
+      }
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: