summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-06-19 17:46:11 +0000
committeralecpl <alec@alec.pl>2010-06-19 17:46:11 +0000
commita2e81736a91f72c8688e6ab0f45061369614dae3 (patch)
tree0912ec132920a80471182cbc52d2d1e6a9b0180e /program/steps/mail/func.inc
parente7ed903a2b25c27470cc54542554adaa63ce372e (diff)
- Move quota indicator to mailboxlist footer
- Fix groupcontrols on IE6 (use gif)
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc53
1 files changed, 24 insertions, 29 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 1614f4ccc..805f0af97 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -130,7 +130,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
if (!$OUTPUT->ajax_call)
$OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash',
- 'movingmessage', 'copyingmessage', 'copy', 'move');
+ 'movingmessage', 'copyingmessage', 'copy', 'move', 'quota');
$OUTPUT->set_pagetitle(rcmail_localize_foldername($mbox_name));
}
@@ -449,13 +449,10 @@ function rcmail_quota_display($attrib)
$quota = rcmail_quota_content($attrib);
- if (is_array($quota)) {
- $OUTPUT->add_script('$(document).ready(function(){
+ $OUTPUT->add_script('$(document).ready(function(){
rcmail.set_quota('.json_serialize($quota).')});', 'foot');
- $quota = '';
- }
- return html::span($attrib, $quota);
+ return html::span($attrib, '');
}
@@ -463,39 +460,37 @@ function rcmail_quota_content($attrib=NULL)
{
global $COMM_PATH, $RCMAIL;
- $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
-
$quota = $RCMAIL->imap->get_quota();
$quota = $RCMAIL->plugins->exec_hook('quota', $quota);
- if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited'))
- return rcube_label('unlimited');
+ $quota_result = (array) $quota;
+ $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
- if ($quota['total'])
- {
+ if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
+ $quota_result['title'] = rcube_label('unlimited');
+ $quota_result['percent'] = 0;
+ }
+ else if ($quota['total']) {
if (!isset($quota['percent']))
- $quota['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
+ $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
- $quota_result = sprintf('%s / %s (%.0f%%)',
+ $title = sprintf('%s / %s (%.0f%%)',
show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
- $quota['percent']);
-
- if ($display == 'image') {
- $quota_result = array(
- 'percent' => $quota['percent'],
- 'title' => $quota_result,
- );
-
- if ($attrib['width'])
- $quota_result['width'] = $attrib['width'];
- if ($attrib['height'])
- $quota_result['height'] = $attrib['height'];
- }
+ $quota_result['percent']);
+
+ $quota_result['title'] = $title;
- return $quota_result;
+ if ($attrib['width'])
+ $quota_result['width'] = $attrib['width'];
+ if ($attrib['height'])
+ $quota_result['height'] = $attrib['height'];
+ }
+ else {
+ $quota_result['title'] = rcube_label('unknown');
+ $quota_result['percent'] = 0;
}
- return rcube_label('unknown');
+ return $quota_result;
}