Änderungen im Modul. Ausklappen desd Baumes
This commit is contained in:
BIN
mod_pdf_tree/.DS_Store
vendored
BIN
mod_pdf_tree/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
@@ -53,27 +53,39 @@ class ModEisAnzeigeHelper
|
|||||||
$rawName = $item['title'] ?: $item['name'];
|
$rawName = $item['title'] ?: $item['name'];
|
||||||
$fileId = (int) $item['id'];
|
$fileId = (int) $item['id'];
|
||||||
|
|
||||||
// Dateiendung .pdf entfernen
|
// Dateiendung .pdf entfernen und escapen
|
||||||
$displayName = preg_replace('/\.pdf$/i', '', $rawName);
|
$displayName = preg_replace('/\.pdf$/i', '', $rawName);
|
||||||
$displayName = htmlspecialchars($displayName);
|
$displayName = htmlspecialchars($displayName, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
if ($isFolder) {
|
if ($isFolder) {
|
||||||
$fileCount = self::countFilesRecursive($items, $item['id']);
|
$fileCount = self::countFilesRecursive($items, $item['id']);
|
||||||
|
|
||||||
|
// WICHTIG: Toggle-Element einfügen – dein JS hängt hier dran
|
||||||
$html .= '<li class="folder">';
|
$html .= '<li class="folder">';
|
||||||
$html .= '📁 ' . $displayName . ' <small>(' . $fileCount . ')</small>';
|
$html .= '<span class="toggle" role="button" aria-label="Ordner umschalten" tabindex="0">▶</span> ';
|
||||||
|
$html .= '📁 ' . $displayName . ' <small>(' . (int) $fileCount . ')</small>';
|
||||||
|
|
||||||
|
// Kindknoten
|
||||||
$html .= self::renderTree($items, $item['id']);
|
$html .= self::renderTree($items, $item['id']);
|
||||||
$html .= '</li>';
|
$html .= '</li>';
|
||||||
} else {
|
} else {
|
||||||
$link = Route::_('index.php?option=com_eis&task=download.download&id=' . $fileId);
|
$link = Route::_('index.php?option=com_eis&task=download.download&id=' . $fileId);
|
||||||
|
|
||||||
// Tooltip mit Dateigröße
|
// Tooltip + (neu) inline-Anzeige der Dateigröße, falls der Pfad existiert
|
||||||
$tooltip = '';
|
$tooltip = '';
|
||||||
if (!empty($item['path']) && file_exists($item['path'])) {
|
$sizeStr = '';
|
||||||
$size = filesize($item['path']);
|
if (!empty($item['path']) && is_file($item['path'])) {
|
||||||
$tooltip = ' title="Größe: ' . self::formatFileSize($size) . '"';
|
$size = @filesize($item['path']);
|
||||||
|
if ($size !== false) {
|
||||||
|
$formatted = self::formatFileSize((int) $size);
|
||||||
|
$tooltip = ' title="Größe: ' . $formatted . '"';
|
||||||
|
// Sichtbar neben dem Dateinamen anzeigen
|
||||||
|
//$sizeStr = ' <small class="meta">(' . $formatted . ')</small>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '<li class="file">';
|
$html .= '<li class="file">';
|
||||||
|
//$html .= '📄 <a class="file-link" href="' . $link . '"' . $tooltip . '>' . $displayName . '</a>' . $sizeStr;
|
||||||
$html .= '📄 <a class="file-link" href="' . $link . '"' . $tooltip . '>' . $displayName . '</a>';
|
$html .= '📄 <a class="file-link" href="' . $link . '"' . $tooltip . '>' . $displayName . '</a>';
|
||||||
$html .= '</li>';
|
$html .= '</li>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
.pdf-tree .meta { color: #666; }
|
||||||
|
|
||||||
/* Optionale visuelle Trennung bei Dateien */
|
/* Optionale visuelle Trennung bei Dateien */
|
||||||
.file-link {
|
.file-link {
|
||||||
|
|||||||
Reference in New Issue
Block a user