summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-10-11 01:18:28 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-10-11 01:18:28 (GMT)
commit8d13292b3833a4bff27865377fae75ae8905d015 (patch)
treed5433c89c07537a2954c00d9e57ae620c9637312
parent1e0b0cdf9d428de6d8c12e673b72cdcdb0aa79bd (diff)
parent6c8d7d40005ad0f55251a3b81bd529e166c77769 (diff)
downloadroundcubemail-plugins-kolab-8d13292b3833a4bff27865377fae75ae8905d015.tar.gz
Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab
-rw-r--r--plugins/libkolab/lib/kolab_format.php2
-rw-r--r--plugins/libkolab/lib/kolab_format_configuration.php38
2 files changed, 35 insertions, 5 deletions
diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index 3a0133a..8c6b1d4 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -174,7 +174,7 @@ abstract class kolab_format
if (!self::supports($version))
return PEAR::raiseError("No support for Kolab format version " . $version);
- $type = preg_replace('/configuration\.[a-z.]+$/', 'configuration', $type);
+ $type = preg_replace('/configuration\.[a-z._]+$/', 'configuration', $type);
$suffix = preg_replace('/[^a-z]+/', '', $type);
$classname = 'kolab_format_' . $suffix;
if (class_exists($classname))
diff --git a/plugins/libkolab/lib/kolab_format_configuration.php b/plugins/libkolab/lib/kolab_format_configuration.php
index 4506ed3..24bc8de 100644
--- a/plugins/libkolab/lib/kolab_format_configuration.php
+++ b/plugins/libkolab/lib/kolab_format_configuration.php
@@ -32,12 +32,14 @@ class kolab_format_configuration extends kolab_format
protected $write_func = 'writeConfiguration';
private $type_map = array(
- 'category' => Configuration::TypeCategoryColor,
- 'dictionary' => Configuration::TypeDictionary,
- 'relation' => Configuration::TypeRelation,
- 'snippet' => Configuration::TypeSnippet,
+ 'category' => Configuration::TypeCategoryColor,
+ 'dictionary' => Configuration::TypeDictionary,
+ 'file_driver' => Configuration::TypeFileDriver,
+ 'relation' => Configuration::TypeRelation,
+ 'snippet' => Configuration::TypeSnippet,
);
+ private $driver_settings_fields = array('host', 'port', 'username', 'password');
/**
* Set properties to the kolabformat object
@@ -63,6 +65,21 @@ class kolab_format_configuration extends kolab_format
$this->obj = new Configuration($categories);
break;
+ case 'file_driver':
+ $driver = new FileDriver($object['driver'], $object['title']);
+
+ $driver->setEnabled((bool) $object['enabled']);
+
+ foreach ($this->driver_settings_fields as $field) {
+ $value = $object[$field];
+ if ($value !== null) {
+ $driver->{'set' . ucfirst($field)}($value);
+ }
+ }
+
+ $this->obj = new Configuration($driver);
+ break;
+
case 'relation':
$relation = new Relation(strval($object['name']), strval($object['category']));
@@ -157,6 +174,19 @@ class kolab_format_configuration extends kolab_format
// TODO: implement this
break;
+ case 'file_driver':
+ $driver = $this->obj->file_driver();
+
+ $object['driver'] = $driver->driver();
+ $object['title'] = $driver->title();
+ $object['enabled'] = $driver->enabled();
+
+ foreach ($this->driver_settings_fields as $field) {
+ $object[$field] = $driver->{$field}();
+ }
+
+ break;
+
case 'relation':
$relation = $this->obj->relation();