From: hickert Date: Wed, 10 Dec 2008 10:44:50 +0000 (+0000) Subject: Fixed folder type assignement X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=518f07a2b9a687b47c9003b098860ce0763f56df;p=gosa.git Fixed folder type assignement git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13239 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc b/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc index 81e6b4ffe..03cacb41a 100644 --- a/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc +++ b/gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab.inc @@ -55,6 +55,8 @@ class mailMethodKolab extends mailMethodCyrus mailMethod::fixAttributesOnStore(); $this->build_account_id(); $this->parent->attrs['kolabDeleteflag'] = array(); + + /* The folderType is set by ::setFolderType(...) */ $this->parent->attrs['kolabFolderType'] = array(); if($this->type == "group"){ $this->parent->attrs['gosaSharedFolderTarget'] = "kolab+shared.".$this->parent->mail; @@ -141,7 +143,14 @@ class mailMethodKolab extends mailMethodCyrus public function getFolderType($default) { if($this->enableFolderTypes && isset($this->parent->attrs['kolabFolderType'][0])){ - list($cat,$sub) = split("\.",$this->parent->attrs['kolabFolderType'][0]); + $type = $this->parent->attrs['kolabFolderType'][0]; + if(strpos($type,".")){ + list($cat,$sub) = split("\.",$this->parent->attrs['kolabFolderType'][0]); + }else{ + $sub = ""; + $cat = $type; + } + return(array("CAT" => $cat, "SUB_CAT" => $sub)); }else{ return($default); @@ -155,10 +164,26 @@ class mailMethodKolab extends mailMethodCyrus */ public function setFolderType($type) { + + $type_str = trim($type['CAT'].".".$type['SUB_CAT']); + $type_str = trim($type_str,"."); + $attrs = array(); + if(empty($type_str)){ + $attrs['kolabFolderType'] = array(); + }else{ + $attrs['kolabFolderType'] = $type_str; + } + $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->parent->dn); - $ldap->modify(array("kolabFolderType" => $type['CAT'].".".$type['SUB_CAT'])); - echo "Move me to KOLAB"; + $ldap->modify($attrs); + if($ldap->success()){ + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "Successful", + "MAIL: Set folderType to '".$type_str."'"); + }else{ + @DEBUG (DEBUG_MAIL, __LINE__, __FUNCTION__, __FILE__, "Failed: ".$ldap->get_error(), + "MAIL: Set folderType to '".$type_str."'"); + } }