Führe Dokumente mit Kapiteln, Fassung, Seite und PDF mit Inhaltsverzeichnis ein (ADR-51)
Ein Dokument ist eine Komposition der Art document, ein Kapitel ein Text mit der automatischen Materialart Dokumentkapitel; die Ebene steht in der Rolle. Der Aufbaueditor bekommt den Kapitelarbeitsplatz (Übersicht, Ordnen als Block, offene Eingaben bleiben beim Wechsel erhalten, Speichern als Entwurf, Bereitstellen als Dokumentfassung). Module und Programme binden eine Fassung über den gemeinsamen Picker ein. Mitglieder lesen sie mit anklickbarem Inhaltsverzeichnis und laden ein PDF mit Inhaltsverzeichnis, Seitenzahlen, Tabellen und Bildern. Ein älterer Stand liefert die gebundene Fassung weiter. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c57a506f85
commit
3e2fd872c2
43 files changed
+2827
-64
No files matched your search
@@ -27,6 +27,7 @@
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\AssignsPillars;
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use App\Filament\Support\ManagesDocumentChapters;
|
||||
use App\Filament\Support\ManagesEditorialSurface;
|
||||
use App\Filament\Support\ManagesRichFields;
|
||||
use App\Filament\Support\MediumForm;
|
||||
@@ -50,6 +51,7 @@
|
||||
abstract class EditComposition extends EditRecord
|
||||
{
|
||||
use AssignsPillars;
|
||||
use ManagesDocumentChapters;
|
||||
use ManagesEditorialSurface;
|
||||
use ManagesRichFields;
|
||||
use WithFileUploads;
|
||||
@@ -278,6 +280,10 @@ public function previewUrl(): ?string
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
|
||||
if ($this->isDocument()) {
|
||||
return $this->currentReadyVersion() === null && ! is_array($composition->working_draft) ? null : route('editorial.document-preview', ['composition' => $composition]);
|
||||
}
|
||||
|
||||
if (is_array($composition->working_draft) && $composition->working_draft !== []) {
|
||||
return route('editorial.draft-preview', ['composition' => $composition]);
|
||||
}
|
||||
@@ -371,8 +377,18 @@ public function redaktionKopf(): array
|
||||
|
||||
return [
|
||||
'art' => $this->hostLabel(),
|
||||
'fuer' => $program ? 'das Programm' : 'das Modul',
|
||||
'liste' => $program ? 'Programme' : 'Module',
|
||||
'fuer' => match (true) {
|
||||
$program => 'das Programm',
|
||||
$this->isDocument() => 'das Dokument',
|
||||
$this->isExercise() => 'die Übung',
|
||||
default => 'das Modul',
|
||||
},
|
||||
'liste' => match (true) {
|
||||
$program => 'Programme',
|
||||
$this->isDocument() => 'Dokumente',
|
||||
$this->isExercise() => 'Übungen',
|
||||
default => 'Module',
|
||||
},
|
||||
'zurueck' => 'Zurück zum Aufbau',
|
||||
'typ' => null,
|
||||
'umfang' => '„Redaktion speichern“ sichert Name, Texte, Präsentationsmedien und Einordnung. Aufbau, Lernziel, Zeit und Fassungen bleiben unverändert; offene Änderungen am Aufbau bleiben offen.',
|
||||
@@ -705,10 +721,16 @@ public function saveDraft(): void
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->persistChapterEdits()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->write($record, $this->payload());
|
||||
$this->feedback = 'Der Entwurf ist gespeichert. Es entsteht keine neue Fassung.';
|
||||
$this->feedback = $this->isDocument()
|
||||
? 'Der Entwurf ist gespeichert, auch die Texte der Kapitel. Es entsteht keine neue Dokumentfassung.'
|
||||
: 'Der Entwurf ist gespeichert. Es entsteht keine neue Fassung.';
|
||||
}
|
||||
|
||||
public function armRelease(): void
|
||||
@@ -722,6 +744,12 @@ public function armRelease(): void
|
||||
|
||||
$this->commitRoleDraft();
|
||||
|
||||
if (! $this->persistChapterEdits()) {
|
||||
$this->releaseArmed = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->members === []) {
|
||||
$this->releaseArmed = false;
|
||||
$this->feedback = 'Eine Fassung braucht mindestens einen Bestandteil. Anzeige und Entwurf kannst du schon speichern.';
|
||||
@@ -807,6 +835,7 @@ public function discardDraft(): void
|
||||
$record = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->clear($record);
|
||||
$this->releaseArmed = false;
|
||||
$this->chapterEdits = [];
|
||||
$this->loadAufbau();
|
||||
$this->selected = null;
|
||||
$this->selectFirstPart();
|
||||
@@ -852,6 +881,12 @@ public function includeNeedsRelease(): bool
|
||||
|
||||
public function moveTo(int $from, int $to): void
|
||||
{
|
||||
if ($this->isDocument()) {
|
||||
$this->moveChapterTo($from, $to);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->commitRoleDraft();
|
||||
$count = count($this->members);
|
||||
|
||||
@@ -1184,6 +1219,11 @@ public function removePart(int $index): void
|
||||
}
|
||||
|
||||
$title = (string) ($this->members[$index]['title'] ?? 'Der Bestandteil');
|
||||
|
||||
if ($this->isDocument()) {
|
||||
$this->forgetChapter($index);
|
||||
}
|
||||
|
||||
unset($this->members[$index]);
|
||||
$this->members = array_values($this->members);
|
||||
$this->selected = $this->members === [] ? null : min($index, count($this->members) - 1);
|
||||
@@ -1206,7 +1246,9 @@ protected function extraConfirmation(string $aktion, int|string|null $argument):
|
||||
'aktion' => $aktion,
|
||||
'argument' => (int) $argument,
|
||||
'titel' => '„'.$title.'“ aus diesem Aufbau entfernen?',
|
||||
'text' => 'Nur diese Verwendung wird entfernt. Das Medium oder Modul bleibt im Bestand und in anderen Aufbauten. Gespeichert wird das mit „Entwurf speichern“.',
|
||||
'text' => $this->isDocument()
|
||||
? 'Nur dieses Kapitel wird aus dem Dokument genommen; seine Unterkapitel bleiben und gehören dann zum Kapitel davor. Der Text bleibt im Medienbestand, ungespeicherte Eingaben zu diesem Kapitel entfallen. Gespeichert wird das mit „Entwurf speichern“.'
|
||||
: 'Nur diese Verwendung wird entfernt. Das Medium oder Modul bleibt im Bestand und in anderen Aufbauten. Gespeichert wird das mit „Entwurf speichern“.',
|
||||
'label' => 'Aus dem Aufbau entfernen',
|
||||
'gefahr' => true,
|
||||
];
|
||||
@@ -1221,6 +1263,12 @@ protected function runExtraConfirmation(string $aktion, int|string|null $argumen
|
||||
|
||||
public function movePart(int $index, int $direction): void
|
||||
{
|
||||
if ($this->isDocument()) {
|
||||
$this->moveChapter($index, $direction);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->commitRoleDraft();
|
||||
$target = $index + $direction;
|
||||
|
||||
@@ -1754,6 +1802,10 @@ public function publishRevision(): bool
|
||||
|
||||
$this->commitRoleDraft();
|
||||
|
||||
if (! $this->persistChapterEdits()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->members === []) {
|
||||
$this->feedback = 'Eine Fassung braucht mindestens einen Bestandteil. Anzeige und Kurzbeschreibung kannst du schon speichern.';
|
||||
|
||||
@@ -1813,7 +1865,9 @@ public function publishRevision(): bool
|
||||
$this->loadEditor();
|
||||
$released = $this->currentReadyVersion();
|
||||
$number = $released instanceof CompositionVersion ? $released->number : '';
|
||||
$this->feedback = 'Fassung '.$number.' ist freigegeben. Der Entwurf ist geschlossen und die bisherige Fassung bleibt erhalten. Die Mitgliederbibliothek ändert sich dadurch nicht.';
|
||||
$this->feedback = $this->isDocument()
|
||||
? 'Dokumentfassung '.$number.' ist bereitgestellt. Der Entwurf ist geschlossen, frühere Fassungen bleiben erhalten. Ein Modul oder Programm bindet sie über „Hinzufügen“ ein; bestehende Stände ändern sich dadurch nicht.'
|
||||
: 'Fassung '.$number.' ist freigegeben. Der Entwurf ist geschlossen und die bisherige Fassung bleibt erhalten. Die Mitgliederbibliothek ändert sich dadurch nicht.';
|
||||
|
||||
if ($this->returnAfterRelease) {
|
||||
$this->returnAfterRelease = false;
|
||||
@@ -1969,6 +2023,7 @@ protected function applyDraft(array $draft): void
|
||||
}
|
||||
|
||||
$this->members = $rows;
|
||||
$this->slimChapterMembers();
|
||||
$this->variants = $this->normalizeVariants($draft['variants'] ?? []);
|
||||
$this->durationMax = ($draft['duration_max'] ?? null) === null ? '' : (string) $draft['duration_max'];
|
||||
$this->prerequisites = (string) ($draft['prerequisites'] ?? '');
|
||||
@@ -1989,6 +2044,7 @@ protected function applyDraft(array $draft): void
|
||||
protected function applyVersion(CompositionVersion $version): void
|
||||
{
|
||||
$this->members = app(EditorialCatalog::class)->rows($version, (int) $this->getRecord()->getKey());
|
||||
$this->slimChapterMembers();
|
||||
$this->variants = $this->normalizeVariants($version->variants->map(fn ($variant): array => [
|
||||
'key' => $variant->key, 'name' => $variant->name, 'description' => (string) $variant->description, 'origin' => $variant->origin,
|
||||
])->all());
|
||||
@@ -2014,6 +2070,13 @@ protected function commitRoleDraft(?string $value = null): void
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->isDocument()) {
|
||||
// Ein Kapitel hat keine freie Rolle: Die Ebene steht fest; offene Eingaben des Kapitels bleiben erhalten.
|
||||
$this->stashChapter();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->members[$this->selected]['role'] = trim($value ?? $this->roleDraft);
|
||||
$this->members[$this->selected]['note'] = trim($this->noteDraft);
|
||||
}
|
||||
@@ -2023,6 +2086,13 @@ protected function syncRoleDraft(): void
|
||||
$member = $this->selected !== null ? ($this->members[$this->selected] ?? null) : null;
|
||||
$this->roleDraft = is_array($member) ? (string) ($member['role'] ?? '') : '';
|
||||
$this->noteDraft = is_array($member) ? (string) ($member['note'] ?? '') : '';
|
||||
|
||||
if ($this->isDocument()) {
|
||||
$this->loadChapterFields();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->partTitle = is_array($member) ? (string) ($member['title'] ?? '') : '';
|
||||
$this->partBody = is_array($member) ? (string) ($member['body'] ?? '') : '';
|
||||
}
|
||||
@@ -2340,6 +2410,8 @@ protected function payload(): array
|
||||
'prerequisites' => $this->blank($this->prerequisites),
|
||||
'variants' => $this->normalizeVariants($this->variants),
|
||||
'revision_note' => $this->blank($this->revisionNote),
|
||||
// Ungespeicherte Texte der Kapitel gelten als Änderung des Entwurfs; nach dem Speichern sind sie leer.
|
||||
'chapters' => $this->chapterEditsNow(),
|
||||
'members' => array_values(array_map(
|
||||
fn (array $member): array => [
|
||||
'role' => trim((string) ($member['role'] ?? '')),
|
||||
@@ -2442,6 +2514,7 @@ protected function normalizePayload(array $payload): array
|
||||
'prerequisites' => $payload['prerequisites'] ?? null,
|
||||
'variants' => $this->normalizeVariants($payload['variants'] ?? []),
|
||||
'revision_note' => $payload['revision_note'] ?? null,
|
||||
'chapters' => is_array($payload['chapters'] ?? null) ? $payload['chapters'] : [],
|
||||
'members' => $members,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user