diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/check_recent.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 31 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/quotadisplay.inc | 28 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 18 |
5 files changed, 37 insertions, 44 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index 3e0301613..dee8ca61b 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -37,7 +37,7 @@ foreach ($a_mailboxes as $mbox_name) $OUTPUT->set_env('messagecount', $IMAP->messagecount()); $OUTPUT->command('set_unread_count', $mbox_name, $unread_count, ($mbox_name == 'INBOX')); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text()); - $OUTPUT->command('set_quota', $IMAP->get_quota()); + $OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota())); // add new message headers to list $a_headers = array(); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index af3618112..393fcaa10 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -408,30 +408,43 @@ function rcmail_quota_display($attrib) if (!$attrib['id']) $attrib['id'] = 'rcmquotadisplay'; + if(isset($attrib['display'])) + $_SESSION['quota_display'] = $attrib['display']; + $OUTPUT->add_gui_object('quotadisplay', $attrib['id']); // allow the following attributes to be added to the <span> tag $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'display')); $out = '<span' . $attrib_str . '>'; - $out .= rcmail_quota_content($attrib['display']); + $out .= rcmail_quota_content(); $out .= '</span>'; return $out; } -function rcmail_quota_content($display) +function rcmail_quota_content($quota=NULL) { global $IMAP, $COMM_PATH; - if (!$IMAP->get_capability('QUOTA')) - $quota_text = rcube_label('unknown'); - else if ($quota = $IMAP->get_quota()) + $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; + + if (is_array($quota) && !empty($quota['used']) && !empty($quota['total'])) + { + if (!isset($quota['percent'])) + $quota['percent'] = $quota['used'] / $quota['total']; + } + elseif (!$IMAP->get_capability('QUOTA')) + return rcube_label('unknown'); + else + $quota = $IMAP->get_quota(); + + if ($quota) { - $quota_text = sprintf("%s / %s (%.0f%%)", - show_bytes($quota["used"] * 1024), - show_bytes($quota["total"] * 1024), - $quota["percent"]); + $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 ($display == 'image' && function_exists('imagegif')) diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index 3bc644f49..131ad2e4f 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -92,7 +92,7 @@ $OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN') if ($_action=='moveto' && $target) $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN')); -$OUTPUT->command('set_quota', $IMAP->get_quota()); +$OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota())); // add new rows from next page (if any) if ($_POST['_from']!='show' && ($jump_back || $nextpage_count > 0)) diff --git a/program/steps/mail/quotadisplay.inc b/program/steps/mail/quotadisplay.inc deleted file mode 100644 index 223dd5824..000000000 --- a/program/steps/mail/quotadisplay.inc +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -/* - +-----------------------------------------------------------------------+ - | program/steps/mail/quotadisplay.inc | - | | - | This file is part of the RoundCube Webmail client | - | Copyright (C) 2005-2007, 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); -$OUTPUT->remote_response(sprintf("this.gui_objects.%s.innerHTML = '%s';\n", $id, $quota)); - -exit; -?> diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 27d26603f..94e4c6105 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -53,8 +53,10 @@ if ($_GET['_uid']) else if ($_SESSION['safe_messages'][$MESSAGE['UID']]) $MESSAGE['is_safe'] = 1; + $mbox_name = $IMAP->get_mailbox_name(); + // calculate Etag for this request - $etag = md5($MESSAGE['UID'].$IMAP->get_mailbox_name().session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['is_safe']).intval($PRINT_MODE)); + $etag = md5($MESSAGE['UID'].$mbox_name.session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['is_safe']).intval($PRINT_MODE)); // allow caching, unless remote images are present if ((bool)$MESSAGE['is_safe']) @@ -75,17 +77,23 @@ if ($_GET['_uid']) else $MESSAGE['body'] = $IMAP->get_body($MESSAGE['UID']); - // mark message as read - if (!$MESSAGE['headers']->seen && $_action != 'preview') - $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); + if (!$MESSAGE['headers']->seen) + { + $marked = $IMAP->set_flag($MESSAGE['UID'], 'SEEN'); + if($_action == 'preview' && $marked != -1) + { + $OUTPUT->command('set_unread_count_from_preview', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX')); + $OUTPUT->command('mark_as_read_from_preview', $MESSAGE['UID']); + } + } // give message uid to the client $OUTPUT->set_env('uid', $MESSAGE['UID']); $OUTPUT->set_env('safemode', $MESSAGE['is_safe']); // check for unset disposition notification - if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $IMAP->get_mailbox_name() != $CONFIG['drafts_mbox']) + if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $mbox_name != $CONFIG['drafts_mbox']) { if (intval($CONFIG['mdn_requests']) === 1) { |