Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117792713
D5436.1775258646.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D5436.1775258646.diff
View Options
diff --git a/lib/kolab_sync_storage.php b/lib/kolab_sync_storage.php
--- a/lib/kolab_sync_storage.php
+++ b/lib/kolab_sync_storage.php
@@ -164,7 +164,7 @@
/**
* Converts list of folders to a "flat" list
*/
- protected function folders_list_flat($folders, $type, $typedata)
+ private function folders_list_flat($folders, $type, $typedata)
{
$delim = $this->storage->get_hierarchy_delimiter();
diff --git a/lib/kolab_sync_storage_kolab4.php b/lib/kolab_sync_storage_kolab4.php
--- a/lib/kolab_sync_storage_kolab4.php
+++ b/lib/kolab_sync_storage_kolab4.php
@@ -121,6 +121,9 @@
$list[$folder_data['serverId']] = $folder_data;
}
+ if ($flat_mode) {
+ $list = $this->folders_list_flat($list);
+ }
} elseif (in_array($type, [self::MODEL_CONTACTS, self::MODEL_CALENDAR, self::MODEL_TASKS])) {
if (!empty($this->folders)) {
foreach ($this->folders as $unique_key => $folder) {
@@ -145,15 +148,56 @@
}
}
}
- /*
- // TODO
- if ($flat_mode) {
- $list = $this->folders_list_flat($list, $type, $typedata);
- }
- */
+
return $list;
}
+ /**
+ * Converts list of folders to a "flat" list
+ */
+ private function folders_list_flat($folders)
+ {
+ // This contains a mapping for special folders, such as 'Sent' => 'mail.sentitems',
+ $typedata = kolab_storage::folders_typedata();
+ $delim = $this->storage->get_hierarchy_delimiter();
+ foreach ($folders as $idx => $folder) {
+ // for mail folders we modify only folders with non-existing parents
+ if ($folder['parentId']) {
+ $items = explode($delim, $folder['imap_name']);
+ $parent = 0;
+
+ // find existing parent
+ while (count($items) > 0) {
+ array_pop($items);
+
+ $parent_name = implode($delim, $items);
+ $parent_type = !empty($typedata[$parent_name]) ? $typedata[$parent_name] : 'mail';
+ $parent_id = $this->folder_id($parent_name, $parent_type);
+
+ if (isset($folders[$parent_id])) {
+ $parent = $parent_id;
+ break;
+ }
+ }
+
+ if (!$parent) {
+ $display_name = kolab_storage::object_prettyname($folder['imap_name']);
+ $display_name = html_entity_decode($display_name, ENT_COMPAT, RCUBE_CHARSET);
+ } else {
+ $parent_name = isset($parent_id) ? $folders[$parent_id]['imap_name'] : '';
+ $display_name = substr($folder['imap_name'], strlen($parent_name) + 1);
+ $display_name = rcube_charset::convert($display_name, 'UTF7-IMAP');
+ $display_name = str_replace($delim, ' » ', $display_name);
+ }
+
+ $folders[$idx]['parentId'] = $parent;
+ $folders[$idx]['displayName'] = $display_name;
+ }
+ }
+
+ return $folders;
+ }
+
/**
* Creates folder and subscribes to the device
*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 11:24 PM (4 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18827253
Default Alt Text
D5436.1775258646.diff (3 KB)
Attached To
Mode
D5436: flat_mode for kolab4
Attached
Detach File
Event Timeline