Projects
Kolab:3.4
roundcubemail-plugins-kolab
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 56
View file
roundcubemail-plugins-kolab.spec
Changed
@@ -24,14 +24,14 @@ Name: roundcubemail-plugins-kolab Version: 3.2 -Release: 0.6.dev20140820.gitf75cc475%{?dist} +Release: 0.6.dev20140821.git41929675%{?dist} Summary: Kolab Groupware plugins for Roundcube Webmail Group: Applications/Internet License: AGPLv3+ and GPLv3+ URL: http://www.kolab.org -# From git f554c201754ebc44229c74e6d3d11ef0c0059190 +# From git 419296757aad4da3499763a775d42688c3fced70 Source0: http://git.kolab.org/%{name}/snapshot/%{name}-%{version}.tar.gz Source1: kolab_logo.png
View file
debian.changelog
Changed
@@ -1,3 +1,9 @@ +roundcubemail-plugins-kolab (1:3.2~dev20140821-0~kolab1) unstable; urgency=low + + * New git master head snapshot (419296757aad4da3499763a775d42688c3fced70) + + -- Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> Thu, 21 Aug 2014 18:41:13 +0200 + roundcubemail-plugins-kolab (1:3.2~dev20140820-0~kolab1) unstable; urgency=low * New git master head snapshot (f554c201754ebc44229c74e6d3d11ef0c0059190)
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/kolab_notes/kolab_notes.php
Changed
@@ -406,10 +406,16 @@ public function notes_fetch() { $search = rcube_utils::get_input_value('_q', RCUBE_INPUT_GPC, true); - $list = rcube_utils::get_input_value('_list', RCUBE_INPUT_GPC); + $list = rcube_utils::get_input_value('_list', RCUBE_INPUT_GPC); $data = $this->notes_data($this->list_notes($list, $search), $tags); - $this->rc->output->command('plugin.data_ready', array('list' => $list, 'search' => $search, 'data' => $data, 'tags' => array_values($tags))); + + $this->rc->output->command('plugin.data_ready', array( + 'list' => $list, + 'search' => $search, + 'data' => $data, + 'tags' => array_values($tags) + )); } /** @@ -417,18 +423,14 @@ */ protected function notes_data($records, &$tags) { - $tags = array(); + $config = kolab_storage_config::get_instance(); + $tags = $config->apply_tags($records); foreach ($records as $i => $rec) { unset($records[$i]['description']); $this->_client_encode($records[$i]); - - foreach ((array)$rec['categories'] as $tag) { - $tags[] = $tag; - } } - $tags = array_unique($tags); return $records; } @@ -460,8 +462,7 @@ $matches = 0; $contents = mb_strtolower( $record['title'] . - ($this->is_html($record) ? strip_tags($record['description']) : $record['description']) . - join(' ', (array)$record['categories']) + ($this->is_html($record) ? strip_tags($record['description']) : $record['description']) ); foreach ($words as $word) { if (mb_strpos($contents, $word) !== false) { @@ -519,10 +520,12 @@ return $this->cache[$key]; } + $result = false; + $this->_read_lists(); if ($list_id) { if ($folder = $this->get_folder($list_id)) { - return $folder->get_object($uid); + $result = $folder->get_object($uid); } } // iterate over all calendar folders and search for the event ID @@ -530,12 +533,17 @@ foreach ($this->folders as $list_id => $folder) { if ($result = $folder->get_object($uid)) { $result['list'] = $list_id; - return $result; + break; } } } - return false; + if ($result) { + // get note tags + $result['tags'] = $this->get_tags($result['uid']); + } + + return $result; } /** @@ -576,7 +584,7 @@ public function note_action() { $action = rcube_utils::get_input_value('_do', RCUBE_INPUT_POST); - $note = rcube_utils::get_input_value('_data', RCUBE_INPUT_POST, true); + $note = rcube_utils::get_input_value('_data', RCUBE_INPUT_POST, true); $success = false; switch ($action) { @@ -665,9 +673,12 @@ // generate new note object from input $object = $this->_write_preprocess($note, $old); - // email links are handled separately + // email links and tags are handled separately $links = $object['links']; + $tags = $object['tags']; + unset($object['links']); + unset($object['tags']); $saved = $folder->save($object, 'note', $note['uid']); @@ -682,9 +693,12 @@ else { // save links in configuration.relation object $this->save_links($object['uid'], $links); + // save tags in configuration.relation object + $this->save_tags($object['uid'], $tags); $note = $object; $note['list'] = $list_id; + $note['tags'] = (array) $tags; // cache this in memory for later read $key = $list_id . ':' . $note['uid']; @@ -700,7 +714,8 @@ function move_note($note, $list_id) { $this->_read_lists(); - $tofolder = $this->get_folder($list_id); + + $tofolder = $this->get_folder($list_id); $fromfolder = $this->get_folder($note['list']); if ($fromfolder && $tofolder) { @@ -730,6 +745,7 @@ if ($status) { $this->save_links($note['uid'], null); + $this->save_tags($note['uid'], null); } return $status; @@ -740,8 +756,8 @@ */ public function list_action() { - $action = rcube_utils::get_input_value('_do', RCUBE_INPUT_GPC); - $list = rcube_utils::get_input_value('_list', RCUBE_INPUT_GPC, true); + $action = rcube_utils::get_input_value('_do', RCUBE_INPUT_GPC); + $list = rcube_utils::get_input_value('_list', RCUBE_INPUT_GPC, true); $success = $update_cmd = false; if (empty($action)) { @@ -1038,6 +1054,18 @@ } /** + * Get note tags + */ + private function get_tags($uid) + { + $config = kolab_storage_config::get_instance(); + $tags = $config->get_tags($uid); + $tags = array_map(function($v) { return $v['name']; }, $tags); + + return $tags; + } + + /** * Find notes assigned to specified message */ private function get_message_notes($message, $folder) @@ -1149,6 +1177,15 @@ } /** + * Update note tags + */ + private function save_tags($uid, $tags) + { + $config = kolab_storage_config::get_instance(); + $config->save_tags($uid, $tags); + } + + /** * Process the given note data (submitted by the client) before saving it */ private function _write_preprocess($note, $old = array()) @@ -1192,8 +1229,8 @@ } // make list of categories unique - if (is_array($object['categories'])) { - $object['categories'] = array_unique(array_filter($object['categories'])); + if (is_array($object['tags'])) { + $object['tags'] = array_unique(array_filter($object['tags'])); } unset($object['list'], $object['tempid'], $object['created'], $object['changed'], $object['created_'], $object['changed_']);
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/kolab_notes/notes.js
Changed
@@ -325,7 +325,7 @@ uid: null, title: rcmail.gettext('newnote','kolab_notes'), description: '', - categories: [], + tags: [], created: rcmail.gettext('now', 'kolab_notes'), changed: rcmail.gettext('now', 'kolab_notes') }, rcmail.env.kolab_notes_template || {}); @@ -417,7 +417,7 @@ uid: null, title: rcmail.gettext('newnote','kolab_notes'), description: '', - categories: [], + tags: [], created: rcmail.gettext('now', 'kolab_notes'), changed: rcmail.gettext('now', 'kolab_notes') } @@ -687,9 +687,9 @@ for (var id in noteslist.rows) { tr = noteslist.rows[id].obj; note = notesdata[id]; - match = note.categories && note.categories.length; + match = note.tags && note.tags.length; for (var i=0; match && note && i < tagsfilter.length; i++) { - if ($.inArray(tagsfilter[i], note.categories) < 0) + if ($.inArray(tagsfilter[i], note.tags) < 0) match = false; } @@ -787,7 +787,7 @@ // tag-edit line var tagline = $('.tagline', rcmail.gui_objects.noteviewtitle).empty()[readonly?'addClass':'removeClass']('disabled').show(); - $.each(typeof data.categories == 'object' && data.categories.length ? data.categories : [''], function(i,val){ + $.each(typeof data.tags == 'object' && data.tags.length ? data.tags : [''], function(i,val) { $('<input>') .attr('name', 'tags[]') .attr('tabindex', '0') @@ -796,7 +796,7 @@ .appendTo(tagline); }); - if (!data.categories || !data.categories.length) { + if (!data.tags || !data.tags.length) { $('<span>').addClass('placeholder') .html(rcmail.gettext('notags', 'kolab_notes')) .appendTo(tagline) @@ -941,7 +941,7 @@ printwin.document.title = data.title; $('#notetitle', printwin.document).html(Q(data.title)); $('#notebody', printwin.document).html(data.description); - $('#notetags', printwin.document).html('<span class="tag">' + data.categories.join('</span><span class="tag">') + '</span>'); + $('#notetags', printwin.document).html('<span class="tag">' + data.tags.join('</span><span class="tag">') + '</span>'); $('#notecreated', printwin.document).html(Q(me.selected_note.created)); $('#notechanged', printwin.document).html(Q(me.selected_note.changed)); printwin.print(); @@ -1026,8 +1026,8 @@ if (typeof counts == 'undefined') { counts = {}; $.each(notesdata, function(id, rec){ - for (var t, j=0; rec && rec.categories && j < rec.categories.length; j++) { - t = rec.categories[j]; + for (var t, j=0; rec && rec.tags && j < rec.tags.length; j++) { + t = rec.tags[j]; if (typeof counts[t] == 'undefined') counts[t] = 0; counts[t]++; @@ -1064,10 +1064,10 @@ if (is_new || me.selected_note && data.id == me.selected_note.id) { render_note(data); - render_tagslist(data.categories || []); + render_tagslist(data.tags || []); } - else if (data.categories) { - render_tagslist(data.categories); + else if (data.tags) { + render_tagslist(data.tags); } // add list item on top @@ -1153,18 +1153,18 @@ description: editor ? editor.getContent({ format:'html' }).replace(/^<p><\/p>/, '') : $('#notecontent').val(), list: listselect.length ? listselect.val() : me.selected_note.list || me.selected_list, uid: me.selected_note.uid, - categories: [] + tags: [] }; // collect tags $('.tagedit-list input[type="hidden"]', rcmail.gui_objects.noteviewtitle).each(function(i, elem){ if (elem.value) - savedata.categories.push(elem.value); + savedata.tags.push(elem.value); }); // including the "pending" one in the text box var newtag = $('#tagedit-input').val(); if (newtag != '') { - savedata.categories.push(newtag); + savedata.tags.push(newtag); } return savedata; @@ -1183,7 +1183,7 @@ return savedata.title != me.selected_note.title || savedata.description != me.selected_note.description - || savedata.categories.join(',') != (me.selected_note.categories || []).join(',') + || savedata.tags.join(',') != (me.selected_note.tags || []).join(',') || savedata.list != me.selected_note.list; } @@ -1367,7 +1367,7 @@ drop_rec = notesdata[drop_id]; // target already has this tag assigned - if (!drop_rec || (drop_rec.categories && $.inArray(tag, drop_rec.categories) >= 0)) { + if (!drop_rec || (drop_rec.tags && $.inArray(tag, drop_rec.tags) >= 0)) { return false; } @@ -1387,9 +1387,9 @@ if (savedata.id) delete savedata.id; if (savedata.html) delete savedata.html; - if (!savedata.categories) - savedata.categories = []; - savedata.categories.push(tag); + if (!savedata.tags) + savedata.tags = []; + savedata.tags.push(tag); rcmail.lock_form(rcmail.gui_objects.noteseditform, true); saving_lock = rcmail.set_busy(true, 'kolab_notes.savingdata');
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/libkolab/lib/kolab_format.php
Changed
@@ -45,7 +45,7 @@ protected $version = '3.0'; const KTYPE_PREFIX = 'application/x-vnd.kolab.'; - const PRODUCT_ID = 'Roundcube-libkolab-0.9'; + const PRODUCT_ID = 'Roundcube-libkolab-1.1'; /** * Factory method to instantiate a kolab_format object of the given type and version
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/libkolab/lib/kolab_storage_cache.php
Changed
@@ -491,7 +491,7 @@ else if ($fetchall && ($object = $this->_unserialize($sql_arr))) { $result[] = $object; } - else { + else if (!$fetchall) { // only add msguid to dataset index $result[] = $sql_arr; }
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/libkolab/lib/kolab_storage_config.php
Changed
@@ -515,4 +515,135 @@ return $result; } + + /** + * Assign tags to kolab objects + * + * @param array $records List of kolab objects + * + * @return array List of tags + */ + public function apply_tags(&$records) + { + // first convert categories into tags + foreach ($records as $i => $rec) { + if (!empty($rec['categories'])) { + $folder = new kolab_storage_folder($rec['_mailbox']); + if ($object = $folder->get_object($rec['uid'])) { + $tags = $rec['categories']; + + unset($object['categories']); + unset($records[$i]['categories']); + + $this->save_tags($rec['uid'], $tags); + $folder->save($object, $rec['_type'], $rec['uid']); + } + } + } + + $tags = array(); + + // assign tags to objects + foreach ($this->get_tags() as $tag) { + foreach ($records as $idx => $rec) { + $uid = self::build_member_url($rec['uid']); + if (in_array($uid, (array) $tag['members'])) { + $records[$idx]['tags'][] = $tag['name']; + } + } + + $tags[] = $tag['name']; + } + + $tags = array_unique($tags); + + return $tags; + } + + /** + * Update object tags + * + * @param string $uid Kolab object UID + * @param array $tags List of tag names + */ + public function save_tags($uid, $tags) + { + $url = self::build_member_url($uid); + $relations = $this->get_tags(); + + foreach ($relations as $idx => $relation) { + $selected = !empty($tags) && in_array($relation['name'], $tags); + $found = !empty($relation['members']) && in_array($url, $relation['members']); + $update = false; + + // remove member from the relation + if ($found && !$selected) { + $relation['members'] = array_diff($relation['members'], (array) $url); + $update = true; + } + // add member to the relation + else if (!$found && $selected) { + $relation['members'][] = $url; + $update = true; + } + + if ($update) { + if ($this->save($relation, 'relation')) { + $this->tags[$idx] = $relation; // update in-memory cache + } + } + + if ($selected) { + $tags = array_diff($tags, (array)$relation['name']); + } + } + + // create new relations + if (!empty($tags)) { + foreach ($tags as $tag) { + $relation = array( + 'name' => $tag, + 'members' => (array) $url, + 'category' => 'tag', + ); + + if ($this->save($relation, 'relation')) { + $this->tags[] = $relation; // update in-memory cache + } + } + } + } + + /** + * Get tags (all or referring to specified object) + * + * @param string $uid Optional object UID + * + * @return array List of Relation objects + */ + public function get_tags($uid = '*') + { + if (!isset($this->tags)) { + $filter = array(array('type', '=', 'relation')); + $default = true; + $data_filter = array('category' => 'tag'); + + $this->tags = $this->get_objects($filter, $default, $data_filter); + } + + if ($uid === '*') { + return $this->tags; + } + + $result = array(); + $search = self::build_member_url($uid); + + foreach ($this->tags as $tag) { + if (in_array($search, (array) $tag['members'])) { + $result[] = $tag; + } + } + + return $result; + } }
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
Changed
@@ -809,6 +809,17 @@ $task['alarms'] = $record['alarms']; } + if (!empty($task['attendees'])) { + foreach ((array)$task['attendees'] as $i => $attendee) { + if (is_array($attendee['delegated-from'])) { + $task['attendees'][$i]['delegated-from'] = join(', ', $attendee['delegated-from']); + } + if (is_array($attendee['delegated-to'])) { + $task['attendees'][$i]['delegated-to'] = join(', ', $attendee['delegated-to']); + } + } + } + if (!empty($record['_attachments'])) { foreach ($record['_attachments'] as $key => $attachment) { if ($attachment !== false) {
View file
roundcubemail-plugins-kolab-3.2.tar.gz/plugins/tasklist/tasklist.js
Changed
@@ -1830,7 +1830,7 @@ $('#task-rsvp .itip-reply-comment textarea').hide().val(''); if (rec.organizer && !organizer) { - $('#task-organizer').show().children('.task-text').html(task_attendee_html(rec.organizer)); + $('#task-organizer').show().children('.task-text').html(task_attendee_html($.extend(rec.organizer, { role:'ORGANIZER' }))); } }
View file
roundcubemail-plugins-kolab.dsc
Changed
@@ -2,7 +2,7 @@ Source: roundcubemail-plugins-kolab Binary: roundcubemail-plugins-kolab Architecture: all -Version: 1:3.2~dev20140820-0~kolab1 +Version: 1:3.2~dev20140821-0~kolab1 Maintainer: Christoph Wickert <wickert@kolabsys.com> Uploaders: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>, Paul Klos <kolab@klos2day.nl> Standards-Version: 3.9.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.