diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php index a5002bab..2c41ac39 100644 --- a/plugins/calendar/drivers/kolab/kolab_driver.php +++ b/plugins/calendar/drivers/kolab/kolab_driver.php @@ -858,10 +858,10 @@ class kolab_driver extends calendar_driver { // Remove any scripts/css/js $this->rc->output->reset(); - + // Produce form content $content = $this->calendar_form_content($calendar, $formfields); - + // Parse form template for skin-dependent stuff // TODO: copy scripts and styles added by other plugins (e.g. acl) from $this->rc->output $html = $this->rc->output->parse('calendar.calendarform-kolab', false, false); @@ -920,7 +920,7 @@ class kolab_driver extends calendar_driver $hidden_fields[] = array('name' => 'parent', 'value' => $path_imap); } else { - $select = rcube_kolab::folder_selector('event', array('name' => 'parent')); + $select = rcube_kolab::folder_selector('event', array('name' => 'parent'), $folder); $form['props']['fieldsets']['location']['content']['path'] = array( 'label' => $this->cal->gettext('parentcalendar'), 'value' => $select->show($path_imap), diff --git a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php index 9abd813b..83b97022 100644 --- a/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php +++ b/plugins/kolab_addressbook/lib/kolab_addressbook_ui.php @@ -162,7 +162,7 @@ class kolab_addressbook_ui $hidden_fields[] = array('name' => '_parent', 'value' => $path_imap); } else { - $select = rcube_kolab::folder_selector('contact', array('name' => '_parent')); + $select = rcube_kolab::folder_selector('contact', array('name' => '_parent'), $folder); $form['props']['fieldsets']['location']['content']['path'] = array( 'label' => $this->plugin->gettext('parentbook'), diff --git a/plugins/kolab_core/rcube_kolab.php b/plugins/kolab_core/rcube_kolab.php index 052751f2..bf79b13a 100644 --- a/plugins/kolab_core/rcube_kolab.php +++ b/plugins/kolab_core/rcube_kolab.php @@ -416,19 +416,33 @@ class rcube_kolab /** * Creates a SELECT field with folders list * - * @param string $type Folder type - * @param array $attrs SELECT field attributes (e.g. name) + * @param string $type Folder type + * @param array $attrs SELECT field attributes (e.g. name) + * @param string $current The name of current folder (to skip it) * * @return html_select SELECT object */ - public static function folder_selector($type, $attrs) + public static function folder_selector($type, $attrs, $current = '') { // get all folders of specified type $folders = self::get_folders($type); + $delim = $_SESSION['delimiter']; $names = array(); - foreach ($folders as $c_folder) - $names[$c_folder->name] = rcube_charset_convert($c_folder->name, 'UTF7-IMAP'); + $len = strlen($current); + + // Filter folders list + foreach ($folders as $c_folder) { + $name = $c_folder->name; + // skip current folder and it's subfolders + if ($len && ($name == $current || strpos($name, $current.$delim) === 0)) { + continue; + } + + $names[$name] = rcube_charset_convert($name, 'UTF7-IMAP'); + } + + // Sort folders list asort($names, SORT_LOCALE_STRING); $folders = array_keys($names);