Führe den gemeinsamen Redaktionsarbeitsplatz ein.
Deploy Test / test (push) Successful in 55s
Deploy Test / deploy (push) Successful in 24s

Texte, Medienzuordnung und Einordnung teilen sich einen Arbeitsplatz. Fassungen, Rechte und das Datenmodell bleiben unverändert.
This commit is contained in:
Lars committed 2026-11-19 14:43:15 +01:00
1 parent a359a5fb69
commit 4c29ab2593
140 files changed
+6705 -201

No files matched your search

@@ -101,6 +101,8 @@ abstract class EditComposition extends EditRecord
public string $pickerSelected = '';
public string $pickerInspected = '';
public bool $textOpen = false;
public bool $releaseArmed = false;
@@ -326,6 +328,66 @@ public function openPicker(): void
$this->pickerOpen = true;
$this->textOpen = false;
$this->pickerSelected = '';
$this->pickerInspected = '';
}
public function openRedaktion(): void
{
$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 = '';
}
public function saveRedaktion(): void
{
if (! $this->persistPresentation()) {
return;
}
$this->feedback = 'Die Redaktion ist gespeichert. Aufbau, Lernziel, Zeit und Fassungen bleiben unverändert.';
}
public function redaktionUnsaved(): 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())
->where('origin', 'direkt')
->pluck('editorial_dimension_value_id')
->map(fn ($id): int => (int) $id)
->all();
$current = array_map(intval(...), $this->dimensionIds);
sort($stored);
sort($current);
return $stored !== $current;
}
public function openPresentationPicker(): void
@@ -341,6 +403,7 @@ public function openPresentationPicker(): void
$this->moduleOpen = false;
$this->textOpen = false;
$this->pickerSelected = '';
$this->pickerInspected = '';
}
public function assignFromPicker(string $target): void
@@ -389,6 +452,18 @@ public function assignFromPicker(string $target): void
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;
}
}
/**
@@ -417,12 +492,14 @@ public function pickerResult(): array
*/
public function pickerDetail(): ?array
{
if ($this->pickerSelected === '') {
$target = $this->pickerInspected !== '' ? $this->pickerInspected : $this->pickerSelected;
if ($target === '') {
return null;
}
$row = app(EditorialCatalog::class)->rowForTarget(
$this->pickerSelected,
$target,
(int) $this->getRecord()->getKey(),
allowDraft: true,
);
@@ -482,6 +482,52 @@ public function saveEditorial(): void
$this->editorialFeedback = $element->versions()->count() === $versions
? 'Gespeichert. Es gibt keine neue Fassung.'
: 'Gespeichert. Prüfe die Fassungen, ihre Zahl hat sich geändert.';
$this->deskFeedback = $this->editorialFeedback;
}
public function redaktionUnsaved(): bool
{
/** @var ContentElement $element */
$element = $this->getRecord()->fresh() ?? $this->getRecord();
$kind = filled($this->kindId) ? (int) $this->kindId : null;
$storedKind = $element->editorial_content_kind_id !== null ? (int) $element->editorial_content_kind_id : null;
$text = trim($this->workingTitle) !== trim((string) $element->working_title)
|| trim($this->displayTitle) !== trim((string) ($element->display_title ?? ''))
|| trim($this->teaser) !== trim((string) ($element->teaser ?? ''))
|| trim($this->summary) !== trim((string) ($element->summary ?? ''))
|| trim($this->searchTerms) !== trim((string) ($element->search_terms ?? ''))
|| trim($this->descriptionText) !== trim((string) ($element->description ?? ''))
|| trim($this->usageNote) !== trim((string) ($element->usage_note ?? ''))
|| trim($this->licenseNote) !== trim((string) ($element->license_note ?? ''))
|| trim($this->websiteCredit) !== trim((string) ($element->website_credit ?? ''))
|| trim($this->websiteAlt) !== trim((string) ($element->website_alt ?? ''))
|| $kind !== $storedKind;
if ($text) {
return true;
}
$pillars = $element->pillars()->pluck('pillars.id')->map(fn ($id): int => (int) $id)->all();
$currentPillars = array_map(intval(...), $this->pillarIds);
sort($pillars);
sort($currentPillars);
if ($pillars !== $currentPillars) {
return true;
}
$stored = IdentityDimensionValue::query()
->where('subject_type', $element->getMorphClass())
->where('subject_id', $element->getKey())
->where('origin', 'direkt')
->pluck('editorial_dimension_value_id')
->map(fn ($id): int => (int) $id)
->all();
$current = array_map(intval(...), $this->dimensionIds);
sort($stored);
sort($current);
return $stored !== $current;
}
public function releaseForWebsite(): void
@@ -83,6 +83,22 @@ public function saveLicenseEditorial(): void
: 'Gespeichert. Prüfe den Artikelstand, er hat sich geändert.';
}
public function redaktionUnsaved(): bool
{
/** @var LicenseArticle $article */
$article = $this->getRecord()->fresh() ?? $this->getRecord();
$kind = filled($this->kindId) ? (int) $this->kindId : null;
$storedKind = $article->editorial_content_kind_id !== null ? (int) $article->editorial_content_kind_id : null;
return trim($this->workingTitle) !== trim((string) ($article->working_title ?? ''))
|| trim($this->displayTitle) !== trim((string) ($article->display_title ?? ''))
|| trim($this->teaser) !== trim((string) ($article->teaser ?? ''))
|| trim($this->summary) !== trim((string) ($article->summary ?? ''))
|| trim($this->descriptionText) !== trim((string) ($article->description ?? ''))
|| trim($this->searchTerms) !== trim((string) ($article->search_terms ?? ''))
|| $kind !== $storedKind;
}
/**
* @return list<array{label: string, values: list<array{id: int, label: string}>}>
*/
@@ -8,6 +8,7 @@
use App\Domain\Catalog\EditorialProfile;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\EditorialTextVariant;
use App\Domain\Catalog\PresentationAssignment;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Catalog\PresentationRole;
use App\Domain\Media\WebsiteRelease;
@@ -27,8 +28,16 @@ trait ManagesEditorialSurface
public string $presentationPick = '';
public string $presentationInspect = '';
public bool $bindToVersion = false;
public bool $redaktionOpen = false;
public string $redaktionTab = 'texte';
public ?int $replacingAssignment = null;
public string $deskFeedback = '';
public string $variantAudience = 'kachel';
@@ -106,6 +115,97 @@ public function assignPickedPresentation(): void
$this->rememberAssignment((int) $row['element_id'], isset($row['target']) ? (string) $row['target'] : null);
$this->presentationPick = '';
$this->presentationInspect = '';
}
public function openRedaktion(): void
{
$this->guardEditorial();
$this->redaktionOpen = true;
$this->redaktionTab = 'texte';
}
public function closeRedaktion(): void
{
$this->redaktionOpen = false;
$this->presentationInspect = '';
$this->replacingAssignment = null;
}
public function cancelPresentationPick(): void
{
$this->presentationPick = '';
$this->presentationInspect = '';
$this->replacingAssignment = null;
$this->deskFeedback = 'Die vorhandene Zuordnung bleibt unverändert.';
}
public function beginExchange(int $assignmentId): void
{
$this->guardEditorial();
foreach ($this->presentationRows() as $row) {
if ((int) $row['id'] !== $assignmentId) {
continue;
}
$this->presentationRole = (string) $row['role'];
$this->replacingAssignment = $assignmentId;
$this->presentationPick = '';
$this->presentationInspect = '';
$this->redaktionTab = 'medien';
$this->deskFeedback = 'Wähle das neue Medium und übernimm es. Abbrechen lässt die bisherige Zuordnung stehen.';
if (method_exists($this, 'openPresentationPicker')) {
$this->openPresentationPicker();
}
return;
}
$this->deskFeedback = 'Diese Zuordnung gibt es nicht mehr.';
}
public function placePresentation(int $assignmentId, int $beforeId): void
{
$this->guardEditorial();
$rows = $this->presentationRows();
$moving = null;
foreach ($rows as $row) {
if ((int) $row['id'] === $assignmentId) {
$moving = $row;
}
}
if ($moving === null || ! $moving['ordered']) {
$this->deskFeedback = 'Diese Rolle hat eine feste einzelne Zuordnung und wird nicht umsortiert.';
return;
}
$ids = [];
foreach ($rows as $row) {
if ($row['role'] === $moving['role']) {
$ids[] = (int) $row['id'];
}
}
$from = array_search($assignmentId, $ids, true);
$to = array_search($beforeId, $ids, true);
if ($from === false || $to === false || $from === $to) {
return;
}
$direction = $to < $from ? -1 : 1;
for ($step = 0; $step < abs($to - $from); $step++) {
app(PresentationMedia::class)->move($this->editorialSubject(), $assignmentId, $direction, $this->deskActor());
}
$this->deskFeedback = 'Die Reihenfolge gilt nur in dieser Rolle.';
}
public function detachPresentation(int $assignmentId): void
@@ -245,6 +345,36 @@ protected function rememberAssignment(int $elementId, ?string $target): void
$this->deskActor(),
),
);
$this->finishExchange();
}
protected function finishExchange(): void
{
$previous = $this->replacingAssignment;
if ($previous === null || ! str_contains($this->deskFeedback, 'zugeordnet')) {
return;
}
$this->replacingAssignment = null;
$still = PresentationAssignment::query()->find($previous);
if (! $still instanceof PresentationAssignment) {
$this->deskFeedback = 'Die Zuordnung ist ausgetauscht. '.$this->deskFeedback;
return;
}
if (str_contains($this->deskFeedback, 'bereits')) {
return;
}
$removed = $this->reportPresentation(
fn (): string => app(PresentationMedia::class)->detach($this->editorialSubject(), $previous, $this->deskActor()),
);
$this->deskFeedback = str_contains($removed, 'entfernt')
? 'Die bisherige Zuordnung ist ersetzt. '.$this->deskFeedback
: $removed;
}
protected function versionIdFromTarget(?string $target): ?int