diff options
author | thomascube <thomas@roundcube.net> | 2006-09-01 13:43:14 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2006-09-01 13:43:14 +0000 |
commit | 3ea0e3202a73eb7efcbf0b825582a6d3504658aa (patch) | |
tree | 1ec2e9f514a4b294bcf35450537ce9b1d01fb8f1 /program/steps/mail/func.inc | |
parent | ea206d3d9299ce32996dcd24d49790e36f2b89a2 (diff) |
Quota display as image
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r-- | program/steps/mail/func.inc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 58da0ca45..986a4c955 100644 --- a/program/steps/mail/func.inc +++ b/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 <span> 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('<img src="%s&_action=quotaimg&u=%s&q=%d" alt="%s" width="102" height="15" />', + $COMM_PATH, + $quota['used'], $quota['total'], + $quota_text); + } + } + else $quota_text = rcube_label('unlimited'); + $out = '<span' . $attrib_str . '>'; $out .= $quota_text; |