From 2f2f15b7aabe19e45dad9bddb7eb7f4394aa1e21 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Mon, 04 Sep 2006 08:26:30 -0400 Subject: [PATCH] Little improvements for message parsing and encoding --- program/steps/mail/func.inc | 28 +++++++++++++++++++++++++--- 1 files changed, 25 insertions(+), 3 deletions(-) diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 58da0ca..0cd6652 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -611,7 +611,7 @@ 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,33 @@ // 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')) + { + $attrib += array('width' => 100, 'height' => 14); + $quota_text = sprintf('<img src="%s&_action=quotaimg&u=%s&q=%d&w=%d&h=%d" width="%d" height="%d" alt="%s" title="%s / %s" />', + $COMM_PATH, + $quota['used'], $quota['total'], + $attrib['width'], $attrib['height'], + $attrib['width'], $attrib['height'], + $quota_text, + show_bytes($quota["used"] * 1024), + show_bytes($quota["total"] * 1024)); + } + } + else $quota_text = rcube_label('unlimited'); + $out = '<span' . $attrib_str . '>'; $out .= $quota_text; -- Gitblit v1.9.1