0011898: Download links missing server subdir part
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 9 Jun 2016 16:37:46 +0000 (18:37 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 10 Jun 2016 16:17:33 +0000 (18:17 +0200)
* make use of new Tinebase_Core::getUrl()
* 'full' is default part for getUrl()

https://forge.tine20.org/view.php?id=11898

Change-Id: I92e8889623d11eaa748e0ee134f4326d6f6c40f5
Reviewed-on: http://gerrit.tine20.com/customers/3222
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Filemanager/Frontend/JsonTests.php
tine20/Filemanager/Model/DownloadLink.php
tine20/Tinebase/Core.php

index 4610666..7c64fe4 100644 (file)
@@ -1362,11 +1362,16 @@ class Filemanager_Frontend_JsonTests extends TestCase
         $result = $this->_json->saveDownloadLink($downloadLinkData);
         
         $this->assertTrue(! empty($result['url']));
-        $this->assertEquals(Tinebase_Core::getHostname() . '/download/show/' . $result['id'], $result['url']);
+        $this->assertEquals($this->_getDownloadUrl($result['id']), $result['url']);
         $this->assertEquals(0, $result['access_count']);
         
         return $result;
     }
+
+    protected function _getDownloadUrl($id)
+    {
+        return Tinebase_Core::getUrl() . '/download/show/' . $id;
+    }
     
     /**
      * testSaveDownloadLinkDirectory
@@ -1379,7 +1384,7 @@ class Filemanager_Frontend_JsonTests extends TestCase
         $result = $this->_json->saveDownloadLink($downloadLinkData);
         
         $this->assertTrue(! empty($result['url']));
-        $this->assertEquals(Tinebase_Core::getHostname() . '/download/show/' . $result['id'], $result['url']);
+        $this->assertEquals($this->_getDownloadUrl($result['id']), $result['url']);
         
         return $result;
     }
index 7b8d4e4..f7d495c 100644 (file)
@@ -73,7 +73,7 @@ class Filemanager_Model_DownloadLink extends Tinebase_Record_Abstract
         
         // always set url here (or is there a better place?)
         if ($this->getId()) {
-            $this->url = Tinebase_Core::getHostname() . '/download/show/' . $this->getId();
+            $this->url = Tinebase_Core::getUrl() . '/download/show/' . $this->getId();
         }
     }
     
index 1d0f0ea..54bc448 100644 (file)
@@ -1506,9 +1506,10 @@ class Tinebase_Core
     /**
      * returns requested url part
      *
+     * @param string $part
      * @return string
      */
-    public static function getUrl($part)
+    public static function getUrl($part = 'full')
     {
         $request = new Zend_Controller_Request_Http();
         $pathname = $request->getBasePath();