summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-16 14:32:08 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-10-16 14:32:08 (GMT)
commit24f64bee5ae8ac6e7c6522c5e7fb686df658ca46 (patch)
tree49f6cab25786e82ea6329489b4685e814053c854
parent0e39734b88b755ed3f4a8eb1dede6841d46592d8 (diff)
downloadroundcubemail-plugins-kolab-24f64bee5ae8ac6e7c6522c5e7fb686df658ca46.tar.gz
Sort folders by hierarchy level first
-rw-r--r--plugins/libkolab/lib/kolab_storage.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
index 23d273b..8ede2e3 100644
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -677,11 +677,13 @@ class kolab_storage
*/
public static function sort_folders($folders)
{
+ $delimiter = self::$imap->get_hierarchy_delimiter();
$nsnames = array('personal' => array(), 'shared' => array(), 'other' => array());
foreach ($folders as $folder) {
$folders[$folder->name] = $folder;
$ns = $folder->get_namespace();
- $nsnames[$ns][$folder->name] = strtolower(html_entity_decode(self::object_name($folder->name, $ns), ENT_COMPAT, RCUBE_CHARSET)); // decode &raquo;
+ $level = count(explode($delimiter, $folder->name));
+ $nsnames[$ns][$folder->name] = sprintf('%02d-%s', $level, strtolower(html_entity_decode(self::object_name($folder->name, $ns), ENT_COMPAT, RCUBE_CHARSET))); // decode &raquo;
}
$names = array();