Minor bugfixes and visual enhancements for new folder navigation

This commit is contained in:
Thomas Bruederli 2014-05-21 10:50:36 +02:00
parent 36248fb468
commit 709bd16016
5 changed files with 17 additions and 8 deletions

View file

@ -52,7 +52,7 @@ class kolab_calendar extends kolab_storage_folder_api
$imap = $calendar->rc->get_storage(); $imap = $calendar->rc->get_storage();
$imap_folder = kolab_storage::id_decode($id); $imap_folder = kolab_storage::id_decode($id);
$info = $imap->folder_info($imap_folder, true); $info = $imap->folder_info($imap_folder, true);
if (empty($info) || $info['noselect'] || kolab_storage::folder_type($imap_folder) != 'event') { if (empty($info) || $info['noselect'] || strpos(kolab_storage::folder_type($imap_folder), 'event') !== 0) {
return new kolab_user_calendar($imap_folder, $calendar); return new kolab_user_calendar($imap_folder, $calendar);
} }
else { else {

View file

@ -117,8 +117,9 @@ class kolab_driver extends calendar_driver
} }
} }
$delim = $this->rc->get_storage()->get_hierarchy_delimiter();
$folders = $this->filter_calendars(false, $active, $personal); $folders = $this->filter_calendars(false, $active, $personal);
$calendars = $names = array(); $calendars = array();
// include virtual folders for a full folder tree // include virtual folders for a full folder tree
if (!is_null($tree)) if (!is_null($tree))
@ -127,14 +128,19 @@ class kolab_driver extends calendar_driver
foreach ($folders as $id => $cal) { foreach ($folders as $id => $cal) {
$fullname = $cal->get_name(); $fullname = $cal->get_name();
$listname = $cal->get_foldername(); $listname = $cal->get_foldername();
$imap_path = explode('/', $cal->name); $imap_path = explode($delim, $cal->name);
// find parent // find parent
do { do {
array_pop($imap_path); array_pop($imap_path);
$parent_id = kolab_storage::folder_id(join('/', $imap_path)); $parent_id = kolab_storage::folder_id(join($delim, $imap_path));
}
while (count($imap_path) > 1 && !$this->calendars[$parent_id]);
// restore "real" parent ID
if ($parent_id && !$this->calendars[$parent_id]) {
$parent_id = kolab_storage::folder_id($cal->get_parent());
} }
while (count($imap_path) > 0 && !$this->calendars[$parent_id]);
// turn a kolab_storage_folder object into a kolab_calendar // turn a kolab_storage_folder object into a kolab_calendar
if ($cal instanceof kolab_storage_folder) { if ($cal instanceof kolab_storage_folder) {
@ -360,9 +366,9 @@ class kolab_driver extends calendar_driver
if ($prop['id'] && ($cal = $this->get_calendar($prop['id']))) { if ($prop['id'] && ($cal = $this->get_calendar($prop['id']))) {
$ret = false; $ret = false;
if (isset($prop['permanent'])) if (isset($prop['permanent']))
$ret |= $cal->storage->subscribe($prop['permanent']); $ret |= $cal->storage->subscribe(intval($prop['permanent']));
if (isset($prop['active'])) if (isset($prop['active']))
$ret |= $cal->storage->activate($prop['active']); $ret |= $cal->storage->activate(intval($prop['active']));
return $ret; return $ret;
} }
else { else {

View file

@ -273,7 +273,7 @@ class calendar_ui
/** /**
* Helper method to build a calendar list item (HTML content and js data) * Helper method to build a calendar list item (HTML content and js data)
*/ */
public function calendar_list_item($id, $prop, &$jsenv, $activeonly) public function calendar_list_item($id, $prop, &$jsenv, $activeonly = false)
{ {
// enrich calendar properties with settings from the driver // enrich calendar properties with settings from the driver
if (!$prop['virtual']) { if (!$prop['virtual']) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -256,6 +256,9 @@ $(document).ready(function(e){
if (box.is(':visible')) { if (box.is(':visible')) {
box.find('input[type=text]').focus(); box.find('input[type=text]').focus();
} }
else {
$('#calendarlistsearch-reset').click();
}
// TODO: save state in localStorage // TODO: save state in localStorage
} }
}); });