Code

Enabled single cut and paste
[gosa.git] / plugins / admin / ogroups / class_ogroup.inc
index 09219dfe133e003c678d6b69c2caa1c3cd93d296..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");
@@ -139,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){
@@ -636,6 +641,7 @@ class ogroup extends plugin
         $this->attrs['member']= array();
       }
       $mode= "modify";
+
     } else {
       $mode= "add";
       $ldap->cd($this->config->current['BASE']);
@@ -647,6 +653,12 @@ class ogroup extends plugin
     $this->cleanup();
     $ldap->$mode($this->attrs);
 
+    if($mode == "add"){
+      new log("create","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("modify","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     /* Trigger post signal */
     $this->handle_post_events($mode);
 
@@ -666,10 +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));
 
+    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()
   {