mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
Duplicate names attachments
Problem: The browser view for attachments displayed the attachment name twice. With the change, only the filename is shown, which improves clarity.
This commit is contained in:
parent
544b926c9e
commit
15eb21378e
1 changed files with 17 additions and 12 deletions
|
@ -35,7 +35,7 @@ class Browser extends BaseModule
|
||||||
{
|
{
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||||
|
|
||||||
$this->session = $session;
|
$this->session = $session;
|
||||||
$this->appHelper = $appHelper;
|
$this->appHelper = $appHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,15 +55,16 @@ class Browser extends BaseModule
|
||||||
|
|
||||||
$fileArray = array_map([$this, 'map_files'], $files);
|
$fileArray = array_map([$this, 'map_files'], $files);
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('media/browser.tpl');
|
$tpl = Renderer::getMarkupTemplate('media/browser.tpl');
|
||||||
|
|
||||||
$output = Renderer::replaceMacros($tpl, [
|
$output = Renderer::replaceMacros($tpl, [
|
||||||
'$type' => 'attachment',
|
'$type' => 'attachment',
|
||||||
'$path' => ['' => $this->t('Files')],
|
'$path' => ['' => $this->t('Files')],
|
||||||
'$folders' => false,
|
'$folders' => false,
|
||||||
'$files' => $fileArray,
|
'$files' => $fileArray,
|
||||||
'$cancel' => $this->t('Cancel'),
|
'$cancel' => $this->t('Cancel'),
|
||||||
'$nickname' => $this->session->getLocalUserNickname(),
|
'$nickname' => $this->session->getLocalUserNickname(),
|
||||||
'$upload' => $this->t('Upload'),
|
'$upload' => $this->t('Upload'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (empty($request['mode'])) {
|
if (empty($request['mode'])) {
|
||||||
|
@ -76,12 +77,16 @@ class Browser extends BaseModule
|
||||||
protected function map_files(array $record): array
|
protected function map_files(array $record): array
|
||||||
{
|
{
|
||||||
list($m1, $m2) = explode('/', $record['filetype']);
|
list($m1, $m2) = explode('/', $record['filetype']);
|
||||||
$filetype = file_exists(sprintf('images/icons/%s.png', $m1) ? $m1 : 'text');
|
$filetype = file_exists('images/icons/' . $m1 . '.png') ? $m1 : 'text';
|
||||||
|
$iconUrl = sprintf('%s/images/icon/16/%s.png', $this->baseUrl, $filetype);
|
||||||
|
$fileUrl = sprintf('%s/attach/%s', $this->baseUrl, $record['id']);
|
||||||
|
|
||||||
|
// Erstellen Sie ein Array mit den notwendigen Informationen
|
||||||
return [
|
return [
|
||||||
sprintf('%s/attach/%s', $this->baseUrl, $record['id']),
|
$fileUrl, // $f.0
|
||||||
$record['filename'],
|
$record['filename'], // $f.1
|
||||||
sprintf('%s/images/icon/16/%s.png', $this->baseUrl, $filetype),
|
$iconUrl, // $f.2
|
||||||
|
$record['filename'] // $f.3
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue