summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js11
-rw-r--r--program/steps/mail/check_recent.inc4
-rw-r--r--program/steps/mail/folders.inc1
-rw-r--r--program/steps/mail/list.inc1
-rw-r--r--program/steps/mail/move_del.inc7
-rw-r--r--program/steps/mail/search.inc1
6 files changed, 15 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 4094a67ad..b5bf1840a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -651,13 +651,13 @@ function rcube_webmail()
break;
case 'expunge':
- if (this.env.messagecount)
+ if (this.env.exists)
this.expunge_mailbox(this.env.mailbox);
break;
case 'purge':
case 'empty-mailbox':
- if (this.env.messagecount)
+ if (this.env.exists)
this.purge_mailbox(this.env.mailbox);
break;
@@ -2971,7 +2971,7 @@ function rcube_webmail()
// test if purge command is allowed
this.purge_mailbox_test = function()
{
- return (this.env.messagecount && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox
+ return (this.env.exists && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox
|| this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter))
|| this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter))));
};
@@ -6228,7 +6228,7 @@ function rcube_webmail()
case 'purge':
case 'expunge':
if (this.task == 'mail') {
- if (!this.env.messagecount) {
+ if (!this.env.exists) {
// clear preview pane content
if (this.env.contentframe)
this.show_contentframe(false);
@@ -6248,7 +6248,8 @@ function rcube_webmail()
this.env.qsearch = null;
case 'list':
if (this.task == 'mail') {
- this.enable_command('show', 'expunge', 'select-all', 'select-none', (this.env.messagecount > 0));
+ this.enable_command('show', 'select-all', 'select-none', this.env.messagecount > 0);
+ this.enable_command('expunge', this.env.exists);
this.enable_command('purge', this.purge_mailbox_test());
this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading && this.env.messagecount);
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index 61693b4ed..4befbf275 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -75,13 +75,15 @@ foreach ($a_mailboxes as $mbox_name) {
if (!empty($_GET['_quota']))
$OUTPUT->command('set_quota', rcmail_quota_content());
+ $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS'));
+
// "No-list" mode, don't get messages
if (empty($_GET['_list']))
continue;
// get overall message count; allow caching because rcube_storage::folder_status() did a refresh
$list_mode = $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL';
- $all_count = $RCMAIL->storage->count(null, $list_mode, false, false);
+ $all_count = $RCMAIL->storage->count($mbox_name, $list_mode, false, false);
$page = $RCMAIL->storage->get_page();
$page_size = $RCMAIL->storage->get_pagesize();
diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc
index c56c914cd..574d6e975 100644
--- a/program/steps/mail/folders.inc
+++ b/program/steps/mail/folders.inc
@@ -65,6 +65,7 @@ else if ($RCMAIL->action == 'purge')
if (!empty($_REQUEST['_reload'])) {
$OUTPUT->set_env('messagecount', 0);
$OUTPUT->set_env('pagecount', 0);
+ $OUTPUT->set_env('exists', 0);
$OUTPUT->command('message_list.clear');
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text(), $mbox);
$OUTPUT->command('set_unread_count', $mbox, 0);
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index b433f81fc..b8c3ee021 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -95,6 +95,7 @@ $OUTPUT->set_env('messagecount', $count);
$OUTPUT->set_env('pagecount', $pages);
$OUTPUT->set_env('threading', $threading);
$OUTPUT->set_env('current_page', $count ? $RCMAIL->storage->get_page() : 1);
+$OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS'));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name);
$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index da43b4000..3e2252683 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -38,7 +38,7 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_targe
if (!$moved) {
// send error message
- if ($_POST['_from'] != 'show')
+ if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
rcmail_display_server_error('errormoving');
$OUTPUT->send();
@@ -59,7 +59,7 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
if (!$del) {
// send error message
- if ($_POST['_from'] != 'show')
+ if ($_POST['_from'] != 'show')
$OUTPUT->command('list_mailbox');
rcmail_display_server_error('errordeleting');
$OUTPUT->send();
@@ -111,6 +111,7 @@ else
$OUTPUT->set_env('messagecount', $msg_count);
$OUTPUT->set_env('current_page', $page);
$OUTPUT->set_env('pagecount', $pages);
+ $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox, 'EXISTS', true));
// update mailboxlist
$mbox = $RCMAIL->storage->get_folder();
@@ -144,5 +145,3 @@ else
// send response
$OUTPUT->send();
-
-
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index db5424b3b..f9b8f9e67 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -143,5 +143,6 @@ else {
$OUTPUT->set_env('search_request', $search_str ? $search_request : '');
$OUTPUT->set_env('messagecount', $count);
$OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->storage->get_pagesize()));
+$OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS'));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox);
$OUTPUT->send();