Fix so default categories are used when categories aren't configured
This commit is contained in:
parent
484e5ad498
commit
aae87c8954
3 changed files with 10 additions and 10 deletions
|
@ -58,13 +58,6 @@ class calendar extends rcube_plugin
|
||||||
'calendar_time_indicator' => true,
|
'calendar_time_indicator' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
private $default_categories = array(
|
|
||||||
'Personal' => 'c0c0c0',
|
|
||||||
'Work' => 'ff0000',
|
|
||||||
'Family' => '00ff00',
|
|
||||||
'Holiday' => 'ff6600',
|
|
||||||
);
|
|
||||||
|
|
||||||
private $ics_parts = array();
|
private $ics_parts = array();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,13 @@ abstract class calendar_driver
|
||||||
public $alarm_absolute = true;
|
public $alarm_absolute = true;
|
||||||
public $last_error;
|
public $last_error;
|
||||||
|
|
||||||
|
protected $default_categories = array(
|
||||||
|
'Personal' => 'c0c0c0',
|
||||||
|
'Work' => 'ff0000',
|
||||||
|
'Family' => '00ff00',
|
||||||
|
'Holiday' => 'ff6600',
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of available calendars from this source
|
* Get a list of available calendars from this source
|
||||||
*
|
*
|
||||||
|
@ -328,7 +335,7 @@ abstract class calendar_driver
|
||||||
public function list_categories()
|
public function list_categories()
|
||||||
{
|
{
|
||||||
$rcmail = rcube::get_instance();
|
$rcmail = rcube::get_instance();
|
||||||
return $rcmail->config->get('calendar_categories', array());
|
return $rcmail->config->get('calendar_categories', $this->default_categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -698,7 +698,7 @@ class kolab_driver extends calendar_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
// add new categories to user prefs
|
// add new categories to user prefs
|
||||||
$old_categories = $this->rc->config->get('calendar_categories', array());
|
$old_categories = $this->rc->config->get('calendar_categories', $this->default_categories);
|
||||||
if ($newcats = array_diff(array_map('strtolower', array_keys($categories)), array_map('strtolower', array_keys($old_categories)))) {
|
if ($newcats = array_diff(array_map('strtolower', array_keys($categories)), array_map('strtolower', array_keys($old_categories)))) {
|
||||||
foreach ($newcats as $category)
|
foreach ($newcats as $category)
|
||||||
$old_categories[$category] = ''; // no color set yet
|
$old_categories[$category] = ''; // no color set yet
|
||||||
|
@ -867,7 +867,7 @@ class kolab_driver extends calendar_driver
|
||||||
public function list_categories()
|
public function list_categories()
|
||||||
{
|
{
|
||||||
// FIXME: complete list with categories saved in config objects (KEP:12)
|
// FIXME: complete list with categories saved in config objects (KEP:12)
|
||||||
return $this->rc->config->get('calendar_categories', array());
|
return $this->rc->config->get('calendar_categories', $this->default_categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue