Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 847c3aaf36 | |||
| 16627b0433 | |||
| 147b163fd5 | |||
| 976d33cd1b | |||
| 6f279a2cc2 | |||
| f244d1f52a | |||
| 2e09acdc00 | |||
| 461c80d75d | |||
| c361999ea8 |
42
CHANGELOG.md
Normal file
42
CHANGELOG.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
Alle nennenswerten Aenderungen an `webfarben/contao-dummy-copier` werden in dieser Datei dokumentiert.
|
||||||
|
|
||||||
|
## [1.1.5] - 2026-03-15
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Kompatibilitaet fuer Contao 4.13 und 5.x verbessert: Array-Serialisierung nutzt jetzt natives PHP `serialize()` statt `StringUtil::serialize()`.
|
||||||
|
|
||||||
|
## [1.1.4] - 2026-03-15
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- SQL-Fehler in Umgebungen ohne `sorting`-Spalte in `tl_news` bzw. `tl_calendar_events` behoben.
|
||||||
|
- Sortierung fuer News/Events auf robuste ORDER-BY-Klauseln ohne `sorting` angepasst.
|
||||||
|
|
||||||
|
## [1.1.3] - 2026-03-15
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Backend-Modul-Icon (`public/icon.svg`) hinzugefuegt/aktualisiert.
|
||||||
|
- README auf aktuellen Funktionsumfang und Installationsweg ueber Packagist gebracht.
|
||||||
|
|
||||||
|
## [1.1.2] - 2026-03-12
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Paket-Metadaten (`homepage`, `support.source`, `support.issues`) auf GitHub als kanonische Quelle umgestellt.
|
||||||
|
|
||||||
|
## [1.1.1] - 2026-03-12
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Rewiring fuer interne News-Referenzen (`related`) in kopierten News verbessert.
|
||||||
|
- Reader-Modul-Referenzen in kopierten Modulen korrigiert (`news_readerModule`, `cal_readerModule`).
|
||||||
|
|
||||||
|
## [1.1.0] - 2026-03-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Kopieren von Newsarchiven und Newsbeitraegen (`tl_news_archive`, `tl_news`).
|
||||||
|
- Kopieren von Kalendern und Events (`tl_calendar`, `tl_calendar_events`).
|
||||||
|
- Auswahlfelder fuer Newsarchive/Kalender im Backend-Modul.
|
||||||
|
- Ergebnisdaten um Zaehler und Mapping fuer News/Kalender erweitert.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Referenz-Umschreibung fuer kopierte Module um Archivzuordnungen erweitert (`news_archives`, `cal_calendar`).
|
||||||
75
README.md
75
README.md
@@ -1,43 +1,56 @@
|
|||||||
# Contao Dummy Copier (Scaffold)
|
# Contao Dummy Copier
|
||||||
|
|
||||||
Dieses Bundle stellt ein Backend-Modul `Dummy Copier` bereit, um bestehende Dummyseiten, Inhalte, Module und Verzeichnisse zu kopieren und Referenzen automatisiert umzubiegen.
|
Dieses Bundle stellt ein Backend-Modul `Dummy Copier` bereit, um bestehende Dummydaten in Contao kontrolliert zu vervielfaeltigen und interne Referenzen auf die neuen Zielobjekte umzubiegen.
|
||||||
|
|
||||||
## Enthaltene Funktionen
|
## Funktionsumfang
|
||||||
|
|
||||||
- Rekursives Kopieren von Seitenbaeumen (`tl_page`)
|
- rekursives Kopieren von Seitenbaeumen aus `tl_page`
|
||||||
- Optionales Kopieren von Artikeln und Content (`tl_article`, `tl_content`)
|
- optionales Kopieren von Artikeln und verschachtelten Inhaltselementen aus `tl_article` und `tl_content`
|
||||||
- Optionales Kopieren von Modulen (`tl_module`)
|
- optionales Kopieren von Modulen aus `tl_module`
|
||||||
- Automatisches Umstellen von:
|
- optionales Kopieren von Newsarchiven samt Newsbeitraegen aus `tl_news_archive` und `tl_news`
|
||||||
- Content-Elementen vom Typ `module` auf kopierte Modul-IDs
|
- optionales Kopieren von Kalendern samt Events aus `tl_calendar` und `tl_calendar_events`
|
||||||
- `jumpTo` in kopierten Seiten/Modulen/Content auf kopierte Seiten, falls vorhanden
|
- optionales Spiegeln von Verzeichnissen im Dateisystem
|
||||||
- Optionales Kopieren von Verzeichnissen (Dateisystem-Mirror)
|
- Dry-Run zur Vorschau ohne Schreibzugriffe
|
||||||
- Dry-Run Modus ohne Schreibzugriff
|
|
||||||
|
## Automatische Referenzanpassungen
|
||||||
|
|
||||||
|
- `jumpTo` in kopierten Seiten, Modulen, Content-Elementen, Newsarchiven, News, Kalendern und Events
|
||||||
|
- Modulreferenzen in Content-Elementen vom Typ `module`
|
||||||
|
- Alias-Referenzen in verschachtelten Content-Elementen (`cteAlias`)
|
||||||
|
- Archiv-Zuordnungen in kopierten Modulen (`news_archives`, `cal_calendar`)
|
||||||
|
- Reader-Module in kopierten Modulen (`news_readerModule`, `cal_readerModule`)
|
||||||
|
- verwandte News (`related`), sofern die referenzierten News ebenfalls mitkopiert wurden
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Bundle in dein Contao-Projekt legen (oder als VCS-Paket einbinden).
|
Installation ueber Packagist:
|
||||||
2. `composer install` oder `composer update acme/contao-dummy-copier`
|
|
||||||
3. Cache leeren.
|
|
||||||
4. Backend-Modul `Dummy Copier` unter `System` oeffnen.
|
|
||||||
|
|
||||||
## Bedienung (aktueller Stand)
|
```bash
|
||||||
|
composer require webfarben/contao-dummy-copier
|
||||||
|
```
|
||||||
|
|
||||||
- Quellobjekte werden ueber Mehrfachauswahlfelder ausgewaehlt (Seiten, Module, Content, Verzeichnisse).
|
Danach wie ueblich:
|
||||||
- Seiten und Verzeichnisse werden in Baumdarstellung (Einrueckung nach Hierarchie) angezeigt.
|
|
||||||
- Alle Mehrfachauswahlfelder haben Live-Filter sowie `Alle`/`Keine` Buttons.
|
|
||||||
- Ziel-Elternseite wird per Auswahlfeld gesetzt.
|
|
||||||
|
|
||||||
Bei kompatibler Contao-Umgebung nutzt das Modul native `pageTree`/`fileTree` Widgets fuer Seiten und Verzeichnisse.
|
```bash
|
||||||
Falls die Widget-Initialisierung versionsbedingt fehlschlaegt, wird automatisch auf die Select-Fallbacks gewechselt.
|
php vendor/bin/contao-setup
|
||||||
- Setze optional Zielverzeichnis, Zielartikel-ID und Praefix.
|
php vendor/bin/console contao:migrate
|
||||||
- Aktiviere Optionen nach Bedarf (`inkl. Content`, `Module kopieren`, `Verzeichnisse kopieren`, `Dry-Run`).
|
```
|
||||||
|
|
||||||
Hinweis: Das Modul akzeptiert weiterhin CSV-Werte als Fallback, falls du Felder per POST automatisiert befuellst.
|
Das Backend-Modul `Dummy Copier` erscheint anschliessend unter `System`.
|
||||||
|
|
||||||
## Wichtige Hinweise
|
## Bedienung
|
||||||
|
|
||||||
- Nach Verzeichnis-Kopien ggf. `contao:filesync` ausfuehren, damit DBAFS konsistent ist.
|
- Quellobjekte werden ueber Mehrfachauswahlfelder ausgewaehlt.
|
||||||
- Dieses Grundgeruest ist bewusst pragmatisch und kann erweitert werden um:
|
- Seiten, Module, Newsarchive, Kalender und Verzeichnisse koennen separat kombiniert werden.
|
||||||
- PageTree/FileTree Picker statt CSV
|
- Alle Mehrfachauswahlfelder besitzen Live-Filter sowie `Alle`/`Keine` Buttons.
|
||||||
- Feldspezifisches Mapping fuer News/Event/Archive-Felder in `tl_module`
|
- Inhaltselemente von Seiten werden bei aktiver Option automatisch mitkopiert.
|
||||||
- Job-Queue via Messenger bei sehr grossen Kopierlaeufen
|
- Ueber ein Praefix lassen sich Titel, Namen und Aliase der Kopien kenntlich machen.
|
||||||
|
|
||||||
|
## Hinweise
|
||||||
|
|
||||||
|
- Nach Dateikopien ggf. `php vendor/bin/console contao:filesync` ausfuehren, damit die DBAFS-Daten synchronisiert werden.
|
||||||
|
- Das Bundle ist fuer pragmatische Redaktions- und Setup-Workflows gedacht. Projektspezifische Sonderfelder oder Referenzen koennen bei Bedarf erweitert werden.
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
- Siehe `CHANGELOG.md` fuer die dokumentierten Aenderungen ab `1.1.0`.
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
"migration",
|
"migration",
|
||||||
"cloner"
|
"cloner"
|
||||||
],
|
],
|
||||||
"homepage": "https://git.file-archive.de/webfarben/DummyCopier",
|
"homepage": "https://github.com/webfarben/DummyCopier",
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://git.file-archive.de/webfarben/DummyCopier",
|
"source": "https://github.com/webfarben/DummyCopier",
|
||||||
"issues": "https://git.file-archive.de/webfarben/DummyCopier/issues"
|
"issues": "https://github.com/webfarben/DummyCopier/issues"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,12 @@
|
|||||||
.dc-section { border: 1px solid #ccc; padding: 1rem; margin-bottom: 1.5rem; border-radius: 4px; }
|
.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-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-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; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Abschnitt 1: Quell-Seiten -->
|
<!-- Abschnitt 1: Quell-Seiten -->
|
||||||
@@ -19,16 +25,48 @@
|
|||||||
<p class="dc-hint">Alle Artikel und Inhaltselemente der gewaehlten Seiten werden automatisch mitkopiert (sofern Option "inkl. Content" aktiv ist).</p>
|
<p class="dc-hint">Alle Artikel und Inhaltselemente der gewaehlten Seiten werden automatisch mitkopiert (sofern Option "inkl. Content" aktiv ist).</p>
|
||||||
<p>
|
<p>
|
||||||
<label>Quell-Seiten (Mehrfachauswahl):<br>
|
<label>Quell-Seiten (Mehrfachauswahl):<br>
|
||||||
<input class="dc-filter" type="text" data-filter-for="sourcePages" placeholder="Seiten filtern...">
|
<input class="dc-filter" type="text" data-filter-for-tree="sourcePages" placeholder="Seiten im Baum filtern...">
|
||||||
<span class="dc-tools">
|
<span class="dc-tools">
|
||||||
<button class="dc-button" type="button" data-select-all="sourcePages">Alle</button>
|
<button class="dc-button" type="button" data-check-all="sourcePages">Alle</button>
|
||||||
<button class="dc-button" type="button" data-select-none="sourcePages">Keine</button>
|
<button class="dc-button" type="button" data-check-none="sourcePages">Keine</button>
|
||||||
</span>
|
</span>
|
||||||
<select id="sourcePages" name="sourcePages[]" multiple size="12" style="width:100%;">
|
<div class="dc-page-tree" id="sourcePages">
|
||||||
<?php foreach (($this->pageChoices ?? []) as $id => $label): ?>
|
<?php
|
||||||
<option value="<?= (int) $id; ?>" <?= in_array((int) $id, ($this->selected['sourcePages'] ?? []), true) ? 'selected' : ''; ?>><?= htmlspecialchars((string) $label, ENT_QUOTES, 'UTF-8'); ?></option>
|
$selectedSourcePages = (array) ($this->selected['sourcePages'] ?? []);
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
$renderNodes = static function (array $nodes) use (&$renderNodes, $selectedSourcePages): void {
|
||||||
|
if ($nodes === []) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<ul>';
|
||||||
|
|
||||||
|
foreach ($nodes as $node) {
|
||||||
|
$id = (int) ($node['id'] ?? 0);
|
||||||
|
$label = (string) ($node['label'] ?? ('Seite ' . $id));
|
||||||
|
$children = (array) ($node['children'] ?? []);
|
||||||
|
$checked = in_array($id, $selectedSourcePages, true) ? 'checked' : '';
|
||||||
|
|
||||||
|
echo '<li data-tree-item="sourcePages" data-tree-label="' . htmlspecialchars(strtolower($label), ENT_QUOTES, 'UTF-8') . '">';
|
||||||
|
echo '<label class="dc-page-item">';
|
||||||
|
echo '<input type="checkbox" name="sourcePages[]" value="' . $id . '" ' . $checked . '>';
|
||||||
|
echo '<span>' . htmlspecialchars($label, ENT_QUOTES, 'UTF-8') . '</span>';
|
||||||
|
echo '<span class="dc-page-id">[ID ' . $id . ']</span>';
|
||||||
|
echo '</label>';
|
||||||
|
|
||||||
|
if ($children !== []) {
|
||||||
|
$renderNodes($children);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</ul>';
|
||||||
|
};
|
||||||
|
|
||||||
|
$renderNodes((array) ($this->pageTreeNodes ?? []));
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -174,6 +212,87 @@
|
|||||||
(function () {
|
(function () {
|
||||||
function byId(id) { return document.getElementById(id); }
|
function byId(id) { return document.getElementById(id); }
|
||||||
|
|
||||||
|
function childCheckboxesOf(li) {
|
||||||
|
var nested = li.querySelector(':scope > ul');
|
||||||
|
return nested ? nested.querySelectorAll('input[type="checkbox"]') : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function parentLiOf(li) {
|
||||||
|
var parentUl = li.parentElement;
|
||||||
|
if (!parentUl || parentUl.classList.contains('dc-page-tree')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var candidate = parentUl.closest('li[data-tree-item="sourcePages"]');
|
||||||
|
return candidate || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateParentState(li) {
|
||||||
|
var children = childCheckboxesOf(li);
|
||||||
|
if (!children.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var own = li.querySelector(':scope > label input[type="checkbox"]');
|
||||||
|
if (!own) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var checkedCount = 0;
|
||||||
|
children.forEach(function (cb) {
|
||||||
|
if (cb.checked) {
|
||||||
|
checkedCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (checkedCount === 0) {
|
||||||
|
own.checked = false;
|
||||||
|
own.indeterminate = false;
|
||||||
|
} else if (checkedCount === children.length) {
|
||||||
|
own.checked = true;
|
||||||
|
own.indeterminate = false;
|
||||||
|
} else {
|
||||||
|
own.checked = false;
|
||||||
|
own.indeterminate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cascadeToChildren(li, checked) {
|
||||||
|
childCheckboxesOf(li).forEach(function (cb) {
|
||||||
|
cb.checked = checked;
|
||||||
|
cb.indeterminate = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshAllParentStates() {
|
||||||
|
var nodes = Array.prototype.slice.call(document.querySelectorAll('li[data-tree-item="sourcePages"]'));
|
||||||
|
nodes.reverse();
|
||||||
|
nodes.forEach(function (li) {
|
||||||
|
updateParentState(li);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelectorAll('li[data-tree-item="sourcePages"] > label input[type="checkbox"]').forEach(function (checkbox) {
|
||||||
|
checkbox.addEventListener('change', function () {
|
||||||
|
var li = checkbox.closest('li[data-tree-item="sourcePages"]');
|
||||||
|
if (!li) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!checkbox.indeterminate) {
|
||||||
|
cascadeToChildren(li, checkbox.checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
var parent = parentLiOf(li);
|
||||||
|
while (parent) {
|
||||||
|
updateParentState(parent);
|
||||||
|
parent = parentLiOf(parent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshAllParentStates();
|
||||||
|
|
||||||
document.querySelectorAll('[data-filter-for]').forEach(function (input) {
|
document.querySelectorAll('[data-filter-for]').forEach(function (input) {
|
||||||
input.addEventListener('input', function () {
|
input.addEventListener('input', function () {
|
||||||
var select = byId(input.getAttribute('data-filter-for'));
|
var select = byId(input.getAttribute('data-filter-for'));
|
||||||
@@ -185,6 +304,42 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
|
var items = Array.prototype.slice.call(document.querySelectorAll('[data-tree-item="' + key + '"]'));
|
||||||
|
|
||||||
|
if (query === '') {
|
||||||
|
items.forEach(function (item) {
|
||||||
|
item.hidden = false;
|
||||||
|
delete item.dataset.treeMatched;
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
items.reverse().forEach(function (item) {
|
||||||
|
var label = item.getAttribute('data-tree-label') || '';
|
||||||
|
var selfMatch = label.indexOf(query) !== -1;
|
||||||
|
var nested = item.querySelector(':scope > ul');
|
||||||
|
var childMatch = false;
|
||||||
|
|
||||||
|
if (nested) {
|
||||||
|
Array.prototype.forEach.call(nested.children, function (child) {
|
||||||
|
if (child.matches('[data-tree-item="' + key + '"]') && child.dataset.treeMatched === '1') {
|
||||||
|
childMatch = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = selfMatch || childMatch;
|
||||||
|
item.hidden = !match;
|
||||||
|
item.dataset.treeMatched = match ? '1' : '0';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelectorAll('[data-select-all]').forEach(function (button) {
|
document.querySelectorAll('[data-select-all]').forEach(function (button) {
|
||||||
button.addEventListener('click', function () {
|
button.addEventListener('click', function () {
|
||||||
var select = byId(button.getAttribute('data-select-all'));
|
var select = byId(button.getAttribute('data-select-all'));
|
||||||
@@ -204,6 +359,34 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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;
|
||||||
|
checkbox.indeterminate = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshAllParentStates();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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;
|
||||||
|
checkbox.indeterminate = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshAllParentStates();
|
||||||
|
});
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
70
public/icon.svg
Normal file
70
public/icon.svg
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 32 32"
|
||||||
|
fill="none"
|
||||||
|
version="1.1"
|
||||||
|
id="svg10"
|
||||||
|
sodipodi:docname="icon.svg"
|
||||||
|
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs14" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview12"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="14.015625"
|
||||||
|
inkscape:cy="16"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1408"
|
||||||
|
inkscape:window-x="2560"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg10" />
|
||||||
|
<rect
|
||||||
|
x="4"
|
||||||
|
y="5"
|
||||||
|
width="11"
|
||||||
|
height="9"
|
||||||
|
rx="2"
|
||||||
|
stroke="#1f2937"
|
||||||
|
stroke-width="2"
|
||||||
|
id="rect2" />
|
||||||
|
<rect
|
||||||
|
x="18"
|
||||||
|
y="5"
|
||||||
|
width="11"
|
||||||
|
height="9"
|
||||||
|
rx="2"
|
||||||
|
stroke="#1f2937"
|
||||||
|
stroke-width="2"
|
||||||
|
opacity="0.55"
|
||||||
|
id="rect4" />
|
||||||
|
<rect
|
||||||
|
x="4"
|
||||||
|
y="18"
|
||||||
|
width="11"
|
||||||
|
height="9"
|
||||||
|
rx="2"
|
||||||
|
stroke="#1f2937"
|
||||||
|
stroke-width="2"
|
||||||
|
opacity="0.55"
|
||||||
|
id="rect6" />
|
||||||
|
<path
|
||||||
|
d="m 19,22.5 h 9 m -4,-4 4,4 -4,4"
|
||||||
|
stroke="#0f766e"
|
||||||
|
stroke-width="2.5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
id="path8" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -27,6 +27,7 @@ class DummyCopierModule extends BackendModule
|
|||||||
$this->Template->action = Environment::get('request');
|
$this->Template->action = Environment::get('request');
|
||||||
$this->Template->requestToken = $this->getCsrfToken();
|
$this->Template->requestToken = $this->getCsrfToken();
|
||||||
$this->Template->pageChoices = $this->getPageChoices($connection);
|
$this->Template->pageChoices = $this->getPageChoices($connection);
|
||||||
|
$this->Template->pageTreeNodes = $this->getPageTreeNodes($connection);
|
||||||
$this->Template->moduleChoices = $this->getModuleChoices($connection);
|
$this->Template->moduleChoices = $this->getModuleChoices($connection);
|
||||||
$this->Template->newsArchiveChoices = $this->getNewsArchiveChoices($connection);
|
$this->Template->newsArchiveChoices = $this->getNewsArchiveChoices($connection);
|
||||||
$this->Template->calendarChoices = $this->getCalendarChoices($connection);
|
$this->Template->calendarChoices = $this->getCalendarChoices($connection);
|
||||||
@@ -229,6 +230,50 @@ class DummyCopierModule extends BackendModule
|
|||||||
return $choices;
|
return $choices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int,array<string,mixed>>
|
||||||
|
*/
|
||||||
|
private function getPageTreeNodes(Connection $connection): array
|
||||||
|
{
|
||||||
|
$rows = $connection->fetchAllAssociative('SELECT id, pid, title, alias FROM tl_page ORDER BY sorting, id');
|
||||||
|
$rowsByParent = [];
|
||||||
|
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$pid = (int) ($row['pid'] ?? 0);
|
||||||
|
$rowsByParent[$pid][] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
$build = function (int $pid) use (&$build, $rowsByParent): array {
|
||||||
|
$nodes = [];
|
||||||
|
|
||||||
|
foreach ($rowsByParent[$pid] ?? [] as $row) {
|
||||||
|
$id = (int) ($row['id'] ?? 0);
|
||||||
|
|
||||||
|
if ($id < 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = trim((string) ($row['title'] ?? ''));
|
||||||
|
$alias = trim((string) ($row['alias'] ?? ''));
|
||||||
|
$label = $title !== '' ? $title : ('Seite ' . $id);
|
||||||
|
|
||||||
|
if ($alias !== '') {
|
||||||
|
$label .= ' (' . $alias . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
$nodes[] = [
|
||||||
|
'id' => $id,
|
||||||
|
'label' => $label,
|
||||||
|
'children' => $build($id),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nodes;
|
||||||
|
};
|
||||||
|
|
||||||
|
return $build(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array<int,string>
|
* @return array<int,string>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ final class DummyCopier
|
|||||||
$this->connection->update(
|
$this->connection->update(
|
||||||
'tl_news',
|
'tl_news',
|
||||||
[
|
[
|
||||||
'related' => StringUtil::serialize($mappedRelated),
|
'related' => serialize($mappedRelated),
|
||||||
'tstamp' => time(),
|
'tstamp' => time(),
|
||||||
],
|
],
|
||||||
['id' => $newNewsId]
|
['id' => $newNewsId]
|
||||||
@@ -426,7 +426,7 @@ final class DummyCopier
|
|||||||
$map[(int) $sourceArchiveId] = $newArchiveId;
|
$map[(int) $sourceArchiveId] = $newArchiveId;
|
||||||
$result->copiedNewsArchives++;
|
$result->copiedNewsArchives++;
|
||||||
|
|
||||||
$newsIds = $this->connection->fetchFirstColumn('SELECT id FROM tl_news WHERE pid = ? ORDER BY date, sorting, id', [(int) $sourceArchiveId]);
|
$newsIds = $this->connection->fetchFirstColumn('SELECT id FROM tl_news WHERE pid = ? ORDER BY date, id', [(int) $sourceArchiveId]);
|
||||||
|
|
||||||
foreach ($newsIds as $newsId) {
|
foreach ($newsIds as $newsId) {
|
||||||
$newsRow = $this->fetchRow('tl_news', (int) $newsId);
|
$newsRow = $this->fetchRow('tl_news', (int) $newsId);
|
||||||
@@ -492,7 +492,7 @@ final class DummyCopier
|
|||||||
$map[(int) $sourceCalendarId] = $newCalendarId;
|
$map[(int) $sourceCalendarId] = $newCalendarId;
|
||||||
$result->copiedCalendars++;
|
$result->copiedCalendars++;
|
||||||
|
|
||||||
$eventIds = $this->connection->fetchFirstColumn('SELECT id FROM tl_calendar_events WHERE pid = ? ORDER BY startTime, sorting, id', [(int) $sourceCalendarId]);
|
$eventIds = $this->connection->fetchFirstColumn('SELECT id FROM tl_calendar_events WHERE pid = ? ORDER BY startTime, id', [(int) $sourceCalendarId]);
|
||||||
|
|
||||||
foreach ($eventIds as $eventId) {
|
foreach ($eventIds as $eventId) {
|
||||||
$eventRow = $this->fetchRow('tl_calendar_events', (int) $eventId);
|
$eventRow = $this->fetchRow('tl_calendar_events', (int) $eventId);
|
||||||
@@ -658,7 +658,7 @@ final class DummyCopier
|
|||||||
$mapped[] = (string) ($idMap[$id] ?? $id);
|
$mapped[] = (string) ($idMap[$id] ?? $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return StringUtil::serialize($mapped);
|
return serialize($mapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function estimateContentCount(DummyCopyOptions $options): int
|
private function estimateContentCount(DummyCopyOptions $options): int
|
||||||
|
|||||||
Reference in New Issue
Block a user