Merge branch '2014.11' into 2015.11
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 9 May 2016 12:02:00 +0000 (14:02 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 9 May 2016 12:02:00 +0000 (14:02 +0200)
tests/tine20/Calendar/Frontend/WebDAV/ContainerTest.php
tests/tine20/Filemanager/Frontend/JsonTests.php
tine20/Calendar/Frontend/WebDAV/Container.php
tine20/Tinebase/FileSystem.php
tine20/Tinebase/js/widgets/tree/ContextMenu.js

index 2cfa166..beb7ab2 100644 (file)
@@ -361,8 +361,10 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         $container = new Calendar_Frontend_WebDAV_Container($this->objects['initialContainer']);
         
         $shares = $container->getShares();
-        
+
         $this->assertEquals(3, count($shares));
+        $this->assertEquals('urn:uuid:anyone', $shares[0]['href']);
+        $this->assertEquals('urn:uuid:' . Tinebase_Core::getUser()->contact_id, $shares[2]['href']);
     }
     
     /**
index 19cfeb2..be8ef68 100644 (file)
@@ -1237,13 +1237,15 @@ class Filemanager_Frontend_JsonTests extends TestCase
     public function testCreateFolderInFolderWithSameName()
     {
         $path = '/personal/' .Tinebase_Core::getUser()->accountLoginName . '/' . $this->_getPersonalFilemanagerContainer()->name;
-        
-        $this->_json->createNode($path . '/Test1', 'folder', NULL, FALSE);
-        $this->_json->createNode($path . '/Test1/Test1', 'folder', NULL, FALSE);
+
+        $result = $this->_json->createNode($path . '/Test1', 'folder', NULL, FALSE);
+        $this->assertTrue(isset($result['id']));
+        $result = $this->_json->createNode($path . '/Test1/Test1', 'folder', NULL, FALSE);
+        $this->assertTrue(isset($result['id']), 'node has not been created');
         $e = new Tinebase_Exception('nothing');
         try {
             $this->_json->createNode($path . '/Test1/Test1/Test2', 'folder', NULL, FALSE);
-        } catch(Exception $e) {
+        } catch (Exception $e) {
             $this->fail('The folder couldn\'t be found, so it hasn\'t ben created');
         }
         
@@ -1432,15 +1434,15 @@ class Filemanager_Frontend_JsonTests extends TestCase
         
         $this->assertEquals(1, $result['totalcount']);
     }
-    
+
     /**
      * testDeleteDownloadLinks
      */
     public function testDeleteDownloadLinks()
     {
         $downloadLink = $this->testSaveDownloadLinkFile();
-        
-        $result = $this->_json->deleteDownloadLinks(array($downloadLink['id']));
+
+        $this->_json->deleteDownloadLinks(array($downloadLink['id']));
         try {
             Filemanager_Controller_DownloadLink::getInstance()->get($downloadLink['id']);
             $this->fail('link should have been deleted');
index bdfc3e6..3dba01b 100644 (file)
@@ -343,6 +343,11 @@ class Calendar_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstr
     
     /**
      * (non-PHPdoc)
+     *
+     * changed href from URI format /path/to/targetid to urn:uuid:id format due to el capitano ical client
+     * see:
+     * https://service.metaways.net/Ticket/Display.html?id=145985
+     *
      * @see \Sabre\CalDAV\IShareableCalendar::getShares()
      */
     public function getShares()
@@ -361,7 +366,8 @@ class Calendar_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstr
             
             switch ($grant->account_type) {
                 case 'anyone':
-                    $href       = '/principals/groups/anyone';
+                    // was: '/principals/groups/anyone'
+                    $href       = 'urn:uuid:anyone';
                     $commonName = 'Anyone';
                     break;
                 
@@ -371,20 +377,25 @@ class Calendar_Frontend_WebDAV_Container extends Tinebase_WebDav_Container_Abstr
                     } catch (Tinebase_Exception_NotFound $tenf) {
                         continue;
                     }
-                     
-                    $href       = '/principals/groups/' . $list->list_id;
+
+                    // was: '/principals/groups/'
+                    $href       = 'urn:uuid:' . $list->list_id;
                     $commonName = $list->name;
                     
                     break;
                     
                 case 'user':
+                    if ((string)$this->_container->owner_id === (string)$grant->account_id) {
+                        continue;
+                    }
                     try {
                         $contact = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $grant->account_id);
                     } catch (Tinebase_Exception_NotFound $tenf) {
                         continue;
                     }
-                     
-                    $href       = '/principals/users/' . $contact->contact_id;
+
+                    // was: '/principals/users/'
+                    $href       = 'urn:uuid:' . $contact->contact_id;
                     $commonName = $contact->accountDisplayName;
                     break;
             }
index 3764afb..5c089d8 100644 (file)
@@ -735,12 +735,12 @@ class Tinebase_FileSystem implements Tinebase_Controller_Interface
             }
         }
         
-        $missingPathParts = array_diff($this->_splitPath($path), $pathParts);
+        $missingPathParts = array_diff_assoc($this->_splitPath($path), $pathParts);
         
         foreach ($missingPathParts as $pathPart) {
             $node = $this->_treeNodeBackend->getChild($parentNode, $pathPart);
             
-            // keep track of current path posistion
+            // keep track of current path position
             array_push($pathParts, $pathPart);
             
             // add found path to statCache
index 2a89c32..76507b4 100644 (file)
@@ -233,6 +233,12 @@ Tine.widgets.tree.ContextMenu = {
                     success: function(result, request){
                         var nodeData = Ext.util.JSON.decode(result.responseText);
 
+                        if (nodeData.length == 0) {
+                            Tine.log.err('Server returned empty node data!');
+                            Ext.MessageBox.hide();
+                            return;
+                        }
+
                         // TODO add + icon if it wasn't expandable before
                         if(nodeData.type == 'folder') {
                             var nodeData = Ext.util.JSON.decode(result.responseText);
@@ -481,16 +487,20 @@ Tine.widgets.tree.ContextMenu = {
     manageProperties: function() {
         if (this.scope.ctxNode) {
             var node = this.scope.ctxNode,
-                grantsContainer;
-            if(node.attributes.nodeRecord && node.attributes.nodeRecord.data.name) {
+                grantsContainer,
+                ctxNodeName;
+            if (node.attributes.nodeRecord && node.attributes.nodeRecord.data.name) {
                 grantsContainer = node.attributes.nodeRecord.data.name;
             } else if(node.attributes.container) {
                 grantsContainer = node.attributes.container;
             }
+
+            ctxNodeName = grantsContainer.name ? grantsContainer.name : grantsContainer;
             
             var window = Tine.widgets.container.PropertiesDialog.openWindow({
-                title: String.format(_('Properties for {0} "{1}"'), this.nodeName, Ext.util.Format.htmlEncode(grantsContainer.name)),
+                title: String.format(_('Properties for {0} "{1}"'), this.nodeName, Ext.util.Format.htmlEncode(ctxNodeName)),
                 containerName: this.nodeName,
+                // TODO fix this in Filemanager! sub-nodes do not have a container...
                 grantContainer: grantsContainer,
                 app: this.scope.app.appName
             });