diff options
Diffstat (limited to 'plugins/archive')
-rw-r--r-- | plugins/archive/archive.js | 15 | ||||
-rw-r--r-- | plugins/archive/archive.php | 152 | ||||
-rw-r--r-- | plugins/archive/composer.json | 2 | ||||
-rw-r--r-- | plugins/archive/localization/en_GB.inc | 9 | ||||
-rw-r--r-- | plugins/archive/localization/fo_FO.inc | 31 | ||||
-rw-r--r-- | plugins/archive/localization/hr_HR.inc | 11 | ||||
-rw-r--r-- | plugins/archive/localization/hy_AM.inc | 9 | ||||
-rw-r--r-- | plugins/archive/localization/km_KH.inc | 13 | ||||
-rw-r--r-- | plugins/archive/localization/uk_UA.inc | 3 | ||||
-rw-r--r-- | plugins/archive/localization/vi_VN.inc | 9 | ||||
-rw-r--r-- | plugins/archive/package.xml | 4 |
11 files changed, 173 insertions, 85 deletions
diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js index 813033401..f77bedf46 100644 --- a/plugins/archive/archive.js +++ b/plugins/archive/archive.js @@ -1,6 +1,19 @@ /** * Archive plugin script - * @version 2.1 + * @version 2.3 + * + * @licstart The following is the entire license notice for the + * JavaScript code in this file. + * + * Copyright (c) 2012-2014, The Roundcube Dev Team + * + * The JavaScript code in this page is free software: you can redistribute it + * and/or modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * @licend The above is the entire license notice + * for the JavaScript code in this file. */ function rcmail_archive(prop) diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index a0fd2efa9..72f7a7f2a 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -6,22 +6,22 @@ * Plugin that adds a new button to the mailbox toolbar * to move messages to a (user selectable) archive folder. * - * @version 2.1 + * @version 2.3 * @license GNU GPLv3+ * @author Andre Rodier, Thomas Bruederli, Aleksander Machniak */ class archive extends rcube_plugin { - public $task = 'mail|settings'; - function init() { $rcmail = rcmail::get_instance(); - // There is no "Archived flags" - // $GLOBALS['IMAP_FLAGS']['ARCHIVED'] = 'Archive'; + // register special folder type + rcube_storage::$folder_types[] = 'archive'; + if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show') - && ($archive_folder = $rcmail->config->get('archive_mbox'))) { + && ($archive_folder = $rcmail->config->get('archive_mbox')) + ) { $skin_path = $this->local_skin_path(); if (is_file($this->home . "/$skin_path/archive.css")) $this->include_stylesheet("$skin_path/archive.css"); @@ -48,12 +48,6 @@ class archive extends rcube_plugin // 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 @@ -99,7 +93,7 @@ class archive extends rcube_plugin return true; } else if (!empty($item['folders'])) if ($this->_mod_folder_name($list[$idx]['folders'], $folder, $new_name)) - return true; + return true; } return false; } @@ -117,8 +111,7 @@ class archive extends rcube_plugin $delimiter = $storage->get_hierarchy_delimiter(); $archive_folder = $rcmail->config->get('archive_mbox'); $archive_type = $rcmail->config->get('archive_type', ''); - - $storage->set_folder(($current_mbox = rcube_utils::get_input_value('_mbox', RCUBE_INPUT_POST))); + $current_mbox = rcube_utils::get_input_value('_mbox', RCUBE_INPUT_POST); $result = array('reload' => false, 'update' => false, 'errors' => array()); $folders = array(); @@ -127,84 +120,88 @@ class archive extends rcube_plugin if ($uids == '*') { $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order()); - $uids = $index->get(); + $messageset = array($current_mbox => $index->get()); } else { - $uids = explode(',', $uids); + $messageset = rcmail::get_uids(); } - foreach ($uids as $uid) { - if (!$archive_folder || !($message = $rcmail->storage->get_message($uid))) { - continue; - } + foreach ($messageset as $mbox => $uids) { + $storage->set_folder(($current_mbox = $mbox)); - $subfolder = null; - switch ($archive_type) { - case 'year': - $subfolder = $rcmail->format_date($message->timestamp, 'Y'); - break; - - case 'month': - $subfolder = $rcmail->format_date($message->timestamp, 'Y') . $delimiter . $rcmail->format_date($message->timestamp, 'm'); - break; + foreach ($uids as $uid) { + if (!$archive_folder || !($message = $rcmail->storage->get_message($uid))) { + continue; + } - case 'folder': - $subfolder = $current_mbox; - break; + $subfolder = null; + switch ($archive_type) { + case 'year': + $subfolder = $rcmail->format_date($message->timestamp, 'Y'); + break; - case 'sender': - $from = $message->get('from'); - if (preg_match('/[\b<](.+@.+)[\b>]/i', $from, $m)) { - $subfolder = $m[1]; - } - else { - $subfolder = $this->gettext('unkownsender'); - } + case 'month': + $subfolder = $rcmail->format_date($message->timestamp, 'Y') . $delimiter . $rcmail->format_date($message->timestamp, 'm'); + break; - // replace reserved characters in folder name - $repl = $delimiter == '-' ? '_' : '-'; - $replacements[$delimiter] = $repl; - $replacements['.'] = $repl; // some IMAP server do not allow . characters - $subfolder = strtr($subfolder, $replacements); - break; + case 'folder': + $subfolder = $current_mbox; + break; - default: - $subfolder = ''; - break; - } + case 'sender': + $from = $message->get('from'); + if (preg_match('/[\b<](.+@.+)[\b>]/i', $from, $m)) { + $subfolder = $m[1]; + } + else { + $subfolder = $this->gettext('unkownsender'); + } - // compose full folder path - $folder = $archive_folder . ($subfolder ? $delimiter . $subfolder : ''); + // replace reserved characters in folder name + $repl = $delimiter == '-' ? '_' : '-'; + $replacements[$delimiter] = $repl; + $replacements['.'] = $repl; // some IMAP server do not allow . characters + $subfolder = strtr($subfolder, $replacements); + break; - // create archive subfolder if it doesn't yet exist - // we'll create all folders in the path - if (!in_array($folder, $folders)) { - if (empty($list)) { - $list = $storage->list_folders('', $archive_folder . '*', 'mail', null, true); + default: + $subfolder = ''; + break; } - $path = explode($delimiter, $folder); - - for ($i=0; $i<count($path); $i++) { - $_folder = implode($delimiter, array_slice($path, 0, $i+1)); - if (!in_array($_folder, $list)) { - if ($storage->create_folder($_folder, true)) { - $result['reload'] = true; - $list[] = $_folder; + + // compose full folder path + $folder = $archive_folder . ($subfolder ? $delimiter . $subfolder : ''); + + // create archive subfolder if it doesn't yet exist + // we'll create all folders in the path + if (!in_array($folder, $folders)) { + if (empty($list)) { + $list = $storage->list_folders('', $archive_folder . '*', 'mail', null, true); + } + $path = explode($delimiter, $folder); + + for ($i=0; $i<count($path); $i++) { + $_folder = implode($delimiter, array_slice($path, 0, $i+1)); + if (!in_array($_folder, $list)) { + if ($storage->create_folder($_folder, true)) { + $result['reload'] = true; + $list[] = $_folder; + } } } - } - $folders[] = $folder; - } + $folders[] = $folder; + } - // move message to target folder - if ($storage->move_message(array($uid), $folder)) { - $result['update'] = true; - } - else { - $result['errors'][] = $uid; - } - } // end for + // move message to target folder + if ($storage->move_message(array($uid), $folder)) { + $result['update'] = true; + } + else { + $result['errors'][] = $uid; + } + } // end for + } // send response if ($result['errors']) { @@ -286,7 +283,6 @@ class archive extends rcube_plugin function save_prefs($args) { if ($args['section'] == 'folders') { - $args['prefs']['archive_mbox'] = rcube_utils::get_input_value('_archive_mbox', rcube_utils::INPUT_POST); $args['prefs']['archive_type'] = rcube_utils::get_input_value('_archive_type', rcube_utils::INPUT_POST); return $args; } diff --git a/plugins/archive/composer.json b/plugins/archive/composer.json index 8a585ad09..1e3331b2c 100644 --- a/plugins/archive/composer.json +++ b/plugins/archive/composer.json @@ -3,7 +3,7 @@ "type": "roundcube-plugin", "description": "This adds a button to move the selected messages to an archive folder. The folder (and the optional structure of subfolders) can be selected in the settings panel.", "license": "GNU GPLv3+", - "version": "2.1", + "version": "2.3", "authors": [ { "name": "Thomas Bruederli", diff --git a/plugins/archive/localization/en_GB.inc b/plugins/archive/localization/en_GB.inc index 5c03b82d5..58cb7f439 100644 --- a/plugins/archive/localization/en_GB.inc +++ b/plugins/archive/localization/en_GB.inc @@ -18,5 +18,14 @@ $labels['buttontext'] = 'Archive'; $labels['buttontitle'] = 'Archive this message'; $labels['archived'] = 'Successfully archived'; +$labels['archivedreload'] = 'Successfully archived. Reload the page to see the new archive folders.'; +$labels['archiveerror'] = 'Some messages could not be archived'; $labels['archivefolder'] = 'Archive'; +$labels['settingstitle'] = 'Archive'; +$labels['archivetype'] = 'Divide archive by'; +$labels['archivetypeyear'] = 'Year (e.g. Archive/2012)'; +$labels['archivetypemonth'] = 'Month (e.g. Archive/2012/06)'; +$labels['archivetypefolder'] = 'Original folder'; +$labels['archivetypesender'] = 'Sender email'; +$labels['unkownsender'] = 'unknown'; ?> diff --git a/plugins/archive/localization/fo_FO.inc b/plugins/archive/localization/fo_FO.inc new file mode 100644 index 000000000..2022b41dd --- /dev/null +++ b/plugins/archive/localization/fo_FO.inc @@ -0,0 +1,31 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/archive/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Archive plugin | + | Copyright (C) 2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-archive/ +*/ +$labels['buttontext'] = 'Goym í skjalasavni'; +$labels['buttontitle'] = 'Goym hetta boð í skjalasavni'; +$labels['archived'] = 'Goymt í skjalasavn'; +$labels['archivedreload'] = 'Goymt í skjalasavn. Les inn aftur síðu fyri at síggja nýggjar mappur'; +$labels['archiveerror'] = 'Onkur boð kundu ikki leggjast í skjalagoymslu'; +$labels['archivefolder'] = 'Goym í skjalasavni'; +$labels['settingstitle'] = 'Goym í skjalasavni'; +$labels['archivetype'] = 'Deil skjalagoymslu við'; +$labels['archivetypeyear'] = 'Ár (t.d. Skjalagoymsla/2012)'; +$labels['archivetypemonth'] = 'Mánar(t.d. Skjalahgoymsla/2012/06)'; +$labels['archivetypefolder'] = 'Uppruna mappa'; +$labels['archivetypesender'] = 'Sendara teldupostur'; +$labels['unkownsender'] = 'ókent'; +?> diff --git a/plugins/archive/localization/hr_HR.inc b/plugins/archive/localization/hr_HR.inc index 2a99cb687..e6334cce0 100644 --- a/plugins/archive/localization/hr_HR.inc +++ b/plugins/archive/localization/hr_HR.inc @@ -17,6 +17,15 @@ */ $labels['buttontext'] = 'Arhiva'; $labels['buttontitle'] = 'Arhiviraj poruku'; -$labels['archived'] = 'Uspješno arhivirana'; +$labels['archived'] = 'Uspješno arhivirano'; +$labels['archivedreload'] = 'Uspješno arhivirano. Osvježite stranicu kako biste vidjeli nove arhivske mape.'; +$labels['archiveerror'] = 'Neke poruke nije bilo moguće arhivirati'; $labels['archivefolder'] = 'Arhiva'; +$labels['settingstitle'] = 'Arhiva'; +$labels['archivetype'] = 'Podijeli arhivu po'; +$labels['archivetypeyear'] = 'Godina (npr. Arhiva/2012)'; +$labels['archivetypemonth'] = 'Mjesec (e.g. Arhiva/2012/06)'; +$labels['archivetypefolder'] = 'Izvorna mapa'; +$labels['archivetypesender'] = 'E-mail adresa pošiljatelja'; +$labels['unkownsender'] = 'nepoznato'; ?> diff --git a/plugins/archive/localization/hy_AM.inc b/plugins/archive/localization/hy_AM.inc index a380346d4..47fc8d6f6 100644 --- a/plugins/archive/localization/hy_AM.inc +++ b/plugins/archive/localization/hy_AM.inc @@ -18,5 +18,14 @@ $labels['buttontext'] = 'Արխիվ'; $labels['buttontitle'] = 'Արխիվացնել այս հաղորդագրությունը'; $labels['archived'] = 'Բարեհաջող արխիվացվեց'; +$labels['archivedreload'] = 'Բարեհաջող արխիվացվեց: Վերբեռնեք էջը նոր արխիվացված պանակները տեսնելու համար:'; +$labels['archiveerror'] = 'Որոշ հաղորդագրություններ հնարավոր չէ արխիվացնել'; $labels['archivefolder'] = 'Արխիվ'; +$labels['settingstitle'] = 'Արխիվ'; +$labels['archivetype'] = 'Բաժանել արխիվը'; +$labels['archivetypeyear'] = 'Տարեթիվ (օր.՝ Արխիվ/2012)'; +$labels['archivetypemonth'] = 'Ամսաթիվ (օր.՝ Արխիվ/2012/06)'; +$labels['archivetypefolder'] = 'Առաջին պանակը'; +$labels['archivetypesender'] = 'Ուղարկողի էլ-փոստը'; +$labels['unkownsender'] = 'անհայտ'; ?> diff --git a/plugins/archive/localization/km_KH.inc b/plugins/archive/localization/km_KH.inc index d4b1c3baa..ab2e5e2cc 100644 --- a/plugins/archive/localization/km_KH.inc +++ b/plugins/archive/localization/km_KH.inc @@ -16,7 +16,16 @@ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-archive/ */ $labels['buttontext'] = 'ប័ណ្ណសារ'; -$labels['buttontitle'] = 'ប័ណ្ណសារ សារលិខិត នេះ'; -$labels['archived'] = 'ប័ណ្ណសារ បានសំរេច'; +$labels['buttontitle'] = 'ធ្វើសារនេះជាបណ្ណសារ'; +$labels['archived'] = 'ធ្វើជាបណ្ណសារបានសម្រេច'; +$labels['archivedreload'] = 'ធ្វើជាបណ្ណសារបានសម្រេច។ ផ្ទុកទំព័រឡើងវិញ ដើម្បីមើលថតបណ្ណសារថ្មី។'; +$labels['archiveerror'] = 'សារខ្លះមិនអាចត្រូវបានធ្វើជាបណ្ណសារទេ'; $labels['archivefolder'] = 'ប័ណ្ណសារ'; +$labels['settingstitle'] = 'បណ្ណសារ'; +$labels['archivetype'] = 'ចែកបណ្ណសារតាម'; +$labels['archivetypeyear'] = 'ឆ្នាំ (ឧទា. បណ្ណសារ/2012)'; +$labels['archivetypemonth'] = 'ខែ (ឧទា. បណ្ណសារ/2012/06)'; +$labels['archivetypefolder'] = 'ថតដើម'; +$labels['archivetypesender'] = 'អ្នកផ្ញើអ៊ីមែល'; +$labels['unkownsender'] = 'មិនស្គាល់'; ?> diff --git a/plugins/archive/localization/uk_UA.inc b/plugins/archive/localization/uk_UA.inc index 48cbf00f8..92fbc79ea 100644 --- a/plugins/archive/localization/uk_UA.inc +++ b/plugins/archive/localization/uk_UA.inc @@ -22,7 +22,10 @@ $labels['archivedreload'] = 'Архівацію успішно завершен $labels['archiveerror'] = 'Деякі повідомлення неможуть бути зархівованими'; $labels['archivefolder'] = 'Архів'; $labels['settingstitle'] = 'Архів'; +$labels['archivetype'] = 'Розділіть архів по'; $labels['archivetypeyear'] = 'Рік (наприклад Архів/2012)'; $labels['archivetypemonth'] = 'Місяць (наприклад Архів/2012/06)'; +$labels['archivetypefolder'] = 'Оригінальний каталог'; +$labels['archivetypesender'] = 'Відправник email'; $labels['unkownsender'] = 'невідомо'; ?> diff --git a/plugins/archive/localization/vi_VN.inc b/plugins/archive/localization/vi_VN.inc index 61e02085b..b2fe3899a 100644 --- a/plugins/archive/localization/vi_VN.inc +++ b/plugins/archive/localization/vi_VN.inc @@ -18,5 +18,14 @@ $labels['buttontext'] = 'Lưu trữ'; $labels['buttontitle'] = 'Lưu lại bức thư này'; $labels['archived'] = 'Lưu lại thành công'; +$labels['archivedreload'] = 'Đã lưu thành công. Tải lại trang này để thấy các thư mục lưu trữ mới.'; +$labels['archiveerror'] = 'Một số thư không thể lưu lại được'; $labels['archivefolder'] = 'Lưu trữ'; +$labels['settingstitle'] = 'Lưu trữ'; +$labels['archivetype'] = 'Chia bộ lưu trữ bởi'; +$labels['archivetypeyear'] = 'Năm (ví dụ: Lưu trữ/2012)'; +$labels['archivetypemonth'] = 'Tháng (ví dụ: Lưu trữ/2012/06)'; +$labels['archivetypefolder'] = 'Thư mục nguyên gốc'; +$labels['archivetypesender'] = 'Địa chỉ thư điện tử của người gửi'; +$labels['unkownsender'] = 'Không rõ'; ?> diff --git a/plugins/archive/package.xml b/plugins/archive/package.xml index ec3323e4b..4f5a87c7b 100644 --- a/plugins/archive/package.xml +++ b/plugins/archive/package.xml @@ -19,9 +19,9 @@ <email>alec@alec.pl</email> <active>yes</active> </lead> - <date>2013-10-30</date> + <date>2014-04-07</date> <version> - <release>2.1</release> + <release>2.3</release> <api>2.0</api> </version> <stability> |