Kolab driver uses immutable category configuration
This commit is contained in:
parent
722a400e01
commit
2bf657d69d
4 changed files with 82 additions and 78 deletions
|
@ -2,7 +2,7 @@
|
|||
+ Edit: 3.13: Location
|
||||
+ Edit: 3.14: Start / End / All Day
|
||||
+ 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.18: Recurrence (in line with Kontact)
|
||||
- Edit: 3.19: Attachment Upload
|
||||
|
|
|
@ -233,6 +233,7 @@ class calendar extends rcube_plugin
|
|||
|
||||
|
||||
// category definitions
|
||||
if (!$this->driver->categoriesimmutable) {
|
||||
$p['blocks']['categories']['name'] = $this->gettext('categories');
|
||||
|
||||
$categories = $this->rc->config->get('calendar_categories', array());
|
||||
|
@ -267,6 +268,7 @@ class calendar extends rcube_plugin
|
|||
}
|
||||
}');
|
||||
}
|
||||
}
|
||||
|
||||
return $p;
|
||||
}
|
||||
|
@ -281,7 +283,21 @@ class calendar extends rcube_plugin
|
|||
function preferences_save($p)
|
||||
{
|
||||
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
|
||||
if (!$this->driver->categoriesimmutable) {
|
||||
$old_categories = $new_categories = array();
|
||||
foreach ($this->driver->list_categories() as $name => $color) {
|
||||
$old_categories[md5($name)] = $name;
|
||||
|
@ -307,19 +323,8 @@ class calendar extends rcube_plugin
|
|||
$this->driver->remove_category($name);
|
||||
}
|
||||
|
||||
// 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_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,
|
||||
);
|
||||
$p['prefs']['calendar_categories'] = $new_categories;
|
||||
}
|
||||
}
|
||||
|
||||
return $p;
|
||||
|
|
|
@ -28,6 +28,7 @@ abstract class calendar_driver
|
|||
public $alarms = false;
|
||||
public $attendees = false;
|
||||
public $attachments = false;
|
||||
public $categoriesimmutable = false;
|
||||
public $alarm_types = array('DISPLAY');
|
||||
|
||||
/**
|
||||
|
@ -135,7 +136,6 @@ abstract class calendar_driver
|
|||
* @return array A list of alarms, each encoded as hash array:
|
||||
* id: Event identifier
|
||||
* uid: Unique identifier of this event
|
||||
* calendar: Calendar identifier to add event to (optional)
|
||||
* start: Event start date/time as unix timestamp
|
||||
* end: Event end date/time as unix timestamp
|
||||
* allday: Boolean flag if this is an all-day event
|
||||
|
|
|
@ -24,6 +24,7 @@ class kolab_driver extends calendar_driver
|
|||
public $alarms = true;
|
||||
public $attendees = false;
|
||||
public $attachments = false;
|
||||
public $categoriesimmutable = true;
|
||||
|
||||
private $rc;
|
||||
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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update/replace a category
|
||||
*/
|
||||
public function replace_category($oldname, $name, $color)
|
||||
{
|
||||
|
||||
# fixed list according to http://www.kolab.org/doc/kolabformat-2.0rc7-html/c300.html
|
||||
return array(
|
||||
'important' => 'cc0000',
|
||||
'business' => '333333',
|
||||
'personal' => '333333',
|
||||
'vacation' => '333333',
|
||||
'must-attend' => '333333',
|
||||
'travel-required' => '333333',
|
||||
'needs-preparation' => '333333',
|
||||
'birthday' => '333333',
|
||||
'anniversary' => '333333',
|
||||
'phone-call' => '333333',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue