diff options
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 44 | ||||
-rw-r--r-- | program/js/common.js | 6 |
2 files changed, 40 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js index 3c91490f6..e0e31ed09 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -145,6 +145,9 @@ function rcube_webmail() if (this.env.messagecount) this.enable_command('select-all', 'select-none', 'sort', 'expunge', true); + if (this.env.messagecount && this.env.mailbox==this.env.trash_mailbox) + this.enable_command('purge', true); + this.set_page_buttons(); // focus this window @@ -622,9 +625,10 @@ function rcube_webmail() this.expunge_mailbox(this.env.mailbox); break; - case 'clear-mailbox': - //if (this.env.messagecount) - //this.clear_mailbox(this.env.mailbox); + case 'purge': + case 'empty-mailbox': + if (this.env.messagecount) + this.purge_mailbox(this.env.mailbox); break; @@ -1435,6 +1439,28 @@ function rcube_webmail() }; + this.purge_mailbox = function(mbox) + { + var lock = false; + var add_url = ''; + + if (!confirm(this.get_label('purgefolderconfirm'))) + return false; + + // lock interface if it's the active mailbox + if (mbox == this.env.mailbox) + { + lock = true; + this.set_busy(true, 'loading'); + add_url = '&_reload=1'; + } + + // send request to server + var url = '_mbox='+escape(mbox); + this.http_request('purge', url+add_url, lock); + }; + + // move selected messages to the specified mailbox this.move_messages = function(mbox) { @@ -2068,6 +2094,7 @@ function rcube_webmail() return false; //if (this.env.framed && add_url=='') + // add_url = '&_framed=1'; if (action && (cid || action=='add')) @@ -2081,9 +2108,9 @@ function rcube_webmail() this.delete_contacts = function() { // exit if no mailbox specified or if selection is empty - if (!(this.selection.length || this.env.cid)) + if (!(this.selection.length || this.env.cid) || !confirm(this.get_label('deletecontactconfirm'))) return; - + var a_cids = new Array(); if (this.env.cid) @@ -2821,7 +2848,7 @@ function rcube_webmail() if (request_obj.__lock) this.set_busy(false); - console(request_obj.responseText); + console(request_obj.get_text()); // if we get javascript code from server -> execute it if (request_obj.get_text() && (ctype=='text/javascript' || ctype=='application/x-javascript')) @@ -2837,9 +2864,12 @@ function rcube_webmail() break; case 'list': + if (this.env.messagecount) + this.enable_command('purge', (this.env.mailbox==this.env.trash_mailbox)); + case 'expunge': this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false); - break; + break; } request_obj.reset(); diff --git a/program/js/common.js b/program/js/common.js index 02f698b90..8378e2e57 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -6,11 +6,11 @@ | Copyright (C) 2005, RoundCube Dev, - Switzerland | | Licensed under the GNU GPL | | | - | Modified:2005/11/06 (roundcube) | - | | +-----------------------------------------------------------------------+ | Author: Thomas Bruederli <roundcube@gmail.com> | +-----------------------------------------------------------------------+ + + $Id$ */ @@ -271,7 +271,7 @@ function rcube_check_email(input, inline) { var reg_str = '([a-z0-9][-a-z0-9\.\+_]*)\@(([-a-z0-9][\.]?)*[a-z0-9]\.[a-z]{2,9})'; var reg1 = inline ? new RegExp(reg_str, 'i') : new RegExp('^'+reg_str+'$', 'i'); - var reg2 = /[\._\-\@]{2}/; + var reg2 = /[\._\-]{2}/; return reg1.test(input) && !reg2.test(input) ? true : false; } return false; |