From 3dee5525febf51e6c9222451b57004b36a392794 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 31 May 2006 09:44:45 +0000 Subject: [PATCH] Updated kolabMethod to display / set quota correct. Allow kolab to remove quota restrictions git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3575 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_mail-methods-kolab.inc | 16 +++++++++++++--- plugins/personal/mail/class_mailAccount.inc | 11 +++++++---- plugins/personal/mail/generic.tpl | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index c6f3f22de..3b5045d5f 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -50,12 +50,14 @@ class mailMethodKolab extends mailMethodCyrus } - /* Get quota and divide it by 1024, because in gosa we display in Kb - but we get bytes */ + /* Get quota and divide it by 1024, because in gosa we display in MB + but we get Kb */ function getQuota($folder) { $result= array('quotaUsage' => '', 'gosaMailQuota' => ''); - + + error_reporting(0); + /* Load quota settings */ $quota_value = @imap_get_quota($this->mbox, $folder); if(is_array($quota_value)) { @@ -72,6 +74,8 @@ class mailMethodKolab extends mailMethodCyrus return(false); } + error_reporting(E_ALL); + return ($result); } @@ -109,6 +113,12 @@ class mailMethodKolab extends mailMethodCyrus function fixAttributesOnStore(&$mailObject) { global $config; + + /* If quota is empty, remove quota restrictions by setting quota to 0 */ + if(isset($mailObject->gosaMailQuota) && (empty($mailObject->gosaMailQuota))){ + $mailObject->attrs['gosaMailQuota'] = 0; + } + /* Convert attributes and objectClasses */ foreach ($this->attribute_map as $source => $dest){ if (isset($mailObject->attrs[$source])){ diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index 4adef1da1..1d45d563f 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -128,7 +128,7 @@ class mailAccount extends plugin /* Update quota values */ $quota= $method->getQuota($this->folder_prefix.$this->$id); - + if($quota){ if ($quota['gosaMailQuota'] == 2147483647){ $this->quotaUsage = ""; @@ -138,6 +138,8 @@ class mailAccount extends plugin $this->gosaMailQuota = $quota['gosaMailQuota']; } }else{ + $this->quotaUsage = ""; + $this->gosaMailQuota = ""; print_red(sprintf(_("Can't get quota for for '%s'."),$this->folder_prefix.$this->$id)); } @@ -699,11 +701,12 @@ class mailAccount extends plugin /* Adapt attributes if needed */ $method= new $this->method($this->config); $id= $method->uattrib; + $method->fixAttributesOnStore($this); - /* Remove Mailquota if = "" */ - if((isset($this->attrs['gosaMailQuota']))&&($this->attrs['gosaMailQuota']=="")) { - $this->attrs['gosaMailQuota']=array(); + /* Remove Mailquota if = "" or "0" */ + if((isset($this->attrs['gosaMailQuota']))&&(!$this->attrs['gosaMailQuota'])) { + $this->attrs['gosaMailQuota']=0; } if(empty($this->attrs['gosaSpamMailbox'])){ diff --git a/plugins/personal/mail/generic.tpl b/plugins/personal/mail/generic.tpl index c467a89f5..1e99bb707 100644 --- a/plugins/personal/mail/generic.tpl +++ b/plugins/personal/mail/generic.tpl @@ -35,7 +35,7 @@ KB + value="{$gosaMailQuota}"> MB -- 2.30.2