diff options
author | svncommit <devs@roundcube.net> | 2006-12-18 09:11:57 +0000 |
---|---|---|
committer | svncommit <devs@roundcube.net> | 2006-12-18 09:11:57 +0000 |
commit | 23796ec2909bf9cb3ae846f9d124a1098672c5ff (patch) | |
tree | a7e579c977d414541ced08424b20413253ad7462 /program/steps | |
parent | 04d6304b4d1b272d5cd533abfbc2240d8ce77c38 (diff) |
Fix display of quota image/text after a remote command.
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/func.inc | 25 | ||||
-rw-r--r-- | program/steps/mail/quotadisplay.inc | 29 |
2 files changed, 45 insertions, 9 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 5e91d162f..0f062156c 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -634,7 +634,7 @@ function rcmail_messagecount_display($attrib) function rcmail_quota_display($attrib) { - global $IMAP, $OUTPUT, $JS_OBJECT_NAME, $COMM_PATH; + global $OUTPUT, $JS_OBJECT_NAME, $COMM_PATH; if (!$attrib['id']) $attrib['id'] = 'rcmquotadisplay'; @@ -642,7 +642,18 @@ function rcmail_quota_display($attrib) $OUTPUT->add_script(sprintf("%s.gui_object('quotadisplay', '%s');", $JS_OBJECT_NAME, $attrib['id'])); // allow the following attributes to be added to the <span> tag - $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id')); + $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'display')); + + $out = '<span' . $attrib_str . '>'; + $out .= rcmail_quota_content($attrib['display']); + $out .= '</span>'; + return $out; + } + + +function rcmail_quota_content($display) + { + global $IMAP, $COMM_PATH; if (!$IMAP->get_capability('QUOTA')) $quota_text = rcube_label('unknown'); @@ -654,9 +665,9 @@ function rcmail_quota_display($attrib) $quota["percent"]); // show quota as image (by Brett Patterson) - if ($attrib['display'] == 'image' && function_exists('imagegif')) + if ($display == 'image' && function_exists('imagegif')) { - $attrib += array('width' => 100, 'height' => 14); + $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'], @@ -669,12 +680,8 @@ function rcmail_quota_display($attrib) } else $quota_text = rcube_label('unlimited'); - - $out = '<span' . $attrib_str . '>'; - $out .= $quota_text; - $out .= '</span>'; - return $out; + return $quota_text; } diff --git a/program/steps/mail/quotadisplay.inc b/program/steps/mail/quotadisplay.inc new file mode 100644 index 000000000..c96a7a7ee --- /dev/null +++ b/program/steps/mail/quotadisplay.inc @@ -0,0 +1,29 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | program/steps/mail/quotadisplay.inc | + | | + | This file is part of the RoundCube Webmail client | + | Copyright (C) 2005, RoundCube Dev. - Switzerland | + | Licensed under the GNU GPL | + | | + | PURPOSE: | + | Remote call to return the quota image or text | + | | + +-----------------------------------------------------------------------+ + | Author: Robin Elfrink <robin@15augustus.nl> | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +$display = isset($_GET['_display']) ? $_GET['_display'] : 'text'; +$id = isset($_GET['_id']) ? $_GET['_id'] : 'rcmquotadisplay'; +$quota = rcmail_quota_content($display); +$command = sprintf("this.gui_objects.%s.innerHTML = '%s';\n", $id, $quota); +rcube_remote_response($command); + +exit; +?> |