summaryrefslogtreecommitdiff
path: root/plugins/subscriptions_option
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/subscriptions_option')
-rw-r--r--plugins/subscriptions_option/localization/cs_CZ.inc23
-rw-r--r--plugins/subscriptions_option/localization/de_CH.inc6
-rw-r--r--plugins/subscriptions_option/localization/de_DE.inc6
-rw-r--r--plugins/subscriptions_option/localization/en_US.inc6
-rw-r--r--plugins/subscriptions_option/localization/es_ES.inc6
-rw-r--r--plugins/subscriptions_option/localization/et_EE.inc6
-rw-r--r--plugins/subscriptions_option/localization/gl_ES.inc6
-rw-r--r--plugins/subscriptions_option/localization/ja_JP.inc8
-rw-r--r--plugins/subscriptions_option/localization/pl_PL.inc6
-rw-r--r--plugins/subscriptions_option/localization/ru_RU.inc6
-rw-r--r--plugins/subscriptions_option/localization/sv_SE.inc6
-rw-r--r--plugins/subscriptions_option/localization/zh_TW.inc6
-rw-r--r--plugins/subscriptions_option/package.xml69
-rw-r--r--plugins/subscriptions_option/subscriptions_option.php95
14 files changed, 255 insertions, 0 deletions
diff --git a/plugins/subscriptions_option/localization/cs_CZ.inc b/plugins/subscriptions_option/localization/cs_CZ.inc
new file mode 100644
index 000000000..0d9c1fc73
--- /dev/null
+++ b/plugins/subscriptions_option/localization/cs_CZ.inc
@@ -0,0 +1,23 @@
+<?php
+
+/*
+
++-----------------------------------------------------------------------+
+| language/cs_CZ/labels.inc |
+| |
+| Language file of the Roundcube subscriptions option plugin |
+| Copyright (C) 2005-2009, The Roundcube Dev Team |
+| 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['useimapsubscriptions'] = 'Používat odebírání IMAP složek';
+
+?>
diff --git a/plugins/subscriptions_option/localization/de_CH.inc b/plugins/subscriptions_option/localization/de_CH.inc
new file mode 100644
index 000000000..b4affe0c8
--- /dev/null
+++ b/plugins/subscriptions_option/localization/de_CH.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Nur abonnierte Ordner anzeigen';
+
+?>
diff --git a/plugins/subscriptions_option/localization/de_DE.inc b/plugins/subscriptions_option/localization/de_DE.inc
new file mode 100644
index 000000000..b4affe0c8
--- /dev/null
+++ b/plugins/subscriptions_option/localization/de_DE.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Nur abonnierte Ordner anzeigen';
+
+?>
diff --git a/plugins/subscriptions_option/localization/en_US.inc b/plugins/subscriptions_option/localization/en_US.inc
new file mode 100644
index 000000000..5a348e0ee
--- /dev/null
+++ b/plugins/subscriptions_option/localization/en_US.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Use IMAP Subscriptions';
+
+?>
diff --git a/plugins/subscriptions_option/localization/es_ES.inc b/plugins/subscriptions_option/localization/es_ES.inc
new file mode 100644
index 000000000..ca9a42126
--- /dev/null
+++ b/plugins/subscriptions_option/localization/es_ES.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Usar suscripciones IMAP';
+
+?>
diff --git a/plugins/subscriptions_option/localization/et_EE.inc b/plugins/subscriptions_option/localization/et_EE.inc
new file mode 100644
index 000000000..6c5f6f435
--- /dev/null
+++ b/plugins/subscriptions_option/localization/et_EE.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Kasuta IMAP tellimusi';
+
+?>
diff --git a/plugins/subscriptions_option/localization/gl_ES.inc b/plugins/subscriptions_option/localization/gl_ES.inc
new file mode 100644
index 000000000..d7db28d2e
--- /dev/null
+++ b/plugins/subscriptions_option/localization/gl_ES.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Usar suscripcións IMAP';
+
+?>
diff --git a/plugins/subscriptions_option/localization/ja_JP.inc b/plugins/subscriptions_option/localization/ja_JP.inc
new file mode 100644
index 000000000..dacea2956
--- /dev/null
+++ b/plugins/subscriptions_option/localization/ja_JP.inc
@@ -0,0 +1,8 @@
+<?php
+
+// EN-Revision: 3891
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'IMAP 購読リストを使う';
+
+?>
diff --git a/plugins/subscriptions_option/localization/pl_PL.inc b/plugins/subscriptions_option/localization/pl_PL.inc
new file mode 100644
index 000000000..8544c7d30
--- /dev/null
+++ b/plugins/subscriptions_option/localization/pl_PL.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Używaj subskrypcji IMAP';
+
+?>
diff --git a/plugins/subscriptions_option/localization/ru_RU.inc b/plugins/subscriptions_option/localization/ru_RU.inc
new file mode 100644
index 000000000..5deb84e0d
--- /dev/null
+++ b/plugins/subscriptions_option/localization/ru_RU.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Использовать IMAP подписку';
+
+?>
diff --git a/plugins/subscriptions_option/localization/sv_SE.inc b/plugins/subscriptions_option/localization/sv_SE.inc
new file mode 100644
index 000000000..05b7006f4
--- /dev/null
+++ b/plugins/subscriptions_option/localization/sv_SE.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = 'Använd IMAP-prenumerationer';
+
+?>
diff --git a/plugins/subscriptions_option/localization/zh_TW.inc b/plugins/subscriptions_option/localization/zh_TW.inc
new file mode 100644
index 000000000..f310b51b7
--- /dev/null
+++ b/plugins/subscriptions_option/localization/zh_TW.inc
@@ -0,0 +1,6 @@
+<?php
+
+$labels = array();
+$labels['useimapsubscriptions'] = '使用IMAP訂閱';
+
+?>
diff --git a/plugins/subscriptions_option/package.xml b/plugins/subscriptions_option/package.xml
new file mode 100644
index 000000000..1ecabf711
--- /dev/null
+++ b/plugins/subscriptions_option/package.xml
@@ -0,0 +1,69 @@
+<?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>subscriptions_option</name>
+ <channel>pear.roundcube.net</channel>
+ <summary>Option to disable IMAP subscriptions</summary>
+ <description>
+ A plugin which can enable or disable the use of imap subscriptions.
+ It includes a toggle on the settings page under "Server Settings".
+ The preference can also be locked.
+ </description>
+ <lead>
+ <name>Thomas Bruederli</name>
+ <user>thomasb</user>
+ <email>roundcube@gmail.com</email>
+ <active>yes</active>
+ </lead>
+ <developer>
+ <name>Ziba Scott</name>
+ <user>ziba</user>
+ <email>ziba@umich.edu</email>
+ <active>yes</active>
+ </developer>
+ <date>2012-03-05</date>
+ <version>
+ <release>1.2</release>
+ <api>1.1</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="subscriptions_option.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="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/en_US.inc" role="data"></file>
+ <file name="localization/es_ES.inc" role="data"></file>
+ <file name="localization/et_EE.inc" role="data"></file>
+ <file name="localization/gl_ES.inc" role="data"></file>
+ <file name="localization/ja_JP.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/sv_SE.inc" role="data"></file>
+ <file name="localization/zh_TW.inc" 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/subscriptions_option/subscriptions_option.php b/plugins/subscriptions_option/subscriptions_option.php
new file mode 100644
index 000000000..28f826263
--- /dev/null
+++ b/plugins/subscriptions_option/subscriptions_option.php
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * Subscription Options
+ *
+ * A plugin which can enable or disable the use of imap subscriptions.
+ * It includes a toggle on the settings page under "Server Settings".
+ * The preference can also be locked
+ *
+ * Add it to the plugins list in config/main.inc.php to enable the user option
+ * The user option can be hidden and set globally by adding 'use_subscriptions'
+ * to the the 'dont_override' configure line:
+ * $rcmail_config['dont_override'] = array('use_subscriptions');
+ * and then set the global preference
+ * $rcmail_config['use_subscriptions'] = true; // or false
+ *
+ * Roundcube caches folder lists. When a user changes this option or visits
+ * their folder list, this cache is refreshed. If the option is on the
+ * 'dont_override' list and the global option has changed, don't expect
+ * to see the change until the folder list cache is refreshed.
+ *
+ * @version @package_version@
+ * @author Ziba Scott
+ */
+class subscriptions_option extends rcube_plugin
+{
+ public $task = 'mail|settings';
+
+ function init()
+ {
+ $this->add_texts('localization/', false);
+ $dont_override = rcmail::get_instance()->config->get('dont_override', array());
+ if (!in_array('use_subscriptions', $dont_override)) {
+ $this->add_hook('preferences_list', array($this, 'settings_blocks'));
+ $this->add_hook('preferences_save', array($this, 'save_prefs'));
+ }
+ $this->add_hook('storage_folders', array($this, 'mailboxes_list'));
+ $this->add_hook('folders_list', array($this, 'folders_list'));
+ }
+
+ function settings_blocks($args)
+ {
+ if ($args['section'] == 'server') {
+ $use_subscriptions = rcmail::get_instance()->config->get('use_subscriptions');
+ $field_id = 'rcmfd_use_subscriptions';
+ $checkbox = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1));
+
+ $args['blocks']['main']['options']['use_subscriptions'] = array(
+ 'title' => html::label($field_id, Q($this->gettext('useimapsubscriptions'))),
+ 'content' => $checkbox->show($use_subscriptions?1:0),
+ );
+ }
+
+ return $args;
+ }
+
+ function save_prefs($args)
+ {
+ if ($args['section'] == 'server') {
+ $rcmail = rcmail::get_instance();
+ $use_subscriptions = $rcmail->config->get('use_subscriptions');
+
+ $args['prefs']['use_subscriptions'] = isset($_POST['_use_subscriptions']) ? true : false;
+
+ // if the use_subscriptions preference changes, flush the folder cache
+ if (($use_subscriptions && !isset($_POST['_use_subscriptions'])) ||
+ (!$use_subscriptions && isset($_POST['_use_subscriptions']))) {
+ $storage = $rcmail->get_storage();
+ $storage->clear_cache('mailboxes');
+ }
+ }
+ return $args;
+ }
+
+ function mailboxes_list($args)
+ {
+ $rcmail = rcmail::get_instance();
+ if (!$rcmail->config->get('use_subscriptions', true)) {
+ $storage = $rcmail->get_storage();
+ if ($storage->check_connection()) {
+ $args['folders'] = $storage->conn->listMailboxes($args['root'], $args['name']);
+ }
+ }
+ return $args;
+ }
+
+ function folders_list($args)
+ {
+ $rcmail = rcmail::get_instance();
+ if (!$rcmail->config->get('use_subscriptions', true)) {
+ $args['table']->remove_column('subscribed');
+ }
+ return $args;
+ }
+}