mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-17 09:48:41 +00:00
continue implementation
This commit is contained in:
parent
dc34899cf3
commit
10b99b6f27
|
|
@ -36,7 +36,7 @@ class BaseView extends View
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected string $form = '';
|
public string $form = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual path of the media file
|
* Virtual path of the media file
|
||||||
|
|
@ -44,7 +44,7 @@ class BaseView extends View
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected string $virtualPath = '';
|
public string $virtualPath = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the image preview
|
* Name of the image preview
|
||||||
|
|
@ -52,7 +52,9 @@ class BaseView extends View
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected string $name = '';
|
public string $name = '';
|
||||||
|
|
||||||
|
public array $files = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
@ -60,7 +62,7 @@ class BaseView extends View
|
||||||
public function __construct(L11nManager $l11n = null, RequestAbstract $request, ResponseAbstract $response)
|
public function __construct(L11nManager $l11n = null, RequestAbstract $request, ResponseAbstract $response)
|
||||||
{
|
{
|
||||||
parent::__construct($l11n, $request, $response);
|
parent::__construct($l11n, $request, $response);
|
||||||
$this->setTemplate('/Modules/Media/Theme/Backend/Components/Upload/upload');
|
$this->setTemplate('/Modules/Media/Theme/Backend/Components/Upload/upload-list');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,7 +73,8 @@ class BaseView extends View
|
||||||
/** @var array{0:string, 1?:string, 2?:string} $data */
|
/** @var array{0:string, 1?:string, 2?:string} $data */
|
||||||
$this->form = $data[0];
|
$this->form = $data[0];
|
||||||
$this->name = $data[1] ?? 'UNDEFINED';
|
$this->name = $data[1] ?? 'UNDEFINED';
|
||||||
$this->virtualPath = $data[2] ?? '';
|
$this->virtualPath = $data[2] ?? $this->virtualPath;
|
||||||
|
$this->files = $data[3] ?? $this->files;
|
||||||
return parent::render();
|
return parent::render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
111
Theme/Backend/Components/Upload/upload-list.tpl.php
Executable file
111
Theme/Backend/Components/Upload/upload-list.tpl.php
Executable file
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Karaka
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\Media
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use phpOMS\Uri\UriFactory;
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-md-6">
|
||||||
|
<div class="portlet">
|
||||||
|
<div class="portlet-head"><?= $this->getHtml('Upload', 'Media', 'Backend'); ?></div>
|
||||||
|
<form id="<?= $this->form; ?>-upload">
|
||||||
|
<div class="portlet-body">
|
||||||
|
<table class="layout wf-100">
|
||||||
|
<tbody>
|
||||||
|
<tr><td><label for="iMedia"><?= $this->getHtml('Media', 'Media', 'Backend'); ?></label>
|
||||||
|
<tr><td>
|
||||||
|
<div class="ipt-wrap">
|
||||||
|
<div class="ipt-first">
|
||||||
|
<div class="advancedInput wf-100" id="iMediaInput">
|
||||||
|
<input autocomplete="off" class="input" id="mediaInput" name="mediaFile" type="text"
|
||||||
|
data-emptyAfter="true"
|
||||||
|
data-autocomplete="off"
|
||||||
|
data-src="api/media/find?search={!#mediaInput}">
|
||||||
|
<div id="iMediaInput-popup" class="popup" data-active="true">
|
||||||
|
<table id="iMediaInput-table" class="default">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
|
<td><?= $this->getHtml('Name', 'Media', 'Backend'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
|
<tbody>
|
||||||
|
<template id="iMediaInput-rowElement" class="rowTemplate">
|
||||||
|
<tr tabindex="-1">
|
||||||
|
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
||||||
|
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ipt-second"><button><?= $this->getHtml('Select', 'Media', 'Backend'); ?></button></div>
|
||||||
|
</div>
|
||||||
|
<tr><td><label for="iUpload"><?= $this->getHtml('Upload', 'Media', 'Backend'); ?></label>
|
||||||
|
<tr><td>
|
||||||
|
<input type="hidden" name="virtualPath" form="<?= $this->form; ?>" value="<?= $this->virtualPath; ?>">
|
||||||
|
<input type="file" id="iUpload" name="upload" form="<?= $this->form; ?>" multiple>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="portlet">
|
||||||
|
<div class="portlet-head"><?= $this->getHtml('Files', 'Media', 'Backend'); ?><i class="lni lni-download download btn end-xs"></i></div>
|
||||||
|
<div class="slider">
|
||||||
|
<table class="default">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
|
<td class="wf-100"><?= $this->getHtml('Name', 'Media', 'Backend'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
||||||
|
<tbody id="iMediaInput-tags" class="tags" data-limit="0" data-active="true" data-form="<?= $this->form; ?>">
|
||||||
|
<template id="iMediaInput-tagTemplate">
|
||||||
|
<tr data-tpl-value="/id" data-value="" data-uuid="" data-name="media-list">
|
||||||
|
<td><label class="radio" for="iFile-0">
|
||||||
|
<input id="iFile-0" type="radio" name="media_file" value="">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
||||||
|
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
||||||
|
</template>
|
||||||
|
<?php foreach ($this->files as $file) : ?>
|
||||||
|
<tr data-tpl-value="/id" data-value="" data-uuid="" data-name="media-list">
|
||||||
|
<td><label class="radio" for="iFile-<?= $file->id; ?>">
|
||||||
|
<input id="iFile-<?= $file->id; ?>" type="radio" name="media_file" value="1"<?= \end($this->files)->id === $file->id ? ' checked' : ''; ?>>
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""><?= $this->printHtml((string) $file->id); ?></td>
|
||||||
|
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""><?= $this->printHtml($file->name); ?></td>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if (empty($this->files)) : ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-md-6 col-simple">
|
||||||
|
<section id="mediaFile" class="portlet col-simple">
|
||||||
|
<div class="portlet-body col-simple">
|
||||||
|
<?php if (!empty($this->files)) : ?>
|
||||||
|
<iframe class="col-simple" id="iMediaFile" src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}media/export?id=' . \end($this->files)->id)); ?>" loading="lazy" allowfullscreen></iframe>
|
||||||
|
<?php else : ?>
|
||||||
|
<img width="100%" src="Web/Backend/img/logo_grey.png">
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
<div class="portlet">
|
|
||||||
<div class="portlet-head"><?= $this->getHtml('Media'); ?></div>
|
|
||||||
<form id="<?= $this->form; ?>-upload">
|
|
||||||
<div class="portlet-body">
|
|
||||||
<table class="layout wf-100">
|
|
||||||
<tbody>
|
|
||||||
<tr><td><label for="iMedia"><?= $this->getHtml('Media'); ?></label>
|
|
||||||
<tr><td>
|
|
||||||
<div class="ipt-wrap">
|
|
||||||
<div class="ipt-first">
|
|
||||||
<div class="advancedInput wf-100" id="iMediaInput">
|
|
||||||
<input autocomplete="off" class="input" id="mediaInput" name="mediaFile" type="text"
|
|
||||||
data-emptyAfter="true"
|
|
||||||
data-autocomplete="off"
|
|
||||||
data-src="api/media/find?search={!#mediaInput}">
|
|
||||||
<div id="iMediaInput-popup" class="popup" data-active="true">
|
|
||||||
<table id="iMediaInput-table" class="default">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
|
||||||
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
|
||||||
<td>Extension<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
|
||||||
<tbody>
|
|
||||||
<template id="iMediaInput-rowElement" class="rowTemplate">
|
|
||||||
<tr tabindex="-1">
|
|
||||||
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
|
||||||
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
|
||||||
<td data-tpl-text="/extension"></td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="ipt-second"><button><?= $this->getHtml('Select', 'Media'); ?></button></div>
|
|
||||||
</div>
|
|
||||||
<tr><td><label for="iUpload"><?= $this->getHtml('Upload', 'Media'); ?></label>
|
|
||||||
<tr><td>
|
|
||||||
<input type="hidden" name="virtualPath" form="<?= $this->form; ?>" value="<?= $this->virtualPath; ?>">
|
|
||||||
<input type="file" id="iUpload" name="upload" form="<?= $this->form; ?>" multiple>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="box wf-100">
|
|
||||||
<table class="default">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
|
||||||
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
|
||||||
<td>Extension<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
|
|
||||||
<tbody id="iMediaInput-tags" class="tags" data-limit="0" data-active="true" data-form="<?= $this->form; ?>">
|
|
||||||
<template id="iMediaInput-tagTemplate">
|
|
||||||
<tr data-tpl-value="/id" data-value="" data-uuid="" data-name="media-list">
|
|
||||||
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
|
|
||||||
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
|
|
||||||
<td data-tpl-text="/extension"></td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
@ -89,7 +89,7 @@ $next = empty($media) ? '{/base}/media/list' : '{/base}/media/list?{?}&id='
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="portlet">
|
<div class="portlet">
|
||||||
<div class="portlet-head">
|
<div class="portlet-head">
|
||||||
<?= $this->getHtml('Media'); ?><i class="fa fa-download floatRight download btn"></i>
|
<?= $this->getHtml('Media'); ?><i class="fa fa-download end-xs download btn"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="slider">
|
<div class="slider">
|
||||||
<table id="iMediaList" class="default sticky">
|
<table id="iMediaList" class="default sticky">
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ echo $this->data['nav']->render();
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<?php if ($this->request->getData('path') !== null) : ?>
|
<?php if ($this->request->getData('path') !== null) : ?>
|
||||||
<a tabindex="0" class="button" href="<?= UriFactory::build('{/base}/media/list?path=' . ($media->id === 0 ? $media->getVirtualPath() : '{?path}')); ?>"><?= $this->getHtml('Back'); ?></a>
|
<a tabindex="0" class="button" href="<?= UriFactory::build('{/app}/media/list?path=' . ($media->id === 0 ? $media->getVirtualPath() : '{?path}')); ?>"><?= $this->getHtml('Back'); ?></a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a tabindex="0" class="button" href="<?= $this->request->getReferer() !== '' ? $this->request->getReferer() : UriFactory::build('{/base}/media/list'); ?>"><?= $this->getHtml('Back'); ?></a>
|
<a tabindex="0" class="button" href="<?= $this->request->getReferer() !== '' ? $this->request->getReferer() : UriFactory::build('{/app}/media/list'); ?>"><?= $this->getHtml('Back'); ?></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -52,8 +52,8 @@ echo $this->data['nav']->render();
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<ul class="crumbs-2">
|
<ul class="crumbs-2">
|
||||||
<li data-href="<?= UriFactory::build('{/base}/media/list?path=/Accounts/' . $accountDir); ?>"><a href="<?= UriFactory::build('{/base}/media/list?path=/Accounts/' . $accountDir); ?>"><i class="fa fa-home"></i></a>
|
<li data-href="<?= UriFactory::build('{/app}/media/list?path=/Accounts/' . $accountDir); ?>"><a href="<?= UriFactory::build('{/app}/media/list?path=/Accounts/' . $accountDir); ?>"><i class="fa fa-home"></i></a>
|
||||||
<li data-href="<?= UriFactory::build('{/base}/media/list?path=/'); ?>"><a href="<?= UriFactory::build('{/base}/media/list?path=/'); ?>">/</a></li>
|
<li data-href="<?= UriFactory::build('{/app}/media/list?path=/'); ?>"><a href="<?= UriFactory::build('{/app}/media/list?path=/'); ?>">/</a></li>
|
||||||
<?php
|
<?php
|
||||||
$subPath = '';
|
$subPath = '';
|
||||||
$paths = \explode('/', \ltrim($mediaPath, '/'));
|
$paths = \explode('/', \ltrim($mediaPath, '/'));
|
||||||
|
|
@ -71,7 +71,7 @@ echo $this->data['nav']->render();
|
||||||
|
|
||||||
$subPath .= '/' . $paths[$i];
|
$subPath .= '/' . $paths[$i];
|
||||||
|
|
||||||
$url = UriFactory::build('{/base}/media/list?path=' . $subPath);
|
$url = UriFactory::build('{/app}/media/list?path=' . $subPath);
|
||||||
?>
|
?>
|
||||||
<li data-href="<?= $url; ?>"<?= $i === $length - 1 ? 'class="active"' : ''; ?>><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li>
|
<li data-href="<?= $url; ?>"<?= $i === $length - 1 ? 'class="active"' : ''; ?>><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
|
|
@ -92,7 +92,7 @@ echo $this->data['nav']->render();
|
||||||
$size = FileSizeType::autoFormat($media->size);
|
$size = FileSizeType::autoFormat($media->size);
|
||||||
echo $this->printHtml(\number_format($size[0], 1, '.', ',') . $size[1]); ?>
|
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('Created'); ?><td><?= $this->printHtml($media->createdAt->format('Y-m-d')); ?>
|
||||||
<tr><td><?= $this->getHtml('Creator'); ?><td><a href="<?= UriFactory::build('{/base}/profile/single?for=' . $media->createdBy->id); ?>"><?= $this->printHtml(
|
<tr><td><?= $this->getHtml('Creator'); ?><td><a href="<?= UriFactory::build('{/app}/profile/single?for=' . $media->createdBy->id); ?>"><?= $this->printHtml(
|
||||||
\ltrim($media->createdBy->name2 . ', ' . $media->createdBy->name1, ', ')
|
\ltrim($media->createdBy->name2 . ', ' . $media->createdBy->name1, ', ')
|
||||||
); ?></a>
|
); ?></a>
|
||||||
<tr><td><?= $this->getHtml('Tags'); ?><td>
|
<tr><td><?= $this->getHtml('Tags'); ?><td>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user