summaryrefslogtreecommitdiff
path: root/program/steps/settings/func.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-05-20 10:38:44 +0000
committeralecpl <alec@alec.pl>2011-05-20 10:38:44 +0000
commit254d5ef32b7ec45a48abd43f19c84168dabe13d1 (patch)
tree4b8551073ec4ac519856f9f04049d3c5b1d7dd40 /program/steps/settings/func.inc
parent3253b296c21c54df228de39ff3e4775974df81d5 (diff)
- Improve performence of folder manager operations by moving subscriptions table operations (like adding/updateing/moving folders) into client-side - no need to invoke LIST, do sorting in browser
- This change should also handle better situations when working with replicated IMAP backend (e.g.Cyrus Murder)
Diffstat (limited to 'program/steps/settings/func.inc')
-rw-r--r--program/steps/settings/func.inc23
1 files changed, 22 insertions, 1 deletions
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index b204d9bc9..a44d6c8ff 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -747,7 +747,7 @@ function rcmail_get_skins()
}
-function rcube_folder_options($mailbox)
+function rcmail_folder_options($mailbox)
{
global $RCMAIL;
@@ -785,6 +785,27 @@ function rcube_folder_options($mailbox)
return $options;
}
+// Updates (or creates) folder row in the subscriptions table
+function rcmail_update_folder_row($name, $oldname=null)
+{
+ global $IMAP, $CONFIG, $OUTPUT;
+
+ $delimiter = $IMAP->get_hierarchy_delimiter();
+ $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP');
+ $protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_imap_folders']));
+
+ $foldersplit = explode($delimiter, $IMAP->mod_mailbox($name));
+ $level = count($foldersplit) - 1;
+ $display_name = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level)
+ . Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'));
+
+ if ($oldname === null)
+ $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, true);
+ else
+ $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldname, 'UTF7-IMAP'),
+ $name_utf8, $display_name, $protected);
+}
+
// register UI objects
$OUTPUT->add_handlers(array(