Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab
This commit is contained in:
commit
164fae8387
3 changed files with 21 additions and 9 deletions
|
@ -1205,7 +1205,8 @@ class calendar extends rcube_plugin
|
||||||
'_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar
|
'_id' => $event['calendar'] . ':' . $event['id'], // unique identifier for fullcalendar
|
||||||
'start' => $this->lib->adjust_timezone($event['start'])->format('c'),
|
'start' => $this->lib->adjust_timezone($event['start'])->format('c'),
|
||||||
'end' => $this->lib->adjust_timezone($event['end'])->format('c'),
|
'end' => $this->lib->adjust_timezone($event['end'])->format('c'),
|
||||||
'changed' => $this->lib->adjust_timezone($event['changed'])->format('c'),
|
// 'changed' might be empty for event recurrences (Bug #2185)
|
||||||
|
'changed' => $event['changed'] ? $this->lib->adjust_timezone($event['changed'])->format('c') : null,
|
||||||
'title' => strval($event['title']),
|
'title' => strval($event['title']),
|
||||||
'description' => strval($event['description']),
|
'description' => strval($event['description']),
|
||||||
'location' => strval($event['location']),
|
'location' => strval($event['location']),
|
||||||
|
|
|
@ -120,7 +120,10 @@ class libcalendaring extends rcube_plugin
|
||||||
else if (is_string($dt))
|
else if (is_string($dt))
|
||||||
$dt = new DateTime($dt);
|
$dt = new DateTime($dt);
|
||||||
|
|
||||||
$dt->setTimezone($this->timezone);
|
if ($dt instanceof DateTime) {
|
||||||
|
$dt->setTimezone($this->timezone);
|
||||||
|
}
|
||||||
|
|
||||||
return $dt;
|
return $dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,6 @@ class libvcalendar
|
||||||
return $this->import_from_vobject($vobject);
|
return $this->import_from_vobject($vobject);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
throw $e;
|
|
||||||
rcube::raise_error(array(
|
rcube::raise_error(array(
|
||||||
'code' => 600, 'type' => 'php',
|
'code' => 600, 'type' => 'php',
|
||||||
'file' => __FILE__, 'line' => __LINE__,
|
'file' => __FILE__, 'line' => __LINE__,
|
||||||
|
@ -206,19 +205,28 @@ class libvcalendar
|
||||||
$event = array(
|
$event = array(
|
||||||
'uid' => strval($ve->UID),
|
'uid' => strval($ve->UID),
|
||||||
'title' => strval($ve->SUMMARY),
|
'title' => strval($ve->SUMMARY),
|
||||||
'created' => $ve->CREATED ? $ve->CREATED->getDateTime() : null,
|
|
||||||
'changed' => null,
|
|
||||||
'_type' => $ve->name == 'VTODO' ? 'task' : 'event',
|
'_type' => $ve->name == 'VTODO' ? 'task' : 'event',
|
||||||
// set defaults
|
// set defaults
|
||||||
'priority' => 0,
|
'priority' => 0,
|
||||||
'attendees' => array(),
|
'attendees' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($ve->{'LAST-MODIFIED'}) {
|
// Catch possible exceptions when date is invalid (Bug #2144)
|
||||||
$event['changed'] = $ve->{'LAST-MODIFIED'}->getDateTime();
|
// We can skip these fields, they aren't critical
|
||||||
|
if ($ve->CREATED) {
|
||||||
|
try {
|
||||||
|
$event['created'] = $ve->CREATED->getDateTime();
|
||||||
|
} catch (Exception $e) {};
|
||||||
}
|
}
|
||||||
else if ($ve->DTSTAMP) {
|
if ($ve->{'LAST-MODIFIED'}) {
|
||||||
$event['changed'] = $ve->DTSTAMP->getDateTime();
|
try {
|
||||||
|
$event['changed'] = $ve->{'LAST-MODIFIED'}->getDateTime();
|
||||||
|
} catch (Exception $e) {};
|
||||||
|
}
|
||||||
|
if (!$event['changed'] && $ve->DTSTAMP) {
|
||||||
|
try {
|
||||||
|
$event['changed'] = $ve->DTSTAMP->getDateTime();
|
||||||
|
} catch (Exception $e) {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// map other attributes to internal fields
|
// map other attributes to internal fields
|
||||||
|
|
Loading…
Add table
Reference in a new issue