0011898: Download links missing server subdir part
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 14 Sep 2016 20:54:24 +0000 (22:54 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 15 Sep 2016 07:53:50 +0000 (09:53 +0200)
https://forge.tine20.org/view.php?id=11898

Change-Id: I19e1c6dc7f81afbbe99f728789e646e4183efc37
Reviewed-on: http://gerrit.tine20.com/customers/3572
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Filemanager/Frontend/Download.php
tine20/Filemanager/views/file.phtml
tine20/Filemanager/views/folder.phtml
tine20/Filemanager/views/notfound.phtml

index f8ebef2..befc41d 100644 (file)
@@ -55,9 +55,7 @@ class Filemanager_Frontend_Download extends Tinebase_Frontend_Http_Abstract
             
             header('HTTP/1.0 404 Not found');
             
-            $view = new Zend_View();
-            $view->setScriptPath('Filemanager/views');
-            
+            $view = $this->_getView();
             header('Content-Type: text/html; charset=utf-8');
             die($view->render('notfound.phtml'));
         }
@@ -129,11 +127,7 @@ class Filemanager_Frontend_Download extends Tinebase_Frontend_Http_Abstract
      */
     protected function _listDirectory(Filemanager_Model_DownloadLink $download, Tinebase_Model_Tree_Node $node, $path)
     {
-        $view = new Zend_View();
-        $view->setScriptPath('Filemanager/views');
-        
-        $view->path = '/' . implode('/', $path);
-        
+        $this->_getView($path, $node);
         $view->files = Filemanager_Controller_DownloadLink::getInstance()->getFileList($download, $path, $node);
         
         header('Content-Type: text/html; charset=utf-8');
@@ -149,17 +143,26 @@ class Filemanager_Frontend_Download extends Tinebase_Frontend_Http_Abstract
      */
     protected function _displayFile(Filemanager_Model_DownloadLink $download, Tinebase_Model_Tree_Node $node, $path)
     {
-        $view = new Zend_View();
-        $view->setScriptPath('Filemanager/views');
-        
-        $view->path = '/' . implode('/', $path);
-        
+        $view = $this->_getView($path, $node);
+
         $view->file = $node;
         $view->file->path = '/download/get/' . $download->getId() . '/' . implode('/', $path);
         
         header('Content-Type: text/html; charset=utf-8');
         die($view->render('file.phtml'));
     }
+
+    protected function _getView($path = null, $node = null)
+    {
+        $view = new Zend_View();
+        $view->setScriptPath('Filemanager/views');
+
+        $view->logoPath = Tinebase_Core::getUrl() . '/images/tine_logo.png';
+
+        if ($path !== null) {
+            $view->path = (empty($path)) ? '/' . $node->name : '/' . implode('/', $path);
+        }
+    }
     
     /**
      * sets download link owner (creator) as current user to ensure ACL handling
index a676dfb..5993987 100644 (file)
@@ -6,7 +6,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=8; IE=7" />
 </head>
  <body>
-    <img alt="Tine 2.0" src="/images/tine_logo.png"><h1><?php echo $this->path ?></h1>
+    <img alt="Tine 2.0" src="<?php echo $this->logoPath ?>"><h1><?php echo $this->path ?></h1>
     <hr>
     <table>
         <tr><td>Name:</td><td><?php echo $this->file->name ?></td></tr>
index 4283b2a..b82f84f 100644 (file)
@@ -6,7 +6,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=8; IE=7" />
 </head>
  <body>
-    <img alt="Tine 2.0" src="/images/tine_logo.png"><h1><?php echo $this->path ?></h1>
+    <img alt="Tine 2.0" src="<?php echo $this->logoPath ?>"><h1><?php echo $this->path ?></h1>
     <hr>
     <table>
         <tr><th>Name</th><th>letzte Änderung</th><th>Größe</th><th>Beschreibung</th></tr>
index 17068e0..dd53f1c 100644 (file)
@@ -6,7 +6,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=8; IE=7" />
 </head>
  <body>
-    <img alt="Tine 2.0" src="/images/tine_logo.png"><h1></h1>
+    <img alt="Tine 2.0" src="<?php echo $this->logoPath ?>"><h1></h1>
     File not found!
 </body>
 </html>