Medium, Modul, Programm und Lizenzartikel nutzen denselben Objektkopf, dieselben Register (Texte, Präsentationsmedien, Einordnung) und denselben visuellen Picker. Präsentationsmedien, Abweichungen und Texte bilden einen Arbeitsstand, den nur „Redaktion speichern“ schreibt; Austausch behält die Position, Sortierung bleibt in der Rolle. Der Wechsel zur Redaktion und zurück erhält offene Eingaben des Ausgangseditors. Entfernt versteckte Mitspeicherungen: Der Didaktikdialog schreibt keine Redaktionstexte mehr, die Website-Freigabe keine offenen Quellenzeilen, Entwurf verwerfen setzt keine offenen Redaktionseingaben zurück. Tests, die alte Orte oder CSS-Zeichenketten prüften, sind auf die neue Bedienung umgestellt; neue Tests decken Arbeitsstand, Austausch, Abbrechen und Rückweg ab. Datenmodell, Fassungen und Rechte bleiben unverändert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
41658d98dd
commit
e1fd59491c
44 files changed
+3917
-2173
No files matched your search
@@ -19,11 +19,13 @@
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
use App\Domain\Catalog\StructureNode;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Support\EditorialCatalog;
|
||||
use App\Filament\Support\ManagesEditorialSurface;
|
||||
use App\Filament\Support\MediumForm;
|
||||
use App\Filament\Support\WidgetEditor;
|
||||
use App\Http\Controllers\ContentPreviewController;
|
||||
use App\Jobs\DeriveCompositionFrame;
|
||||
use App\Jobs\DeriveThumbnail;
|
||||
@@ -87,22 +89,6 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public string $panel = 'angaben';
|
||||
|
||||
public bool $pickerOpen = false;
|
||||
|
||||
public string $pickerPurpose = 'aufbau';
|
||||
|
||||
public string $pickerQuery = '';
|
||||
|
||||
public string $pickerKind = 'alle';
|
||||
|
||||
public string $pickerLayout = 'liste';
|
||||
|
||||
public string $pickerDimension = '';
|
||||
|
||||
public string $pickerSelected = '';
|
||||
|
||||
public string $pickerInspected = '';
|
||||
|
||||
public bool $textOpen = false;
|
||||
|
||||
public bool $releaseArmed = false;
|
||||
@@ -139,7 +125,7 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public bool $moduleOpen = false;
|
||||
|
||||
public string $moduleTab = 'beschreibung';
|
||||
public string $moduleTab = 'didaktik';
|
||||
|
||||
public bool $partOpen = false;
|
||||
|
||||
@@ -182,24 +168,11 @@ public function mount(int|string $record): void
|
||||
}
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable|null
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
if ($this->redaktionOpen) {
|
||||
return null;
|
||||
}
|
||||
$title = trim((string) $this->getRecord()->display_title) !== '' ? (string) $this->getRecord()->display_title : (string) $this->getRecord()->designation;
|
||||
|
||||
$title = trim($this->displayTitle) !== '' ? trim($this->displayTitle) : trim($this->designation);
|
||||
|
||||
return $title !== '' ? $title : parent::getHeading();
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
if ($this->redaktionOpen) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->hostKind()->deskExplanation().' '.$this->statusSentence();
|
||||
return $title !== '' ? $title : $this->hostLabel();
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
@@ -214,47 +187,53 @@ protected function mutateFormDataBeforeFill(array $data): array
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
if ($this->redaktionOpen) {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
Action::make('preview')
|
||||
->label('Vorschau für Trainer')
|
||||
->url(fn (): ?string => $this->previewUrl())
|
||||
->openUrlInNewTab()
|
||||
->visible(fn (): bool => $this->previewUrl() !== null),
|
||||
Action::make('displayRelease')
|
||||
->label('In Mitgliederbibliothek anzeigen')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('In der Mitgliederbibliothek anzeigen')
|
||||
->modalDescription('Sichtbar wird die zuletzt übernommene Fassung. Das ist keine Website-Veröffentlichung und kein aktives Angebot. Eine frühere Fassung bleibt unverändert. Ungespeicherte Änderungen am Aufbau sind nicht Teil dieser Freigabe.')
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
public function displayReleaseAction(): Action
|
||||
{
|
||||
return Action::make('displayRelease')
|
||||
->label('In Mitgliederbibliothek anzeigen')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('In der Mitgliederbibliothek anzeigen')
|
||||
->modalDescription('Sichtbar wird die zuletzt übernommene Fassung. Das ist keine Website-Veröffentlichung und kein aktives Angebot. Eine frühere Fassung bleibt unverändert. Ungespeicherte Änderungen am Aufbau sind nicht Teil dieser Freigabe.')
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
return $version !== null && ! app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
})
|
||||
->action(function (): void {
|
||||
$this->releaseDisplay();
|
||||
}),
|
||||
Action::make('displayRevoke')
|
||||
->label('Aus Mitgliederbibliothek ausblenden')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Die Fassung verschwindet aus der Mitgliederbibliothek. Der fachliche Inhalt bleibt gespeichert. Website und Angebot sind davon unabhängig.')
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
return $version !== null && ! app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
})
|
||||
->action(function (): void {
|
||||
$this->releaseDisplay();
|
||||
});
|
||||
}
|
||||
|
||||
return $version !== null && app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
})
|
||||
->action(function (): void {
|
||||
$version = $this->currentReadyVersion();
|
||||
$actor = $this->actor();
|
||||
abort_unless($version !== null && $actor instanceof User, 403);
|
||||
app(CompositionDisplayRelease::class)->revoke($version, $actor);
|
||||
$this->feedback = 'Die Fassung ist aus der Mitgliederbibliothek ausgeblendet. Der Inhalt bleibt gespeichert.';
|
||||
}),
|
||||
];
|
||||
public function displayRevokeAction(): Action
|
||||
{
|
||||
return Action::make('displayRevoke')
|
||||
->label('Aus Mitgliederbibliothek ausblenden')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Aus der Mitgliederbibliothek ausblenden')
|
||||
->modalDescription('Die Fassung verschwindet aus der Mitgliederbibliothek. Der fachliche Inhalt bleibt gespeichert. Website und Angebot sind davon unabhängig.')
|
||||
->visible(function (): bool {
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
return $version !== null && app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
})
|
||||
->action(function (): void {
|
||||
$version = $this->currentReadyVersion();
|
||||
$actor = $this->actor();
|
||||
abort_unless($version !== null && $actor instanceof User, 403);
|
||||
app(CompositionDisplayRelease::class)->revoke($version, $actor);
|
||||
$this->feedback = 'Die Fassung ist aus der Mitgliederbibliothek ausgeblendet. Der Inhalt bleibt gespeichert.';
|
||||
});
|
||||
}
|
||||
|
||||
public function isInLibrary(): bool
|
||||
{
|
||||
$version = $this->currentReadyVersion();
|
||||
|
||||
return $version !== null && app(CompositionDisplayRelease::class)->isReleased($version);
|
||||
}
|
||||
|
||||
public function hostKind(): CompositionKind
|
||||
@@ -336,58 +315,158 @@ public function openPicker(): void
|
||||
$this->closePart();
|
||||
}
|
||||
|
||||
$this->pickerPurpose = 'aufbau';
|
||||
$this->pickerOpen = true;
|
||||
$this->textOpen = false;
|
||||
$this->pickerSelected = '';
|
||||
$this->pickerInspected = '';
|
||||
$this->resetPicker('aufbau');
|
||||
$this->pickerKind = 'alle';
|
||||
}
|
||||
|
||||
public function openRedaktion(): void
|
||||
/**
|
||||
* Schließt die Dialoge des Aufbaus, ohne deren offene Eingaben zu verwerfen.
|
||||
*/
|
||||
protected function redaktionWillOpen(): void
|
||||
{
|
||||
$this->moduleOpen = false;
|
||||
$this->partOpen = false;
|
||||
$this->textOpen = false;
|
||||
$this->releaseArmed = false;
|
||||
}
|
||||
|
||||
protected function saveRedaktionTexte(): bool
|
||||
{
|
||||
$this->guardEditorial();
|
||||
$this->moduleOpen = false;
|
||||
$this->moduleSnapshot = [];
|
||||
$this->partOpen = false;
|
||||
$this->pickerOpen = false;
|
||||
$this->textOpen = false;
|
||||
$this->redaktionOpen = true;
|
||||
$this->redaktionTab = 'texte';
|
||||
}
|
||||
|
||||
public function closeRedaktion(): void
|
||||
{
|
||||
$this->redaktionOpen = false;
|
||||
$this->pickerOpen = false;
|
||||
$this->replacingAssignment = null;
|
||||
$this->presentationInspect = '';
|
||||
}
|
||||
if (trim($this->designation) === '') {
|
||||
$this->deskFeedback = 'Der Name fehlt. Er bezeichnet den Eintrag in der Verwaltung.';
|
||||
$this->redaktionFehlerFeld = 'designation';
|
||||
|
||||
public function saveRedaktion(): void
|
||||
{
|
||||
if (! $this->persistPresentation()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->feedback = 'Die Redaktion ist gespeichert. Aufbau, Lernziel, Zeit und Fassungen bleiben unverändert.';
|
||||
return $this->persistRedaktion();
|
||||
}
|
||||
|
||||
public function redaktionUnsaved(): bool
|
||||
protected function redaktionSavedMessage(): string
|
||||
{
|
||||
$this->feedback = 'Die Redaktion ist gespeichert. Aufbau, Lernziel, Zeit und Fassungen bleiben unverändert.';
|
||||
|
||||
return $this->feedback;
|
||||
}
|
||||
|
||||
protected function resetRedaktionTexte(): void
|
||||
{
|
||||
$this->fillRedaktion();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{art: string, fuer: string, liste: string, zurueck: string, typ: ?string, umfang: string}
|
||||
*/
|
||||
public function redaktionKopf(): array
|
||||
{
|
||||
$program = $this->isProgram();
|
||||
|
||||
return [
|
||||
'art' => $this->hostLabel(),
|
||||
'fuer' => $program ? 'das Programm' : 'das Modul',
|
||||
'liste' => $program ? 'Programme' : '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.',
|
||||
];
|
||||
}
|
||||
|
||||
public function redaktionTitel(): string
|
||||
{
|
||||
$title = trim($this->displayTitle) !== '' ? trim($this->displayTitle) : trim($this->designation);
|
||||
|
||||
return $title !== '' ? $title : $this->hostLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function redaktionFelder(): array
|
||||
{
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
$stored = fn (string $column): string => (string) ($record->getAttribute($column) ?? '');
|
||||
|
||||
return [
|
||||
['id' => 'name', 'label' => 'Name in der Verwaltung', 'model' => 'designation', 'kind' => 'text', 'stored' => $stored('designation'), 'required' => true, 'hilfe' => 'Pflichtangabe. Erscheint in Listen der Verwaltung.'],
|
||||
['id' => 'titel', 'label' => 'Titel', 'model' => 'displayTitle', 'kind' => 'text', 'stored' => $stored('display_title'), 'hilfe' => 'Erscheint auf Karten und in der Bibliothek. Leer zeigt den Namen.'],
|
||||
['id' => 'teaser', 'label' => 'Teaser', 'model' => 'teaser', 'kind' => 'textarea', 'rows' => 2, 'stored' => $stored('teaser')],
|
||||
['id' => 'kurz', 'label' => 'Kurzbeschreibung', 'model' => 'summary', 'kind' => 'textarea', 'rows' => 3, 'stored' => $stored('summary')],
|
||||
['id' => 'beschreibung', 'label' => 'Ausführliche Beschreibung', 'model' => 'description', 'kind' => 'textarea', 'rows' => 8, 'stored' => $stored('description'), 'hilfe' => 'Beschreibt das Angebot. Kein Lehrtext und kein Lernziel.'],
|
||||
['id' => 'suche', 'label' => 'Suchbegriffe', 'model' => 'searchTerms', 'kind' => 'text', 'gruppe' => 'weitere', 'stored' => $stored('search_terms'), 'placeholder' => 'Begriffe, durch Komma getrennt'],
|
||||
];
|
||||
}
|
||||
|
||||
public function redaktionTexteHinweis(): string
|
||||
{
|
||||
return 'Lernziel, Zeit und Material gehören zum fachlichen Stand. Sie stehen im Aufbau unter „Didaktik und Katalogbild“ und entstehen mit der nächsten Fassung.';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{legend: string, model: string, values: list<array{id: int, label: string}>}>
|
||||
*/
|
||||
public function einordnungGruppen(): array
|
||||
{
|
||||
return array_map(fn (array $group): array => [
|
||||
'legend' => $group['label'],
|
||||
'model' => 'dimensionIds',
|
||||
'values' => $group['values'],
|
||||
], $this->dimensionGroups());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{html: string, stand: string}|null
|
||||
*/
|
||||
public function redaktionAusgabe(): ?array
|
||||
{
|
||||
$subject = app(PublicCatalogReader::class)->subject($this->getRecord()->getKey(), true);
|
||||
|
||||
if ($subject === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$card = view('widgets.premium_card', [
|
||||
'subject' => $subject,
|
||||
'context' => RenderContext::preview(),
|
||||
'cardStyle' => $subject->style ?? 'program',
|
||||
'imageUrl' => null,
|
||||
'alt' => '',
|
||||
'focus' => ['x' => 50, 'y' => 45],
|
||||
'format' => 'landscape',
|
||||
'fit' => 'cover',
|
||||
'headingTag' => 'h3',
|
||||
'show' => ['summary' => true, 'kind' => true, 'meta' => true, 'action' => true],
|
||||
'actionLabel' => 'Ansehen',
|
||||
'note' => null,
|
||||
'stacked' => false,
|
||||
])->render();
|
||||
|
||||
return [
|
||||
'html' => view('filament.cms.widget-live-preview', [
|
||||
'html' => $card,
|
||||
'stylesheets' => WidgetEditor::previewStylesheets(),
|
||||
'width' => 640,
|
||||
'bodyClass' => '',
|
||||
'caption' => 'Website-Karte bei 640 px, wie im öffentlichen Auftritt.',
|
||||
])->render(),
|
||||
'stand' => $this->redaktionOffen()
|
||||
? 'Gezeigt wird der gespeicherte Stand. Deine ungespeicherten Änderungen erscheinen erst nach „Redaktion speichern“.'
|
||||
: 'Gezeigt wird der gespeicherte Stand der Redaktion.',
|
||||
];
|
||||
}
|
||||
|
||||
protected function pickerExceptId(): int
|
||||
{
|
||||
return (int) $this->getRecord()->getKey();
|
||||
}
|
||||
|
||||
public function einordnungUnsaved(): bool
|
||||
{
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord()->fresh() ?? $this->getRecord();
|
||||
$text = trim($this->designation) !== trim((string) $record->designation)
|
||||
|| trim($this->displayTitle) !== trim((string) ($record->display_title ?? ''))
|
||||
|| trim($this->teaser) !== trim((string) ($record->teaser ?? ''))
|
||||
|| trim($this->summary) !== trim((string) ($record->summary ?? ''))
|
||||
|| trim($this->description) !== trim((string) ($record->description ?? ''))
|
||||
|| trim($this->searchTerms) !== trim((string) ($record->search_terms ?? ''))
|
||||
|| trim($this->thumbnailAlt) !== trim((string) ($record->thumbnail_alt ?? ''));
|
||||
|
||||
if ($text) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$stored = IdentityDimensionValue::query()
|
||||
->where('subject_type', $record->getMorphClass())
|
||||
->where('subject_id', $record->getKey())
|
||||
@@ -402,174 +481,6 @@ public function redaktionUnsaved(): bool
|
||||
return $stored !== $current;
|
||||
}
|
||||
|
||||
public function openPresentationPicker(): void
|
||||
{
|
||||
$this->guardEditorial();
|
||||
|
||||
if ($this->partOpen) {
|
||||
$this->closePart();
|
||||
}
|
||||
|
||||
$this->pickerPurpose = 'praesentation';
|
||||
$this->pickerOpen = true;
|
||||
$this->moduleOpen = false;
|
||||
$this->textOpen = false;
|
||||
$this->pickerSelected = '';
|
||||
$this->pickerInspected = '';
|
||||
}
|
||||
|
||||
public function assignFromPicker(string $target): void
|
||||
{
|
||||
$this->guardEditorial();
|
||||
|
||||
if (preg_match('/^medium:(\d+)$/', $target, $mediumMatch) === 1) {
|
||||
$element = ContentElement::query()->find((int) $mediumMatch[1]);
|
||||
|
||||
if (! $element instanceof ContentElement
|
||||
|| $element->archived_at !== null
|
||||
|| ! in_array($element->output_class, ['bild', 'film', 'audio'], true)) {
|
||||
$this->deskFeedback = 'Dieses Präsentationsmedium ist nicht verfügbar.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->rememberAssignment($element->id, null);
|
||||
$this->pickerOpen = false;
|
||||
$this->pickerPurpose = 'aufbau';
|
||||
$this->pickerSelected = '';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^element:(\d+)$/', $target, $match) !== 1) {
|
||||
$this->deskFeedback = 'Präsentationsmedien sind Medien aus dem Bestand. Ein Modul bleibt Bestandteil des Aufbaus.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$version = ContentElementVersion::query()->find((int) $match[1]);
|
||||
|
||||
if (! $version instanceof ContentElementVersion) {
|
||||
$this->deskFeedback = 'Dieses Medium ist nicht verfügbar.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->rememberAssignment((int) $version->content_element_id, $target);
|
||||
$this->pickerOpen = false;
|
||||
$this->pickerPurpose = 'aufbau';
|
||||
$this->pickerSelected = '';
|
||||
}
|
||||
|
||||
public function closePicker(): void
|
||||
{
|
||||
$this->pickerOpen = false;
|
||||
$this->pickerSelected = '';
|
||||
$this->pickerInspected = '';
|
||||
$this->replacingAssignment = null;
|
||||
}
|
||||
|
||||
public function inspectPicker(string $target, bool $mark = false): void
|
||||
{
|
||||
$this->pickerInspected = $target;
|
||||
|
||||
if ($mark) {
|
||||
$this->pickerSelected = $target;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{items: list<array<string, string|null>>, more: bool}
|
||||
*/
|
||||
public function pickerResult(): array
|
||||
{
|
||||
if (! $this->pickerOpen) {
|
||||
return ['items' => [], 'more' => false];
|
||||
}
|
||||
|
||||
if ($this->pickerPurpose === 'praesentation') {
|
||||
return app(EditorialCatalog::class)->presentationBrowse($this->pickerQuery);
|
||||
}
|
||||
|
||||
return app(EditorialCatalog::class)->browse(
|
||||
$this->pickerQuery,
|
||||
$this->pickerKind,
|
||||
$this->pickerDimension,
|
||||
(int) $this->getRecord()->getKey(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string|null>|null
|
||||
*/
|
||||
public function pickerDetail(): ?array
|
||||
{
|
||||
$target = $this->pickerInspected !== '' ? $this->pickerInspected : $this->pickerSelected;
|
||||
|
||||
if ($target === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$row = app(EditorialCatalog::class)->rowForTarget(
|
||||
$target,
|
||||
(int) $this->getRecord()->getKey(),
|
||||
allowDraft: true,
|
||||
);
|
||||
|
||||
if ($row === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$row['playback'] = null;
|
||||
|
||||
if (preg_match('/^element:(\d+)$/', (string) $row['target'], $match) === 1) {
|
||||
$version = ContentElementVersion::query()->with('element.editorialContentKind')->find($match[1]);
|
||||
$row['playback'] = $version instanceof ContentElementVersion
|
||||
? app(ContentPreviewController::class)->playback($version)
|
||||
: null;
|
||||
if ($version?->element !== null) {
|
||||
$row['visibility'] = app(PublicMaterialReader::class)->visibilityNote($version->element);
|
||||
}
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{target: string, label: string, current: bool}>
|
||||
*/
|
||||
public function pickerVersions(): array
|
||||
{
|
||||
$detail = $this->pickerDetail();
|
||||
|
||||
if ($detail === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$options = app(EditorialCatalog::class)->alternatives(
|
||||
(string) ($detail['identity'] ?? ''),
|
||||
(int) $this->getRecord()->getKey(),
|
||||
);
|
||||
|
||||
if ($options === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$current = $options[array_key_last($options)]['target'];
|
||||
|
||||
return array_map(
|
||||
fn (array $option): array => $option + ['current' => $option['target'] === $current],
|
||||
$options,
|
||||
);
|
||||
}
|
||||
|
||||
public function pickerMatches(string $identity): bool
|
||||
{
|
||||
$detail = $this->pickerDetail();
|
||||
|
||||
return $detail !== null && ($detail['identity'] ?? '') === $identity;
|
||||
}
|
||||
|
||||
public function openText(): void
|
||||
{
|
||||
$this->pickerOpen = false;
|
||||
@@ -673,8 +584,8 @@ public function discardDraft(): void
|
||||
$record = $this->getRecord();
|
||||
app(EditorialWorkingDraft::class)->clear($record);
|
||||
$this->releaseArmed = false;
|
||||
$this->loadEditor();
|
||||
$this->feedback = 'Der Entwurf ist verworfen. Eine freigegebene Fassung bleibt unverändert.';
|
||||
$this->loadAufbau();
|
||||
$this->feedback = 'Der Entwurf ist verworfen. Eine freigegebene Fassung bleibt unverändert. Offene Eingaben der Redaktion bleiben erhalten.';
|
||||
}
|
||||
|
||||
public function editorStatus(): string
|
||||
@@ -1150,7 +1061,7 @@ public function startModule(): void
|
||||
|
||||
public function saveDisplay(): void
|
||||
{
|
||||
if (! $this->persistPresentation()) {
|
||||
if (! $this->persistRedaktion()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1160,18 +1071,11 @@ public function saveDisplay(): void
|
||||
public function openModule(): void
|
||||
{
|
||||
$this->moduleSnapshot = [
|
||||
'designation' => $this->designation,
|
||||
'displayTitle' => $this->displayTitle,
|
||||
'teaser' => $this->teaser,
|
||||
'summary' => $this->summary,
|
||||
'searchTerms' => $this->searchTerms,
|
||||
'description' => $this->description,
|
||||
'learningGoal' => $this->learningGoal,
|
||||
'durationMinutes' => $this->durationMinutes,
|
||||
'materialNote' => $this->materialNote,
|
||||
'revisionNote' => $this->revisionNote,
|
||||
'thumbnailAlt' => $this->thumbnailAlt,
|
||||
'dimensionIds' => $this->dimensionIds,
|
||||
'imageMode' => $this->imageMode,
|
||||
'imagePick' => $this->imagePick,
|
||||
'frameVersionId' => $this->frameVersionId,
|
||||
@@ -1180,7 +1084,7 @@ public function openModule(): void
|
||||
$this->pickerOpen = false;
|
||||
$this->partOpen = false;
|
||||
$this->textOpen = false;
|
||||
$this->moduleTab = 'beschreibung';
|
||||
$this->moduleTab = in_array($this->moduleTab, ['didaktik', 'titelbild'], true) ? $this->moduleTab : 'didaktik';
|
||||
$this->frameFilmChoices = $this->frameFilms();
|
||||
$films = $this->frameFilmChoices;
|
||||
$this->imageMode = $films === [] ? 'bestand' : 'film';
|
||||
@@ -1203,6 +1107,9 @@ public function closeModule(): void
|
||||
$this->previewUpload = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Übernimmt Didaktik und Katalogbild. Texte, Name und Einordnung gehören zur Redaktion und werden hier nicht gespeichert.
|
||||
*/
|
||||
public function saveModule(): void
|
||||
{
|
||||
if ($this->minutes($this->durationMinutes) === false) {
|
||||
@@ -1211,19 +1118,16 @@ public function saveModule(): void
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $this->persistPresentation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
app(IdentityProfile::class)->fill($record, ['thumbnail_alt' => trim($this->thumbnailAlt)], $this->actor());
|
||||
$record->refresh();
|
||||
$image = $this->applyChosenImage();
|
||||
|
||||
if ($image === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
|
||||
if ($this->needsRevision() || app(EditorialWorkingDraft::class)->read($record) !== null) {
|
||||
$this->persistDraft();
|
||||
}
|
||||
@@ -1232,7 +1136,7 @@ public function saveModule(): void
|
||||
$this->moduleSnapshot = [];
|
||||
$this->previewUpload = null;
|
||||
$this->imagePick = '';
|
||||
$this->feedback = trim('Die Angaben sind übernommen. Es entsteht keine neue Fassung.'.($image === '' ? '' : ' '.$image));
|
||||
$this->feedback = trim('Didaktik und Katalogbild sind übernommen. Es entsteht keine neue Fassung.'.($image === '' ? '' : ' '.$image));
|
||||
}
|
||||
|
||||
public function openPart(int $index): void
|
||||
@@ -1728,22 +1632,25 @@ public function selectedMember(): ?array
|
||||
}
|
||||
|
||||
protected function loadEditor(): void
|
||||
{
|
||||
$this->fillRedaktion();
|
||||
$this->loadAufbau();
|
||||
}
|
||||
|
||||
/**
|
||||
* Liest die Angaben der Redaktion (Name, Texte, Einordnung) aus dem gespeicherten Stand.
|
||||
*/
|
||||
protected function fillRedaktion(): void
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
$composition->refresh();
|
||||
$version = $this->currentReadyVersion();
|
||||
$this->designation = $composition->designation;
|
||||
$this->displayTitle = (string) ($composition->display_title ?? '');
|
||||
$this->teaser = (string) ($composition->teaser ?? '');
|
||||
$this->summary = (string) ($composition->summary ?? '');
|
||||
$this->searchTerms = (string) ($composition->search_terms ?? '');
|
||||
$this->description = (string) ($composition->description ?? '');
|
||||
$this->thumbnailPath = $composition->thumbnail_path;
|
||||
$this->thumbnailAlt = (string) ($composition->thumbnail_alt ?? '');
|
||||
$this->thumbnailError = $composition->thumbnail_error;
|
||||
$this->thumbnailSource = $composition->thumbnail_source;
|
||||
$this->imageCaptionText = $this->captionFor($composition->thumbnail_source);
|
||||
$this->dimensionIds = IdentityDimensionValue::query()
|
||||
->where('subject_type', $composition->getMorphClass())
|
||||
->where('subject_id', $composition->id)
|
||||
@@ -1751,6 +1658,22 @@ protected function loadEditor(): void
|
||||
->pluck('editorial_dimension_value_id')
|
||||
->map(fn (mixed $id): string => (string) (int) $id)
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Liest Aufbau, Didaktik und Katalogbild aus Entwurf oder letzter freigegebener Fassung.
|
||||
*/
|
||||
protected function loadAufbau(): void
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
$composition->refresh();
|
||||
$version = $this->currentReadyVersion();
|
||||
$this->thumbnailPath = $composition->thumbnail_path;
|
||||
$this->thumbnailAlt = (string) ($composition->thumbnail_alt ?? '');
|
||||
$this->thumbnailError = $composition->thumbnail_error;
|
||||
$this->thumbnailSource = $composition->thumbnail_source;
|
||||
$this->imageCaptionText = $this->captionFor($composition->thumbnail_source);
|
||||
$this->catalogScope = match ($this->hostKind()) {
|
||||
CompositionKind::Kurs => 'module',
|
||||
CompositionKind::Uebung => 'medien',
|
||||
@@ -1968,7 +1891,10 @@ protected function syncDimensions(Composition $composition, array $ids): void
|
||||
app(IdentityDimension::class)->replaceOffered($composition, $ids);
|
||||
}
|
||||
|
||||
protected function persistPresentation(): bool
|
||||
/**
|
||||
* Schreibt Name, Texte und Einordnung. Aufbau, Didaktik, Katalogbild und Fassungen bleiben unberührt.
|
||||
*/
|
||||
protected function persistRedaktion(): bool
|
||||
{
|
||||
/** @var Composition $record */
|
||||
$record = $this->getRecord();
|
||||
@@ -1987,7 +1913,6 @@ protected function persistPresentation(): bool
|
||||
'summary' => $this->summary,
|
||||
'search_terms' => $this->searchTerms,
|
||||
'description' => $this->description,
|
||||
'thumbnail_alt' => $this->thumbnailAlt,
|
||||
], $this->actor());
|
||||
$this->syncDimensions($record, array_map(intval(...), $this->dimensionIds));
|
||||
$record->refresh();
|
||||
|
||||
Reference in new issue
Block a user