mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-09-19 05:59:02 +00:00
Support schedule-calendar-transp property.
This commit is contained in:
parent
d92361cb0d
commit
40dd74447b
@ -49,6 +49,7 @@ $success = array();
|
|||||||
*/
|
*/
|
||||||
$qry = new AwlQuery();
|
$qry = new AwlQuery();
|
||||||
$qry->Begin();
|
$qry->Begin();
|
||||||
|
$setcalendar = count($xmltree->GetPath('/DAV::propertyupdate/DAV::set/DAV::prop/DAV::resourcetype/urn:ietf:params:xml:ns:caldav:calendar'));
|
||||||
foreach( $setprops AS $k => $setting ) {
|
foreach( $setprops AS $k => $setting ) {
|
||||||
$tag = $setting->GetTag();
|
$tag = $setting->GetTag();
|
||||||
$content = $setting->RenderContent();
|
$content = $setting->RenderContent();
|
||||||
@ -59,12 +60,12 @@ foreach( $setprops AS $k => $setting ) {
|
|||||||
/**
|
/**
|
||||||
* Can't set displayname on resources - only collections or principals
|
* Can't set displayname on resources - only collections or principals
|
||||||
*/
|
*/
|
||||||
if ( $request->IsCollection() || $request->IsPrincipal() ) {
|
if ( $dav_resource->IsCollection() || $dav_resource->IsPrincipal() ) {
|
||||||
if ( $dav_resource->IsBinding() ) {
|
if ( $dav_resource->IsBinding() ) {
|
||||||
$qry->QDo('UPDATE dav_binding SET dav_displayname = :displayname WHERE dav_name = :dav_name',
|
$qry->QDo('UPDATE dav_binding SET dav_displayname = :displayname WHERE dav_name = :dav_name',
|
||||||
array( ':displayname' => $content, ':dav_name' => $dav_resource->dav_name()) );
|
array( ':displayname' => $content, ':dav_name' => $dav_resource->dav_name()) );
|
||||||
}
|
}
|
||||||
else if ( $request->IsPrincipal() ) {
|
else if ( $dav_resource->IsPrincipal() ) {
|
||||||
$qry->QDo('UPDATE dav_principal SET fullname = :displayname, displayname = :displayname, modified = current_timestamp WHERE user_no = :user_no',
|
$qry->QDo('UPDATE dav_principal SET fullname = :displayname, displayname = :displayname, modified = current_timestamp WHERE user_no = :user_no',
|
||||||
array( ':displayname' => $content, ':user_no' => $request->user_no) );
|
array( ':displayname' => $content, ':user_no' => $request->user_no) );
|
||||||
}
|
}
|
||||||
@ -93,9 +94,8 @@ foreach( $setprops AS $k => $setting ) {
|
|||||||
* Only collections may be CalDAV calendars or addressbooks, and they may not be both.
|
* Only collections may be CalDAV calendars or addressbooks, and they may not be both.
|
||||||
*/
|
*/
|
||||||
$setcollection = count($setting->GetPath('DAV::resourcetype/DAV::collection'));
|
$setcollection = count($setting->GetPath('DAV::resourcetype/DAV::collection'));
|
||||||
$setcalendar = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:caldav:calendar'));
|
|
||||||
$setaddressbook = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:carddav:addressbook'));
|
$setaddressbook = count($setting->GetPath('DAV::resourcetype/urn:ietf:params:xml:ns:carddav:addressbook'));
|
||||||
if ( $request->IsCollection() && $setcollection && ! $dav_resource->IsPrincipal()
|
if ( $dav_resource->IsCollection() && $setcollection && ! $dav_resource->IsPrincipal()
|
||||||
&& ! $dav_resource->IsBinding() && ! ($setaddressbook && $setcalendar) ) {
|
&& ! $dav_resource->IsBinding() && ! ($setaddressbook && $setcalendar) ) {
|
||||||
$resourcetypes = $setting->GetPath('DAV::resourcetype/*');
|
$resourcetypes = $setting->GetPath('DAV::resourcetype/*');
|
||||||
$resourcetypes = str_replace( "\n", "", implode('',$resourcetypes));
|
$resourcetypes = str_replace( "\n", "", implode('',$resourcetypes));
|
||||||
@ -117,6 +117,26 @@ foreach( $setprops AS $k => $setting ) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'urn:ietf:params:xml:ns:caldav:schedule-calendar-transp':
|
||||||
|
if ( $dav_resource->IsCollection() && ( $dav_resource->IsCalendar() || $setcalendar ) && !$dav_resource->IsBinding() ) {
|
||||||
|
$transparency = $setting->GetPath('urn:ietf:params:xml:ns:caldav:schedule-calendar-transp/*');
|
||||||
|
$transparency = preg_replace( '{^.*:}', '', $transparency[0]->GetTag());
|
||||||
|
$qry->QDo('UPDATE collection SET schedule_transp = :transparency WHERE dav_name = :dav_name',
|
||||||
|
array( ':dav_name' => $dav_resource->dav_name(), ':transparency' => $transparency ) );
|
||||||
|
$success[$tag] = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$failure['set-'.$tag] = new XMLElement( 'propstat', array(
|
||||||
|
new XMLElement( 'prop', new XMLElement($tag)),
|
||||||
|
new XMLElement( 'status', 'HTTP/1.1 403 Forbidden' ),
|
||||||
|
new XMLElement( 'responsedescription', array(
|
||||||
|
new XMLElement( 'error', new XMLElement( 'cannot-modify-protected-property') ),
|
||||||
|
translate("The CalDAV:schedule-calendar-transp property may only be set on calendars.") )
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'urn:ietf:params:xml:ns:caldav:calendar-free-busy-set':
|
case 'urn:ietf:params:xml:ns:caldav:calendar-free-busy-set':
|
||||||
$failure['set-'.$tag] = new XMLElement( 'propstat', array(
|
$failure['set-'.$tag] = new XMLElement( 'propstat', array(
|
||||||
new XMLElement( 'prop', new XMLElement($tag)),
|
new XMLElement( 'prop', new XMLElement($tag)),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user