Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube
Resolved conflicts
This commit is contained in:
commit
641482b70f
3 changed files with 40 additions and 33 deletions
|
@ -606,8 +606,7 @@ class database_driver extends calendar_driver
|
||||||
$calendars = explode(',', $calendars);
|
$calendars = explode(',', $calendars);
|
||||||
|
|
||||||
// only allow to select from calendars of this use
|
// only allow to select from calendars of this use
|
||||||
$calendar_ids = array_intersect($calendars, array_keys($this->calendars));
|
$calendar_ids = array_map(array($this->rc->db, 'quote'), array_intersect($calendars, array_keys($this->calendars)));
|
||||||
array_walk($calendar_ids, array($this->rc->db, 'quote'));
|
|
||||||
|
|
||||||
$events = array();
|
$events = array();
|
||||||
if (!empty($calendar_ids)) {
|
if (!empty($calendar_ids)) {
|
||||||
|
@ -691,8 +690,7 @@ class database_driver extends calendar_driver
|
||||||
$calendars = explode(',', $calendars);
|
$calendars = explode(',', $calendars);
|
||||||
|
|
||||||
// only allow to select from calendars of this use
|
// only allow to select from calendars of this use
|
||||||
$calendar_ids = array_intersect($calendars, array_keys($this->calendars));
|
$calendar_ids = array_map(array($this->rc->db, 'quote'), array_intersect($calendars, array_keys($this->calendars)));
|
||||||
array_walk($calendar_ids, array($this->rc->db, 'quote'));
|
|
||||||
|
|
||||||
$alarms = array();
|
$alarms = array();
|
||||||
if (!empty($calendar_ids)) {
|
if (!empty($calendar_ids)) {
|
||||||
|
|
|
@ -258,6 +258,7 @@ class kolab_calendar
|
||||||
$old = $this->storage->getObject($event['id']);
|
$old = $this->storage->getObject($event['id']);
|
||||||
$object = array_merge($old, $this->_from_rcube_event($event));
|
$object = array_merge($old, $this->_from_rcube_event($event));
|
||||||
$saved = $this->storage->save($object, $event['id']);
|
$saved = $this->storage->save($object, $event['id']);
|
||||||
|
|
||||||
if (PEAR::isError($saved)) {
|
if (PEAR::isError($saved)) {
|
||||||
raise_error(array(
|
raise_error(array(
|
||||||
'code' => 600, 'type' => 'php',
|
'code' => 600, 'type' => 'php',
|
||||||
|
@ -269,6 +270,15 @@ class kolab_calendar
|
||||||
$updated = true;
|
$updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delete alarm settings in local database
|
||||||
|
if ($updated && ($old['alarm'] != $object['alarm'] || $old['start-date'] != $object['start-date'])) {
|
||||||
|
$query = $this->cal->rc->db->query(
|
||||||
|
"DELETE FROM kolab_alarms
|
||||||
|
WHERE event_id=?",
|
||||||
|
$event['id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $updated;
|
return $updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +401,7 @@ class kolab_calendar
|
||||||
'end' => $rec['end-date'],
|
'end' => $rec['end-date'],
|
||||||
'allday' => $allday,
|
'allday' => $allday,
|
||||||
'recurrence' => $rrule,
|
'recurrence' => $rrule,
|
||||||
|
'_alarm' => $rec['alarm'],
|
||||||
'alarms' => $alarm_value . $alarm_unit,
|
'alarms' => $alarm_value . $alarm_unit,
|
||||||
'categories' => $rec['categories'],
|
'categories' => $rec['categories'],
|
||||||
'free_busy' => $rec['show-time-as'],
|
'free_busy' => $rec['show-time-as'],
|
||||||
|
|
|
@ -308,7 +308,7 @@ class kolab_driver extends calendar_driver
|
||||||
if ($calendars && !in_array($cid, $calendars))
|
if ($calendars && !in_array($cid, $calendars))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$events = array_merge($this->calendars[$cid]->list_events($start, $end, $search));
|
$events = array_merge($events, $this->calendars[$cid]->list_events($start, $end, $search));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $events;
|
return $events;
|
||||||
|
@ -334,9 +334,9 @@ class kolab_driver extends calendar_driver
|
||||||
public function pending_alarms($time, $calendars = null)
|
public function pending_alarms($time, $calendars = null)
|
||||||
{
|
{
|
||||||
$events = array();
|
$events = array();
|
||||||
foreach ($this->load_events($time, $time + 86400 * 365) as $e) {
|
foreach ($this->load_events($time, $time + 86400 * 365, $calendars) as $e) {
|
||||||
// add to list if alarm is set
|
// add to list if alarm is set
|
||||||
if ($e['alarm'] && ($notifyat = $e['start'] - $e['alarm'] * 60) <= $time) {
|
if ($e['_alarm'] && ($notifyat = $e['start'] - $e['_alarm'] * 60) <= $time) {
|
||||||
$id = $e['id'];
|
$id = $e['id'];
|
||||||
$events[$id] = $e;
|
$events[$id] = $e;
|
||||||
$events[$id]['notifyat'] = $notifyat;
|
$events[$id]['notifyat'] = $notifyat;
|
||||||
|
@ -345,12 +345,10 @@ class kolab_driver extends calendar_driver
|
||||||
|
|
||||||
// get alarm information stored in local database
|
// get alarm information stored in local database
|
||||||
if (!empty($events)) {
|
if (!empty($events)) {
|
||||||
$event_ids = array_keys($events);
|
$event_ids = array_map(array($this->rc->db, 'quote'), array_keys($events));
|
||||||
array_walk($event_ids, array($this->rc->db, 'quote'));
|
|
||||||
$result = $this->rc->db->query(sprintf(
|
$result = $this->rc->db->query(sprintf(
|
||||||
"SELECT * FROM kolab_alarms
|
"SELECT * FROM kolab_alarms
|
||||||
WHERE event_id IN (%s)
|
WHERE event_id IN (%s)",
|
||||||
AND notifyat <= %s",
|
|
||||||
join(',', $event_ids),
|
join(',', $event_ids),
|
||||||
$this->rc->db->now()
|
$this->rc->db->now()
|
||||||
));
|
));
|
||||||
|
@ -367,7 +365,7 @@ class kolab_driver extends calendar_driver
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// snooze function may have shifted alarm time
|
// snooze function may have shifted alarm time
|
||||||
$notifyat = $dbdata['notifyat'] ? strtotime($notifyat) : $e['notifyat'];
|
$notifyat = $dbdata[$id]['notifyat'] ? strtotime($dbdata[$id]['notifyat']) : $e['notifyat'];
|
||||||
if ($notifyat <= $time)
|
if ($notifyat <= $time)
|
||||||
$alarms[] = $e;
|
$alarms[] = $e;
|
||||||
}
|
}
|
||||||
|
@ -386,12 +384,12 @@ class kolab_driver extends calendar_driver
|
||||||
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
$notifyat = $snooze > 0 ? date('Y-m-d H:i:s', time() + $snooze) : null;
|
||||||
|
|
||||||
$query = $this->rc->db->query(
|
$query = $this->rc->db->query(
|
||||||
"UPDATE kolab_alarms
|
"REPLACE INTO kolab_alarms
|
||||||
SET dismissed=?, notifyat=?
|
(event_id, dismissed, notifyat)
|
||||||
WHERE event_id=?",
|
VALUES(?, ?, ?)",
|
||||||
|
$event_id,
|
||||||
$snooze > 0 ? 0 : 1,
|
$snooze > 0 ? 0 : 1,
|
||||||
$notifyat,
|
$notifyat
|
||||||
$event_id
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->rc->db->affected_rows($query);
|
return $this->rc->db->affected_rows($query);
|
||||||
|
|
Loading…
Add table
Reference in a new issue