Fix media file list bugs

This commit is contained in:
Dennis Eichhorn 2018-11-03 16:58:28 +01:00
parent 822cd3ebbe
commit b9239beaa3
2 changed files with 11 additions and 6 deletions

View File

@ -140,7 +140,8 @@ class UploadFile
$result[$key]['extension'] = $extension; $result[$key]['extension'] = $extension;
if ($this->preserveFileName) { if ($this->preserveFileName) {
$this->fileName = $f['name']; $this->fileName = $f['name'];
$result[$key]['filename'] = $this->fileName;
} }
if (empty($this->fileName) || \file_exists($path . '/' . $this->fileName)) { if (empty($this->fileName) || \file_exists($path . '/' . $this->fileName)) {

View File

@ -61,9 +61,13 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Creator') ?> <td><?= $this->getHtml('Creator') ?>
<td><?= $this->getHtml('Created') ?> <td><?= $this->getHtml('Created') ?>
<tbody> <tbody>
<?php if (!is_dir($media->getPath())) : foreach ($media as $key => $value) : <?php
$url = UriFactory::build('/{/lang}/backend/media/single?{?}&id=' . $value->getId()); if (!is_dir($media->isAbsolute() ? $path : __DIR__ . '/../../../' . \ltrim($media->getPath(), '//'))
$icon = $this->fileIconFunction(FileUtils::getExtensionType($value->getExtension())); || $media->getPath() === ''
) :
foreach ($media as $key => $value) :
$url = UriFactory::build('/{/lang}/backend/media/single?{?}&id=' . $value->getId());
$icon = $fileIconFunction(FileUtils::getExtensionType($value->getExtension()));
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><i class="fa fa-<?= $this->printHtml($icon); ?>"></i></a> <td><a href="<?= $url; ?>"><i class="fa fa-<?= $this->printHtml($icon); ?>"></i></a>
@ -103,12 +107,12 @@ echo $this->getData('nav')->render();
<?php else : ?> <?php else : ?>
<button class="floatRight">Edit</button> <button class="floatRight">Edit</button>
<?php if (!\file_exists($media->isAbsolute() ? $path : __DIR__ . '/../../../../' . $path)) : ?> <?php if (!\file_exists($media->isAbsolute() ? $path : __DIR__ . '/../../../' . \ltrim($path, '/'))) : ?>
<div class="centerText"><i class="fa fa-question fa-5x"></i></div> <div class="centerText"><i class="fa fa-question fa-5x"></i></div>
<?php else : ?> <?php else : ?>
<pre> <pre>
<?php <?php
$output = $this->lineContentFunction($media->isAbsolute() ? $path : __DIR__ . '/../../../../' . $path); $output = $this->lineContentFunction($media->isAbsolute() ? $path : __DIR__ . '/../../../' . \ltrim($path, '/'));
foreach ($output as $line) : ?><span><?= $this->printHtml($line); ?></span><?php endforeach; ?> foreach ($output as $line) : ?><span><?= $this->printHtml($line); ?></span><?php endforeach; ?>
</pre> </pre>
<?php endif; ?> <?php endif; ?>