From 15c68653e8bb49030bcd638dba300f33b950d8a7 Mon Sep 17 00:00:00 2001 From: alec Date: Fri, 20 May 2011 10:38:44 +0000 Subject: - 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) git-svn-id: https://svn.roundcube.net/trunk@4793 208e9e7b-5314-0410-a742-e7e81cd9613c --- roundcubemail/program/steps/settings/func.inc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'roundcubemail/program/steps/settings/func.inc') diff --git a/roundcubemail/program/steps/settings/func.inc b/roundcubemail/program/steps/settings/func.inc index b204d9bc9..a44d6c8ff 100644 --- a/roundcubemail/program/steps/settings/func.inc +++ b/roundcubemail/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('    ', $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( -- cgit v1.2.3