From d41d67add6d2bc226544148730928ca31a2c4313 Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 7 Apr 2008 17:58:20 +0000 Subject: - better commands enabling/disabling after get/post response, fixes: when delete last (selected) message in mailbox content in preview pane should be cleaned, when delete last (selected) message in mailbox sellect-all, purge and others commands should be disabled, and probably other related bugs --- program/js/app.js | 24 ++++++++++++++++++------ program/steps/mail/move_del.inc | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'program') diff --git a/program/js/app.js b/program/js/app.js index e6b6cff7c..a24745645 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3453,25 +3453,37 @@ function rcube_webmail() // process the response data according to the sent action switch (request_obj.__action) { + case 'delete': case 'moveto': if (this.env.action=='show') this.command('list'); else if (this.message_list) this.message_list.init(); - break; case 'purge': + case 'expunge': + if (!this.env.messagecount) + { + // clear preview pane content + if (this.env.contentframe) + this.show_contentframe(false); + // disable commands useless when mailbox is empty + this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', + 'print', 'load-attachment', 'purge', 'expunge', 'select-all', 'select-none', 'sort', false); + } + + break; + case 'list': - this.enable_command('purge', (this.env.messagecount && (this.env.mailbox==this.env.trash_mailbox || this.env.mailbox==this.env.junk_mailbox))); this.msglist_select(this.message_list); + case 'check-recent': case 'getunread': - this.enable_command('sort', (this.env.messagecount > 0)); + this.enable_command('show', 'expunge', 'select-all', 'select-none', 'sort', (this.env.messagecount > 0)); + this.enable_command('purge', (this.env.messagecount && (this.env.mailbox==this.env.trash_mailbox || this.env.mailbox==this.env.junk_mailbox))); - case 'expunge': - this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false); - break; + break; } diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index b6ec20773..3bc644f49 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -80,6 +80,7 @@ if ($IMAP->list_page > 1 && $nextpage_count <= 0 && $remaining == 0) // update message count display $OUTPUT->set_env('pagecount', $pages); +$OUTPUT->set_env('messagecount', $msg_count); $OUTPUT->set_env('current_page', $IMAP->list_page); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count)); -- cgit v1.2.3