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

This commit is contained in:
Thomas Bruederli 2011-07-29 17:51:21 +02:00
commit a80720ebac
5 changed files with 45 additions and 18 deletions

View file

@ -66,10 +66,9 @@ class kolab_calendar
$this->alarms = true;
}
else {
$acl = $this->storage->_folder->getACL();
if (is_array($acl)) {
$acl = $acl[$_SESSION['username']];
if (strpos($acl, 'i') !== false)
$rights = $this->storage->_folder->getMyRights();
if (!PEAR::isError($rights)) {
if (strpos($rights, 'i') !== false)
$this->readonly = false;
}
}

View file

@ -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),

View file

@ -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'),

View file

@ -127,12 +127,11 @@ class rcube_kolab_contacts extends rcube_addressbook
$this->readonly = false;
}
else {
$acl = $this->storagefolder->getACL();
if (!PEAR::isError($acl) && is_array($acl)) {
$acl = $acl[$_SESSION['username']];
if (strpos($acl, 'i') !== false)
$rights = $this->storagefolder->getMyRights();
if (!PEAR::isError($rights)) {
if (strpos($rights, 'i') !== false)
$this->readonly = false;
if (strpos($acl, 'a') !== false || strpos($acl, 'x') !== false)
if (strpos($rights, 'a') !== false || strpos($rights, 'x') !== false)
$this->editable = true;
}
}

View file

@ -416,19 +416,48 @@ 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);
if ($len && ($rpos = strrpos($current, $delim))) {
$parent = substr($current, 0, $rpos-1);
$p_len = strlen($parent);
}
// 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;
}
// always show the parent of current folder
if ($p_len && $name == $parent) { }
// skip folders where user have no rights to create subfolders
else if ($c_folder->getOwner() != $_SESSION['username']) {
$rights = $c_folder->getMyRights();
if (PEAR::IsError($rights) || !preg_match('/[ck]/', $rights)) {
continue;
}
}
$names[$name] = rcube_charset_convert($name, 'UTF7-IMAP');
}
// Sort folders list
asort($names, SORT_LOCALE_STRING);
$folders = array_keys($names);