mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-01-29 17:18:39 +00:00
Fixing upload bugs
This commit is contained in:
parent
537b9291ab
commit
918ca094aa
|
|
@ -21,7 +21,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<section class="box w-50">
|
||||
<header><h1><?= $this->l11n->lang['Media']['Upload']; ?></h1></header>
|
||||
<div class="inner">
|
||||
<form method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/media/create'); ?>">
|
||||
<form method="POST" id="media-uploader" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/media'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iName"><?= $this->l11n->lang['Media']['Name']; ?></label>
|
||||
<tr><td><input type="text" id="iName" name="name" placeholder="">
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@
|
|||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
|
||||
$mediaMapper = new \Modules\Media\Models\MediaMapper($this->app->dbPool->get());
|
||||
$media = $mediaMapper->getNewest(25);
|
||||
|
||||
$media = \Modules\Media\Models\MediaMapper::getNewest(25);
|
||||
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
|
||||
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
|
||||
$footerView->setPages(count($media) / 25);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
/**
|
||||
* @var $media \Modules\Media\Models\Media
|
||||
*/
|
||||
$media = $this->getData('media');
|
||||
echo $this->getData('nav')->render();
|
||||
?>
|
||||
|
|
@ -23,10 +26,24 @@ echo $this->getData('nav')->render();
|
|||
<section class="box w-100">
|
||||
<header><h1><?= $media->getName() ?></h1></header>
|
||||
<div class="inner">
|
||||
<table class="list w-100">
|
||||
<tbody>
|
||||
<tr><td>Size<td class="wf-100"><?= $media->getSize(); ?>
|
||||
<tr><td>Created at<td><?= $media->getCreatedAt()->format('Y-m-d'); ?>
|
||||
<tr><td>Created by<td><?= $media->getCreatedBy(); ?>
|
||||
<tr><td>Description<td><?= $media->getDescription(); ?>
|
||||
<tr><td colspan="2">Content
|
||||
</table>
|
||||
<?php if(in_array($media->getExtension(), ['gif', 'bmp', 'jpg', 'jpeg', 'png'])) : ?>
|
||||
<img src="<?= $media->getPath(); ?>">
|
||||
<img src="<?= $this->request->getUri()->getBase() . $media->getPath(); ?>">
|
||||
<?php else : ?>
|
||||
<pre><?= htmlspecialchars(file_get_contents(ROOT_PATH . '/' . $media->getPath())); ?></pre>
|
||||
<pre>
|
||||
<?php
|
||||
$output = htmlspecialchars(file_get_contents(ROOT_PATH . '/' . $media->getPath()));
|
||||
$output = str_replace(["\r\n", "\r"], "\n", $output);
|
||||
$output = explode("\n", $output);
|
||||
foreach($output as $line) : ?><span><?= $line; ?></span><?php endforeach; ?>
|
||||
</pre>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user