Compare commits

...
Author SHA1 Message Date
LarsandCursor a359a5fb69 Vermerke den Teststand nach der fassungslosen Präsentation.
Deploy Test / test (push) Successful in 48s
CI Feature / test (push) Successful in 48s
Deploy Test / deploy (push) Successful in 22s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-19 08:25:28 +01:00
LarsandCursor 7b325f0d66 Lasse Präsentationsmedien ohne Inhaltsfassung zu.
CI Feature / test (push) Successful in 53s
Deploy Test / test (push) Successful in 48s
Deploy Test / deploy (push) Successful in 22s
Bilder, Filme und Hörstücke lassen sich zuordnen und für die Website freigeben, ohne eine fachliche Fassung anzulegen. Unterrichtsfilme behalten die Teaserfassung an ihrer bereitgestellten Fassung.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-19 08:20:35 +01:00
LarsandCursor 5590225f4f Vermerke ADR-41 als auf der Testinstanz bereitgestellt.
Deploy Test / test (push) Successful in 47s
CI Feature / test (push) Successful in 47s
Deploy Test / deploy (push) Successful in 24s
Der Eintrag nannte noch den Feature-Branch, obwohl der Stand bereits über develop ausgeliefert ist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-19 08:00:57 +01:00
LarsandCursor f29ea58fd5 Ergänze die gemeinsame redaktionelle Basis an den Fachobjekten.
CI Feature / test (push) Successful in 54s
Deploy Test / test (push) Successful in 47s
Deploy Test / deploy (push) Successful in 24s
Texte, Materialart und Präsentationsmedien bleiben am Medium, Modul, Programm und Lizenzartikel und werden von Verwaltung und Karten aus derselben Quelle gelesen, ohne Fassung oder Lizenz zu verändern.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-19 07:54:36 +01:00
50 changed files with 3013 additions and 81 deletions

No files matched your search

