Code

Enabled single cut and paste
[gosa.git] / plugins / admin / ogroups / class_ogroup.inc
index 9a17773cf9b5b0c996925d1bed337e7bffcb800d..1a5db9bca3162789803ffcf7918338b605357f0f 100644 (file)
@@ -30,6 +30,7 @@ class ogroup extends plugin
   var $member= array();
   var $orig_dn= "";
   var $group_dialog= FALSE;
+  var $view_logged = FALSE;
 
   /* attribute list for save action */
   var $attributes= array("cn", "description", "gosaGroupObjects","member");
@@ -94,10 +95,6 @@ class ogroup extends plugin
       $this->base= preg_replace("/^[^,]+,".get_groups_ou()."/","",$this->dn);
     }
 
-    if($this->is_account){
-      @log::log("view","ogroup/".get_class($this),$this->dn);
-    }
-
     /* Load member data */
     $this->reload();
   }
@@ -143,10 +140,14 @@ class ogroup extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
+
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","ogroups/".get_class($this),$this->dn);
+    }
 
-//    $this->reload();
 
     /* Do we represent a valid group? */
     if (!$this->is_account){
@@ -653,9 +654,9 @@ class ogroup extends plugin
     $ldap->$mode($this->attrs);
 
     if($mode == "add"){
-      @log::log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }else{
-      @log::log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }
 
     /* Trigger post signal */
@@ -677,12 +678,42 @@ class ogroup extends plugin
     $ldap->rmdir($this->dn);
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn));
 
-    @log::log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
 
     /* Trigger remove signal */
     $this->handle_post_events("remove");
   }
 
+  
+  function PrepareForCopyPaste($source)
+  {
+    /* Update available object types */
+    if(isset($source['gosaGroupObjects'][0])){
+      $this->gosaGroupObjects =  $source['gosaGroupObjects'][0];
+    }
+
+    /* Reload tabs */
+    $this->parent->reload($this->gosaGroupObjects );
+   
+    /* Reload plugins */ 
+    foreach($this->parent->by_object as $name => $class ){
+      if(get_class($this) != $name) {
+        $this->parent->by_object[$name]->PrepareForCopyPaste($source);
+      }
+    }
+
+    /* Load member objects */
+    if (isset($source['member'])){
+      foreach ($source['member'] as $key => $value){
+        if ("$key" != "count"){
+          $value= @LDAP::convert($value);
+          $this->member["$value"]= "$value";
+        }
+      }
+    }
+
+  }
+
 
   function getCopyDialog()
   {