0012492: support property-update calendar-order
authorCornelius Weiß <c.weiss@metaways.de>
Thu, 5 Jan 2017 17:41:15 +0000 (18:41 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 9 Jan 2017 08:24:53 +0000 (09:24 +0100)
Change-Id: Id6555660ec92cbe66c80925b961ace4abe201c4c
Reviewed-on: http://gerrit.tine20.com/customers/4051
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Frontend/WebDAV/ContainerTest.php
tine20/Calendar/Frontend/WebDAV/Container.php
tine20/Tinebase/WebDav/Container/Abstract.php

index 050c152..4e0f960 100644 (file)
@@ -148,6 +148,7 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         
         $mutations = array(
             '{http://apple.com/ns/ical/}calendar-color'      => '#123456FF',
+            '{http://apple.com/ns/ical/}calendar-order'      => 2,
             '{DAV:}displayname'                              => 'testUpdateProperties',
             '{http://calendarserver.org/ns/}invalidProperty' => null
         );
@@ -159,12 +160,14 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         $updatedContainer = Tinebase_Container::getInstance()->get($this->objects['initialContainer']);
         
         $this->assertEquals($result[200]["{http://apple.com/ns/ical/}calendar-color"],      null);
+        $this->assertEquals($result[200]["{http://apple.com/ns/ical/}calendar-order"],      null);
         $this->assertEquals($result[200]["{DAV:}displayname"],                              null);
         $this->assertEquals($result[403]["{http://calendarserver.org/ns/}invalidProperty"], null);
         $this->assertEquals($updatedContainer->color, substr($mutations['{http://apple.com/ns/ical/}calendar-color'], 0, 7));
+        $this->assertEquals($updatedContainer->order,  2);
         $this->assertEquals($updatedContainer->name,  $mutations['{DAV:}displayname']);
     }
-    
+
     /**
      * test getCreateFile
      * 
index f86ce4c..af0f3b3 100644 (file)
@@ -187,7 +187,8 @@ class Calendar_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstr
             '{DAV:}owner'       => new Sabre\DAVACL\Property\Principal(Sabre\DAVACL\Property\Principal::HREF, 'principals/users/' . Tinebase_Core::getUser()->contact_id),
             '{DAV:}displayname' => $this->_container->name,
             '{http://apple.com/ns/ical/}calendar-color' => (empty($this->_container->color)) ? '#000000' : $this->_container->color,
-            
+            '{http://apple.com/ns/ical/}calendar-order' => (empty($this->_container->order)) ? 1 : $this->_container->order,
+
             '{' . Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre\CalDAV\Property\SupportedCalendarComponentSet(array('VEVENT')),
             '{' . Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-data'          => new Sabre\CalDAV\Property\SupportedCalendarData(),
             '{' . Sabre\CalDAV\Plugin::NS_CALDAV . '}calendar-description'             => 'Calendar ' . $this->_container->name,
index 5e15bf9..0ba8487 100644 (file)
@@ -459,7 +459,12 @@ abstract class Tinebase_WebDav_Container_Abstract extends \Sabre\DAV\Collection
                     $this->_container->color = substr($value, 0, 7);
                     $result['200'][$key] = null;
                     break;
-                
+
+                case '{http://apple.com/ns/ical/}calendar-order':
+                    $this->_container->order = (int) $value;
+                    $result['200'][$key] = null;
+                    break;
+
                 default:
                     $result['403'][$key] = null;
             }