From 816e5ef0bf3ba727bea14cf2533b8ba607744d22 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 10 Dec 2008 13:13:34 +0000 Subject: [PATCH] Display quota image git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13243 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../mail/admin/groups/mail/class_groupMail.inc | 12 ++++++------ .../mail/personal/mail/class_mail-methods.inc | 11 +++++++++++ .../mail/personal/mail/class_mailAccount.inc | 11 ++++++----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/gosa-plugins/mail/admin/groups/mail/class_groupMail.inc b/gosa-plugins/mail/admin/groups/mail/class_groupMail.inc index 695bae8d8..b4c01024d 100644 --- a/gosa-plugins/mail/admin/groups/mail/class_groupMail.inc +++ b/gosa-plugins/mail/admin/groups/mail/class_groupMail.inc @@ -11,7 +11,6 @@ class mailgroup extends plugin var $gosaMailForwardingAddress = array(); // Forwarding also empty var $gosaMailServer = ""; // Selected mailserver var $gosaMailQuota = ""; // Defined Quota - var $quotaUsage = 0; // Currently used quota var $gosaVacationMessage = ""; // Vocation message var $gosaSpamSortLevel = ""; var $gosaSpamMailbox = ""; @@ -20,6 +19,8 @@ class mailgroup extends plugin var $gosaMailMaxSize = ""; // var $FolderType = array("CAT" => '', "SUB_CAT" => ''); + var $quotaUsage = -1; // -1 Means undefined + /* Internal */ var $AclTypes = array(); var $members = array(); // Group members @@ -100,6 +101,7 @@ class mailgroup extends plugin /* Read quota */ $this->gosaMailQuota = $this->mailMethod->getQuota($this->gosaMailQuota); + $this->quotaUsage = $this->mailMethod->getQuotaUsage($this->quotaUsage); if($this->mailMethod->is_error()){ msg_dialog::display(_("Mail error"), sprintf(_("Cannot read quota settings: %s"), $this->mailMethod->get_error()), ERROR_DIALOG); @@ -408,11 +410,9 @@ class mailgroup extends plugin $smarty->assign("AclTypes" , $this->AclTypes); $smarty->assign("quotaEnabled", $this->mailMethod->quotaEnabled()); - $smarty->assign("gosaMailQuota",$this->gosaMailQuota); - if($this->mailMethod->is_connected()){ - $smarty->assign("quotaUsage", $this->mailMethod->getQuotaUsage()); - }else{ - $smarty->assign("quotaUsage", _("Unknown")); + if($this->mailMethod->quotaEnabled()){ + $smarty->assign("gosaMailQuota",$this->gosaMailQuota); + $smarty->assign("quotaUsage", mailMethod::quota_to_image($this->quotaUsage,$this->gosaMailQuota)); } $smarty->assign("MailDomains", $this->mailDomainParts); diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods.inc b/gosa-plugins/mail/personal/mail/class_mail-methods.inc index 9f1cbf7cf..d2d76936d 100644 --- a/gosa-plugins/mail/personal/mail/class_mail-methods.inc +++ b/gosa-plugins/mail/personal/mail/class_mail-methods.inc @@ -725,6 +725,17 @@ class mailMethod{ return(""); } + + static function quota_to_image($use,$quota) + { + if($use == -1 ){ + return(_("Unknown")); + }elseif($quota == 0){ + return(progressbar(100,100,15,true)); + }else{ + return(progressbar(round(($use * 100)/ $quota),100,15,true)); + } + } } diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc index d346f242a..295ab5747 100644 --- a/gosa-plugins/mail/personal/mail/class_mailAccount.inc +++ b/gosa-plugins/mail/personal/mail/class_mailAccount.inc @@ -68,6 +68,8 @@ class mailAccount extends plugin var $gosaSpamMailbox = ""; /* The methods defaults */ + var $quotaUsage = -1; // Means unknown + var $mailMethod = NULL; var $MailDomain = ""; var $sieveManagementUsed = FALSE; @@ -140,6 +142,7 @@ class mailAccount extends plugin /* Read quota */ $this->gosaMailQuota = $this->mailMethod->getQuota($this->gosaMailQuota); + $this->quotaUsage = $this->mailMethod->getQuotaUsage($this->quotaUsage); if($this->mailMethod->is_error()){ msg_dialog::display(_("Mail error"), sprintf(_("Cannot read quota settings: %s"), $this->mailMethod->get_error()), ERROR_DIALOG); @@ -392,12 +395,10 @@ class mailAccount extends plugin $smarty->assign($attr,$this->$attr); } $smarty->assign("quotaEnabled", $this->mailMethod->quotaEnabled()); - if($this->mailMethod->is_connected()){ - $smarty->assign("quotaUsage", $this->mailMethod->getQuotaUsage()); - }else{ - $smarty->assign("quotaUsage", _("Unknown")); + if($this->mailMethod->quotaEnabled()){ + $smarty->assign("quotaUsage", mailMethod::quota_to_image($this->quotaUsage,$this->gosaMailQuota)); + $smarty->assign("gosaMailQuota",$this->gosaMailQuota); } - $smarty->assign("gosaMailQuota",$this->gosaMailQuota); $smarty->assign("domainSelectionEnabled", $this->mailMethod->domainSelectionEnabled()); $smarty->assign("MailDomains", $this->mailDomainParts); $smarty->assign("MailDomain" , $this->mailDomainPart); -- 2.30.2