From b9ce8aabca52046f1f5726a3506a7091c7fa073a Mon Sep 17 00:00:00 2001 From: thomasb Date: Fri, 1 Sep 2006 13:43:14 +0000 Subject: Quota display as image git-svn-id: https://svn.roundcube.net/trunk@331 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/steps/mail/func.inc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'roundcubemail/program/steps/mail/func.inc') diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc index 58da0ca45..986a4c955 100644 --- a/roundcubemail/program/steps/mail/func.inc +++ b/roundcubemail/program/steps/mail/func.inc @@ -611,7 +611,7 @@ function rcmail_messagecount_display($attrib) function rcmail_quota_display($attrib) { - global $IMAP, $OUTPUT, $JS_OBJECT_NAME; + global $IMAP, $OUTPUT, $JS_OBJECT_NAME, $COMM_PATH; if (!$attrib['id']) $attrib['id'] = 'rcmquotadisplay'; @@ -620,11 +620,28 @@ function rcmail_quota_display($attrib) // allow the following attributes to be added to the tag $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); - + if (!$IMAP->get_capability('QUOTA')) $quota_text = rcube_label('unknown'); - else if (!($quota_text = $IMAP->get_quota())) + else if ($quota = $IMAP->get_quota()) + { + $quota_text = sprintf("%s / %s (%.0f%%)", + show_bytes($quota["used"] * 1024), + show_bytes($quota["total"] * 1024), + $quota["percent"]); + + // show quota as image (by Brett Patterson) + if ($attrib['display'] == 'image' && function_exists('imagegif')) + { + $quota_text = sprintf('%s', + $COMM_PATH, + $quota['used'], $quota['total'], + $quota_text); + } + } + else $quota_text = rcube_label('unlimited'); + $out = ''; $out .= $quota_text; -- cgit v1.2.3