Fix setting display color of read-only calendars

This commit is contained in:
Thomas Bruederli 2011-07-17 21:13:34 +02:00
parent f87ddd4c6e
commit b7564ade58
2 changed files with 4 additions and 5 deletions

View file

@ -876,7 +876,7 @@ function rcube_calendar_ui(settings)
var $dialog = $("#calendarform").dialog('close');
if (!calendar)
calendar = { name:'', color:'cc0000' };
calendar = { name:'', color:'cc0000', editable:true };
var form, name, color;
@ -889,7 +889,7 @@ function rcube_calendar_ui(settings)
success: function(data){
$dialog.html(data);
form = $('#calendarform > form');
name = $('#calendar-name').val(calendar.editname || calendar.name);
name = $('#calendar-name').prop('disabled', !calendar.editable).val(calendar.editname || calendar.name);
color = $('#calendar-color').val(calendar.color).miniColors({ value: calendar.color });
name.select();
}

View file

@ -177,21 +177,20 @@ class kolab_driver extends calendar_driver
$this->rc->imap_init();
$newfolder = $this->rc->imap->mod_mailbox($newfolder, 'in');
if ($newfolder != $oldfolder)
if (!$cal->readonly && $newfolder != $oldfolder)
$result = rcube_kolab::folder_rename($oldfolder, $newfolder);
else
$result = true;
if ($result) {
// create ID
$id = rcube_kolab::folder_id($newfolder);
$id = $newfolder ? rcube_kolab::folder_id($newfolder) : $prop['id'];
// save color in user prefs (temp. solution)
$prefs['kolab_calendars'] = $this->rc->config->get('kolab_calendars', array());
unset($prefs['kolab_calendars'][$prop['id']]);
$prefs['kolab_calendars'][$id]['color'] = $prop['color'];
$this->rc->user->save_prefs($prefs);
return true;
}
}