Add event attendees support for database driver
This commit is contained in:
parent
6bfaf4be1e
commit
95f7e663a9
3 changed files with 32 additions and 4 deletions
|
@ -75,6 +75,7 @@ abstract class calendar_driver
|
||||||
// features supported by backend
|
// features supported by backend
|
||||||
public $alarms = false;
|
public $alarms = false;
|
||||||
public $attendees = false;
|
public $attendees = false;
|
||||||
|
public $freebusy = false;
|
||||||
public $attachments = false;
|
public $attachments = false;
|
||||||
public $undelete = false; // event undelete action
|
public $undelete = false; // event undelete action
|
||||||
public $categoriesimmutable = false;
|
public $categoriesimmutable = false;
|
||||||
|
@ -295,7 +296,6 @@ abstract class calendar_driver
|
||||||
*/
|
*/
|
||||||
public function get_freebusy_list($email, $start, $end)
|
public function get_freebusy_list($email, $start, $end)
|
||||||
{
|
{
|
||||||
sleep(2);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ class database_driver extends calendar_driver
|
||||||
// features this backend supports
|
// features this backend supports
|
||||||
public $alarms = true;
|
public $alarms = true;
|
||||||
public $attendees = true;
|
public $attendees = true;
|
||||||
|
public $freebusy = false;
|
||||||
public $attachments = true;
|
public $attachments = true;
|
||||||
public $alarm_types = array('DISPLAY','EMAIL');
|
public $alarm_types = array('DISPLAY','EMAIL');
|
||||||
|
|
||||||
|
@ -185,7 +186,7 @@ class database_driver extends calendar_driver
|
||||||
$event = $this->_save_preprocess($event);
|
$event = $this->_save_preprocess($event);
|
||||||
$query = $this->rc->db->query(sprintf(
|
$query = $this->rc->db->query(sprintf(
|
||||||
"INSERT INTO " . $this->db_events . "
|
"INSERT INTO " . $this->db_events . "
|
||||||
(calendar_id, created, changed, uid, start, end, all_day, recurrence, title, description, location, categories, free_busy, priority, sensitivity, alarms, notifyat)
|
(calendar_id, created, changed, uid, start, end, all_day, recurrence, title, description, location, categories, free_busy, priority, sensitivity, attendees, alarms, notifyat)
|
||||||
VALUES (?, %s, %s, ?, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
VALUES (?, %s, %s, ?, %s, %s, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||||
$this->rc->db->now(),
|
$this->rc->db->now(),
|
||||||
$this->rc->db->now(),
|
$this->rc->db->now(),
|
||||||
|
@ -203,6 +204,7 @@ class database_driver extends calendar_driver
|
||||||
intval($event['free_busy']),
|
intval($event['free_busy']),
|
||||||
intval($event['priority']),
|
intval($event['priority']),
|
||||||
intval($event['sensitivity']),
|
intval($event['sensitivity']),
|
||||||
|
$event['attendees'],
|
||||||
$event['alarms'],
|
$event['alarms'],
|
||||||
$event['notifyat']
|
$event['notifyat']
|
||||||
);
|
);
|
||||||
|
@ -342,6 +344,17 @@ class database_driver extends calendar_driver
|
||||||
// compute absolute time to notify the user
|
// compute absolute time to notify the user
|
||||||
$event['notifyat'] = $this->_get_notification($event);
|
$event['notifyat'] = $this->_get_notification($event);
|
||||||
|
|
||||||
|
// process event attendees
|
||||||
|
$_attendees = '';
|
||||||
|
foreach ((array)$event['attendees'] as $attendee) {
|
||||||
|
$_attendees .= 'NAME="'.addcslashes($attendee['name'], '"') . '"' .
|
||||||
|
';STATUS=' . $attendee['status'].
|
||||||
|
';ROLE=' . $attendee['role'] .
|
||||||
|
';EMAIL=' . $attendee['email'] .
|
||||||
|
"\n";
|
||||||
|
}
|
||||||
|
$event['attendees'] = rtrim($_attendees);
|
||||||
|
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,9 +400,9 @@ class database_driver extends calendar_driver
|
||||||
private function _update_event($event, $update_recurring = true)
|
private function _update_event($event, $update_recurring = true)
|
||||||
{
|
{
|
||||||
$event = $this->_save_preprocess($event);
|
$event = $this->_save_preprocess($event);
|
||||||
|
console($event);
|
||||||
$sql_set = array();
|
$sql_set = array();
|
||||||
$set_cols = array('all_day', 'recurrence', 'recurrence_id', 'title', 'description', 'location', 'categories', 'free_busy', 'priority', 'sensitivity', 'alarms', 'notifyat');
|
$set_cols = array('all_day', 'recurrence', 'recurrence_id', 'title', 'description', 'location', 'categories', 'free_busy', 'priority', 'sensitivity', 'attendees', 'alarms', 'notifyat');
|
||||||
foreach ($set_cols as $col) {
|
foreach ($set_cols as $col) {
|
||||||
if (isset($event[$col]))
|
if (isset($event[$col]))
|
||||||
$sql_set[] = $this->rc->db->quote_identifier($col) . '=' . $this->rc->db->quote($event[$col]);
|
$sql_set[] = $this->rc->db->quote_identifier($col) . '=' . $this->rc->db->quote($event[$col]);
|
||||||
|
@ -693,6 +706,20 @@ class database_driver extends calendar_driver
|
||||||
if ($event['_attachments'] > 0)
|
if ($event['_attachments'] > 0)
|
||||||
$event['attachments'] = (array)$this->list_attachments($event);
|
$event['attachments'] = (array)$this->list_attachments($event);
|
||||||
|
|
||||||
|
// decode serialized event attendees
|
||||||
|
if ($event['attendees']) {
|
||||||
|
$attendees = array();
|
||||||
|
foreach (explode("\n", $event['attendees']) as $line) {
|
||||||
|
$att = array();
|
||||||
|
foreach (rcube_explode_quoted_string(';', $line) as $prop) {
|
||||||
|
list($key, $value) = explode("=", $prop);
|
||||||
|
$att[strtolower($key)] = stripslashes(trim($value, '""'));
|
||||||
|
}
|
||||||
|
$attendees[] = $att;
|
||||||
|
}
|
||||||
|
$event['attendees'] = $attendees;
|
||||||
|
}
|
||||||
|
|
||||||
unset($event['event_id'], $event['calendar_id'], $event['notifyat'], $event['_attachments']);
|
unset($event['event_id'], $event['calendar_id'], $event['notifyat'], $event['_attachments']);
|
||||||
return $event;
|
return $event;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,7 @@ class calendar_ui
|
||||||
unset($prop['user_id']);
|
unset($prop['user_id']);
|
||||||
$prop['alarms'] = $this->calendar->driver->alarms;
|
$prop['alarms'] = $this->calendar->driver->alarms;
|
||||||
$prop['attendees'] = $this->calendar->driver->attendees;
|
$prop['attendees'] = $this->calendar->driver->attendees;
|
||||||
|
$prop['freebusy'] = $this->calendar->driver->freebusy;
|
||||||
$prop['attachments'] = $this->calendar->driver->attachments;
|
$prop['attachments'] = $this->calendar->driver->attachments;
|
||||||
$jsenv[$id] = $prop;
|
$jsenv[$id] = $prop;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue