summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/check_recent.inc5
-rw-r--r--program/steps/mail/copy.inc16
-rw-r--r--program/steps/mail/folders.inc4
-rw-r--r--program/steps/mail/list.inc9
-rw-r--r--program/steps/mail/move_del.inc15
-rw-r--r--program/steps/mail/search.inc16
-rw-r--r--program/steps/settings/edit_folder.inc4
-rw-r--r--program/steps/settings/folders.inc4
8 files changed, 50 insertions, 23 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index 70f4c03a6..b95819415 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -77,12 +77,13 @@ foreach ($a_mailboxes as $mbox_name) {
if ($search_request && isset($_SESSION['search'])) {
unset($search_request); // only do this once
$_SESSION['search'] = $RCMAIL->storage->refresh_search();
- if ($_SESSION['search'][1]->multi)
+ if ($_SESSION['search'][1]->multi) {
$mbox_name = '';
+ }
}
if (!empty($_POST['_quota'])) {
- $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $mbox_name));
}
$OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS', true));
diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc
index 86586d34d..585310d47 100644
--- a/program/steps/mail/copy.inc
+++ b/program/steps/mail/copy.inc
@@ -24,15 +24,19 @@ if (!$OUTPUT->ajax_call) {
return;
}
-// move messages
+// copy messages
if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
- $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
+ $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
+ $sources = array();
- foreach (rcmail::get_uids() as $mbox => $uids) {
- if ($mbox === $target)
+ foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) {
+ if ($mbox === $target) {
$copied++;
- else
+ }
+ else {
$copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox);
+ $sources[] = $mbox;
+ }
}
if (!$copied) {
@@ -47,7 +51,7 @@ if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
rcmail_send_unread_count($target, true);
- $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? $sources[0] : 'INBOX'));
}
// unknown action or missing query param
else {
diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc
index 519a41fdd..49bf25377 100644
--- a/program/steps/mail/folders.inc
+++ b/program/steps/mail/folders.inc
@@ -35,7 +35,7 @@ if ($RCMAIL->action == 'expunge') {
$OUTPUT->show_message('folderexpunged', 'confirmation');
if (!empty($_REQUEST['_reload'])) {
- $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $mbox));
$OUTPUT->command('message_list.clear');
$RCMAIL->action = 'list';
return;
@@ -69,7 +69,7 @@ else if ($RCMAIL->action == 'purge') {
$OUTPUT->command('message_list.clear');
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text(), $mbox);
$OUTPUT->command('set_unread_count', $mbox, 0);
- $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $mbox));
rcmail_set_unseen_count($mbox, 0);
// set trash folder state
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 496c95146..2dcc40d17 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -68,6 +68,8 @@ if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') {
$OUTPUT->set_env('search_request', $search_request);
$OUTPUT->set_env('search_filter', $_SESSION['search_filter']);
+
+ $multifolder = is_a($_SESSION['search'][1], 'rcube_result_multifolder');
}
// fetch message headers
@@ -96,12 +98,13 @@ rcmail_send_unread_count($mbox_name, !empty($_REQUEST['_refresh']), $unseen);
// update message count display
$pages = ceil($count/$RCMAIL->storage->get_pagesize());
+$page = $count ? $RCMAIL->storage->get_page() : 1;
$exists = $RCMAIL->storage->count($mbox_name, 'EXISTS', true);
$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('current_page', $page);
$OUTPUT->set_env('exists', $exists);
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name);
@@ -143,5 +146,9 @@ if ($mbox_name === $RCMAIL->config->get('trash_mbox')) {
$OUTPUT->command('set_trash_count', $exists);
}
+if ($page == 1) {
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? 'INBOX' : $mbox_name));
+}
+
// send response
$OUTPUT->send();
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index d98d49d1f..81d476b2e 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -27,6 +27,7 @@ if (!$OUTPUT->ajax_call)
$threading = (bool) $RCMAIL->storage->get_threading();
$old_count = $RCMAIL->storage->count(NULL, $threading ? 'THREADS' : 'ALL');
$old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize());
+$sources = array();
$trash = $RCMAIL->config->get('trash_mbox');
@@ -36,12 +37,13 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe
$trash = $RCMAIL->config->get('trash_mbox');
$success = true;
- foreach (rcmail::get_uids() as $mbox => $uids) {
+ foreach (rcmail::get_uids(null, null, multifolder) as $mbox => $uids) {
if ($mbox === $target) {
$count += count($uids);
}
else if ($RCMAIL->storage->move_message($uids, $target, $mbox)) {
$count += count($uids);
+ $sources[] = $mbox;
}
else {
$success = false;
@@ -69,10 +71,11 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe
}
}
// delete messages
-else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
- foreach (rcmail::get_uids() as $mbox => $uids) {
- $del += (int)$RCMAIL->storage->delete_message($uids, $mbox);
- $count += count($uids);
+else if ($RCMAIL->action == 'delete' && !empty($_POST['_uid'])) {
+ foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) {
+ $del += (int)$RCMAIL->storage->delete_message($uids, $mbox);
+ $count += count($uids);
+ $sources[] = $mbox;
}
if (!$del) {
@@ -146,7 +149,7 @@ else {
rcmail_send_unread_count($target, true);
}
- $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? $sources[0] : 'INBOX'));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox);
if ($threading) {
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 4aa22e14b..b50593480 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -127,8 +127,9 @@ if ($search_str) {
}
else if ($scope == 'sub') {
$mboxes = $RCMAIL->storage->list_folders_subscribed($mbox, '*', 'mail');
- if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX')
+ if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX') {
array_shift($mboxes);
+ }
}
$result = $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column);
@@ -144,7 +145,7 @@ if ($search_str) {
$_SESSION['last_text_search'] = $str;
}
$_SESSION['search_request'] = $search_request;
-$_SESSION['search_scope'] = $scope;
+$_SESSION['search_scope'] = $scope;
// Get the headers
@@ -181,10 +182,13 @@ else if ($result->incomplete) {
else {
$OUTPUT->show_message('searchnomatch', 'notice');
$OUTPUT->set_env('multifolder_listing', (bool)$result->multi);
- if ($result->multi && $scope == 'all')
+ if ($result->multi && $scope == 'all') {
$OUTPUT->command('select_folder', '');
+ }
}
+$OUTPUT->set_pagetitle($RCMAIL->gettext(array('name' => 'searchfor', 'vars' => array('q' => $str))));
+
// update message count display
$OUTPUT->set_env('search_request', $search_str ? $search_request : '');
$OUTPUT->set_env('search_filter', $_SESSION['search_filter']);
@@ -193,5 +197,9 @@ $OUTPUT->set_env('messagecount', $count);
$OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->storage->get_pagesize()));
$OUTPUT->set_env('exists', $mbox === null ? 0 : $RCMAIL->storage->count($mbox, 'EXISTS'));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox);
-$OUTPUT->set_pagetitle($RCMAIL->gettext(array('name' => 'searchfor', 'vars' => array('q' => $str))));
+
+if (!$result->incomplete) {
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $result->multi ? 'INBOX' : $mbox));
+}
+
$OUTPUT->send();
diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc
index 87a45fa8d..51f4d8d72 100644
--- a/program/steps/settings/edit_folder.inc
+++ b/program/steps/settings/edit_folder.inc
@@ -290,6 +290,10 @@ function rcmail_folder_form($attrib)
$RCMAIL->output->set_env('messagecount', (int) $msgcount);
+ if ($mbox_imap !== null && empty($_POST)) {
+ $RCMAIL->output->command('parent.set_quota', $RCMAIL->quota_content(null, $mbox_imap));
+ }
+
return $out;
}
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 8b74a59e1..33b2b0624 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -134,7 +134,7 @@ else if ($RCMAIL->action == 'purge') {
$success = $STORAGE->delete_message('*', $mbox);
$delete = true;
}
- // copy to Trash
+ // move to Trash
else {
$success = $STORAGE->move_message('1:*', $trash_mbox, $mbox);
$delete = false;
@@ -144,7 +144,7 @@ else if ($RCMAIL->action == 'purge') {
$OUTPUT->set_env('messagecount', 0);
if ($delete) {
$OUTPUT->show_message('folderpurged', 'confirmation');
- $OUTPUT->command('set_quota', $RCMAIL->quota_content());
+ $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $mbox));
}
else {
$OUTPUT->show_message('messagemoved', 'confirmation');