Display quota information for current folder not INBOX only (#1487993)
| | |
| | | CHANGELOG Roundcube Webmail |
| | | =========================== |
| | | |
| | | - Display quota information for current folder not INBOX only (#1487993) |
| | | - Support images in HTML signatures (#1488676) |
| | | - Display full quota information in popup (#1485769, #1486604) |
| | | - Mail compose: Selecting contact inserts recipient to previously focused input - to/cc/bcc accordingly (#1489684) |
| | |
| | | } |
| | | |
| | | |
| | | public function quota_content($attrib = null) |
| | | public function quota_content($attrib = null, $folder = null) |
| | | { |
| | | $quota = $this->storage->get_quota(); |
| | | $quota = $this->storage->get_quota($folder); |
| | | $quota = $this->plugins->exec_hook('quota', $quota); |
| | | |
| | | $quota_result = (array) $quota; |
| | |
| | | unset($quota_result['abort']); |
| | | if (empty($quota_result['table'])) { |
| | | unset($quota_result['all']); |
| | | } |
| | | |
| | | if ($folder !== null && $folder !== '') { |
| | | $quota_result['folder'] = $folder; |
| | | } |
| | | |
| | | return $quota_result; |
| | |
| | | /** |
| | | * Returns message UID(s) and IMAP folder(s) from GET/POST data |
| | | * |
| | | * @param string UID value to decode |
| | | * @param string Default mailbox value (if not encoded in UIDs) |
| | | * @param string UID value to decode |
| | | * @param string Default mailbox value (if not encoded in UIDs) |
| | | * @param bool Will be set to True if multi-folder request |
| | | * |
| | | * @return array List of message UIDs per folder |
| | | */ |
| | | public static function get_uids($uids = null, $mbox = null) |
| | | public static function get_uids($uids = null, $mbox = null, &$is_multifolder = false) |
| | | { |
| | | // message UID (or comma-separated list of IDs) is provided in |
| | | // the form of <ID>-<MBOX>[,<ID>-<MBOX>]* |
| | |
| | | |
| | | // special case: * |
| | | if ($_uid == '*' && is_object($_SESSION['search'][1]) && $_SESSION['search'][1]->multi) { |
| | | $is_multifolder = true; |
| | | // extract the full list of UIDs per folder from the search set |
| | | foreach ($_SESSION['search'][1]->sets as $subset) { |
| | | $mbox = $subset->get_parameters('MAILBOX'); |
| | |
| | | // create a per-folder UIDs array |
| | | foreach ((array)$_uid as $uid) { |
| | | list($uid, $mbox) = explode('-', $uid, 2); |
| | | if (!strlen($mbox)) |
| | | if (!strlen($mbox)) { |
| | | $mbox = $_mbox; |
| | | if ($uid == '*') |
| | | } |
| | | else { |
| | | $is_multifolder = true; |
| | | } |
| | | |
| | | if ($uid == '*') { |
| | | $result[$mbox] = $uid; |
| | | else |
| | | } |
| | | else { |
| | | $result[$mbox][] = $uid; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | 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)); |
| | |
| | | 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) { |
| | |
| | | |
| | | 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 { |
| | |
| | | $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; |
| | |
| | | $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 |
| | |
| | | |
| | | $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 |
| | |
| | | |
| | | // 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); |
| | | |
| | |
| | | $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(); |
| | |
| | | $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'); |
| | | |
| | |
| | | $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; |
| | |
| | | } |
| | | } |
| | | // 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) { |
| | |
| | | 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) { |
| | |
| | | } |
| | | 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); |
| | |
| | | $_SESSION['last_text_search'] = $str; |
| | | } |
| | | $_SESSION['search_request'] = $search_request; |
| | | $_SESSION['search_scope'] = $scope; |
| | | $_SESSION['search_scope'] = $scope; |
| | | |
| | | |
| | | // Get the headers |
| | |
| | | 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('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(); |
| | |
| | | |
| | | $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; |
| | | } |
| | | |
| | |
| | | $success = $STORAGE->delete_message('*', $mbox); |
| | | $delete = true; |
| | | } |
| | | // copy to Trash |
| | | // move to Trash |
| | | else { |
| | | $success = $STORAGE->move_message('1:*', $trash_mbox, $mbox); |
| | | $delete = false; |
| | |
| | | $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'); |