Änderungen im Modul. Ausklappen desd Baumes

This commit is contained in:
Thomas Spohr
2025-08-18 11:58:50 +02:00
parent bd7e720c47
commit 7396cf9f51
4 changed files with 53 additions and 40 deletions

BIN
mod_pdf_tree/.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@@ -53,27 +53,39 @@ class ModEisAnzeigeHelper
$rawName = $item['title'] ?: $item['name'];
$fileId = (int) $item['id'];
// Dateiendung .pdf entfernen
// Dateiendung .pdf entfernen und escapen
$displayName = preg_replace('/\.pdf$/i', '', $rawName);
$displayName = htmlspecialchars($displayName);
$displayName = htmlspecialchars($displayName, ENT_QUOTES, 'UTF-8');
if ($isFolder) {
$fileCount = self::countFilesRecursive($items, $item['id']);
// WICHTIG: Toggle-Element einfügen dein JS hängt hier dran
$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 .= '</li>';
} else {
$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 = '';
if (!empty($item['path']) && file_exists($item['path'])) {
$size = filesize($item['path']);
$tooltip = ' title="Größe: ' . self::formatFileSize($size) . '"';
$sizeStr = '';
if (!empty($item['path']) && is_file($item['path'])) {
$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 .= '📄 <a class="file-link" href="' . $link . '"' . $tooltip . '>' . $displayName . '</a>' . $sizeStr;
$html .= '📄 <a class="file-link" href="' . $link . '"' . $tooltip . '>' . $displayName . '</a>';
$html .= '</li>';
}

View File

@@ -55,6 +55,7 @@
display: inline-block;
user-select: none;
}
.pdf-tree .meta { color: #666; }
/* Optionale visuelle Trennung bei Dateien */
.file-link {