diff --git a/dav/Changelog.txt b/dav/Changelog.txt index a252673e1..90117b718 100644 --- a/dav/Changelog.txt +++ b/dav/Changelog.txt @@ -1,7 +1,9 @@ -v0.2.0-pre +v0.2.0 ====== -[FEATURE] Multiple private Calendars can be created. +[FEATURE] Multiple private Calendars can be created. Each calendar can have its own default color; single events of a calendar can override this setting. [FEATURE] Support for recurring events. +[FEATURE] ICS files can be imported to and exported from a calendar. +[FEATURE] Notification by e-mail is supported. [COMPATIBILITY] When creating or updating an event using CalDAV, the etag is returned. v0.1.1 diff --git a/dav/common/dav_caldav_backend_private.inc.php b/dav/common/dav_caldav_backend_private.inc.php index 6ca24c28e..5356280a4 100644 --- a/dav/common/dav_caldav_backend_private.inc.php +++ b/dav/common/dav_caldav_backend_private.inc.php @@ -34,7 +34,8 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common * @static * @return string */ - public static function getBackendTypeName() { + public static function getBackendTypeName() + { return t("Private Events"); } @@ -110,9 +111,9 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common */ public function listItemsByRange($calendarId, $sd, $ed, $base_path) { - $calendar = Sabre_CalDAV_Backend_Common::loadCalendarById($calendarId); - $von = wdcal_php2MySqlTime($sd); - $bis = wdcal_php2MySqlTime($ed); + $calendar = Sabre_CalDAV_Backend_Common::loadCalendarById($calendarId); + $von = wdcal_php2MySqlTime($sd); + $bis = wdcal_php2MySqlTime($ed); $timezoneOffset = date("P"); // @TODO Events, die früher angefangen haben, aber noch andauern @@ -166,12 +167,17 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common if (!isset($cal["uri"])) throw new DAVVersionMismatchException(); if (in_array($cal["uri"], $GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"])) continue; + $components = array(); + if ($cal["has_vevent"]) $components[] = "VEVENT"; + if ($cal["has_vtodo"]) $components[] = "VTODO"; + $dat = array( - "id" => $cal["id"], - "uri" => $cal["uri"], - "principaluri" => $principalUri, - '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0', - "calendar_class" => "Sabre_CalDAV_Calendar", + "id" => $cal["id"], + "uri" => $cal["uri"], + "principaluri" => $principalUri, + '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0', + '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet($components), + "calendar_class" => "Sabre_CalDAV_Calendar", ); foreach ($this->propertyMap as $key=> $field) $dat[$key] = $cal[$field]; @@ -191,7 +197,7 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common * @param string $principalUri * @param string $calendarUri * @param array $properties - * @throws Sabre_DAV_Exception + * @throws Sabre_DAV_Exception|Sabre_DAV_Exception_Conflict * @return string|void */ public function createCalendar($principalUri, $calendarUri, array $properties) @@ -200,7 +206,7 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common $uid = dav_compat_principal2uid($principalUri); $r = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, $uid, dbesc($calendarUri)); - if (count($r) > 0) throw new Sabre_DAV_Exception("A calendar with this URI already exists"); + if (count($r) > 0) throw new Sabre_DAV_Exception_Conflict("A calendar with this URI already exists"); $keys = array("`namespace`", "`namespace_id`", "`ctag`", "`uri`"); $vals = array(CALDAV_NAMESPACE_PRIVATE, IntVal($uid), 1, "'" . dbesc($calendarUri) . "'"); diff --git a/dav/dav_caldav_backend_virtual_friendica.inc.php b/dav/dav_caldav_backend_virtual_friendica.inc.php index 4f761da1a..9178aaabb 100644 --- a/dav/dav_caldav_backend_virtual_friendica.inc.php +++ b/dav/dav_caldav_backend_virtual_friendica.inc.php @@ -226,6 +226,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual "uri" => $cal["uri"], "principaluri" => $principalUri, '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0', + '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array("VEVENT")), "calendar_class" => "Sabre_CalDAV_Calendar_Virtual", ); foreach ($this->propertyMap as $key=> $field) $dat[$key] = $cal[$field]; diff --git a/dav/main.php b/dav/main.php index 86c365c0a..03f342bd2 100644 --- a/dav/main.php +++ b/dav/main.php @@ -67,7 +67,7 @@ function dav_init(&$a) dav_include_files(); - if (true) { + if (false) { dbg(true); error_reporting(E_ALL); ini_set("display_errors", 1);