permission changes & minor bug fixes

This commit is contained in:
Dennis Eichhorn 2022-11-09 22:56:18 +01:00
parent b025126d18
commit 9d9221b823
73 changed files with 47 additions and 29 deletions

0
Admin/Settings/Theme/Backend/settings-type.tpl.php Normal file → Executable file
View File

2
Admin/Settings/Theme/Backend/settings.tpl.php Normal file → Executable file
View File

@ -69,7 +69,7 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $count = 0;
foreach ($types as $key => $type) : ++$count;
$url = UriFactory::build('{/prefix}admin/module/settings?id=Media&type=' . $type->getId()); ?>
$url = UriFactory::build('admin/module/settings?id=Media&type=' . $type->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $type->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($type->name); ?></a>

View File

@ -236,7 +236,7 @@ final class BackendController extends Controller
->where('tags/title/language', $request->getLanguage())
->execute();
if ($media->extension === 'collection') {
if ($media->class === MediaClass::COLLECTION) {
/** @var \Modules\Media\Models\Media[] $files */
$files = MediaMapper::getByVirtualPath(
$media->getVirtualPath() . ($media->getVirtualPath() !== '/' ? '/' : '') . $media->name
@ -256,7 +256,20 @@ final class BackendController extends Controller
$listView->setTemplate('/modules/Media/Theme/Backend/Components/Media/list');
$view->addData('view', $listView);
} else {
$view->addData('view', $this->createMediaView($media, $request, $response));
if ($media->class === MediaClass::REFERENCE) {
$media->source = MediaMapper::get()
->with('createdBy')
->with('tags')
->with('tags/title')
->with('content')
->where('id', $media->source->getId())
->where('tags/title/language', $request->getLanguage())
->execute();
$view->addData('view', $this->createMediaView($media->source, $request, $response));
} else {
$view->addData('view', $this->createMediaView($media, $request, $response));
}
}
}
}

0
ICAL.txt Normal file → Executable file
View File

0
Models/MediaClass.php Normal file → Executable file
View File

0
Models/MediaContent.php Normal file → Executable file
View File

0
Models/MediaContentMapper.php Normal file → Executable file
View File

0
Models/MediaStatus.php Normal file → Executable file
View File

0
Models/MediaType.php Normal file → Executable file
View File

0
Models/MediaTypeL11n.php Normal file → Executable file
View File

0
Models/MediaTypeL11nMapper.php Normal file → Executable file
View File

0
Models/MediaTypeMapper.php Normal file → Executable file
View File

0
Models/NullMediaContent.php Normal file → Executable file
View File

0
Models/NullMediaType.php Normal file → Executable file
View File

0
Models/NullMediaTypeL11n.php Normal file → Executable file
View File

0
Models/NullReference.php Normal file → Executable file
View File

0
Models/Reference.php Normal file → Executable file
View File

0
Models/ReferenceMapper.php Normal file → Executable file
View File

View File

@ -5,9 +5,9 @@
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
]
}

View File

@ -38,7 +38,7 @@ $next = empty($this->media)
<td><?= $this->getHtml('Created', 'Media'); ?>
<tbody>
<?php $count = 0; foreach ($this->media as $key => $value) : ++$count;
$url = UriFactory::build('{/prefix}media/single?{?}&id=' . $value->getId());
$url = UriFactory::build('media/single?{?}&id=' . $value->getId());
$icon = '';
$extensionType = FileUtils::getExtensionType($value->extension);
@ -46,7 +46,7 @@ $next = empty($this->media)
?>
<tr data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('Type'); ?>"><a href="<?= $url; ?>"><i class="fa fa-<?= $this->printHtml($icon); ?>"></i></a>
<td data-label="<?= $this->getHtml('Path'); ?>"><a class="content" href="<?= UriFactory::build('{/prefix}media/list?{?}&path=' . $value->getVirtualPath()); ?>"><?= $this->printHtml($value->getVirtualPath()); ?></a>
<td data-label="<?= $this->getHtml('Path'); ?>"><a class="content" href="<?= UriFactory::build('media/list?{?}&path=' . $value->getVirtualPath()); ?>"><?= $this->printHtml($value->getVirtualPath()); ?></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Extension'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->extension); ?></a>
<td data-label="<?= $this->getHtml('Size'); ?>"><a href="<?= $url; ?>"><?= $value->size; ?></a>

0
Theme/Backend/Lang/Navigation.ar.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.cs.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.da.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.de.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.el.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.en.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.es.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.fi.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.fr.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.hu.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.it.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.ja.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.ko.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.no.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.pl.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.pt.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.ru.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.sv.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.th.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.tr.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.uk.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/Navigation.zh.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ar.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/cs.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/da.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/de.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/el.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/en.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/es.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/fi.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/fr.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/hu.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/it.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ja.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ko.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/no.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/pl.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/pt.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/ru.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/sv.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/th.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/tr.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/uk.lang.php Normal file → Executable file
View File

