summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/kolab_notes/kolab_notes.php8
-rw-r--r--plugins/kolab_tags/kolab_tags.js2
-rw-r--r--plugins/kolab_tags/lib/kolab_tags_backend.php10
-rw-r--r--plugins/libkolab/lib/kolab_format_configuration.php8
-rw-r--r--plugins/libkolab/lib/kolab_storage_cache_configuration.php22
-rw-r--r--plugins/libkolab/lib/kolab_storage_config.php25
6 files changed, 49 insertions, 26 deletions
diff --git a/plugins/kolab_notes/kolab_notes.php b/plugins/kolab_notes/kolab_notes.php
index ad40a86..7553fd1 100644
--- a/plugins/kolab_notes/kolab_notes.php
+++ b/plugins/kolab_notes/kolab_notes.php
@@ -1109,11 +1109,13 @@ class kolab_notes extends rcube_plugin
{
if (!isset($this->relations)) {
$config = kolab_storage_config::get_instance();
- $filter = array(array('type', '=', 'relation'));
$default = true;
- $data_filter = array('category' => 'generic');
+ $filter = array(
+ array('type', '=', 'relation'),
+ array('category', '=', 'generic')
+ );
- $this->relations = $config->get_objects($filter, $default, $data_filter);
+ $this->relations = $config->get_objects($filter, $default);
}
if ($uid === null) {
diff --git a/plugins/kolab_tags/kolab_tags.js b/plugins/kolab_tags/kolab_tags.js
index 14d28e7..0afd78e 100644
--- a/plugins/kolab_tags/kolab_tags.js
+++ b/plugins/kolab_tags/kolab_tags.js
@@ -293,7 +293,7 @@ function tag_form_dialog(id)
if (tag) {
name_input.val(tag.name);
- color_input.val(tag.color.replace(/^#/, ''));
+ color_input.val(tag.color ? tag.color.replace(/^#/, '') : '');
}
}
diff --git a/plugins/kolab_tags/lib/kolab_tags_backend.php b/plugins/kolab_tags/lib/kolab_tags_backend.php
index 519f962..de69bae 100644
--- a/plugins/kolab_tags/lib/kolab_tags_backend.php
+++ b/plugins/kolab_tags/lib/kolab_tags_backend.php
@@ -38,14 +38,14 @@ class kolab_tags_backend
*/
public function list_tags($filter = array())
{
- $config = kolab_storage_config::get_instance();
- $default = true;
- $filter[] = array('type', '=', self::O_TYPE);
- $cat_filter = array('category' => self::O_CATEGORY);
+ $config = kolab_storage_config::get_instance();
+ $default = true;
+ $filter[] = array('type', '=', self::O_TYPE);
+ $filter[] = array('category', '=', self::O_CATEGORY);
// for performance reasons assume there will be no more than 100 tags (per-folder)
- return $config->get_objects($filter, $default, $cat_filter, 100);
+ return $config->get_objects($filter, $default, 100);
}
/**
diff --git a/plugins/libkolab/lib/kolab_format_configuration.php b/plugins/libkolab/lib/kolab_format_configuration.php
index 11f934f..6b71f3e 100644
--- a/plugins/libkolab/lib/kolab_format_configuration.php
+++ b/plugins/libkolab/lib/kolab_format_configuration.php
@@ -208,8 +208,14 @@ class kolab_format_configuration extends kolab_format
{
$tags = array();
- if ($this->data['type'] == 'dictionary') {
+ switch ($this->data['type']) {
+ case 'dictionary':
$tags = array($this->data['language']);
+ break;
+
+ case 'relation':
+ $tags = array('category:' . $this->data['category']);
+ break;
}
return $tags;
diff --git a/plugins/libkolab/lib/kolab_storage_cache_configuration.php b/plugins/libkolab/lib/kolab_storage_cache_configuration.php
index 8380aa8..97315da 100644
--- a/plugins/libkolab/lib/kolab_storage_cache_configuration.php
+++ b/plugins/libkolab/lib/kolab_storage_cache_configuration.php
@@ -37,4 +37,24 @@ class kolab_storage_cache_configuration extends kolab_storage_cache
return $sql_data;
}
-} \ No newline at end of file
+
+ /**
+ * Helper method to compose a valid SQL query from pseudo filter triplets
+ */
+ protected function _sql_where($query)
+ {
+ if (is_array($query)) {
+ foreach ($query as $idx => $param) {
+ // convert category filter
+ if ($param[0] == 'category') {
+ $param[2] = array_map(function($n) { return 'category:' . $n; }, (array) $param[2]);
+
+ $query[$idx][0] = 'tags';
+ $query[$idx][2] = count($param[2]) > 1 ? $param[2] : $param[2][0];
+ }
+ }
+ }
+
+ return parent::_sql_where($query);
+ }
+}
diff --git a/plugins/libkolab/lib/kolab_storage_config.php b/plugins/libkolab/lib/kolab_storage_config.php
index a80cf46..beaa928 100644
--- a/plugins/libkolab/lib/kolab_storage_config.php
+++ b/plugins/libkolab/lib/kolab_storage_config.php
@@ -103,14 +103,13 @@ class kolab_storage_config
/**
* Get configuration objects
*
- * @param array $filter Search filter
- * @param bool $default Enable to get objects only from default folder
- * @param array $data_filter Additional object data filter
- * @param int $limit Max. number of records (per-folder)
+ * @param array $filter Search filter
+ * @param bool $default Enable to get objects only from default folder
+ * @param int $limit Max. number of records (per-folder)
*
* @return array List of objects
*/
- public function get_objects($filter = array(), $default = false, $data_filter = array(), $limit = 0)
+ public function get_objects($filter = array(), $default = false, $limit = 0)
{
$list = array();
@@ -126,12 +125,6 @@ class kolab_storage_config
}
foreach ($folder->select($filter) as $object) {
- foreach ($data_filter as $key => $val) {
- if ($object[$key] != $val) {
- continue 2;
- }
- }
-
$list[] = $object;
}
}
@@ -624,11 +617,13 @@ class kolab_storage_config
public function get_tags($uid = '*')
{
if (!isset($this->tags)) {
- $filter = array(array('type', '=', 'relation'));
- $default = true;
- $data_filter = array('category' => 'tag');
+ $default = true;
+ $filter = array(
+ array('type', '=', 'relation'),
+ array('category', '=', 'tag')
+ );
- $this->tags = $this->get_objects($filter, $default, $data_filter);
+ $this->tags = $this->get_objects($filter, $default);
}
if ($uid === '*') {