+2
View File
@@ -11,8 +11,10 @@ class Composition extends Model
protected $fillable = [
'designation',
'display_title',
'teaser',
'summary',
'description',
'search_terms',
'thumbnail_path',
'thumbnail_alt',
'thumbnail_source',
+3
View File
@@ -14,6 +14,7 @@ class ContentElement extends Model
'output_class',
'working_title',
'display_title',
'teaser',
'description',
'usage_note',
'license_note',
@@ -22,10 +23,12 @@ class ContentElement extends Model
'website_released_at',
'website_public_path',
'summary',
'search_terms',
'thumbnail_path',
'thumbnail_alt',
'thumbnail_source',
'thumbnail_error',
'preview_path',
'editorial_content_kind_id',
'archived_at',
];
+29
View File
@@ -2,6 +2,7 @@
namespace App\Domain\Catalog;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
@@ -13,4 +14,32 @@ public function values(): HasMany
{
return $this->hasMany(EditorialDimensionValue::class);
}
/**
* Inhaltselemente pflegen Themen über die Säulen, nicht noch einmal über die Dimension.
* Module, Programme und Lizenzartikel haben keine Säulenauswahl und behalten die Dimension.
*
* @return Collection<int, self>
*/
public static function forSubject(Model $subject): Collection
{
$query = static::query()->with('values')->orderBy('label');
if ($subject instanceof ContentElement) {
$query->where('slug', '!=', 'saeule');
}
return $query->get();
}
/**
* @return list<int>
*/
public static function offeredValueIds(Model $subject): array
{
return static::forSubject($subject)
->flatMap(fn (self $dimension) => $dimension->values->pluck('id'))
->map(fn ($id): int => (int) $id)
->all();
}
}
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace App\Domain\Catalog;
use Illuminate\Database\Eloquent\Model;
/**
* Aufgelöste Klasse-A-Angaben eines Fachobjekts.
* Fehlende Felder bleiben leer. Es wird nichts materialisiert.
*/
final readonly class EditorialProfile
{
/**
* @param array<string, ResolvedText> $texts
*/
public function __construct(
public ?string $workingTitle,
public array $texts,
public ?string $searchTerms,
public string $searchOrigin,
public ?string $kindLabel,
public ?Model $source,
) {}
public function text(string $field): ResolvedText
{
return $this->texts[$field] ?? new ResolvedText(null, 'leer', null);
}
public function value(string $field): ?string
{
return $this->text($field)->value;
}
public function origin(string $field): string
{
return $this->text($field)->origin;
}
public function originLabel(string $field): string
{
$text = $this->text($field);
return match ($text->origin) {
'eigen' => 'Eigene Angabe',
'variante' => 'Abweichung für '.($text->label ?? 'diesen Kontext'),
'quelle' => 'Übernommen von '.($text->label ?? 'der fachlichen Quelle'),
default => 'Keine Angabe',
};
}
}
@@ -0,0 +1,225 @@
<?php
namespace App\Domain\Catalog;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
/**
* Löst die Klasse-A-Texte eines Fachobjekts auf.
*
* Reihenfolge: abweichende Formulierung für den Kontext, eigene Angabe am Objekt,
* bei einem Lizenzartikel die Angabe der eindeutigen fachlichen Quelle.
* Eine Quelle gibt es nur, wenn der aktuelle Artikelstand genau eine Wurzel hat.
* Preise, Rechte und Fassungen werden nicht gelesen und nicht geschrieben.
*/
class EditorialProfileReader
{
public const AUDIENCES = [
'kachel' => 'Öffentliche Kachel',
'detail' => 'Öffentliche Detailvorstellung',
'bibliothek' => 'Mitgliederbibliothek',
'trainer' => 'Fachliche Traineransicht',
'artikel' => 'Lizenzartikelpräsentation',
'cms' => 'CMS-Teaser',
'suche' => 'Suchergebnis',
];
public const TEXT_FIELDS = ['display_title', 'teaser', 'summary', 'description'];
public function read(Model $subject, ?string $audience = null): EditorialProfile
{
if ($audience !== null && ! array_key_exists($audience, self::AUDIENCES)) {
throw new DomainRuleException('Diese Zielgruppe ist nicht vorgesehen.');
}
$source = $subject instanceof LicenseArticle ? $this->sourceOf($subject) : null;
$texts = [];
foreach (self::TEXT_FIELDS as $field) {
$texts[$field] = $this->resolve($subject, $field, $audience, $source);
}
$search = $this->own($subject, 'search_terms');
$searchOrigin = 'eigen';
if ($search === null && $source instanceof Model) {
$search = $this->own($source, 'search_terms');
$searchOrigin = $search === null ? 'leer' : 'quelle';
}
if ($search === null) {
$searchOrigin = 'leer';
}
return new EditorialProfile(
workingTitle: $this->workingTitle($subject),
texts: $texts,
searchTerms: $search,
searchOrigin: $searchOrigin,
kindLabel: $subject->editorialContentKind?->label
?? ($source?->editorialContentKind?->label),
source: $source,
);
}
public function sourceOf(LicenseArticle $article): ?Model
{
$release = $article->relationLoaded('currentRelease')
? $article->currentRelease
: $article->currentRelease()->first();
if (! $release instanceof ArticleRelease) {
return null;
}
$elementId = $release->root_element_version_id;
$compositionId = $release->root_composition_version_id;
if (($elementId === null) === ($compositionId === null)) {
return null;
}
if ($elementId !== null) {
return ContentElementVersion::query()->with('element.editorialContentKind')->find($elementId)?->element;
}
return CompositionVersion::query()->with('composition.editorialContentKind')->find($compositionId)?->composition;
}
public function putVariant(Model $subject, string $field, string $audience, ?string $body, ?User $actor = null): string
{
if (! in_array($field, self::TEXT_FIELDS, true) || ! array_key_exists($audience, self::AUDIENCES)) {
throw new DomainRuleException('Diese Abweichung ist nicht vorgesehen.');
}
$body = is_string($body) ? trim($body) : '';
$existing = $this->variant($subject, $field, $audience);
if ($body === '') {
if ($existing instanceof EditorialTextVariant) {
$this->record($subject, $audience, $field, $existing->body, null, $actor);
$existing->delete();
}
return 'Die abweichende Formulierung ist entfernt. Es gilt wieder die zentrale Angabe.';
}
if ($existing instanceof EditorialTextVariant && $existing->body === $body) {
return 'Die abweichende Formulierung ist unverändert.';
}
$this->record($subject, $audience, $field, $existing?->body, $body, $actor);
EditorialTextVariant::query()->updateOrCreate(
[
'subject_type' => $subject->getMorphClass(),
'subject_id' => $subject->getKey(),
'field' => $field,
'audience' => $audience,
],
['body' => $body],
);
return 'Die abweichende Formulierung gilt nur für '.self::AUDIENCES[$audience].'. Die zentrale Angabe bleibt.';
}
public function forgetVariant(Model $subject, EditorialTextVariant $variant, ?User $actor = null): void
{
if ($variant->subject_type !== $subject->getMorphClass() || (int) $variant->subject_id !== (int) $subject->getKey()) {
throw new DomainRuleException('Diese Abweichung gehört zu einem anderen Objekt.');
}
$this->record($subject, $variant->audience, $variant->field, $variant->body, null, $actor);
$variant->delete();
}
private function resolve(Model $subject, string $field, ?string $audience, ?Model $source): ResolvedText
{
if ($audience !== null) {
$variant = $this->variant($subject, $field, $audience);
if ($variant instanceof EditorialTextVariant && trim($variant->body) !== '') {
return new ResolvedText(trim($variant->body), 'variante', self::AUDIENCES[$audience]);
}
}
$own = $this->own($subject, $field);
if ($own !== null) {
return new ResolvedText($own, 'eigen', null);
}
if ($source instanceof Model) {
$fromSource = $this->resolve($source, $field, $audience, null);
if ($fromSource->value !== null) {
return new ResolvedText($fromSource->value, 'quelle', $this->sourceLabel($source));
}
}
return new ResolvedText(null, 'leer', null);
}
private function variant(Model $subject, string $field, string $audience): ?EditorialTextVariant
{
return EditorialTextVariant::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->where('field', $field)
->where('audience', $audience)
->first();
}
private function own(Model $subject, string $field): ?string
{
$value = $subject->getAttribute($field);
if (! is_string($value)) {
return null;
}
$value = trim($value);
return $value === '' ? null : $value;
}
private function workingTitle(Model $subject): ?string
{
if ($subject instanceof Composition) {
return $this->own($subject, 'designation');
}
if ($subject instanceof LicenseArticle) {
return $this->own($subject, 'working_title') ?? $this->own($subject, 'code');
}
return $this->own($subject, 'working_title');
}
private function sourceLabel(Model $source): string
{
if ($source instanceof Composition) {
return (string) ($source->display_title ?: $source->designation);
}
if ($source instanceof ContentElement) {
return (string) ($source->display_title ?: $source->working_title);
}
return 'der fachlichen Quelle';
}
private function record(Model $subject, string $audience, string $field, ?string $before, ?string $after, ?User $actor): void
{
IdentityChange::query()->create([
'subject_type' => $subject->getMorphClass(),
'subject_id' => $subject->getKey(),
'field' => 'variante:'.$audience.':'.$field,
'before' => $before,
'after' => $after,
'actor_id' => $actor?->id,
'occurred_at' => now(),
]);
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Domain\Catalog;
use Illuminate\Database\Eloquent\Model;
class EditorialTextVariant extends Model
{
protected $fillable = [
'subject_type',
'subject_id',
'field',
'audience',
'body',
];
}
+31
View File
@@ -52,4 +52,35 @@ public function matches(Model $subject, array $valueIds): bool
return true;
}
/**
* Ersetzt nur die Werte der Dimensionen, die dieses Fachobjekt anbietet.
* Nicht angebotene Zuordnungen, etwa gespiegelte Säulen am Inhaltselement, bleiben.
*
* @param list<int> $valueIds
*/
public function replaceOffered(Model $subject, array $valueIds): void
{
$offeredIds = EditorialDimension::offeredValueIds($subject);
$ids = array_values(array_intersect(
array_values(array_unique(array_map(intval(...), $valueIds))),
$offeredIds,
));
$query = IdentityDimensionValue::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->where('origin', 'direkt')
->whereIn('editorial_dimension_value_id', $offeredIds === [] ? [0] : $offeredIds);
if ($ids !== []) {
$query->whereNotIn('editorial_dimension_value_id', $ids);
}
$query->delete();
foreach (EditorialDimensionValue::query()->whereIn('id', $ids)->get() as $value) {
$this->assign($subject, $value, 'direkt');
}
}
}
+12
View File
@@ -10,6 +10,13 @@ class LicenseArticle extends Model
{
protected $fillable = [
'code',
'working_title',
'display_title',
'teaser',
'summary',
'description',
'search_terms',
'editorial_content_kind_id',
'product_line',
'successor_of_id',
'current_release_id',
@@ -37,4 +44,9 @@ public function successorOf(): BelongsTo
{
return $this->belongsTo(self::class, 'successor_of_id');
}
public function editorialContentKind(): BelongsTo
{
return $this->belongsTo(EditorialContentKind::class);
}
}
@@ -0,0 +1,33 @@
<?php
namespace App\Domain\Catalog;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PresentationAssignment extends Model
{
protected $fillable = [
'subject_type',
'subject_id',
'content_element_id',
'presentation_role_id',
'position',
'source_version_id',
];
public function role(): BelongsTo
{
return $this->belongsTo(PresentationRole::class, 'presentation_role_id');
}
public function element(): BelongsTo
{
return $this->belongsTo(ContentElement::class, 'content_element_id');
}
public function sourceVersion(): BelongsTo
{
return $this->belongsTo(ContentElementVersion::class, 'source_version_id');
}
}
+269
View File
@@ -0,0 +1,269 @@
<?php
namespace App\Domain\Catalog;
use App\Domain\Media\WebsiteMedia;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
/**
* Präsentationsmedien sind Referenzen auf Inhaltselemente.
* Die Rolle gehört zur Zuordnung. Eine Zuordnung gibt nichts frei und ändert keine Fassung.
*/
class PresentationMedia
{
public function __construct(private readonly WebsiteMedia $website) {}
/**
* @return list<array<string, mixed>>
*/
public function rows(Model $subject): array
{
$assignments = PresentationAssignment::query()
->with(['role', 'element.editorialContentKind', 'sourceVersion'])
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->orderBy('position')
->orderBy('id')
->get();
$rows = [];
foreach ($assignments as $assignment) {
$element = $assignment->element;
$released = $element instanceof ContentElement && $this->website->present($element) !== null;
$binding = $this->binding($assignment);
$rows[] = [
'id' => $assignment->id,
'role' => (string) $assignment->role?->slug,
'role_label' => (string) ($assignment->role?->label ?? ''),
'ordered' => (bool) $assignment->role?->ordered,
'position' => (int) $assignment->position,
'standard' => $assignment->role?->slug === 'titelbild',
'element_id' => (int) $assignment->content_element_id,
'title' => $element instanceof ContentElement
? (string) ($element->display_title ?: $element->working_title)
: 'Medium fehlt',
'kind' => $element?->editorialContentKind?->label,
'output' => $element instanceof ContentElement ? (string) $element->output_class : '',
'released' => $released,
'release_label' => $released ? 'Für die Website freigegeben' : 'Nicht für die Website freigegeben',
'binding' => $binding,
];
}
return $rows;
}
public function assign(Model $subject, string $roleSlug, int $elementId, ?int $sourceVersionId, ?User $actor = null): string
{
$role = PresentationRole::query()->where('slug', $roleSlug)->first();
$element = ContentElement::query()->find($elementId);
if (! $role instanceof PresentationRole || ! $element instanceof ContentElement) {
throw new DomainRuleException('Rolle oder Medium fehlt.');
}
if ($element->archived_at !== null) {
throw new DomainRuleException('Ein archiviertes Medium wird nicht zugeordnet.');
}
if ($subject instanceof ContentElement && (int) $subject->getKey() === (int) $element->id) {
throw new DomainRuleException('Ein Medium kann nicht seine eigene Präsentation sein.');
}
$source = $this->checkedSource($subject, $element, $sourceVersionId);
$existing = PresentationAssignment::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->where('presentation_role_id', $role->id)
->where('content_element_id', $element->id)
->first();
if ($existing instanceof PresentationAssignment) {
if ((int) $existing->source_version_id !== (int) ($source?->id ?? 0) && ($source !== null || $existing->source_version_id !== null)) {
$existing->source_version_id = $source?->id;
$existing->save();
$this->record($subject, null, $role->label.': '.$element->working_title, $actor);
}
return $element->working_title.' ist in dieser Rolle bereits zugeordnet.';
}
if (! $role->multiple) {
PresentationAssignment::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->where('presentation_role_id', $role->id)
->delete();
}
$position = (int) PresentationAssignment::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->where('presentation_role_id', $role->id)
->max('position') + 1;
PresentationAssignment::query()->create([
'subject_type' => $subject->getMorphClass(),
'subject_id' => $subject->getKey(),
'content_element_id' => $element->id,
'presentation_role_id' => $role->id,
'position' => max(1, $position),
'source_version_id' => $source?->id,
]);
$this->record($subject, null, $role->label.': '.$element->working_title, $actor);
return $element->working_title.' ist als '.$role->label.' zugeordnet. Es entsteht keine Fassung und keine Freigabe.';
}
public function detach(Model $subject, int $assignmentId, ?User $actor = null): string
{
$assignment = $this->owned($subject, $assignmentId);
$label = ($assignment->role?->label ?? 'Präsentation').': '.($assignment->element?->working_title ?? '');
$assignment->delete();
$this->record($subject, $label, null, $actor);
return 'Die Zuordnung ist entfernt. Das Medium bleibt im Bestand.';
}
public function move(Model $subject, int $assignmentId, int $direction, ?User $actor = null): void
{
$assignment = $this->owned($subject, $assignmentId);
if (! $assignment->role?->ordered || $direction === 0) {
return;
}
$neighbors = PresentationAssignment::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->where('presentation_role_id', $assignment->presentation_role_id)
->orderBy('position')
->orderBy('id')
->get()
->values();
$index = $neighbors->search(fn (PresentationAssignment $row): bool => $row->id === $assignment->id);
if ($index === false) {
return;
}
$swap = $index + ($direction < 0 ? -1 : 1);
$other = $neighbors->get($swap);
if (! $other instanceof PresentationAssignment) {
return;
}
$position = $assignment->position;
$assignment->position = $other->position === $position ? $position + ($direction < 0 ? -1 : 1) : $other->position;
$other->position = $position;
$assignment->save();
$other->save();
$this->record($subject, null, 'Reihenfolge '.$assignment->role?->label, $actor);
}
/**
* Kennung des ersten Titel- oder Galeriebildes. Ob es öffentlich erscheint, entscheidet WebsiteMedia.
*/
public function coverElementId(Model $subject): ?int
{
$assignments = PresentationAssignment::query()
->with('role')
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->orderBy('position')
->get();
foreach (PresentationRole::COVER_ROLES as $slug) {
$match = $assignments->first(fn (PresentationAssignment $row): bool => $row->role?->slug === $slug);
if ($match instanceof PresentationAssignment) {
return (int) $match->content_element_id;
}
}
return null;
}
private function owned(Model $subject, int $assignmentId): PresentationAssignment
{
$assignment = PresentationAssignment::query()
->with(['role', 'element'])
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->whereKey($assignmentId)
->first();
if (! $assignment instanceof PresentationAssignment) {
throw new DomainRuleException('Diese Zuordnung gehört zu einem anderen Objekt.');
}
return $assignment;
}
private function checkedSource(Model $subject, ContentElement $element, ?int $sourceVersionId): ?ContentElementVersion
{
if ($sourceVersionId === null) {
return null;
}
$version = ContentElementVersion::query()->find($sourceVersionId);
if (! $version instanceof ContentElementVersion) {
throw new DomainRuleException('Die gebundene Fassung fehlt.');
}
$ownsFilm = $subject instanceof ContentElement && (int) $version->content_element_id === (int) $subject->getKey();
$ownsClip = (int) $version->content_element_id === (int) $element->id;
if (! $ownsFilm && ! $ownsClip) {
throw new DomainRuleException('Die gebundene Fassung gehört weder zum Fachobjekt noch zum zugeordneten Medium.');
}
return $version;
}
/**
* @return array{label: string, stale: bool}|null
*/
private function binding(PresentationAssignment $assignment): ?array
{
if ($assignment->source_version_id === null || ! $assignment->sourceVersion instanceof ContentElementVersion) {
return null;
}
$version = $assignment->sourceVersion;
$latestId = ContentElementVersion::query()
->where('content_element_id', $version->content_element_id)
->where('status', ContentVersionStatus::Bereit)
->orderByDesc('number')
->value('id');
$stale = $latestId !== null && (int) $latestId !== (int) $version->id;
return [
'label' => $stale
? 'Gebunden an Fassung '.$version->number.'. Die aktuelle Fassung ist eine andere. Der Clip wurde nicht neu erzeugt.'
: 'Gebunden an Fassung '.$version->number.'.',
'stale' => $stale,
];
}
private function record(Model $subject, ?string $before, ?string $after, ?User $actor): void
{
IdentityChange::query()->create([
'subject_type' => $subject->getMorphClass(),
'subject_id' => $subject->getKey(),
'field' => 'praesentation',
'before' => $before,
'after' => $after,
'actor_id' => $actor?->id,
'occurred_at' => now(),
]);
}
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App\Domain\Catalog;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class PresentationRole extends Model
{
/** Rollen, deren Herkunft an einer Film- oder Audiofassung festgehalten werden kann. */
public const BOUND_ROLES = ['trailer', 'vorschauclip', 'audiovorschau'];
/** Reihenfolge, in der ein öffentliches Titelbild gesucht wird. */
public const COVER_ROLES = ['titelbild', 'hero', 'hover', 'titelbild_alternativ', 'galerie'];
protected $fillable = [
'slug',
'label',
'multiple',
'ordered',
'sort_order',
];
protected function casts(): array
{
return [
'multiple' => 'boolean',
'ordered' => 'boolean',
];
}
public function assignments(): HasMany
{
return $this->hasMany(PresentationAssignment::class);
}
/**
* @return array<string, string>
*/
public static function selectOptions(): array
{
return static::query()->orderBy('sort_order')->pluck('label', 'slug')->all();
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace App\Domain\Catalog;
/**
* Ein aufgelöster redaktioneller Text. Der Wert wird nicht kopiert:
* eigen steht am Fachobjekt, variante ist eine Abweichung für einen Kontext,
* quelle verweist auf das eindeutig zugeordnete Fachobjekt eines Lizenzartikels.
*/
final readonly class ResolvedText
{
public function __construct(
public ?string $value,
public string $origin,
public ?string $label,
) {}
}
+19
View File
@@ -37,4 +37,23 @@ public function __construct(
public array $missing = [],
public ?string $style = null,
) {}
public function withText(?string $title, ?string $summary): self
{
return new self(
title: $title ?? $this->title,
summary: $summary ?? $this->summary,
kind: $this->kind,
badge: $this->badge,
meta: $this->meta,
url: $this->url,
public: $this->public,
notice: $this->notice,
visual: $this->visual,
visualLabel: $this->visualLabel,
previewImage: $this->previewImage,
missing: $this->missing,
style: $this->style,
);
}
}
+10 -4
View File
@@ -7,6 +7,7 @@
use App\Domain\Catalog\CompositionVersion;
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Media\ThumbnailRef;
use Illuminate\Support\Collection;
@@ -95,7 +96,9 @@ public function search(?string $term, int $limit = 25): array
$like = '%'.mb_strtolower($term).'%';
$query->where(fn ($inner) => $inner
->whereRaw('LOWER(designation) LIKE ?', [$like])
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like]));
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like])
->orWhereRaw('LOWER(COALESCE(teaser, \'\')) LIKE ?', [$like])
->orWhereRaw('LOWER(COALESCE(search_terms, \'\')) LIKE ?', [$like]));
})
->orderBy('designation')
->limit($limit * 3)
@@ -200,7 +203,9 @@ public function cardSearch(?string $term, int $limit = 25): array
$like = '%'.mb_strtolower($term).'%';
$query->where(fn ($inner) => $inner
->whereRaw('LOWER(designation) LIKE ?', [$like])
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like]));
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like])
->orWhereRaw('LOWER(COALESCE(teaser, \'\')) LIKE ?', [$like])
->orWhereRaw('LOWER(COALESCE(search_terms, \'\')) LIKE ?', [$like]));
})
->orderBy('designation')
->limit($limit * 3)
@@ -257,7 +262,8 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
$version = $shown ?? $this->latestReadyVersion($composition);
$program = $composition->editorialContentKind?->slug === 'programm';
$kind = (string) ($composition->editorialContentKind?->label ?? ($program ? 'Programm' : 'Modul'));
$summary = filled($composition->summary) ? trim((string) $composition->summary) : null;
$profile = app(EditorialProfileReader::class)->read($composition, 'kachel');
$summary = $profile->value('teaser') ?: $profile->value('summary');
$goal = filled($version?->learning_goal) ? trim((string) $version->learning_goal) : null;
$missing = [];
@@ -295,7 +301,7 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
}
return new CardSubject(
title: $this->title($composition),
title: $profile->value('display_title') ?: $this->title($composition),
summary: $summary ?? $goal,
kind: $kind,
badge: null,
@@ -5,6 +5,7 @@
use App\Domain\Catalog\CompositionStructureReader;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\StructureNode;
use App\Domain\Media\ThumbnailRef;
@@ -137,6 +138,19 @@ public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ?
$film = $shown->output_class === 'film';
$editorialKind = $element->editorialContentKind?->label;
$summary = filled($shown->summary) ? trim((string) $shown->summary) : null;
$profile = app(EditorialProfileReader::class)->read($shown, 'bibliothek');
if (! array_key_exists('summary', $draft) && $profile->origin('summary') === 'variante') {
$summary = $profile->value('summary');
} elseif ($summary === null && filled($shown->teaser)) {
$summary = trim((string) $shown->teaser);
}
$title = (string) ($shown->display_title ?: $shown->working_title);
if (! array_key_exists('display_title', $draft) && $profile->origin('display_title') === 'variante') {
$title = (string) $profile->value('display_title');
}
$meta = [$output];
if ($program !== null) {
@@ -157,7 +171,7 @@ public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ?
$previewImage = $includeNonPublic ? ThumbnailRef::url('editorial.card', 'element', (int) $element->id, $shown->thumbnail_path) : null;
return new CardSubject(
title: (string) ($shown->display_title ?: $shown->working_title),
title: $title,
summary: $summary,
kind: filled($editorialKind) ? (string) $editorialKind : $output,
badge: $output,
@@ -3,6 +3,7 @@
namespace App\Domain\Cms\Widgets\Types;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Cms\Catalog\CardSubject;
use App\Domain\Cms\Catalog\PublicMaterialReader;
use App\Domain\Cms\Widgets\RenderContext;
@@ -88,4 +89,13 @@ protected function cardStyle(): string
{
return 'media';
}
protected function centralCoverId(mixed $id): ?int
{
$element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null;
return $element instanceof ContentElement
? app(PresentationMedia::class)->coverElementId($element)
: null;
}
}
@@ -137,6 +137,8 @@ public function dataRules(): array
return [
'action_label' => ['nullable', 'string', 'max:60'],
'note' => ['nullable', 'string', 'max:200'],
'heading' => ['nullable', 'string', 'max:200'],
'summary' => ['nullable', 'string', 'max:500'],
'alt' => ['nullable', 'string', 'max:300'],
'focus_x' => ['nullable', 'numeric', 'between:0,100'],
'focus_y' => ['nullable', 'numeric', 'between:0,100'],
@@ -178,7 +180,22 @@ public function editorSchema(): array
return [
Group::make([$this->subjectField()])->statePath('refs'),
Group::make([$action, $note])->statePath('data'),
Group::make([
$action,
$note,
TextInput::make('heading')
->label('Anzeigename nur für diese Karte')
->maxLength(200)
->live(onBlur: true)
->placeholder('Zentraler Anzeigename')
->helperText('Leer übernimmt den Anzeigenamen des Fachobjekts. Eine Eintragung gilt nur für diese Karte und ändert die Quelle nicht.'),
TextInput::make('summary')
->label('Teaser nur für diese Karte')
->maxLength(500)
->live(onBlur: true)
->placeholder('Zentraler Teaser oder Kurzbeschreibung')
->helperText('Leer übernimmt Teaser oder Kurzbeschreibung. Lehrinhalt, Rechte und Preise bleiben unberührt.'),
])->statePath('data'),
];
}
@@ -205,7 +222,7 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
$refs[$key] = $id;
$refs = ImageRefFields::clean($refs, $errors);
foreach (['action_label', 'note', 'alt'] as $field) {
foreach (['action_label', 'note', 'alt', 'heading', 'summary'] as $field) {
$data[$field] = filled($data[$field] ?? null) ? trim((string) $data[$field]) : null;
}
@@ -224,13 +241,22 @@ public function resolve(array $widget, RenderContext $context): array
$data = $widget['data'];
$subject = $this->subject($widget['refs'][$this->refKey()] ?? null, $context);
$heading = filled($data['heading'] ?? null) ? trim((string) $data['heading']) : null;
$lead = filled($data['summary'] ?? null) ? trim((string) $data['summary']) : null;
if ($subject instanceof CardSubject && ($heading !== null || $lead !== null)) {
$subject = $subject->withText($heading, $lead);
}
$storedImage = WebsiteImage::normalize($widget['refs']['image'] ?? null);
$imageRef = $storedImage ?? $this->centralCoverId($widget['refs'][$this->refKey()] ?? null);
return [
'subject' => $subject,
'cardStyle' => $subject?->style ?? $this->cardStyle(),
'imageUrl' => app(WebsiteImage::class)->url($widget['refs']['image'] ?? null, $context->preview),
'alt' => app(WebsiteImage::class)->alt($widget['refs']['image'] ?? null, $data['alt'] ?? null),
'imageNotice' => $context->preview ? app(WebsiteImage::class)->previewNotice($widget['refs']['image'] ?? null, 'Das Kartenbild') : null,
'imageUrl' => app(WebsiteImage::class)->url($imageRef, $context->preview),
'alt' => app(WebsiteImage::class)->alt($imageRef, $data['alt'] ?? null),
'imageNotice' => $context->preview ? app(WebsiteImage::class)->previewNotice($imageRef, 'Das Kartenbild') : null,
'focus' => PremiumFields::focus($data, 66, 45),
'format' => $option('format', 'landscape'),
'fit' => $option('fit', 'cover'),
@@ -261,6 +287,11 @@ public function summary(array $widget): string
return $label ?? 'Kein Objekt gewählt';
}
protected function centralCoverId(mixed $id): ?int
{
return null;
}
private function subjectField(): Select
{
return Select::make($this->refKey())
@@ -3,6 +3,7 @@
namespace App\Domain\Cms\Widgets\Types;
use App\Domain\Catalog\Composition;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Cms\Catalog\CardSubject;
use App\Domain\Cms\Catalog\PublicCatalogReader;
use App\Domain\Cms\Widgets\RenderContext;
@@ -97,4 +98,13 @@ protected function cardStyle(): string
{
return 'catalog';
}
protected function centralCoverId(mixed $id): ?int
{
$composition = is_numeric($id) ? Composition::query()->find((int) $id) : null;
return $composition instanceof Composition
? app(PresentationMedia::class)->coverElementId($composition)
: null;
}
}
+71
View File
@@ -0,0 +1,71 @@
<?php
namespace App\Domain\Media;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\DomainRuleException;
use Illuminate\Support\Facades\Storage;
/**
* Legt die technische Ableitung eines Präsentationsmediums an der Medienidentität ab.
* Es entsteht keine Inhaltsfassung, keine Freigabe und keine Berechtigung.
*/
class PresentationFile
{
public function store(ContentElement $element, string $incoming): void
{
if (! in_array($element->output_class, ['bild', 'film', 'audio'], true)) {
throw new DomainRuleException('Eine Präsentationsdatei ist ein Bild, ein Film oder ein Hörstück.');
}
if ($element->versions()->exists()) {
throw new DomainRuleException('Dieses Medium hat bereits eine Inhaltsfassung. Die Präsentationsdatei ersetzt sie nicht.');
}
if (! $this->readable($incoming)) {
throw new DomainRuleException('Die Datei liegt nicht im Eingang.');
}
$extension = strtolower(pathinfo($incoming, PATHINFO_EXTENSION));
$allowed = match ($element->output_class) {
'bild' => ['jpg', 'jpeg', 'png', 'webp', 'gif'],
'audio' => ['mp3', 'm4a', 'ogg'],
default => ['mp4', 'webm'],
};
if (! in_array($extension, $allowed, true)) {
throw new DomainRuleException('Diese Datei ist keine freigebbare Ableitung. Es wird keine Inhaltsfassung angelegt.');
}
$prefix = $element->output_class === 'bild' ? 'vorschau' : 'teaser';
$target = $prefix.'/'.$element->id.'/datei.'.$extension;
$stream = Storage::disk('cms_incoming')->readStream($incoming);
if (! is_resource($stream)) {
throw new DomainRuleException('Die Datei ließ sich nicht lesen.');
}
try {
Storage::disk('media_derived')->writeStream($target, $stream);
} finally {
fclose($stream);
}
if ($element->output_class === 'bild') {
$element->thumbnail_path = $target;
$element->thumbnail_source = 'eigen';
} else {
$element->preview_path = $target;
}
$element->save();
}
private function readable(string $path): bool
{
return (str_starts_with($path, 'inhalte/') || str_starts_with($path, 'cms/') || str_starts_with($path, 'vorschau/'))
&& ! str_contains($path, '..')
&& preg_match('#^(inhalte|cms|vorschau)/[A-Za-z0-9._\-/]+$#', $path) === 1
&& Storage::disk('cms_incoming')->exists($path);
}
}
+5 -1
View File
@@ -40,7 +40,11 @@ public function present(ContentElement|int $element): ?WebsitePresentation
title: $title,
alt: $alt !== '' ? $alt : $title,
credit: filled($element->website_credit) ? trim((string) $element->website_credit) : null,
kind: $element->output_class === 'film' ? 'film' : 'bild',
kind: match ($element->output_class) {
'film' => 'film',
'audio' => 'audio',
default => 'bild',
},
url: route('website.media', $element),
);
}
+19 -5
View File
@@ -44,7 +44,7 @@ public function refusal(ContentElement $element): ?string
}
if ($this->derivedPath($element) === null) {
return 'Für die Website fehlt eine freigebbare Ableitung. Beim Bild ist das das Vorschaubild, beim Film eine Teaserfassung unter teaser/. Die Originaldatei bleibt geschützt.';
return 'Für die Website fehlt eine freigebbare Ableitung. Beim Bild ist das das Vorschaubild. Film und Hörstück ohne Inhaltsfassung nutzen die Datei am Medium unter teaser/. Ein Film mit Inhaltsfassung nutzt die Teaserfassung seiner bereitgestellten Fassung. Die Originaldatei bleibt geschützt.';
}
return null;
@@ -57,7 +57,18 @@ public function derivedPath(ContentElement $element): ?string
}
if ($element->output_class === 'bild') {
return $this->allowedDerivedPath($element->thumbnail_path, 'vorschau/');
return $this->allowedDerivedPath($element->thumbnail_path, 'vorschau/', ['jpg', 'jpeg', 'png', 'webp', 'gif']);
}
if (in_array($element->output_class, ['film', 'audio'], true)) {
$extensions = $element->output_class === 'audio'
? ['mp3', 'm4a', 'ogg']
: ['mp4', 'webm'];
$own = $this->allowedDerivedPath($element->preview_path, 'teaser/', $extensions);
if ($own !== null) {
return $own;
}
}
if ($element->output_class !== 'film') {
@@ -79,7 +90,7 @@ public function derivedPath(ContentElement $element): ?string
->orderByDesc('id')
->value('path');
return $this->allowedDerivedPath($path, 'teaser/');
return $this->allowedDerivedPath($path, 'teaser/', ['mp4', 'webm']);
}
public function publicPath(ContentElement $element, string $derivedPath): string
@@ -100,7 +111,10 @@ private function isConfidential(ContentElement $element): bool
return in_array($slug, PublicMaterialReader::CONFIDENTIAL_KINDS, true);
}
private function allowedDerivedPath(mixed $path, string $prefix): ?string
/**
* @param list<string> $extensions
*/
private function allowedDerivedPath(mixed $path, string $prefix, array $extensions): ?string
{
if (! is_string($path) || ! str_starts_with($path, $prefix) || str_contains($path, '..')) {
return null;
@@ -108,7 +122,7 @@ private function allowedDerivedPath(mixed $path, string $prefix): ?string
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if (! in_array($extension, ['jpg', 'jpeg', 'png', 'webp', 'gif', 'mp4', 'webm'], true)) {
if (! in_array($extension, $extensions, true)) {
return null;
}
@@ -14,7 +14,6 @@
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\EditorialDimension;
use App\Domain\Catalog\EditorialDimensionValue;
use App\Domain\Catalog\EditorialWorkingDraft;
use App\Domain\Catalog\IdentityDimension;
use App\Domain\Catalog\IdentityDimensionValue;
@@ -23,6 +22,7 @@
use App\Domain\Cms\Catalog\PublicMaterialReader;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Support\EditorialCatalog;
use App\Filament\Support\ManagesEditorialSurface;
use App\Filament\Support\MediumForm;
use App\Http\Controllers\ContentPreviewController;
use App\Jobs\DeriveCompositionFrame;
@@ -41,6 +41,7 @@
abstract class EditComposition extends EditRecord
{
use ManagesEditorialSurface;
use WithFileUploads;
protected string $view = 'filament.editorial.edit';
@@ -49,8 +50,12 @@ abstract class EditComposition extends EditRecord
public string $displayTitle = '';
public string $teaser = '';
public string $summary = '';
public string $searchTerms = '';
public string $description = '';
public string $learningGoal = '';
@@ -84,6 +89,8 @@ abstract class EditComposition extends EditRecord
public bool $pickerOpen = false;
public string $pickerPurpose = 'aufbau';
public string $pickerQuery = '';
public string $pickerKind = 'alle';
@@ -315,11 +322,70 @@ public function openPicker(): void
$this->closePart();
}
$this->pickerPurpose = 'aufbau';
$this->pickerOpen = true;
$this->textOpen = false;
$this->pickerSelected = '';
}
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 = '';
}
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;
@@ -334,6 +400,10 @@ public function pickerResult(): array
return ['items' => [], 'more' => false];
}
if ($this->pickerPurpose === 'praesentation') {
return app(EditorialCatalog::class)->presentationBrowse($this->pickerQuery);
}
return app(EditorialCatalog::class)->browse(
$this->pickerQuery,
$this->pickerKind,
@@ -639,7 +709,7 @@ public function dimensionGroups(): array
{
$groups = [];
foreach (EditorialDimension::query()->with('values')->orderBy('label')->get() as $dimension) {
foreach (EditorialDimension::forSubject($this->getRecord()) as $dimension) {
$values = [];
foreach ($dimension->values as $value) {
@@ -1003,7 +1073,9 @@ 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,
@@ -1574,7 +1646,9 @@ protected function loadEditor(): void
$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 ?? '');
@@ -1802,16 +1876,7 @@ protected function blank(string $value): ?string
*/
protected function syncDimensions(Composition $composition, array $ids): void
{
IdentityDimensionValue::query()
->where('subject_type', $composition->getMorphClass())
->where('subject_id', $composition->id)
->where('origin', 'direkt')
->whereNotIn('editorial_dimension_value_id', $ids === [] ? [0] : $ids)
->delete();
foreach (EditorialDimensionValue::query()->whereIn('id', $ids)->get() as $value) {
app(IdentityDimension::class)->assign($composition, $value, 'direkt');
}
app(IdentityDimension::class)->replaceOffered($composition, $ids);
}
protected function persistPresentation(): bool
@@ -1829,7 +1894,9 @@ protected function persistPresentation(): bool
$record->designation = $name;
app(IdentityProfile::class)->fill($record, [
'display_title' => $this->displayTitle,
'teaser' => $this->teaser,
'summary' => $this->summary,
'search_terms' => $this->searchTerms,
'description' => $this->description,
'thumbnail_alt' => $this->thumbnailAlt,
], $this->actor());
@@ -9,7 +9,6 @@
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\EditorialDimension;
use App\Domain\Catalog\EditorialDimensionValue;
use App\Domain\Catalog\IdentityDimension;
use App\Domain\Catalog\IdentityDimensionValue;
use App\Domain\Catalog\IdentityProfile;
@@ -93,7 +92,7 @@ public function form(Schema $schema): Schema
CheckboxList::make('dimension_ids')->label('Fachliche Einordnung')
->options(function (): array {
$options = [];
foreach (EditorialDimension::query()->with('values')->orderBy('label')->get() as $dimension) {
foreach (EditorialDimension::forSubject($this->getRecord()) as $dimension) {
foreach ($dimension->values as $value) {
$options[$value->id] = $dimension->label.': '.$value->label;
}
@@ -233,16 +232,7 @@ protected function handleRecordUpdate(Model $record, array $data): Model
DeriveThumbnail::dispatch('element', $record->id, $data['thumbnail_upload']);
}
if (array_key_exists('dimension_ids', $data)) {
$ids = array_map(intval(...), $data['dimension_ids'] ?? []);
IdentityDimensionValue::query()
->where('subject_type', $record->getMorphClass())
->where('subject_id', $record->id)
->where('origin', 'direkt')
->whereNotIn('editorial_dimension_value_id', $ids === [] ? [0] : $ids)
->delete();
foreach (EditorialDimensionValue::query()->whereIn('id', $ids)->get() as $value) {
app(IdentityDimension::class)->assign($record, $value, 'direkt');
}
app(IdentityDimension::class)->replaceOffered($record, array_map(intval(...), $data['dimension_ids'] ?? []));
}
app(PillarService::class)->assign($record, array_map(intval(...), $data['pillars'] ?? []));
} catch (DomainRuleException $exception) {
@@ -2,6 +2,7 @@
namespace App\Filament\Resources\ContentElements\Pages;
use App\Domain\Catalog\EditorialContentKind;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Support\MediaLibrary;
use App\Filament\Support\MediumForm;
@@ -46,6 +47,9 @@ class ListContentElements extends ListRecords
#[Url(as: 'saeule', except: '')]
public string $saeule = '';
#[Url(as: 'inhaltsart', except: '')]
public string $inhaltsart = '';
#[Url(as: 'einordnung', except: '')]
public string $einordnung = '';
@@ -112,6 +116,14 @@ public function classificationOptions(): array
return app(MediaLibrary::class)->classifications();
}
/**
* @return array<int, string>
*/
public function contentKindOptions(): array
{
return EditorialContentKind::selectOptions();
}
public function filtersActive(): bool
{
return trim($this->suche) !== ''
@@ -122,6 +134,7 @@ public function filtersActive(): bool
|| $this->nutzung !== ''
|| $this->saeule !== ''
|| $this->einordnung !== ''
|| $this->inhaltsart !== ''
|| $this->verarbeitung !== ''
|| $this->archiv !== 'aktiv';
}
@@ -136,6 +149,7 @@ public function resetFilters(): void
$this->nutzung = '';
$this->saeule = '';
$this->einordnung = '';
$this->inhaltsart = '';
$this->verarbeitung = '';
$this->archiv = 'aktiv';
}
@@ -154,6 +168,7 @@ private function libraryFilters(): array
'nutzung' => $this->nutzung,
'saeule' => $this->saeule,
'einordnung' => $this->einordnung,
'inhaltsart' => $this->inhaltsart,
'verarbeitung' => $this->verarbeitung,
'archiv' => $this->archiv,
];
@@ -6,7 +6,6 @@
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\EditorialDimensionValue;
use App\Domain\Catalog\IdentityChange;
use App\Domain\Catalog\IdentityDimension;
use App\Domain\Catalog\IdentityDimensionValue;
@@ -22,6 +21,7 @@
use App\Filament\Support\CatalogReading;
use App\Filament\Support\EditorialCatalog;
use App\Filament\Support\ElementRevision;
use App\Filament\Support\ManagesEditorialSurface;
use App\Filament\Support\MediaLibrary;
use App\Filament\Support\ReportsDomainRules;
use App\Http\Controllers\ContentPreviewController;
@@ -39,6 +39,7 @@
class ViewContentElement extends ViewRecord
{
use ManagesEditorialSurface;
use ReportsDomainRules;
use WithFileUploads;
@@ -62,8 +63,12 @@ class ViewContentElement extends ViewRecord
public string $displayTitle = '';
public string $teaser = '';
public string $summary = '';
public string $searchTerms = '';
public string $descriptionText = '';
public string $usageNote = '';
@@ -109,7 +114,7 @@ public function mount(int|string $record): void
}
$bereich = (string) request()->query('bereich', 'beschreibung');
$this->bereich = in_array($bereich, ['beschreibung', 'inhalt', 'fassungen', 'verwendung', 'vorschau'], true)
$this->bereich = in_array($bereich, ['beschreibung', 'inhalt', 'fassungen', 'praesentation', 'verwendung', 'vorschau'], true)
? $bereich
: 'beschreibung';
$this->thumbnailAlt = (string) ($this->getRecord()->thumbnail_alt ?? '');
@@ -458,7 +463,9 @@ public function saveEditorial(): void
app(IdentityProfile::class)->fill($element, [
'working_title' => $title,
'display_title' => $this->displayTitle,
'teaser' => $this->teaser,
'summary' => $this->summary,
'search_terms' => $this->searchTerms,
'description' => $this->descriptionText,
'usage_note' => $this->usageNote,
'license_note' => $this->licenseNote,
@@ -468,17 +475,7 @@ public function saveEditorial(): void
'editorial_content_kind_id' => filled($this->kindId) ? (int) $this->kindId : null,
], auth()->user());
app(PillarService::class)->assign($element, array_map(intval(...), $this->pillarIds));
$ids = array_map(intval(...), $this->dimensionIds);
IdentityDimensionValue::query()
->where('subject_type', $element->getMorphClass())
->where('subject_id', $element->id)
->where('origin', 'direkt')
->whereNotIn('editorial_dimension_value_id', $ids === [] ? [0] : $ids)
->delete();
foreach (EditorialDimensionValue::query()->whereIn('id', $ids)->get() as $value) {
app(IdentityDimension::class)->assign($element, $value, 'direkt');
}
app(IdentityDimension::class)->replaceOffered($element, array_map(intval(...), $this->dimensionIds));
$element->refresh();
$this->fillEditorial();
@@ -665,8 +662,10 @@ public function editorialHistory(): array
$labels = [
'working_title' => 'Arbeitstitel',
'display_title' => 'Anzeigename',
'teaser' => 'Teaser',
'description' => 'Beschreibung',
'summary' => 'Kurzbeschreibung',
'search_terms' => 'Suchbegriffe',
'usage_note' => 'Einsatzhinweis',
'license_note' => 'Interner Lizenzvermerk',
'website_credit' => 'Quellenzeile',
@@ -709,7 +708,9 @@ private function fillEditorial(): void
$element = $this->getRecord();
$this->workingTitle = (string) $element->working_title;
$this->displayTitle = (string) ($element->display_title ?? '');
$this->teaser = (string) ($element->teaser ?? '');
$this->summary = (string) ($element->summary ?? '');
$this->searchTerms = (string) ($element->search_terms ?? '');
$this->descriptionText = (string) ($element->description ?? '');
$this->usageNote = (string) ($element->usage_note ?? '');
$this->licenseNote = (string) ($element->license_note ?? '');
@@ -12,6 +12,7 @@
use Filament\Infolists\Components\TextEntry;
use Filament\Resources\Resource;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\View;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
@@ -62,6 +63,7 @@ public static function infolist(Schema $schema): Schema
TextEntry::make('context')->hiddenLabel()->listWithLineBreaks()
->state(fn (LicenseArticle $record): array => app(CatalogReading::class)->articleContext($record)),
]),
View::make('filament.editorial.license-desk'),
]);
}
@@ -5,9 +5,14 @@
use App\Domain\Catalog\ArticleService;
use App\Domain\Catalog\CompositionVersion;
use App\Domain\Catalog\ContentElementVersion;
use App\Domain\Catalog\EditorialDimension;
use App\Domain\Catalog\IdentityDimension;
use App\Domain\Catalog\IdentityDimensionValue;
use App\Domain\Catalog\IdentityProfile;
use App\Domain\Catalog\LicenseArticle;
use App\Filament\Resources\LicenseArticles\LicenseArticleResource;
use App\Filament\Support\CatalogOptions;
use App\Filament\Support\ManagesEditorialSurface;
use App\Filament\Support\ReportsDomainRules;
use Filament\Actions\Action;
use Filament\Forms\Components\Select;
@@ -17,10 +22,108 @@
class ViewLicenseArticle extends ViewRecord
{
use ManagesEditorialSurface;
use ReportsDomainRules;
protected static string $resource = LicenseArticleResource::class;
public string $workingTitle = '';
public string $displayTitle = '';
public string $teaser = '';
public string $summary = '';
public string $descriptionText = '';
public string $searchTerms = '';
public int|string|null $kindId = null;
/** @var list<int|string> */
public array $dimensionIds = [];
public function mount(int|string $record): void
{
parent::mount($record);
$this->fillLicenseEditorial();
}
public function canEditEditorial(): bool
{
return LicenseArticleResource::keeper();
}
public function saveLicenseEditorial(): void
{
$this->guardEditorial();
/** @var LicenseArticle $article */
$article = $this->getRecord();
$releaseId = $article->current_release_id;
$releases = $article->releases()->count();
app(IdentityProfile::class)->fill($article, [
'working_title' => $this->workingTitle,
'display_title' => $this->displayTitle,
'teaser' => $this->teaser,
'summary' => $this->summary,
'description' => $this->descriptionText,
'search_terms' => $this->searchTerms,
'editorial_content_kind_id' => filled($this->kindId) ? (int) $this->kindId : null,
], auth()->user());
app(IdentityDimension::class)->replaceOffered($article, array_map(intval(...), $this->dimensionIds));
$article->refresh();
$this->fillLicenseEditorial();
$this->deskFeedback = $article->current_release_id === $releaseId && $article->releases()->count() === $releases
? 'Gespeichert. Stand, Preis und Rechte bleiben unverändert.'
: 'Gespeichert. Prüfe den Artikelstand, er hat sich geändert.';
}
/**
* @return list<array{label: string, values: list<array{id: int, label: string}>}>
*/
public function licenseDimensionGroups(): array
{
$groups = [];
foreach (EditorialDimension::forSubject($this->getRecord()) as $dimension) {
$values = [];
foreach ($dimension->values as $value) {
$values[] = ['id' => $value->id, 'label' => $value->label];
}
if ($values !== []) {
$groups[] = ['label' => $dimension->label, 'values' => $values];
}
}
return $groups;
}
private function fillLicenseEditorial(): void
{
/** @var LicenseArticle $article */
$article = $this->getRecord();
$this->workingTitle = (string) ($article->working_title ?? '');
$this->displayTitle = (string) ($article->display_title ?? '');
$this->teaser = (string) ($article->teaser ?? '');
$this->summary = (string) ($article->summary ?? '');
$this->descriptionText = (string) ($article->description ?? '');
$this->searchTerms = (string) ($article->search_terms ?? '');
$this->kindId = $article->editorial_content_kind_id;
$this->dimensionIds = IdentityDimensionValue::query()
->where('subject_type', $article->getMorphClass())
->where('subject_id', $article->id)
->where('origin', 'direkt')
->pluck('editorial_dimension_value_id')
->all();
}
protected function getHeaderActions(): array
{
return [
+113
View File
@@ -65,6 +65,10 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
return $this->draftCompositionRow((int) $draftMatch[1], $exceptCompositionId, $allowSelf);
}
if (preg_match('/^medium:(\d+)$/', $target, $mediumMatch) === 1) {
return $this->rowForPresentationMedium((int) $mediumMatch[1]);
}
if (preg_match('/^(element|composition):(\d+)$/', $target, $match) !== 1) {
return null;
}
@@ -210,6 +214,8 @@ public function search(string $query, string $scope, int $exceptCompositionId):
$builder->where('working_title', 'like', $like)
->orWhere('display_title', 'like', $like)
->orWhere('teaser', 'like', $like)
->orWhere('search_terms', 'like', $like)
->orWhere('summary', 'like', $like);
})
->orderByDesc('id')
@@ -242,6 +248,8 @@ public function search(string $query, string $scope, int $exceptCompositionId):
$builder->where(function ($inner) use ($like): void {
$inner->where('designation', 'like', $like)
->orWhere('display_title', 'like', $like)
->orWhere('teaser', 'like', $like)
->orWhere('search_terms', 'like', $like)
->orWhere('summary', 'like', $like);
});
})
@@ -317,6 +325,8 @@ public function browse(string $query, string $kind, string $dimension, int $exce
$builder->where(function ($inner) use ($like): void {
$inner->where('designation', 'like', $like)
->orWhere('display_title', 'like', $like)
->orWhere('teaser', 'like', $like)
->orWhere('search_terms', 'like', $like)
->orWhere('summary', 'like', $like);
});
})
@@ -382,6 +392,105 @@ public function browse(string $query, string $kind, string $dimension, int $exce
];
}
/**
* Bestandssuche für Präsentationsmedien.
* Fassungen bleiben im didaktischen Aufbau. Bilder, Filme und Hörstücke ohne Inhaltsfassung kommen dazu.
*
* @return array{items: list<array<string, string|null>>, more: bool}
*/
public function presentationBrowse(string $query): array
{
$catalog = $this->browse($query, 'alle', '', 0, elementsOnly: true);
$seen = [];
foreach ($catalog['items'] as $item) {
if (isset($item['element_id'])) {
$seen[(int) $item['element_id']] = true;
}
}
$query = trim($query);
$like = '%'.str_replace(['%', '_'], ['', ''], $query).'%';
$elements = ContentElement::query()
->with('editorialContentKind')
->whereIn('output_class', ['bild', 'film', 'audio'])
->whereNull('archived_at')
->whereDoesntHave('versions')
->where(function ($builder): void {
$builder->whereNull('editorial_content_kind_id')
->orWhereDoesntHave('editorialContentKind', function ($kind): void {
$kind->where('slug', 'traineranleitung');
});
})
->when($query !== '', function ($builder) use ($like): void {
$builder->where(function ($inner) use ($like): void {
$inner->where('working_title', 'like', $like)
->orWhere('display_title', 'like', $like)
->orWhere('teaser', 'like', $like)
->orWhere('search_terms', 'like', $like)
->orWhere('summary', 'like', $like);
});
})
->orderBy('working_title')
->limit(48)
->get();
foreach ($elements as $element) {
if (isset($seen[$element->id])) {
continue;
}
$row = $this->rowForPresentationMedium($element->id);
if ($row !== null) {
$catalog['items'][] = $row;
}
}
return $catalog;
}
/**
* @return array<string, string|null>|null
*/
private function rowForPresentationMedium(int $id): ?array
{
$element = ContentElement::query()->with('editorialContentKind')->find($id);
if (! $element instanceof ContentElement
|| $element->archived_at !== null
|| ! in_array($element->output_class, ['bild', 'film', 'audio'], true)
|| $element->editorialContentKind?->slug === 'traineranleitung') {
return null;
}
$kind = $element->editorialContentKind?->label ?: $this->outputLabel((string) $element->output_class);
$title = filled($element->display_title) ? $element->display_title : $element->working_title;
return [
'target' => 'medium:'.$element->id,
'element_id' => (string) $element->id,
'title' => $title,
'kind' => $kind,
'output' => (string) $element->output_class,
'body' => '',
'summary' => (string) ($element->summary ?: $element->description ?: ''),
'medium_description' => (string) ($element->description ?? ''),
'usage_note' => (string) ($element->usage_note ?? ''),
'license_note' => (string) ($element->license_note ?? ''),
'tone' => $this->tone((string) $element->output_class, $kind),
'image' => $element->output_class === 'bild'
? $this->cardUrl('element', $element->id, $element->thumbnail_path)
: null,
'version_label' => 'Ohne Inhaltsfassung',
'committed' => false,
'identity' => 'medium:'.$element->id,
'open_url' => ContentElementResource::getUrl('view', ['record' => $element]),
'open_label' => 'Medium ansehen',
'edit_url' => ContentElementResource::getUrl('view', ['record' => $element]),
];
}
public function tone(string $outputClass, string $kindLabel): string
{
$value = mb_strtolower($outputClass.' '.$kindLabel);
@@ -468,6 +577,8 @@ private function constrainElement($builder, string $query, string $like, string
$builder->where(function ($inner) use ($like): void {
$inner->where('working_title', 'like', $like)
->orWhere('display_title', 'like', $like)
->orWhere('teaser', 'like', $like)
->orWhere('search_terms', 'like', $like)
->orWhere('summary', 'like', $like)
->orWhere('description', 'like', $like);
});
@@ -749,6 +860,8 @@ public function mediaPictures(string $query): array
->where(function ($builder) use ($like): void {
$builder->where('working_title', 'like', $like)
->orWhere('display_title', 'like', $like)
->orWhere('teaser', 'like', $like)
->orWhere('search_terms', 'like', $like)
->orWhere('summary', 'like', $like);
})
->orderBy('working_title')
@@ -0,0 +1,282 @@
<?php
namespace App\Filament\Support;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\ContentVersionStatus;
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\EditorialProfile;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\EditorialTextVariant;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Catalog\PresentationRole;
use App\Domain\Media\WebsiteRelease;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
/**
* Gemeinsame Bedienung für Präsentationsmedien und abweichende Formulierungen.
* Die Texte selbst bleiben an den vorhandenen Feldern der jeweiligen Seite.
*/
trait ManagesEditorialSurface
{
public string $presentationRole = 'titelbild';
public string $presentationQuery = '';
public string $presentationPick = '';
public bool $bindToVersion = false;
public string $deskFeedback = '';
public string $variantAudience = 'kachel';
public string $variantField = 'teaser';
public string $variantBody = '';
public function editorialSubject(): Model
{
return $this->getRecord();
}
public function editorialProfile(?string $audience = null): EditorialProfile
{
return app(EditorialProfileReader::class)->read($this->editorialSubject(), $audience);
}
/**
* @return list<string>
*/
public function editorialGaps(): array
{
$profile = $this->editorialProfile();
$gaps = [];
foreach ([
'display_title' => 'Anzeigename',
'teaser' => 'Teaser',
'summary' => 'Kurzbeschreibung',
'description' => 'Ausführliche Beschreibung',
] as $field => $label) {
if ($profile->value($field) === null) {
$gaps[] = $label;
}
}
return $gaps;
}
/**
* @return list<array<string, mixed>>
*/
public function presentationRows(): array
{
return app(PresentationMedia::class)->rows($this->editorialSubject());
}
/**
* @return array<string, string>
*/
public function presentationRoleOptions(): array
{
return PresentationRole::selectOptions();
}
/**
* @return array{items: list<array<string, mixed>>, more: bool}
*/
public function presentationChoices(): array
{
return app(EditorialCatalog::class)->presentationBrowse($this->presentationQuery);
}
public function assignPickedPresentation(): void
{
$this->guardEditorial();
$row = app(EditorialCatalog::class)->rowForTarget($this->presentationPick, 0, allowDraft: true);
if ($row === null || ! isset($row['element_id'])) {
$this->deskFeedback = 'Bitte ein Medium aus dem Bestand wählen.';
return;
}
$this->rememberAssignment((int) $row['element_id'], isset($row['target']) ? (string) $row['target'] : null);
$this->presentationPick = '';
}
public function detachPresentation(int $assignmentId): void
{
$this->guardEditorial();
$this->deskFeedback = $this->reportPresentation(
fn (): string => app(PresentationMedia::class)->detach($this->editorialSubject(), $assignmentId, $this->deskActor()),
);
}
public function movePresentation(int $assignmentId, int $direction): void
{
$this->guardEditorial();
$this->deskFeedback = $this->reportPresentation(function () use ($assignmentId, $direction): string {
app(PresentationMedia::class)->move($this->editorialSubject(), $assignmentId, $direction, $this->deskActor());
return 'Die Reihenfolge ist gespeichert.';
});
}
public function releaseAssigned(int $elementId): void
{
abort_unless(ContentElementResource::editor(), 403);
$element = ContentElement::query()->find($elementId);
if (! $element instanceof ContentElement) {
$this->deskFeedback = 'Das Medium fehlt.';
return;
}
$this->deskFeedback = app(WebsiteRelease::class)->release($element, $this->deskActor());
}
public function withdrawAssigned(int $elementId): void
{
abort_unless(ContentElementResource::editor(), 403);
$element = ContentElement::query()->find($elementId);
if (! $element instanceof ContentElement) {
$this->deskFeedback = 'Das Medium fehlt.';
return;
}
$this->deskFeedback = app(WebsiteRelease::class)->withdraw($element, $this->deskActor());
}
/**
* @return list<EditorialTextVariant>
*/
public function variantRows(): array
{
$subject = $this->editorialSubject();
return EditorialTextVariant::query()
->where('subject_type', $subject->getMorphClass())
->where('subject_id', $subject->getKey())
->orderBy('audience')
->orderBy('field')
->get()
->all();
}
public function saveVariant(): void
{
$this->guardEditorial();
$this->deskFeedback = $this->reportPresentation(
fn (): string => app(EditorialProfileReader::class)->putVariant(
$this->editorialSubject(),
$this->variantField,
$this->variantAudience,
$this->variantBody,
$this->deskActor(),
),
);
$this->variantBody = '';
}
public function forgetVariant(int $variantId): void
{
$this->guardEditorial();
$variant = EditorialTextVariant::query()->find($variantId);
if (! $variant instanceof EditorialTextVariant) {
$this->deskFeedback = 'Diese Abweichung gibt es nicht mehr.';
return;
}
$this->reportPresentation(function () use ($variant): string {
app(EditorialProfileReader::class)->forgetVariant($this->editorialSubject(), $variant, $this->deskActor());
return 'Die abweichende Formulierung ist entfernt.';
});
$this->deskFeedback = 'Die abweichende Formulierung ist entfernt. Es gilt wieder die zentrale Angabe.';
}
public function variantFieldLabel(string $field): string
{
return match ($field) {
'display_title' => 'Anzeigename',
'teaser' => 'Teaser',
'summary' => 'Kurzbeschreibung',
'description' => 'Ausführliche Beschreibung',
default => $field,
};
}
public function canReleasePresentation(): bool
{
return ContentElementResource::editor();
}
public function canEditEditorial(): bool
{
return ContentElementResource::editor();
}
protected function rememberAssignment(int $elementId, ?string $target): void
{
$sourceId = null;
if ($this->bindToVersion && in_array($this->presentationRole, PresentationRole::BOUND_ROLES, true)) {
$subject = $this->editorialSubject();
$sourceId = $subject instanceof ContentElement
? $subject->versions()->where('status', ContentVersionStatus::Bereit)->orderByDesc('number')->value('id')
: $this->versionIdFromTarget($target);
}
$this->deskFeedback = $this->reportPresentation(
fn (): string => app(PresentationMedia::class)->assign(
$this->editorialSubject(),
$this->presentationRole,
$elementId,
$sourceId !== null ? (int) $sourceId : null,
$this->deskActor(),
),
);
}
protected function versionIdFromTarget(?string $target): ?int
{
if (is_string($target) && preg_match('/^element:(\d+)$/', $target, $match) === 1) {
return (int) $match[1];
}
return null;
}
protected function guardEditorial(): void
{
abort_unless($this->canEditEditorial(), 403);
}
protected function deskActor(): ?User
{
$user = auth()->user();
return $user instanceof User ? $user : null;
}
/**
* @param callable(): string $action
*/
protected function reportPresentation(callable $action): string
{
try {
return $action();
} catch (DomainRuleException $exception) {
return $exception->getMessage();
}
}
}
+10 -2
View File
@@ -75,7 +75,7 @@ public function classifications(): array
*/
public function cardFor(ContentElement $element, bool $canEdit): array
{
$element->loadMissing(['versions', 'pillars']);
$element->loadMissing(['versions', 'pillars', 'editorialContentKind']);
$versionIds = $element->versions->pluck('id')->all();
return $this->card(
@@ -95,7 +95,7 @@ public function cards(array $filters, bool $canEdit): array
{
$filters = $this->normalize($filters);
$elements = ContentElement::query()
->with(['versions', 'pillars'])
->with(['versions', 'pillars', 'editorialContentKind'])
->orderBy('working_title')
->get();
$versionIds = $elements->flatMap(fn (ContentElement $element) => $element->versions->pluck('id'))->all();
@@ -140,6 +140,7 @@ private function normalize(array $filters): array
'nutzung' => $this->choice($filters['nutzung'] ?? '', ['verwendet', 'unbenutzt']),
'saeule' => ctype_digit($filters['saeule'] ?? '') ? $filters['saeule'] : '',
'einordnung' => ctype_digit($filters['einordnung'] ?? '') ? $filters['einordnung'] : '',
'inhaltsart' => ctype_digit($filters['inhaltsart'] ?? '') ? $filters['inhaltsart'] : '',
'verarbeitung' => $this->choice($filters['verarbeitung'] ?? '', ['fehler', 'uebernahme']),
'archiv' => $this->choice($filters['archiv'] ?? '', ['aktiv', 'archiviert', 'alle'], 'aktiv'),
];
@@ -418,6 +419,10 @@ private function matches(ContentElement $element, array $portrait, array $uses,
return false;
}
if ($filters['inhaltsart'] !== '' && (int) $element->editorial_content_kind_id !== (int) $filters['inhaltsart']) {
return false;
}
if ($filters['verarbeitung'] === 'fehler' && $portrait['processing'] !== 'Verarbeitungsfehler') {
return false;
}
@@ -451,6 +456,8 @@ private function haystack(ContentElement $element): string
$element->display_title,
$element->description,
$element->summary,
$element->teaser,
$element->search_terms,
$element->usage_note,
], fn (mixed $value): bool => is_string($value) && trim($value) !== '')));
}
@@ -473,6 +480,7 @@ private function card(ContentElement $element, array $portrait, array $uses, arr
'id' => $element->id,
'title' => $element->working_title,
'type' => $this->catalog->outputLabel((string) $element->output_class),
'editorialKind' => $element->editorialContentKind?->label,
'typeKey' => $typeKey,
'description' => $description === '' ? null : $description,
'usageNote' => $usageNote === '' ? null : $usageNote,
+16 -6
View File
@@ -7,7 +7,9 @@
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\IdentityProfile;
use App\Domain\Media\PresentationFile;
use App\Jobs\DeriveThumbnail;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
@@ -39,6 +41,10 @@ public static function fields(bool $creating, ?ContentElement $element = null):
$fields[] = self::fileField()
->visible(fn ($get): bool => filled($get('shape')) && $get('shape') !== 'text')
->required(fn ($get): bool => filled($get('shape')) && $get('shape') !== 'text');
$fields[] = Checkbox::make('without_version')
->label('Eigenständiges Präsentationsmedium')
->helperText('Bild, Film oder Hörstück ohne fachliche Inhaltsfassung. Die Datei bleibt eine technische Ableitung am Medium. Sie wird nicht lizenziert und nicht automatisch für die Website freigegeben.')
->visible(fn ($get): bool => in_array($get('shape'), ['film', 'audio', 'bild'], true));
} elseif ($element?->output_class === 'text') {
$fields[] = Textarea::make('body')->label('Text')->rows(8)->required();
}
@@ -120,13 +126,17 @@ public static function create(array $data, bool $hold): ContentElement
throw new DomainRuleException('Diese Datei passt nicht zur gewählten Art.');
}
$metadata = ['incoming' => $incoming];
if ($hold) {
$metadata['hold'] = true;
$service->draftElementVersion($element, null, $metadata);
if (! empty($data['without_version']) && in_array($output, ['bild', 'film', 'audio'], true)) {
app(PresentationFile::class)->store($element, $incoming);
} else {
$service->publishElementVersion($element, null, $metadata);
$metadata = ['incoming' => $incoming];
if ($hold) {
$metadata['hold'] = true;
$service->draftElementVersion($element, null, $metadata);
} else {
$service->publishElementVersion($element, null, $metadata);
}
}
}
@@ -0,0 +1,191 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('content_elements', function (Blueprint $table) {
$table->text('teaser')->nullable()->after('display_title');
$table->text('search_terms')->nullable()->after('summary');
});
Schema::table('compositions', function (Blueprint $table) {
$table->text('teaser')->nullable()->after('display_title');
$table->text('search_terms')->nullable()->after('description');
});
Schema::table('license_articles', function (Blueprint $table) {
$table->string('working_title')->nullable()->after('code');
$table->string('display_title')->nullable()->after('working_title');
$table->text('teaser')->nullable()->after('display_title');
$table->text('summary')->nullable()->after('teaser');
$table->text('description')->nullable()->after('summary');
$table->text('search_terms')->nullable()->after('description');
$table->foreignId('editorial_content_kind_id')
->nullable()
->after('search_terms')
->constrained('editorial_content_kinds')
->nullOnDelete();
});
Schema::create('editorial_text_variants', function (Blueprint $table) {
$table->id();
$table->string('subject_type');
$table->unsignedBigInteger('subject_id');
$table->string('field');
$table->string('audience');
$table->text('body');
$table->timestamps();
$table->unique(['subject_type', 'subject_id', 'field', 'audience'], 'editorial_text_variant_unique');
});
Schema::create('presentation_roles', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique();
$table->string('label');
$table->boolean('multiple')->default(false);
$table->boolean('ordered')->default(false);
$table->unsignedInteger('sort_order')->default(0);
$table->timestamps();
});
Schema::create('presentation_assignments', function (Blueprint $table) {
$table->id();
$table->string('subject_type');
$table->unsignedBigInteger('subject_id');
$table->foreignId('content_element_id')->constrained('content_elements')->cascadeOnDelete();
$table->foreignId('presentation_role_id')->constrained('presentation_roles')->cascadeOnDelete();
$table->unsignedInteger('position')->default(1);
$table->foreignId('source_version_id')->nullable()->constrained('content_element_versions')->nullOnDelete();
$table->timestamps();
$table->unique(
['subject_type', 'subject_id', 'presentation_role_id', 'content_element_id'],
'presentation_assignment_unique',
);
$table->index(['subject_type', 'subject_id'], 'presentation_assignment_subject');
});
$now = now();
foreach ([
['slug' => 'unterrichtsfilm', 'label' => 'Unterrichtsfilm', 'sort_order' => 50],
['slug' => 'kurzfilm', 'label' => 'Kurzfilm / Filmbeispiel', 'sort_order' => 60],
['slug' => 'trailer', 'label' => 'Trailer / Teaserfilm', 'sort_order' => 70],
['slug' => 'interview', 'label' => 'Interview', 'sort_order' => 80],
['slug' => 'arbeitsblatt', 'label' => 'Arbeitsblatt', 'sort_order' => 90],
['slug' => 'uebungsbeschreibung', 'label' => 'Übungsbeschreibung', 'sort_order' => 100],
['slug' => 'titelbild', 'label' => 'Titelbild / Keyvisual', 'sort_order' => 110],
['slug' => 'hintergrundbild', 'label' => 'Hintergrundbild', 'sort_order' => 120],
['slug' => 'praesentationsbild', 'label' => 'Sonstiges Präsentationsbild', 'sort_order' => 130],
['slug' => 'audioanleitung', 'label' => 'Audioanleitung', 'sort_order' => 140],
] as $row) {
DB::table('editorial_content_kinds')->insert($row + ['created_at' => $now, 'updated_at' => $now]);
}
$dimensions = [
'verwendungszweck' => [
'label' => 'Redaktioneller Verwendungszweck',
'values' => [
'training' => 'Training / Lehrinhalt',
'begleitmaterial' => 'Trainer- und Begleitmaterial',
'website' => 'Website / Marketing',
'marke' => 'Markenpräsentation',
'intern' => 'Interne redaktionelle Ressource',
],
],
'zielgruppe' => [
'label' => 'Altersbereich und Zielgruppe',
'values' => [
'kinder' => 'Kinder',
'jugendliche' => 'Jugendliche',
'erwachsene' => 'Erwachsene',
'eltern' => 'Eltern',
'fachkraefte' => 'Fachkräfte',
],
],
'einsatzbereich' => [
'label' => 'Einsatzbereich',
'values' => [
'kita' => 'Kita',
'schule' => 'Schule',
'familie' => 'Familie',
'fortbildung' => 'Fortbildung',
],
],
];
foreach ($dimensions as $slug => $dimension) {
$dimensionId = DB::table('editorial_dimensions')->insertGetId([
'slug' => $slug,
'label' => $dimension['label'],
'created_at' => $now,
'updated_at' => $now,
]);
foreach ($dimension['values'] as $valueSlug => $label) {
DB::table('editorial_dimension_values')->insert([
'editorial_dimension_id' => $dimensionId,
'slug' => $valueSlug,
'label' => $label,
'created_at' => $now,
'updated_at' => $now,
]);
}
}
foreach ([
['slug' => 'titelbild', 'label' => 'Titelbild / Standard-Thumbnail', 'multiple' => false, 'ordered' => false, 'sort_order' => 10],
['slug' => 'titelbild_alternativ', 'label' => 'Alternatives Titelbild', 'multiple' => true, 'ordered' => true, 'sort_order' => 20],
['slug' => 'hero', 'label' => 'Hero-Bild', 'multiple' => false, 'ordered' => false, 'sort_order' => 30],
['slug' => 'hover', 'label' => 'Hoverbild', 'multiple' => false, 'ordered' => false, 'sort_order' => 40],
['slug' => 'trailer', 'label' => 'Trailer / Teaserfilm', 'multiple' => true, 'ordered' => true, 'sort_order' => 50],
['slug' => 'vorschauclip', 'label' => 'Vorschauclip', 'multiple' => true, 'ordered' => true, 'sort_order' => 60],
['slug' => 'audiovorschau', 'label' => 'Audiovorschau', 'multiple' => true, 'ordered' => true, 'sort_order' => 70],
['slug' => 'interview', 'label' => 'Interview', 'multiple' => true, 'ordered' => true, 'sort_order' => 80],
['slug' => 'galerie', 'label' => 'Galerieelement', 'multiple' => true, 'ordered' => true, 'sort_order' => 90],
] as $role) {
DB::table('presentation_roles')->insert($role + ['created_at' => $now, 'updated_at' => $now]);
}
}
public function down(): void
{
Schema::dropIfExists('presentation_assignments');
Schema::dropIfExists('presentation_roles');
Schema::dropIfExists('editorial_text_variants');
Schema::table('license_articles', function (Blueprint $table) {
$table->dropConstrainedForeignId('editorial_content_kind_id');
$table->dropColumn(['working_title', 'display_title', 'teaser', 'summary', 'description', 'search_terms']);
});
Schema::table('compositions', function (Blueprint $table) {
$table->dropColumn(['teaser', 'search_terms']);
});
Schema::table('content_elements', function (Blueprint $table) {
$table->dropColumn(['teaser', 'search_terms']);
});
$dimensionIds = DB::table('editorial_dimensions')
->whereIn('slug', ['verwendungszweck', 'zielgruppe', 'einsatzbereich'])
->pluck('id');
DB::table('identity_dimension_values')->whereIn(
'editorial_dimension_value_id',
DB::table('editorial_dimension_values')->whereIn('editorial_dimension_id', $dimensionIds)->pluck('id'),
)->delete();
DB::table('editorial_dimension_values')->whereIn('editorial_dimension_id', $dimensionIds)->delete();
DB::table('editorial_dimensions')->whereIn('id', $dimensionIds)->delete();
DB::table('editorial_content_kinds')->whereIn('slug', [
'unterrichtsfilm', 'kurzfilm', 'trailer', 'interview', 'arbeitsblatt', 'uebungsbeschreibung',
'titelbild', 'hintergrundbild', 'praesentationsbild', 'audioanleitung',
])->delete();
}
};
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('content_elements', function (Blueprint $table) {
$table->string('preview_path')->nullable()->after('thumbnail_error');
});
}
public function down(): void
{
Schema::table('content_elements', function (Blueprint $table) {
$table->dropColumn('preview_path');
});
}
};
@@ -69,7 +69,7 @@ ## 3. Prüfung
## 4. Offene Punkte für Lars
1. **Bild entfällt oder Widget entfällt?** Die Dokumentation sagt, eine Komponente ohne freigegebenes Medium „erscheint öffentlich nicht“. Umgesetzt ist, dass nur das Bild entfällt, damit eine zurückgenommene Freigabe keine Überschrift (H1) von einer Seite entfernt.
1. **Bild entfällt oder Widget entfällt?** Entschieden am 19.11.2026: Das Medium wird nicht öffentlich ausgeliefert. Texte und übrige Widget-Inhalte bleiben. Ein Widget ohne verbleibenden Inhalt entfällt. Siehe ADR-40.
2. **Bildschlüssel:** Gespeichert wird im bisherigen Schlüssel `image` (`refs.image`, `style.image`, `data.items[].image`), nicht in `refs.element`. Grund: Die Medienkarte nutzt `refs.element` für ihr Fachobjekt. Das Dokument ist entsprechend ergänzt.
3. **Originalmotiv freigegeben:** „Lara Felix Park Original“ (`cms/lara-felix-park-original-…png`) lag bereits öffentlich unter `cms/` und ist durch die Übernahme ein freigegebenes Medium. Ist die Veröffentlichung nicht geklärt, im Medienmanager zurücknehmen; `/premium-referenz` zeigt es dann nicht mehr.
4. **Titel und Quellenzeilen der übernommenen Medien** kommen aus den Dateinamen, ohne Quellenzeile, zum Beispiel „Platzhalter Markenbuehne“ ohne Umlaut. Beides lässt sich im Medienmanager pflegen.
@@ -61,6 +61,7 @@ ## Übersicht der Architekturentscheidungen
| ADR-38 | Layoutvertrag der Widgets | Umgesetzt auf Test (18.11.2026); UX-Abnahme offen | Zulässige Rasterbreiten, Höhen und Verhalten bei wenig Platz je Widget-Art in der bestehenden Registry; Darstellung nach realer Containerbreite |
| ADR-39 | Premium-Karten mit Fachbezug | Umgesetzt auf Test (18.11.2026); gestalterische Freigabe v1.7 offen | Eine Karte je Platz im Abschnittsraster; Inhalte und Linkziel aus Thema, Medium oder Programm/Modul; keine Preise, keine Freigabe geschützter Medien |
| ADR-40 | Zentrale Medienverwaltung im CMS | Umgesetzt auf Test (19.11.2026); Abnahme offen | CMS-Bilder sind Medien des Medienmanagers (Kennung statt Pfad), öffentlich nur mit Website-Freigabe; frühere CMS-Bilder übernommen |
| ADR-41 | Gemeinsame Redaktionsbasis | Auf Test (19.11.2026, `develop` `f29ea58`); Betreiberabnahme offen. Technische Abbildung ist eine Arbeitsannahme, keine neue fachliche Freigabe | Klasse-A-Texte, Fachdimensionen und Präsentationsreferenzen an den bestehenden Fachobjekten; keine zweite Inhalts- oder Produktverwaltung |
---
@@ -523,6 +524,23 @@ ## ADR-40 – Zentrale Medienverwaltung im CMS
**Status am 19.11.2026:** Umgesetzt auf `develop`/Testinstanz (Branch `feature/cms-medienverwaltung`); Abnahme durch den Betreiber offen. Baut auf der Website-Freigabe des Medienmanagers auf (`medienzugriff-fuer-komponenten.md`).
**Kontext.** Das CMS hatte eine eigene Bildablage (`cms/`, `PublishPublicMedia`). Redakteure sollen Bilder im Medienmanager, im Modul-/Programmeditor und in CMS-Widgets aus demselben Bestand verwenden; öffentlich darf nur erscheinen, was für die Website freigegeben ist.
**Entscheidung.** Alle Bildstellen (Einstieg, Bild und Text, redaktionelle Karten, Premium-Karten, Abschnittshintergrund) speichern die Kennung des Inhaltselements im bisherigen Bildschlüssel `image` und lesen über `WebsiteMedia`. Uploads im Widget-Dialog laufen über `WebsiteIntake`. Frühere CMS-Bilder werden per Warteschlangen-Job übernommen (dedupliziert, nichts gelöscht) und über `website_media_aliases` zugeordnet; die Zuordnung wird erst nach der ersten Website-Freigabe wirksam. Ein nicht freigegebenes Bild entfällt öffentlich, das Widget bleibt.
**Alternativen.** Schlüssel `refs.element` wie im Dokument (verworfen: kollidiert mit dem Fachobjekt der Medienkarte); Revisionen per Migration umschreiben (verworfen: Revisionen bleiben unverändert, Rollback); ganzes Widget bei fehlender Freigabe ausblenden (verworfen bis zur Entscheidung: entfernt Überschriften und H1).
**Folgen und offene Prüfung.** Rollback zeigt nach der Umstellung gespeicherte Bilder nicht (Registry §9). Website-Bilder werden bis 2400 px abgeleitet. Offen: Entscheidung „Bild entfällt“ vs. „Widget entfällt“; übernommene Medien tragen Dateinamen als Titel und keine Quellenzeile; ein unter `cms/` liegendes Originalmotiv (`lara-felix-park-original`) wurde mit übernommen und ist damit ein freigegebenes Medium – prüfen und gegebenenfalls zurücknehmen.
**Alternativen.** Schlüssel `refs.element` wie im Dokument (verworfen: kollidiert mit dem Fachobjekt der Medienkarte); Revisionen per Migration umschreiben (verworfen: Revisionen bleiben unverändert, Rollback); jedes Widget bei fehlender Freigabe ausblenden (verworfen: entfernt Überschriften und H1).
**Entscheidung zur fehlenden Freigabe (19.11.2026).** Wird die Website-Freigabe zurückgenommen, wird das Medium nicht mehr öffentlich ausgeliefert. Überschriften, Texte und übrige Widget-Inhalte bleiben. Ein Widget, das danach keinen darstellbaren Inhalt mehr hat, entfällt. Ein reines Medienwidget ohne Medium gehört dazu. Die Redaktionsvorschau darf das nicht freigegebene Bild weiter mit Hinweis zeigen.
**Folgen und offene Prüfung.** Rollback zeigt nach der Umstellung gespeicherte Bilder nicht (Registry §9). Website-Bilder werden bis 2400 px abgeleitet. Offen bleiben: übernommene Medien tragen Dateinamen als Titel und keine Quellenzeile; ein unter `cms/` liegendes Originalmotiv (`lara-felix-park-original`) wurde mit übernommen und ist damit ein freigegebenes Medium – prüfen und gegebenenfalls zurücknehmen.
**Quelle.** `docs/architektur/medienzugriff-fuer-komponenten.md`; `cms-widget-registry.md` §§7, 9; ADR-30, ADR-38, ADR-39.
## ADR-41 – Gemeinsame redaktionelle Informationsbasis
**Status am 19.11.2026:** Auf der Testinstanz (`develop` `7b325f0`, Deploy-Lauf 4868). `PresentationMediaTest` und `EditorialDeskTest` sind grün. **Keine formale Freigabe** durch diesen Eintrag. Die technische Abbildung ist eine Arbeitsannahme aus dem vorhandenen Bestand, soweit unten nicht als Entscheidung gekennzeichnet.
**Kontext.** Redaktionelle Texte, fachliche Auffindbarkeit und Präsentationsmedien sollen an Medium, Modul, Programm und Lizenzartikel gepflegt und von Website, CMS und Verwaltung aus derselben Quelle gelesen werden. Medien, Module, Programme, Lizenzartikel und Angebote bleiben getrennte Fachobjekte (ADR-03, ADR-04). Öffentliche Profile (ADR-29) sind nicht entschieden. Die Website-Freigabe bleibt die von ADR-40.
**Entscheidung (Arbeitsannahme, am Bestand geprüft).**
- Klasse A bleibt an den vorhandenen Feldern: Arbeitstitel bzw. Bezeichnung, Anzeigename, Kurzbeschreibung (`summary`), ausführliche Beschreibung. Neu und leer nachrüstbar sind `teaser` und `search_terms`. Ein Lizenzartikel trägt dieselben Felder als eigene Abweichung. Leer heißt: der Wert wird nicht kopiert, sondern über die eindeutige Wurzel des aktuellen Artikelstands gelesen (`EditorialProfileReader`). Zwei Wurzeln oder keine Wurzel ergeben keine Ableitung.
- Abweichende Formulierungen stehen nur als einzelne Variante (`editorial_text_variants`: Feld und Kontext). Es gibt keine zweite Stammdatenkopie je Zielgruppe.
- Die fachliche Materialart bleibt `editorial_content_kinds`. Ergänzt wurden Unterrichtsfilm, Kurzfilm, Trailer, Interview, Arbeitsblatt, Übungsbeschreibung, Titelbild, Hintergrundbild, Präsentationsbild und Audioanleitung. Der redaktionelle Verwendungszweck, Altersbereiche und Einsatzbereiche sind Werte der vorhandenen Dimensionen und mehrfach zuordenbar. Sie geben nichts frei.
- Präsentationsmedien sind Referenzen (`presentation_assignments`) auf die Medienidentität, nicht auf eine Inhaltsfassung. Bilder, Filme und Hörstücke können ohne fachliche Fassung im Medienmanager liegen. `preview_path` hält bei Film und Hörstück die technische Ableitung unter `teaser/`. Eine Zuordnung speichert die Kennung des Mediums. `source_version_id` bleibt leer, solange niemand ausdrücklich eine Inhaltsfassung hinterlegt. Eine neuere Fassung markiert eine solche Bindung als veraltet und erzeugt keinen neuen Clip. Die Zuordnung legt keine Fassung an, erteilt kein Recht und nimmt das Medium nicht in einen Aufbau auf.
- **Bisherige Abhängigkeit der Website-Videoauslieferung.** `WebsiteRelease` hat einen Film nur freigegeben, wenn eine bereitgestellte Inhaltsfassung eine `MediaRendition` der Rolle `preview` unter `teaser/` trug. Ein Teaser ohne Fassung blieb damit unfreigebbar. Bilder waren davon unabhängig und nutzen das Vorschaubild am Medium. **Anpassung:** Liegt `preview_path` am Medium, gibt die Website-Freigabe diese Ableitung frei, ohne eine Inhaltsfassung zu erzeugen oder vorauszusetzen. Hat ein Film keine solche Datei, bleibt der bisherige Weg über die bereitgestellte Fassung bestehen. Zurücknehmen löscht nur die öffentliche Kopie. Originale, Master und Traineranleitungen bleiben gesperrt.
- Programm- und Medienkarten lesen Teaser oder Kurzbeschreibung zur Laufzeit. `data.heading` und `data.summary` einer Karte sind eine lokale Abweichung. Ein leeres Kartenbild nimmt das zugeordnete Titelbild, öffentlich nur über `WebsiteImage`.
**Nicht entschieden.** Eine verwaltbare Liste zulässiger Objekttypen je Dimension (die Tabelle führt sie nicht; Inhaltselemente blenden nur die Dimension „Fachliche Säule“ aus, weil Themen dort über die Säulen gepflegt werden). Ob ein öffentliches Profil (ADR-29) die Kartenregeln ersetzt. Ob freie Suchbegriffe später eine verwaltete Schlagwortdimension werden. Die Frage, ob bei zurückgenommener Freigabe das ganze Widget entfällt, ist entschieden, siehe ADR-40.
**Folgen.** Klasse B (Fassungen, Lernziele, Mitglieder) und Klasse C (Angebote, Rechte, Bestellstände) werden von dieser Pflege nicht geschrieben. Bestehende Thumbnails, CMS-Kennungen und Revisionen bleiben. Ein Code-Rollback vor dieser Migration lässt die neuen Spalten liegen; die Anwendung davor kennt sie nicht.
**Quelle.** Auftrag gemeinsame Redaktionsverwaltung; `medienzugriff-fuer-komponenten.md`; `cms-widget-registry.md`; ADR-03, ADR-07, ADR-22, ADR-29, ADR-39, ADR-40.
+3 -1
View File
@@ -306,7 +306,9 @@ ## 13. Premium-Karten (Brand-UI-Kit v1.7, ADR-39)
**Darstellung der Medienkarte nach Ausgabeart:** Film → Variante `lf-pc--media` (grüne Aktion, Metadatenband, Filmtafel); Dokument, Text, Hörstück, Bild → `lf-pc--material` (Materialsymbol). Die Unterscheidung folgt `output_class`, nicht einer redaktionellen Einstellung.
**Gespeichert** (Hülle wie jedes Widget): `refs.{pillar|element|composition}` (Kennung), `refs.image` (öffentlicher Bereich `cms/`), `data.action_label`, `data.note`, `data.alt` (Pflicht bei Bild), `data.focus_x/focus_y` (0–100, Vorgabe 66/45). Kein Titel, kein Text, kein Linkziel.
**Gespeichert** (Hülle wie jedes Widget): `refs.{pillar|element|composition}` (Kennung), `refs.image` (Kennung eines Medienmanager-Bildes, früher ein Pfad unter `cms/`), `data.action_label`, `data.note`, `data.alt` (Abweichung vom Alternativtext des Mediums), `data.heading` und `data.summary` (optionale Abweichung nur für diese Karte; leer übernimmt den zentralen Anzeigenamen bzw. Teaser oder Kurzbeschreibung), `data.focus_x/focus_y` (0–100, Vorgabe 66/45). Kein kopierter Lehrtext, kein Linkziel, kein Preis.
Ist `refs.image` leer, verwendet die Programm- und die Medienkarte das zentral zugeordnete Titelbild des Fachobjekts (`PresentationMedia`, zuerst Titelbild, dann Hero, Hover, alternatives Titelbild, Galerie). Gelesen wird es über `WebsiteImage`. Ohne Website-Freigabe erscheint öffentlich kein Bild; die Texte bleiben. Hat ein Widget danach keinen darstellbaren Inhalt, entfällt es. Eine eingetragene Bildkennung hat Vorrang vor dem zentralen Titelbild. Öffentliche Fachobjektprofile nach ADR-29 bleiben offen. Ein Titelbild kann ein Bild ohne Inhaltsfassung sein.
**Darstellung** (Reiter „Darstellung“): Variante `adaptive` (ab 520 px Bild neben Text) oder `stacked` (Bild immer oben); Höhe `auto` oder `fill` („An die Zeile angleichen“); `settings.format` (`landscape` 16:9 Vorgabe, `square`, `portrait` 3:4); `settings.fit` (`cover` Vorgabe, `contain` für Dokumente und Poster); `settings.heading_level` (`h3` Vorgabe, `h2`, `h4`); Anzeigen/Ausblenden von Kurzbeschreibung, Art (nicht bei Programm/Modul), Zusatzangaben und Aktion. Bildhöhe höchstens min(70vh, 640 px).
@@ -72,17 +72,18 @@ ### Neues Bild aus dem CMS
Was freigegeben werden kann:
- Bild: Vorschaubild unter `vorschau/` auf `media_derived`, Endung jpg, jpeg, png, webp oder gif.
- Film: an der höchsten bereitgestellten Fassung eine Ausgabe mit Rolle `preview` und Pfad unter `teaser/`, Endung mp4 oder webm.
- Bild: Vorschaubild unter `vorschau/` auf `media_derived`, Endung jpg, jpeg, png, webp oder gif. Eine Inhaltsfassung ist dafür nicht nötig.
- Film oder Hörstück ohne Inhaltsfassung: `preview_path` am Medium, unter `teaser/`, Film mp4 oder webm, Hörstück mp3, m4a oder ogg.
- Film mit Inhaltsfassung: an der höchsten bereitgestellten Fassung eine Ausgabe mit Rolle `preview` und Pfad unter `teaser/`, Endung mp4 oder webm. Das gilt, wenn am Medium kein `preview_path` liegt.
Originaldatei, Master-Fassung und Traineranleitungen werden abgelehnt. Eine Quellenzeile (`website_credit`) und ein Alternativtext (`website_alt`) gehören zu den Anzeigedaten und erzeugen keine neue Fassung. Die Quellenzeile erscheint nur, solange die Freigabe besteht. Der interne Vermerk bleibt intern.
Ein neues Website-Bild nimmt `WebsiteIntake` auf. Eine Teaserfassung für einen Film erzeugt es nicht; die muss bereits unter `teaser/` liegen. Öffentliche Profile nach ADR-29 sind damit nicht umgesetzt.
Ein neues Website-Bild nimmt `WebsiteIntake` auf und gibt es nach der Ableitung frei. Ein eigenständiges Präsentationsmedium legt `PresentationFile` ohne Inhaltsfassung an und gibt es nicht von selbst frei. Öffentliche Profile nach ADR-29 sind damit nicht umgesetzt.
## Was eine Komponente einhält
1. Identität und Anzeigedaten bleiben am Inhaltselement. Die Komponente speichert die Kennung, nicht eine Kopie von Titel, Text oder Datei.
2. Eine Programmkarte liest das Medium über `PublicMaterialReader`. Hero, Bild und Slideshow lesen `WebsiteMedia`. Ist dort nichts freigegeben, erscheint die Komponente öffentlich nicht.
2. Eine Programmkarte liest das Fachobjekt über `PublicMaterialReader` und ein Bild über `WebsiteImage`. Hero, Bild und Text sowie Karten lesen `WebsiteMedia`. Ist das Medium nicht freigegeben, wird es nicht ausgeliefert. Texte und übrige Inhalte des Widgets bleiben. Ein Widget ohne verbleibenden Inhalt entfällt.
3. Öffentliche Seiten enthalten keine Adresse unter `/redaktion/` oder `/bereich/` und kein Bibliotheksbild.
4. Die Mitgliedsdatei entsteht nur über den Mitgliederabruf, der `DecideAccess` erneut aufruft. Die Website-Ableitung läuft ausschließlich über `website.media`.
5. Der Web-Prozess schreibt nicht nach `originals/` und nicht nach `derived/` oder `public/`.
@@ -101,9 +102,9 @@ ## Umsetzung im CMS (19.11.2026, ADR-40)
- **Lesen:** `App\Domain\Cms\Widgets\Support\WebsiteImage` ruft `WebsiteMedia::present` auf. Öffentlich erscheint
ein Bild nur über `website.media`. In der Redaktionsvorschau erscheint ein nicht freigegebenes Bild als
Vorschaubild über `editorial.card` mit Hinweis; öffentlich nie.
- **Nicht freigegeben:** Es entfällt nur das Bild; das Widget erscheint mit seiner Darstellung ohne Bild (Überschrift,
Text, Schaltflächen bleiben). Das ist eine bewusste Auslegung von „gibt das Widget nichts aus“, damit eine
zurückgenommene Freigabe keine Überschrift (auch keine H1) von einer Seite entfernt. Entscheidung offen für Lars.
- **Nicht freigegeben:** Das Medium wird nicht öffentlich ausgeliefert. Überschrift, Text und Schaltflächen bleiben.
Ein Widget, das danach keinen Inhalt mehr hat, entfällt. Die Redaktionsvorschau zeigt ein nicht freigegebenes Bild
weiter mit Hinweis. Entschieden am 19.11.2026, siehe ADR-40.
- **Neu hochladen im Widget-Dialog:** Die Datei geht über `WebsiteIntake::acceptImage` sofort in den Medienmanager
und wird ausgewählt. Titel aus dem Dateinamen, ohne Quellenzeile; beides ist im Medienmanager änderbar. Die
Warteschlange leitet ab und gibt frei (wie dokumentiert).
@@ -129,3 +130,11 @@ ### Übernahme der früheren CMS-Bilder
- Gespeicherte Revisionen bleiben unverändert; frühere Pfade werden beim Darstellen zugeordnet und beim nächsten
Speichern durch die Kennung ersetzt. Frühere Pfade ohne Zuordnung bleiben über `PublicMedia` gültig.
- Eine Slideshow gibt es im CMS nicht; `WebsiteMedia::presentMany` ist für sie vorbereitet und noch unbenutzt.
## Präsentationszuordnungen (19.11.2026, ADR-41)
Ein Titelbild, Trailer oder Galerieelement an einem Film, Modul, Programm oder Lizenzartikel ist eine Referenz (`presentation_assignments`) auf die Medienidentität. Eine Inhaltsfassung ist dafür nicht erforderlich. `source_version_id` hält nur eine ausdrücklich hinterlegte Fassung fest. Die Rolle ist keine Verwendung im Aufbau, keine Inhaltsart und keine Website-Freigabe. Die Zuordnung macht das Medium nicht lizenzierbar.
Öffentliche Seiten lesen ein Bild nur über `WebsiteImage` und damit über `WebsiteMedia`. Ein freigegebener Film oder ein Hörstück wird über `website.media` ausgeliefert. Geschützte Originaldateien und Vorschaubilder der Bibliothek bleiben auf diesem Weg geschlossen. Wird die Freigabe zurückgenommen, endet die öffentliche Ausgabe; Überschriften und Texte bleiben. Ein Widget ohne verbleibenden Inhalt entfällt.
Die ausführliche Beschreibung, Einsatzhinweise, Lizenzvermerke und Lehrtexte bleiben außerhalb der öffentlichen Karte. `PublicMaterialReader` und `PublicCatalogReader` lesen dafür die Klasse-A-Angaben (`EditorialProfileReader`) und keine Datei.
@@ -0,0 +1,53 @@
# Redaktionelle Informationsbasis
**Stand:** 19.11.2026, Testinstanz `develop` `7b325f0` (Deploy-Lauf 4868). Arbeitsannahme, keine formale Freigabe. ADR-41.
Die Pflege bleibt an den bestehenden Fachobjekten. Es gibt keine zweite Medienverwaltung, keine Textmedien für gewöhnliche Beschreibungen und keine neue Produkthierarchie.
## Vorhanden und weiterverwendet
| Bedarf | Bestand |
|---|---|
| Arbeitstitel, Anzeigename, Kurz- und Langbeschreibung | `content_elements` und `compositions`; Änderung über `IdentityProfile`, protokolliert in `identity_changes`, ohne neue Fassung |
| Fachliche Materialart | `editorial_content_kinds` |
| Themen, Zielgruppen, Einsatz, Verwendungszweck | `editorial_dimensions` und `identity_dimension_values`, mehrere Werte je Dimension |
| Vorschaubild der Bibliothek | `thumbnail_path`, Route `editorial.card`, nur Redaktion |
| Website-Ausgabe | `WebsiteRelease`, `WebsiteMedia`, `WebsiteImage` (ADR-40) |
| Lehrinhalt und Aufbau | Fassungen, Lernziel, Mitglieder |
| Kommerz | Artikelstand, Angebot, Rechte |
| Auswahl eines Mediums | `EditorialCatalog`. Der Aufbau sucht Fassungen. Die Präsentation sucht zusätzlich Bilder, Filme und Hörstücke ohne Inhaltsfassung |
## Ergänzt
- `teaser` und `search_terms` an Inhaltselement, Komposition und, als eigene Abweichung, am Lizenzartikel.
- `editorial_text_variants` nur für eine abweichende Formulierung eines Feldes in einem Kontext (`kachel`, `detail`, `bibliothek`, `trainer`, `artikel`, `cms`, `suche`).
- Materialarten: Unterrichtsfilm, Kurzfilm, Trailer, Interview, Arbeitsblatt, Übungsbeschreibung, Titelbild, Hintergrundbild, Präsentationsbild, Audioanleitung.
- Dimensionen: Redaktioneller Verwendungszweck, Altersbereich und Zielgruppe, Einsatzbereich.
- `presentation_roles` und `presentation_assignments`. Rollen: Titelbild, alternatives Titelbild, Hero, Hover, Trailer, Vorschauclip, Audiovorschau, Interview, Galerie. Galerie und mehrfach belegte Rollen haben eine Reihenfolge. Die Zuordnung verweist auf das Medium. `source_version_id` wird nur gesetzt, wenn eine Inhaltsfassung ausdrücklich festgehalten wird, und danach nicht automatisch nachgezogen.
- Lesen: `EditorialProfileReader`, `PresentationMedia`. Programm- und Medienkarten sowie die Medienübersicht nutzen das.
- Oberfläche: Beschreibung und Präsentation am Medium, Angaben und Präsentation an Modul und Programm, Abschnitt Redaktion am Lizenzartikel. Im Modul und Programm öffnet „Medium aus dem Bestand auswählen“ denselben Picker wie der Aufbau. Die Übernahme als Präsentation sucht auch Medien ohne Inhaltsfassung und legt keine Fassung an.
- `preview_path` an der Medienidentität für die technische Film- oder Audioableitung. Die Website-Freigabe liest sie, ohne eine Inhaltsfassung zu verlangen. Der bisherige Weg über eine `preview`-Rendition der bereitgestellten Fassung bleibt für Unterrichtsfilme.
## Auflösung
1. Variante für den Kontext, wenn sie einen Text enthält.
2. Sonst die eigene Angabe am Objekt.
3. Beim Lizenzartikel sonst die Angabe der eindeutigen Quelle. Quelle ist die eine Wurzel des aktuellen Artikelstands, also entweder eine Inhaltsfassung oder eine Kompositionsfassung. Beides oder keins: keine Ableitung.
4. Sonst leer.
Eigene Angaben des Lizenzartikels gehen vor. Nicht überschriebene Angaben bleiben an der Quelle. Preise, Rechte und der Artikelstand werden nicht gelesen und nicht geschrieben.
## Öffentliche Karte
`PublicCatalogReader` liest für die Kachel den Teaser, sonst die Kurzbeschreibung, sonst das Lernziel. `data.heading` und `data.summary` einer Premium-Karte ersetzen nur diese Karte. Ein leeres Kartenbild nimmt das zugeordnete Titelbild und gibt es nur über `WebsiteImage` aus. Ohne Freigabe entfällt das Bild, der Text bleibt. Ein Widget ohne verbleibenden Inhalt entfällt. Bibliotheksvorschaubilder und Originaldateien bleiben geschlossen. Ein freigegebener Teaserfilm wird über `website.media` ausgeliefert und nach dem Zurücknehmen nicht mehr.
Die Medienübersicht filtert technische Art, Materialart und Einordnung gemeinsam. „Verwendung“ zählt Aufbauten, nicht die Klassifikation und nicht die Präsentationsrolle.
## Grenzen
- ADR-29, öffentliche Profile, ist nicht umgesetzt. Die bisherigen Sichtbarkeitsregeln der Karten gelten.
- Inhaltselemente bieten die Dimension „Fachliche Säule“ nicht an. Themen liegen dort bei den Säulen. Module, Programme und Lizenzartikel sehen diese Dimension, weil sie keine Säulenauswahl haben. Eine zweite Klassifikation oder eine verwaltbare Objektartenliste gibt es nicht.
- Es gibt keine neue Schlagwortverwaltung. Freie Suchbegriffe stehen in `search_terms`. Kontrollierte Werte bleiben Dimensionen.
- Kein Videoschnitt und keine neue Transcodierung. Ein gebundener Ausschnitt wird bei einer neueren Fassung nur als veraltet gekennzeichnet.
- Der Medienpicker ist nicht neu gestaltet. Am Medium und am Lizenzartikel liegt dieselbe Bestandssuche als kurze Liste, weil der Picker des Aufbaus an dessen Seite hängt (ADR-40).
- Klasse B und Klasse C sind unverändert.
@@ -216,6 +216,14 @@
<button type="button" class="luf-primary" wire:click="openModule">{{ $this->hostLabel() }} bearbeiten</button>
</div>
<h3>Präsentationsmedien</h3>
@include('filament.editorial.presentation')
@if ($this->canEditEditorial())
<div class="luf-actions">
<button type="button" class="luf-quiet" wire:click="openPresentationPicker">Medium aus dem Bestand auswählen</button>
</div>
@endif
<h3>Freigegebene Fassungen</h3>
@if ($this->versionChoices() === [])
<p class="luf-empty">Noch keine freigegebene Fassung. Sie entsteht mit „Fassung freigeben“, nicht beim Speichern des Entwurfs.</p>
@@ -291,6 +299,10 @@
<label for="anzeige">Titel</label>
<input id="anzeige" type="text" wire:model="displayTitle" placeholder="Leer lässt den Namen stehen">
</div>
<div class="luf-field">
<label for="teaser">Teaser</label>
<textarea id="teaser" rows="2" wire:model="teaser"></textarea>
</div>
<div class="luf-field">
<label for="kurz">Kurzbeschreibung</label>
<textarea id="kurz" rows="3" wire:model="summary"></textarea>
@@ -299,6 +311,11 @@
<label for="beschreibung">Ausführliche Beschreibung</label>
<textarea id="beschreibung" rows="8" wire:model="description"></textarea>
</div>
<div class="luf-field">
<label for="suche">Suchbegriffe</label>
<input id="suche" type="text" wire:model="searchTerms" placeholder="Begriffe für die Suche">
</div>
@include('filament.editorial.variants')
@elseif ($this->moduleTab === 'didaktik')
<p class="luf-note">Lernziel, Zeit und Material gehören zum fachlichen Stand. Sie landen im Entwurf und erzeugen erst mit „Fassung freigeben“ eine neue Fassung.</p>
<div class="luf-field">
@@ -575,7 +592,9 @@
<p class="luf-note">Für diese Fassung liegt noch keine abspielbare Datei vor. Ansehen öffnet die vorhandene Vorschau.</p>
@endif
@endif
@if (count($this->pickerVersions()) > 1)
@if (($detail['version_label'] ?? '') === 'Ohne Inhaltsfassung')
<p class="luf-note">Dieses Medium hat keine Inhaltsfassung. Übernehmen legt keine an.</p>
@elseif (count($this->pickerVersions()) > 1)
<h3>Fassungen</h3>
<p class="luf-note">Standard ist der aktuelle Stand. Eine andere zulässige Fassung wählst du vor dem Übernehmen.</p>
<div class="luf-scopes">
@@ -591,6 +610,8 @@
@endif
@if (($detail['version_label'] ?? '') === 'Entwurf')
<p class="luf-note">Übernehmen nimmt diesen Entwurf in den Aufbau. Eine Fassung entsteht erst, wenn du das Modul oder Programm freigibst und die gemeinsame Freigabe bestätigst.</p>
@elseif (($detail['version_label'] ?? '') === 'Ohne Inhaltsfassung')
<p class="luf-note">Übernehmen verweist auf dieses Medium. Es hat keine Inhaltsfassung, und es wird keine angelegt.</p>
@else
<p class="luf-note">Übernehmen verweist auf diese vorhandene Fassung. Es wird nichts kopiert und keine neue Fassung des Eintrags angelegt.</p>
@endif
@@ -601,7 +622,11 @@
@if ($detail['edit_url'] ?? null)
<a class="luf-link" href="{{ $detail['edit_url'] }}">In der Verwaltung öffnen</a>
@endif
<button type="button" class="luf-primary" wire:click="addPart('{{ $detail['target'] }}')">Übernehmen</button>
@if ($this->pickerPurpose === 'praesentation')
<button type="button" class="luf-primary" wire:click="assignFromPicker('{{ $detail['target'] }}')">Als Präsentation übernehmen</button>
@else
<button type="button" class="luf-primary" wire:click="addPart('{{ $detail['target'] }}')">Übernehmen</button>
@endif
</div>
@else
<p class="luf-empty">Wähle einen Eintrag, sieh ihn dir an und übernimm ihn in den Entwurf.</p>
@@ -0,0 +1,61 @@
@php($profile = $this->editorialProfile('artikel'))
@php($editable = $this->canEditEditorial())
<section class="luf-redaktion" aria-label="Redaktion des Lizenzartikels">
<h2>Redaktion</h2>
<p>Eigene Angaben ersetzen nur die Präsentation dieses Lizenzartikels. Leer gelassene Felder bleiben mit der fachlichen Quelle verbunden. Preise, Rechte und der Artikelstand stehen oben und werden hier nicht geändert.</p>
@if ($profile->source)
<p>Fachliche Quelle: {{ $profile->source->display_title ?: ($profile->source->working_title ?? $profile->source->designation) }}.</p>
@else
<p>Keine eindeutige fachliche Quelle. Es wird nichts aus einem Modul, Programm oder Medium abgeleitet.</p>
@endif
@if ($this->deskFeedback !== '')
<p role="status">{{ $this->deskFeedback }}</p>
@endif
<form wire:submit="saveLicenseEditorial">
<label>Interner Arbeitstitel
<input type="text" wire:model="workingTitle" @disabled(! $editable)>
</label>
<label>Anzeigename
<input type="text" wire:model="displayTitle" placeholder="{{ $profile->origin('display_title') === 'quelle' ? $profile->value('display_title') : '' }}" @disabled(! $editable)>
<span>{{ $profile->originLabel('display_title') }}</span>
</label>
<label>Teaser
<textarea rows="2" wire:model="teaser" placeholder="{{ $profile->origin('teaser') === 'quelle' ? $profile->value('teaser') : '' }}" @disabled(! $editable)></textarea>
<span>{{ $profile->originLabel('teaser') }}</span>
</label>
<label>Kurzbeschreibung
<textarea rows="3" wire:model="summary" placeholder="{{ $profile->origin('summary') === 'quelle' ? $profile->value('summary') : '' }}" @disabled(! $editable)></textarea>
<span>{{ $profile->originLabel('summary') }}</span>
</label>
<label>Ausführliche Beschreibung
<textarea rows="6" wire:model="descriptionText" placeholder="{{ $profile->origin('description') === 'quelle' ? $profile->value('description') : '' }}" @disabled(! $editable)></textarea>
<span>{{ $profile->originLabel('description') }}</span>
</label>
<label>Suchbegriffe
<input type="text" wire:model="searchTerms" @disabled(! $editable)>
</label>
<label>Inhaltsart
<select wire:model="kindId" @disabled(! $editable)>
<option value="">Keine</option>
@foreach (\App\Domain\Catalog\EditorialContentKind::selectOptions() as $id => $label)
<option value="{{ $id }}">{{ $label }}</option>
@endforeach
</select>
</label>
@foreach ($this->licenseDimensionGroups() as $group)
<fieldset>
<legend>{{ $group['label'] }}</legend>
@foreach ($group['values'] as $value)
<label><input type="checkbox" value="{{ $value['id'] }}" wire:model="dimensionIds" @disabled(! $editable)> {{ $value['label'] }}</label>
@endforeach
</fieldset>
@endforeach
@if ($editable)
<button type="submit">Redaktion speichern</button>
@endif
</form>
@include('filament.editorial.variants')
@include('filament.editorial.presentation')
@include('filament.editorial.presentation-picker')
</section>
@@ -0,0 +1,26 @@
<details>
<summary>Medium aus dem Bestand zuordnen</summary>
<p>Dieselbe Bestandssuche wie im Modul und im Programm. Es wird nur verwiesen, nichts kopiert.</p>
<label>Suche
<input type="search" wire:model.live.debounce.300ms="presentationQuery" placeholder="Titel oder Beschreibung">
</label>
@php($choices = $this->presentationChoices())
@if ($choices['items'] === [])
<p>Nichts gefunden.</p>
@else
<ul>
@foreach ($choices['items'] as $hit)
<li wire:key="wahl-{{ $hit['target'] }}">
<label>
<input type="radio" value="{{ $hit['target'] }}" wire:model="presentationPick">
{{ $hit['title'] }} · {{ $hit['kind'] }}@if (($hit['version_label'] ?? '') === 'Ohne Inhaltsfassung') · ohne Inhaltsfassung @endif
</label>
</li>
@endforeach
</ul>
@if ($choices['more'])
<p>Es gibt weitere Treffer. Grenze die Suche ein.</p>
@endif
<button type="button" wire:click="assignPickedPresentation">Zuordnen</button>
@endif
</details>
@@ -0,0 +1,65 @@
<div class="luf-redaktion">
<p>Zugeordnet wird ein Medium aus dem Bestand. Die Rolle gilt nur für diese Zuordnung. Sie gibt das Medium nicht frei und nimmt es nicht in den Lehrinhalt auf.</p>
@if ($gaps = $this->editorialGaps())
<p>Noch ohne Angabe: {{ implode(', ', $gaps) }}.</p>
@endif
@if ($this->deskFeedback !== '')
<p role="status">{{ $this->deskFeedback }}</p>
@endif
@if ($rows = $this->presentationRows())
<ul>
@foreach ($rows as $row)
<li wire:key="praesentation-{{ $row['id'] }}">
<strong>{{ $row['title'] }}</strong>
<span>{{ $row['role_label'] }}@if ($row['standard']) · Standard-Titelbild @endif</span>
@if ($row['kind'])
<span>{{ $row['kind'] }}</span>
@endif
<span>{{ $row['release_label'] }}</span>
@if ($row['binding'])
<span>{{ $row['binding']['label'] }}</span>
@else
<span>Eigenständiges Medium, ohne Bindung an eine Fassung.</span>
@endif
<span>
<a href="{{ \App\Filament\Resources\ContentElements\ContentElementResource::getUrl('view', ['record' => $row['element_id']]) }}">Im Medienmanager öffnen</a>
@if ($this->canEditEditorial())
@if ($row['ordered'])
<button type="button" wire:click="movePresentation({{ $row['id'] }}, -1)">Nach vorn</button>
<button type="button" wire:click="movePresentation({{ $row['id'] }}, 1)">Nach hinten</button>
@endif
<button type="button" wire:click="detachPresentation({{ $row['id'] }})">Zuordnung lösen</button>
@if ($this->canReleasePresentation())
@if ($row['released'])
<button type="button" wire:click="withdrawAssigned({{ $row['element_id'] }})">Website-Freigabe zurücknehmen</button>
@else
<button type="button" wire:click="releaseAssigned({{ $row['element_id'] }})">Für die Website freigeben</button>
@endif
@endif
@endif
</span>
</li>
@endforeach
</ul>
@else
<p>Noch kein Präsentationsmedium. Das Vorschaubild der Bibliothek bleibt davon unabhängig.</p>
@endif
@if ($this->canEditEditorial())
<label>Rolle
<select wire:model.live="presentationRole">
@foreach ($this->presentationRoleOptions() as $slug => $label)
<option value="{{ $slug }}">{{ $label }}</option>
@endforeach
</select>
</label>
@if (in_array($this->presentationRole, \App\Domain\Catalog\PresentationRole::BOUND_ROLES, true))
<label>
<input type="checkbox" wire:model="bindToVersion">
Zusätzlich an der aktuellen Inhaltsfassung festhalten. Ohne Haken bleibt die Zuordnung am Medium. Eine spätere Fassung erzeugt keinen neuen Clip.
</label>
@endif
<p>Die tatsächliche Verwendung steht getrennt davon und wird nicht als Verwendungszweck gespeichert.</p>
@endif
</div>
@@ -0,0 +1,39 @@
<details>
<summary>Abweichende Formulierung für einen Kontext</summary>
<p>Ohne Eintrag gilt die zentrale Angabe. Eine Abweichung gilt nur für den gewählten Kontext und ändert die Quelle nicht.</p>
@if ($variants = $this->variantRows())
<ul>
@foreach ($variants as $variant)
<li wire:key="variante-{{ $variant->id }}">
{{ \App\Domain\Catalog\EditorialProfileReader::AUDIENCES[$variant->audience] ?? $variant->audience }}
· {{ $this->variantFieldLabel($variant->field) }}:
{{ \Illuminate\Support\Str::limit($variant->body, 160) }}
@if ($this->canEditEditorial())
<button type="button" wire:click="forgetVariant({{ $variant->id }})">Entfernen</button>
@endif
</li>
@endforeach
</ul>
@endif
@if ($this->canEditEditorial())
<label>Kontext
<select wire:model="variantAudience">
@foreach (\App\Domain\Catalog\EditorialProfileReader::AUDIENCES as $key => $label)
<option value="{{ $key }}">{{ $label }}</option>
@endforeach
</select>
</label>
<label>Angabe
<select wire:model="variantField">
<option value="display_title">Anzeigename</option>
<option value="teaser">Teaser</option>
<option value="summary">Kurzbeschreibung</option>
<option value="description">Ausführliche Beschreibung</option>
</select>
</label>
<label>Abweichender Text
<textarea rows="3" wire:model="variantBody"></textarea>
</label>
<button type="button" wire:click="saveVariant">Abweichung speichern</button>
@endif
</details>
@@ -10,7 +10,7 @@
@endif
</a>
<div class="luf-medium-body">
<p class="luf-medium-kind">{{ $card['type'] }}</p>
<p class="luf-medium-kind">{{ $card['type'] }}@if (! empty($card['editorialKind'])) · {{ $card['editorialKind'] }}@endif</p>
<a class="luf-medium-title" href="{{ $card['url'] }}">{{ $card['title'] }}</a>
@if ($card['description'])
<p class="luf-medium-copy">{{ $card['description'] }}</p>
@@ -4,7 +4,7 @@
$options = [
'kinds' => \App\Domain\Catalog\EditorialContentKind::selectOptions(),
'pillars' => \App\Domain\Catalog\Pillar::query()->orderBy('name')->get(['id', 'name']),
'dimensions' => \App\Domain\Catalog\EditorialDimension::query()->with('values')->orderBy('label')->get(),
'dimensions' => \App\Domain\Catalog\EditorialDimension::forSubject($this->getRecord()),
];
@endphp
@@ -24,12 +24,18 @@
<label>Anzeigename
<input type="text" wire:model.live.debounce.300ms="displayTitle" @disabled(! $editable)>
</label>
<label class="is-wide">Teaser
<textarea rows="2" wire:model.live.debounce.300ms="teaser" @disabled(! $editable)></textarea>
</label>
<label class="is-wide">Kurzbeschreibung
<textarea rows="3" wire:model.live.debounce.300ms="summary" @disabled(! $editable)></textarea>
</label>
<label class="is-wide">Beschreibung
<textarea rows="6" wire:model.live.debounce.300ms="descriptionText" @disabled(! $editable)></textarea>
</label>
<label class="is-wide">Suchbegriffe
<input type="text" wire:model="searchTerms" @disabled(! $editable) placeholder="Begriffe für die Suche, durch Komma getrennt">
</label>
<label>Hinweise für den Einsatz
<textarea rows="4" wire:model.live.debounce.300ms="usageNote" @disabled(! $editable)></textarea>
</label>
@@ -60,7 +66,6 @@
</div>
</fieldset>
@foreach ($options['dimensions'] as $dimension)
@continue($dimension->slug === 'saeule')
<fieldset>
<legend>{{ $dimension->label }}</legend>
<div class="luf-editor-checks">
@@ -95,6 +100,7 @@
@endif
@endif
</p>
@include('filament.editorial.variants')
@php($history = $this->editorialHistory())
@if ($history !== [])
<details>
@@ -111,6 +117,11 @@
</div>
@endif
@if ($fokus === 'praesentation')
@include('filament.editorial.presentation')
@include('filament.editorial.presentation-picker')
@endif
@if ($fokus === 'verwendung')
@php($card = $this->usageCard())
<p>Eine Verwendung verweist auf eine konkrete Fassung. Die Rolle steht an der Verwendung, nicht als Kopie des Mediums.</p>
@@ -21,7 +21,7 @@
<input id="medien-suche" type="search" wire:model.live.debounce.300ms="suche" placeholder="Titel oder Beschreibung">
</div>
<div class="luf-media-field">
<label for="medien-art">Art</label>
<label for="medien-art">Technische Art</label>
<select id="medien-art" wire:model.live="art">
<option value="">Alle Arten</option>
@foreach ($this->typeOptions() as $type)
@@ -29,6 +29,15 @@
@endforeach
</select>
</div>
<div class="luf-media-field">
<label for="medien-inhaltsart">Fachliche Materialart</label>
<select id="medien-inhaltsart" wire:model.live="inhaltsart">
<option value="">Alle Materialarten</option>
@foreach ($this->contentKindOptions() as $id => $label)
<option value="{{ $id }}">{{ $label }}</option>
@endforeach
</select>
</div>
<div class="luf-media-field">
<label for="medien-freigabe">Freigabe</label>
<select id="medien-freigabe" wire:model.live="freigabe">
@@ -102,7 +111,7 @@
</div>
</div>
<p class="luf-media-hint">Freigabe meint die Fassung des Mediums. Sie ist weder die Veröffentlichung auf der Website noch ein Nachweis, dass jemand das Medium öffnen darf. Medien, die nur noch deaktivierte Fassungen haben, und archivierte Medien bleiben über die Filter auffindbar.</p>
<p class="luf-media-hint">Freigabe meint die Fassung des Mediums. Sie ist weder die Veröffentlichung auf der Website noch ein Nachweis, dass jemand das Medium öffnen darf. Die Materialart und die Einordnung sind die redaktionelle Klassifikation. Verwendung zeigt, wo das Medium tatsächlich referenziert ist, und ist keine Klassifikation. Medien, die nur noch deaktivierte Fassungen haben, und archivierte Medien bleiben über die Filter auffindbar.</p>
@if ($this->filtersActive())
<p class="luf-media-reset">
@@ -10,6 +10,7 @@
<nav class="luf-editor-tabs" role="tablist" aria-label="Bereiche des Mediums">
@foreach ([
'beschreibung' => 'Beschreibung',
'praesentation' => 'Präsentation',
'inhalt' => 'Inhalt',
'fassungen' => 'Fassungen',
'verwendung' => 'Verwendung',
@@ -19,7 +20,7 @@
@endforeach
</nav>
@if (in_array($fokus, ['beschreibung', 'verwendung', 'vorschau'], true))
@if (in_array($fokus, ['beschreibung', 'praesentation', 'verwendung', 'vorschau'], true))
@include('filament.media.editor-panels')
@else
<div style="display: grid; gap: 1.5rem;">
+630
View File
@@ -0,0 +1,630 @@
<?php
namespace Tests\Feature;
use App\Domain\Catalog\ArticleRelease;
use App\Domain\Catalog\ArticleService;
use App\Domain\Catalog\CompositionDisplayRelease;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\CompositionMember;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\EditorialDimension;
use App\Domain\Catalog\EditorialDimensionValue;
use App\Domain\Catalog\EditorialProfileReader;
use App\Domain\Catalog\IdentityDimension;
use App\Domain\Catalog\IdentityDimensionValue;
use App\Domain\Catalog\Offer;
use App\Domain\Catalog\Pillar;
use App\Domain\Catalog\PresentationAssignment;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Catalog\ReleaseStatus;
use App\Domain\Cms\Page;
use App\Domain\Cms\PageRevision;
use App\Domain\Cms\PageService;
use App\Domain\Cms\Widgets\Support\WebsiteImage;
use App\Domain\Media\MediaRendition;
use App\Domain\Media\PresentationFile;
use App\Domain\Media\WebsiteMedia;
use App\Domain\Media\WebsiteRelease;
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
use App\Filament\Resources\Courses\Pages\EditCourse;
use App\Filament\Resources\Exercises\Pages\EditExercise;
use App\Filament\Resources\LicenseArticles\Pages\ViewLicenseArticle;
use App\Filament\Support\MediaLibrary;
use App\Models\User;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;
use Tests\Support\BuildsCatalog;
use Tests\TestCase;
class EditorialDeskTest extends TestCase
{
use BuildsCatalog;
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
Storage::fake('media_derived');
Storage::fake('media_public');
Storage::fake('media_originals');
}
public function test_a_film_keeps_its_version_when_editorial_text_and_presentation_change(): void
{
$content = app(ContentService::class);
$film = $content->createElement('film', 'film', 'Lara im Park');
$version = $content->publishElementVersion($film, 'Filmfassung');
$cover = $this->image('Titel Park');
$trailer = $this->trailer('Trailer Park');
$editor = $this->editor();
$this->actingAs($editor, 'staff');
Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
->set('bereich', 'beschreibung')
->set('displayTitle', 'Lara im Park')
->set('teaser', 'Ein Nachmittag im Park.')
->set('summary', 'Lara übt, ihre Grenze zu sagen.')
->set('descriptionText', 'Ausführlich: die Szene im Park und was sie zeigt.')
->set('searchTerms', 'park, grenze')
->set('kindId', $this->kind('unterrichtsfilm'))
->call('saveEditorial')
->assertSee('Es gibt keine neue Fassung.');
$film->refresh();
$this->assertSame(1, $film->versions()->count());
$this->assertSame($version->id, $film->versions()->first()->id);
$this->assertSame('Ein Nachmittag im Park.', $film->teaser);
$this->assertSame($this->kind('unterrichtsfilm'), $film->editorial_content_kind_id);
$purpose = $this->dimensionValue('verwendungszweck', 'training');
$audience = $this->dimensionValue('zielgruppe', 'kinder');
app(IdentityDimension::class)->assign($film, $purpose);
app(IdentityDimension::class)->assign($film, $audience);
Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
->set('bereich', 'praesentation')
->set('presentationRole', 'titelbild')
->set('presentationPick', 'element:'.$cover->versions()->first()->id)
->call('assignPickedPresentation')
->set('presentationRole', 'trailer')
->set('presentationPick', 'element:'.$trailer->versions()->first()->id)
->set('bindToVersion', true)
->call('assignPickedPresentation')
->assertSee('Titel Park')
->assertSee('Trailer Park')
->assertSee('Standard-Titelbild')
->call('releaseAssigned', $trailer->id)
->assertSee('Für die Website freigegeben');
$film->refresh();
$trailer->refresh();
$this->assertSame(1, $film->versions()->count());
$this->assertSame($version->id, $film->versions()->value('id'));
$this->assertNotNull($trailer->website_released_at);
$this->assertNotNull(app(WebsiteMedia::class)->present($trailer));
Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
->call('withdrawAssigned', $trailer->id);
$this->assertNull($trailer->fresh()->website_released_at);
$this->assertNull(app(WebsiteMedia::class)->present($trailer));
$this->assertSame(2, PresentationAssignment::query()->where('subject_id', $film->id)->count());
}
public function test_a_module_description_does_not_version_the_composition_or_create_a_text_medium(): void
{
$content = app(ContentService::class);
$film = $content->publishElementVersion($content->createElement('film', 'film', 'Lara im Park'), 'Film');
$module = $content->createComposition('Eigene Grenzen erkennen');
$module->editorial_content_kind_id = $this->kind('modul');
$module->save();
$version = $content->publishComposition(
$module,
[['role' => 'Film', 'target' => $film]],
didactic: ['learning_goal' => 'Eine Grenze erkennen und sagen.'],
);
$textsBefore = ContentElement::query()->where('output_class', 'text')->count();
$this->actingAs($this->editor(), 'staff');
Livewire::test(EditExercise::class, ['record' => $module->getKey()])
->set('teaser', 'Kurz in das Modul.')
->set('summary', 'Kinder benennen eine eigene Grenze.')
->set('description', 'Ausführliche Modulbeschreibung, kein Lehrtext.')
->set('dimensionIds', [$this->dimensionValue('zielgruppe', 'kinder')->id])
->call('saveDisplay')
->assertSee('Die Fassung bleibt unverändert.');
$module->refresh();
$version->refresh();
$this->assertSame(1, $module->versions()->count());
$this->assertSame('Eine Grenze erkennen und sagen.', $version->learning_goal);
$this->assertSame('Kurz in das Modul.', $module->teaser);
$this->assertTrue(
CompositionMember::query()->where('composition_version_id', $version->id)->where('content_element_version_id', $film->id)->exists()
);
$this->assertSame($textsBefore, ContentElement::query()->where('output_class', 'text')->count());
$cover = $this->pictureWithoutVersion('Modulbild ohne Fassung');
Livewire::test(EditExercise::class, ['record' => $module->getKey()])
->assertSet('teaser', 'Kurz in das Modul.')
->set('teaser', 'Geändertes Modul.')
->call('saveDisplay')
->assertSee('Die Fassung bleibt unverändert.')
->call('openPresentationPicker')
->set('pickerQuery', 'Modulbild ohne')
->assertSee('Modulbild ohne Fassung')
->call('assignFromPicker', 'medium:'.$cover->id);
$module->refresh();
$version->refresh();
$this->assertSame('Geändertes Modul.', $module->teaser);
$this->assertSame('Eine Grenze erkennen und sagen.', $version->learning_goal);
$this->assertSame(0, $cover->fresh()->versions()->count());
$this->assertSame(1, $module->versions()->count());
$this->assertNull(PresentationAssignment::query()->where('content_element_id', $cover->id)->value('source_version_id'));
$this->assertSame(
1,
CompositionMember::query()->where('composition_version_id', $version->id)->count()
);
}
public function test_a_program_keeps_its_own_cover_trailer_and_gallery_order(): void
{
$content = app(ContentService::class);
$program = $content->createComposition('Stark im Alltag', CompositionKind::Kurs);
$program->editorial_content_kind_id = $this->kind('programm');
$program->save();
$content->publishComposition($program, [[
'role' => 'Text',
'target' => $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Inhalt'),
]]);
$cover = $this->image('Programmcover');
$trailer = $this->trailer('Programmtrailer');
$first = $this->image('Galerie eins');
$second = $this->image('Galerie zwei');
$third = $this->image('Galerie drei');
$media = app(PresentationMedia::class);
$actor = $this->editor();
$media->assign($program, 'titelbild', $cover->id, null, $actor);
$media->assign($program, 'trailer', $trailer->id, $trailer->versions()->first()->id, $actor);
$media->assign($program, 'galerie', $first->id, null, $actor);
$media->assign($program, 'galerie', $second->id, null, $actor);
$media->assign($program, 'galerie', $third->id, null, $actor);
$gallery = PresentationAssignment::query()
->where('subject_id', $program->id)
->whereHas('role', fn ($query) => $query->where('slug', 'galerie'))
->orderBy('position')
->pluck('content_element_id')
->all();
$this->assertSame([$first->id, $second->id, $third->id], $gallery);
$firstAssignment = PresentationAssignment::query()->where('content_element_id', $first->id)->where('subject_id', $program->id)->first();
$media->move($program, $firstAssignment->id, 1, $actor);
$gallery = PresentationAssignment::query()
->where('subject_id', $program->id)
->whereHas('role', fn ($query) => $query->where('slug', 'galerie'))
->orderBy('position')
->pluck('content_element_id')
->all();
$this->assertSame([$second->id, $first->id, $third->id], $gallery);
$this->assertSame(1, $program->fresh()->versions()->count());
app(IdentityDimension::class)->assign($program, $this->dimensionValue('zielgruppe', 'eltern'));
$found = app(MediaLibrary::class)->cards([
'suche' => '',
'inhaltsart' => '',
], false);
$this->assertNotContains('Stark im Alltag', array_column($found, 'title'));
$this->actingAs($actor, 'staff');
Livewire::test(EditCourse::class, ['record' => $program->getKey()])
->assertSee('Programmcover')
->assertSee('Galerie zwei')
->assertSee('Standard-Titelbild');
}
public function test_a_license_article_overrides_only_its_own_presentation(): void
{
$content = app(ContentService::class);
$film = $content->createElement('film', 'film', 'Lara im Park');
$film->display_title = 'Lara im Park';
$film->teaser = 'Teaser der Fassung';
$film->summary = 'Kurz aus dem Film';
$film->description = 'Lang aus dem Film';
$film->save();
$version = $content->publishElementVersion($film, 'Film');
$articles = app(ArticleService::class);
$article = $articles->create('LARA-PARK', 'Alltag');
$release = $articles->publishRelease($article, $version, 'Derselbe Unterrichtsfilm');
$offers = Offer::query()->count();
$note = $release->classification_note;
$number = $release->number;
$keeper = User::factory()->katalogverwalter()->create();
$keeper->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($keeper, 'staff');
$profile = app(EditorialProfileReader::class)->read($article->fresh(), 'artikel');
$this->assertSame('quelle', $profile->origin('summary'));
$this->assertSame('Kurz aus dem Film', $profile->value('summary'));
$this->assertSame('Lara im Park', $profile->value('display_title'));
Livewire::test(ViewLicenseArticle::class, ['record' => $article->getKey()])
->set('summary', 'Eigene Artikelbeschreibung')
->call('saveLicenseEditorial')
->assertSee('Stand, Preis und Rechte bleiben unverändert.')
->assertSee('Übernommen von Lara im Park')
->assertSee('Eigene Angabe');
$article->refresh();
$release->refresh();
$this->assertSame('Eigene Artikelbeschreibung', $article->summary);
$this->assertNull($article->teaser);
$again = app(EditorialProfileReader::class)->read($article, 'artikel');
$this->assertSame('eigen', $again->origin('summary'));
$this->assertSame('Eigene Artikelbeschreibung', $again->value('summary'));
$this->assertSame('quelle', $again->origin('teaser'));
$this->assertSame('Teaser der Fassung', $again->value('teaser'));
$this->assertSame($number, $release->number);
$this->assertSame($note, $release->classification_note);
$this->assertSame(ReleaseStatus::Veroeffentlicht, $release->status);
$this->assertSame($offers, Offer::query()->count());
$this->assertSame(1, $film->fresh()->versions()->count());
$cover = $this->pictureWithoutVersion('Artikelbild ohne Fassung');
Livewire::test(ViewLicenseArticle::class, ['record' => $article->getKey()])
->assertSet('summary', 'Eigene Artikelbeschreibung')
->set('descriptionText', 'Nur dieser Artikel')
->call('saveLicenseEditorial')
->set('presentationQuery', 'Artikelbild ohne')
->set('presentationRole', 'titelbild')
->set('presentationPick', 'medium:'.$cover->id)
->call('assignPickedPresentation')
->assertSee('Artikelbild ohne Fassung');
$overridden = app(EditorialProfileReader::class)->read($article->fresh(), 'artikel');
$this->assertSame('eigen', $overridden->origin('description'));
$this->assertSame('Nur dieser Artikel', $overridden->value('description'));
$this->assertSame('quelle', $overridden->origin('teaser'));
$this->assertSame('Teaser der Fassung', $overridden->value('teaser'));
$this->assertSame('Lang aus dem Film', $film->fresh()->description);
$this->assertSame(0, $cover->fresh()->versions()->count());
Livewire::test(ViewLicenseArticle::class, ['record' => $article->getKey()])
->set('summary', '')
->call('saveLicenseEditorial');
$restored = app(EditorialProfileReader::class)->read($article->fresh(), 'artikel');
$this->assertSame('quelle', $restored->origin('summary'));
$this->assertSame('Kurz aus dem Film', $restored->value('summary'));
$this->assertSame('eigen', $restored->origin('description'));
$this->assertSame($release->id, $article->fresh()->current_release_id);
$this->assertSame(1, ArticleRelease::query()->count());
$this->assertSame($offers, Offer::query()->count());
$this->assertSame(ReleaseStatus::Veroeffentlicht, $release->fresh()->status);
$ambiguous = $articles->create('UNDEUTIG');
$program = $content->createComposition('Zweite Wurzel', CompositionKind::Kurs);
$programVersion = $content->publishComposition($program, [['role' => 'Film', 'target' => $version]]);
$ambiguous->releases()->create([
'number' => 1,
'classification_note' => 'zwei Wurzeln',
'status' => ReleaseStatus::Entwurf,
'root_element_version_id' => $version->id,
'root_composition_version_id' => $programVersion->id,
]);
$ambiguous->current_release_id = $ambiguous->releases()->value('id');
$ambiguous->save();
$this->assertNull(app(EditorialProfileReader::class)->sourceOf($ambiguous->fresh()));
$this->assertSame('leer', app(EditorialProfileReader::class)->read($ambiguous->fresh())->origin('summary'));
}
public function test_content_elements_do_not_offer_the_pillar_dimension_a_second_time(): void
{
$pillar = Pillar::query()->create(['name' => 'Nähe', 'slug' => 'naehe', 'sort_order' => 1]);
$dimension = EditorialDimension::query()->where('slug', 'saeule')->firstOrFail();
$value = EditorialDimensionValue::query()->create([
'editorial_dimension_id' => $dimension->id,
'slug' => 'pfeiler-'.$pillar->id,
'label' => 'Nähe als Dimension',
]);
$content = app(ContentService::class);
$film = $content->createElement('film', 'film', 'Film mit Säule');
$content->publishElementVersion($film, 'Film');
app(IdentityDimension::class)->assign($film, $value);
$kinder = $this->dimensionValue('zielgruppe', 'kinder');
$this->actingAs($this->editor(), 'staff');
$html = Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
->set('bereich', 'beschreibung')
->set('dimensionIds', [$kinder->id])
->call('saveEditorial')
->html();
$this->assertStringContainsString('Fachliche Säulen', $html);
$this->assertStringNotContainsString('>Fachliche Säule<', $html);
$assigned = IdentityDimensionValue::query()
->where('subject_type', $film->getMorphClass())
->where('subject_id', $film->id)
->pluck('editorial_dimension_value_id')
->all();
$this->assertContains($value->id, $assigned);
$this->assertContains($kinder->id, $assigned);
$module = $content->createComposition('Modul mit Säule');
$content->publishComposition($module, [[
'role' => 'Film',
'target' => $film->versions()->first(),
]]);
Livewire::test(EditExercise::class, ['record' => $module->getKey()])
->call('openModule')
->set('moduleTab', 'einordnung')
->assertSee('Nähe als Dimension')
->assertDontSee('Fachliche Säulen');
}
public function test_classification_is_filterable_and_does_not_change_use_or_release(): void
{
$content = app(ContentService::class);
$lesson = $content->createElement('film', 'film', 'Unterricht');
$lesson->editorial_content_kind_id = $this->kind('unterrichtsfilm');
$lesson->teaser = 'sucht-den-unterricht';
$lesson->save();
$content->publishElementVersion($lesson, 'Film');
$clip = $content->createElement('film', 'film', 'Nur Trailer');
$clip->editorial_content_kind_id = $this->kind('trailer');
$clip->save();
$content->publishElementVersion($clip, 'Clip');
$picture = $content->createElement('bild', 'bild', 'Keyvisual');
$picture->editorial_content_kind_id = $this->kind('titelbild');
$picture->thumbnail_path = 'vorschau/key.jpg';
$picture->save();
$content->publishElementVersion($picture, null, ['file' => 'inhalte/key.jpg']);
$backdrop = $content->createElement('bild', 'bild', 'Hintergrund');
$backdrop->editorial_content_kind_id = $this->kind('hintergrundbild');
$backdrop->save();
$content->publishElementVersion($backdrop, null, ['file' => 'inhalte/hintergrund.jpg']);
app(IdentityDimension::class)->assign($lesson, $this->dimensionValue('verwendungszweck', 'training'));
app(IdentityDimension::class)->assign($lesson, $this->dimensionValue('verwendungszweck', 'website'));
app(IdentityDimension::class)->assign($clip, $this->dimensionValue('verwendungszweck', 'website'));
$releasedAt = null;
$lesson->website_released_at = null;
$lesson->save();
$library = app(MediaLibrary::class);
$lessons = array_column($library->cards(['inhaltsart' => (string) $this->kind('unterrichtsfilm')], false), 'title');
$clips = array_column($library->cards(['inhaltsart' => (string) $this->kind('trailer')], false), 'title');
$pictures = array_column($library->cards(['art' => 'bild', 'inhaltsart' => (string) $this->kind('titelbild')], false), 'title');
$backs = array_column($library->cards(['inhaltsart' => (string) $this->kind('hintergrundbild')], false), 'title');
$this->assertSame(['Unterricht'], $lessons);
$this->assertSame(['Nur Trailer'], $clips);
$this->assertSame(['Keyvisual'], $pictures);
$this->assertSame(['Hintergrund'], $backs);
$this->assertNotContains('Nur Trailer', $lessons);
$byPurpose = array_column($library->cards([
'einordnung' => (string) $this->dimensionValue('verwendungszweck', 'training')->id,
'nutzung' => 'unbenutzt',
], false), 'title');
$this->assertContains('Unterricht', $byPurpose);
$this->assertNotContains('Nur Trailer', $byPurpose);
$bySearch = array_column($library->cards(['suche' => 'sucht-den-unterricht'], false), 'title');
$this->assertSame(['Unterricht'], $bySearch);
$lesson->editorial_content_kind_id = $this->kind('interview');
$lesson->save();
$lesson->refresh();
$this->assertSame($releasedAt, $lesson->website_released_at);
$this->assertSame(0, CompositionMember::query()->where('content_element_version_id', $lesson->versions()->first()->id)->count());
$this->assertSame(2, IdentityDimensionValue::query()->where('subject_type', $lesson->getMorphClass())->where('subject_id', $lesson->id)->count());
}
public function test_the_program_card_uses_central_text_and_only_a_released_cover(): void
{
$content = app(ContentService::class);
$program = $content->createComposition('Programm Karte', CompositionKind::Kurs);
$program->editorial_content_kind_id = $this->kind('programm');
$program->display_title = 'Zentraler Programmname';
$program->teaser = 'Zentraler Teaser';
$program->summary = 'Zentrale Kurzbeschreibung';
$program->description = 'Interne Langfassung';
$program->save();
$version = $content->publishComposition($program, [[
'role' => 'Text',
'target' => $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Inhalt'),
]]);
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
$cover = $this->image('Öffentliches Cover');
Storage::disk('media_derived')->put('vorschau/oeffentlich.jpg', 'cover-bytes');
$cover->thumbnail_path = 'vorschau/oeffentlich.jpg';
$cover->website_alt = 'Lara auf der Wiese';
$cover->save();
app(WebsiteRelease::class)->release($cover);
app(PresentationMedia::class)->assign($program, 'titelbild', $cover->id, null);
$guide = $content->createElement('text', 'text', 'Geheime Traineranleitung');
$guide->editorial_content_kind_id = $this->kind('traineranleitung');
$guide->description = 'Nur für Trainer, nicht öffentlich.';
$guide->save();
$content->publishElementVersion($guide, 'Interner Lehrtext');
$this->publish('/redaktion-karte', [[
'layout' => 'u2_2',
'style' => [],
'slots' => [
$this->card('program_card', ['composition' => $program->id]),
$this->card('program_card', ['composition' => $program->id], ['heading' => 'Nur diese Karte']),
],
]]);
$html = $this->get('/redaktion-karte')->assertOk()->getContent();
$this->assertStringContainsString('Zentraler Programmname', $html);
$this->assertStringContainsString('Zentraler Teaser', $html);
$this->assertStringContainsString('Nur diese Karte', $html);
$this->assertStringNotContainsString('Interne Langfassung', $html);
$this->assertStringNotContainsString('Nur für Trainer', $html);
$this->assertStringContainsString('/website-medien/'.$cover->id, $html);
$this->assertStringNotContainsString('editorial.card', $html);
$this->assertStringNotContainsString('originals/', $html);
$program->teaser = 'Teaser nach der Änderung';
$program->save();
$this->get('/redaktion-karte')->assertOk()
->assertSee('Teaser nach der Änderung')
->assertSee('Nur diese Karte')
->assertSee('Zentraler Programmname');
app(WebsiteRelease::class)->withdraw($cover->fresh());
$this->assertNull($cover->fresh()->website_released_at);
// WebsiteImage ist je Prozess gebunden. Ein neuer HTTP-Request im selben Testprozess
// bekommt sonst noch die vorherige Freigabe. Auf dem Server endet der Scope mit der Anfrage.
$this->app->forgetInstance(WebsiteImage::class);
$after = $this->get('/redaktion-karte')->assertOk()->getContent();
$this->assertStringNotContainsString('/website-medien/'.$cover->id, $after);
$this->assertStringContainsString('Teaser nach der Änderung', $after);
$this->assertStringContainsString('Nur diese Karte', $after);
$this->assertStringNotContainsString('cover-bytes', $after);
$this->assertSame('Zentraler Programmname', $program->fresh()->display_title);
}
public function test_a_bound_clip_stays_on_its_version_and_a_medium_cannot_present_itself(): void
{
$content = app(ContentService::class);
$film = $content->createElement('film', 'film', 'Lara im Park');
$first = $content->publishElementVersion($film, 'Fassung 1');
$trailer = $this->trailer('Ausschnitt');
$media = app(PresentationMedia::class);
$media->assign($film, 'vorschauclip', $trailer->id, $first->id);
$second = $content->publishElementVersion($film, 'Fassung 2');
$rows = $media->rows($film->fresh());
$this->assertTrue($rows[0]['binding']['stale']);
$this->assertSame($first->id, PresentationAssignment::query()->value('source_version_id'));
$this->assertNotSame($second->id, PresentationAssignment::query()->value('source_version_id'));
$this->expectException(DomainRuleException::class);
$media->assign($film, 'titelbild', $film->id, null);
}
public function test_a_kachel_variant_does_not_replace_the_central_teaser(): void
{
$program = app(ContentService::class)->createComposition('Variante', CompositionKind::Kurs);
$program->editorial_content_kind_id = $this->kind('programm');
$program->teaser = 'Zentral';
$program->save();
app(ContentService::class)->publishComposition($program, [[
'role' => 'Text',
'target' => app(ContentService::class)->publishElementVersion(app(ContentService::class)->createElement('text', 'text', 'Blatt'), 'Inhalt'),
]]);
app(EditorialProfileReader::class)->putVariant($program, 'teaser', 'kachel', 'Nur die Kachel', $this->editor());
$profile = app(EditorialProfileReader::class)->read($program->fresh(), 'kachel');
$plain = app(EditorialProfileReader::class)->read($program->fresh());
$this->assertSame('Nur die Kachel', $profile->value('teaser'));
$this->assertSame('variante', $profile->origin('teaser'));
$this->assertSame('Zentral', $plain->value('teaser'));
$this->assertSame('Zentral', $program->fresh()->teaser);
}
private function pictureWithoutVersion(string $title): ContentElement
{
Storage::fake('cms_incoming');
$path = 'inhalte/'.md5($title).'.jpg';
Storage::disk('cms_incoming')->put($path, 'bild');
$element = app(ContentService::class)->createElement('bild', 'bild', $title);
$element->display_title = $title;
$element->save();
app(PresentationFile::class)->store($element, $path);
return $element->fresh();
}
private function image(string $title): ContentElement
{
$content = app(ContentService::class);
$element = $content->createElement('bild', 'bild', $title);
$element->thumbnail_path = 'vorschau/'.md5($title).'.jpg';
$element->save();
Storage::disk('media_derived')->put($element->thumbnail_path, 'bild');
$content->publishElementVersion($element, null, ['file' => 'inhalte/'.md5($title).'.jpg']);
return $element->fresh();
}
private function trailer(string $title): ContentElement
{
$content = app(ContentService::class);
$element = $content->createElement('film', 'film', $title);
$version = $content->publishElementVersion($element, 'Teaser');
$path = 'teaser/'.md5($title).'.mp4';
MediaRendition::query()->create([
'content_element_version_id' => $version->id,
'role' => 'preview',
'label' => 'teaser',
'path' => $path,
]);
Storage::disk('media_derived')->put($path, 'teaser-bytes');
return $element->fresh();
}
private function kind(string $slug): int
{
return (int) EditorialContentKind::query()->where('slug', $slug)->value('id');
}
private function dimensionValue(string $dimension, string $slug): EditorialDimensionValue
{
$id = EditorialDimension::query()->where('slug', $dimension)->value('id');
return EditorialDimensionValue::query()
->where('editorial_dimension_id', $id)
->where('slug', $slug)
->firstOrFail();
}
private function editor(): User
{
$editor = User::factory()->redakteur()->create();
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
return $editor;
}
/**
* @param list<array<string, mixed>> $sections
*/
private function publish(string $path, array $sections): PageRevision
{
$page = Page::query()->create(['path' => $path]);
$service = app(PageService::class);
$revision = $service->saveRevision($page, $sections, null, null, null);
$service->publish($page, $revision);
return $revision;
}
/**
* @param array<string, mixed> $refs
* @param array<string, mixed> $data
* @return array<string, mixed>
*/
private function card(string $type, array $refs, array $data = []): array
{
return ['type' => $type, 'v' => 1, 'variant' => 'adaptive', 'settings' => [], 'data' => $data, 'refs' => $refs];
}
}
+1 -1
View File
@@ -234,7 +234,7 @@ public function test_pillar_and_classification_filters_narrow_the_same_library()
$content->publishElementVersion($other, 'Text');
$pillar = app(PillarService::class)->create('Meine Grenzen');
app(PillarService::class)->assign($film, [$pillar->id]);
$dimension = EditorialDimension::query()->create(['slug' => 'zielgruppe', 'label' => 'Zielgruppe']);
$dimension = EditorialDimension::query()->where('slug', 'zielgruppe')->firstOrFail();
$value = $dimension->values()->create(['slug' => 'grundschule', 'label' => 'Grundschule']);
app(IdentityDimension::class)->assign($film, $value);
+268
View File
@@ -0,0 +1,268 @@
<?php
namespace Tests\Feature;
use App\Domain\Catalog\CompositionDisplayRelease;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\CompositionMember;
use App\Domain\Catalog\ContentElement;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\PresentationAssignment;
use App\Domain\Catalog\PresentationMedia;
use App\Domain\Cms\Page;
use App\Domain\Cms\PageService;
use App\Domain\Cms\Widgets\RenderContext;
use App\Domain\Cms\Widgets\Support\WebsiteImage;
use App\Domain\Cms\Widgets\WidgetRenderer;
use App\Domain\Entitlement\Grant;
use App\Domain\Media\PresentationFile;
use App\Domain\Media\WebsiteMedia;
use App\Domain\Media\WebsiteRelease;
use App\Filament\Resources\Courses\Pages\EditCourse;
use App\Filament\Support\EditorialCatalog;
use App\Filament\Support\MediumForm;
use App\Models\User;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;
use Tests\TestCase;
class PresentationMediaTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
Storage::fake('cms_incoming');
Storage::fake('media_derived');
Storage::fake('media_public');
Storage::fake('media_originals');
}
public function test_a_versionless_image_and_teaser_can_be_assigned_released_and_withdrawn(): void
{
$content = app(ContentService::class);
$program = $content->createComposition('Programm mit Teaser', CompositionKind::Kurs);
$program->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id');
$program->display_title = 'Name aus der Redaktion';
$program->teaser = 'Teaser aus der Redaktion';
$program->description = 'Interne Langfassung';
$program->save();
$version = $content->publishComposition($program, [[
'role' => 'Text',
'target' => $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Inhalt'),
]]);
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
$image = $this->store('bild', 'Pruefbild ohne Fassung', 'bild-bytes');
$teaser = $this->store('film', 'Teaser ohne Fassung', 'teaser-bytes');
$editor = User::factory()->redakteur()->create();
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($editor, 'staff');
$found = app(EditorialCatalog::class)->presentationBrowse('ohne Fassung');
$targets = array_column($found['items'], 'target');
$this->assertContains('medium:'.$image->id, $targets);
$this->assertContains('medium:'.$teaser->id, $targets);
$didactic = app(EditorialCatalog::class)->browse('ohne Fassung', 'alle', '', $program->id);
$this->assertNotContains('medium:'.$image->id, array_column($didactic['items'], 'target'));
$this->assertNotContains('medium:'.$teaser->id, array_column($didactic['items'], 'target'));
Livewire::test(EditCourse::class, ['record' => $program->getKey()])
->call('openPresentationPicker')
->set('pickerQuery', 'Pruefbild ohne')
->set('presentationRole', 'titelbild')
->call('assignFromPicker', 'medium:'.$image->id)
->call('openPresentationPicker')
->set('pickerQuery', 'Teaser ohne')
->set('presentationRole', 'trailer')
->set('bindToVersion', false)
->call('assignFromPicker', 'medium:'.$teaser->id)
->assertSee('Pruefbild ohne Fassung')
->assertSee('Teaser ohne Fassung')
->assertSee('Eigenständiges Medium, ohne Bindung an eine Fassung.');
$this->assertSame(0, $image->fresh()->versions()->count());
$this->assertSame(0, $teaser->fresh()->versions()->count());
$this->assertSame(1, $program->fresh()->versions()->count());
$this->assertSame(0, Grant::query()->count());
$this->assertNull(PresentationAssignment::query()->where('content_element_id', $image->id)->value('source_version_id'));
$this->assertNull(PresentationAssignment::query()->where('content_element_id', $teaser->id)->value('source_version_id'));
$this->assertSame(1, CompositionMember::query()->where('composition_version_id', $version->id)->count());
app(WebsiteRelease::class)->release($image->fresh());
app(WebsiteRelease::class)->release($teaser->fresh());
$image->refresh();
$teaser->refresh();
$this->assertNotNull($image->website_released_at);
$this->assertNotNull($teaser->website_released_at);
$this->assertSame(0, $image->versions()->count());
$this->assertSame(0, $teaser->versions()->count());
$this->assertSame(0, Grant::query()->count());
Storage::disk('media_public')->assertExists($image->website_public_path);
Storage::disk('media_public')->assertExists($teaser->website_public_path);
$this->assertStringNotContainsString('originals', (string) $teaser->website_public_path);
$this->publish('/praesentation-ohne-fassung', [[
'layout' => 'u2_2',
'style' => [],
'slots' => [
$this->card('program_card', ['composition' => $program->id]),
$this->card('program_card', ['composition' => $program->id], ['heading' => 'Nur diese Karte']),
],
]]);
$this->get('/praesentation-ohne-fassung')->assertOk()
->assertSee('Name aus der Redaktion')
->assertSee('Teaser aus der Redaktion')
->assertSee('Nur diese Karte')
->assertSee('/website-medien/'.$image->id, false)
->assertDontSee('Interne Langfassung');
$film = app(WebsiteMedia::class)->present($teaser);
$this->assertNotNull($film);
$this->assertSame('film', $film->kind);
$this->get($film->url)->assertOk()->assertStreamedContent('teaser-bytes');
$program->teaser = 'Teaser nach der zentralen Änderung';
$program->save();
$this->app->forgetInstance(WebsiteImage::class);
$this->get('/praesentation-ohne-fassung')->assertOk()
->assertSee('Teaser nach der zentralen Änderung')
->assertSee('Nur diese Karte')
->assertDontSee('Teaser aus der Redaktion');
app(WebsiteRelease::class)->withdraw($image->fresh());
app(WebsiteRelease::class)->withdraw($teaser->fresh());
$this->app->forgetInstance(WebsiteImage::class);
$after = $this->get('/praesentation-ohne-fassung')->assertOk()->getContent();
$this->assertStringNotContainsString('/website-medien/'.$image->id, $after);
$this->assertStringContainsString('Teaser nach der zentralen Änderung', $after);
$this->assertStringContainsString('Nur diese Karte', $after);
$this->get(route('website.media', $teaser))->assertNotFound();
$this->get(route('website.media', $image))->assertNotFound();
Storage::disk('media_derived')->assertExists($image->thumbnail_path);
Storage::disk('media_derived')->assertExists($teaser->preview_path);
$this->assertSame(0, $teaser->fresh()->versions()->count());
$this->assertSame('Name aus der Redaktion', $program->fresh()->display_title);
}
public function test_creating_a_presentation_film_does_not_open_a_content_version(): void
{
Storage::disk('cms_incoming')->put('inhalte/teaser.mp4', 'teaser-bytes');
$editor = User::factory()->redakteur()->create();
$this->actingAs($editor, 'staff');
$element = MediumForm::create([
'working_title' => 'Marketingclip',
'shape' => 'film',
'incoming' => 'inhalte/teaser.mp4',
'without_version' => true,
'description' => 'Nur die Website',
], hold: false);
$this->assertSame(0, $element->versions()->count());
$this->assertSame('teaser/'.$element->id.'/datei.mp4', $element->preview_path);
$this->assertNull($element->website_released_at);
$this->assertSame(0, Grant::query()->count());
Storage::disk('media_derived')->assertExists($element->preview_path);
Storage::disk('media_originals')->assertDirectoryEmpty('/');
}
public function test_a_versionless_audio_preview_is_released_without_a_license(): void
{
$audio = $this->store('audio', 'Audiovorschau ohne Fassung', 'audio-bytes');
$this->assertNull(app(WebsiteMedia::class)->present($audio));
app(WebsiteRelease::class)->release($audio);
$audio->refresh();
$presentation = app(WebsiteMedia::class)->present($audio);
$this->assertNotNull($presentation);
$this->assertSame('audio', $presentation->kind);
$this->get($presentation->url)->assertOk()->assertStreamedContent('audio-bytes');
$this->assertSame(0, $audio->versions()->count());
$this->assertSame(0, Grant::query()->count());
app(WebsiteRelease::class)->withdraw($audio->fresh());
$this->assertNull(app(WebsiteMedia::class)->present($audio->fresh()));
$this->get(route('website.media', $audio))->assertNotFound();
Storage::disk('media_derived')->assertExists($audio->preview_path);
}
public function test_an_explicit_version_binding_stays_optional(): void
{
$content = app(ContentService::class);
$film = $content->createElement('film', 'film', 'Unterricht');
$version = $content->publishElementVersion($film, 'Fassung');
$clip = $this->store('film', 'Clip ohne Fassung', 'clip-bytes');
app(PresentationMedia::class)->assign($film, 'trailer', $clip->id, null);
$this->assertNull(PresentationAssignment::query()->value('source_version_id'));
app(PresentationMedia::class)->assign($film, 'trailer', $clip->id, $version->id);
$this->assertSame($version->id, PresentationAssignment::query()->value('source_version_id'));
$this->assertSame(0, $clip->fresh()->versions()->count());
$this->assertSame(1, $film->fresh()->versions()->count());
$this->assertSame(0, Grant::query()->count());
}
public function test_a_widget_with_nothing_but_a_missing_medium_is_omitted(): void
{
$image = $this->store('bild', 'Nur ein Bild', 'bild-bytes');
$html = app(WidgetRenderer::class)->renderAll([
['type' => 'heading', 'v' => 1, 'variant' => 'standard', 'settings' => [], 'data' => ['heading' => 'Die Überschrift bleibt'], 'refs' => []],
['type' => 'cards', 'v' => 1, 'variant' => 'standard', 'settings' => [], 'data' => ['items' => [
['title' => '', 'text' => null, 'url' => null, 'image' => $image->id],
]], 'refs' => []],
], RenderContext::publicPage())->toHtml();
$this->assertStringContainsString('Die Überschrift bleibt', $html);
$this->assertStringNotContainsString('widget-cards', $html);
$this->assertStringNotContainsString('<img', $html);
}
private function store(string $output, string $title, string $bytes): ContentElement
{
$extension = match ($output) {
'bild' => 'jpg',
'audio' => 'mp3',
default => 'mp4',
};
$path = 'inhalte/'.md5($title).'.'.$extension;
Storage::disk('cms_incoming')->put($path, $bytes);
$element = app(ContentService::class)->createElement($output, $output, $title);
$element->display_title = $title;
$element->save();
app(PresentationFile::class)->store($element, $path);
return $element->fresh();
}
/**
* @param list<array<string, mixed>> $sections
*/
private function publish(string $path, array $sections): void
{
$page = Page::query()->create(['path' => $path]);
$service = app(PageService::class);
$revision = $service->saveRevision($page, $sections, null, null, null);
$service->publish($page, $revision);
}
/**
* @param array<string, mixed> $refs
* @param array<string, mixed> $data
* @return array<string, mixed>
*/
private function card(string $type, array $refs, array $data = []): array
{
return ['type' => $type, 'v' => 1, 'variant' => 'adaptive', 'settings' => [], 'data' => $data, 'refs' => $refs];
}
}