Branch 'dev/recurring-invitations' - 2 commits - plugins/calendar plugins/libkolab
Thomas Brüderli
bruederli at kolabsys.com
Sun Feb 15 17:21:34 CET 2015
plugins/calendar/calendar.php | 17 ++++++++++++++++-
plugins/calendar/drivers/kolab/kolab_driver.php | 3 ++-
plugins/libkolab/lib/kolab_format_event.php | 12 +++---------
plugins/libkolab/lib/kolab_format_task.php | 19 ++++++++++---------
plugins/libkolab/lib/kolab_format_xcal.php | 14 +++++++++-----
5 files changed, 40 insertions(+), 25 deletions(-)
New commits:
commit 26381f82a775da9f8876fbcd6a189224d70e12df
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Sun Feb 15 17:21:30 2015 +0100
Send iTip notifications for main event of savemode is 'all'
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 880086d..f61b681 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -846,9 +846,16 @@ class calendar extends rcube_plugin
$event['_notify'] = 1;
// read old event data in order to find changes
- if (($event['_notify'] || $event['_decline']) && $action != 'new')
+ if (($event['_notify'] || $event['_decline']) && $action != 'new') {
$old = $this->driver->get_event($event);
+ // load main event when savemode is 'all'
+ if ($event['_savemode'] == 'all' && $old['recurrence_id']) {
+ $old['id'] = $old['recurrence_id'];
+ $old = $this->driver->get_event($old);
+ }
+ }
+
switch ($action) {
case "new":
// create UID for new event
@@ -1128,9 +1135,17 @@ class calendar extends rcube_plugin
// send out notifications
if ($success && $event['_notify'] && ($event['attendees'] || $old['attendees'])) {
+ $_savemode = $event['_savemode'];
+
// make sure we have the complete record
$event = $action == 'remove' ? $old : $this->driver->get_event($event);
+ // send notification for the main event when savemode is 'all'
+ if ($_savemode == 'all' && $event['recurrence_id']) {
+ $event['id'] = $event['recurrence_id'];
+ $event = $this->driver->get_event($event);
+ }
+
// only notify if data really changed (TODO: do diff check on client already)
if (!$old || $action == 'remove' || self::event_diff($event, $old)) {
$sent = $this->notify_attendees($event, $old, $action, $event['_comment']);
commit d564e23aa345ce67c7c8cabca1a324628a94fcba
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Sun Feb 15 17:10:22 2015 +0100
Use the right list of properties relevenat for scheduling (follow-up of commit 12591358). Static vars don't work here as intended
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index 815f51e..d4a3436 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -1041,7 +1041,8 @@ class kolab_driver extends calendar_driver
}
// iterate through the list of properties considered 'significant' for scheduling
- $reschedule = kolab_format_event::check_rescheduling($event, $old);
+ $kolab_event = $old['_formatobj'] ?: new kolab_format_event();
+ $reschedule = $kolab_event->check_rescheduling($event, $old);
// reset all attendee status to needs-action (#4360)
if ($update && $reschedule && is_array($event['attendees'])) {
diff --git a/plugins/libkolab/lib/kolab_format_event.php b/plugins/libkolab/lib/kolab_format_event.php
index f3c52df..fe10f9d 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -44,6 +44,9 @@ class kolab_format_event extends kolab_format_xcal
$this->obj = $data;
$this->loaded = true;
}
+
+ // copy static property overriden by this class
+ $this->_scheduling_properties = self::$scheduling_properties;
}
/**
@@ -275,13 +278,4 @@ class kolab_format_event extends kolab_format_xcal
return $exception;
}
- /**
- * Identify changes considered relevant for scheduling
- *
- * @see kolab_format_xcal::check_rescheduling()
- */
- public static function check_rescheduling($object, $old, $checks = null)
- {
- return parent::check_rescheduling($object, $old, $checks ?: self::$scheduling_properties);
- }
}
diff --git a/plugins/libkolab/lib/kolab_format_task.php b/plugins/libkolab/lib/kolab_format_task.php
index 2c0cda5..d3ddfe9 100644
--- a/plugins/libkolab/lib/kolab_format_task.php
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -32,6 +32,16 @@ class kolab_format_task extends kolab_format_xcal
protected $read_func = 'readTodo';
protected $write_func = 'writeTodo';
+ /**
+ * Default constructor
+ */
+ function __construct($data = null, $version = 3.0)
+ {
+ parent::__construct(is_string($data) ? $data : null, $version);
+
+ // copy static property overriden by this class
+ $this->_scheduling_properties = self::$scheduling_properties;
+ }
/**
* Set properties to the kolabformat object
@@ -127,13 +137,4 @@ class kolab_format_task extends kolab_format_xcal
return $tags;
}
- /**
- * Identify changes considered relevant for scheduling
- *
- * @see kolab_format_xcal::check_rescheduling()
- */
- public static function check_rescheduling($object, $old, $checks = null)
- {
- return parent::check_rescheduling($object, $old, $checks ?: self::$scheduling_properties);
- }
}
diff --git a/plugins/libkolab/lib/kolab_format_xcal.php b/plugins/libkolab/lib/kolab_format_xcal.php
index 8d751a6..6d49ad1 100644
--- a/plugins/libkolab/lib/kolab_format_xcal.php
+++ b/plugins/libkolab/lib/kolab_format_xcal.php
@@ -32,6 +32,8 @@ abstract class kolab_format_xcal extends kolab_format
public static $scheduling_properties = array('start', 'end', 'location');
+ protected $_scheduling_properties = null;
+
protected $sensitivity_map = array(
'public' => kolabformat::ClassPublic,
'private' => kolabformat::ClassPrivate,
@@ -317,11 +319,10 @@ abstract class kolab_format_xcal extends kolab_format
}
else {
$object['sequence'] = $old_sequence;
- $old = $this->data['uid'] ? $this->data : $this->to_array();
// increment sequence when updating properties relevant for scheduling.
// RFC 5545: "It is incremented [...] each time the Organizer makes a significant revision to the calendar component."
- if (self::check_rescheduling($object, $old)) {
+ if ($this->check_rescheduling($object)) {
$object['sequence']++;
}
}
@@ -634,15 +635,18 @@ abstract class kolab_format_xcal extends kolab_format
*
* @param array Hash array with NEW object properties
* @param array Hash array with OLD object properties
- * @param array List of object properties to check for changes
*
* @return boolean True if changes affect scheduling, False otherwise
*/
- public static function check_rescheduling($object, $old, $checks = null)
+ public function check_rescheduling($object, $old = null)
{
$reschedule = false;
- foreach ($checks ?: self::$scheduling_properties as $prop) {
+ if (!is_array($old)) {
+ $old = $this->data['uid'] ? $this->data : $this->to_array();
+ }
+
+ foreach ($this->_scheduling_properties ?: self::$scheduling_properties as $prop) {
$a = $old[$prop];
$b = $object[$prop];
if ($object['allday'] && ($prop == 'start' || $prop == 'end') && $a instanceof DateTime && $b instanceof DateTime) {
More information about the commits
mailing list