From 1c7b97e81bea919c26bfe878312c5118c02ac0a9 Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 13 Mar 2007 23:17:20 +0000 Subject: Fixed flag for deletion bug #1484264 + code style --- program/js/app.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 376990cb1..c19a3e14a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1355,15 +1355,14 @@ function rcube_webmail() // delete selected messages from the current mailbox this.delete_messages = function() { + var selection = this.message_list ? this.message_list.get_selection() : new Array(); + // exit if no mailbox specified or if selection is empty - if (!this.env.uid) - { - if (!this.message_list || !this.message_list.get_selection().length) + if (!this.env.uid && !selection.length) return; - } // if there is a trash mailbox defined and we're not currently in it: - if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase()!=String(this.env.trash_mailbox).toLowerCase()) + if (this.env.trash_mailbox && String(this.env.mailbox).toLowerCase() != String(this.env.trash_mailbox).toLowerCase()) { // if shift was pressed delete it immediately if (this.message_list && this.message_list.shiftkey) @@ -1380,8 +1379,7 @@ function rcube_webmail() // if there isn't a defined trash mailbox and the config is set to flag for deletion else if (!this.env.trash_mailbox && this.env.flag_for_deletion) { - flag = 'delete'; - this.mark_message(flag); + this.mark_message('delete'); if(this.env.action=="show") this.command('nextmessage','',this); else if (selection.length == 1) @@ -1399,7 +1397,7 @@ function rcube_webmail() // exit if no mailbox specified or if selection is empty if (!this.env.uid && (!this.message_list || !this.message_list.get_selection().length)) return; - + this.show_messageframe(false); this._with_selected_messages('delete', false, '&_from='+(this.env.action ? this.env.action : '')); }; @@ -1444,13 +1442,13 @@ function rcube_webmail() a_uids[0] = uid; else if (this.env.uid) a_uids[0] = this.env.uid; - else + else if (this.message_list) { - var id; - for (var n=0; n 0) { + if (rows[uid].classname.indexOf('deleted') > 0) + { rows[uid].classname = rows[uid].classname.replace(/\s*deleted/, ''); this.set_classname(rows[uid].obj, 'deleted', false); } @@ -1593,7 +1596,8 @@ function rcube_webmail() return false; var rows = this.message_list.rows; - for (var i=0; i