summaryrefslogtreecommitdiff
path: root/plugins/archive
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2011-01-12 15:47:44 +0000
committerthomascube <thomas@roundcube.net>2011-01-12 15:47:44 +0000
commit62a83b3bd5813885d964d9fd1509d52bb9c4f12c (patch)
tree241e4407b51747889e63cc2d26219301639c238d /plugins/archive
parent28a4d4a49ebc4090155f97aeaf9a409f8e1549dc (diff)
Copying plugins to release branch
Diffstat (limited to 'plugins/archive')
-rw-r--r--plugins/archive/archive.js34
-rw-r--r--plugins/archive/archive.php122
-rw-r--r--plugins/archive/localization/cs_CZ.inc25
-rw-r--r--plugins/archive/localization/de_CH.inc8
-rw-r--r--plugins/archive/localization/de_DE.inc8
-rw-r--r--plugins/archive/localization/en_US.inc8
-rw-r--r--plugins/archive/localization/es_AR.inc10
-rw-r--r--plugins/archive/localization/es_ES.inc10
-rw-r--r--plugins/archive/localization/et_EE.inc8
-rw-r--r--plugins/archive/localization/fr_FR.inc8
-rw-r--r--plugins/archive/localization/ja_JP.inc10
-rw-r--r--plugins/archive/localization/nl_NL.inc8
-rw-r--r--plugins/archive/localization/pl_PL.inc8
-rw-r--r--plugins/archive/localization/ru_RU.inc8
-rw-r--r--plugins/archive/localization/sv_SE.inc8
-rw-r--r--plugins/archive/localization/zh_TW.inc8
-rw-r--r--plugins/archive/package.xml64
-rw-r--r--plugins/archive/skins/default/archive_act.pngbin0 -> 3663 bytes
-rw-r--r--plugins/archive/skins/default/archive_pas.pngbin0 -> 977 bytes
-rw-r--r--plugins/archive/skins/default/foldericon.pngbin0 -> 3312 bytes
20 files changed, 355 insertions, 0 deletions
diff --git a/plugins/archive/archive.js b/plugins/archive/archive.js
new file mode 100644
index 000000000..a83750819
--- /dev/null
+++ b/plugins/archive/archive.js
@@ -0,0 +1,34 @@
+/*
+ * Archive plugin script
+ * @version @package_version@
+ */
+
+function rcmail_archive(prop)
+{
+ if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length))
+ return;
+
+ if (rcmail.env.mailbox != rcmail.env.archive_folder)
+ rcmail.command('moveto', rcmail.env.archive_folder);
+}
+
+// callback for app-onload event
+if (window.rcmail) {
+ rcmail.addEventListener('init', function(evt) {
+
+ // register command (directly enable in message view mode)
+ rcmail.register_command('plugin.archive', rcmail_archive, (rcmail.env.uid && rcmail.env.mailbox != rcmail.env.archive_folder));
+
+ // add event-listener to message list
+ if (rcmail.message_list)
+ rcmail.message_list.addEventListener('select', function(list){
+ rcmail.enable_command('plugin.archive', (list.get_selection().length > 0 && rcmail.env.mailbox != rcmail.env.archive_folder));
+ });
+
+ // set css style for archive folder
+ var li;
+ if (rcmail.env.archive_folder && rcmail.env.archive_folder_icon && (li = rcmail.get_folder_li(rcmail.env.archive_folder)))
+ $(li).css('background-image', 'url(' + rcmail.env.archive_folder_icon + ')');
+ })
+}
+
diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php
new file mode 100644
index 000000000..fbb01296d
--- /dev/null
+++ b/plugins/archive/archive.php
@@ -0,0 +1,122 @@
+<?php
+
+/**
+ * Archive
+ *
+ * Plugin that adds a new button to the mailbox toolbar
+ * to move messages to a (user selectable) archive folder.
+ *
+ * @version @package_version@
+ * @author Andre Rodier, Thomas Bruederli
+ */
+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';
+ if ($rcmail->task == 'mail' && ($rcmail->action == '' || $rcmail->action == 'show')
+ && ($archive_folder = $rcmail->config->get('archive_mbox'))) {
+ $skin_path = $this->local_skin_path();
+
+ $this->include_script('archive.js');
+ $this->add_texts('localization', true);
+ $this->add_button(
+ array(
+ 'command' => 'plugin.archive',
+ 'imagepas' => $skin_path.'/archive_pas.png',
+ 'imageact' => $skin_path.'/archive_act.png',
+ 'title' => 'buttontitle',
+ 'domain' => $this->ID,
+ ),
+ 'toolbar');
+
+ // register hook to localize the archive folder
+ $this->add_hook('render_mailboxlist', array($this, 'render_mailboxlist'));
+
+ // set env variable for client
+ $rcmail->output->set_env('archive_folder', $archive_folder);
+ $rcmail->output->set_env('archive_folder_icon', $this->url($skin_path.'/foldericon.png'));
+
+ // add archive folder to the list of default mailboxes
+ if (($default_folders = $rcmail->config->get('default_imap_folders')) && !in_array($archive_folder, $default_folders)) {
+ $default_folders[] = $archive_folder;
+ $rcmail->config->set('default_imap_folders', $default_folders);
+ }
+ }
+ else if ($rcmail->task == 'settings') {
+ $dont_override = $rcmail->config->get('dont_override', array());
+ if (!in_array('archive_mbox', $dont_override)) {
+ $this->add_hook('preferences_list', array($this, 'prefs_table'));
+ $this->add_hook('preferences_save', array($this, 'save_prefs'));
+ }
+ }
+ }
+
+ function render_mailboxlist($p)
+ {
+ $rcmail = rcmail::get_instance();
+ $archive_folder = $rcmail->config->get('archive_mbox');
+
+ // set localized name for the configured archive folder
+ if ($archive_folder) {
+ if (isset($p['list'][$archive_folder]))
+ $p['list'][$archive_folder]['name'] = $this->gettext('archivefolder');
+ else // search in subfolders
+ $this->_mod_folder_name($p['list'], $archive_folder, $this->gettext('archivefolder'));
+ }
+
+ return $p;
+ }
+
+ function _mod_folder_name(&$list, $folder, $new_name)
+ {
+ foreach ($list as $idx => $item) {
+ if ($item['id'] == $folder) {
+ $list[$idx]['name'] = $new_name;
+ return true;
+ } else if (!empty($item['folders']))
+ if ($this->_mod_folder_name($list[$idx]['folders'], $folder, $new_name))
+ return true;
+ }
+ return false;
+ }
+
+ function prefs_table($args)
+ {
+ global $CURR_SECTION;
+
+ if ($args['section'] == 'folders') {
+ $this->add_texts('localization');
+
+ $rcmail = rcmail::get_instance();
+
+ // load folders list when needed
+ if ($CURR_SECTION)
+ $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true,
+ 'maxlength' => 30, 'exceptions' => array('INBOX')));
+ else
+ $select = new html_select();
+
+ $args['blocks']['main']['options']['archive_mbox'] = array(
+ 'title' => $this->gettext('archivefolder'),
+ 'content' => $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox"))
+ );
+ }
+
+ return $args;
+ }
+
+ function save_prefs($args)
+ {
+ if ($args['section'] == 'folders') {
+ $args['prefs']['archive_mbox'] = get_input_value('_archive_mbox', RCUBE_INPUT_POST);
+ return $args;
+ }
+ }
+
+}
diff --git a/plugins/archive/localization/cs_CZ.inc b/plugins/archive/localization/cs_CZ.inc
new file mode 100644
index 000000000..1396fb8e8
--- /dev/null
+++ b/plugins/archive/localization/cs_CZ.inc
@@ -0,0 +1,25 @@
+<?php
+
+/*
+
++-----------------------------------------------------------------------+
+| language/cs_CZ/labels.inc |
+| |
+| Language file of the Roundcube archive plugin |
+| Copyright (C) 2005-2009, Roundcube Dev. - Switzerland |
+| Licensed under the GNU GPL |
+| |
++-----------------------------------------------------------------------+
+| Author: Milan Kozak <hodza@hodza.net> |
++-----------------------------------------------------------------------+
+
+@version $Id: labels.inc 2993 2009-09-26 18:32:07Z alec $
+
+*/
+
+$labels = array();
+$labels['buttontitle'] = 'Archivovat zprávu';
+$labels['archived'] = 'Úspěšně vloženo do archivu';
+$labels['archivefolder'] = 'Archiv';
+
+?>
diff --git a/plugins/archive/localization/de_CH.inc b/plugins/archive/localization/de_CH.inc
new file mode 100644
index 000000000..2ed0f5ac8
--- /dev/null
+++ b/plugins/archive/localization/de_CH.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Nachricht archivieren';
+$labels['archived'] = 'Nachricht erfolgreich archiviert';
+$labels['archivefolder'] = 'Archiv';
+
+?>
diff --git a/plugins/archive/localization/de_DE.inc b/plugins/archive/localization/de_DE.inc
new file mode 100644
index 000000000..2ed0f5ac8
--- /dev/null
+++ b/plugins/archive/localization/de_DE.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Nachricht archivieren';
+$labels['archived'] = 'Nachricht erfolgreich archiviert';
+$labels['archivefolder'] = 'Archiv';
+
+?>
diff --git a/plugins/archive/localization/en_US.inc b/plugins/archive/localization/en_US.inc
new file mode 100644
index 000000000..fce31a0b5
--- /dev/null
+++ b/plugins/archive/localization/en_US.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Archive this message';
+$labels['archived'] = 'Successfully archived';
+$labels['archivefolder'] = 'Archive';
+
+?>
diff --git a/plugins/archive/localization/es_AR.inc b/plugins/archive/localization/es_AR.inc
new file mode 100644
index 000000000..7d021f561
--- /dev/null
+++ b/plugins/archive/localization/es_AR.inc
@@ -0,0 +1,10 @@
+<?php
+
+// MPBAUPGRADE
+
+$labels = array();
+$labels['buttontitle'] = 'Archivar este mensaje';
+$labels['archived'] = 'Mensaje Archivado';
+$labels['archivefolder'] = 'Archivo';
+
+?>
diff --git a/plugins/archive/localization/es_ES.inc b/plugins/archive/localization/es_ES.inc
new file mode 100644
index 000000000..7d021f561
--- /dev/null
+++ b/plugins/archive/localization/es_ES.inc
@@ -0,0 +1,10 @@
+<?php
+
+// MPBAUPGRADE
+
+$labels = array();
+$labels['buttontitle'] = 'Archivar este mensaje';
+$labels['archived'] = 'Mensaje Archivado';
+$labels['archivefolder'] = 'Archivo';
+
+?>
diff --git a/plugins/archive/localization/et_EE.inc b/plugins/archive/localization/et_EE.inc
new file mode 100644
index 000000000..e3968d755
--- /dev/null
+++ b/plugins/archive/localization/et_EE.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Arhiveeri see kiri';
+$labels['archived'] = 'Edukalt arhiveeritud';
+$labels['archivefolder'] = 'Arhiveeri';
+
+?>
diff --git a/plugins/archive/localization/fr_FR.inc b/plugins/archive/localization/fr_FR.inc
new file mode 100644
index 000000000..f44f30f44
--- /dev/null
+++ b/plugins/archive/localization/fr_FR.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Archiver ce message';
+$labels['archived'] = 'Message archiv avec success';
+$labels['archivefolder'] = 'Archive';
+
+?>
diff --git a/plugins/archive/localization/ja_JP.inc b/plugins/archive/localization/ja_JP.inc
new file mode 100644
index 000000000..31fa15267
--- /dev/null
+++ b/plugins/archive/localization/ja_JP.inc
@@ -0,0 +1,10 @@
+<?php
+
+// EN-Revision: 3891
+
+$labels = array();
+$labels['buttontitle'] = 'このメッセージのアーカイブ';
+$labels['archived'] = 'アーカイブに成功しました。';
+$labels['archivefolder'] = 'アーカイブ';
+
+?>
diff --git a/plugins/archive/localization/nl_NL.inc b/plugins/archive/localization/nl_NL.inc
new file mode 100644
index 000000000..0d47f7b9c
--- /dev/null
+++ b/plugins/archive/localization/nl_NL.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Archiveer dit bericht';
+$labels['archived'] = 'Succesvol gearchiveerd';
+$labels['archivefolder'] = 'Archief';
+
+?>
diff --git a/plugins/archive/localization/pl_PL.inc b/plugins/archive/localization/pl_PL.inc
new file mode 100644
index 000000000..2ecc77991
--- /dev/null
+++ b/plugins/archive/localization/pl_PL.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Przenieś do archiwum';
+$labels['archived'] = 'Pomyślnie zarchiwizowano';
+$labels['archivefolder'] = 'Archiwum';
+
+?>
diff --git a/plugins/archive/localization/ru_RU.inc b/plugins/archive/localization/ru_RU.inc
new file mode 100644
index 000000000..e377ad017
--- /dev/null
+++ b/plugins/archive/localization/ru_RU.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Переместить выбранное в архив';
+$labels['archived'] = 'Перенесено в Архив';
+$labels['archivefolder'] = 'Архив';
+
+?>
diff --git a/plugins/archive/localization/sv_SE.inc b/plugins/archive/localization/sv_SE.inc
new file mode 100644
index 000000000..c55da7aaf
--- /dev/null
+++ b/plugins/archive/localization/sv_SE.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = 'Arkivera meddelande';
+$labels['archived'] = 'Meddelandet är arkiverat';
+$labels['archivefolder'] = 'Arkiv';
+
+?>
diff --git a/plugins/archive/localization/zh_TW.inc b/plugins/archive/localization/zh_TW.inc
new file mode 100644
index 000000000..5cccebbdc
--- /dev/null
+++ b/plugins/archive/localization/zh_TW.inc
@@ -0,0 +1,8 @@
+<?php
+
+$labels = array();
+$labels['buttontitle'] = '封存此信件';
+$labels['archived'] = '已成功封存';
+$labels['archivefolder'] = '封存';
+
+?>
diff --git a/plugins/archive/package.xml b/plugins/archive/package.xml
new file mode 100644
index 000000000..c442a5c4d
--- /dev/null
+++ b/plugins/archive/package.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.0" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+ http://pear.php.net/dtd/tasks-1.0.xsd
+ http://pear.php.net/dtd/package-2.0
+ http://pear.php.net/dtd/package-2.0.xsd">
+ <name>archive</name>
+ <channel>pear.roundcube.net</channel>
+ <summary>Archive feature for Roundcube</summary>
+ <description>This adds a button to move the selected messages to an archive folder. The folder can be selected in the settings panel.</description>
+ <lead>
+ <name>Thomas Bruederli</name>
+ <user>thomasb</user>
+ <email>roundcube@gmail.com</email>
+ <active>yes</active>
+ </lead>
+ <date>2010-02-06</date>
+ <time>12:12:00</time>
+ <version>
+ <release>1.4</release>
+ <api>1.4</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
+ <notes>-</notes>
+ <contents>
+ <dir baseinstalldir="/" name="/">
+ <file name="archive.php" role="php">
+ <tasks:replace from="@name@" to="name" type="package-info"/>
+ <tasks:replace from="@package_version@" to="version" type="package-info"/>
+ </file>
+ <file name="archive.js" role="data">
+ <tasks:replace from="@name@" to="name" type="package-info"/>
+ <tasks:replace from="@package_version@" to="version" type="package-info"/>
+ </file>
+ <file name="localization/en_US.inc" role="data"></file>
+ <file name="localization/cs_CZ.inc" role="data"></file>
+ <file name="localization/de_CH.inc" role="data"></file>
+ <file name="localization/de_DE.inc" role="data"></file>
+ <file name="localization/et_EE.inc" role="data"></file>
+ <file name="localization/fr_FR.inc" role="data"></file>
+ <file name="localization/pl_PL.inc" role="data"></file>
+ <file name="localization/ru_RU.inc" role="data"></file>
+ <file name="localization/zh_TW.inc" role="data"></file>
+ <file name="skins/default/archive_act.png" role="data"></file>
+ <file name="skins/default/archive_pas.png" role="data"></file>
+ <file name="skins/default/foldericon.png" role="data"></file>
+ </dir>
+ <!-- / -->
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.2.1</min>
+ </php>
+ <pearinstaller>
+ <min>1.7.0</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+ <phprelease/>
+</package>
diff --git a/plugins/archive/skins/default/archive_act.png b/plugins/archive/skins/default/archive_act.png
new file mode 100644
index 000000000..2a1735868
--- /dev/null
+++ b/plugins/archive/skins/default/archive_act.png
Binary files differ
diff --git a/plugins/archive/skins/default/archive_pas.png b/plugins/archive/skins/default/archive_pas.png
new file mode 100644
index 000000000..8de208583
--- /dev/null
+++ b/plugins/archive/skins/default/archive_pas.png
Binary files differ
diff --git a/plugins/archive/skins/default/foldericon.png b/plugins/archive/skins/default/foldericon.png
new file mode 100644
index 000000000..ec0853c44
--- /dev/null
+++ b/plugins/archive/skins/default/foldericon.png
Binary files differ