mirror of
https://github.com/Karaka-Management/oms-Script.git
synced 2026-01-22 09:28:41 +00:00
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:
parent
3b6a903db4
commit
28f4cbeac4
7
Admin/Install/Media.install.json
Normal file
7
Admin/Install/Media.install.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
{
|
||||
"name": "Helper",
|
||||
"virtualPath": "/Modules",
|
||||
"user": 1
|
||||
}
|
||||
]
|
||||
43
Admin/Install/Media.php
Normal file
43
Admin/Install/Media.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Reference in New Issue
Block a user