| | |
| | | * Plugin that adds a new button to the mailbox toolbar |
| | | * to move messages to a (user selectable) archive folder. |
| | | * |
| | | * @version 2.0 |
| | | * @version 2.1 |
| | | * @license GNU GPLv3+ |
| | | * @author Andre Rodier, Thomas Bruederli |
| | | * @author Andre Rodier, Thomas Bruederli, Aleksander Machniak |
| | | */ |
| | | class archive extends rcube_plugin |
| | | { |
| | |
| | | function init() |
| | | { |
| | | $rcmail = rcmail::get_instance(); |
| | | $archive_folder = $rcmail->config->get('archive_mbox'); |
| | | |
| | | // add archive folder to the list of default mailboxes |
| | | if (($default_folders = $rcmail->config->get('default_folders')) && !in_array($archive_folder, $default_folders)) { |
| | | $default_folders[] = $archive_folder; |
| | | $rcmail->config->set('default_folders', $default_folders); |
| | | } |
| | | |
| | | // There is no "Archived flags" |
| | | // $GLOBALS['IMAP_FLAGS']['ARCHIVED'] = 'Archive'; |
| | | if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') |
| | | && ($archive_folder = $rcmail->config->get('archive_mbox'))) { |
| | | if ($archive_folder && $rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show')) { |
| | | $skin_path = $this->local_skin_path(); |
| | | if (is_file($this->home . "/$skin_path/archive.css")) |
| | | $this->include_stylesheet("$skin_path/archive.css"); |
| | |
| | | // set env variables for client |
| | | $rcmail->output->set_env('archive_folder', $archive_folder); |
| | | $rcmail->output->set_env('archive_type', $rcmail->config->get('archive_type','')); |
| | | |
| | | // add archive folder to the list of default mailboxes |
| | | if (($default_folders = $rcmail->config->get('default_folders')) && !in_array($archive_folder, $default_folders)) { |
| | | $default_folders[] = $archive_folder; |
| | | $rcmail->config->set('default_folders', $default_folders); |
| | | } |
| | | } |
| | | else if ($rcmail->task == 'mail') { |
| | | // handler for ajax request |
| | |
| | | $result = array('reload' => false, 'update' => false, 'errors' => array()); |
| | | $folders = array(); |
| | | $uids = rcube_utils::get_input_value('_uid', RCUBE_INPUT_POST); |
| | | $search_request = get_input_value('_search', RCUBE_INPUT_GPC); |
| | | |
| | | if ($uids == '*') { |
| | | $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order()); |
| | |
| | | $rcmail->output->show_message($this->gettext('archived'), 'confirmation'); |
| | | } |
| | | |
| | | // refresh saved search set after moving some messages |
| | | if ($search_request && $rcmail->storage->get_search_set()) { |
| | | $_SESSION['search'] = $rcmail->storage->refresh_search(); |
| | | } |
| | | |
| | | if ($_POST['_from'] == 'show' && !empty($result['update'])) { |
| | | if ($next = get_input_value('_next_uid', RCUBE_INPUT_GPC)) { |
| | | $rcmail->output->command('show_message', $next); |
| | |
| | | $archive_type->add($this->gettext('archivetypefolder'), 'folder'); |
| | | |
| | | $args['blocks']['archive'] = array( |
| | | 'name' => Q(rcube_label('settingstitle', 'archive')), |
| | | 'name' => Q($this->gettext('settingstitle')), |
| | | 'options' => array('archive_type' => array( |
| | | 'title' => $this->gettext('archivetype'), |
| | | 'content' => $archive_type->show($rcmail->config->get('archive_type')) |