Mit neuen Manfest
This commit is contained in:
@@ -4,114 +4,58 @@
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
$hasTree = !empty($this->treeHtml);
|
||||
?>
|
||||
<style>
|
||||
/* Layout */
|
||||
.eis-flex{display:flex;gap:1rem;align-items:flex-start}
|
||||
.eis-tree-wrap{flex:1 1 auto;background:#f9f9f9;border:1px solid #ddd;border-radius:6px;padding:1em}
|
||||
.eis-edit{flex:0 0 360px;background:#fff;border:1px solid #ddd;border-radius:6px;padding:1em}
|
||||
.eis-edit h4{margin:.2rem 0 1rem}
|
||||
|
||||
/* Baum */
|
||||
.pdf-tree{list-style:none;margin:0;padding:0}
|
||||
.pdf-tree ul{list-style:none;margin-left:1.25em;padding:0;display:none}
|
||||
.pdf-tree li{margin:.35em 0}
|
||||
.folder>.toggle{cursor:pointer;width:1.25em;display:inline-block;user-select:none}
|
||||
.folder>.folder-label,.file>.file-label{cursor:pointer;user-select:none}
|
||||
.pdf-tree .meta{color:#666}
|
||||
.pdf-tree .count{color:#999}
|
||||
.pdf-tree .is-selected{background:rgba(0,0,0,.06);border-radius:3px}
|
||||
|
||||
/* Steuerleiste */
|
||||
.controls{margin-bottom:.75em}
|
||||
.controls button{margin-right:.5em}
|
||||
|
||||
/* Form */
|
||||
.control-group{margin-bottom:.6rem}
|
||||
.form-help{color:#666;font-size:.9em}
|
||||
</style>
|
||||
|
||||
<!-- Scan-Formular -->
|
||||
<form action="<?php echo Route::_('index.php?option=com_eis&task=display.scan'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<div class="form-horizontal">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo Text::_('COM_EIS_DOCUMENT_PATH'); ?></legend>
|
||||
<!-- Optional: Hier später Pfad aus Einstellungen anzeigen -->
|
||||
</fieldset>
|
||||
|
||||
<div class="mt-2">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<?php echo Text::_('COM_EIS_SCAN_DOCUMENTS'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<form action="<?php echo Route::_('index.php?option=com_eis&task=display.scan'); ?>" method="post" id="eis-scan-form">
|
||||
<fieldset class="adminform">
|
||||
<legend><?php echo Text::_('COM_EIS_DOCUMENT_PATH'); ?></legend>
|
||||
<div class="form-help"><?php echo Text::_('COM_EIS_SETTINGS_TITLE'); ?> · <?php echo Text::_('COM_EIS_FIELD_DOCUMENT_ROOT_LABEL'); ?></div>
|
||||
</fieldset>
|
||||
<div class="mt-2">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<?php echo Text::_('COM_EIS_SCAN_DOCUMENTS'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
<?php $hasTree = !empty($this->treeHtml); ?>
|
||||
|
||||
<?php if (!$hasTree): ?>
|
||||
<p class="text-muted">
|
||||
<?php echo Text::_('COM_EIS_NO_DOCUMENTS_FOUND') ?: 'Noch keine Dokumente in der Datenbank. Bitte zuerst „Dokumente einlesen“ ausführen.'; ?>
|
||||
<?php echo Text::_('COM_EIS_NO_DOCUMENTS_FOUND'); ?>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
|
||||
<style>
|
||||
/* Layout */
|
||||
.eis-flex {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.eis-tree-wrap {
|
||||
flex: 1 1 auto;
|
||||
background: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.eis-edit {
|
||||
flex: 0 0 360px;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
.eis-edit h4 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* Baum */
|
||||
.pdf-tree {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pdf-tree ul {
|
||||
list-style: none;
|
||||
margin-left: 1.5em;
|
||||
padding: 0;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Unterebenen eingeklappt */
|
||||
.pdf-tree li {
|
||||
margin: .3em 0;
|
||||
}
|
||||
|
||||
.folder>.toggle {
|
||||
cursor: pointer;
|
||||
width: 1em;
|
||||
display: inline-block;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.folder>.folder-label,
|
||||
.file>.file-label {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.pdf-tree .meta {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.pdf-tree .count {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* Steuerleiste */
|
||||
.controls {
|
||||
margin-bottom: .75em;
|
||||
}
|
||||
|
||||
.controls button {
|
||||
margin-right: .5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h3 class="mt-3"><?php echo Text::_('COM_EIS_PDF_TREE') ?: 'PDF-Baum'; ?></h3>
|
||||
<h3 class="mt-3"><?php echo Text::_('COM_EIS_PDF_TREE'); ?></h3>
|
||||
|
||||
<div class="eis-flex">
|
||||
|
||||
@@ -119,14 +63,14 @@ use Joomla\CMS\Language\Text;
|
||||
<div class="eis-tree-wrap">
|
||||
<div class="controls">
|
||||
<button id="eis-expand-all" type="button" class="btn btn-sm btn-secondary">
|
||||
<?php echo Text::_('JGLOBAL_EXPAND_ALL') ?: 'Ausklappen'; ?>
|
||||
<?php echo Text::_('COM_EIS_EXPAND_ALL'); ?>
|
||||
</button>
|
||||
<button id="eis-collapse-all" type="button" class="btn btn-sm btn-secondary">
|
||||
<?php echo Text::_('JGLOBAL_COLLAPSE_ALL') ?: 'Einklappen'; ?>
|
||||
<?php echo Text::_('COM_EIS_COLLAPSE_ALL'); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="tree">
|
||||
<div class="tree" id="eis-tree" role="tree" aria-label="<?php echo Text::_('COM_EIS_PDF_TREE'); ?>">
|
||||
<?php echo $this->treeHtml; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -134,24 +78,27 @@ use Joomla\CMS\Language\Text;
|
||||
<!-- Rechte Seite: Inline-Bearbeitungsformular -->
|
||||
<div class="eis-edit">
|
||||
<h4><?php echo Text::_('COM_EIS_EDIT_TITLE') ?: 'Anzeigename bearbeiten'; ?></h4>
|
||||
<form action="<?php echo Route::_('index.php?option=com_eis&task=display.rename'); ?>" method="post" id="eis-rename-form">
|
||||
|
||||
<form action="<?php echo Route::_('index.php?option=com_eis&task=display.rename'); ?>" method="post" id="eis-rename-form" novalidate>
|
||||
<div class="control-group">
|
||||
<label for="eis-current-name"><?php echo Text::_('COM_EIS_FIELD_NAME') ?: 'Originalname'; ?></label>
|
||||
<input type="text" id="eis-current-name" class="form-control" value="" readonly>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="margin-top:.5rem;">
|
||||
<div class="control-group">
|
||||
<label for="eis-title"><?php echo Text::_('COM_EIS_FIELD_TITLE') ?: 'Anzeigename (optional)'; ?></label>
|
||||
<input type="text" name="title" id="eis-title" class="form-control" value="" placeholder="<?php echo Text::_('COM_EIS_PLACEHOLDER_TITLE') ?: 'Leer lassen = automatisch aus Dateiname'; ?>">
|
||||
<input type="text" name="title" id="eis-title" class="form-control" value=""
|
||||
placeholder="<?php echo Text::_('COM_EIS_PLACEHOLDER_TITLE') ?: 'Leer lassen = automatisch aus Dateiname'; ?>">
|
||||
<div class="form-help"><?php echo Text::_('COM_EIS_FILESIZE'); ?>: <span id="eis-filesize">–</span></div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" id="eis-id" value="">
|
||||
|
||||
<div style="margin-top:.75rem;">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<?php echo Text::_('JSAVE') ?: 'Speichern'; ?>
|
||||
<div class="mt-2">
|
||||
<button type="submit" class="btn btn-success" id="eis-save" disabled>
|
||||
<?php echo Text::_('JSAVE'); ?>
|
||||
</button>
|
||||
<button type="button" id="eis-clear-title" class="btn btn-light">
|
||||
<button type="button" id="eis-clear-title" class="btn btn-light" disabled>
|
||||
<?php echo Text::_('JDEFAULT') ?: 'Zurücksetzen'; ?>
|
||||
</button>
|
||||
</div>
|
||||
@@ -162,64 +109,76 @@ use Joomla\CMS\Language\Text;
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const wrap = document.querySelector('.eis-tree-wrap');
|
||||
const form = document.getElementById('eis-rename-form');
|
||||
const idField = document.getElementById('eis-id');
|
||||
const nameField = document.getElementById('eis-current-name');
|
||||
const titleField = document.getElementById('eis-title');
|
||||
const clearBtn = document.getElementById('eis-clear-title');
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const tree = document.getElementById('eis-tree');
|
||||
const form = document.getElementById('eis-rename-form');
|
||||
const idFld = document.getElementById('eis-id');
|
||||
const nameFld = document.getElementById('eis-current-name');
|
||||
const titleFld= document.getElementById('eis-title');
|
||||
const sizeOut = document.getElementById('eis-filesize');
|
||||
const btnSave = document.getElementById('eis-save');
|
||||
const btnClr = document.getElementById('eis-clear-title');
|
||||
|
||||
if (!wrap || !form) return;
|
||||
if (!tree || !form) return;
|
||||
|
||||
// Einzelnes Toggle: Caret ODER Label
|
||||
wrap.addEventListener('click', (e) => {
|
||||
let lastSelected;
|
||||
|
||||
// Toggle (Caret) & Auswahl
|
||||
tree.addEventListener('click', (e) => {
|
||||
const t = e.target;
|
||||
|
||||
// Toggle (Caret oder Label für Ordner)
|
||||
// Ein-/Ausklappen
|
||||
if (t.classList.contains('toggle') || t.classList.contains('folder-label')) {
|
||||
const li = t.closest('li.folder');
|
||||
if (li) {
|
||||
// direkte Kind-UL finden
|
||||
let childUl = null;
|
||||
for (const el of li.children) {
|
||||
if (el.tagName === 'UL') {
|
||||
childUl = el;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const childUl = li.querySelector(':scope > ul');
|
||||
if (childUl) {
|
||||
const open = childUl.style.display === 'block';
|
||||
childUl.style.display = open ? 'none' : 'block';
|
||||
const caret = li.querySelector(':scope > .toggle') || li.querySelector('.toggle');
|
||||
const caret = li.querySelector(':scope > .toggle');
|
||||
if (caret) caret.textContent = open ? '▶' : '▼';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Auswahl fürs Bearbeiten: Klick auf Ordner- oder Datei-Label
|
||||
// Auswahl für Bearbeitung (Ordner- oder Datei-Label)
|
||||
if (t.classList.contains('folder-label') || t.classList.contains('file-label')) {
|
||||
const li = t.closest('li');
|
||||
if (!li) return;
|
||||
|
||||
const id = li.getAttribute('data-id') || '';
|
||||
const title = li.getAttribute('data-title') || '';
|
||||
const name = li.getAttribute('data-name') || '';
|
||||
// Visuelles Highlight
|
||||
if (lastSelected) lastSelected.classList.remove('is-selected');
|
||||
t.classList.add('is-selected');
|
||||
lastSelected = t;
|
||||
|
||||
idField.value = id;
|
||||
nameField.value = name;
|
||||
titleField.value = title;
|
||||
titleField.focus();
|
||||
// Daten aus data-Attributen (TreeHelper muss sie setzen)
|
||||
const id = li.getAttribute('data-id') || '';
|
||||
const title = li.getAttribute('data-title') || '';
|
||||
const name = li.getAttribute('data-name') || '';
|
||||
const size = li.getAttribute('data-size') || ''; // optional
|
||||
|
||||
|
||||
idFld.value = id;
|
||||
nameFld.value = name;
|
||||
titleFld.value= title;
|
||||
sizeOut.textContent = size || '–';
|
||||
|
||||
// Buttons ermöglichen
|
||||
btnSave.disabled = !id;
|
||||
btnClr.disabled = !id;
|
||||
|
||||
// Fokus ins Titel-Feld
|
||||
titleFld.focus();
|
||||
}
|
||||
});
|
||||
|
||||
// "Zurücksetzen" = Anzeigename löschen (fällt auf Dateiname zurück)
|
||||
clearBtn?.addEventListener('click', () => {
|
||||
titleField.value = '';
|
||||
titleField.focus();
|
||||
// „Zurücksetzen“ = Titel leeren
|
||||
btnClr?.addEventListener('click', () => {
|
||||
titleFld.value = '';
|
||||
titleFld.focus();
|
||||
});
|
||||
|
||||
// Global: Alle aus-/einklappen
|
||||
// Global: Aus-/Einklappen
|
||||
document.getElementById('eis-expand-all')?.addEventListener('click', () => {
|
||||
document.querySelectorAll('.pdf-tree ul').forEach(ul => ul.style.display = 'block');
|
||||
document.querySelectorAll('.pdf-tree .toggle').forEach(t => t.textContent = '▼');
|
||||
@@ -231,4 +190,4 @@ use Joomla\CMS\Language\Text;
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user