summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js43
-rw-r--r--program/steps/mail/check_recent.inc2
-rw-r--r--program/steps/mail/func.inc31
-rw-r--r--program/steps/mail/move_del.inc2
-rw-r--r--program/steps/mail/quotadisplay.inc28
-rw-r--r--program/steps/mail/show.inc18
6 files changed, 70 insertions, 54 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 05a4385ab..02c1cf5c2 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -179,7 +179,6 @@ function rcube_webmail()
{
this.enable_command('compose', 'add-contact', false);
parent.rcmail.show_contentframe(true);
- parent.rcmail.mark_message('read', this.env.uid);
}
if ((this.env.action=='show' || this.env.action=='preview') && this.env.blockedobjects)
@@ -1569,6 +1568,28 @@ function rcube_webmail()
this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag);
};
+
+ // set class to read/unread
+ this.mark_as_read_from_preview = function(uid)
+ {
+ var icn_src;
+ var rows = parent.rcmail.message_list.rows;
+ if(rows[uid].unread)
+ {
+ rows[uid].unread = false;
+ rows[uid].classname = rows[uid].classname.replace(/\s*unread/, '');
+ parent.rcmail.set_classname(rows[uid].obj, 'unread', false);
+
+ if (rows[uid].replied && parent.rcmail.env.repliedicon)
+ icn_src = parent.rcmail.env.repliedicon;
+ else if (parent.rcmail.env.messageicon)
+ icn_src = parent.rcmail.env.messageicon;
+
+ if (rows[uid].icon && icn_src)
+ rows[uid].icon.src = icn_src;
+ }
+ }
+
// mark all message rows as deleted/undeleted
this.toggle_delete_status = function(a_uids)
@@ -3254,16 +3275,13 @@ function rcube_webmail()
this.set_page_buttons();
};
+
// replace content of quota display
- this.set_quota = function()
+ this.set_quota = function(content)
{
- if (this.gui_objects.quotadisplay &&
- this.gui_objects.quotadisplay.attributes.getNamedItem('display') &&
- this.gui_objects.quotadisplay.attributes.getNamedItem('id'))
- this.http_request('quotadisplay', '_display='+
- this.gui_objects.quotadisplay.attributes.getNamedItem('display').nodeValue+
- '&_id='+this.gui_objects.quotadisplay.attributes.getNamedItem('id').nodeValue, false);
- };
+ if (this.gui_objects.quotadisplay && content)
+ this.gui_objects.quotadisplay.innerHTML = content;
+ };
// update the mailboxlist
@@ -3308,7 +3326,12 @@ function rcube_webmail()
}
};
-
+ // update parent's mailboxlist (from preview)
+ this.set_unread_count_from_preview = function(mbox, count, set_title)
+ {
+ parent.rcmail.set_unread_count(mbox, count, set_title);
+ }
+
// add row to contacts list
this.add_contact_row = function(cid, cols, select)
{
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)
{