summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail.php2
-rw-r--r--program/js/app.js70
-rw-r--r--program/steps/mail/move_del.inc7
3 files changed, 47 insertions, 32 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 965242037..f3b39709e 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -243,7 +243,7 @@ class rcmail
if (!($this->output instanceof rcube_template))
$this->output = new rcube_template($this->task, $framed);
- foreach (array('flag_for_deletion') as $js_config_var) {
+ foreach (array('flag_for_deletion','read_when_deleted') as $js_config_var) {
$this->output->set_env($js_config_var, $this->config->get($js_config_var));
}
diff --git a/program/js/app.js b/program/js/app.js
index 20c561a5f..a86f41c5c 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1282,8 +1282,8 @@ function rcube_webmail()
if (!show && window.frames[this.env.contentframe])
{
if (window.frames[this.env.contentframe].location.href.indexOf(this.env.blankpage)<0)
- window.frames[this.env.contentframe].location.href = this.env.blankpage;
- }
+ window.frames[this.env.contentframe].location.href = this.env.blankpage;
+ }
else if (!bw.safari)
frm.style.display = show ? 'block' : 'none';
}
@@ -1506,13 +1506,13 @@ function rcube_webmail()
// Send a specifc request with UIDs of all selected messages
// @private
this._with_selected_messages = function(action, lock, add_url, remove)
- {
+ {
var a_uids = new Array();
if (this.env.uid)
a_uids[0] = this.env.uid;
else
- {
+ {
var selection = this.message_list.get_selection();
var rows = this.message_list.rows;
var id;
@@ -1521,23 +1521,28 @@ function rcube_webmail()
id = selection[n];
a_uids[a_uids.length] = id;
- if (remove)
+ if (remove)
this.message_list.remove_row(id, (n == selection.length-1));
else
- {
- rows[id].deleted = true;
+ {
+ rows[id].deleted = true;
if (rows[id].classname.indexOf('deleted')<0)
- {
+ {
rows[id].classname += ' deleted';
this.set_classname(rows[id].obj, 'deleted', true);
- }
+ }
+ if (this.env.read_when_deleted)
+ {
+ rows[id].classname = rows[id].classname.replace(/\s*unread/, '');
+ this.set_classname(rows[id].obj, 'unread', false);
+ }
- if (rows[id].icon && this.env.deletedicon)
+ if (rows[id].icon && this.env.deletedicon)
rows[id].icon.src = this.env.deletedicon;
- }
}
}
+ }
// also send search request to get the right messages
if (this.env.search_request)
@@ -1545,7 +1550,7 @@ function rcube_webmail()
// send request to server
this.http_post(action, '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock);
- };
+ };
// set a specific flag to one or more messages
@@ -1574,14 +1579,14 @@ function rcube_webmail()
{
id = a_uids[n];
if ((flag=='read' && this.message_list.rows[id].unread)
- || (flag=='unread' && !this.message_list.rows[id].unread)
- || (flag=='delete' && !this.message_list.rows[id].deleted)
- || (flag=='undelete' && this.message_list.rows[id].deleted)
- || (flag=='flagged' && !this.message_list.rows[id].flagged)
- || (flag=='unflagged' && this.message_list.rows[id].flagged))
- {
- r_uids[r_uids.length] = id;
- }
+ || (flag=='unread' && !this.message_list.rows[id].unread)
+ || (flag=='delete' && !this.message_list.rows[id].deleted)
+ || (flag=='undelete' && this.message_list.rows[id].deleted)
+ || (flag=='flagged' && !this.message_list.rows[id].flagged)
+ || (flag=='unflagged' && this.message_list.rows[id].flagged))
+ {
+ r_uids[r_uids.length] = id;
+ }
}
// nothing to do
@@ -1636,7 +1641,7 @@ function rcube_webmail()
}
if (rows[uid].icon && icn_src
- && !(rows[uid].replied && this.env.repliedicon)
+ && !(rows[uid].replied && this.env.repliedicon)
&& !(rows[uid].deleted && this.env.deletedicon))
rows[uid].icon.src = icn_src;
}
@@ -1657,13 +1662,13 @@ function rcube_webmail()
parent.rcmail.set_classname(rows[uid].obj, 'unread', false);
if (rows[uid].replied && parent.rcmail.env.repliedicon)
- icn_src = parent.rcmail.env.repliedicon;
+ icn_src = parent.rcmail.env.repliedicon;
else if (rows[uid].deleted && parent.rcmail.env.deletedicon)
- icn_src = parent.rcmail.env.deletedicon;
+ icn_src = parent.rcmail.env.deletedicon;
else if (parent.rcmail.env.messageicon)
icn_src = parent.rcmail.env.messageicon;
- if (rows[uid].icon && icn_src)
+ if (rows[uid].icon && icn_src)
rows[uid].icon.src = icn_src;
}
}
@@ -1779,16 +1784,21 @@ function rcube_webmail()
rows[uid].deleted = true;
if (rows[uid].classname.indexOf('deleted')<0)
- {
+ {
rows[uid].classname += ' deleted';
this.set_classname(rows[uid].obj, 'deleted', true);
}
-
- if (rows[uid].icon && this.env.deletedicon)
+ if (this.env.read_when_deleted)
+ {
+ rows[uid].classname = rows[uid].classname.replace(/\s*unread/, '');
+ this.set_classname(rows[uid].obj, 'unread', false);
+ }
+
+ if (rows[uid].icon && this.env.deletedicon)
rows[uid].icon.src = this.env.deletedicon;
- if (rows[uid].unread)
- r_uids[r_uids.length] = uid;
+ if (rows[uid].unread)
+ r_uids[r_uids.length] = uid;
}
}
@@ -1817,7 +1827,7 @@ function rcube_webmail()
if (rows[uid])
{
rows[uid].unread = false;
- rows[uid].read = true;
+ rows[uid].read = true;
rows[uid].classname = rows[uid].classname.replace(/\s*unread/, '');
this.set_classname(rows[uid].obj, 'unread', false);
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index d8a017171..5fbb41c55 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -29,7 +29,12 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_targe
$target = get_input_value('_target_mbox', RCUBE_INPUT_POST);
$moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_POST));
- if (!$moved) {
+ if ($moved) {
+ // flag old messages as read because rcube_imap will not send expunge command after moving
+ if ($CONFIG['read_when_deleted'])
+ $IMAP->set_flag($uids, 'SEEN');
+ }
+ else {
// send error message
$OUTPUT->command('list_mailbox');
$OUTPUT->show_message('errormoving', 'error');