diff --git a/contao/templates/be_dummy_copier.html5 b/contao/templates/be_dummy_copier.html5 index 2a4e96a..df0ca12 100644 --- a/contao/templates/be_dummy_copier.html5 +++ b/contao/templates/be_dummy_copier.html5 @@ -11,6 +11,12 @@ .dc-section { border: 1px solid #ccc; padding: 1rem; margin-bottom: 1.5rem; border-radius: 4px; } .dc-section h3 { margin: 0 0 0.75rem; font-size: 1rem; font-weight: bold; } .dc-hint { color: #666; font-size: 0.85rem; margin: 0.25rem 0 0.75rem; } + .dc-page-tree { border: 1px solid #ddd; border-radius: 4px; background: #fff; max-height: 360px; overflow: auto; padding: 0.5rem; } + .dc-page-tree ul { list-style: none; margin: 0.1rem 0 0.1rem 1.1rem; padding: 0; } + .dc-page-tree > ul { margin-left: 0; } + .dc-page-tree li { margin: 0.1rem 0; } + .dc-page-item { display: flex; align-items: center; gap: 0.45rem; } + .dc-page-id { color: #777; font-size: 0.8rem; } @@ -19,16 +25,48 @@
Alle Artikel und Inhaltselemente der gewaehlten Seiten werden automatisch mitkopiert (sofern Option "inkl. Content" aktiv ist).
@@ -185,6 +223,18 @@ }); }); + document.querySelectorAll('[data-filter-for-tree]').forEach(function (input) { + input.addEventListener('input', function () { + var key = input.getAttribute('data-filter-for-tree'); + var query = (input.value || '').toLowerCase(); + + document.querySelectorAll('[data-tree-item="' + key + '"]').forEach(function (item) { + var label = item.getAttribute('data-tree-label') || ''; + item.hidden = query !== '' && label.indexOf(query) === -1; + }); + }); + }); + document.querySelectorAll('[data-select-all]').forEach(function (button) { button.addEventListener('click', function () { var select = byId(button.getAttribute('data-select-all')); @@ -204,6 +254,28 @@ }); }); }); + + document.querySelectorAll('[data-check-all]').forEach(function (button) { + button.addEventListener('click', function () { + var key = button.getAttribute('data-check-all'); + + document.querySelectorAll('[data-tree-item="' + key + '"] input[type="checkbox"]').forEach(function (checkbox) { + if (!checkbox.closest('li').hidden) { + checkbox.checked = true; + } + }); + }); + }); + + document.querySelectorAll('[data-check-none]').forEach(function (button) { + button.addEventListener('click', function () { + var key = button.getAttribute('data-check-none'); + + document.querySelectorAll('[data-tree-item="' + key + '"] input[type="checkbox"]').forEach(function (checkbox) { + checkbox.checked = false; + }); + }); + }); })(); diff --git a/src/Backend/DummyCopierModule.php b/src/Backend/DummyCopierModule.php index 3ce7758..0871b3a 100644 --- a/src/Backend/DummyCopierModule.php +++ b/src/Backend/DummyCopierModule.php @@ -27,6 +27,7 @@ class DummyCopierModule extends BackendModule $this->Template->action = Environment::get('request'); $this->Template->requestToken = $this->getCsrfToken(); $this->Template->pageChoices = $this->getPageChoices($connection); + $this->Template->pageTreeNodes = $this->getPageTreeNodes($connection); $this->Template->moduleChoices = $this->getModuleChoices($connection); $this->Template->newsArchiveChoices = $this->getNewsArchiveChoices($connection); $this->Template->calendarChoices = $this->getCalendarChoices($connection); @@ -229,6 +230,50 @@ class DummyCopierModule extends BackendModule return $choices; } + /** + * @return array