Make get_default_folder() work multiple annotations

This commit is contained in:
Thomas Bruederli 2012-09-20 09:32:02 +02:00
parent 395807c424
commit aae0f725bc

View file

@ -388,9 +388,8 @@ class kolab_folders extends rcube_plugin
$namespace = $storage->get_namespace(); $namespace = $storage->get_namespace();
// get all folders of specified type // get all folders of specified type
$folderdata = array_map('implode', $folderdata); $folderdata = array_map(array($this, 'folder_select_metadata'), $folderdata);
$folderdata = array_intersect($folderdata, array($type)); $folderdata = array_intersect($folderdata, array($type));
unset($folders[0]);
foreach ($folderdata as $folder => $data) { foreach ($folderdata as $folder => $data) {
// check if folder is in personal namespace // check if folder is in personal namespace
@ -411,6 +410,14 @@ class kolab_folders extends rcube_plugin
return null; return null;
} }
/**
* Callback for array_map to select the correct annotation value
*/
private function folder_select_metadata($types)
{
return $types[kolab_storage::CTYPE_KEY_PRIVATE] ?: $types[kolab_storage::CTYPE_KEY];
}
/** /**
* Returns CSS class name for specified folder type * Returns CSS class name for specified folder type
* *