implement the attributes "deletable" and "editable_name" for calendars

This commit is contained in:
JodliDev 2021-08-26 15:58:25 +02:00
parent 766088b19a
commit 3df123b0b8
2 changed files with 21 additions and 20 deletions

View file

@ -2953,7 +2953,7 @@ function rcube_calendar_ui(settings)
$dialog = $('<iframe>').attr('src', rcmail.url('calendar', params)).on('load', function() {
var contents = $(this).contents();
contents.find('#calendar-name')
.prop('disabled', !calendar.editable)
.prop('disabled', !calendar.editable && !calendar.editable_name)
.val(calendar.editname || calendar.name)
.select();
contents.find('#calendar-color')
@ -3607,7 +3607,7 @@ function rcube_calendar_ui(settings)
if (node && node.id && me.calendars[node.id]) {
me.select_calendar(node.id, true);
rcmail.enable_command('calendar-edit', 'calendar-showurl', 'calendar-showfburl', true);
rcmail.enable_command('calendar-delete', me.calendars[node.id].editable);
rcmail.enable_command('calendar-delete', me.calendars[node.id].editable || me.calendars[node.id].deletable);
rcmail.enable_command('calendar-remove', me.calendars[node.id] && me.calendars[node.id].removable);
}
});

View file

@ -141,7 +141,6 @@ class caldav_driver extends calendar_driver
if($arr['is_ical']) {
$this->sync_clients[$arr['id']] = new ical_sync($arr);
$arr["readonly"] = true;
$arr["editable"] = false;
$arr["deletable"] = true;
$arr["editable_name"] = true;
@ -186,16 +185,17 @@ class caldav_driver extends calendar_driver
if (empty($active) || !in_array($id, $hidden)) {
$calendars[$id] = array(
'id' => $id,
'name' => $this->cal->gettext('birthdays'),
'listname' => $this->cal->gettext('birthdays'),
'color' => $prefs['color'],
'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'),
'active' => !in_array($id, $hidden),
'group' => 'x-birthdays',
'editable' => false,
'default' => false,
'children' => false,
'id' => $id,
'name' => $this->cal->gettext('birthdays'),
'listname' => $this->cal->gettext('birthdays'),
'color' => $prefs['color'],
'showalarms' => (bool)$this->rc->config->get('calendar_birthdays_alarm_type'),
'active' => !in_array($id, $hidden),
'group' => 'x-birthdays',
'editable' => false,
'editable_name' => true,
'default' => false,
'children' => false,
);
}
}
@ -880,19 +880,20 @@ class caldav_driver extends calendar_driver
}
// compose vcalendar-style recurrencue rule from structured data
$rrule = $event['recurrence'] ? libcalendaring::to_rrule($event['recurrence']) : '';
$rrule = !empty($event['recurrence']) ? libcalendaring::to_rrule($event['recurrence']) : '';
$sensitivity = strtolower($event['sensitivity']);
$free_busy = strtolower($event['free_busy']);
$event['_recurrence'] = rtrim($rrule, ';');
$event['free_busy'] = intval($this->free_busy_map[strtolower($event['free_busy'])]);
$event['sensitivity'] = intval($this->sensitivity_map[strtolower($event['sensitivity'])]);
$event['free_busy'] = isset($this->free_busy_map[$free_busy]) ? $this->free_busy_map[$free_busy] : null;
$event['sensitivity'] = isset($this->sensitivity_map[$sensitivity]) ? $this->sensitivity_map[$sensitivity] : null;
$event['all_day'] = !empty($event['allday']) ? 1 : 0;
if ($event['free_busy'] == 'tentative') {
$event['status'] = 'TENTATIVE';
}
if (isset($event['allday'])) {
$event['all_day'] = $event['allday'] ? 1 : 0;
}
// compute absolute time to notify the user
$event['notifyat'] = $this->_get_notification($event);