0
Theme/Backend/Lang/zh.lang.php Normal file → Executable file
View File

View File

@ -22,7 +22,7 @@ use phpOMS\Uri\UriFactory;
<div class="row">
<div class="col-xs-12">
<div class="box">
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/list?path={?path}'); ?>"><?= $this->getHtml('Back', '0', '0'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build('media/list?path={?path}'); ?>"><?= $this->getHtml('Back', '0', '0'); ?></a>
</div>
</div>
</div>

View File

@ -39,7 +39,7 @@ use phpOMS\Uri\UriFactory;
<div class="col-xs-12 col-md-4">
<div class="box">
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/list?path={?path}'); ?>"><?= $this->getHtml('Back'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build('media/list?path={?path}'); ?>"><?= $this->getHtml('Back'); ?></a>
</div>
<div class="portlet">

View File

@ -30,20 +30,20 @@ $media = $this->getData('media') ?? [];
$account = $this->getData('account');
$accountDir = $account->getId() . ' ' . $account->login;
$previous = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=' . \reset($media)->getId() . '&ptype=p';
$next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=' . \end($media)->getId() . '&ptype=n';
$previous = empty($media) ? 'media/list' : 'media/list?{?}&id=' . \reset($media)->getId() . '&ptype=p';
$next = empty($media) ? 'media/list' : 'media/list?{?}&id=' . \end($media)->getId() . '&ptype=n';
?>
<div class="row">
<div class="col-xs-12">
<div class="box">
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/upload?path={?path}'); ?>">
<a tabindex="0" class="button" href="<?= UriFactory::build('media/upload?path={?path}'); ?>">
<?= $this->getHtml('Upload'); ?>
</a>
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/file/create?path={?path}'); ?>">
<a tabindex="0" class="button" href="<?= UriFactory::build('media/file/create?path={?path}'); ?>">
<?= $this->getHtml('CreateFile'); ?>
</a>
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/collection/create?path={?path}'); ?>">
<a tabindex="0" class="button" href="<?= UriFactory::build('media/collection/create?path={?path}'); ?>">
<?= $this->getHtml('CreateCollection'); ?>
</a>
</div>
@ -54,9 +54,9 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
<div class="col-xs-12">
<div class="box">
<ul class="crumbs-2">
<li data-href="<?= $uri = UriFactory::build('{/prefix}media/list?path=/Accounts/' . $accountDir); ?>">
<li data-href="<?= $uri = UriFactory::build('media/list?path=/Accounts/' . $accountDir); ?>">
<a href="<?= $uri; ?>"><i class="fa fa-home"></i></a>
<li data-href="<?= $uri = UriFactory::build('{/prefix}media/list?path=/'); ?>">
<li data-href="<?= $uri = UriFactory::build('media/list?path=/'); ?>">
<a href="<?= $uri; ?>">/</a>
<?php
$subPath = '';
@ -75,7 +75,7 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
$subPath .= '/' . $paths[$i];
$url = UriFactory::build('{/prefix}media/list?path=' . $subPath);
$url = UriFactory::build('media/list?path=' . $subPath);
?>
<li data-href="<?= $url; ?>"<?= $i === $length - 1 ? 'class="active"' : ''; ?>>
<a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a>
@ -166,7 +166,7 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
</label>
<tbody>
<?php if (!empty($parentPath)) :
$url = UriFactory::build('{/prefix}media/list?path=' . $parentPath);
$url = UriFactory::build('media/list?path=' . $parentPath);
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td>
@ -186,8 +186,8 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
++$count;
$url = $value->extension === 'collection'
? UriFactory::build('{/prefix}media/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->name)
: UriFactory::build('{/prefix}media/single?id=' . $value->getId()
? UriFactory::build('media/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->name)
: UriFactory::build('media/single?id=' . $value->getId()
. '&path={?path}' . (
$value->getId() === 0
? '/' . $value->name
@ -220,7 +220,7 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
$size = FileSizeType::autoFormat($value->size);
echo $this->printHtml($value->extension !== 'collection' ? \number_format($size[0], 1, '.', ',') . $size[1] : ''); ?></a>
<td data-label="<?= $this->getHtml('Creator'); ?>">
<a class="content" href="<?= UriFactory::build('{/prefix}profile/single?{?}&for=' . $value->createdBy->getId()); ?>">
<a class="content" href="<?= UriFactory::build('profile/single?{?}&for=' . $value->createdBy->getId()); ?>">
<?= $this->printHtml($this->renderUserName(
'%3$s %2$s %1$s',
[$value->createdBy->name1, $value->createdBy->name2, $value->createdBy->name3, $value->createdBy->login ?? '']
@ -237,7 +237,7 @@ $next = empty($media) ? '{/prefix}media/list' : '{/prefix}media/list?{?}&id=
<div class="portlet-foot">
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
<a tabindex="0" class="button floatRight" href="<?= UriFactory::build('{/prefix}api/media/download'); ?>">
<a tabindex="0" class="button floatRight" href="<?= UriFactory::build('api/media/download'); ?>">
<?= $this->getHtml('Download', '0', '0'); ?>
</a>
</div>

View File

@ -12,6 +12,7 @@
*/
declare(strict_types=1);
use Modules\Media\Models\MediaClass;
use \phpOMS\Uri\UriFactory;
use phpOMS\Utils\Converter\FileSizeType;
@ -39,9 +40,9 @@ echo $this->getData('nav')->render();
<div class="col-xs-12">
<div class="box">
<?php if ($this->request->getData('path') !== null) : ?>
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/list?path=' . ($media->getId() === 0 ? $media->getVirtualPath() : '{?path}')); ?>"><?= $this->getHtml('Back'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build('media/list?path=' . ($media->getId() === 0 ? $media->getVirtualPath() : '{?path}')); ?>"><?= $this->getHtml('Back'); ?></a>
<?php else: ?>
<a tabindex="0" class="button" href="<?= $this->request->getReferer() !== '' ? $this->request->getReferer() : UriFactory::build('{/prefix}media/list'); ?>"><?= $this->getHtml('Back'); ?></a>
<a tabindex="0" class="button" href="<?= $this->request->getReferer() !== '' ? $this->request->getReferer() : UriFactory::build('media/list'); ?>"><?= $this->getHtml('Back'); ?></a>
<?php endif; ?>
</div>
</div>
@ -51,8 +52,8 @@ echo $this->getData('nav')->render();
<div class="col-xs-12">
<div class="box">
<ul class="crumbs-2">
<li data-href="<?= UriFactory::build('{/prefix}media/list?path=/Accounts/' . $accountDir); ?>"><a href="<?= UriFactory::build('{/prefix}media/list?path=/Accounts/' . $accountDir); ?>"><i class="fa fa-home"></i></a>
<li data-href="<?= UriFactory::build('{/prefix}media/list?path=/'); ?>"><a href="<?= UriFactory::build('{/prefix}media/list?path=/'); ?>">/</a></li>
<li data-href="<?= UriFactory::build('media/list?path=/Accounts/' . $accountDir); ?>"><a href="<?= UriFactory::build('media/list?path=/Accounts/' . $accountDir); ?>"><i class="fa fa-home"></i></a>
<li data-href="<?= UriFactory::build('media/list?path=/'); ?>"><a href="<?= UriFactory::build('media/list?path=/'); ?>">/</a></li>
<?php
$subPath = '';
$paths = \explode('/', \ltrim($mediaPath, '/'));
@ -70,7 +71,7 @@ echo $this->getData('nav')->render();
$subPath .= '/' . $paths[$i];
$url = UriFactory::build('{/prefix}media/list?path=' . $subPath);
$url = UriFactory::build('media/list?path=' . $subPath);
?>
<li data-href="<?= $url; ?>"<?= $i === $length - 1 ? 'class="active"' : ''; ?>><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li>
<?php endfor; ?>
@ -91,7 +92,7 @@ echo $this->getData('nav')->render();
$size = FileSizeType::autoFormat($media->size);
echo $this->printHtml(\number_format($size[0], 1, '.', ',') . $size[1]); ?>
<tr><td><?= $this->getHtml('Created'); ?><td><?= $this->printHtml($media->createdAt->format('Y-m-d')); ?>
<tr><td><?= $this->getHtml('Creator'); ?><td><a href="<?= UriFactory::build('{/prefix}profile/single?for=' . $media->createdBy->getId()); ?>"><?= $this->printHtml(
<tr><td><?= $this->getHtml('Creator'); ?><td><a href="<?= UriFactory::build('profile/single?for=' . $media->createdBy->getId()); ?>"><?= $this->printHtml(
\ltrim($media->createdBy->name2 . ', ' . $media->createdBy->name1, ', ')
); ?></a>
<tr><td><?= $this->getHtml('Tags'); ?><td>
@ -121,6 +122,10 @@ echo $this->getData('nav')->render();
</div>
</div>
<?php
$media = $media->class === MediaClass::REFERENCE ? $media->source : $media;
?>
<div class="row" style="height: calc(100% - 85px);">
<div class="col-xs-12">
<?= $view->render($media); ?>

View File

@ -22,7 +22,7 @@ use phpOMS\Uri\UriFactory;
<div class="row">
<div class="col-xs-12">
<div class="box">
<a tabindex="0" class="button" href="<?= UriFactory::build('{/prefix}media/list?path={?path}'); ?>"><?= $this->getHtml('Back', '0', '0'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build('media/list?path={?path}'); ?>"><?= $this->getHtml('Back', '0', '0'); ?></a>
</div>
</div>
</div>

0
tests/Models/MediaTypeL11nTest.php Normal file → Executable file
View File

0
tests/Models/MediaTypeTest.php Normal file → Executable file
View File

0
tests/Models/NullMediaTypeL11nTest.php Normal file → Executable file
View File

0
tests/Models/NullMediaTypeTest.php Normal file → Executable file
View File