Kolab driver uses immutable category configuration

This commit is contained in:
Thomas Bruederli 2011-05-26 15:44:46 +02:00
parent 722a400e01
commit 2bf657d69d
4 changed files with 82 additions and 78 deletions

View file

@ -2,7 +2,7 @@
+ Edit: 3.13: Location + Edit: 3.13: Location
+ Edit: 3.14: Start / End / All Day + Edit: 3.14: Start / End / All Day
+ Edit: 3.15: Show time as: Busy, Free, Out of office + Edit: 3.15: Show time as: Busy, Free, Out of office
- Edit: 3.16: Reminder set + Edit: 3.16: Reminder set
+ Edit: 3.17: Priority: High/Low + Edit: 3.17: Priority: High/Low
- Edit: 3.18: Recurrence (in line with Kontact) - Edit: 3.18: Recurrence (in line with Kontact)
- Edit: 3.19: Attachment Upload - Edit: 3.19: Attachment Upload

View file

@ -233,6 +233,7 @@ class calendar extends rcube_plugin
// category definitions // category definitions
if (!$this->driver->categoriesimmutable) {
$p['blocks']['categories']['name'] = $this->gettext('categories'); $p['blocks']['categories']['name'] = $this->gettext('categories');
$categories = $this->rc->config->get('calendar_categories', array()); $categories = $this->rc->config->get('calendar_categories', array());
@ -267,6 +268,7 @@ class calendar extends rcube_plugin
} }
}'); }');
} }
}
return $p; return $p;
} }
@ -281,7 +283,21 @@ class calendar extends rcube_plugin
function preferences_save($p) function preferences_save($p)
{ {
if ($p['section'] == 'calendar') { if ($p['section'] == 'calendar') {
// compose default alarm preset value
$alarm_offset = get_input_value('_alarm_offset', RCUBE_INPUT_POST);
$default_alam = $alarm_offset[0] . intval(get_input_value('_alarm_value', RCUBE_INPUT_POST)) . $alarm_offset[1];
$p['prefs'] = array(
'calendar_default_view' => get_input_value('_default_view', RCUBE_INPUT_POST),
'calendar_time_format' => get_input_value('_time_format', RCUBE_INPUT_POST),
'calendar_timeslots' => get_input_value('_timeslots', RCUBE_INPUT_POST),
'calendar_first_day' => get_input_value('_first_day', RCUBE_INPUT_POST),
'calendar_default_alarm_type' => get_input_value('_alarm_type', RCUBE_INPUT_POST),
'calendar_default_alarm_offset' => $default_alam,
);
// categories // categories
if (!$this->driver->categoriesimmutable) {
$old_categories = $new_categories = array(); $old_categories = $new_categories = array();
foreach ($this->driver->list_categories() as $name => $color) { foreach ($this->driver->list_categories() as $name => $color) {
$old_categories[md5($name)] = $name; $old_categories[md5($name)] = $name;
@ -307,19 +323,8 @@ class calendar extends rcube_plugin
$this->driver->remove_category($name); $this->driver->remove_category($name);
} }
// compose default alarm preset value $p['prefs']['calendar_categories'] = $new_categories;
$alarm_offset = get_input_value('_alarm_offset', RCUBE_INPUT_POST); }
$default_alam = $alarm_offset[0] . intval(get_input_value('_alarm_value', RCUBE_INPUT_POST)) . $alarm_offset[1];
$p['prefs'] = array(
'calendar_categories' => $new_categories,
'calendar_default_view' => get_input_value('_default_view', RCUBE_INPUT_POST),
'calendar_time_format' => get_input_value('_time_format', RCUBE_INPUT_POST),
'calendar_timeslots' => get_input_value('_timeslots', RCUBE_INPUT_POST),
'calendar_first_day' => get_input_value('_first_day', RCUBE_INPUT_POST),
'calendar_default_alarm_type' => get_input_value('_alarm_type', RCUBE_INPUT_POST),
'calendar_default_alarm_offset' => $default_alam,
);
} }
return $p; return $p;

View file

@ -28,6 +28,7 @@ abstract class calendar_driver
public $alarms = false; public $alarms = false;
public $attendees = false; public $attendees = false;
public $attachments = false; public $attachments = false;
public $categoriesimmutable = false;
public $alarm_types = array('DISPLAY'); public $alarm_types = array('DISPLAY');
/** /**
@ -135,7 +136,6 @@ abstract class calendar_driver
* @return array A list of alarms, each encoded as hash array: * @return array A list of alarms, each encoded as hash array:
* id: Event identifier * id: Event identifier
* uid: Unique identifier of this event * uid: Unique identifier of this event
* calendar: Calendar identifier to add event to (optional)
* start: Event start date/time as unix timestamp * start: Event start date/time as unix timestamp
* end: Event end date/time as unix timestamp * end: Event end date/time as unix timestamp
* allday: Boolean flag if this is an all-day event * allday: Boolean flag if this is an all-day event

View file

@ -24,6 +24,7 @@ class kolab_driver extends calendar_driver
public $alarms = true; public $alarms = true;
public $attendees = false; public $attendees = false;
public $attachments = false; public $attachments = false;
public $categoriesimmutable = true;
private $rc; private $rc;
private $cal; private $cal;
@ -260,28 +261,26 @@ class kolab_driver extends calendar_driver
} }
/**
* Create a new category
*/
public function add_category($name, $color)
{
}
/** /**
* Remove the given category * List availabale categories
* The default implementation reads them from config/user prefs
*/ */
public function remove_category($name) public function list_categories()
{ {
# fixed list according to http://www.kolab.org/doc/kolabformat-2.0rc7-html/c300.html
} return array(
'important' => 'cc0000',
/** 'business' => '333333',
* Update/replace a category 'personal' => '333333',
*/ 'vacation' => '333333',
public function replace_category($oldname, $name, $color) 'must-attend' => '333333',
{ 'travel-required' => '333333',
'needs-preparation' => '333333',
'birthday' => '333333',
'anniversary' => '333333',
'phone-call' => '333333',
);
} }
/** /**