Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube

This commit is contained in:
Thomas Bruederli 2011-07-29 13:16:27 +02:00
commit 0f266481dd
2 changed files with 29 additions and 24 deletions

View file

@ -102,40 +102,42 @@ class kolab_addressbook_ui
{
$action = trim(get_input_value('_act', RCUBE_INPUT_GPC));
$folder = trim(get_input_value('_source', RCUBE_INPUT_GPC, true)); // UTF8
$name = trim(get_input_value('_name', RCUBE_INPUT_GPC, true)); // UTF8
$old = trim(get_input_value('_oldname', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$path_imap = trim(get_input_value('_parent', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$hidden_fields[] = array('name' => '_source', 'value' => $folder);
$folder = rcube_charset_convert($folder, RCMAIL_CHARSET, 'UTF7-IMAP');
$delim = $_SESSION['imap_delimiter'];
$form = array();
if ($this->rc->action == 'plugin.book-save') {
// save error
$path_imap = $folder;
$name = trim(get_input_value('_name', RCUBE_INPUT_GPC, true)); // UTF8
$old = trim(get_input_value('_oldname', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$path_imap = trim(get_input_value('_parent', RCUBE_INPUT_GPC, true)); // UTF7-IMAP
$hidden_fields[] = array('name' => '_oldname', 'value' => $old);
if (strlen($old)) {
$this->rc->imap_connect();
$options = $this->rc->imap->mailbox_info($old);
}
$folder = $old;
}
else if ($action == 'edit') {
$path_imap = explode($delim, $folder);
$name = rcube_charset_convert(array_pop($path_imap), 'UTF7-IMAP');
$path_imap = implode($path_imap, $delim);
}
else { // create
$path_imap = $folder;
$name = '';
$folder = '';
}
// Store old name, get folder options
if (strlen($folder)) {
$hidden_fields[] = array('name' => '_oldname', 'value' => $folder);
$this->rc->imap_connect();
$options = $this->rc->imap->mailbox_info($folder);
}
$hidden_fields[] = array('name' => '_oldname', 'value' => $folder);
}
else {
$path_imap = $folder;
$name = '';
}
$form = array();
// General tab
$form['props'] = array(

View file

@ -290,20 +290,23 @@ class rcube_kolab
$folder = $kolab->getFolder($oldname);
$folder->setFolder($newname);
// We're not using $folder->save() because some caching issues
$result = $kolab->rename($folder);
if (is_a($result, 'PEAR_Error')) {
return false;
}
// need to re-set some properties
$folder->name = $folder->new_name;
$folder->new_name = null;
$folder->_title = null;
$folder->_owner = null;
// resetting _data prevents from some wierd cache unserialization issue
$folder->_data = null;
// @TODO: Horde doesn't update subfolders cache nor subscriptions
// but we cannot use Roundcube imap object here, because
// when two connections are used in one request and we have
// multi-server configuration, updating the cache after all
// would get wrong information (e.g. annotations)
// Reset the List object and cache
$kolab = null;
if (self::$cache) {
self::$list = null;
self::$cache->remove('mailboxes', true);
}
return true;
}