mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-01-25 07:18:41 +00:00
todo implementations
This commit is contained in:
parent
f928583447
commit
f3d2f51d38
|
|
@ -13,6 +13,11 @@
|
|||
"name": "media_type_name",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"media_type_isvisible": {
|
||||
"name": "media_type_isvisible",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,6 +18,28 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/admin/module/settings\?id=Media$' => [
|
||||
[
|
||||
'dest' => '\Modules\Media\Controller\BackendController:viewModuleSettings',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => \Modules\Admin\Models\PermissionState::MODULE,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/admin/module/settings\?id=Media&type=.*?$' => [
|
||||
[
|
||||
'dest' => '\Modules\Media\Controller\BackendController:viewMediaTypeSettings',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => \Modules\Admin\Models\PermissionState::MODULE,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/media/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Media\Controller\BackendController:viewMediaList',
|
||||
|
|
|
|||
0
Admin/Settings/Theme/Backend/settings-type.tpl.php
Normal file
0
Admin/Settings/Theme/Backend/settings-type.tpl.php
Normal file
85
Admin/Settings/Theme/Backend/settings.tpl.php
Normal file
85
Admin/Settings/Theme/Backend/settings.tpl.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Auditor
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\Media\Models\MediaType[] $types
|
||||
*/
|
||||
$types = $this->getData('types') ?? [];
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Types'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||
<div class="slider">
|
||||
<table id="typeList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<label for="typeList-sort-1">
|
||||
<input type="radio" name="typeList-sort" id="typeList-sort-1">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="typeList-sort-2">
|
||||
<input type="radio" name="typeList-sort" id="typeList-sort-2">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('keyword'); ?>
|
||||
<label for="typeList-sort-3">
|
||||
<input type="radio" name="typeList-sort" id="typeList-sort-3">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="typeList-sort-4">
|
||||
<input type="radio" name="typeList-sort" id="typeList-sort-4">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('Name'); ?>
|
||||
<label for="typeList-sort-5">
|
||||
<input type="radio" name="typeList-sort" id="typeList-sort-5">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="typeList-sort-6">
|
||||
<input type="radio" name="typeList-sort" id="typeList-sort-6">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php $count = 0;
|
||||
foreach ($types as $key => $type) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}admin/module/settings?id=Media&type=' . $type->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $type->getId(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($type->name); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($type->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -642,7 +642,9 @@ final class ApiController extends Controller
|
|||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setData('media', $media);
|
||||
|
||||
$response->endAllOutputBuffering(); // for large files
|
||||
if (!\headers_sent()) {
|
||||
$response->endAllOutputBuffering(); // for large files
|
||||
}
|
||||
|
||||
if (($type = $request->getData('type')) === null) {
|
||||
$view->setTemplate('/Modules/Media/Theme/Api/render');
|
||||
|
|
|
|||
|
|
@ -14,11 +14,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Media\Controller;
|
||||
|
||||
use Model\NullSetting;
|
||||
use Model\SettingMapper;
|
||||
use Modules\Admin\Models\Account;
|
||||
use Modules\Media\Models\Collection;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Media\Models\Media;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\MediaTypeMapper;
|
||||
use Modules\Media\Models\MediaTypeL11nMapper;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use Modules\Media\Theme\Backend\Components\Media\ElementView;
|
||||
use Modules\Media\Theme\Backend\Components\Media\ListView;
|
||||
|
|
@ -262,6 +266,70 @@ final class BackendController extends Controller
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewModuleSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response));
|
||||
|
||||
$id = $request->getData('id') ?? '';
|
||||
|
||||
$settings = SettingMapper::getFor($id, 'module');
|
||||
if (!($settings instanceof NullSetting)) {
|
||||
$view->setData('settings', !\is_array($settings) ? [$settings] : $settings);
|
||||
}
|
||||
|
||||
$types = MediaTypeMapper::with('language', $response->getLanguage())::getAll();
|
||||
$view->setData('types', $types);
|
||||
|
||||
if (\is_file(__DIR__ . '/../Admin/Settings/Theme/Backend/settings.tpl.php')) {
|
||||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings');
|
||||
} else {
|
||||
$view->setTemplate('/Modules/Admin/Theme/Backend/modules-settings');
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewMediaTypeSettings(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings-type');
|
||||
|
||||
$type = MediaTypeMapper::with('language', $response->getLanguage())::get((int) $request->getData('id'));
|
||||
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response));
|
||||
$view->addData('type', $type);
|
||||
|
||||
$l11n = MediaTypeL11nMapper::with('tag', $type->getId())::getAll();
|
||||
$view->addData('l11n', $l11n);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ class MediaType implements \JsonSerializable, ArrayableInterface
|
|||
*/
|
||||
public string $name = '';
|
||||
|
||||
/**
|
||||
* Is this media type visible in lists or only internal?
|
||||
*
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public bool $isVisible = true;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ final class MediaTypeMapper extends DataMapperAbstract
|
|||
protected static array $columns = [
|
||||
'media_type_id' => ['name' => 'media_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'media_type_name' => ['name' => 'media_type_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'media_type_isvisible' => ['name' => 'media_type_isvisible', 'type' => 'bool', 'internal' => 'isVisible'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -272,6 +272,8 @@ trait ApiControllerMediaTrait
|
|||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$response->header->lock();
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('type', 'html');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user