diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php index 6af8f0d9..c48b63d5 100644 --- a/plugins/libkolab/lib/kolab_format_event.php +++ b/plugins/libkolab/lib/kolab_format_event.php @@ -27,8 +27,6 @@ class kolab_format_event extends kolab_format_xcal protected $read_func = 'kolabformat::readEvent'; protected $write_func = 'kolabformat::writeEvent'; - public static $fulltext_cols = array('title', 'description', 'location', 'attendees:name', 'attendees:email'); - private $kolab2_rolemap = array( 'required' => 'REQ-PARTICIPANT', 'optional' => 'OPT-PARTICIPANT', @@ -181,34 +179,6 @@ class kolab_format_event extends kolab_format_xcal return $tags; } - /** - * Callback for kolab_storage_cache to get words to index for fulltext search - * - * @return array List of words to save in cache - */ - public function get_words() - { - $data = ''; - foreach (self::$fulltext_cols as $colname) { - list($col, $field) = explode(':', $colname); - - if ($field) { - $a = array(); - foreach ((array)$this->data[$col] as $attr) - $a[] = $attr[$field]; - $val = join(' ', $a); - } - else { - $val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : $this->data[$col]; - } - - if (strlen($val)) - $data .= $val . ' '; - } - - return array_unique(rcube_utils::normalize_string($data, true)); - } - /** * Load data from old Kolab2 format */ diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php index d7bb275e..477f1b2d 100644 --- a/plugins/libkolab/lib/kolab_format_task.php +++ b/plugins/libkolab/lib/kolab_format_task.php @@ -123,4 +123,24 @@ class kolab_format_task extends kolab_format_xcal $this->data = $object; } + /** + * Callback for kolab_storage_cache to get object specific tags to cache + * + * @return array List of tags to save in cache + */ + public function get_tags() + { + $tags = array(); + + if ($this->data['status'] == 'COMPLETED' || $this->data['complete'] == 100) + $tags[] = 'complete'; + + if ($this->data['priority'] == 1) + $tags[] = 'flagged'; + + if (!empty($this->data['alarms'])) + $tags[] = 'x-has-alarms'; + + return $tags; + } } diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php index 19d29215..db2ad3a6 100644 --- a/plugins/libkolab/lib/kolab_format_xcal.php +++ b/plugins/libkolab/lib/kolab_format_xcal.php @@ -28,6 +28,8 @@ abstract class kolab_format_xcal extends kolab_format { public $CTYPE = 'application/calendar+xml'; + public static $fulltext_cols = array('title', 'description', 'location', 'attendees:name', 'attendees:email'); + protected $sensitivity_map = array( 'public' => kolabformat::ClassPublic, 'private' => kolabformat::ClassPrivate, @@ -358,4 +360,32 @@ abstract class kolab_format_xcal extends kolab_format $this->obj->setAlarms($valarms); } + /** + * Callback for kolab_storage_cache to get words to index for fulltext search + * + * @return array List of words to save in cache + */ + public function get_words() + { + $data = ''; + foreach (self::$fulltext_cols as $colname) { + list($col, $field) = explode(':', $colname); + + if ($field) { + $a = array(); + foreach ((array)$this->data[$col] as $attr) + $a[] = $attr[$field]; + $val = join(' ', $a); + } + else { + $val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : $this->data[$col]; + } + + if (strlen($val)) + $data .= $val . ' '; + } + + return array_unique(rcube_utils::normalize_string($data, true)); + } + } \ No newline at end of file diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php index d1ec64e4..9d4b37e6 100644 --- a/plugins/libkolab/lib/kolab_storage_cache.php +++ b/plugins/libkolab/lib/kolab_storage_cache.php @@ -383,8 +383,9 @@ class kolab_storage_cache $qvalue = '(' . join(',', array_map(array($this->db, 'quote'), $param[2])) . ')'; $param[1] = 'IN'; } - else if ($param[1] == '~' || $param[1] == 'LIKE') { - $param[1] = 'LIKE'; + else if ($param[1] == '~' || $param[1] == 'LIKE' || $param[1] == '!~' || $param[1] == '!LIKE') { + $not = ($param[1] == '!~' || $param[1] == '!LIKE') ? 'NOT ' : ''; + $param[1] = $not . 'LIKE'; $qvalue = $this->db->quote('%'.preg_replace('/(^\^|\$$)/', ' ', $param[2]).'%'); } else if ($param[0] == 'tags') {