Code

Updated mailForward selection list
[gosa.git] / gosa-plugins / mail / personal / mail / class_mail-methods.inc
index cab73287477c7ecf850270292b7f93c23b66172d..a17d77e4a0462d88de166d22461705d524590a50 100644 (file)
@@ -39,12 +39,21 @@ class mailMethod{
   /* Create accounts in cyrus style with '/' instead of '.' */
   protected $cyrusUseSlashes= FALSE;
 
+  /* gosaSharedFolderTarget settings, 
+   *  E.g. 
+   *    For an accountID like: 'share/herberts.folder@gonicus.de' the value 'dummy+' 
+   *    will result in gosaSharedFolderTarget: dummy+share/herberts.folder@gonicus.de
+   */
+  protected $gosaSharedPrefix = '';  
+
   /* The atribute mapping for this class  Source --> Destination */
   protected $attributes     = array();
   protected $userObjectClasses = array();
   protected $shareObjectClasses = array();
 
-  /* Enabled mail domain selection. If enabled getMailDomains must the domain parts */ 
+  /* Enabled mail domain selection. If enabled getMailDomains() have to return an array 
+   *  with the domain parts.
+   */ 
   protected $enableDomainSelection= FALSE;
   protected $enableQuota          = TRUE;
   protected $enableSieveManager   = FALSE;
@@ -152,6 +161,12 @@ class mailMethod{
           "<b>MAIL:</b> Shared folder creation set to");
       $this->share_id = $tmp;
     }
+    $tmp = $this->config->get_cfg_value("gosaSharedPrefix");
+    if(!empty($tmp)){
+      @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "<i>".$tmp."</i>",
+          "<b>MAIL:</b> Shared folder prefix set to");
+      $this->gosaSharedPrefix = $tmp;
+    }
 
     $this->build_account_id();
     $this->initial_account_id = $this->account_id;
@@ -190,6 +205,7 @@ class mailMethod{
     }else{
       $this->parent->attrs['objectClass'] = 
         array_remove_entries_ics($this->shareObjectClasses, $this->parent->attrs['objectClass']);
+      $this->parent->attrs['gosaSharedFolderTarget'] =array();
     }
     foreach($this->attributes as $source => $dest){
       $this->attrs[$dest]   = array();
@@ -218,6 +234,13 @@ class mailMethod{
         $this->parent->attrs['objectClass'][] = $oc;
       }
     }
+  
+    // Add gosaSharedFolderTarget for groups.
+    $this->build_account_id();
+    if($this->type == "group"){ 
+      $this->parent->attrs['gosaSharedFolderTarget'] = 
+        $this->gosaSharedPrefix.$this->account_id;
+    }
   }
 
 
@@ -337,7 +360,7 @@ class mailMethod{
     $domain = $mailpart = "";
     $mail = $this->parent->mail;
     if(preg_match("/\@/",$mail)){
-      list($mailpart,$domain) = split("\@",$mail);
+      list($mailpart,$domain) = explode("@",$mail);
     }
 
     /* Create account_id 
@@ -406,7 +429,7 @@ class mailMethod{
     $domain = $mailpart = "";
     $mail = $this->parent->mail;
     if(preg_match("/\@/",$mail)){
-      list($mailpart,$domain) = split("\@",$mail);
+      list($mailpart,$domain) = explode("@",$mail);
     }
 
     /* Create account_id
@@ -429,7 +452,7 @@ class mailMethod{
     }
 
     if(preg_match("/\@/",$acc_id)){
-      list($mail,$domain) = split("\@",$acc_id);
+      list($mail,$domain) = explode("@",$acc_id);
       $str = trim($mail . $folder . "@" . $domain);
     }else{
       $str = trim($acc_id . $folder);