Code

Added support for optionally taking along members when copying object
[gosa.git] / trunk / gosa-core / plugins / admin / ogroups / class_ogroup.inc
index 3c26c693af05d1bd11eb338bf17c3405c52091e6..e9456ef7aa137aeaa3e6e8c25d53cba67e111f4b 100644 (file)
@@ -67,6 +67,8 @@ class ogroup extends plugin
   var $attributes= array("cn", "description", "gosaGroupObjects","member","accessTo","trustModel");
   var $objectclasses= array("top", "gosaGroupOfNames");
 
+  var $copyMembers = TRUE;
+
   function ogroup (&$config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
@@ -1061,6 +1063,12 @@ class ogroup extends plugin
       $this->gosaGroupObjects =  $source['gosaGroupObjects'][0];
     }
 
+    if (preg_match("/[STW]/", $this->gosaGroupObjects) || !isset($source['member'])) {
+      $this->copyMembers = false;
+    } else {
+      $this->copyMembers = true;
+    }
+
     /* Reload tabs */
     $this->parent->reload($this->gosaGroupObjects );
    
@@ -1088,6 +1096,7 @@ class ogroup extends plugin
   {
     $smarty = get_smarty();
     $smarty->assign("cn",     $this->cn);
+    $smarty->assign("copyMembers",     $this->copyMembers);
     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
     $ret = array();
     $ret['string'] = $str;
@@ -1100,6 +1109,9 @@ class ogroup extends plugin
     if(isset($_POST['cn'])){
       $this->cn = $_POST['cn'];
     }
+    if(!isset($_POST['copyMembers'])){
+      $this->member = array();
+    }
   }