Commit e2b75973 authored by Daniel Morlock's avatar Daniel Morlock

Show user an error if occurred during calendar creation.

parent 07eb13d8
......@@ -97,6 +97,15 @@ class caldav_driver extends database_driver
rcmail::console(__CLASS__.': '.$msg);
}
/**
* Helper method to log (if debug mode is enabled) and raise an user error.
*/
private function _raise_error($msg)
{
self::debug_log($msg);
$this->rc->output->show_message($msg, 'error');
}
/**
* Sets caldav properties.
*
......@@ -341,7 +350,7 @@ class caldav_driver extends database_driver
$caldav_url = $props["url"];
$response = $caldav->prop_find($caldav_url, array_merge($current_user_principal,$cal_attribs), 0);
if (!$response) {
self::debug_log("Resource \"$caldav_url\" has no collections");
$this->_raise_error("Resource \"$caldav_url\" has no collections");
return false;
}
else if (array_key_exists ('{DAV:}resourcetype', $response) &&
......@@ -365,7 +374,7 @@ class caldav_driver extends database_driver
$caldav_url = $base_uri . $response[$current_user_principal[0]];
$response = $caldav->prop_find($caldav_url, $calendar_home_set, 0);
if (!$response) {
self::debug_log("Resource \"$caldav_url\" contains no calendars.");
$this->_raise_error("Resource \"$caldav_url\" contains no calendars.");
return false;
}
$caldav_url = $base_uri . $response[$calendar_home_set[0]];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment