summaryrefslogtreecommitdiff
path: root/program/steps/settings/folders.inc
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-11 13:11:10 +0200
committerAleksander Machniak <alec@alec.pl>2014-08-11 13:11:10 +0200
commite9ecd49f7460f571e2bf13161038371e2d5f8bfb (patch)
treefa3c3ad4ab2b87485905879f52c6b45e545303a6 /program/steps/settings/folders.inc
parent1c70ff9d2471fa48f5ffe9d270b3b04e6ec58a63 (diff)
Added namespace filter in Folder Manager
Diffstat (limited to 'program/steps/settings/folders.inc')
-rw-r--r--program/steps/settings/folders.inc49
1 files changed, 47 insertions, 2 deletions
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 061cd8893..14e41d607 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -181,8 +181,9 @@ $OUTPUT->add_label('deletefolderconfirm', 'purgefolderconfirm', 'folderdeleting'
// register UI objects
$OUTPUT->add_handlers(array(
- 'foldersubscription' => 'rcube_subscription_form',
+ 'foldersubscription' => 'rcmail_subscription_form',
'folderframe' => 'rcmail_folder_frame',
+ 'folderfilter' => 'rcmail_folder_filter',
'quotadisplay' => array($RCMAIL, 'quota_display'),
));
@@ -190,7 +191,7 @@ $OUTPUT->send('folders');
// build table with all folders listed by server
-function rcube_subscription_form($attrib)
+function rcmail_subscription_form($attrib)
{
global $RCMAIL, $OUTPUT;
@@ -424,6 +425,50 @@ function rcmail_folder_frame($attrib)
return $OUTPUT->frame($attrib, true);
}
+function rcmail_folder_filter($attrib)
+{
+ global $RCMAIL;
+
+ $storage = $RCMAIL->get_storage();
+ $namespace = $storage->get_namespace();
+
+ if (empty($namespace['personal']) && empty($namespace['shared']) && empty($namespace['other'])) {
+ return '';
+ }
+
+ if (!$attrib['id']) {
+ $attrib['id'] = 'rcmfolderfilter';
+ }
+
+ $attrib['onchange'] = rcmail_output::JS_OBJECT_NAME . '.folder_filter(this.value)';
+
+ $roots = array();
+ $select = new html_select($attrib);
+ $select->add($RCMAIL->gettext('all'), '---');
+
+ foreach (array_keys($namespace) as $type) {
+ foreach ((array)$namespace[$type] as $ns) {
+ $root = rtrim($ns[0], $ns[1]);
+ $label = $RCMAIL->gettext('namespace.' . $type);
+
+ if (count($namespace[$type]) > 1) {
+ $label .= ' (' . rcube_charset::convert($root, 'UTF7-IMAP', RCUBE_CHARSET) . ')';
+ }
+
+ $select->add($label, $root);
+
+ if (strlen($root)) {
+ $roots[] = $root;
+ }
+ }
+ }
+
+ $RCMAIL->output->add_gui_object('foldersfilter', $attrib['id']);
+ $RCMAIL->output->set_env('ns_roots', $roots);
+
+ return $select->show();
+}
+
function rcmail_rename_folder($oldname, $newname)
{
global $RCMAIL;