Implemented virtual path for media module.

First test implementation done in the Helper module.
The upload component is using a bad workaround where the virtual path is defined
in the uri as ?virutalPath= because we are not uploading media files AND form data
at the same time. Therefore the virtualPath can currently only be passed in the get/uri data.
This commit is contained in:
Dennis Eichhorn 2019-05-30 19:13:11 +02:00
parent 3b6a903db4
commit 28f4cbeac4
5 changed files with 54 additions and 2 deletions

View File

@ -0,0 +1,7 @@
[
{
"name": "Helper",
"virtualPath": "/Modules",
"user": 1
}
]

43
Admin/Install/Media.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Helper\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
declare(strict_types=1);
namespace Modules\Helper\Admin\Install;
use phpOMS\DataStorage\Database\DatabasePool;
/**
* Media class.
*
* @package Modules\Helper\Admin\Install
* @license OMS License 1.0
* @link http://website.orange-management.de
* @since 1.0.0
*/
class Media
{
/**
* Install media providing
*
* @param string $path Module path
* @param DatabasePool $dbPool Database pool for database interaction
*
* @return void
*
* @since 1.0.0
*/
public static function install(string $path, DatabasePool $dbPool) : void
{
\Modules\Media\Admin\Installer::installExternal($dbPool, ['path' => __DIR__ . '/Media.install.json']);
}
}

View File

@ -268,6 +268,7 @@ final class ApiController extends Controller
$mediaCollection->setDescriptionRaw((string) ($request->getData('description') ?? ''));
$mediaCollection->setCreatedBy($request->getHeader()->getAccount());
$mediaCollection->setSources($files);
$mediaCollection->setVirtualPath('/Modules/Helper');
CollectionMapper::create($mediaCollection);

View File

@ -48,6 +48,6 @@ echo $this->getData('nav')->render(); ?>
</div>
<div class="col-xs-12 col-md-6">
<?= $this->getData('media-upload')->render('helper-template-create'); ?>
<?= $this->getData('media-upload')->render('helper-template-create', '/Modules/Helper'); ?>
</div>
</div>

View File

@ -22,7 +22,8 @@
"Tools": "1.0.0"
},
"providing": {
"Navigation": "*"
"Navigation": "*",
"Media": "*"
},
"load": [
{