Compare commits
19
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a359a5fb69 | ||
|
|
7b325f0d66 | ||
|
|
5590225f4f | ||
|
|
f29ea58fd5 | ||
|
|
c4be6ed8dc | ||
|
|
053a8d4648 | ||
|
|
7c63424ea6 | ||
|
|
13530b8171 | ||
|
|
72130d66c5 | ||
|
|
d37a7093dd | ||
|
|
3e56314cf9 | ||
|
|
8a6678aad7 | ||
|
|
b178939852 | ||
|
|
a08067c078 | ||
|
|
bc1f84ac89 | ||
|
|
39ab25d8c6 | ||
|
|
127ea86817 | ||
|
|
cca069be48 | ||
|
|
f511ad10de |
No files matched your search
@@ -11,8 +11,10 @@ class Composition extends Model
|
||||
protected $fillable = [
|
||||
'designation',
|
||||
'display_title',
|
||||
'teaser',
|
||||
'summary',
|
||||
'description',
|
||||
'search_terms',
|
||||
'thumbnail_path',
|
||||
'thumbnail_alt',
|
||||
'thumbnail_source',
|
||||
|
||||
@@ -14,14 +14,21 @@ class ContentElement extends Model
|
||||
'output_class',
|
||||
'working_title',
|
||||
'display_title',
|
||||
'teaser',
|
||||
'description',
|
||||
'usage_note',
|
||||
'license_note',
|
||||
'website_credit',
|
||||
'website_alt',
|
||||
'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',
|
||||
];
|
||||
@@ -30,6 +37,7 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'archived_at' => 'datetime',
|
||||
'website_released_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Catalog;
|
||||
|
||||
/**
|
||||
* Anzeigedaten des Fachobjekts hinter einer Premium-Karte (Thema, Medium/Material, Programm/Modul).
|
||||
* Wird zur Laufzeit aus den maßgeblichen Fachdaten gelesen und nie im CMS gespeichert.
|
||||
*
|
||||
* - url: nur ein öffentlich freigegebenes Ziel aus dem Fachobjekt (Themenseite, Programmseite), sonst null.
|
||||
* - public: false heißt „nur in der Redaktionsvorschau“; öffentlich entfällt die Karte dann.
|
||||
* - notice: redaktioneller Hinweis für die Vorschau, warum die Karte öffentlich nicht erscheint.
|
||||
* - visual: Darstellung ohne Kartenbild: 'film' (Medientafel Film), 'material' (Materialsymbol),
|
||||
* 'catalog' (Navy-Tafel Programm/Modul) oder null (Karte ohne Bildbereich).
|
||||
* - previewImage: geschütztes Vorschaubild der Bibliothek (Filmstandbild, Vorschau des Moduls). Nur für die
|
||||
* Redaktionsvorschau (Route editorial.card, nur für angemeldete Redaktion); öffentlich nie ausgegeben, weil es
|
||||
* keine Freigabe für die Website hat.
|
||||
* - missing: was für eine vollständige Karte fehlt, als Hinweis nur in der Redaktionsvorschau.
|
||||
*/
|
||||
final readonly class CardSubject
|
||||
{
|
||||
/**
|
||||
* @param list<string> $meta reine Anzeigetexte aus Fachdaten
|
||||
* @param list<string> $missing Hinweise für die Redaktion
|
||||
*/
|
||||
public function __construct(
|
||||
public string $title,
|
||||
public ?string $summary,
|
||||
public string $kind,
|
||||
public ?string $badge,
|
||||
public array $meta,
|
||||
public ?string $url,
|
||||
public bool $public,
|
||||
public ?string $notice = null,
|
||||
public ?string $visual = null,
|
||||
public ?string $visualLabel = null,
|
||||
public ?string $previewImage = null,
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,10 @@
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -93,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)
|
||||
@@ -171,6 +176,165 @@ public function entries(array $refs, bool $includeNonPublic): array
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Für die Programm- oder Modulkarte wählbar: Programm oder Modul, nicht archiviert, mit mindestens einer
|
||||
* bereitgestellten Fassung. Anders als bei den Katalogkarten ist keine Anzeigefreigabe nötig, damit die Redaktion
|
||||
* eine Karte vorbereiten kann; öffentlich gilt unverändert isPublic().
|
||||
*/
|
||||
public function isCardSelectable(Composition $composition): bool
|
||||
{
|
||||
return $composition->archived_at === null
|
||||
&& in_array($composition->editorialContentKind?->slug, self::SELECTABLE_KINDS, true)
|
||||
&& $this->latestReadyVersion($composition) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function cardSearch(?string $term, int $limit = 25): array
|
||||
{
|
||||
$term = trim((string) $term);
|
||||
|
||||
$candidates = Composition::query()
|
||||
->with('editorialContentKind')
|
||||
->whereNull('archived_at')
|
||||
->whereHas('editorialContentKind', fn ($query) => $query->whereIn('slug', self::SELECTABLE_KINDS))
|
||||
->when($term !== '', function ($query) use ($term): void {
|
||||
$like = '%'.mb_strtolower($term).'%';
|
||||
$query->where(fn ($inner) => $inner
|
||||
->whereRaw('LOWER(designation) 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)
|
||||
->get();
|
||||
|
||||
$options = [];
|
||||
foreach ($candidates as $composition) {
|
||||
if (! $this->isCardSelectable($composition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$options[$composition->id] = $this->cardOptionLabel($composition);
|
||||
|
||||
if (count($options) >= $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function cardLabelFor(mixed $id): ?string
|
||||
{
|
||||
$composition = is_numeric($id) ? Composition::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||
|
||||
return $composition === null ? null : $this->cardOptionLabel($composition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Anzeigedaten für eine Programm- oder Modulkarte (Premium-Karte).
|
||||
*
|
||||
* - Öffentlich nur Programme mit Anzeigefreigabe (dieselbe Regel wie /programme), mit Programmseite als Ziel.
|
||||
* Module haben keine öffentliche Seitenart (ADR-29) und erscheinen nur in der Redaktionsvorschau, ohne Link.
|
||||
* - Text: Kurzbeschreibung, sonst das Lernziel der gezeigten (öffentlich) bzw. neuesten bereitgestellten Fassung;
|
||||
* das Lernziel steht auf der öffentlichen Programmseite bereits öffentlich.
|
||||
* - Zusatzangaben: Zahl der Module, Dauer. Kein Preis, kein Angebot, keine Kaufaktion; eine Karte ist kein
|
||||
* Lizenzartikel. Das Vorschaubild der Bibliothek erscheint nur in der Redaktionsvorschau.
|
||||
*/
|
||||
public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
||||
{
|
||||
$composition = is_numeric($id) ? Composition::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||
|
||||
if ($composition === null || ! $this->isCardSelectable($composition)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$shown = $this->shownVersion($composition);
|
||||
$public = $shown !== null && $composition->archived_at === null;
|
||||
|
||||
if (! $public && ! $includeNonPublic) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$version = $shown ?? $this->latestReadyVersion($composition);
|
||||
$program = $composition->editorialContentKind?->slug === 'programm';
|
||||
$kind = (string) ($composition->editorialContentKind?->label ?? ($program ? 'Programm' : 'Modul'));
|
||||
$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 = [];
|
||||
|
||||
if ($summary === null) {
|
||||
$missing[] = $goal !== null
|
||||
? 'Keine Kurzbeschreibung gepflegt; die Karte zeigt das Lernziel.'
|
||||
: 'Weder Kurzbeschreibung noch Lernziel gepflegt.';
|
||||
}
|
||||
|
||||
$meta = [];
|
||||
if ($version !== null) {
|
||||
$modules = $version->members()
|
||||
->whereNotNull('nested_composition_version_id')
|
||||
->with('nestedCompositionVersion.composition.editorialContentKind')
|
||||
->get()
|
||||
->filter(fn ($member): bool => $member->nestedCompositionVersion?->composition?->editorialContentKind?->slug === 'modul')
|
||||
->count();
|
||||
|
||||
if ($program && $modules > 0) {
|
||||
$meta[] = $modules === 1 ? '1 Modul' : $modules.' Module';
|
||||
}
|
||||
|
||||
if (is_numeric($version->duration_minutes) && (int) $version->duration_minutes > 0) {
|
||||
$meta[] = 'Dauer '.(int) $version->duration_minutes.' Min.';
|
||||
} else {
|
||||
$missing[] = 'Keine Dauer gepflegt.';
|
||||
}
|
||||
}
|
||||
|
||||
$notice = null;
|
||||
if (! $public) {
|
||||
$notice = 'Nur in der Redaktionsvorschau sichtbar: '.($program
|
||||
? 'Das Programm hat keine Anzeigefreigabe.'
|
||||
: 'Für Module gibt es noch keine öffentliche Seitenart (öffentliches Profil, ADR-29); die Karte erhält deshalb keinen Link.');
|
||||
}
|
||||
|
||||
return new CardSubject(
|
||||
title: $profile->value('display_title') ?: $this->title($composition),
|
||||
summary: $summary ?? $goal,
|
||||
kind: $kind,
|
||||
badge: null,
|
||||
meta: $meta,
|
||||
url: $public ? route('public.program', $composition) : null,
|
||||
public: $public,
|
||||
notice: $notice,
|
||||
visual: 'catalog',
|
||||
visualLabel: $kind,
|
||||
previewImage: $includeNonPublic ? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path) : null,
|
||||
missing: $missing,
|
||||
);
|
||||
}
|
||||
|
||||
private function latestReadyVersion(Composition $composition): ?CompositionVersion
|
||||
{
|
||||
return $composition->versions()
|
||||
->where('status', ContentVersionStatus::Bereit->value)
|
||||
->orderByDesc('number')
|
||||
->first();
|
||||
}
|
||||
|
||||
private function cardOptionLabel(Composition $composition): string
|
||||
{
|
||||
$visibility = match (true) {
|
||||
$this->isPublic($composition) => 'öffentlich sichtbar',
|
||||
$composition->editorialContentKind?->slug === 'modul' => 'Modul, nur Redaktionsvorschau',
|
||||
default => 'ohne Anzeigefreigabe, nur Redaktionsvorschau',
|
||||
};
|
||||
|
||||
return $this->title($composition).' · '.($composition->editorialContentKind?->label ?? '').' · '.$visibility;
|
||||
}
|
||||
|
||||
private function title(Composition $composition): string
|
||||
{
|
||||
return (string) ($composition->display_title ?: $composition->designation);
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Catalog;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Lesesicht „Medien und Materialien“ für Premium-Karten (Website-CMS-Zielarchitektur 6.2).
|
||||
*
|
||||
* Auswahl in der Redaktion: jedes nicht archivierte Inhaltselement mit mindestens einer nicht gesperrten Fassung.
|
||||
*
|
||||
* Öffentliche Sichtbarkeit (Übergangsregel, solange öffentliche Fachobjektprofile nach ADR-29 fehlen):
|
||||
* Ein Medium hat keine eigene öffentliche Seite. Öffentlich genannt wird es heute nur als Bestandteil der gezeigten
|
||||
* Fassung eines öffentlichen Programms (Programmseite /programme/{id}). Genau dann erscheint auch die Karte
|
||||
* öffentlich, mit Verweis auf diese Programmseite, und nur mit bereitgestellter Fassung. Traineranleitungen erscheinen
|
||||
* nie öffentlich (vertraulich für Trainerinnen und Trainer).
|
||||
*
|
||||
* Öffentlich gelesen werden Anzeigetitel (sonst Arbeitstitel), Kurzbeschreibung, Inhaltsart und Ausgabeart. Nie:
|
||||
* Beschreibung, Einsatzhinweis, Lizenzvermerk, Dateien, Lehrtexte, Ausgabeadressen. Das Vorschaubild (Filmstandbild)
|
||||
* der Bibliothek ist nicht für die Website freigegeben; es erscheint nur in der Redaktionsvorschau.
|
||||
* Eine Karte spielt nichts ab, bietet keinen Download und gibt kein Medium frei.
|
||||
*/
|
||||
class PublicMaterialReader
|
||||
{
|
||||
/** Inhaltsarten, die nie öffentlich auf einer Karte erscheinen. */
|
||||
public const CONFIDENTIAL_KINDS = ['traineranleitung'];
|
||||
|
||||
/** @var array<int, array{id: int, title: string}>|null Element-ID => erstes öffentliches Programm */
|
||||
private ?array $publicIndex = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly PublicCatalogReader $catalog,
|
||||
private readonly CompositionStructureReader $structure,
|
||||
) {}
|
||||
|
||||
public function isSelectable(ContentElement $element): bool
|
||||
{
|
||||
return $element->archived_at === null
|
||||
&& $element->versions()->where('status', '!=', ContentVersionStatus::Gesperrt->value)->exists();
|
||||
}
|
||||
|
||||
public function isReady(ContentElement $element): bool
|
||||
{
|
||||
return $element->versions()->where('status', ContentVersionStatus::Bereit->value)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Öffentliches Programm, in dessen gezeigter Fassung das Element vorkommt, sonst null.
|
||||
*
|
||||
* @return array{id: int, title: string}|null
|
||||
*/
|
||||
public function publicProgramFor(ContentElement $element): ?array
|
||||
{
|
||||
return $this->publicIndex()[$element->id] ?? null;
|
||||
}
|
||||
|
||||
public function isPublic(ContentElement $element): bool
|
||||
{
|
||||
return $this->isSelectable($element)
|
||||
&& $this->isReady($element)
|
||||
&& ! in_array($element->editorialContentKind?->slug, self::CONFIDENTIAL_KINDS, true)
|
||||
&& $this->publicProgramFor($element) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function search(?string $term, int $limit = 25): array
|
||||
{
|
||||
$term = trim((string) $term);
|
||||
|
||||
$candidates = ContentElement::query()
|
||||
->with('editorialContentKind')
|
||||
->whereNull('archived_at')
|
||||
->whereHas('versions', fn ($query) => $query->where('status', '!=', ContentVersionStatus::Gesperrt->value))
|
||||
->when($term !== '', function ($query) use ($term): void {
|
||||
$like = '%'.mb_strtolower($term).'%';
|
||||
$query->where(fn ($inner) => $inner
|
||||
->whereRaw('LOWER(working_title) LIKE ?', [$like])
|
||||
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like]));
|
||||
})
|
||||
->orderBy('working_title')
|
||||
->limit($limit)
|
||||
->get();
|
||||
|
||||
$options = [];
|
||||
foreach ($candidates as $element) {
|
||||
$options[$element->id] = $this->optionLabel($element);
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function labelFor(mixed $id): ?string
|
||||
{
|
||||
$element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||
|
||||
return $element === null ? null : $this->optionLabel($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Anzeigedaten für eine Karte. Öffentlich null, wenn das Element nicht öffentlich genannt wird.
|
||||
*
|
||||
* @param array<string, mixed> $draft ungespeicherte Anzeigedaten, nur für die Redaktionsvorschau
|
||||
*/
|
||||
public function subject(mixed $id, bool $includeNonPublic, array $draft = []): ?CardSubject
|
||||
{
|
||||
$element = is_numeric($id) ? ContentElement::query()->with('editorialContentKind')->find((int) $id) : null;
|
||||
|
||||
if ($element === null || ! $this->isSelectable($element)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$public = $this->isPublic($element);
|
||||
|
||||
if (! $public && ! $includeNonPublic) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$shown = clone $element;
|
||||
|
||||
foreach (['working_title', 'display_title', 'summary', 'thumbnail_path', 'thumbnail_alt'] as $field) {
|
||||
if (! array_key_exists($field, $draft)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$value = $draft[$field];
|
||||
$shown->setAttribute($field, is_string($value) && trim($value) === '' ? null : $value);
|
||||
}
|
||||
|
||||
$program = $this->publicProgramFor($element);
|
||||
$output = self::outputLabel((string) $shown->output_class);
|
||||
$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) {
|
||||
$meta[] = 'Im Programm „'.$program['title'].'“';
|
||||
}
|
||||
if ($film) {
|
||||
$meta[] = 'Vollständiger Film nur mit Lizenz im Mitgliederbereich';
|
||||
}
|
||||
|
||||
$missing = [];
|
||||
if ($summary === null) {
|
||||
$missing[] = 'Keine Kurzbeschreibung gepflegt (Medium bearbeiten → Kurzbeschreibung).';
|
||||
}
|
||||
if (! filled($shown->display_title)) {
|
||||
$missing[] = 'Kein Anzeigetitel gepflegt; die Karte zeigt den Arbeitstitel.';
|
||||
}
|
||||
|
||||
$previewImage = $includeNonPublic ? ThumbnailRef::url('editorial.card', 'element', (int) $element->id, $shown->thumbnail_path) : null;
|
||||
|
||||
return new CardSubject(
|
||||
title: $title,
|
||||
summary: $summary,
|
||||
kind: filled($editorialKind) ? (string) $editorialKind : $output,
|
||||
badge: $output,
|
||||
meta: $meta,
|
||||
url: $public && $program !== null ? route('public.program', $program['id']) : null,
|
||||
public: $public,
|
||||
notice: $public ? null : $this->notice($element, $program),
|
||||
visual: $film ? 'film' : 'material',
|
||||
visualLabel: $output,
|
||||
previewImage: $previewImage,
|
||||
missing: $missing,
|
||||
style: $film ? 'media' : 'material',
|
||||
);
|
||||
}
|
||||
|
||||
/** Bezeichnung der Ausgabeart, wie in der Redaktionsstruktur (CompositionRelease::outputLabel). */
|
||||
public static function outputLabel(string $outputClass): string
|
||||
{
|
||||
return match ($outputClass) {
|
||||
'film' => 'Film',
|
||||
'audio' => 'Hörstück',
|
||||
'bild' => 'Bild',
|
||||
'document', 'pdf' => 'Dokument',
|
||||
default => 'Text',
|
||||
};
|
||||
}
|
||||
|
||||
public function visibilityNote(ContentElement $element): string
|
||||
{
|
||||
if ($this->isPublic($element)) {
|
||||
$program = $this->publicProgramFor($element);
|
||||
|
||||
return 'Öffentlich nur als Teil der Programmseite „'.($program['title'] ?? '').'“. Die Mediendatei wird dabei nicht ausgeliefert.';
|
||||
}
|
||||
|
||||
return $this->notice($element, $this->publicProgramFor($element));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{id: int, title: string}|null $program
|
||||
*/
|
||||
private function notice(ContentElement $element, ?array $program): string
|
||||
{
|
||||
$reason = match (true) {
|
||||
in_array($element->editorialContentKind?->slug, self::CONFIDENTIAL_KINDS, true) => 'Traineranleitungen erscheinen nie öffentlich.',
|
||||
! $this->isReady($element) => 'Das Medium hat noch keine bereitgestellte Fassung.',
|
||||
$program === null => 'Das Medium gehört zu keinem öffentlich gezeigten Programm. Medien haben noch keine eigene öffentliche Freigabe (öffentliches Profil, ADR-29).',
|
||||
default => 'Das Medium ist nicht öffentlich.',
|
||||
};
|
||||
|
||||
return 'Nur in der Redaktionsvorschau sichtbar: '.$reason;
|
||||
}
|
||||
|
||||
private function optionLabel(ContentElement $element): string
|
||||
{
|
||||
$visibility = $this->isPublic($element)
|
||||
? 'öffentlich über Programmseite'
|
||||
: ($this->isReady($element) ? 'nur Redaktionsvorschau' : 'Entwurf, nur Redaktionsvorschau');
|
||||
$kind = $element->editorialContentKind?->label ?: self::outputLabel((string) $element->output_class);
|
||||
|
||||
return (string) ($element->display_title ?: $element->working_title).' · '.$kind.' · '.$visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Index aller Elemente, die in der gezeigten Fassung eines öffentlichen Programms vorkommen (auch verschachtelt).
|
||||
*
|
||||
* @return array<int, array{id: int, title: string}>
|
||||
*/
|
||||
private function publicIndex(): array
|
||||
{
|
||||
if ($this->publicIndex !== null) {
|
||||
return $this->publicIndex;
|
||||
}
|
||||
|
||||
$index = [];
|
||||
|
||||
foreach ($this->catalog->publicPrograms() as $program) {
|
||||
$version = $this->catalog->shownVersion($program);
|
||||
|
||||
if ($version === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry = ['id' => (int) $program->id, 'title' => (string) ($program->display_title ?: $program->designation)];
|
||||
|
||||
foreach ($this->elementIds($this->structure->tree($version)) as $elementId) {
|
||||
$index[$elementId] ??= $entry;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->publicIndex = $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<StructureNode> $nodes
|
||||
* @return list<int>
|
||||
*/
|
||||
private function elementIds(array $nodes): array
|
||||
{
|
||||
$ids = [];
|
||||
|
||||
foreach ($nodes as $node) {
|
||||
if ($node->contentElementId !== null) {
|
||||
$ids[] = (int) $node->contentElementId;
|
||||
}
|
||||
|
||||
array_push($ids, ...$this->elementIds($node->children));
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Domain\Cms\Sections;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
@@ -11,14 +13,17 @@
|
||||
* Abschnitts- und Slotmodell einer Seite: Seite → Abschnitte → Slots → Widget-Instanzen.
|
||||
*
|
||||
* Gespeicherte Hülle eines Abschnitts (Version 1):
|
||||
* {id, v, layout, style: {background, image, focus, overlay, width, spacing, spacing_top, divider}, slots: [Widget-Hülle|null, …]}
|
||||
* {id, v, layout, style: {background, image, focus, overlay, width, spacing_top, spacing_bottom, gap, divider}, slots: [Widget-Hülle|null, …]}
|
||||
*
|
||||
* Version 2 (Abstände): oben, unten und Widget-Abstand sind drei unabhängige Werte. Hüllen der Version 1 werden beim
|
||||
* Lesen übersetzt (SectionStyle::migrateSpacing), ohne die Darstellung zu ändern; gespeicherte Revisionen bleiben.
|
||||
*
|
||||
* Jeder Slot enthält höchstens ein Widget aus dem zentralen Widget-Register. Abschnitte sind nicht verschachtelbar.
|
||||
* Revisionen ohne Abschnitte (Bestand vor dieser Fassung) werden beim Lesen als einspaltige Abschnitte gelesen.
|
||||
*/
|
||||
class PageSections
|
||||
{
|
||||
public const VERSION = 1;
|
||||
public const VERSION = 2;
|
||||
|
||||
public const MAX_SECTIONS = 30;
|
||||
|
||||
@@ -41,10 +46,8 @@ public function read(?array $sections, ?array $blocks = null): array
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach (array_values($sections) as $section) {
|
||||
if (is_array($section)) {
|
||||
$result[] = $this->upcastSection($section);
|
||||
}
|
||||
foreach (SectionStyle::migrateSpacing(array_values(array_filter($sections, 'is_array')), byVersion: true) as $section) {
|
||||
$result[] = $this->upcastSection($section);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -74,6 +77,12 @@ public function normalize(array $content): array
|
||||
$seenWidgetIds = [];
|
||||
$widgetCount = 0;
|
||||
|
||||
// Eingaben mit Abständen der Version 1 (zum Beispiel ältere Aufrufer) werden wie beim Lesen übersetzt.
|
||||
$migrated = SectionStyle::migrateSpacing(array_map(
|
||||
fn ($item) => is_array($item) && array_key_exists('slots', $item) ? $item : ['style' => [], 'slots' => [$item]],
|
||||
$items,
|
||||
));
|
||||
|
||||
foreach ($items as $index => $item) {
|
||||
if (! is_array($item)) {
|
||||
$errors["sections.$index"] = ['Ein Abschnitt ist unvollständig.'];
|
||||
@@ -83,6 +92,8 @@ public function normalize(array $content): array
|
||||
|
||||
if (! array_key_exists('slots', $item)) {
|
||||
$item = ['id' => null, 'layout' => SectionLayouts::DEFAULT, 'style' => [], 'slots' => [$item]];
|
||||
} else {
|
||||
$item['style'] = $migrated[$index]['style'] ?? ($item['style'] ?? []);
|
||||
}
|
||||
|
||||
$sections[] = $this->normalizeSection($item, $index, $errors, $seenSectionIds, $seenWidgetIds, $widgetCount);
|
||||
@@ -136,7 +147,7 @@ public function mediaPaths(array $sections): array
|
||||
|
||||
foreach ($sections as $section) {
|
||||
$style = SectionStyle::fromStored($section['style'] ?? []);
|
||||
if ($style['image'] !== null && PublicMedia::isPublicPath($style['image'])) {
|
||||
if (is_string($style['image']) && PublicMedia::isPublicPath($style['image'])) {
|
||||
$paths[] = $style['image'];
|
||||
}
|
||||
}
|
||||
@@ -164,13 +175,14 @@ private function wrapWidgets(array $blocks): array
|
||||
{
|
||||
$sections = [];
|
||||
|
||||
foreach ($this->widgets->read($blocks) as $widget) {
|
||||
foreach ($this->widgets->read($blocks) as $position => $widget) {
|
||||
$sections[] = [
|
||||
'id' => null,
|
||||
'v' => self::VERSION,
|
||||
'layout' => SectionLayouts::DEFAULT,
|
||||
// Bestand vor dem Raster stand in einem durchgehenden Blatt: kompakte Abstände kommen dem am nächsten.
|
||||
'style' => ['spacing' => 'compact'] + SectionStyle::DEFAULTS,
|
||||
// Bestand vor dem Raster stand in einem durchgehenden Blatt: kompakte Abstände, zwischen den Widgets
|
||||
// nur einmal (oben kein Abstand ab dem zweiten), wie bisher.
|
||||
'style' => ['spacing_top' => $position === 0 ? 'compact' : 'none', 'spacing_bottom' => 'compact', 'gap' => 'normal'] + SectionStyle::DEFAULTS,
|
||||
'slots' => [$widget],
|
||||
];
|
||||
}
|
||||
@@ -325,14 +337,17 @@ private function normalizeStyle(array $style, string $prefix, array &$errors): a
|
||||
$result[$key] = $value;
|
||||
}
|
||||
|
||||
$upload = PublicMedia::fromUploadState($style['_upload'] ?? null);
|
||||
$image = $upload ?? PublicMedia::fromUploadState($style['image'] ?? null);
|
||||
|
||||
if ($result['background'] === 'image') {
|
||||
if ($image === null) {
|
||||
$errors["$prefix.style.image"] = ['Bitte ein Hintergrundbild wählen oder hochladen.'];
|
||||
} elseif (! PublicMedia::isPublicPath($image)) {
|
||||
$errors["$prefix.style.image"] = ['Das Hintergrundbild liegt nicht im öffentlichen Medienbereich.'];
|
||||
$widgetErrors = new WidgetErrors;
|
||||
$refs = ImageRefFields::clean(['image' => $style['image'] ?? null, '_upload' => $style['_upload'] ?? null], $widgetErrors, errorKey: 'image');
|
||||
$image = $refs['image'];
|
||||
|
||||
foreach ($widgetErrors->all() as $messages) {
|
||||
$errors["$prefix.style.image"] = $messages;
|
||||
}
|
||||
|
||||
if ($image === null && ! isset($errors["$prefix.style.image"])) {
|
||||
$errors["$prefix.style.image"] = ['Bitte ein Hintergrundbild aus dem Medienmanager wählen oder hochladen.'];
|
||||
}
|
||||
|
||||
$result['image'] = $image;
|
||||
|
||||
@@ -22,6 +22,8 @@ final class SectionLayouts
|
||||
'u3_1' => [3, 1],
|
||||
'u1_2_1' => [1, 2, 1],
|
||||
'u1_1_1_1' => [1, 1, 1, 1],
|
||||
'u1_1_2' => [1, 1, 2],
|
||||
'u2_1_1' => [2, 1, 1],
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
@@ -32,6 +34,8 @@ final class SectionLayouts
|
||||
'u3_1' => 'Breit und schmal',
|
||||
'u1_2_1' => 'Mitte betont',
|
||||
'u1_1_1_1' => 'Vier gleich breit',
|
||||
'u1_1_2' => 'Zwei schmal, eins breit',
|
||||
'u2_1_1' => 'Eins breit, zwei schmal',
|
||||
];
|
||||
|
||||
public static function has(mixed $key): bool
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Domain\Cms\Sections;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\WidgetRenderer;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
@@ -56,7 +56,7 @@ public function renderAll(array $sections, RenderContext $context): HtmlString
|
||||
$last = count($rendered) - 1;
|
||||
|
||||
foreach ($rendered as $index => $item) {
|
||||
$html .= $this->renderSection($item['section'], $item['cells'], $index);
|
||||
$html .= $this->renderSection($item['section'], $item['cells'], $index, $context);
|
||||
|
||||
$divider = $item['section']['style']['divider'] ?? 'none';
|
||||
if ($index < $last && in_array($divider, ['line', 'accent'], true)) {
|
||||
@@ -71,18 +71,21 @@ public function renderAll(array $sections, RenderContext $context): HtmlString
|
||||
* @param array<string, mixed> $section
|
||||
* @param list<array{units: int, html: string}> $cells
|
||||
*/
|
||||
private function renderSection(array $section, array $cells, int $index): string
|
||||
private function renderSection(array $section, array $cells, int $index, RenderContext $context): string
|
||||
{
|
||||
$style = SectionStyle::fromStored($section['style'] ?? []);
|
||||
$columns = SectionLayouts::columns(array_column($cells, 'units'));
|
||||
$hasImage = $style['background'] === 'image' && $style['image'] !== null && PublicMedia::isPublicPath($style['image']);
|
||||
// Hintergrundbild aus dem Medienmanager: öffentlich nur mit Website-Freigabe (WebsiteImage → WebsiteMedia).
|
||||
$imageUrl = $style['background'] === 'image' ? app(WebsiteImage::class)->url($style['image'], $context->preview) : null;
|
||||
$hasImage = $imageUrl !== null;
|
||||
|
||||
$classes = [
|
||||
'page-section',
|
||||
'section-bg-'.($hasImage ? 'image' : ($style['background'] === 'image' ? 'default' : $style['background'])),
|
||||
'section-width-'.$style['width'],
|
||||
'section-space-'.$style['spacing'],
|
||||
...($style['spacing_top'] !== 'same' ? ['section-space-top-'.$style['spacing_top']] : []),
|
||||
'section-space-top-'.$style['spacing_top'],
|
||||
'section-space-bottom-'.$style['spacing_bottom'],
|
||||
'section-gap-'.$style['gap'],
|
||||
'section-layout-'.str_replace('_', '-', $section['layout']),
|
||||
];
|
||||
|
||||
@@ -102,17 +105,13 @@ private function renderSection(array $section, array $cells, int $index): string
|
||||
$classes[] = $scope;
|
||||
}
|
||||
|
||||
if ($style['divider'] === 'space') {
|
||||
$classes[] = 'section-divider-space';
|
||||
}
|
||||
|
||||
$id = is_string($section['id'] ?? null) ? ' id="bereich-'.e($section['id']).'"' : '';
|
||||
$html = '<div class="'.e(implode(' ', $classes)).'"'.$id.'>';
|
||||
|
||||
if ($hasImage) {
|
||||
// Das Bild des ersten Abschnitts ist meist das größte sichtbare Element und wird nicht verzögert geladen.
|
||||
$loading = $index === 0 ? 'loading="eager" fetchpriority="high"' : 'loading="lazy"';
|
||||
$html .= '<img class="page-section-image" src="'.e(PublicMedia::url($style['image'])).'" alt="" '.$loading.' decoding="async"'
|
||||
$html .= '<img class="page-section-image" src="'.e($imageUrl).'" alt="" '.$loading.' decoding="async"'
|
||||
.' style="object-position: '.e(SectionStyle::FOCUS_POSITIONS[$style['focus']]).'">';
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Domain\Cms\Sections;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
|
||||
/**
|
||||
* Semantische Abschnittsgestaltung. Jeder Wert ist eine Aufzählung, die auf zentrale Design-Tokens
|
||||
* abgebildet wird (resources/css/app.css, Abschnitt „Abschnitte“). Keine freie CSS- oder Farbangabe.
|
||||
@@ -25,29 +27,27 @@ final class SectionStyle
|
||||
'full' => 'Vollbreite',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
/**
|
||||
* Gemeinsame Stufen der drei Abstände eines Abschnitts (Hülle Version 2):
|
||||
* - spacing_top: Abstand vor dem Inhalt (oben),
|
||||
* - spacing_bottom: Abstand nach dem Inhalt (unten),
|
||||
* - gap: Abstand zwischen den Plätzen im Abschnittsraster, nebeneinander und gestapelt.
|
||||
* Zwischen zwei Abschnitten addieren sich „unten“ des ersten und „oben“ des zweiten; es gibt keine weitere
|
||||
* versteckte Vorgabe. Liegt eine eigene Fläche (Hintergrund) vor, liegen oben und unten innerhalb dieser Fläche.
|
||||
* Werte: resources/css/tokens.css (--section-space-*, --section-gap-*).
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public const SPACINGS = [
|
||||
'none' => 'Kein Abstand',
|
||||
'compact' => 'Kompakt',
|
||||
'normal' => 'Normal',
|
||||
'large' => 'Großzügig',
|
||||
];
|
||||
|
||||
/**
|
||||
* Abweichender Abstand oben, zum Beispiel damit ein Einstieg direkt unter der Kopfzeile beginnt.
|
||||
* Ergänzt „Abstand oben und unten“, ersetzt ihn nicht; der Abstand unten bleibt unverändert.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public const SPACINGS_TOP = [
|
||||
'same' => 'Wie „Abstand oben und unten“',
|
||||
'small' => 'Gering',
|
||||
'none' => 'Kein Abstand',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
public const DIVIDERS = [
|
||||
'none' => 'Kein Trenner',
|
||||
'space' => 'Zusätzlicher Abstand',
|
||||
'line' => 'Dezente Linie',
|
||||
'accent' => 'Markenakzent',
|
||||
];
|
||||
@@ -91,8 +91,9 @@ final class SectionStyle
|
||||
'focus' => 'center',
|
||||
'overlay' => 'light',
|
||||
'width' => 'standard',
|
||||
'spacing' => 'normal',
|
||||
'spacing_top' => 'same',
|
||||
'spacing_top' => 'compact',
|
||||
'spacing_bottom' => 'compact',
|
||||
'gap' => 'normal',
|
||||
'divider' => 'none',
|
||||
];
|
||||
|
||||
@@ -108,8 +109,9 @@ public static function enums(): array
|
||||
'focus' => self::FOCUS,
|
||||
'overlay' => self::OVERLAYS,
|
||||
'width' => self::WIDTHS,
|
||||
'spacing' => self::SPACINGS,
|
||||
'spacing_top' => self::SPACINGS_TOP,
|
||||
'spacing_top' => self::SPACINGS,
|
||||
'spacing_bottom' => self::SPACINGS,
|
||||
'gap' => self::SPACINGS,
|
||||
'divider' => self::DIVIDERS,
|
||||
];
|
||||
}
|
||||
@@ -118,7 +120,7 @@ public static function enums(): array
|
||||
* Lesepfad: gespeicherte Werte; Unbekanntes fällt auf die Vorgabe zurück, damit alte oder fremde Daten
|
||||
* nie eine Seite brechen.
|
||||
*
|
||||
* @return array{background: string, image: ?string, focus: string, overlay: string, width: string, spacing: string, spacing_top: string, divider: string}
|
||||
* @return array{background: string, image: ?string, focus: string, overlay: string, width: string, spacing_top: string, spacing_bottom: string, gap: string, divider: string}
|
||||
*/
|
||||
public static function fromStored(mixed $style): array
|
||||
{
|
||||
@@ -132,7 +134,7 @@ public static function fromStored(mixed $style): array
|
||||
}
|
||||
}
|
||||
|
||||
$result['image'] = $result['background'] === 'image' && is_string($style['image'] ?? null) ? $style['image'] : null;
|
||||
$result['image'] = $result['background'] === 'image' ? WebsiteImage::normalize($style['image'] ?? null) : null;
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -151,12 +153,13 @@ public static function summary(array $style): string
|
||||
$parts[] = self::WIDTHS[$style['width']];
|
||||
}
|
||||
|
||||
if ($style['spacing'] !== 'normal') {
|
||||
$parts[] = 'Abstand '.mb_strtolower(self::SPACINGS[$style['spacing']]);
|
||||
if ($style['spacing_top'] !== self::DEFAULTS['spacing_top'] || $style['spacing_bottom'] !== self::DEFAULTS['spacing_bottom']) {
|
||||
$parts[] = 'Abstand oben '.mb_strtolower(self::SPACINGS[$style['spacing_top']])
|
||||
.', unten '.mb_strtolower(self::SPACINGS[$style['spacing_bottom']]);
|
||||
}
|
||||
|
||||
if ($style['spacing_top'] !== 'same') {
|
||||
$parts[] = 'oben '.mb_strtolower(self::SPACINGS_TOP[$style['spacing_top']]);
|
||||
if ($style['gap'] !== 'normal') {
|
||||
$parts[] = 'Widget-Abstand '.mb_strtolower(self::SPACINGS[$style['gap']]);
|
||||
}
|
||||
|
||||
if ($style['divider'] !== 'none') {
|
||||
@@ -165,4 +168,77 @@ public static function summary(array $style): string
|
||||
|
||||
return implode(' · ', $parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob eine gespeicherte Gestaltung noch die Abstände der Hülle Version 1 trägt
|
||||
* („Abstand oben und unten“ spacing, Abweichung „Abstand oben“ same/small/none).
|
||||
*
|
||||
* @param array<string, mixed> $style
|
||||
*/
|
||||
public static function hasLegacySpacing(array $style): bool
|
||||
{
|
||||
return array_key_exists('spacing', $style)
|
||||
|| in_array($style['spacing_top'] ?? null, ['same', 'small'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Übersetzt die Abstände der Hülle Version 1 in die drei Werte der Version 2, ohne die Darstellung zu ändern.
|
||||
*
|
||||
* Version 1 rechnete so: jeder Abschnitt oben und unten „spacing“ (Vorgabe normal); die Abweichung
|
||||
* „Abstand oben“ ersetzte nur oben (small/none); und eine versteckte Regel setzte oben auf null, wenn ein Abschnitt
|
||||
* ohne eigene Fläche direkt auf einen Abschnitt ohne eigene Fläche folgte (ohne Linien- oder Akzenttrenner dazwischen).
|
||||
* Diese Regel wird hier als „oben: kein Abstand“ ausgeschrieben. „Gering“ hat keine eigene Stufe mehr und wird
|
||||
* „Kompakt“ (dokumentierte Abweichung). Der Widget-Abstand entspricht dem bisherigen festen Rasterabstand („normal“).
|
||||
*
|
||||
* @param list<array<string, mixed>> $sections Abschnitte in Lesereihenfolge (mit style und slots)
|
||||
* @param bool $byVersion true: jede Hülle mit v < 2 gilt als Version 1 (Lesepfad gespeicherter Revisionen);
|
||||
* false: nur Gestaltungen mit alten Schlüsseln (Eingaben ohne Versionsangabe)
|
||||
* @return list<array<string, mixed>> dieselben Abschnitte mit übersetzter Gestaltung
|
||||
*/
|
||||
public static function migrateSpacing(array $sections, bool $byVersion = false): array
|
||||
{
|
||||
$previous = null;
|
||||
|
||||
foreach ($sections as $index => $section) {
|
||||
$style = is_array($section['style'] ?? null) ? $section['style'] : [];
|
||||
$rendered = is_array($section['slots'] ?? null) && array_filter($section['slots'], 'is_array') !== [];
|
||||
|
||||
$background = is_string($style['background'] ?? null) && isset(self::BACKGROUNDS[$style['background']]) ? $style['background'] : 'default';
|
||||
if ($background === 'image' && WebsiteImage::normalize($style['image'] ?? null) === null) {
|
||||
$background = 'default';
|
||||
}
|
||||
$divider = in_array($style['divider'] ?? null, ['line', 'accent'], true) ? $style['divider'] : 'none';
|
||||
|
||||
$legacy = $byVersion ? (int) ($section['v'] ?? 1) < 2 : self::hasLegacySpacing($style);
|
||||
|
||||
if ($legacy) {
|
||||
$level = in_array($style['spacing'] ?? null, ['compact', 'normal', 'large'], true) ? $style['spacing'] : 'normal';
|
||||
$override = $style['spacing_top'] ?? 'same';
|
||||
$collapsed = $background === 'default' && $previous !== null && $previous['background'] === 'default' && ! in_array($previous['divider'], ['line', 'accent'], true);
|
||||
|
||||
$style['spacing_top'] = match (true) {
|
||||
$override === 'none' => 'none',
|
||||
$override === 'small' => 'compact',
|
||||
$collapsed => 'none',
|
||||
default => $level,
|
||||
};
|
||||
$style['spacing_bottom'] = $level;
|
||||
$style['gap'] = 'normal';
|
||||
|
||||
// Trenner „Zusätzlicher Abstand“ (Version 1) fügte unten noch einmal den Abschnittsabstand an.
|
||||
if (($style['divider'] ?? null) === 'space') {
|
||||
$style['spacing_bottom'] = ['compact' => 'normal', 'normal' => 'large', 'large' => 'large'][$level];
|
||||
$style['divider'] = 'none';
|
||||
}
|
||||
unset($style['spacing']);
|
||||
$sections[$index]['style'] = $style;
|
||||
}
|
||||
|
||||
if ($rendered) {
|
||||
$previous = ['background' => $background, 'divider' => $divider];
|
||||
}
|
||||
}
|
||||
|
||||
return $sections;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Media\WebsiteMediaAlias;
|
||||
|
||||
/**
|
||||
* Wo ein Medium auf Website-Seiten als Bild verwendet wird (veröffentlichte Fassung und neuester Entwurf).
|
||||
* Für den Medienmanager: Vor dem Zurücknehmen einer Website-Freigabe ist sichtbar, welche Seiten das Bild verlieren.
|
||||
*/
|
||||
class WebsiteImageUsage
|
||||
{
|
||||
/**
|
||||
* @return list<array{path: string, published: bool, draft: bool}>
|
||||
*/
|
||||
public function pages(ContentElement $element): array
|
||||
{
|
||||
$legacy = WebsiteMediaAlias::query()->where('content_element_id', $element->id)->pluck('legacy_path')->all();
|
||||
$usages = [];
|
||||
|
||||
foreach (Page::query()->with(['publishedRevision', 'latestRevision'])->orderBy('path')->get() as $page) {
|
||||
$published = $page->publishedRevision !== null && $this->uses($page->publishedRevision->sections ?? [], $element->id, $legacy);
|
||||
$draft = $page->latestRevision !== null && $page->latestRevision->id !== $page->published_revision_id
|
||||
&& $this->uses($page->latestRevision->sections ?? [], $element->id, $legacy);
|
||||
|
||||
if ($published || $draft) {
|
||||
$usages[] = ['path' => (string) $page->path, 'published' => $published, 'draft' => $draft];
|
||||
}
|
||||
}
|
||||
|
||||
return $usages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $legacy
|
||||
*/
|
||||
private function uses(mixed $value, int $id, array $legacy): bool
|
||||
{
|
||||
if (! is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($value as $key => $item) {
|
||||
if ($key === 'image' && (($item === $id || (is_string($item) && ($item === (string) $id || in_array($item, $legacy, true)))))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_array($item) && $this->uses($item, $id, $legacy)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -5,40 +5,80 @@
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use Filament\Forms\Components\Field;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Placeholder;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Illuminate\Support\Str;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
|
||||
/**
|
||||
* Gemeinsame Bildauswahl für Widgets: vorhandenes Bild aus dem öffentlichen Website-Bereich wählen
|
||||
* oder ein neues hochladen. Keine eigene Medienverwaltung.
|
||||
* Gemeinsame Bildauswahl aller Widgets und des Abschnittshintergrunds: Bilder aus dem zentralen Medienmanager
|
||||
* (siehe WebsiteImage, docs/architektur/medienzugriff-fuer-komponenten.md). Keine eigene CMS-Medienverwaltung.
|
||||
*
|
||||
* - Auswahl: durchsuchbare Liste mit Vorschaubild, Titel und Website-Status.
|
||||
* - Neu hochladen: Das Bild wird sofort als Medium im Medienmanager angelegt (WebsiteIntake) und ausgewählt.
|
||||
* - Anzeige des gewählten Mediums mit Status und Verweis auf die Freigabe im Medienmanager.
|
||||
*
|
||||
* Das Bedienmuster folgt der Bildauswahl im Modul- und Programmeditor (Suche, Vorschaubild, Auswählen); jene ist an
|
||||
* die Livewire-Seite des Editors gebunden und lässt sich nicht als Formularfeld im Widget-Dialog einhängen.
|
||||
*/
|
||||
final class ImageRefFields
|
||||
{
|
||||
/**
|
||||
* @param bool $live Änderungen sofort an die Vorschau im Bearbeitungsdialog geben.
|
||||
* @return list<Field>
|
||||
* @param string|null $altField Name des Alternativtext-Felds im selben Formular (für neue Medien), falls vorhanden.
|
||||
* @return list<Field|Placeholder>
|
||||
*/
|
||||
public static function fields(string $label = 'Bild', bool $live = false): array
|
||||
public static function fields(string $label = 'Bild', bool $live = false, string $key = 'image', ?string $altField = null): array
|
||||
{
|
||||
return [
|
||||
Select::make('image')
|
||||
->live($live)
|
||||
->label($label.': vorhandenes Bild')
|
||||
->options(fn (): array => PublicMedia::imageOptions())
|
||||
Select::make($key)
|
||||
->live()
|
||||
->label($label.' aus dem Medienmanager')
|
||||
->searchable()
|
||||
->allowHtml()
|
||||
->options(fn (): array => app(WebsiteImage::class)->options())
|
||||
->getSearchResultsUsing(fn (?string $search): array => app(WebsiteImage::class)->options($search))
|
||||
->getOptionLabelUsing(fn (mixed $value): ?string => app(WebsiteImage::class)->optionHtml($value))
|
||||
->placeholder('Kein Bild')
|
||||
->helperText('Auswahl aus den Bildern, die bereits für die Website hochgeladen wurden.'),
|
||||
->helperText('Alle Bilder des Medienmanagers. Öffentlich erscheint ein Bild nur mit Website-Freigabe.'),
|
||||
FileUpload::make('_upload')
|
||||
->live($live)
|
||||
->label($label.': neu hochladen')
|
||||
->disk('cms_incoming')
|
||||
->directory('cms')
|
||||
->live()
|
||||
->label($label.': neues Bild hochladen')
|
||||
->image()
|
||||
->maxSize(8192)
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->getUploadedFileNameForStorageUsing(fn (TemporaryUploadedFile $file): string => Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)).'-'.Str::lower(Str::random(6)).'.'.$file->guessExtension())
|
||||
->helperText('Ein neues Bild ersetzt die Auswahl oben. Es wird beim Speichern im öffentlichen Bereich der Website abgelegt.'),
|
||||
->storeFiles(false)
|
||||
->afterStateUpdated(function (mixed $state, Set $set, Get $get) use ($key, $altField): void {
|
||||
$file = is_array($state) ? (array_values($state)[0] ?? null) : $state;
|
||||
|
||||
if (! $file instanceof TemporaryUploadedFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
$element = app(WebsiteImage::class)->accept($file, $altField !== null ? $get($altField) : null);
|
||||
$set('_upload', null);
|
||||
|
||||
if ($element === null) {
|
||||
Notification::make()->danger()->title('Das Bild konnte nicht übernommen werden.')->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$set($key, $element->id);
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Im Medienmanager angelegt: „'.($element->display_title ?: $element->working_title).'“')
|
||||
->body('Das Bild ist ausgewählt. Nach der Verarbeitung wird es automatisch für die Website freigegeben.')
|
||||
->send();
|
||||
})
|
||||
->helperText('Das Bild wird im Medienmanager angelegt und hier ausgewählt. Nur Bilder mit geklärten Rechten hochladen.'),
|
||||
Placeholder::make('_media_status')
|
||||
->label('Gewähltes Bild')
|
||||
->visible(fn (Get $get): bool => WebsiteImage::normalize($get($key)) !== null)
|
||||
->content(fn (Get $get): HtmlString => self::statusHtml($get($key))),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -48,29 +88,49 @@ public static function fields(string $label = 'Bild', bool $live = false): array
|
||||
public static function rules(): array
|
||||
{
|
||||
return [
|
||||
'image' => ['nullable', 'string', 'max:255'],
|
||||
'image' => ['nullable'],
|
||||
'_upload' => ['nullable'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Übernimmt einen neuen Upload als Bild und prüft, dass das Bild im öffentlichen Bereich liegt.
|
||||
* Prüft das gewählte Bild. Ein früherer CMS-Pfad mit wirksamer Zuordnung wird zur Kennung des Mediums.
|
||||
* Ein noch als Datei übergebener Upload (frühere Formulare) wird über den Medienmanager aufgenommen.
|
||||
*
|
||||
* @param array<string, mixed> $refs
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function clean(array $refs, WidgetErrors $errors, string $key = 'image', ?string $errorKey = null): array
|
||||
{
|
||||
$upload = PublicMedia::fromUploadState($refs['_upload'] ?? null);
|
||||
$image = $upload ?? PublicMedia::fromUploadState($refs[$key] ?? null);
|
||||
$images = app(WebsiteImage::class);
|
||||
$upload = $refs['_upload'] ?? null;
|
||||
$upload = is_array($upload) ? (array_values($upload)[0] ?? null) : $upload;
|
||||
|
||||
if ($image !== null && ! PublicMedia::isPublicPath($image)) {
|
||||
$errors->add($errorKey ?? "refs.$key", 'Das Bild liegt nicht im öffentlichen Medienbereich.');
|
||||
if ($upload instanceof TemporaryUploadedFile) {
|
||||
$element = $images->accept($upload);
|
||||
$refs[$key] = $element?->id ?? $refs[$key] ?? null;
|
||||
}
|
||||
|
||||
$refs[$key] = $image;
|
||||
$refs[$key] = $images->clean($refs[$key] ?? null, $errors, $errorKey ?? "refs.$key");
|
||||
unset($refs['_upload']);
|
||||
|
||||
return $refs;
|
||||
}
|
||||
|
||||
public static function statusHtml(mixed $value): HtmlString
|
||||
{
|
||||
$status = app(WebsiteImage::class)->status($value);
|
||||
|
||||
if ($status === null) {
|
||||
return new HtmlString('');
|
||||
}
|
||||
|
||||
$thumb = $status['thumb'] !== null ? '<img src="'.e($status['thumb']).'" alt="">' : '';
|
||||
$link = $status['manageUrl'] !== null
|
||||
? '<a href="'.e($status['manageUrl']).'" target="_blank" rel="noopener">Im Medienmanager öffnen</a>'
|
||||
: '';
|
||||
|
||||
return new HtmlString('<div class="luf-media-status luf-media-status-'.e($status['state']).'">'.$thumb
|
||||
.'<div><strong>'.e($status['title']).'</strong><p>'.e($status['note']).'</p>'.$link.'</div></div>');
|
||||
}
|
||||
}
|
||||
@@ -98,10 +98,10 @@ public static function focusFields(int $defaultX = 50, int $defaultY = 50): arra
|
||||
public static function altField(): TextInput
|
||||
{
|
||||
return TextInput::make('alt')
|
||||
->label('Alternativtext des Bildes')
|
||||
->label('Alternativtext (optional)')
|
||||
->maxLength(300)
|
||||
->live(onBlur: true)
|
||||
->helperText('Beschreibt, was auf dem Bild zu sehen ist. Pflicht, sobald ein Bild gewählt ist.');
|
||||
->helperText('Leer lassen, dann gilt der Alternativtext des Mediums aus dem Medienmanager. Nur ausfüllen, wenn das Bild hier etwas anderes aussagen soll.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,10 +127,6 @@ public static function clean(array $data, WidgetErrors $errors, bool $hasImage):
|
||||
$data[$key] = is_numeric($value) ? (int) round(max(0, min(100, (float) $value))) : null;
|
||||
}
|
||||
|
||||
if ($hasImage && $data['alt'] === null) {
|
||||
$errors->add('data.alt', 'Bitte einen Alternativtext für das Bild angeben.');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,20 +2,14 @@
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Support;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Öffentlicher Medienbereich der Website ("cms/"). Nur Dateien aus diesem Bereich dürfen in Widgets
|
||||
* verwendet werden. Geschützte Bibliotheksmedien (Inhaltsdateien, Vorschaubilder) sind hier nie wählbar.
|
||||
* Frühere öffentliche CMS-Bilder („cms/“, Route media.public). Neue Bilder kommen aus dem Medienmanager (WebsiteImage);
|
||||
* dieser Bereich bleibt nur für gespeicherte Revisionen mit früheren Pfaden, die (noch) keinem Medium zugeordnet sind.
|
||||
*/
|
||||
final class PublicMedia
|
||||
{
|
||||
public const PREFIX = 'cms/';
|
||||
|
||||
private const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'avif'];
|
||||
|
||||
public static function isPublicPath(mixed $path): bool
|
||||
{
|
||||
return is_string($path)
|
||||
@@ -29,36 +23,6 @@ public static function url(string $path): string
|
||||
return route('media.public', ['path' => $path]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bereits vorhandene Bilder im öffentlichen Bereich (veröffentlicht oder zur Veröffentlichung vorgemerkt).
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function imageOptions(): array
|
||||
{
|
||||
$options = [];
|
||||
|
||||
foreach (['media_public', 'cms_incoming'] as $disk) {
|
||||
try {
|
||||
$files = Storage::disk($disk)->allFiles(rtrim(self::PREFIX, '/'));
|
||||
} catch (Throwable) {
|
||||
$files = [];
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
|
||||
if (self::isPublicPath($file) && in_array($extension, self::IMAGE_EXTENSIONS, true)) {
|
||||
$options[$file] = substr($file, strlen(self::PREFIX));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ksort($options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pfad aus dem Zustand eines Upload-Felds (Zeichenkette oder Liste).
|
||||
*/
|
||||
@@ -70,31 +34,4 @@ public static function fromUploadState(mixed $state): ?string
|
||||
|
||||
return is_string($state) && $state !== '' ? $state : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bildadresse für Darstellung und Blockvorschau. In der Vorschau kann ein noch nicht gespeicherter Upload vorliegen.
|
||||
*
|
||||
* @param array<string, mixed> $refs
|
||||
*/
|
||||
public static function imageUrl(array $refs, string $key = 'image'): ?string
|
||||
{
|
||||
$upload = $refs['_upload'] ?? null;
|
||||
$upload = is_array($upload) ? (array_values($upload)[0] ?? null) : $upload;
|
||||
|
||||
if ($upload instanceof TemporaryUploadedFile) {
|
||||
try {
|
||||
return $upload->temporaryUrl();
|
||||
} catch (Throwable) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (self::isPublicPath($upload)) {
|
||||
return self::url($upload);
|
||||
}
|
||||
|
||||
$path = $refs[$key] ?? null;
|
||||
|
||||
return self::isPublicPath($path) ? self::url($path) : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Support;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Media\ThumbnailRef;
|
||||
use App\Domain\Media\WebsiteIntake;
|
||||
use App\Domain\Media\WebsiteMedia;
|
||||
use App\Domain\Media\WebsiteMediaAlias;
|
||||
use App\Domain\Media\WebsitePresentation;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Bilder in CMS-Widgets und Abschnittshintergründen aus dem zentralen Medienbestand
|
||||
* (docs/architektur/medienzugriff-fuer-komponenten.md).
|
||||
*
|
||||
* Gespeichert wird im jeweiligen Bildschlüssel (refs.image, style.image, data.items[].image) die Kennung des
|
||||
* Inhaltselements (int). Frühere Werte sind Pfade unter cms/ (string):
|
||||
* - mit wirksamer Zuordnung (WebsiteMediaAlias) gelten sie als das zugeordnete Medium,
|
||||
* - ohne Zuordnung gelten sie weiter als öffentliches CMS-Bild (PublicMedia), bis das Widget umgestellt ist.
|
||||
*
|
||||
* Öffentlich erscheint ein Medium nur über WebsiteMedia (Website-Freigabe, Route website.media). In der
|
||||
* Redaktionsvorschau erscheint ein nicht freigegebenes Bild als Vorschaubild der Bibliothek (Route editorial.card)
|
||||
* mit Hinweis. Eine CMS-Verwendung gibt nichts frei.
|
||||
*
|
||||
* Je Anfrage gebunden (scoped): Ergebnisse werden innerhalb einer Anfrage zwischengespeichert.
|
||||
*/
|
||||
class WebsiteImage
|
||||
{
|
||||
/** @var array<string, int|string|null> */
|
||||
private array $resolved = [];
|
||||
|
||||
/** @var array<int, WebsitePresentation|false> */
|
||||
private array $presentations = [];
|
||||
|
||||
public function __construct(private readonly WebsiteMedia $media) {}
|
||||
|
||||
/**
|
||||
* Gespeicherter oder eingegebener Wert → Kennung (int), früherer Pfad (string) oder null.
|
||||
*/
|
||||
public static function normalize(mixed $value): int|string|null
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$value = array_values($value)[0] ?? null;
|
||||
}
|
||||
|
||||
if (is_int($value) && $value > 0) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_string($value) && preg_match('/^[1-9][0-9]*$/', $value) === 1) {
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
return PublicMedia::isPublicPath($value) ? $value : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kennung des Mediums: gespeicherte Kennung oder wirksam zugeordneter früherer Pfad; sonst null.
|
||||
*/
|
||||
public function elementId(mixed $value): ?int
|
||||
{
|
||||
$value = self::normalize($value);
|
||||
|
||||
if (is_int($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! array_key_exists($value, $this->resolved)) {
|
||||
$this->resolved[$value] = WebsiteMediaAlias::effectiveFor($value)?->content_element_id;
|
||||
}
|
||||
|
||||
$id = $this->resolved[$value];
|
||||
|
||||
return is_int($id) ? $id : null;
|
||||
}
|
||||
|
||||
public function presentation(mixed $value): ?WebsitePresentation
|
||||
{
|
||||
$id = $this->elementId($value);
|
||||
|
||||
if ($id === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! array_key_exists($id, $this->presentations)) {
|
||||
$this->presentations[$id] = $this->media->present($id) ?? false;
|
||||
}
|
||||
|
||||
return $this->presentations[$id] ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bildadresse für die Darstellung. Öffentlich nur freigegebene Medien (oder frühere CMS-Bilder ohne Zuordnung);
|
||||
* in der Redaktionsvorschau zusätzlich das Vorschaubild eines nicht freigegebenen Mediums.
|
||||
*/
|
||||
public function url(mixed $value, bool $preview = false): ?string
|
||||
{
|
||||
$presentation = $this->presentation($value);
|
||||
|
||||
if ($presentation !== null) {
|
||||
return $presentation->kind === 'bild' ? $presentation->url : null;
|
||||
}
|
||||
|
||||
$id = $this->elementId($value);
|
||||
|
||||
if ($id !== null) {
|
||||
if (! $preview) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$element = ContentElement::query()->find($id);
|
||||
|
||||
return $element === null ? null : ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path);
|
||||
}
|
||||
|
||||
$legacy = self::normalize($value);
|
||||
|
||||
return is_string($legacy) ? PublicMedia::url($legacy) : null;
|
||||
}
|
||||
|
||||
/** Alternativtext: Angabe im Widget, sonst der Alternativtext des Mediums. */
|
||||
public function alt(mixed $value, mixed $override = null): string
|
||||
{
|
||||
if (is_string($override) && trim($override) !== '') {
|
||||
return trim($override);
|
||||
}
|
||||
|
||||
return $this->presentation($value)?->alt ?? '';
|
||||
}
|
||||
|
||||
/** Öffentliche Quellenzeile des Mediums (nur solange es freigegeben ist). */
|
||||
public function credit(mixed $value): ?string
|
||||
{
|
||||
return $this->presentation($value)?->credit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hinweis für die Redaktionsvorschau, wenn das gewählte Bild öffentlich nicht erscheint; sonst null.
|
||||
*/
|
||||
public function previewNotice(mixed $value, string $label = 'Das gewählte Bild'): ?string
|
||||
{
|
||||
$status = $this->status($value);
|
||||
|
||||
if ($status === null || $status['public']) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $label.' „'.$status['title'].'“ erscheint öffentlich nicht: '.$status['note'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Zustand für Editor und Vorschau.
|
||||
*
|
||||
* @return array{public: bool, state: string, title: string, note: string, thumb: ?string, manageUrl: ?string}|null
|
||||
*/
|
||||
public function status(mixed $value): ?array
|
||||
{
|
||||
$value = self::normalize($value);
|
||||
|
||||
if ($value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$id = $this->elementId($value);
|
||||
|
||||
if ($id === null) {
|
||||
return [
|
||||
'public' => true,
|
||||
'state' => 'legacy',
|
||||
'title' => basename((string) $value),
|
||||
'note' => 'Früheres CMS-Bild, noch nicht in den Medienmanager übernommen.',
|
||||
'thumb' => PublicMedia::url((string) $value),
|
||||
'manageUrl' => null,
|
||||
];
|
||||
}
|
||||
|
||||
$element = ContentElement::query()->with('editorialContentKind')->find($id);
|
||||
|
||||
if ($element === null) {
|
||||
return ['public' => false, 'state' => 'missing', 'title' => 'Medium '.$id, 'note' => 'Das Medium gibt es nicht mehr.', 'thumb' => null, 'manageUrl' => null];
|
||||
}
|
||||
|
||||
$title = (string) ($element->display_title ?: $element->working_title);
|
||||
$thumb = ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path);
|
||||
$manageUrl = ContentElementResource::getUrl('view', ['record' => $element]);
|
||||
$public = $this->presentation($id) !== null;
|
||||
|
||||
$note = match (true) {
|
||||
$public => 'Für die Website freigegeben.',
|
||||
$element->archived_at !== null => 'Das Medium ist archiviert.',
|
||||
filled($element->thumbnail_error) => 'Die Datei ließ sich nicht verarbeiten: '.Str::limit((string) $element->thumbnail_error, 120),
|
||||
$element->thumbnail_path === null => 'Wird gerade verarbeitet. Danach wird es automatisch für die Website freigegeben.',
|
||||
default => 'Nicht für die Website freigegeben. Die Freigabe steht im Medienmanager beim Medium unter „Beschreibung“ (Website-Freigabe).',
|
||||
};
|
||||
|
||||
return [
|
||||
'public' => $public,
|
||||
'state' => $public ? 'released' : ($element->thumbnail_path === null && ! filled($element->thumbnail_error) ? 'pending' : 'unreleased'),
|
||||
'title' => $title,
|
||||
'note' => $note,
|
||||
'thumb' => $thumb,
|
||||
'manageUrl' => $manageUrl,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüft einen Wert beim Speichern. Ein früherer Pfad mit wirksamer Zuordnung wird zur Kennung des Mediums.
|
||||
*/
|
||||
public function clean(mixed $value, WidgetErrors $errors, string $errorKey): int|string|null
|
||||
{
|
||||
$raw = is_array($value) ? (array_values($value)[0] ?? null) : $value;
|
||||
$value = self::normalize($raw);
|
||||
|
||||
if ($value === null) {
|
||||
if ($raw !== null && $raw !== '') {
|
||||
$errors->add($errorKey, 'Bitte ein Bild aus dem Medienmanager wählen.');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
return $this->elementId($value) ?? $value;
|
||||
}
|
||||
|
||||
$element = ContentElement::query()->find($value);
|
||||
|
||||
if ($element === null || ! self::isSelectable($element)) {
|
||||
$errors->add($errorKey, 'Dieses Medium ist kein Bild für die Website (nur Bilder aus dem Medienmanager, keine Traineranleitungen).');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return $element->id;
|
||||
}
|
||||
|
||||
public static function isSelectable(ContentElement $element): bool
|
||||
{
|
||||
if ($element->output_class !== 'bild' || $element->archived_at !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$slug = $element->editorialContentKind?->slug
|
||||
?? ($element->editorial_content_kind_id !== null ? EditorialContentKind::query()->whereKey($element->editorial_content_kind_id)->value('slug') : null);
|
||||
|
||||
return ! in_array($slug, PublicMaterialReader::CONFIDENTIAL_KINDS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Auswahl für den Medienpicker: Bilder aus dem Medienmanager mit Vorschaubild, Titel und Freigabestatus (HTML).
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function options(?string $search = null, int $limit = 60): array
|
||||
{
|
||||
$search = trim((string) $search);
|
||||
|
||||
$elements = ContentElement::query()
|
||||
->with('editorialContentKind')
|
||||
->where('output_class', 'bild')
|
||||
->whereNull('archived_at')
|
||||
->when($search !== '', function ($query) use ($search): void {
|
||||
$like = '%'.mb_strtolower($search).'%';
|
||||
$query->where(fn ($inner) => $inner
|
||||
->whereRaw('LOWER(working_title) LIKE ?', [$like])
|
||||
->orWhereRaw('LOWER(COALESCE(display_title, \'\')) LIKE ?', [$like]));
|
||||
})
|
||||
->orderByDesc('id')
|
||||
->limit($limit)
|
||||
->get();
|
||||
|
||||
$options = [];
|
||||
foreach ($elements as $element) {
|
||||
if (self::isSelectable($element)) {
|
||||
$options[$element->id] = $this->optionHtml($element->id);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/** HTML-Bezeichnung einer Option oder des gewählten Werts (auch für frühere Pfade). */
|
||||
public function optionHtml(mixed $value): ?string
|
||||
{
|
||||
$status = $this->status($value);
|
||||
|
||||
if ($status === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$badge = match ($status['state']) {
|
||||
'released' => ['ok', 'Website: freigegeben'],
|
||||
'pending' => ['wait', 'Wird verarbeitet'],
|
||||
'legacy' => ['quiet', 'Früheres CMS-Bild'],
|
||||
default => ['warn', 'Website: nicht freigegeben'],
|
||||
};
|
||||
$thumb = $status['thumb'] !== null
|
||||
? '<img src="'.e($status['thumb']).'" alt="" loading="lazy">'
|
||||
: '<span class="luf-media-option-empty" aria-hidden="true"></span>';
|
||||
|
||||
return '<span class="luf-media-option">'.$thumb
|
||||
.'<span class="luf-media-option-text"><strong>'.e($status['title']).'</strong>'
|
||||
.'<span class="luf-media-badge luf-media-badge-'.$badge[0].'">'.e($badge[1]).'</span></span></span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Neues Bild direkt aus dem CMS: Datei in den Eingang legen und über WebsiteIntake als Medium anlegen.
|
||||
* Die Warteschlange leitet das Bild ab und gibt die Ableitung für die Website frei.
|
||||
*/
|
||||
public function accept(TemporaryUploadedFile $file, ?string $alt = null): ?ContentElement
|
||||
{
|
||||
$base = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)) ?: 'bild';
|
||||
$name = $base.'-'.Str::lower(Str::random(6)).'.'.($file->guessExtension() ?: 'jpg');
|
||||
|
||||
try {
|
||||
$path = $file->storeAs('cms', $name, 'cms_incoming');
|
||||
} catch (Throwable $exception) {
|
||||
report($exception);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! is_string($path) || $path === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$actor = auth('staff')->user();
|
||||
|
||||
return app(WebsiteIntake::class)->acceptImage(
|
||||
$path,
|
||||
Str::title(str_replace(['-', '_'], ' ', $base)),
|
||||
null,
|
||||
filled($alt) ? trim((string) $alt) : null,
|
||||
$actor instanceof User ? $actor : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\SafeUrl;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
@@ -84,14 +85,14 @@ public function dataRules(): array
|
||||
'items.*.title' => ['required', 'string', 'max:120'],
|
||||
'items.*.text' => ['nullable', 'string', 'max:500'],
|
||||
'items.*.url' => ['nullable', 'string', 'max:500'],
|
||||
'items.*.image' => ['nullable', 'string', 'max:255'],
|
||||
'items.*.image' => ['nullable'],
|
||||
'items.*._upload' => ['nullable'],
|
||||
];
|
||||
}
|
||||
|
||||
public function dataFields(): array
|
||||
{
|
||||
[$image, $upload] = ImageRefFields::fields('Bild (optional)');
|
||||
[$image, $upload, $status] = ImageRefFields::fields('Bild (optional)');
|
||||
|
||||
return [
|
||||
Repeater::make('items')
|
||||
@@ -106,6 +107,7 @@ public function dataFields(): array
|
||||
->helperText('Seitenpfad wie /praevention oder eine http(s)-Adresse. Leer lassen für eine Karte ohne Link.'),
|
||||
$image,
|
||||
$upload,
|
||||
$status,
|
||||
])
|
||||
->minItems(1)
|
||||
->maxItems(12)
|
||||
@@ -139,7 +141,9 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$images = app(WebsiteImage::class);
|
||||
$items = [];
|
||||
$notices = [];
|
||||
|
||||
foreach ($widget['data']['items'] ?? [] as $item) {
|
||||
if (! is_array($item) || ! filled($item['title'] ?? null)) {
|
||||
@@ -150,11 +154,15 @@ public function resolve(array $widget, RenderContext $context): array
|
||||
'title' => $item['title'],
|
||||
'text' => $item['text'] ?? null,
|
||||
'url' => SafeUrl::isSafe($item['url'] ?? null) ? $item['url'] : null,
|
||||
'imageUrl' => PublicMedia::imageUrl($item),
|
||||
'imageUrl' => $images->url($item['image'] ?? null, $context->preview),
|
||||
];
|
||||
|
||||
if ($context->preview && ($notice = $images->previewNotice($item['image'] ?? null, 'Das Bild der Karte „'.$item['title'].'“')) !== null) {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
}
|
||||
|
||||
return ['items' => $items];
|
||||
return ['items' => $items, 'imageNotice' => $notices === [] ? null : implode(' ', $notices)];
|
||||
}
|
||||
|
||||
public function mediaPaths(array $widget): array
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
@@ -202,8 +203,13 @@ public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$actions = PremiumFields::actions($widget['data']);
|
||||
|
||||
$images = app(WebsiteImage::class);
|
||||
$image = $widget['refs']['image'] ?? null;
|
||||
|
||||
return [
|
||||
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||
'imageUrl' => $images->url($image, $context->preview),
|
||||
'imageAlt' => $images->alt($image, $widget['data']['alt'] ?? null),
|
||||
'imageNotice' => $context->preview ? $images->previewNotice($image) : null,
|
||||
'actions' => $actions,
|
||||
'action' => $actions[0] ?? null,
|
||||
'focus' => PremiumFields::focus($widget['data'], 68, 50),
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\RichText;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
@@ -229,8 +230,13 @@ public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$surface = $widget['settings']['surface'] ?? 'cream';
|
||||
|
||||
$images = app(WebsiteImage::class);
|
||||
$image = $widget['refs']['image'] ?? null;
|
||||
|
||||
return [
|
||||
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||
'imageUrl' => $images->url($image, $context->preview),
|
||||
'imageAlt' => $images->alt($image, $widget['data']['alt'] ?? null),
|
||||
'imageNotice' => $context->preview ? $images->previewNotice($image) : null,
|
||||
'body' => RichText::sanitize(is_string($widget['data']['body'] ?? null) ? $widget['data']['body'] : ''),
|
||||
'actions' => PremiumFields::actions($widget['data']),
|
||||
'focus' => PremiumFields::focus($widget['data'], 64, 43),
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Medien- und Materialkarte (Kit v1.7 „media“): ein Inhaltselement mit Anzeigetitel, Kurzbeschreibung, Inhaltsart und
|
||||
* Ausgabeart. Filme erscheinen als Medienkarte (grüne Aktion, Filmtafel ohne freigegebenes Bild), Dokumente und andere
|
||||
* Materialien als Materialkarte (Materialsymbol). Öffentlich nur nach den Regeln von PublicMaterialReader; die Aktion
|
||||
* führt auf die öffentliche Programmseite. Die Karte spielt nichts ab, bietet keinen Download und gibt kein Medium frei.
|
||||
*/
|
||||
class MediaCardWidget extends PremiumCardWidget
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'media_card';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Medien- und Materialkarte';
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Karte zu einem Film oder Material aus der Bibliothek; Titel und Art kommen aus den Fachdaten, kein Abspielen, kein Download.';
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return 'heroicon-o-film';
|
||||
}
|
||||
|
||||
public function schematic(): array
|
||||
{
|
||||
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'image'], [7, 7, 8, 3, 'accent'], [31, 8, 22, 4, 'ink'], [31, 15, 22, 5, 'line'], [31, 25, 14, 5, 'accent']];
|
||||
}
|
||||
|
||||
protected function refKey(): string
|
||||
{
|
||||
return 'element';
|
||||
}
|
||||
|
||||
protected function refLabel(): string
|
||||
{
|
||||
return 'Medium oder Material';
|
||||
}
|
||||
|
||||
protected function refHelp(): string
|
||||
{
|
||||
return 'Wählbar sind alle nicht archivierten, nicht gesperrten Filme und Materialien. Öffentlich erscheint die Karte nur mit bereitgestellter Fassung und wenn der Inhalt zu einem öffentlich gezeigten Programm gehört; Traineranleitungen nie. Titel und Kurzbeschreibung pflegen Sie im Medium.';
|
||||
}
|
||||
|
||||
protected function searchSubjects(?string $term): array
|
||||
{
|
||||
return app(PublicMaterialReader::class)->search($term);
|
||||
}
|
||||
|
||||
protected function subjectLabel(mixed $id): ?string
|
||||
{
|
||||
return app(PublicMaterialReader::class)->labelFor($id);
|
||||
}
|
||||
|
||||
protected function rejectSubject(int $id): ?string
|
||||
{
|
||||
$element = ContentElement::query()->find($id);
|
||||
|
||||
return $element !== null && app(PublicMaterialReader::class)->isSelectable($element)
|
||||
? null
|
||||
: 'Dieser Inhalt ist archiviert oder gesperrt.';
|
||||
}
|
||||
|
||||
protected function subject(mixed $id, RenderContext $context): ?CardSubject
|
||||
{
|
||||
return app(PublicMaterialReader::class)->subject($id, includeNonPublic: $context->preview);
|
||||
}
|
||||
|
||||
protected function defaultActionLabel(): string
|
||||
{
|
||||
return 'Im Programm ansehen';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Catalog\CardSubject;
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Group;
|
||||
|
||||
/**
|
||||
* Gemeinsame Basis der Premium-Karten (Brand-UI-Kit v1.7, Entwurf zur visuellen Freigabe):
|
||||
* Redaktionelle Themenkarte, Medien- und Materialkarte, Modul- und Programmkarte.
|
||||
*
|
||||
* - Eine Karte je Widget, ein Widget je Platz. Das Raster ist das bestehende Abschnittsraster (1 bis 4 Einheiten);
|
||||
* es gibt kein zweites Kartenraster.
|
||||
* - refs: genau ein Fachobjekt (Kennung) und optional ein Bild aus dem öffentlichen Website-Bereich.
|
||||
* Titel, Kurzbeschreibung, Art, Zusatzangaben und Linkziel kommen zur Laufzeit aus den Fachdaten.
|
||||
* - data: nur Redaktionelles, das es im Fachobjekt nicht gibt: Beschriftung der Aktion, Hinweis, Alternativtext,
|
||||
* Bildausschnitt. Ein freies Linkziel gibt es nicht; das Ziel ist immer die öffentliche Seite des Fachobjekts.
|
||||
* - Bilder der Bibliothek (Vorschaubilder, Filmstandbilder) werden nie gezeigt.
|
||||
*/
|
||||
abstract class PremiumCardWidget extends WidgetType
|
||||
{
|
||||
public const SHOW = ['yes' => 'Anzeigen', 'no' => 'Ausblenden'];
|
||||
|
||||
/** Schlüssel des Fachobjekts in refs, zum Beispiel 'pillar'. */
|
||||
abstract protected function refKey(): string;
|
||||
|
||||
abstract protected function refLabel(): string;
|
||||
|
||||
abstract protected function refHelp(): string;
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
abstract protected function searchSubjects(?string $term): array;
|
||||
|
||||
abstract protected function subjectLabel(mixed $id): ?string;
|
||||
|
||||
/** Prüft beim Speichern, ob das Objekt gewählt werden darf; liefert sonst die Fehlermeldung. */
|
||||
abstract protected function rejectSubject(int $id): ?string;
|
||||
|
||||
abstract protected function subject(mixed $id, RenderContext $context): ?CardSubject;
|
||||
|
||||
abstract protected function defaultActionLabel(): string;
|
||||
|
||||
/** Gestaltungsvariante des Kits: editorial, media oder catalog. */
|
||||
abstract protected function cardStyle(): string;
|
||||
|
||||
public function view(): string
|
||||
{
|
||||
return 'widgets.premium_card';
|
||||
}
|
||||
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return [1, 2, 3, 4];
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function stages(): array
|
||||
{
|
||||
return [
|
||||
'stacked' => 'unter 520 px Kartenbreite: Bild oder Tafel über dem Text',
|
||||
'side' => 'ab 520 px: Bild links (42 %), Text rechts (58 %); das gewählte Bildformat bleibt erhalten',
|
||||
];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Unter 520 px Kartenbreite steht das Bild über dem Text. Ab etwa 240 px nutzbar, empfohlen ab 280 px (eine Einheit ab Tablet). Texte werden nie gekürzt.';
|
||||
}
|
||||
|
||||
public function heights(): array
|
||||
{
|
||||
return [
|
||||
'auto' => 'Natürliche Höhe',
|
||||
'fill' => 'An die Zeile angleichen',
|
||||
];
|
||||
}
|
||||
|
||||
public function variants(): array
|
||||
{
|
||||
return [
|
||||
'adaptive' => 'Anpassend (ab 520 px Bild neben Text)',
|
||||
'stacked' => 'Bild immer über dem Text',
|
||||
];
|
||||
}
|
||||
|
||||
public function optionIcons(): array
|
||||
{
|
||||
return [
|
||||
'variant' => ['adaptive' => 'heroicon-o-view-columns', 'stacked' => 'heroicon-o-bars-3-bottom-left'],
|
||||
'height' => ['auto' => 'heroicon-o-arrows-pointing-in', 'fill' => 'heroicon-o-arrows-up-down'],
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'format' => ['landscape' => 'Querformat 16:9', 'square' => 'Quadrat 1:1', 'portrait' => 'Hochformat 3:4'],
|
||||
'fit' => ['cover' => 'Ausschnitt füllt die Fläche', 'contain' => 'Ganzes Bild zeigen (Dokument, Poster)'],
|
||||
'heading_level' => ['h3' => 'H3', 'h2' => 'H2', 'h4' => 'H4'],
|
||||
'show_summary' => self::SHOW,
|
||||
'show_kind' => self::SHOW,
|
||||
'show_meta' => self::SHOW,
|
||||
'show_action' => self::SHOW,
|
||||
];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'format' => ['Bildformat', 'Vorgabe: Querformat 16:9. Gilt auch neben dem Text; das Motiv wird nicht nachträglich hochkant beschnitten.'],
|
||||
'fit' => ['Bilddarstellung', 'Vorgabe: Ausschnitt. „Ganzes Bild“ zeigt Dokumente und Poster vollständig auf ruhiger Fläche.'],
|
||||
'heading_level' => ['Überschriftenebene', 'Vorgabe: H3, passend unter einer Abschnittsüberschrift (H2).'],
|
||||
'show_summary' => ['Kurzbeschreibung', 'Aus den Fachdaten. Vorgabe: anzeigen.'],
|
||||
'show_kind' => ['Art oder Label', 'Zum Beispiel „Thema“ oder „Merkblatt“. Vorgabe: anzeigen.'],
|
||||
'show_meta' => ['Zusatzangaben', 'Aus den Fachdaten, zum Beispiel Ausgabeart oder Programmzugehörigkeit. Vorgabe: anzeigen.'],
|
||||
'show_action' => ['Aktion', 'Verweis auf die öffentliche Seite des Fachobjekts, falls es eine gibt. Vorgabe: anzeigen.'],
|
||||
];
|
||||
}
|
||||
|
||||
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'],
|
||||
];
|
||||
}
|
||||
|
||||
public function refRules(): array
|
||||
{
|
||||
return [$this->refKey() => ['required', 'integer']] + ImageRefFields::rules();
|
||||
}
|
||||
|
||||
public function dataFields(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('action_label')
|
||||
->label('Beschriftung der Aktion (optional)')
|
||||
->maxLength(60)
|
||||
->placeholder($this->defaultActionLabel())
|
||||
->live(onBlur: true)
|
||||
->helperText('Das Linkziel ist immer die öffentliche Seite des gewählten Objekts und kann nicht frei gesetzt werden.'),
|
||||
TextInput::make('note')
|
||||
->label('Hinweis (optional)')
|
||||
->maxLength(200)
|
||||
->live(onBlur: true)
|
||||
->helperText('Kurzer redaktioneller Satz über der Aktion, zum Beispiel „Für die nächste Kursstunde“. Begründet keine Berechtigung.'),
|
||||
PremiumFields::altField(),
|
||||
...PremiumFields::focusFields(66, 45),
|
||||
];
|
||||
}
|
||||
|
||||
public function refFields(): array
|
||||
{
|
||||
return [$this->subjectField(), ...ImageRefFields::fields(live: true)];
|
||||
}
|
||||
|
||||
public function editorSchema(): array
|
||||
{
|
||||
[$action, $note] = $this->dataFields();
|
||||
|
||||
return [
|
||||
Group::make([$this->subjectField()])->statePath('refs'),
|
||||
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'),
|
||||
];
|
||||
}
|
||||
|
||||
public function mediaSchema(): array
|
||||
{
|
||||
[, , $alt, $focusX, $focusY] = $this->dataFields();
|
||||
|
||||
return [
|
||||
Group::make(ImageRefFields::fields('Kartenbild', live: true))->statePath('refs'),
|
||||
Group::make([$alt, $focusX, $focusY])->statePath('data'),
|
||||
];
|
||||
}
|
||||
|
||||
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
{
|
||||
$key = $this->refKey();
|
||||
$id = (int) $refs[$key];
|
||||
$rejection = $this->rejectSubject($id);
|
||||
|
||||
if ($rejection !== null) {
|
||||
$errors->add("refs.$key", $rejection);
|
||||
}
|
||||
|
||||
$refs[$key] = $id;
|
||||
$refs = ImageRefFields::clean($refs, $errors);
|
||||
|
||||
foreach (['action_label', 'note', 'alt', 'heading', 'summary'] as $field) {
|
||||
$data[$field] = filled($data[$field] ?? null) ? trim((string) $data[$field]) : null;
|
||||
}
|
||||
|
||||
foreach (['focus_x', 'focus_y'] as $field) {
|
||||
$value = $data[$field] ?? null;
|
||||
$data[$field] = is_numeric($value) ? (int) round(max(0, min(100, (float) $value))) : null;
|
||||
}
|
||||
|
||||
return [$data, $refs];
|
||||
}
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$settings = $widget['settings'];
|
||||
$option = fn (string $key, string $default): string => is_string($settings[$key] ?? null) && isset($this->settingOptions()[$key][$settings[$key]]) ? $settings[$key] : $default;
|
||||
$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($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'),
|
||||
'headingTag' => $option('heading_level', 'h3'),
|
||||
'show' => [
|
||||
'summary' => ! array_key_exists('show_summary', $this->settings()) || $option('show_summary', 'yes') === 'yes',
|
||||
'kind' => ! array_key_exists('show_kind', $this->settings()) || $option('show_kind', 'yes') === 'yes',
|
||||
'meta' => $option('show_meta', 'yes') === 'yes',
|
||||
'action' => $option('show_action', 'yes') === 'yes',
|
||||
],
|
||||
'actionLabel' => filled($data['action_label'] ?? null) ? (string) $data['action_label'] : $this->defaultActionLabel(),
|
||||
'note' => filled($data['note'] ?? null) ? (string) $data['note'] : null,
|
||||
'stacked' => $widget['variant'] === 'stacked',
|
||||
];
|
||||
}
|
||||
|
||||
public function mediaPaths(array $widget): array
|
||||
{
|
||||
$image = $widget['refs']['image'] ?? null;
|
||||
|
||||
return PublicMedia::isPublicPath($image) ? [$image] : [];
|
||||
}
|
||||
|
||||
public function summary(array $widget): string
|
||||
{
|
||||
$label = $this->subjectLabel($widget['refs'][$this->refKey()] ?? null);
|
||||
|
||||
return $label ?? 'Kein Objekt gewählt';
|
||||
}
|
||||
|
||||
protected function centralCoverId(mixed $id): ?int
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private function subjectField(): Select
|
||||
{
|
||||
return Select::make($this->refKey())
|
||||
->label($this->refLabel())
|
||||
->helperText($this->refHelp())
|
||||
->required()
|
||||
->live()
|
||||
->searchable()
|
||||
->getSearchResultsUsing(fn (?string $search): array => $this->searchSubjects($search))
|
||||
->getOptionLabelUsing(fn (mixed $value): ?string => $this->subjectLabel($value))
|
||||
->options(fn (): array => $this->searchSubjects(null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Modul- und Programmkarte (Kit v1.7 „catalog“): ein Programm oder Modul über PublicCatalogReader, dieselbe
|
||||
* Freigaberegel wie die Programm- und Modulkarten (Programme öffentlich mit Programmseite, Module nur in der
|
||||
* Redaktionsvorschau). Die Art ist immer sichtbar benannt. Ohne Bild trägt eine Navy-Tafel die Art.
|
||||
* Kein Preis, kein Angebot, keine Kaufaktion; eine Karte ist kein Lizenzartikel.
|
||||
*/
|
||||
class ProgramCardWidget extends PremiumCardWidget
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'program_card';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Programm- oder Modulkarte';
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Karte zu einem Programm oder Modul; Titel, Beschreibung und Art kommen aus den Fachdaten, ohne Preis und ohne Kaufaktion.';
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return 'heroicon-o-academic-cap';
|
||||
}
|
||||
|
||||
public function schematic(): array
|
||||
{
|
||||
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'ink'], [8, 24, 10, 2, 'accent'], [31, 8, 10, 2, 'line'], [31, 13, 22, 4, 'ink'], [31, 25, 14, 5, 'ink']];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
// Die Art (Programm oder Modul) bleibt immer sichtbar; sie lässt sich nicht ausblenden.
|
||||
$settings = parent::settings();
|
||||
unset($settings['show_kind']);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
protected function refKey(): string
|
||||
{
|
||||
return 'composition';
|
||||
}
|
||||
|
||||
protected function refLabel(): string
|
||||
{
|
||||
return 'Programm oder Modul';
|
||||
}
|
||||
|
||||
protected function refHelp(): string
|
||||
{
|
||||
return 'Wählbar sind Programme und Module mit bereitgestellter Fassung. Öffentlich erscheinen nur Programme mit Anzeigefreigabe (mit Programmseite); Module haben keine öffentliche Seite und erscheinen nur in der Redaktionsvorschau.';
|
||||
}
|
||||
|
||||
protected function searchSubjects(?string $term): array
|
||||
{
|
||||
return app(PublicCatalogReader::class)->cardSearch($term);
|
||||
}
|
||||
|
||||
protected function subjectLabel(mixed $id): ?string
|
||||
{
|
||||
return app(PublicCatalogReader::class)->cardLabelFor($id);
|
||||
}
|
||||
|
||||
protected function rejectSubject(int $id): ?string
|
||||
{
|
||||
$composition = Composition::query()->with('editorialContentKind')->find($id);
|
||||
|
||||
return $composition !== null && app(PublicCatalogReader::class)->isCardSelectable($composition)
|
||||
? null
|
||||
: 'Dieses Objekt ist kein Programm oder Modul mit bereitgestellter Fassung.';
|
||||
}
|
||||
|
||||
protected function subject(mixed $id, RenderContext $context): ?CardSubject
|
||||
{
|
||||
return app(PublicCatalogReader::class)->subject($id, includeNonPublic: $context->preview);
|
||||
}
|
||||
|
||||
protected function defaultActionLabel(): string
|
||||
{
|
||||
return 'Programm ansehen';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Cms\Catalog\CardSubject;
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
|
||||
/**
|
||||
* Redaktionelle Themenkarte (Kit v1.7 „editorial“): ein Thema (fachliche Säule) mit Name, Text für die Website und
|
||||
* Verweis auf die Themenseite /themen/{slug}. Ruhige Textaktion mit gelber Unterstreichung. Wählbar sind alle Säulen;
|
||||
* ein nicht veröffentlichtes Thema erscheint nur in der Redaktionsvorschau, öffentlich nicht.
|
||||
*/
|
||||
class TopicCardWidget extends PremiumCardWidget
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'topic_card';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Themenkarte';
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Redaktionelle Karte zu einem veröffentlichten Thema; Name, Kurzbeschreibung und Ziel kommen aus dem Thema.';
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return 'heroicon-o-bookmark-square';
|
||||
}
|
||||
|
||||
public function schematic(): array
|
||||
{
|
||||
return [[2, 2, 56, 32, 'line'], [5, 5, 22, 26, 'image'], [31, 8, 10, 2, 'accent'], [31, 13, 22, 4, 'ink'], [31, 20, 20, 3, 'line'], [31, 27, 12, 2, 'accent']];
|
||||
}
|
||||
|
||||
protected function refKey(): string
|
||||
{
|
||||
return 'pillar';
|
||||
}
|
||||
|
||||
protected function refLabel(): string
|
||||
{
|
||||
return 'Thema';
|
||||
}
|
||||
|
||||
protected function refHelp(): string
|
||||
{
|
||||
return 'Alle fachlichen Säulen sind wählbar. Öffentlich erscheint die Karte nur, wenn das Thema veröffentlicht ist; Name und Text pflegen Sie unter „Fachliche Säulen“, nicht hier.';
|
||||
}
|
||||
|
||||
protected function searchSubjects(?string $term): array
|
||||
{
|
||||
$term = trim((string) $term);
|
||||
|
||||
return Pillar::query()
|
||||
->orderBy('sort_order')
|
||||
->orderBy('name')
|
||||
->when($term !== '', fn ($query) => $query->whereRaw('LOWER(name) LIKE ?', ['%'.mb_strtolower($term).'%']))
|
||||
->limit(50)
|
||||
->get()
|
||||
->mapWithKeys(fn (Pillar $pillar): array => [$pillar->id => $this->optionLabel($pillar)])
|
||||
->all();
|
||||
}
|
||||
|
||||
protected function subjectLabel(mixed $id): ?string
|
||||
{
|
||||
$pillar = is_numeric($id) ? Pillar::query()->find((int) $id) : null;
|
||||
|
||||
return $pillar === null ? null : $this->optionLabel($pillar);
|
||||
}
|
||||
|
||||
protected function rejectSubject(int $id): ?string
|
||||
{
|
||||
return Pillar::query()->whereKey($id)->exists() ? null : 'Dieses Thema gibt es nicht.';
|
||||
}
|
||||
|
||||
protected function subject(mixed $id, RenderContext $context): ?CardSubject
|
||||
{
|
||||
$pillar = is_numeric($id) ? Pillar::query()->find((int) $id) : null;
|
||||
|
||||
if ($pillar === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$public = self::isPublic($pillar);
|
||||
|
||||
if (! $public && ! $context->preview) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$summary = filled($pillar->public_summary) ? trim((string) $pillar->public_summary) : null;
|
||||
$pages = $pillar->pages()->whereNotNull('published_revision_id')->count();
|
||||
$missing = [];
|
||||
|
||||
if ($summary === null) {
|
||||
$missing[] = 'Kein Text für die Website gepflegt (Fachliche Säulen → Text für die Website).';
|
||||
}
|
||||
|
||||
return new CardSubject(
|
||||
title: (string) $pillar->name,
|
||||
summary: $summary,
|
||||
kind: 'Thema',
|
||||
badge: null,
|
||||
meta: $pages > 0 ? [$pages === 1 ? '1 Seite zum Thema' : $pages.' Seiten zum Thema'] : [],
|
||||
url: $public ? $pillar->publicUrl() : null,
|
||||
public: $public,
|
||||
notice: $public ? null : 'Nur in der Redaktionsvorschau sichtbar: Das Thema ist nicht veröffentlicht (Fachliche Säulen → Öffentliche Adresse und „Auf der Website veröffentlichen“).',
|
||||
missing: $missing,
|
||||
);
|
||||
}
|
||||
|
||||
/** Öffentlich ist ein Thema mit Veröffentlichung und öffentlicher Adresse (dieselbe Regel wie /themen). */
|
||||
public static function isPublic(Pillar $pillar): bool
|
||||
{
|
||||
return $pillar->published_at !== null && filled($pillar->slug);
|
||||
}
|
||||
|
||||
private function optionLabel(Pillar $pillar): string
|
||||
{
|
||||
return $pillar->name.' · Thema · '.(self::isPublic($pillar) ? 'veröffentlicht' : 'nicht veröffentlicht, nur Redaktionsvorschau');
|
||||
}
|
||||
|
||||
protected function defaultActionLabel(): string
|
||||
{
|
||||
return 'Thema entdecken';
|
||||
}
|
||||
|
||||
protected function cardStyle(): string
|
||||
{
|
||||
return 'editorial';
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,18 @@ public function forElementUpload(ContentElement $element, string $incoming): voi
|
||||
$this->rememberElement($element, 'eigen');
|
||||
}
|
||||
|
||||
public function forWebsiteImage(ContentElement $element, string $incoming): void
|
||||
{
|
||||
if ($element->output_class !== 'bild' || ! $this->incomingIsSafe($incoming)) {
|
||||
$this->fail($element, 'Das Bild für die Website wurde nicht übernommen.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->still($element, Storage::disk('cms_incoming'), $incoming, 'element-'.$element->id);
|
||||
$this->rememberElement($element, 'eigen');
|
||||
}
|
||||
|
||||
public function forElementFrame(ContentElement $element, ContentElementVersion $version, float $seconds): void
|
||||
{
|
||||
if ($version->content_element_id !== $element->id || $element->output_class !== 'film') {
|
||||
@@ -201,6 +213,14 @@ private function readableDerived(mixed $path, string $prefix): bool
|
||||
return Storage::disk('media_derived')->exists($path);
|
||||
}
|
||||
|
||||
private function incomingIsSafe(string $incoming): bool
|
||||
{
|
||||
return (str_starts_with($incoming, 'cms/') || str_starts_with($incoming, 'vorschau/'))
|
||||
&& ! str_contains($incoming, '..')
|
||||
&& preg_match('#^(cms|vorschau)/[A-Za-z0-9._\-/]+$#', $incoming) === 1
|
||||
&& Storage::disk('cms_incoming')->exists($incoming);
|
||||
}
|
||||
|
||||
private function secondText(float $seconds): string
|
||||
{
|
||||
$seconds = max(0, min(7200, $seconds));
|
||||
@@ -271,9 +291,15 @@ private function still(ContentElement|Composition $subject, Filesystem $disk, st
|
||||
|
||||
$width = imagesx($image);
|
||||
$height = imagesy($image);
|
||||
$targetWidth = 640;
|
||||
// Bilder (Ausgabeart „bild“) dienen auch als Website-Ableitung für Einstieg und Hintergrund. 640 px wären dort
|
||||
// sichtbar unscharf; deshalb bis 2400 px, nie vergrößert. Filmstandbilder und Modulvorschauen bleiben bei 640 px.
|
||||
$targetWidth = $subject instanceof ContentElement && $subject->output_class === 'bild'
|
||||
? max(1, min(2400, $width))
|
||||
: 640;
|
||||
$targetHeight = (int) max(1, round($height * ($targetWidth / max(1, $width))));
|
||||
$canvas = imagecreatetruecolor($targetWidth, $targetHeight);
|
||||
// Transparente Flächen (PNG, GIF) werden im JPEG weiß statt schwarz.
|
||||
imagefill($canvas, 0, 0, (int) imagecolorallocate($canvas, 255, 255, 255));
|
||||
imagecopyresampled($canvas, $image, 0, 0, 0, 0, $targetWidth, $targetHeight, $width, $height);
|
||||
ob_start();
|
||||
imagejpeg($canvas, null, 82);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\DomainRuleException;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
use App\Jobs\AcceptWebsiteImage;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Nimmt ein neues Website-Bild in den Medienmanager auf.
|
||||
* Die Warteschlange erzeugt danach die Ableitung und gibt sie frei.
|
||||
*/
|
||||
class WebsiteIntake
|
||||
{
|
||||
public function acceptImage(
|
||||
string $incomingPath,
|
||||
string $title,
|
||||
?string $credit = null,
|
||||
?string $alt = null,
|
||||
?User $actor = null,
|
||||
): ContentElement {
|
||||
$title = trim($title);
|
||||
|
||||
if ($title === '') {
|
||||
throw new DomainRuleException('Der Titel fehlt.');
|
||||
}
|
||||
|
||||
if (! $this->incomingIsReadable($incomingPath)) {
|
||||
throw new DomainRuleException('Die Bilddatei liegt nicht im Eingang.');
|
||||
}
|
||||
|
||||
$element = app(ContentService::class)->createElement('bild', 'bild', $title);
|
||||
app(IdentityProfile::class)->fill($element, [
|
||||
'display_title' => $title,
|
||||
'website_credit' => $credit,
|
||||
'website_alt' => $alt,
|
||||
], $actor);
|
||||
AcceptWebsiteImage::dispatch($element->id, $incomingPath, $actor?->id);
|
||||
|
||||
return $element->fresh();
|
||||
}
|
||||
|
||||
private function incomingIsReadable(string $path): bool
|
||||
{
|
||||
return (str_starts_with($path, 'cms/') || str_starts_with($path, 'vorschau/'))
|
||||
&& ! str_contains($path, '..')
|
||||
&& preg_match('#^(cms|vorschau)/[A-Za-z0-9._\-/]+$#', $path) === 1
|
||||
&& Storage::disk('cms_incoming')->exists($path);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Lesesicht für Hero, Teaser und Slideshow.
|
||||
* Liefert nur eine freigegebene öffentliche Ableitung, sonst nichts.
|
||||
*/
|
||||
class WebsiteMedia
|
||||
{
|
||||
public function present(ContentElement|int $element): ?WebsitePresentation
|
||||
{
|
||||
$element = $element instanceof ContentElement
|
||||
? $element
|
||||
: ContentElement::query()->find($element);
|
||||
|
||||
if (! $element instanceof ContentElement || $element->website_released_at === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$path = $element->website_public_path;
|
||||
$expected = '#^website/'.$element->id.'/datei\.[a-z0-9]+$#';
|
||||
|
||||
if (! is_string($path) || preg_match($expected, $path) !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! Storage::disk('media_public')->exists($path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$title = trim((string) ($element->display_title ?: $element->working_title));
|
||||
$alt = trim((string) ($element->website_alt ?? ''));
|
||||
|
||||
return new WebsitePresentation(
|
||||
elementId: $element->id,
|
||||
title: $title,
|
||||
alt: $alt !== '' ? $alt : $title,
|
||||
credit: filled($element->website_credit) ? trim((string) $element->website_credit) : null,
|
||||
kind: match ($element->output_class) {
|
||||
'film' => 'film',
|
||||
'audio' => 'audio',
|
||||
default => 'bild',
|
||||
},
|
||||
url: route('website.media', $element),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Slideshow: freigegebene Medien in der angegebenen Reihenfolge. Nicht freigegebene Einträge entfallen.
|
||||
*
|
||||
* @param list<int|string> $ids
|
||||
* @return list<WebsitePresentation>
|
||||
*/
|
||||
public function presentMany(array $ids): array
|
||||
{
|
||||
$presentations = [];
|
||||
|
||||
foreach ($ids as $id) {
|
||||
if (! is_numeric($id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$presentation = $this->present((int) $id);
|
||||
|
||||
if ($presentation !== null) {
|
||||
$presentations[] = $presentation;
|
||||
}
|
||||
}
|
||||
|
||||
return $presentations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\IdentityChange;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Früherer CMS-Bildpfad (cms/…), der in den Medienmanager übernommen wurde.
|
||||
*
|
||||
* Wirksam ist die Zuordnung erst, wenn das Medium mindestens einmal für die Website freigegeben war. Bis dahin
|
||||
* (Ableitung läuft noch oder ist fehlgeschlagen) bleibt der frühere Pfad gültig, damit keine Seite ihr Bild verliert.
|
||||
* Danach entscheidet allein die Website-Freigabe des Mediums, auch über die frühere Adresse /medien/cms/….
|
||||
*/
|
||||
class WebsiteMediaAlias extends Model
|
||||
{
|
||||
protected $fillable = ['legacy_path', 'content_element_id', 'sha256'];
|
||||
|
||||
public function element(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ContentElement::class, 'content_element_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wirksame Zuordnung für einen früheren Pfad, sonst null. Zwischengespeichert wird im Aufrufer (WebsiteImage, je Anfrage).
|
||||
*/
|
||||
public static function effectiveFor(mixed $path): ?self
|
||||
{
|
||||
if (! is_string($path) || $path === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$alias = self::query()->with('element')->where('legacy_path', $path)->first();
|
||||
|
||||
return $alias instanceof self && $alias->everReleased() ? $alias : null;
|
||||
}
|
||||
|
||||
public function everReleased(): bool
|
||||
{
|
||||
$element = $this->element;
|
||||
|
||||
if ($element === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($element->website_released_at !== null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return IdentityChange::query()
|
||||
->where('subject_type', $element->getMorphClass())
|
||||
->where('subject_id', $element->id)
|
||||
->where('field', 'website_released_at')
|
||||
->whereNotNull('after')
|
||||
->exists();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
/**
|
||||
* Öffentliche Ableitung eines für die Website freigegebenen Mediums.
|
||||
* Enthält keine internen Vermerke und keine Adresse einer Bestandsdatei.
|
||||
*/
|
||||
final class WebsitePresentation
|
||||
{
|
||||
public function __construct(
|
||||
public readonly int $elementId,
|
||||
public readonly string $title,
|
||||
public readonly string $alt,
|
||||
public readonly ?string $credit,
|
||||
public readonly string $kind,
|
||||
public readonly string $url,
|
||||
) {}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Media;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Jobs\PublishWebsiteMedia;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Gibt eine Ableitung für die Website frei oder nimmt sie zurück.
|
||||
* Legt keinen Lizenzartikel an und ruft DecideAccess nicht auf.
|
||||
* Der Web-Prozess schreibt die öffentliche Datei nicht selbst; das tut die Warteschlange.
|
||||
*/
|
||||
class WebsiteRelease
|
||||
{
|
||||
public function release(ContentElement $element, ?User $actor = null): string
|
||||
{
|
||||
$refusal = $this->refusal($element);
|
||||
|
||||
if ($refusal !== null) {
|
||||
return $refusal;
|
||||
}
|
||||
|
||||
PublishWebsiteMedia::dispatch($element->id, 'release', $actor?->id);
|
||||
|
||||
return 'Für die Website freigegeben. Öffentliche Seiten lesen nur diese Ableitung.';
|
||||
}
|
||||
|
||||
public function withdraw(ContentElement $element, ?User $actor = null): string
|
||||
{
|
||||
PublishWebsiteMedia::dispatch($element->id, 'withdraw', $actor?->id);
|
||||
|
||||
return 'Die Website-Freigabe ist zurückgenommen.';
|
||||
}
|
||||
|
||||
public function refusal(ContentElement $element): ?string
|
||||
{
|
||||
if ($this->isConfidential($element)) {
|
||||
return 'Traineranleitungen werden nicht für die Website freigegeben.';
|
||||
}
|
||||
|
||||
if ($this->derivedPath($element) === null) {
|
||||
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;
|
||||
}
|
||||
|
||||
public function derivedPath(ContentElement $element): ?string
|
||||
{
|
||||
if ($this->isConfidential($element)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($element->output_class === 'bild') {
|
||||
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') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$version = $element->versions()
|
||||
->where('status', ContentVersionStatus::Bereit->value)
|
||||
->orderByDesc('number')
|
||||
->first();
|
||||
|
||||
if ($version === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$path = MediaRendition::query()
|
||||
->where('content_element_version_id', $version->id)
|
||||
->where('role', 'preview')
|
||||
->orderByDesc('id')
|
||||
->value('path');
|
||||
|
||||
return $this->allowedDerivedPath($path, 'teaser/', ['mp4', 'webm']);
|
||||
}
|
||||
|
||||
public function publicPath(ContentElement $element, string $derivedPath): string
|
||||
{
|
||||
$extension = strtolower(pathinfo($derivedPath, PATHINFO_EXTENSION));
|
||||
|
||||
return 'website/'.$element->id.'/datei.'.$extension;
|
||||
}
|
||||
|
||||
private function isConfidential(ContentElement $element): bool
|
||||
{
|
||||
$slug = $element->editorialContentKind?->slug;
|
||||
|
||||
if ($slug === null && $element->editorial_content_kind_id !== null) {
|
||||
$slug = EditorialContentKind::query()->whereKey($element->editorial_content_kind_id)->value('slug');
|
||||
}
|
||||
|
||||
return in_array($slug, PublicMaterialReader::CONFIDENTIAL_KINDS, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
|
||||
|
||||
if (! in_array($extension, $extensions, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! Storage::disk('media_derived')->exists($path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,15 @@
|
||||
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;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
use App\Domain\Catalog\StructureNode;
|
||||
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;
|
||||
@@ -40,6 +41,7 @@
|
||||
|
||||
abstract class EditComposition extends EditRecord
|
||||
{
|
||||
use ManagesEditorialSurface;
|
||||
use WithFileUploads;
|
||||
|
||||
protected string $view = 'filament.editorial.edit';
|
||||
@@ -48,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 = '';
|
||||
@@ -83,10 +89,14 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public bool $pickerOpen = false;
|
||||
|
||||
public string $pickerPurpose = 'aufbau';
|
||||
|
||||
public string $pickerQuery = '';
|
||||
|
||||
public string $pickerKind = 'alle';
|
||||
|
||||
public string $pickerLayout = 'kacheln';
|
||||
|
||||
public string $pickerDimension = '';
|
||||
|
||||
public string $pickerSelected = '';
|
||||
@@ -312,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;
|
||||
@@ -331,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,
|
||||
@@ -351,6 +424,7 @@ public function pickerDetail(): ?array
|
||||
$row = app(EditorialCatalog::class)->rowForTarget(
|
||||
$this->pickerSelected,
|
||||
(int) $this->getRecord()->getKey(),
|
||||
allowDraft: true,
|
||||
);
|
||||
|
||||
if ($row === null) {
|
||||
@@ -360,10 +434,13 @@ public function pickerDetail(): ?array
|
||||
$row['playback'] = null;
|
||||
|
||||
if (preg_match('/^element:(\d+)$/', (string) $row['target'], $match) === 1) {
|
||||
$version = ContentElementVersion::query()->with('element')->find($match[1]);
|
||||
$version = ContentElementVersion::query()->with('element.editorialContentKind')->find($match[1]);
|
||||
$row['playback'] = $version instanceof ContentElementVersion
|
||||
? app(ContentPreviewController::class)->playback($version)
|
||||
: null;
|
||||
if ($version?->element !== null) {
|
||||
$row['visibility'] = app(PublicMaterialReader::class)->visibilityNote($version->element);
|
||||
}
|
||||
}
|
||||
|
||||
return $row;
|
||||
@@ -632,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) {
|
||||
@@ -996,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,
|
||||
@@ -1567,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 ?? '');
|
||||
@@ -1795,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
|
||||
@@ -1822,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,12 +2,20 @@
|
||||
|
||||
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;
|
||||
use App\Filament\Support\ReportsDomainRules;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Schemas\Components\RenderHook;
|
||||
use Filament\Schemas\Components\View;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\View\PanelsRenderHook;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Livewire\Attributes\Url;
|
||||
|
||||
class ListContentElements extends ListRecords
|
||||
{
|
||||
@@ -15,9 +23,155 @@ class ListContentElements extends ListRecords
|
||||
|
||||
protected static string $resource = ContentElementResource::class;
|
||||
|
||||
#[Url(as: 'suche', except: '')]
|
||||
public string $suche = '';
|
||||
|
||||
#[Url(as: 'ansicht', except: 'kacheln')]
|
||||
public string $ansicht = 'kacheln';
|
||||
|
||||
#[Url(as: 'art', except: '')]
|
||||
public string $art = '';
|
||||
|
||||
#[Url(as: 'freigabe', except: '')]
|
||||
public string $freigabe = '';
|
||||
|
||||
#[Url(as: 'entwurf', except: '')]
|
||||
public string $entwurf = '';
|
||||
|
||||
#[Url(as: 'fassung', except: '')]
|
||||
public string $fassung = '';
|
||||
|
||||
#[Url(as: 'nutzung', except: '')]
|
||||
public string $nutzung = '';
|
||||
|
||||
#[Url(as: 'saeule', except: '')]
|
||||
public string $saeule = '';
|
||||
|
||||
#[Url(as: 'inhaltsart', except: '')]
|
||||
public string $inhaltsart = '';
|
||||
|
||||
#[Url(as: 'einordnung', except: '')]
|
||||
public string $einordnung = '';
|
||||
|
||||
#[Url(as: 'verarbeitung', except: '')]
|
||||
public string $verarbeitung = '';
|
||||
|
||||
#[Url(as: 'archiv', except: 'aktiv')]
|
||||
public string $archiv = 'aktiv';
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Die Dateien und Texte. Eine Übung, ein Kurs oder eine fachliche Kombination verweist darauf; die Datei wird nicht für jede Verwendung neu hochgeladen.';
|
||||
return 'Die Dateien und Texte. Ein Modul oder ein Programm verweist auf eine Fassung; die Datei wird nicht für jede Verwendung neu hochgeladen.';
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
{
|
||||
return Width::Full;
|
||||
}
|
||||
|
||||
public function content(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
$this->getTabsContentComponent(),
|
||||
RenderHook::make(PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE),
|
||||
View::make('filament.media.library'),
|
||||
RenderHook::make(PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_AFTER),
|
||||
]);
|
||||
}
|
||||
|
||||
public function showingList(): bool
|
||||
{
|
||||
return $this->ansicht === 'liste';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function cards(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->cards($this->libraryFilters(), ContentElementResource::editor());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{value: string, label: string}>
|
||||
*/
|
||||
public function typeOptions(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->types();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, name: string}>
|
||||
*/
|
||||
public function pillarOptions(): array
|
||||
{
|
||||
return app(MediaLibrary::class)->pillars();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, label: string}>
|
||||
*/
|
||||
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) !== ''
|
||||
|| $this->art !== ''
|
||||
|| $this->freigabe !== ''
|
||||
|| $this->entwurf !== ''
|
||||
|| $this->fassung !== ''
|
||||
|| $this->nutzung !== ''
|
||||
|| $this->saeule !== ''
|
||||
|| $this->einordnung !== ''
|
||||
|| $this->inhaltsart !== ''
|
||||
|| $this->verarbeitung !== ''
|
||||
|| $this->archiv !== 'aktiv';
|
||||
}
|
||||
|
||||
public function resetFilters(): void
|
||||
{
|
||||
$this->suche = '';
|
||||
$this->art = '';
|
||||
$this->freigabe = '';
|
||||
$this->entwurf = '';
|
||||
$this->fassung = '';
|
||||
$this->nutzung = '';
|
||||
$this->saeule = '';
|
||||
$this->einordnung = '';
|
||||
$this->inhaltsart = '';
|
||||
$this->verarbeitung = '';
|
||||
$this->archiv = 'aktiv';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function libraryFilters(): array
|
||||
{
|
||||
return [
|
||||
'suche' => $this->suche,
|
||||
'art' => $this->art,
|
||||
'freigabe' => $this->freigabe,
|
||||
'entwurf' => $this->entwurf,
|
||||
'fassung' => $this->fassung,
|
||||
'nutzung' => $this->nutzung,
|
||||
'saeule' => $this->saeule,
|
||||
'einordnung' => $this->einordnung,
|
||||
'inhaltsart' => $this->inhaltsart,
|
||||
'verarbeitung' => $this->verarbeitung,
|
||||
'archiv' => $this->archiv,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
||||
@@ -6,23 +6,32 @@
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\IdentityChange;
|
||||
use App\Domain\Catalog\IdentityDimension;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Domain\Cms\WebsiteImageUsage;
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Media\ThumbnailRef;
|
||||
use App\Domain\Media\WebsiteMedia;
|
||||
use App\Domain\Media\WebsiteRelease;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
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;
|
||||
use App\Jobs\DeriveThumbnail;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
use Filament\Schemas\Components\View;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
@@ -30,6 +39,7 @@
|
||||
|
||||
class ViewContentElement extends ViewRecord
|
||||
{
|
||||
use ManagesEditorialSurface;
|
||||
use ReportsDomainRules;
|
||||
use WithFileUploads;
|
||||
|
||||
@@ -47,6 +57,52 @@ class ViewContentElement extends ViewRecord
|
||||
|
||||
public mixed $previewUpload = null;
|
||||
|
||||
public string $bereich = 'inhalt';
|
||||
|
||||
public string $workingTitle = '';
|
||||
|
||||
public string $displayTitle = '';
|
||||
|
||||
public string $teaser = '';
|
||||
|
||||
public string $summary = '';
|
||||
|
||||
public string $searchTerms = '';
|
||||
|
||||
public string $descriptionText = '';
|
||||
|
||||
public string $usageNote = '';
|
||||
|
||||
public string $licenseNote = '';
|
||||
|
||||
public string $websiteCredit = '';
|
||||
|
||||
public string $websiteAlt = '';
|
||||
|
||||
public string $websiteFeedback = '';
|
||||
|
||||
public int|string|null $kindId = null;
|
||||
|
||||
/** @var list<int|string> */
|
||||
public array $pillarIds = [];
|
||||
|
||||
/** @var list<int|string> */
|
||||
public array $dimensionIds = [];
|
||||
|
||||
public string $editorialFeedback = '';
|
||||
|
||||
public string $previewWidth = '640';
|
||||
|
||||
public string $previewSurface = 'website';
|
||||
|
||||
public string $pickerQuery = '';
|
||||
|
||||
public string $pickerContext = 'modul';
|
||||
|
||||
public string $pickerLayout = 'kacheln';
|
||||
|
||||
public string $pickerSelected = '';
|
||||
|
||||
public function mount(int|string $record): void
|
||||
{
|
||||
parent::mount($record);
|
||||
@@ -57,13 +113,28 @@ public function mount(int|string $record): void
|
||||
$this->fassung = $requested;
|
||||
}
|
||||
|
||||
$bereich = (string) request()->query('bereich', 'beschreibung');
|
||||
$this->bereich = in_array($bereich, ['beschreibung', 'inhalt', 'fassungen', 'praesentation', 'verwendung', 'vorschau'], true)
|
||||
? $bereich
|
||||
: 'beschreibung';
|
||||
$this->thumbnailAlt = (string) ($this->getRecord()->thumbnail_alt ?? '');
|
||||
$this->fillEditorial();
|
||||
$this->syncBodyDraft();
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable
|
||||
{
|
||||
return (string) $this->getRecord()->working_title;
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Jede Fassung hat eine eigene Nummer und bleibt einsehbar. Beschreibung, Arbeitstitel und Säulen gehören zum Medium und ändern keine Fassung. Eine deaktivierte Fassung wird nicht mehr ausgeliefert und lässt sich nicht neu einbauen.';
|
||||
return 'Texte und Vorschaubild ändern keine Fassung. Eine neue Datei oder ein geänderter Lehrtext braucht eine neue Fassung.';
|
||||
}
|
||||
|
||||
public function getMaxContentWidth(): Width|string|null
|
||||
{
|
||||
return Width::Full;
|
||||
}
|
||||
|
||||
public function infolist(Schema $schema): Schema
|
||||
@@ -242,40 +313,6 @@ public function deactivateAction(): Action
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('describe')
|
||||
->label('Beschreibung ändern')
|
||||
->visible(fn (): bool => ContentElementResource::editor())
|
||||
->fillForm(fn (): array => [
|
||||
'working_title' => $this->getRecord()->working_title,
|
||||
'description' => $this->getRecord()->description,
|
||||
'usage_note' => $this->getRecord()->usage_note,
|
||||
'license_note' => $this->getRecord()->license_note,
|
||||
'pillars' => $this->getRecord()->pillars()->pluck('pillars.id')->all(),
|
||||
])
|
||||
->schema([
|
||||
TextInput::make('working_title')->label('Arbeitstitel')->required(),
|
||||
Textarea::make('description')->label('Beschreibung')->rows(4)
|
||||
->helperText('Gilt für das Medium. Speichern legt keine neue Fassung an.'),
|
||||
Textarea::make('usage_note')->label('Hinweise für den Einsatz')->rows(4),
|
||||
Textarea::make('license_note')->label('Interner Lizenzvermerk')->rows(3)
|
||||
->helperText('Nur in der Verwaltung. Nicht in der Bibliothek und nicht auf der Website.'),
|
||||
CheckboxList::make('pillars')
|
||||
->label('Fachliche Säulen')
|
||||
->options(fn (): array => Pillar::query()->orderBy('name')->pluck('name', 'id')->all()),
|
||||
])
|
||||
->action(function (array $data): void {
|
||||
$this->report(function () use ($data): void {
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
app(ContentService::class)->describe($element, (string) $data['working_title'], $data['description'] ?? null);
|
||||
app(IdentityProfile::class)->fill($element, [
|
||||
'usage_note' => $data['usage_note'] ?? null,
|
||||
'license_note' => $data['license_note'] ?? null,
|
||||
], auth()->user());
|
||||
app(PillarService::class)->assign($element, array_map(intval(...), $data['pillars'] ?? []));
|
||||
}, 'Die Beschreibung ist gespeichert.');
|
||||
$this->getRecord()->refresh();
|
||||
}),
|
||||
Action::make('releaseVersion')
|
||||
->label('Fassung freigeben')
|
||||
->modalHeading('Fassung freigeben')
|
||||
@@ -395,6 +432,7 @@ private function pictureCaption(ContentElement $element): string
|
||||
return match ($source) {
|
||||
'eigen' => 'Eigenes Vorschaubild.',
|
||||
'datei' => 'Vorschaubild aus der Datei des Mediums.',
|
||||
'bestand' => 'Vorschaubild aus einem Bild im Bestand. Es ist damit nicht für die Website freigegeben.',
|
||||
default => '',
|
||||
};
|
||||
}
|
||||
@@ -406,4 +444,285 @@ private function ownedVersion(int $id): ?ContentElementVersion
|
||||
|
||||
return $element->versions()->whereKey($id)->first();
|
||||
}
|
||||
|
||||
public function saveEditorial(): void
|
||||
{
|
||||
abort_unless(ContentElementResource::editor(), 403);
|
||||
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$title = trim($this->workingTitle);
|
||||
|
||||
if ($title === '') {
|
||||
$this->editorialFeedback = 'Der Arbeitstitel fehlt.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$versions = $element->versions()->count();
|
||||
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,
|
||||
'website_credit' => $this->websiteCredit,
|
||||
'website_alt' => $this->websiteAlt,
|
||||
'thumbnail_alt' => $this->thumbnailAlt,
|
||||
'editorial_content_kind_id' => filled($this->kindId) ? (int) $this->kindId : null,
|
||||
], auth()->user());
|
||||
app(PillarService::class)->assign($element, array_map(intval(...), $this->pillarIds));
|
||||
app(IdentityDimension::class)->replaceOffered($element, array_map(intval(...), $this->dimensionIds));
|
||||
|
||||
$element->refresh();
|
||||
$this->fillEditorial();
|
||||
$this->editorialFeedback = $element->versions()->count() === $versions
|
||||
? 'Gespeichert. Es gibt keine neue Fassung.'
|
||||
: 'Gespeichert. Prüfe die Fassungen, ihre Zahl hat sich geändert.';
|
||||
}
|
||||
|
||||
public function releaseForWebsite(): void
|
||||
{
|
||||
abort_unless(ContentElementResource::editor(), 403);
|
||||
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
app(IdentityProfile::class)->fill($element, [
|
||||
'website_credit' => $this->websiteCredit,
|
||||
'website_alt' => $this->websiteAlt,
|
||||
], auth()->user());
|
||||
$element->refresh();
|
||||
$this->websiteFeedback = app(WebsiteRelease::class)->release($element, auth()->user());
|
||||
$element->refresh();
|
||||
$this->fillEditorial();
|
||||
}
|
||||
|
||||
public function withdrawWebsite(): void
|
||||
{
|
||||
abort_unless(ContentElementResource::editor(), 403);
|
||||
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$this->websiteFeedback = app(WebsiteRelease::class)->withdraw($element, auth()->user());
|
||||
$element->refresh();
|
||||
$this->fillEditorial();
|
||||
}
|
||||
|
||||
/**
|
||||
* Website-Seiten, die dieses Medium als Bild verwenden (CMS-Widgets und Abschnittshintergründe).
|
||||
*
|
||||
* @return list<array{path: string, published: bool, draft: bool}>
|
||||
*/
|
||||
public function websitePages(): array
|
||||
{
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
|
||||
return app(WebsiteImageUsage::class)->pages($element);
|
||||
}
|
||||
|
||||
public function websiteIsPublic(): bool
|
||||
{
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
|
||||
return app(WebsiteMedia::class)->present($element->fresh()) !== null;
|
||||
}
|
||||
|
||||
public function adoptLibraryImage(): void
|
||||
{
|
||||
abort_unless(ContentElementResource::editor(), 403);
|
||||
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$detail = $this->selectionDetail();
|
||||
$sourceId = (int) ($detail['element_id'] ?? 0);
|
||||
$source = $sourceId > 0 ? ContentElement::query()->find($sourceId) : null;
|
||||
$path = $source?->thumbnail_path;
|
||||
|
||||
if (! $source instanceof ContentElement || $source->output_class !== 'bild' || ! is_string($path) || ! str_starts_with($path, 'vorschau/') || str_contains($path, '..')) {
|
||||
$this->pictureFeedback = 'Dieses Bild hat noch kein übernehmbares Vorschaubild.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$versions = $element->versions()->count();
|
||||
app(IdentityProfile::class)->fill($element, [
|
||||
'thumbnail_path' => $path,
|
||||
'thumbnail_alt' => filled($source->thumbnail_alt) ? $source->thumbnail_alt : $source->working_title,
|
||||
'thumbnail_source' => 'bestand',
|
||||
'thumbnail_error' => null,
|
||||
], auth()->user());
|
||||
$element->refresh();
|
||||
$this->thumbnailAlt = (string) ($element->thumbnail_alt ?? '');
|
||||
$this->pictureFeedback = $element->versions()->count() === $versions
|
||||
? 'Vorschaubild übernommen. Es gibt keine neue Fassung. Für die Website ist es damit nicht freigegeben.'
|
||||
: 'Vorschaubild übernommen. Prüfe die Fassungen.';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{items: list<array<string, mixed>>, more: bool}
|
||||
*/
|
||||
public function selection(): array
|
||||
{
|
||||
return app(EditorialCatalog::class)->browse(
|
||||
$this->pickerQuery,
|
||||
$this->pickerContext === 'bild' ? 'bild' : 'alle',
|
||||
'',
|
||||
0,
|
||||
elementsOnly: $this->pickerContext !== 'modul',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
public function selectionDetail(): ?array
|
||||
{
|
||||
if ($this->pickerSelected === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$row = app(EditorialCatalog::class)->rowForTarget($this->pickerSelected, 0, allowDraft: true);
|
||||
|
||||
if ($row === null || ! isset($row['element_id'])) {
|
||||
return $row;
|
||||
}
|
||||
|
||||
$element = ContentElement::query()->with('editorialContentKind')->find((int) $row['element_id']);
|
||||
|
||||
if ($element instanceof ContentElement) {
|
||||
$row['visibility'] = app(PublicMaterialReader::class)->visibilityNote($element);
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function previewHtml(): string
|
||||
{
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$draft = [
|
||||
'working_title' => $this->workingTitle,
|
||||
'display_title' => $this->displayTitle,
|
||||
'summary' => $this->summary,
|
||||
'thumbnail_alt' => $this->thumbnailAlt,
|
||||
];
|
||||
|
||||
if ($this->previewSurface === 'bibliothek') {
|
||||
$title = trim($this->displayTitle) !== '' ? trim($this->displayTitle) : trim($this->workingTitle);
|
||||
|
||||
return view('member.partials.card', [
|
||||
'href' => '#vorschau',
|
||||
'card' => [
|
||||
'title' => $title !== '' ? $title : $element->working_title,
|
||||
'summary' => trim($this->summary) !== '' ? trim($this->summary) : null,
|
||||
'kind' => PublicMaterialReader::outputLabel((string) $element->output_class),
|
||||
'coverage' => 'offen',
|
||||
'image' => trim($this->thumbnailAlt) !== '' ? trim($this->thumbnailAlt) : $title,
|
||||
'image_url' => ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path),
|
||||
'error' => 'Vorschau der Kartenform. Ob jemand sie öffnen darf, entscheidet die Lizenz.',
|
||||
],
|
||||
])->render();
|
||||
}
|
||||
|
||||
$subject = app(PublicMaterialReader::class)->subject($element->id, true, $draft);
|
||||
|
||||
if ($subject === null) {
|
||||
return '<p class="preview-note">Für dieses Medium liegt noch keine anzeigbare Fassung vor. Die Karte erscheint deshalb auch in der Vorschau nicht.</p>';
|
||||
}
|
||||
|
||||
return view('widgets.premium_card', [
|
||||
'subject' => $subject,
|
||||
'context' => RenderContext::preview(),
|
||||
'cardStyle' => $subject->style ?? 'media',
|
||||
'imageUrl' => null,
|
||||
'alt' => '',
|
||||
'focus' => ['x' => 50, 'y' => 45],
|
||||
'format' => 'landscape',
|
||||
'fit' => 'cover',
|
||||
'headingTag' => 'h3',
|
||||
'show' => ['summary' => true, 'kind' => true, 'meta' => true, 'action' => true],
|
||||
'actionLabel' => 'Ansehen',
|
||||
'note' => null,
|
||||
'stacked' => $this->previewWidth === '390',
|
||||
])->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{field: string, after: string, when: string}>
|
||||
*/
|
||||
public function editorialHistory(): array
|
||||
{
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
$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',
|
||||
'website_alt' => 'Alternativtext der Website',
|
||||
'website_released_at' => 'Website-Freigabe',
|
||||
'thumbnail_alt' => 'Alternativtext',
|
||||
'thumbnail_path' => 'Vorschaubild',
|
||||
'thumbnail_source' => 'Herkunft des Vorschaubilds',
|
||||
'editorial_content_kind_id' => 'Inhaltsart',
|
||||
];
|
||||
|
||||
return IdentityChange::query()
|
||||
->where('subject_type', $element->getMorphClass())
|
||||
->where('subject_id', $element->id)
|
||||
->latest('occurred_at')
|
||||
->limit(8)
|
||||
->get()
|
||||
->map(fn (IdentityChange $change): array => [
|
||||
'field' => $labels[$change->field] ?? $change->field,
|
||||
'after' => is_scalar($change->after) ? (string) $change->after : '',
|
||||
'when' => $change->occurred_at?->timezone(config('app.timezone'))->format('d.m.Y H:i') ?? '',
|
||||
])
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function usageCard(): array
|
||||
{
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
|
||||
return app(MediaLibrary::class)->cardFor($element, ContentElementResource::editor());
|
||||
}
|
||||
|
||||
private function fillEditorial(): void
|
||||
{
|
||||
/** @var ContentElement $element */
|
||||
$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 ?? '');
|
||||
$this->websiteCredit = (string) ($element->website_credit ?? '');
|
||||
$this->websiteAlt = (string) ($element->website_alt ?? '');
|
||||
$this->kindId = $element->editorial_content_kind_id;
|
||||
$this->pillarIds = $element->pillars()->pluck('pillars.id')->all();
|
||||
$this->dimensionIds = IdentityDimensionValue::query()
|
||||
->where('subject_type', $element->getMorphClass())
|
||||
->where('subject_id', $element->id)
|
||||
->where('origin', 'direkt')
|
||||
->pluck('editorial_dimension_value_id')
|
||||
->all();
|
||||
}
|
||||
}
|
||||
@@ -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 [
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\OfferStatus;
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Filament\Resources\Combinations\CombinationResource;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -63,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;
|
||||
}
|
||||
@@ -111,7 +117,7 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'identity' => 'medium:'.$element->id,
|
||||
'open_url' => route('content.preview', $version),
|
||||
'open_label' => 'Medium ansehen',
|
||||
'edit_url' => null,
|
||||
'edit_url' => ContentElementResource::getUrl('view', ['record' => $element]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -208,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')
|
||||
@@ -240,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);
|
||||
});
|
||||
})
|
||||
@@ -262,7 +272,7 @@ public function search(string $query, string $scope, int $exceptCompositionId):
|
||||
/**
|
||||
* @return array{items: list<array<string, string|null>>, more: bool}
|
||||
*/
|
||||
public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId): array
|
||||
public function browse(string $query, string $kind, string $dimension, int $exceptCompositionId, bool $elementsOnly = false): array
|
||||
{
|
||||
$query = trim($query);
|
||||
$like = '%'.str_replace(['%', '_'], ['', ''], $query).'%';
|
||||
@@ -294,7 +304,7 @@ public function browse(string $query, string $kind, string $dimension, int $exce
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($kind, ['alle', 'modul'], true)) {
|
||||
if (! $elementsOnly && in_array($kind, ['alle', 'modul'], true)) {
|
||||
$latestCompositions = CompositionVersion::query()
|
||||
->selectRaw('MAX(id)')
|
||||
->where('status', ContentVersionStatus::Bereit)
|
||||
@@ -315,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);
|
||||
});
|
||||
})
|
||||
@@ -372,12 +384,113 @@ public function browse(string $query, string $kind, string $dimension, int $exce
|
||||
}
|
||||
}
|
||||
|
||||
$rows = $this->withVisibility($rows);
|
||||
|
||||
return [
|
||||
'items' => array_slice($rows, 0, $limit),
|
||||
'more' => count($rows) > $limit,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
@@ -400,6 +513,42 @@ public function cardUrl(string $kind, int $id, ?string $path): ?string
|
||||
return route('editorial.card', ['kind' => $kind, 'subject' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $rows
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
private function withVisibility(array $rows): array
|
||||
{
|
||||
$ids = [];
|
||||
|
||||
foreach ($rows as $row) {
|
||||
if (isset($row['element_id'])) {
|
||||
$ids[] = (int) $row['element_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($ids === []) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
$reader = app(PublicMaterialReader::class);
|
||||
$elements = ContentElement::query()
|
||||
->with('editorialContentKind')
|
||||
->whereIn('id', array_values(array_unique($ids)))
|
||||
->get()
|
||||
->keyBy('id');
|
||||
|
||||
foreach ($rows as $index => $row) {
|
||||
$element = $elements->get((int) ($row['element_id'] ?? 0));
|
||||
|
||||
if ($element instanceof ContentElement) {
|
||||
$rows[$index]['visibility'] = $reader->visibilityNote($element);
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<ContentElement> $builder
|
||||
*/
|
||||
@@ -408,6 +557,7 @@ private function constrainElement($builder, string $query, string $like, string
|
||||
$outputs = match ($kind) {
|
||||
'film' => ['film'],
|
||||
'text' => ['text'],
|
||||
'bild' => ['bild'],
|
||||
'dokument' => ['pdf', 'document'],
|
||||
default => null,
|
||||
};
|
||||
@@ -427,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);
|
||||
});
|
||||
@@ -708,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,578 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Support;
|
||||
|
||||
use App\Domain\Catalog\Composition;
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\CompositionMember;
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\EditorialDimension;
|
||||
use App\Domain\Catalog\IdentityDimensionValue;
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Catalog\ReleaseContent;
|
||||
use App\Domain\Media\ThumbnailRef;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class MediaLibrary
|
||||
{
|
||||
public function __construct(private readonly EditorialCatalog $catalog) {}
|
||||
|
||||
/**
|
||||
* @return list<array{value: string, label: string}>
|
||||
*/
|
||||
public function types(): array
|
||||
{
|
||||
return [
|
||||
['value' => 'film', 'label' => 'Film'],
|
||||
['value' => 'text', 'label' => 'Text'],
|
||||
['value' => 'document', 'label' => 'Dokument'],
|
||||
['value' => 'bild', 'label' => 'Bild'],
|
||||
['value' => 'audio', 'label' => 'Hörstück'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, name: string}>
|
||||
*/
|
||||
public function pillars(): array
|
||||
{
|
||||
return Pillar::query()
|
||||
->orderBy('name')
|
||||
->get(['id', 'name'])
|
||||
->map(fn (Pillar $pillar): array => ['id' => $pillar->id, 'name' => $pillar->name])
|
||||
->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{id: int, label: string}>
|
||||
*/
|
||||
public function classifications(): array
|
||||
{
|
||||
$options = [];
|
||||
|
||||
foreach (EditorialDimension::query()->with('values')->orderBy('label')->get() as $dimension) {
|
||||
foreach ($dimension->values->sortBy('label') as $value) {
|
||||
$options[] = [
|
||||
'id' => $value->id,
|
||||
'label' => $dimension->label.': '.$value->label,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $filters
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function cardFor(ContentElement $element, bool $canEdit): array
|
||||
{
|
||||
$element->loadMissing(['versions', 'pillars', 'editorialContentKind']);
|
||||
$versionIds = $element->versions->pluck('id')->all();
|
||||
|
||||
return $this->card(
|
||||
$element,
|
||||
$this->portrait($element),
|
||||
$this->placements($versionIds)[$element->id] ?? [],
|
||||
$this->licenses($versionIds)[$element->id] ?? [],
|
||||
$canEdit,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $filters
|
||||
* @return list<array<string, mixed>>
|
||||
*/
|
||||
public function cards(array $filters, bool $canEdit): array
|
||||
{
|
||||
$filters = $this->normalize($filters);
|
||||
$elements = ContentElement::query()
|
||||
->with(['versions', 'pillars', 'editorialContentKind'])
|
||||
->orderBy('working_title')
|
||||
->get();
|
||||
$versionIds = $elements->flatMap(fn (ContentElement $element) => $element->versions->pluck('id'))->all();
|
||||
$placements = $this->placements($versionIds);
|
||||
$licenses = $this->licenses($versionIds);
|
||||
$classified = $this->classifiedIds();
|
||||
$needle = mb_strtolower($filters['suche']);
|
||||
$cards = [];
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$portrait = $this->portrait($element);
|
||||
$uses = $placements[$element->id] ?? [];
|
||||
$codes = $licenses[$element->id] ?? [];
|
||||
|
||||
if (! $this->matches($element, $portrait, $uses, $filters, $needle, $classified)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cards[] = $this->card($element, $portrait, $uses, $codes, $canEdit);
|
||||
}
|
||||
|
||||
usort($cards, fn (array $left, array $right): int => strcasecmp(
|
||||
mb_strtolower($left['title']),
|
||||
mb_strtolower($right['title']),
|
||||
));
|
||||
|
||||
return $cards;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $filters
|
||||
* @return array<string, string>
|
||||
*/
|
||||
private function normalize(array $filters): array
|
||||
{
|
||||
return [
|
||||
'suche' => trim($filters['suche'] ?? ''),
|
||||
'art' => $this->choice($filters['art'] ?? '', ['film', 'text', 'document', 'bild', 'audio']),
|
||||
'freigabe' => $this->choice($filters['freigabe'] ?? '', ['freigegeben', 'entwurf', 'ohne']),
|
||||
'entwurf' => $this->choice($filters['entwurf'] ?? '', ['offen', 'keiner']),
|
||||
'fassung' => $this->choice($filters['fassung'] ?? '', ['mit', 'nur']),
|
||||
'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'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $allowed
|
||||
*/
|
||||
private function choice(string $value, array $allowed, string $fallback = ''): string
|
||||
{
|
||||
return in_array($value, $allowed, true) ? $value : $fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<int> $versionIds
|
||||
* @return array<int, list<array<string, mixed>>>
|
||||
*/
|
||||
private function placements(array $versionIds): array
|
||||
{
|
||||
if ($versionIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$grouped = [];
|
||||
$members = CompositionMember::query()
|
||||
->whereIn('content_element_version_id', $versionIds)
|
||||
->with(['compositionVersion.composition', 'contentElementVersion'])
|
||||
->orderBy('id')
|
||||
->get();
|
||||
|
||||
foreach ($members as $member) {
|
||||
$version = $member->contentElementVersion;
|
||||
$compositionVersion = $member->compositionVersion;
|
||||
$composition = $compositionVersion?->composition;
|
||||
|
||||
if (! $version instanceof ContentElementVersion || $compositionVersion === null || ! $composition instanceof Composition) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$elementId = $version->content_element_id;
|
||||
$key = $composition->id.'-'.$compositionVersion->id.'-'.$version->id;
|
||||
$role = trim((string) $member->role);
|
||||
|
||||
if (! isset($grouped[$elementId][$key])) {
|
||||
$grouped[$elementId][$key] = [
|
||||
'compositionId' => $composition->id,
|
||||
'name' => $this->catalog->compositionTitle($composition),
|
||||
'type' => $this->kindLabel($composition),
|
||||
'mediumVersion' => $this->versionLabel($version),
|
||||
'hostVersion' => 'Fassung '.$compositionVersion->number,
|
||||
'url' => EditorialCatalog::editUrl($composition),
|
||||
'roles' => [],
|
||||
];
|
||||
}
|
||||
|
||||
if ($role !== '' && ! in_array($role, $grouped[$elementId][$key]['roles'], true)) {
|
||||
$grouped[$elementId][$key]['roles'][] = $role;
|
||||
}
|
||||
}
|
||||
|
||||
$placements = [];
|
||||
|
||||
foreach ($grouped as $elementId => $rows) {
|
||||
$list = array_values($rows);
|
||||
usort($list, fn (array $left, array $right): int => [$left['type'], $left['name'], $left['hostVersion']]
|
||||
<=> [$right['type'], $right['name'], $right['hostVersion']]);
|
||||
$placements[$elementId] = $list;
|
||||
}
|
||||
|
||||
return $placements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<int> $versionIds
|
||||
* @return array<int, list<string>>
|
||||
*/
|
||||
private function licenses(array $versionIds): array
|
||||
{
|
||||
if ($versionIds === []) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$codes = [];
|
||||
$contents = ReleaseContent::query()
|
||||
->whereIn('content_element_version_id', $versionIds)
|
||||
->with(['release.article', 'elementVersion'])
|
||||
->orderBy('id')
|
||||
->get();
|
||||
|
||||
foreach ($contents as $content) {
|
||||
$version = $content->elementVersion;
|
||||
$code = $content->release?->article?->code;
|
||||
|
||||
if (! $version instanceof ContentElementVersion || ! is_string($code) || $code === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$codes[$version->content_element_id][$code] = $code;
|
||||
}
|
||||
|
||||
return array_map(fn (array $row): array => array_values($row), $codes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, list<int>>
|
||||
*/
|
||||
private function classifiedIds(): array
|
||||
{
|
||||
$map = [];
|
||||
$rows = IdentityDimensionValue::query()
|
||||
->where('subject_type', (new ContentElement)->getMorphClass())
|
||||
->where('origin', 'direkt')
|
||||
->get(['subject_id', 'editorial_dimension_value_id']);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$map[(int) $row->subject_id][] = (int) $row->editorial_dimension_value_id;
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{
|
||||
* ready: ?ContentElementVersion,
|
||||
* draft: ?ContentElementVersion,
|
||||
* blocked: ?ContentElementVersion,
|
||||
* versionCount: int,
|
||||
* archived: bool,
|
||||
* processing: ?string,
|
||||
* stand: string,
|
||||
* standTone: string,
|
||||
* draftNote: ?string,
|
||||
* blockedNote: ?string
|
||||
* }
|
||||
*/
|
||||
private function portrait(ContentElement $element): array
|
||||
{
|
||||
/** @var Collection<int, ContentElementVersion> $versions */
|
||||
$versions = $element->versions->sortByDesc('number')->values();
|
||||
$ready = $versions->first(fn (ContentElementVersion $version): bool => $version->status === ContentVersionStatus::Bereit);
|
||||
$draft = $versions->first(fn (ContentElementVersion $version): bool => $version->status === ContentVersionStatus::Entwurf);
|
||||
$blocked = $versions->first(fn (ContentElementVersion $version): bool => $version->status === ContentVersionStatus::Gesperrt);
|
||||
$processing = $this->processing($versions);
|
||||
|
||||
if ($ready instanceof ContentElementVersion) {
|
||||
$stand = 'Fassung '.$ready->number.' freigegeben';
|
||||
$tone = 'ready';
|
||||
} elseif ($draft instanceof ContentElementVersion) {
|
||||
$stand = 'Entwurf, noch nicht freigegeben';
|
||||
$tone = 'draft';
|
||||
} elseif ($blocked instanceof ContentElementVersion) {
|
||||
$stand = 'Fassung '.$blocked->number.' deaktiviert';
|
||||
$tone = 'blocked';
|
||||
} else {
|
||||
$stand = 'Noch keine Fassung';
|
||||
$tone = 'quiet';
|
||||
}
|
||||
|
||||
return [
|
||||
'ready' => $ready instanceof ContentElementVersion ? $ready : null,
|
||||
'draft' => $draft instanceof ContentElementVersion ? $draft : null,
|
||||
'blocked' => $blocked instanceof ContentElementVersion ? $blocked : null,
|
||||
'versionCount' => $versions->count(),
|
||||
'archived' => $element->archived_at !== null,
|
||||
'processing' => $processing,
|
||||
'stand' => $stand,
|
||||
'standTone' => $tone,
|
||||
'draftNote' => $ready instanceof ContentElementVersion && $draft instanceof ContentElementVersion
|
||||
? 'Entwurf offen'
|
||||
: null,
|
||||
'blockedNote' => $blocked instanceof ContentElementVersion && ($ready instanceof ContentElementVersion || $draft instanceof ContentElementVersion)
|
||||
? 'Fassung '.$blocked->number.' deaktiviert'
|
||||
: null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection<int, ContentElementVersion> $versions
|
||||
*/
|
||||
private function processing(Collection $versions): ?string
|
||||
{
|
||||
foreach ($versions as $version) {
|
||||
$meta = is_array($version->metadata) ? $version->metadata : [];
|
||||
|
||||
if (is_string($meta['error'] ?? null) && trim($meta['error']) !== '') {
|
||||
return 'Verarbeitungsfehler';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($versions as $version) {
|
||||
$meta = is_array($version->metadata) ? $version->metadata : [];
|
||||
$incoming = $meta['incoming'] ?? null;
|
||||
$hasIncoming = (is_string($incoming) && $incoming !== '') || (is_array($incoming) && $incoming !== []);
|
||||
|
||||
if ($hasIncoming && ! is_string($meta['file'] ?? null)) {
|
||||
return 'Datei wird übernommen';
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $portrait
|
||||
* @param list<array<string, mixed>> $uses
|
||||
* @param array<string, string> $filters
|
||||
* @param array<int, list<int>> $classified
|
||||
*/
|
||||
private function matches(ContentElement $element, array $portrait, array $uses, array $filters, string $needle, array $classified): bool
|
||||
{
|
||||
if ($needle !== '' && ! str_contains($this->haystack($element), $needle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $this->matchesArt($element, $filters['art'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$onlyBlocked = $portrait['ready'] === null && $portrait['draft'] === null && $portrait['blocked'] !== null;
|
||||
|
||||
if ($onlyBlocked && $filters['fassung'] === '' && $filters['archiv'] === 'aktiv') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['archiv'] === 'aktiv' && $portrait['archived']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['archiv'] === 'archiviert' && ! $portrait['archived']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['freigabe'] === 'freigegeben' && $portrait['ready'] === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['freigabe'] === 'entwurf' && ($portrait['draft'] === null || $portrait['ready'] !== null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['freigabe'] === 'ohne' && $portrait['ready'] !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['entwurf'] === 'offen' && $portrait['draft'] === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['entwurf'] === 'keiner' && $portrait['draft'] !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['fassung'] === 'mit' && $portrait['blocked'] === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['fassung'] === 'nur' && ($portrait['blocked'] === null || $portrait['ready'] !== null || $portrait['draft'] !== null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$used = $this->usageCount($uses) > 0;
|
||||
|
||||
if ($filters['nutzung'] === 'verwendet' && ! $used) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['nutzung'] === 'unbenutzt' && $used) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['saeule'] !== '' && ! $element->pillars->contains('id', (int) $filters['saeule'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($filters['einordnung'] !== '' && ! in_array((int) $filters['einordnung'], $classified[$element->id] ?? [], true)) {
|
||||
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;
|
||||
}
|
||||
|
||||
if ($filters['verarbeitung'] === 'uebernahme' && $portrait['processing'] !== 'Datei wird übernommen') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function matchesArt(ContentElement $element, string $art): bool
|
||||
{
|
||||
if ($art === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$class = (string) $element->output_class;
|
||||
|
||||
if ($art === 'document') {
|
||||
return in_array($class, ['document', 'pdf'], true);
|
||||
}
|
||||
|
||||
return $class === $art;
|
||||
}
|
||||
|
||||
private function haystack(ContentElement $element): string
|
||||
{
|
||||
return mb_strtolower(implode("\n", array_filter([
|
||||
$element->working_title,
|
||||
$element->display_title,
|
||||
$element->description,
|
||||
$element->summary,
|
||||
$element->teaser,
|
||||
$element->search_terms,
|
||||
$element->usage_note,
|
||||
], fn (mixed $value): bool => is_string($value) && trim($value) !== '')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $portrait
|
||||
* @param list<array<string, mixed>> $uses
|
||||
* @param list<string> $codes
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function card(ContentElement $element, array $portrait, array $uses, array $codes, bool $canEdit): array
|
||||
{
|
||||
$description = trim((string) ($element->description ?: $element->summary ?: ''));
|
||||
$usageNote = trim((string) $element->usage_note);
|
||||
$licenseNote = trim((string) $element->license_note);
|
||||
$typeKey = $this->typeKey((string) $element->output_class);
|
||||
$count = $this->usageCount($uses);
|
||||
|
||||
return [
|
||||
'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,
|
||||
'licenseNote' => $licenseNote === '' ? null : $licenseNote,
|
||||
'image' => ThumbnailRef::url('editorial.card', 'element', $element->id, $element->thumbnail_path),
|
||||
'imageAlt' => trim((string) ($element->thumbnail_alt ?: $element->working_title)),
|
||||
'imageNote' => $this->imageNote($element),
|
||||
'stand' => $portrait['stand'],
|
||||
'standTone' => $portrait['standTone'],
|
||||
'draftNote' => $portrait['draftNote'],
|
||||
'blockedNote' => $portrait['blockedNote'],
|
||||
'processing' => $portrait['processing'],
|
||||
'archived' => $portrait['archived'],
|
||||
'versionCount' => $portrait['versionCount'],
|
||||
'versionLabel' => $this->versionCountLabel($portrait['versionCount']),
|
||||
'usageCount' => $count,
|
||||
'usageLabel' => $count === 0
|
||||
? 'In keinem Modul oder Programm verwendet'
|
||||
: ($count === 1 ? '1 Verwendung' : $count.' Verwendungen'),
|
||||
'usages' => $uses,
|
||||
'licenseText' => $this->licenseText($codes),
|
||||
'url' => ContentElementResource::getUrl('view', ['record' => $element]),
|
||||
'editUrl' => $canEdit ? ContentElementResource::getUrl('edit', ['record' => $element]) : null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $uses
|
||||
*/
|
||||
private function usageCount(array $uses): int
|
||||
{
|
||||
return count(array_unique(array_column($uses, 'compositionId')));
|
||||
}
|
||||
|
||||
private function versionCountLabel(int $count): ?string
|
||||
{
|
||||
return match ($count) {
|
||||
0 => null,
|
||||
1 => '1 Fassung',
|
||||
default => $count.' Fassungen',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $codes
|
||||
*/
|
||||
private function licenseText(array $codes): ?string
|
||||
{
|
||||
if ($codes === []) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$named = count($codes) === 1
|
||||
? 'Im Lizenzartikel '.$codes[0].' genannt.'
|
||||
: 'In den Lizenzartikeln '.implode(', ', $codes).' genannt.';
|
||||
|
||||
return $named.' Das belegt keinen Zugriff in der Bibliothek.';
|
||||
}
|
||||
|
||||
private function imageNote(ContentElement $element): ?string
|
||||
{
|
||||
if (is_string($element->thumbnail_error) && trim($element->thumbnail_error) !== '') {
|
||||
return Str::limit(trim($element->thumbnail_error), 180);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function typeKey(string $outputClass): string
|
||||
{
|
||||
return match ($outputClass) {
|
||||
'film' => 'film',
|
||||
'audio' => 'audio',
|
||||
'bild' => 'bild',
|
||||
'document', 'pdf' => 'document',
|
||||
default => 'text',
|
||||
};
|
||||
}
|
||||
|
||||
private function kindLabel(Composition $composition): string
|
||||
{
|
||||
$kind = $composition->kind;
|
||||
|
||||
return ($kind instanceof CompositionKind ? $kind : CompositionKind::from((string) $kind))->deskLabel();
|
||||
}
|
||||
|
||||
private function versionLabel(ContentElementVersion $version): string
|
||||
{
|
||||
return match ($version->status) {
|
||||
ContentVersionStatus::Entwurf => 'Entwurf',
|
||||
ContentVersionStatus::Gesperrt => 'Fassung '.$version->number.', deaktiviert',
|
||||
default => 'Fassung '.$version->number,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
use App\Domain\Cms\Sections\PageSections;
|
||||
use App\Domain\Cms\Sections\SectionLayouts;
|
||||
use App\Domain\Cms\Sections\SectionStyle;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
@@ -20,7 +19,6 @@
|
||||
use Filament\Schemas\Components\Utilities\Set;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
|
||||
/**
|
||||
* Seiteneditor für Abschnitte und Slots.
|
||||
@@ -143,41 +141,33 @@ private static function styleFields(): array
|
||||
->default('standard')
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Ein Hintergrund reicht immer über die ganze Bildschirmbreite.'),
|
||||
Select::make('spacing')
|
||||
->label('Abstand oben und unten')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default('normal')
|
||||
->selectablePlaceholder(false),
|
||||
Select::make('spacing_top')
|
||||
->label('Abstand oben')
|
||||
->options(SectionStyle::SPACINGS_TOP)
|
||||
->default('same')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default(SectionStyle::DEFAULTS['spacing_top'])
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Zum Beispiel „Kein Abstand“, damit ein Einstieg direkt unter der Kopfzeile beginnt. Der Abstand unten bleibt.'),
|
||||
->helperText('Vor dem Inhalt. Zwischen zwei Abschnitten addieren sich „unten“ und „oben“; „Kein Abstand“ lässt einen Einstieg direkt unter der Kopfzeile beginnen.'),
|
||||
Select::make('spacing_bottom')
|
||||
->label('Abstand unten')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default(SectionStyle::DEFAULTS['spacing_bottom'])
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Nach dem Inhalt. Bei eigener Fläche liegen beide Abstände innerhalb der Fläche.'),
|
||||
Select::make('gap')
|
||||
->label('Widget-Abstand')
|
||||
->options(SectionStyle::SPACINGS)
|
||||
->default(SectionStyle::DEFAULTS['gap'])
|
||||
->selectablePlaceholder(false)
|
||||
->helperText('Zwischen den Plätzen dieses Abschnitts, nebeneinander und gestapelt. Abstände innerhalb eines Widgets bleiben Sache des Widgets.'),
|
||||
Select::make('divider')
|
||||
->label('Trenner zum nächsten Abschnitt')
|
||||
->options(SectionStyle::DIVIDERS)
|
||||
->default('none')
|
||||
->selectablePlaceholder(false),
|
||||
Select::make('image')
|
||||
->label('Hintergrundbild: vorhandenes Bild')
|
||||
->options(fn (): array => PublicMedia::imageOptions())
|
||||
->searchable()
|
||||
->placeholder('Bitte wählen')
|
||||
->helperText('Nur Bilder aus dem öffentlichen Website-Bereich. Geschützte Filmbilder sind hier nicht wählbar.')
|
||||
->visible(fn (Get $get): bool => $get('background') === 'image')
|
||||
->columnSpan(['default' => 1, 'md' => 2]),
|
||||
FileUpload::make('_upload')
|
||||
->label('Hintergrundbild: neu hochladen')
|
||||
->disk('cms_incoming')
|
||||
->directory('cms')
|
||||
->image()
|
||||
->maxSize(8192)
|
||||
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
|
||||
->getUploadedFileNameForStorageUsing(fn (TemporaryUploadedFile $file): string => Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)).'-'.Str::lower(Str::random(6)).'.'.$file->guessExtension())
|
||||
->helperText('Ersetzt die Auswahl links. Nur Bilder mit geklärter Veröffentlichungsfreigabe hochladen.')
|
||||
->visible(fn (Get $get): bool => $get('background') === 'image')
|
||||
->columnSpan(['default' => 1, 'md' => 2]),
|
||||
...array_map(
|
||||
fn ($field) => $field->visible(fn (Get $get): bool => $get('background') === 'image')->columnSpan(['default' => 1, 'md' => 2]),
|
||||
ImageRefFields::fields('Hintergrundbild'),
|
||||
),
|
||||
Select::make('focus')
|
||||
->label('Bildausschnitt (Fokuspunkt)')
|
||||
->options(SectionStyle::FOCUS)
|
||||
|
||||
@@ -2,15 +2,21 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Media\WebsiteMedia;
|
||||
use App\Domain\Media\WebsiteMediaAlias;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class PublicMediaController extends Controller
|
||||
{
|
||||
public function show(string $path): StreamedResponse
|
||||
public function show(string $path, WebsiteMedia $media): StreamedResponse
|
||||
{
|
||||
abort_if(str_contains($path, '..') || ! str_starts_with($path, 'cms/'), 404);
|
||||
|
||||
// Ein in den Medienmanager übernommenes Bild folgt dessen Website-Freigabe, auch unter der früheren Adresse.
|
||||
$alias = WebsiteMediaAlias::effectiveFor($path);
|
||||
abort_if($alias !== null && $media->present($alias->content_element_id) === null, 404);
|
||||
|
||||
foreach (['media_public', 'cms_incoming'] as $disk) {
|
||||
if (Storage::disk($disk)->exists($path)) {
|
||||
return Storage::disk($disk)->response($path);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Media\WebsiteMedia;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
class WebsiteMediaController extends Controller
|
||||
{
|
||||
public function show(ContentElement $element, WebsiteMedia $media): StreamedResponse
|
||||
{
|
||||
$presentation = $media->present($element);
|
||||
abort_if($presentation === null, 404);
|
||||
|
||||
$path = $element->website_public_path;
|
||||
abort_if(! is_string($path), 404);
|
||||
|
||||
return Storage::disk('media_public')->response($path, null, [
|
||||
'Content-Disposition' => 'inline',
|
||||
'X-Content-Type-Options' => 'nosniff',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Media\ThumbnailDeriver;
|
||||
use App\Domain\Media\WebsiteRelease;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class AcceptWebsiteImage implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public int $elementId,
|
||||
public string $incoming,
|
||||
public ?int $actorId = null,
|
||||
) {}
|
||||
|
||||
public function handle(ThumbnailDeriver $deriver, WebsiteRelease $release): void
|
||||
{
|
||||
$element = ContentElement::query()->find($this->elementId);
|
||||
|
||||
if (! $element instanceof ContentElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
$deriver->forWebsiteImage($element, $this->incoming);
|
||||
$element->refresh();
|
||||
|
||||
if ($release->derivedPath($element) === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->incomingIsDisposable()) {
|
||||
Storage::disk('cms_incoming')->delete($this->incoming);
|
||||
}
|
||||
|
||||
PublishWebsiteMedia::dispatch($element->id, 'release', $this->actorId);
|
||||
}
|
||||
|
||||
private function incomingIsDisposable(): bool
|
||||
{
|
||||
return (str_starts_with($this->incoming, 'cms/') || str_starts_with($this->incoming, 'vorschau/'))
|
||||
&& ! str_contains($this->incoming, '..');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Domain\Media\WebsiteIntake;
|
||||
use App\Domain\Media\WebsiteMediaAlias;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Übernimmt die bisherigen CMS-Bilder (media_public, cms/…) in den Medienmanager.
|
||||
*
|
||||
* - Bytegleiche Dateien werden ein Medium (SHA-256); jeder frühere Pfad erhält eine Zuordnung (WebsiteMediaAlias).
|
||||
* - Neue Medien entstehen über WebsiteIntake: Die Warteschlange leitet das Bild ab und gibt genau diese Ableitung
|
||||
* für die Website frei. Erst danach wird die Zuordnung wirksam; bis dahin bleibt der frühere Pfad gültig.
|
||||
* - Wiederholbar: Bereits zugeordnete Pfade werden übersprungen. Es wird nichts gelöscht; die Dateien unter cms/
|
||||
* bleiben liegen (frühere Revisionen, Rückweg).
|
||||
*/
|
||||
class ImportCmsImages implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
private const EXTENSIONS = ['jpg', 'jpeg', 'png', 'webp', 'gif'];
|
||||
|
||||
public function handle(WebsiteIntake $intake): void
|
||||
{
|
||||
$public = Storage::disk('media_public');
|
||||
|
||||
try {
|
||||
$files = $public->allFiles('cms');
|
||||
} catch (Throwable) {
|
||||
return;
|
||||
}
|
||||
|
||||
sort($files);
|
||||
|
||||
foreach ($files as $path) {
|
||||
if (! $this->isImage($path) || WebsiteMediaAlias::query()->where('legacy_path', $path)->exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$bytes = $public->get($path);
|
||||
|
||||
if (! is_string($bytes) || $bytes === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hash = hash('sha256', $bytes);
|
||||
$twin = WebsiteMediaAlias::query()->where('sha256', $hash)->first();
|
||||
|
||||
if ($twin instanceof WebsiteMediaAlias) {
|
||||
WebsiteMediaAlias::query()->create(['legacy_path' => $path, 'content_element_id' => $twin->content_element_id, 'sha256' => $hash]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Storage::disk('cms_incoming')->put($path, $bytes);
|
||||
$element = $intake->acceptImage($path, self::titleFor($path));
|
||||
WebsiteMediaAlias::query()->create(['legacy_path' => $path, 'content_element_id' => $element->id, 'sha256' => $hash]);
|
||||
}
|
||||
}
|
||||
|
||||
/** „cms/platzhalter-karte-1-liyjqa.jpg“ → „Platzhalter Karte 1“ (ohne die angehängte Zufallskennung). */
|
||||
public static function titleFor(string $path): string
|
||||
{
|
||||
$name = pathinfo($path, PATHINFO_FILENAME);
|
||||
$name = preg_replace('/-[a-z0-9]{6}$/', '', $name) ?? $name;
|
||||
$title = trim(str_replace(['-', '_'], ' ', $name));
|
||||
|
||||
return $title === '' ? 'Website-Bild' : Str::title($title);
|
||||
}
|
||||
|
||||
private function isImage(string $path): bool
|
||||
{
|
||||
return str_starts_with($path, 'cms/')
|
||||
&& ! str_contains($path, '..')
|
||||
&& preg_match('#^cms/[A-Za-z0-9._\-/]+$#', $path) === 1
|
||||
&& in_array(strtolower(pathinfo($path, PATHINFO_EXTENSION)), self::EXTENSIONS, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Domain\Catalog\ContentElement;
|
||||
use App\Domain\Catalog\IdentityChange;
|
||||
use App\Domain\Media\WebsiteRelease;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PublishWebsiteMedia implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public int $elementId,
|
||||
public string $action,
|
||||
public ?int $actorId = null,
|
||||
) {}
|
||||
|
||||
public function handle(WebsiteRelease $release): void
|
||||
{
|
||||
$element = ContentElement::query()->find($this->elementId);
|
||||
|
||||
if (! $element instanceof ContentElement || ! in_array($this->action, ['release', 'withdraw'], true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->action === 'withdraw') {
|
||||
$this->deletePublicFile($element);
|
||||
$this->mark($element, $element->website_released_at?->toIso8601String(), null);
|
||||
$element->forceFill([
|
||||
'website_released_at' => null,
|
||||
'website_public_path' => null,
|
||||
])->save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$derived = $release->derivedPath($element);
|
||||
|
||||
if ($derived === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$target = $release->publicPath($element, $derived);
|
||||
$previous = $element->website_public_path;
|
||||
|
||||
Storage::disk('media_public')->put($target, Storage::disk('media_derived')->get($derived));
|
||||
|
||||
if (is_string($previous) && $previous !== $target && str_starts_with($previous, 'website/'.$element->id.'/')) {
|
||||
Storage::disk('media_public')->delete($previous);
|
||||
}
|
||||
|
||||
$this->mark($element, $element->website_released_at?->toIso8601String(), now()->toIso8601String());
|
||||
$element->forceFill([
|
||||
'website_released_at' => now(),
|
||||
'website_public_path' => $target,
|
||||
])->save();
|
||||
}
|
||||
|
||||
private function deletePublicFile(ContentElement $element): void
|
||||
{
|
||||
$path = $element->website_public_path;
|
||||
|
||||
if (! is_string($path) || ! str_starts_with($path, 'website/'.$element->id.'/') || str_contains($path, '..')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Storage::disk('media_public')->delete($path);
|
||||
}
|
||||
|
||||
private function mark(ContentElement $element, ?string $before, ?string $after): void
|
||||
{
|
||||
if ($before === $after) {
|
||||
return;
|
||||
}
|
||||
|
||||
IdentityChange::query()->create([
|
||||
'subject_type' => $element->getMorphClass(),
|
||||
'subject_id' => $element->id,
|
||||
'field' => 'website_released_at',
|
||||
'before' => $before,
|
||||
'after' => $after,
|
||||
'actor_id' => $this->actorId,
|
||||
'occurred_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||
use App\Domain\Cms\NavigationItem;
|
||||
use App\Domain\Cms\NavigationItemPolicy;
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PagePolicy;
|
||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use App\Domain\Media\FfmpegFilmTranscoder;
|
||||
use App\Domain\Media\FilmTranscoder;
|
||||
@@ -23,6 +25,9 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(FilmTranscoder::class, FfmpegFilmTranscoder::class);
|
||||
// Je Anfrage einmal den Index der öffentlich genannten Medien bilden, nicht je Karte.
|
||||
$this->app->scoped(PublicMaterialReader::class);
|
||||
$this->app->scoped(WebsiteImage::class);
|
||||
$this->app->singleton(WidgetRegistry::class, fn ($app): WidgetRegistry => new WidgetRegistry(
|
||||
array_map(fn (string $class) => $app->make($class), config('cms.widgets', [])),
|
||||
));
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
use App\Domain\Cms\Widgets\Types\HeadingWidget;
|
||||
use App\Domain\Cms\Widgets\Types\HeroWidget;
|
||||
use App\Domain\Cms\Widgets\Types\ImageTextWidget;
|
||||
use App\Domain\Cms\Widgets\Types\MediaCardWidget;
|
||||
use App\Domain\Cms\Widgets\Types\ProgramCardWidget;
|
||||
use App\Domain\Cms\Widgets\Types\ProseWidget;
|
||||
use App\Domain\Cms\Widgets\Types\TopicCardWidget;
|
||||
|
||||
return [
|
||||
|
||||
@@ -24,6 +27,9 @@
|
||||
ImageTextWidget::class,
|
||||
CardsWidget::class,
|
||||
CatalogCardsWidget::class,
|
||||
TopicCardWidget::class,
|
||||
MediaCardWidget::class,
|
||||
ProgramCardWidget::class,
|
||||
CallToActionWidget::class,
|
||||
FaqWidget::class,
|
||||
],
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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->text('website_credit')->nullable()->after('license_note');
|
||||
$table->string('website_alt')->nullable()->after('website_credit');
|
||||
$table->timestamp('website_released_at')->nullable()->after('website_alt');
|
||||
$table->string('website_public_path')->nullable()->after('website_released_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('content_elements', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'website_credit',
|
||||
'website_alt',
|
||||
'website_released_at',
|
||||
'website_public_path',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Zuordnung früherer CMS-Bildpfade (cms/…) zu Medien im Medienmanager. Additiv: Gespeicherte Revisionen und
|
||||
* die Dateien unter cms/ bleiben unverändert; die Zuordnung wird beim Darstellen gelesen.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('website_media_aliases', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('legacy_path')->unique();
|
||||
$table->foreignId('content_element_id')->constrained()->restrictOnDelete();
|
||||
$table->string('sha256', 64)->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('website_media_aliases');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use App\Jobs\ImportCmsImages;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
/**
|
||||
* Übernimmt die bisherigen CMS-Bilder (media_public, cms/…) in den Medienmanager. Die Migration läuft im
|
||||
* App-Container, der keine Medien schreibt; sie stößt deshalb nur den Job der Hintergrundverarbeitung an.
|
||||
* Der Job ist wiederholbar und löscht nichts.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// In Tests liegen echte Medien nicht vor; die Übernahme prüfen eigene Tests mit Testplatten.
|
||||
if (app()->runningUnitTests()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImportCmsImages::dispatch();
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Nichts zurückzunehmen: Die übernommenen Medien und Zuordnungen bleiben; die Tabelle entfernt die vorige Migration.
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -259,3 +259,57 @@ ### Wortmarke in Kopfzeile und Fußbereich
|
||||
**Offen:**
|
||||
- Eine Vektorfassung der Wortmarke fehlt; die Rasterfassung ist für die gezeigten Größen scharf (2x-Ableitung).
|
||||
- Bitte die Wortmarke in Kopf- und Fußbereich visuell abnehmen.
|
||||
|
||||
## 9. Korrektur: Abschnittsabstände vereinfacht (18.11.2026)
|
||||
|
||||
Branch `feature/abschnittsabstaende`, Commit `f511ad1`; CI 4842, Deploy 4843 auf `develop`, gearbeitet in einem separaten Worktree. Kein Merge nach `main`.
|
||||
|
||||
**Ersetzt** wurden:
|
||||
- „Abstand oben und unten“,
|
||||
- die Abweichung „Abstand oben“,
|
||||
- die versteckte Regel, die oben zwischen zwei Abschnitten ohne Fläche auf null setzte,
|
||||
- der Trenner „Zusätzlicher Abstand“.
|
||||
|
||||
**Neu** sind genau drei unabhängige Einstellungen: **Abstand oben**, **Abstand unten** und **Widget-Abstand**, jeweils mit den Stufen Kein Abstand, Kompakt, Normal und Großzügig. Gespeichert werden sie in der Abschnittshülle Version 2; Einzelheiten stehen in `cms-widget-registry.md` §11.
|
||||
|
||||
**Bestehende Seiten:** Hüllen der Version 1 werden beim Lesen übersetzt.
|
||||
|
||||
| Seite | Breiten | Ergebnis vor und nach dem Deploy |
|
||||
|---|---|---|
|
||||
| `/`, `/praevention`, `/designreferenz`, `/referenz-abschnitte`, `/premium-referenz`, `/t1-landingpage` | 1440 und 390 px | pixelgleich: Seitenhöhe, Lage jedes Abschnitts und Rasters, Innenabstände, Rasterabstände, Platzpositionen |
|
||||
| `/praevention-im-alltag` | 1440 und 390 px | erster Abschnitt oben +24,5 px bzw. +12 px, weil „Gering“ jetzt „Kompakt“ ist (gewollte Folge der vier Stufen) |
|
||||
|
||||
**Prüfung über den regulären Seitenkonfigurator:**
|
||||
- Angelegt wurde `/abstand-pruefung` (Seite 18) mit aufeinanderfolgenden Abschnitten:
|
||||
|
||||
| Abschnitt | Raster | oben / unten / Widget-Abstand |
|
||||
|---|---|---|
|
||||
| 1 | 4/4 | 0 / 0 / 0 |
|
||||
| 2 | 3:1 | 0 / 0 / 0 |
|
||||
| 3 | 4/4 | Kompakt / Normal / Normal |
|
||||
| 4 | 3:1 | Großzügig / 0 / Großzügig |
|
||||
| 5 | 3:1 | 0 / Kompakt / Kompakt |
|
||||
|
||||
- Die Gestaltung zeigt genau die drei Felder, „Abstand oben und unten“ gibt es nicht mehr.
|
||||
- Berechnete CSS-Werte (26 von 26 Prüfungen):
|
||||
|
||||
| Prüfung | 1440 px | 390 px |
|
||||
|---|---|---|
|
||||
| Stufen oben/unten (Kompakt / Normal / Großzügig) | 44,8 / 89,6 / 120 px | 24 / 48 / 72 px |
|
||||
| Stufen Widget-Abstand (Kompakt / Normal / Großzügig) | 18 / 36 / 56 px | 12 / 20 / 32 px |
|
||||
| Innenabstände und Rasterabstand je Abschnitt | wie eingestellt, Außenabstand jeweils 0 | wie eingestellt, Außenabstand jeweils 0 |
|
||||
| Inhalt 1 → 2 (0 + 0) | 0,0 px | 0,0 px |
|
||||
| Inhalt 2 → 3 (0 + Kompakt) | 44,8 px | 24 px |
|
||||
| Inhalt 3 → 4 (Normal + Großzügig) | 209,6 px | 120 px |
|
||||
| Inhalt 4 → 5 (0 + 0) | 0,0 px | 0,0 px |
|
||||
| Widget-Abstand 3:1 | nebeneinander 0 / 56 / 18 px | gestapelt 0 / 32 / 12 px |
|
||||
|
||||
**Tests:** 204 grün.
|
||||
- Neu:
|
||||
- Addition und Vorgaben,
|
||||
- Übersetzung aller Fälle der Version 1 (Abweichung, versteckte Regel, eigene Fläche, Linientrenner, leerer Abschnitt, Zusatzabstand),
|
||||
- Abweisung freier Werte für alle drei Felder.
|
||||
- Bewusst angepasst: Hüllenversion 2, neue Klassen, Prüfung freier Werte über die neuen Schlüssel.
|
||||
|
||||
**Vorgabe für neue Abschnitte:** oben und unten Kompakt, Widget-Abstand Normal. Damit bleibt der Abstand zwischen zwei neuen Abschnitten so groß wie bisher, und ein neuer erster Abschnitt beginnt näher an der Kopfzeile als vorher.
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# Einheitliche Medienverwaltung im CMS – Bericht
|
||||
|
||||
Branch `feature/cms-medienverwaltung`, Commits `7c63424` (Website-Ableitung) und `053a8d4` (Umstellung). Gearbeitet wurde in einem separaten Worktree, der Deploy lief über `develop` (CI 4859, Deploy 4860). Kein Merge nach `main`.
|
||||
|
||||
- Entscheidung: ADR-40.
|
||||
- Technik: `docs/architektur/medienzugriff-fuer-komponenten.md`, Abschnitt „Umsetzung im CMS“, und `cms-widget-registry.md` §§ 7 und 9.
|
||||
|
||||
## 1. Ergebnis
|
||||
|
||||
**Bildstellen:**
|
||||
- Alle Bildstellen des CMS verwenden den zentralen Medienbestand: Einstieg (Hero), Bild und Text, redaktionelle Karten, Premium-Karten (Kartenbild) und Abschnittshintergrund.
|
||||
- Gespeichert wird die Kennung des Mediums, nicht ein Pfad.
|
||||
- Öffentlich erscheint ein Bild nur mit Website-Freigabe (`WebsiteMedia`, Route `website.media`).
|
||||
- Die CMS-eigene Bildauswahl entfällt.
|
||||
|
||||
**Im Widget-Dialog** (Reiter „Medien“, beim Abschnitt „Gestaltung“):
|
||||
|
||||
| Funktion | Verhalten |
|
||||
|---|---|
|
||||
| Auswahl | Alle Bilder des Medienmanagers, durchsuchbar, mit Vorschaubild, Titel und Website-Status (freigegeben, nicht freigegeben, wird verarbeitet) |
|
||||
| Neues Bild hochladen | Das Bild wird sofort im Medienmanager angelegt (`WebsiteIntake`) und ausgewählt. Nach der Verarbeitung gibt die Warteschlange es automatisch für die Website frei. |
|
||||
| Gewähltes Bild | Vorschaubild, Status mit Begründung und „Im Medienmanager öffnen“ (dort steht die Website-Freigabe) |
|
||||
| Austauschen | Ein anderes Bild in der Auswahl wählen; Bildausschnitt und Darstellung bleiben im Widget |
|
||||
| Alternativtext | Kommt aus dem Medium. Das Feld im Widget ist eine optionale Abweichung. |
|
||||
|
||||
**Medienmanager:** Die Medienansicht nennt jetzt die Website-Seiten, die das Bild verwenden. Beim Zurücknehmen der Freigabe weist sie darauf hin, dass das Bild dort verschwindet.
|
||||
|
||||
**Nicht freigegeben:** Öffentlich entfällt nur das Bild; Überschrift, Text und Schaltflächen des Widgets bleiben. Die Redaktionsvorschau zeigt das Vorschaubild mit dem Hinweis, warum es öffentlich nicht erscheint und wo die Freigabe steht.
|
||||
|
||||
**Website-Ableitung:** Bilder werden bis 2400 px breit abgeleitet statt in 640 px Vorschaugröße und nie vergrößert. Transparente Flächen werden weiß. Filmstandbilder bleiben bei 640 px. Diese Änderung betrifft Lars' `ThumbnailDeriver` und liegt deshalb in einem eigenen Commit.
|
||||
|
||||
## 2. Übernahme der Bestandsmedien (Testinstanz)
|
||||
|
||||
Der Job `ImportCmsImages` wurde beim Deploy von einer Migration angestoßen und von der Warteschlange ausgeführt. Ergebnis, lesend geprüft:
|
||||
|
||||
- **21 frühere Bilddateien** unter `cms/`, bytegleich zusammengefasst zu **9 Medien**: Felix und die Einkäufe (Intro), Lara Felix Park (Original), Platzhalter Bild Text, Platzhalter Karte 1, 2 und 3, Platzhalter Markenbühne, Prüfbild, Testplatzhalter Hintergrund.
|
||||
- Alle 9 Medien sind abgeleitet und freigegeben. Es gibt keine offenen und keine fehlgeschlagenen Jobs.
|
||||
- Gelöscht wurde nichts. Die Dateien unter `cms/` und alle Revisionen bleiben unverändert.
|
||||
- Frühere Pfade gelten über `website_media_aliases` als das jeweilige Medium. Beim nächsten Speichern wird die Kennung eingetragen.
|
||||
|
||||
## 3. Prüfung
|
||||
|
||||
| Prüfung | Ergebnis |
|
||||
|---|---|
|
||||
| Testsuite | 245 grün, davon neu: 8 Tests für die Medienanbindung und 2 für die Ableitungsgröße. Bewusst geändert: Die Alt-Text-Pflicht im Widget entfällt, weil der Alternativtext zum Medium gehört. |
|
||||
| Bestehende Seiten vor und nach Deploy und Übernahme | Geometrie unverändert (16 Messungen: 8 Seiten bei 1440 und 390 px), Texte unverändert (12 Seiten). Alle 16 Bilder auf 5 Seiten kommen jetzt über `/website-medien/`, sind geladen und haben dieselben Maße und Alternativtexte (zuvor `/medien/cms/`). Frühere Revisionen werden damit korrekt dargestellt. |
|
||||
| Browser auf der Testinstanz, Redaktionsablauf (13 von 13) | siehe Liste darunter |
|
||||
| Browser auf der Testinstanz, Freigabe zurücknehmen (8 von 8) | siehe Liste darunter |
|
||||
| Slideshow | Im CMS gibt es keine Slideshow. Neue Widget-Arten waren nicht Teil des Auftrags. `WebsiteMedia::presentMany` ist vorbereitet, aber noch unbenutzt. |
|
||||
|
||||
**Redaktionsablauf, Prüfkonto, regulärer Seitenkonfigurator, Entwurfsseite, nichts veröffentlicht:**
|
||||
- Vorhandenes Bild aus dem Medienmanager im Einstieg gewählt; Picker und Statusanzeige mit Vorschaubild und Verweis.
|
||||
- Übernommene Platzhaltergrafik („Platzhalter Markenbühne“) durch „Platzhalter Bild Text“ ersetzt.
|
||||
- Neues Bild direkt im Dialog hochgeladen: Es war sofort ausgewählt, zuerst mit „Wird gerade verarbeitet“, danach freigegeben. Im Medienmanager per Suche auffindbar; dessen Ansicht nennt die verwendende Seite.
|
||||
- Dasselbe Medium in Einstieg und Karte verwendet.
|
||||
- Gespeichert, wieder geöffnet, Vorschau: alle Bilder über `/website-medien/`, geladen, 1200 bis 1600 px breit.
|
||||
|
||||
**Freigabe zurücknehmen, auf `/premium-referenz`, danach wiederhergestellt:**
|
||||
- Die Medienansicht nennt die Seite.
|
||||
- Nach dem Zurücknehmen fehlt das Bild öffentlich; die übrigen 6 Bilder bleiben.
|
||||
- `/website-medien/15` und die frühere Adresse `/medien/cms/…` liefern 404.
|
||||
- Nach der erneuten Freigabe ist der Ausgangszustand wieder da; Geometrie und Bilder entsprechen dem Stand vorher.
|
||||
|
||||
**Auf der Testinstanz neu angelegt:**
|
||||
- das Medium „Platzhalter Upload Medienpruefung“ (gekennzeichneter Platzhalter),
|
||||
- die Entwurfsseite `/medien-pruefung-entwurf`.
|
||||
|
||||
Beides lässt sich über den Medienmanager bzw. die Seitenverwaltung entfernen.
|
||||
|
||||
## 4. Offene Punkte für Lars
|
||||
|
||||
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.
|
||||
5. **Rollback:** Eine Code-Fassung vor der Umstellung zeigt Bilder nicht, die danach gespeichert wurden (Kennung statt Pfad). Texte bleiben, die Dateien unter `cms/` bleiben (Registry §9).
|
||||
6. **Bedienmuster:** Die Bildauswahl des Modul- und Programmeditors ist an dessen Seite gebunden und ließ sich nicht als Formularfeld wiederverwenden. Das Bedienmuster (Suche, Vorschaubild, Auswahl) ist übernommen, die Abfrage greift auf denselben Bestand zu.
|
||||
@@ -0,0 +1,170 @@
|
||||
# Premium-Karten v1.7 im CMS – Bericht (18.11.2026)
|
||||
|
||||
Branch `feature/premium-karten`, gearbeitet in einem separaten Worktree. Deploy ausschließlich über `develop` (Testinstanz, Port 3011). **Kein Merge nach `main`.** Entscheidung: ADR-39; Technik: `docs/architektur/cms-widget-registry.md` §13.
|
||||
|
||||
Grundlage: `docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf`. Das Kit ist ein **Entwurf zur visuellen Freigabe**. `FREIGABE.md` führt alle drei Varianten als „zur visuellen Freigabe“. Aus der Integration folgt keine Freigabe.
|
||||
|
||||
## 1. Ergebnis
|
||||
|
||||
Redakteure können die drei Kartenarten in regulären Abschnitten einsetzen, mit bestehenden Fachobjekten verbinden und gestalten, ohne Code zu ändern:
|
||||
|
||||
| Widget | Fachobjekt | Öffentlich sichtbar | Aktion |
|
||||
|---|---|---|---|
|
||||
| Themenkarte | veröffentlichtes Thema (Säule) | ja | „Thema entdecken“ → `/themen/{slug}` |
|
||||
| Medien- und Materialkarte | Inhaltselement mit bereitgestellter Fassung | nur als Bestandteil eines öffentlichen Programms, sonst nur in der Redaktionsvorschau | „Im Programm ansehen“ → Programmseite |
|
||||
| Programm- oder Modulkarte | Programm oder Modul mit Anzeigefreigabe | Programme ja, Module nur in der Redaktionsvorschau | „Programm ansehen“ → `/programme/{id}`; Module ohne Aktion |
|
||||
|
||||
- **Gespeichert** werden nur Kennungen, Bild, Alternativtext, Bildausschnitt, die Beschriftung der Aktion und ein kurzer Hinweis. Titel, Beschreibung, Art und Linkziel liest die Karte bei jeder Darstellung aus den Fachdaten. Eine Änderung am Thema oder Programm erscheint deshalb ohne Seitenbearbeitung.
|
||||
- **Gestaltung:**
|
||||
- Variante: Anpassend (ab 520 px Bild neben Text) oder Bild immer oben.
|
||||
- Höhe: Natürlich oder An die Zeile angleichen.
|
||||
- Bildformat: 16:9, 1:1 oder 3:4.
|
||||
- Bilddarstellung: Ausschnitt oder ganzes Bild.
|
||||
- Bildausschnitt in Prozent.
|
||||
- Überschriftenebene: H2, H3 oder H4.
|
||||
- Ein- und Ausblenden von Kurzbeschreibung, Art, Zusatzangaben und Aktion.
|
||||
- **Raster:**
|
||||
- Eine Karte je Platz im bestehenden Abschnittsraster; es gibt kein zweites Kartenraster.
|
||||
- Neu sind die Raster 1 + 1 + 2 und 2 + 1 + 1. Bestehende Raster und Kennungen sind unverändert.
|
||||
- **Keine Freigabe geschützter Inhalte:**
|
||||
- keine Vorschaubilder der Bibliothek
|
||||
- keine Adressen unter `/bereich/` oder `/redaktion/`
|
||||
- kein Abspielen, kein Download
|
||||
- kein Preis, keine Kaufaktion
|
||||
|
||||
## 2. Prüfungen
|
||||
|
||||
| Prüfung | Ergebnis |
|
||||
|---|---|
|
||||
| Testsuite (`php artisan test`) | 212 grün, davon 8 neu in `CmsPremiumCardsTest` |
|
||||
| CI Feature-Branch / Deploy Testinstanz | 4846 / 4847 erfolgreich (Code); Folgecommits siehe Git-Verlauf |
|
||||
| Bestehende Seiten vor und nach dem Deploy | unverändert: 16 Messungen (8 Seiten × 1440/390 px), Lage und Maße aller Abschnitte und Plätze; 12 Textschnappschüsse des Hauptbereichs |
|
||||
| Lokale Probe des Redaktionsablaufs (Wegwerfdatenbank) | 114 von 114 Prüfungen. Abläufe: Thema veröffentlichen; Entwurfsseite anlegen mit 1 + 1 + 2, 2 + 2, 4/4, 1 + 1 + 1 + 1 und 1 + 3; Karte wieder öffnen und bearbeiten; speichern; Redaktionsvorschau; veröffentlichen. Messung bei 1440, 1024, 768 und 390 px: gleiche Höhe je Zeile, Bild neben Text genau ab 520 px Kartenbreite, keine Karte schmaler als 240 px, kein Überlauf, keine geschützten Adressen. **Gilt nicht als Abnahme auf der Testinstanz.** |
|
||||
| Redaktionsablauf auf der Testinstanz | **offen.** Das Skript ist fertig, in dieser Sitzung fehlten die Zugangsdaten des Prüfkontos. |
|
||||
|
||||
**Feature-Tests** (`tests/Feature/CmsPremiumCardsTest.php`):
|
||||
- Fachbezug ohne Kopie: Die Revision enthält nur Kennungen; Namensänderungen erscheinen sofort.
|
||||
- Rückzug: Wird ein Thema zurückgezogen oder ein Element archiviert, verschwindet die Karte.
|
||||
- Programmkarten benennen ihre Art, ohne Bild über die Navy-Tafel. Module erscheinen nur in der Vorschau, mit Hinweis. Kein Preis, keine Kaufbegriffe.
|
||||
- Medienkarten:
|
||||
- erscheinen öffentlich nur über ein öffentliches Programm, mit Link auf die Programmseite;
|
||||
- geben keine Bibliotheksvorschau, keine geschützte Adresse, kein Video und keinen Inhalt aus;
|
||||
- zeigen keine Kurzbeschreibung.
|
||||
- Abweisung:
|
||||
- nicht veröffentlichter oder nicht freigegebener Objekte;
|
||||
- eines Bildes ohne Alternativtext;
|
||||
- freier Einstellungswerte.
|
||||
- Gemischte Raster (1 + 1 + 2, 2 + 2): gleiche Höhe, Bildformat, Bildausschnitt, Variante, Optionen, lange Texte ungekürzt.
|
||||
- Redaktionsablauf über den Editor (Livewire):
|
||||
- alle drei Karten anlegen; als Entwurf gespeichert;
|
||||
- wieder öffnen; Dialog mit den Reitern Inhalt, Medien und Darstellung;
|
||||
- Live-Vorschau; erneut speichern; veröffentlichen.
|
||||
|
||||
## 3. Grenzen und offene Punkte
|
||||
|
||||
1. **Öffentliche Felder der Medienkarte (Entscheidung von Lars).** Heute nennt nur die Programmseite Bestandteile, und zwar nur mit Titel.
|
||||
- Die Karte zeigt öffentlich den Titel (Anzeigetitel, sonst Arbeitstitel), die Inhalts- und Ausgabeart und die Programmzugehörigkeit.
|
||||
- Die Kurzbeschreibung bleibt aus.
|
||||
- Zu prüfen: ob bei Traineranleitungen schon der Titel öffentlich sein darf.
|
||||
2. **ADR-29 (öffentliche Profile).** Bis dahin sind Module und Medien ohne öffentliches Programm nur in der Redaktionsvorschau sichtbar. Profile ersetzen später die Übergangsregeln in `PublicCatalogReader` und `PublicMaterialReader`; gespeicherte Karten bleiben gültig.
|
||||
3. **Gestalterische Freigabe v1.7** und freigegebene Motive. Auf der Testinstanz stehen nur gekennzeichnete Platzhalterbilder.
|
||||
4. **Zusatzangaben** gibt es nur, soweit die Fachdaten sie hergeben: Ausgabeart, Programmzugehörigkeit, Modulanzahl. Laufzeit, Altersangabe oder Seitenzahl fehlen in den Fachdaten.
|
||||
5. **Gleiche Höhe** wird je Karte eingestellt, nicht je Abschnitt. Alle Karten einer Zeile müssen „An die Zeile angleichen“ tragen.
|
||||
6. **Entfallende Plätze.** Eine öffentlich nicht sichtbare Karte (Modul) lässt ihren Platz entfallen; die übrigen Plätze teilen sich die Breite. Hinweis für die Redaktion in §13 der Registry-Dokumentation.
|
||||
7. **Kaufbare Angebotskarte: offener Bedarf.** Die Karten tragen bewusst keinen Preis und keine Kaufaktion. Eine Angebotskarte braucht ein eigenes Fachobjekt „Angebot“ mit Umfang, Zweck, Lizenzbedingungen und Preisquelle aus dem kommerziellen System. Sie ist gesondert zu konzipieren (Zielkonzept: „Angebotskarte … Neu konzipieren“, Lizenzvergleich).
|
||||
8. **Validierungsmeldungen** sind teils englisch, weil `lang/de` fehlt. Das ist bekannt und unverändert.
|
||||
|
||||
## 4. Abweichungen vom Kit
|
||||
|
||||
- Kein Beispielraster (`.lf-pc-grid`) und keine Spannweitenklassen; das Abschnittsraster ist das einzige Raster.
|
||||
- Umschaltung bei 520 px über den Platz-Container.
|
||||
- Keine H1.
|
||||
- Gelber Akzent als SVG-Komponente.
|
||||
- Schriftgewicht 600 statt 750, weil nur vorhandene Schnitte verwendet werden.
|
||||
- Bildhöhe höchstens min(70vh, 640 px).
|
||||
- Karten, die nur in der Vorschau erscheinen, mit gestricheltem Rand.
|
||||
|
||||
## 5. Fachliche Nachbesserung nach der Betreiberprüfung (18.11.2026)
|
||||
|
||||
Branch `feature/premium-karten-nachbesserung`, separater Worktree, Deploy nur über `develop`. Keine neue Widget-Art, keine neuen Fachobjekte, keine Migration, keine Änderung an Lizenz- oder Kaufrechten.
|
||||
|
||||
**Ursache „keine Themen“.** Die Themenkarte bot nur veröffentlichte Säulen an. Auf der Testinstanz gibt es fünf Säulen (lesende Abfrage am 18.11.2026), keine ist veröffentlicht, keine hat eine öffentliche Adresse oder einen Text für die Website. Jetzt sind alle Säulen wählbar; öffentlich gilt unverändert die Regel der Themenseiten (veröffentlicht und mit Adresse).
|
||||
|
||||
**Datenstand der Testinstanz (lesend geprüft):**
|
||||
- 5 Säulen, unveröffentlicht, ohne Website-Text; Säule 1 hat ein zugeordnetes Medium, Säule 2 eine veröffentlichte Seite.
|
||||
- Film „Lara im Park“: bereitgestellte Fassung, Filmstandbild (aus dem Film bei 41,5 s), Beschreibung vorhanden, **keine Kurzbeschreibung und kein Anzeigetitel**; Bestandteil von „Programm Abstand“ (über Modul Abstand) und der UX-Prüfung, beide öffentlich.
|
||||
- Zwei weitere Filme nur als Entwurf; Textmaterialien ohne Inhaltsart; eine gesperrte Traineranleitung.
|
||||
- Module mit Lernziel, Dauer und Materialhinweis; zwei Module mit Vorschaubild; keine Kurzbeschreibungen außer einem Entwurfsmodul.
|
||||
- Keine Laufzeiten in den Mediendaten (Metadaten nur `file`, `held`).
|
||||
|
||||
### Themenkarte
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Verfügbare Fachdaten | Name, öffentliche Adresse, Text für die Website, Veröffentlichung, zugeordnete Seiten und Medien |
|
||||
| Dargestellt | Name, Text für die Website, „N Seiten zum Thema“ (veröffentlichte Seiten), Aktion auf `/themen/{slug}` |
|
||||
| Redaktion | alle Säulen wählbar, mit Status „veröffentlicht“ / „nicht veröffentlicht, nur Redaktionsvorschau“; Vorschau mit Hinweisen auf fehlenden Text und fehlendes Kartenbild |
|
||||
| Fehlt | auf der Testinstanz: Veröffentlichung, Adresse und Text aller Säulen (Pflege unter „Fachliche Säulen“) |
|
||||
| Bewusst | kein Themenbild aus Medien des Themas (geschützt); Bild nur als Kartenbild aus dem öffentlichen Website-Bereich |
|
||||
|
||||
### Medien- und Materialkarte
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Verfügbare Fachdaten | Arbeits- und Anzeigetitel, Kurzbeschreibung, Beschreibung, Einsatzhinweis, Lizenzvermerk, Inhaltsart, Ausgabeart, Fassungsstatus, Vorschaubild (Filmstandbild, geschützt), Programmzugehörigkeit |
|
||||
| Dargestellt | **Film:** Titel, Kurzbeschreibung, Inhalts- und Ausgabeart, „Im Programm …“, „Vollständiger Film nur mit Lizenz im Mitgliederbereich“, Filmtafel; Aktion auf die öffentliche Programmseite. **Material:** eigene Darstellung mit Materialsymbol, Titel, Kurzbeschreibung, Art. **Vorschau:** Filmstandbild der Bibliothek mit Marke „Bibliotheksbild · nur Vorschau“ |
|
||||
| Unterschieden | öffentliche Filmvorschau: **gibt es fachlich noch nicht** (keine eigene Ausgabe, keine Freigabe); geschützter vollständiger Film: nie über die Karte, nur Hinweis; Film ohne freigegebenes Vorschaumaterial: öffentlich Filmtafel oder redaktionelles Kartenbild |
|
||||
| Redaktion | Filme und Materialien mit Entwurfs- oder bereitgestellter Fassung wählbar (gesperrte nicht), Sichtbarkeit in der Auswahl; Hinweise auf fehlende Kurzbeschreibung, Anzeigetitel, freigegebenes Bild |
|
||||
| Fehlt | Kurzbeschreibungen und Anzeigetitel in den Medien; Laufzeit in den Mediendaten; Freigabe von Vorschaubildern für die Website; öffentliche Filmvorschau (Erweiterungsbedarf: `cms-widget-registry.md` §13) |
|
||||
| Bewusst | Traineranleitungen nie öffentlich; nie öffentlich: Beschreibung, Einsatzhinweis, Lizenzvermerk, Dateien; kein Abspielen, kein Download |
|
||||
|
||||
### Programm- und Modulkarte
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Verfügbare Fachdaten | Bezeichnung, Anzeigetitel, Kurzbeschreibung, Inhaltsart, Fassungen mit Lernziel, Dauer, Materialhinweis, Anzeigefreigabe, Vorschaubild (geschützt), Bestandteile |
|
||||
| Dargestellt | Titel, Kurzbeschreibung (sonst Lernziel; auf der Programmseite bereits öffentlich), Art „Programm“/„Modul“, Zahl der Module, Dauer, Navy-Tafel; Aktion nur für Programme mit Anzeigefreigabe; Vorschau: Vorschaubild der Bibliothek, markiert |
|
||||
| Redaktion | Programme und Module mit bereitgestellter Fassung wählbar, auch ohne Anzeigefreigabe (nur Vorschau); Hinweise auf fehlende Kurzbeschreibung und Dauer |
|
||||
| Fehlt | Kurzbeschreibungen; öffentliche Modulseite (ADR-29, nicht Teil dieses Auftrags); Freigabe von Vorschaubildern |
|
||||
| Bewusst | kein künstlicher Link für Module; kein Materialhinweis öffentlich; kein Preis, keine Kaufaktion |
|
||||
|
||||
### Prüfungen der Nachbesserung
|
||||
|
||||
| Prüfung | Ergebnis |
|
||||
|---|---|
|
||||
| Testsuite | 214 grün (Kartentests 10, davon neu: Entwurf/ohne Freigabe nur in der Vorschau, unveröffentlichte Themen; erweitert: Film/Material, Traineranleitung, keine internen Felder, Bibliotheksbild nur in der Vorschau) |
|
||||
| Lokaler Redaktionsablauf mit nachgebildetem Datenstand der Testinstanz | 32 von 32: vorhandene Säule, Film, Material, Modul, Programm in 1 + 1 + 2, 2 + 2, 4/4, 1 + 1 + 1 + 1; speichern, wieder öffnen, bearbeiten, speichern; Vorschau bei 1440/1024/768/390 px (alle Karten mindestens 240 px, kein Überlauf, gleiche Höhe je Zeile); Entwurfsseite öffentlich nicht erreichbar. **Gilt nicht als Abnahme auf der Testinstanz.** |
|
||||
| Redaktionsablauf auf der Testinstanz (Prüfkonto, regulärer Seitenkonfigurator) | **32 von 32.** Die Auswahl bietet alle fünf Säulen und alle Filme und Materialien mit Sichtbarkeit an. Gewählt wurden „Meine Grenzen“, „Lara im Park“, ein Textmaterial, die Module „Freigabe mit Anleitung“ und „Modul Abstand“ sowie „Programm Abstand“, verteilt auf 1 + 1 + 2, 2 + 2, 4/4 und 1 + 1 + 1 + 1. Danach: Entwurf angelegt, wieder geöffnet, bearbeitet, gespeichert. Vorschau bei 1440/1024/768/390 px: alle 10 Karten, mindestens 240 px breit, kein Überlauf, gleiche Höhe je Zeile. Das Filmstandbild erscheint nur in der Vorschau, markiert. Die Entwurfsseite `/karten-nachbesserung-entwurf` (Seite 19) ist öffentlich nicht erreichbar (404). Es wurde nichts veröffentlicht. |
|
||||
|
||||
### Was die Karten mit den heutigen Daten der Testinstanz zeigen
|
||||
|
||||
- **Programmkarte „Programm Abstand“** (öffentlich): Titel, Lernziel als Text, „2 Module“, „Dauer 25 Min.“, Navy-Tafel, Aktion auf die Programmseite. Die vollständigste Karte.
|
||||
- **Filmkarte „Lara im Park“** (öffentlich über „Programm Abstand“): Titel, Filmtafel, „Film“, „Im Programm …“, Hinweis auf den geschützten Film, Aktion auf die Programmseite. **Kein Text, weil das Medium keine Kurzbeschreibung hat**; in der Vorschau zusätzlich das Filmstandbild, als nicht öffentlich markiert.
|
||||
- **Materialkarte „Trainerunterlage Abstand“** (öffentlich über „Programm Abstand“): Titel, Materialsymbol, „Text“, Programmbezug.
|
||||
- **Modulkarten**: nur in der Vorschau, mit Lernziel und Dauer; „Mod - eigene Grenzen erkennen“ mit Vorschaubild der Bibliothek (markiert).
|
||||
- **Themenkarten**: nur in der Vorschau, weil keine Säule veröffentlicht ist und keine einen Website-Text hat.
|
||||
|
||||
Die verbleibenden Lücken sind **fehlende Fachdaten, nicht fehlender Code**:
|
||||
|
||||
| Fehlt | Gepflegt unter |
|
||||
|---|---|
|
||||
| Kurzbeschreibung und Anzeigetitel der Medien | Medium bearbeiten → Anzeigetitel, Kurzbeschreibung |
|
||||
| Veröffentlichung, Adresse und Text der Themen | Fachliche Säulen → Öffentliche Adresse, Text für die Website, „Auf der Website veröffentlichen“ |
|
||||
| Kurzbeschreibung der Programme und Module | Programm/Modul → Kurzbeschreibung |
|
||||
| öffentliches Bild | Kartenbild im Reiter „Medien“ (freigegebenes Motiv), später Freigabe von Vorschaubildern (§13 der Registry) |
|
||||
|
||||
### Neu öffentlich und bewusst entschieden
|
||||
|
||||
- **Kurzbeschreibung von Medien** (Betreibervorgabe) und **Dauer von Programmen** („Dauer N Min.“): beide stehen bisher auf keiner öffentlichen Seite. Die Programmseite zeigt das Lernziel, nicht die Dauer.
|
||||
- **Vertraulichkeit hängt an der Inhaltsart.** Nie öffentlich sind Elemente mit der Inhaltsart „Traineranleitung“. „Trainerunterlage Abstand“ hat auf der Testinstanz keine Inhaltsart und gehört zu einem öffentlichen Programm. Die Karte ist deshalb öffentlich zulässig. Heute zeigt sie nur den Titel, der auf der Programmseite ohnehin steht. Eine später gepflegte Kurzbeschreibung würde öffentlich. **Vor dem Pflegen von Kurzbeschreibungen den Trainermaterialien die Inhaltsart „Traineranleitung“ zuordnen.**
|
||||
|
||||
### Offene Fragen an Lars
|
||||
|
||||
1. Soll die vorhandene „Beschreibung“ eines Mediums (zum Beispiel 215 Zeichen bei „Lara im Park“) öffentlich als Ersatz dienen, wenn keine Kurzbeschreibung gepflegt ist? Derzeit nein: Die Beschreibung ist Bibliothekstext.
|
||||
2. Freigabe von Vorschaubildern für die Website und öffentliche Filmvorschauen: minimaler Erweiterungsbedarf in `cms-widget-registry.md` §13.
|
||||
3. Öffentliche Sichtbarkeit auf der Testinstanz ist nicht live gezeigt, weil keine Hilfsseite veröffentlicht werden darf. Die Regeln belegen die Feature-Tests. Alternative: eine echte Seite mit Karten veröffentlichen.
|
||||
4. Die Entwurfsseite `/karten-nachbesserung-entwurf` (Seite 19) bleibt zur Ansicht in der Redaktionsvorschau stehen; danach über die Seitenverwaltung löschen.
|
||||
|
||||
### Prüfskript für die Testinstanz
|
||||
|
||||
Das Prüfskript ist `e2e_karten2.py` (im Arbeitsordner der Sitzung, nicht im Repository). Es veröffentlicht nichts und legt die Entwurfsseite `/karten-nachbesserung-entwurf` an. Diese Seite nach der Prüfung über die Seitenverwaltung löschen.
|
||||
@@ -59,6 +59,9 @@ ## Übersicht der Architekturentscheidungen
|
||||
| ADR-36 | Designsystem | Designprinzip fest; Tokens offen | Gemeinsame Design-Tokens für Website und Mitgliederbereich |
|
||||
| ADR-37 | n8n-Anbindung | Option / nicht beschlossen | n8n allenfalls für externe Kanäle, ohne direkten Datenbankzugang |
|
||||
| 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 |
|
||||
|
||||
---
|
||||
|
||||
@@ -499,3 +502,45 @@ ## ADR-38 – Gemeinsamer Layoutvertrag für Widget-Arten
|
||||
**Alternativen.** Je Widget eigene Breitenlogik im Editor; feste Pixelhöhen; Höhe als Abschnittseinstellung (verworfen: doppelte, widersprüchliche Einstellmöglichkeit neben Abstand und Raster).
|
||||
**Folgen und offene Prüfung.** Premium-Einstieg (`hero` Version 2) und Bild und Text (`image_text` Version 3) heben ältere Instanzen beim Lesen an; gespeicherte Revisionen bleiben unverändert. Ein Einstieg in einem Platz mit 2 Einheiten ist nicht mehr zulässig (vorher Mindestbreite 2; auf der Testinstanz kein Bestand betroffen). Bewusste Abweichungen vom Kit: Bildfokus als `data.focus_x/focus_y` (Einstellungen tragen nur Aufzählungswerte), Überschriftenebene „Automatisch/H2/H3“ statt freier H1 (genau eine H1 je Seite), Linkziele über die bestehende `SafeUrl`-Regel. Praktische Redaktionsabnahme (Bedienung, Bildzuschnitte mit freigegebenen Motiven) steht aus.
|
||||
**Quelle.** Brand-UI-Kit v1.6 (`docs/Brand-UI-Kit/12_premium_widgets_adaptiv_v1.6`, `docs/layout-profiles.json`); `docs/architektur/cms-widget-registry.md` §§2, 4, 12; ADR-30, ADR-36.
|
||||
|
||||
## ADR-39 – Premium-Karten mit Fachbezug
|
||||
|
||||
**Status am 18.11.2026:** Umgesetzt auf `develop`/Testinstanz (Branch `feature/premium-karten`). **Gestalterische Freigabe des Kits v1.7 offen** (`13_premium_karten_v1.7_entwurf/docs/FREIGABE.md`: alle drei Varianten „zur visuellen Freigabe“). Ergänzt ADR-30 und ADR-38.
|
||||
**Kontext.** Das Brand-UI-Kit v1.7 liefert drei Kartenvarianten (redaktionelle Themenkarte, Medien- und Materialkarte, Modul- und Programmkarte) als reine Darstellungskomponente mit eigenem Beispielraster. Im CMS sollen Redakteure diese Karten in regulären Abschnitten einsetzen, mit bestehenden Fachobjekten verbinden und gestalten, ohne Titel, Medienangaben, Programme oder Module zu kopieren und ohne geschützte Inhalte freizugeben.
|
||||
**Entscheidung.**
|
||||
- Drei Widget-Arten in der bestehenden Registry (`topic_card`, `media_card`, `program_card`) auf einer gemeinsamen Basis (`PremiumCardWidget`) mit einer Ansicht (`widgets/premium_card.blade.php`). Eine Karte je Widget, ein Widget je Platz; Spalten und Abstände bestimmt das Abschnittsraster. Das Beispielraster des Kits wird nicht übernommen.
|
||||
- `refs` speichert genau eine Kennung (Thema `pillar`, Inhaltselement `element`, Komposition `composition`) und optional ein Bild aus dem öffentlichen Website-Bereich. Titel, Kurzbeschreibung, Art, Zusatzangaben und Linkziel werden bei jeder Darstellung aus den Fachdaten gelesen. Redaktionell sind nur Bild, Alternativtext, Bildausschnitt, Beschriftung der Aktion und ein kurzer Hinweis.
|
||||
- Linkziel nur aus dem Fachobjekt: Themenseite eines veröffentlichten Themas, Programmseite eines öffentlichen Programms. Kein freies Linkziel, kein Download, kein Abspielen, kein Preis, keine Kaufaktion.
|
||||
- Sichtbarkeit (Übergangsregel bis ADR-29): Themen nur veröffentlicht; Programme nach `PublicCatalogReader`; Module nur in der Redaktionsvorschau; Medien und Materialien öffentlich nur, wenn sie zur gezeigten Fassung eines öffentlichen Programms gehören (dort sind sie heute schon öffentlich genannt), sonst nur in der Redaktionsvorschau (`PublicMaterialReader`). Von Medien wird keine Kurzbeschreibung gezeigt.
|
||||
- Gleiche Höhe je Zeile über die gemeinsame Höhe `fill` (ADR-38). Für gemischte Raster sind die Abschnittsraster 1 + 1 + 2 und 2 + 1 + 1 ergänzt (additiv, bestehende Kennungen unverändert).
|
||||
**Alternativen.** Ein Widget mit mehreren Karten und eigenem Spannweitenraster (verworfen: zweites Kartenraster neben dem Abschnittsraster); eine Widget-Art mit Variante je Fachobjekt (verworfen: Verweisschema hinge von der Variante ab); redaktionell gepflegte Kartentexte (verworfen: Kopien von Fachdaten); Vorschaubilder der Bibliothek als Kartenbild (verworfen: geschützt, Paket 6).
|
||||
**Nachbesserung (18.11.2026, nach Betreiberprüfung).** Themenkarten bieten alle Säulen an (nicht veröffentlichte nur für die Redaktionsvorschau). Medienkarten zeigen die Kurzbeschreibung des Mediums (auf ausdrücklichen Wunsch), unterscheiden Film (Filmtafel) und Material (Materialsymbol) und zeigen das geschützte Vorschaubild der Bibliothek nur in der Redaktionsvorschau. Traineranleitungen erscheinen nie öffentlich. Programm-/Modulkarten nutzen Lernziel und Dauer und lassen Programme/Module ohne Anzeigefreigabe für die Vorschau zu. Fehlende Inhalte erscheinen nur in der Vorschau als Hinweise.
|
||||
**Offene Entscheidungen.** (1) Freigabe von Vorschaubildern für die Website und öffentliche Filmvorschauen (minimaler Erweiterungsbedarf in `cms-widget-registry.md` §13). (2) Ob bei Traineranleitungen schon der Titel auf der Programmseite öffentlich sein soll (Programmseite, nicht Karte).
|
||||
**Folgen und offene Prüfung.** Keine Migration; bestehende Seiten und Widgets unverändert (gemessen). Mit ADR-29 ersetzen öffentliche Profile die Übergangsregeln in `PublicCatalogReader` und `PublicMaterialReader`; die gespeicherten Karten ändern sich dadurch nicht. Offen: gestalterische Freigabe v1.7, freigegebene Motive statt Platzhaltern, eine kaufbare Angebotskarte (eigenes Fachobjekt „Angebot“ mit Umfang, Zweck und Lizenzbedingungen, nicht Teil dieser Karten).
|
||||
**Quelle.** Brand-UI-Kit v1.7 (`docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf`, README, `docs/design-config.json`); `docs/architektur/cms-widget-registry.md` §§4, 6, 11, 13; ADR-29, ADR-30, ADR-38.
|
||||
|
||||
## 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); 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.
|
||||
|
||||
@@ -76,6 +76,9 @@ ## 4. Registrierte Widget-Arten
|
||||
| `image_text` | Bild und Text, Premium nach Kit v1.6 | 3 | `image_left`, `image_right` (Bildseite) | 1–4 | `compact`, `normal` (Vorgabe), `spacious` | `refs.image` |
|
||||
| `cards` | Redaktionelle Karten | 1 | `standard` (Raster), `compact` (Liste), `featured` (erste Karte hervorgehoben) | 1–4 | – | Bild je Karte in `data.items[].image` |
|
||||
| `catalog_cards` | Programm- und Modulkarten | 1 | `standard`, `compact` | 1–4 | – | `refs.items[] = {type: composition, id}` |
|
||||
| `topic_card` | Themenkarte, Premium-Karte nach Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.pillar`, `refs.image` |
|
||||
| `media_card` | Medien- und Materialkarte, Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.element`, `refs.image` |
|
||||
| `program_card` | Programm- oder Modulkarte, Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.composition`, `refs.image` |
|
||||
| `call_to_action` | Handlungsaufruf | 1 | `standard` | 1–4 | `auto` (Vorgabe), `fill` (Abschnittshöhe füllen) | – |
|
||||
| `faq` | FAQ | 1 | `standard` | 2–4 | – | – |
|
||||
|
||||
@@ -122,6 +125,11 @@ ## 6. Öffentliche Freigabe von Programmen und Modulen (Übergangsregel)
|
||||
|
||||
| Objekt | Im Editor wählbar | Öffentlich sichtbar | Redaktionsvorschau |
|
||||
|---|---|---|---|
|
||||
| Thema (Säule), veröffentlicht mit öffentlicher Adresse | ja (Themenkarte) | ja, mit Link auf `/themen/{slug}` | ja |
|
||||
| Thema, nicht veröffentlicht | ja (Themenkarte) | nein | ja, mit Hinweis „Nur Redaktionsvorschau“ |
|
||||
| Medium/Material, nicht archiviert, mit bereitgestellter Fassung, Bestandteil der gezeigten Fassung eines öffentlichen Programms, keine Traineranleitung | ja (Medienkarte) | ja, mit Link auf die Programmseite (dort ist es bereits öffentlich genannt) | ja |
|
||||
| Medium/Material ohne öffentliches Programm, nur mit Entwurfsfassung oder Traineranleitung | ja (nicht gesperrt) | **nein** | ja, mit Hinweis |
|
||||
| Programm oder Modul mit bereitgestellter Fassung, ohne Anzeigefreigabe | ja (nur Programm-/Modulkarte, nicht Katalogkarten) | nein | ja, mit Hinweis |
|
||||
| Programm mit Anzeigefreigabe, nicht archiviert | ja | ja, mit Link auf `/programme/{id}` (dieselbe Regel wie die bestehende Programmliste) | ja |
|
||||
| Modul mit Anzeigefreigabe, nicht archiviert | ja | **nein** | ja, mit Hinweis „Nur in der Redaktionsvorschau sichtbar“ |
|
||||
| Fassung ohne Anzeigefreigabe, Entwurf, archiviert, ohne Inhaltsart | nein (Speichern wird abgewiesen) | nein | nein |
|
||||
@@ -132,16 +140,19 @@ ## 6. Öffentliche Freigabe von Programmen und Modulen (Übergangsregel)
|
||||
|
||||
## 7. Medien
|
||||
|
||||
- Wählbar sind nur Bilder im öffentlichen Website-Bereich `cms/` (`media_public` bzw. noch nicht übertragene Uploads in `cms_incoming`). Bibliotheksmedien und Filmstandbilder erscheinen nicht, auch nicht als Abschnittshintergrund.
|
||||
- Neue Uploads (Widgets und Abschnittshintergründe) landen im Webprozess in `cms_incoming` (privater Speicher); `PublishPublicMedia` überträgt sie in der Hintergrundverarbeitung nach `media_public`. Der Web-Prozess schreibt nicht in den Medienbestand.
|
||||
- Widget-Bilder sind an einen Alternativtext gebunden (Ausnahme: Kartenbilder gelten als dekorativ, `alt=""`). Abschnittshintergründe sind dekorativ (`alt=""`); tragende Aussagen stehen als HTML-Text in den Widgets.
|
||||
Alle Bilder kommen aus dem zentralen Medienmanager (`docs/architektur/medienzugriff-fuer-komponenten.md`, Abschnitt
|
||||
„Umsetzung im CMS“). Gespeichert wird die Kennung des Mediums in `refs.image`, `data.items[].image` bzw.
|
||||
`style.image`; öffentlich erscheint ein Bild nur mit Website-Freigabe (`WebsiteMedia`, Route `website.media`).
|
||||
Gemeinsame Felder: `ImageRefFields` (Auswahl mit Vorschaubild und Status, Upload über `WebsiteIntake`, Anzeige des
|
||||
gewählten Mediums). Frühere Pfade unter `cms/` gelten über `WebsiteMediaAlias` als das übernommene Medium, ohne
|
||||
Zuordnung weiter als öffentliches CMS-Bild. Bibliotheksmedien ohne Website-Freigabe erscheinen öffentlich nie.
|
||||
|
||||
## 8. Editor und Vorschau
|
||||
|
||||
- Arbeitsfläche in voller Breite (`maxContentWidth = Full`); „Seite und Suchmaschinen“ ist beim Bearbeiten eingeklappt.
|
||||
- **Abschnitte** (Repeater): Kopfzeile „Abschnitt N · Raster 1 + 3 · Fläche · Widgets“; Aktionen Ziehen, nach oben/unten, Duplizieren, Löschen (mit Rückfrage), Einklappen, jeweils mit Tooltip.
|
||||
- **Raster**: grafische Auswahl mit sechs Kacheln. Raster mit weniger Plätzen als eingesetzten Widgets sind gesperrt. Beim Wechsel entfallen zuerst leere Plätze; Widgets behalten ihre Reihenfolge (`SectionEditor::arrangeSlots`). Kein Wechsel entfernt ein Widget.
|
||||
- **Gestaltung des Abschnitts** (eingeklappt, Zusammenfassung im Kopf): Hintergrund, Breite, Abstand oben und unten, **Abstand oben** (Abweichung: wie Abstand / gering / kein, zum Beispiel für einen Einstieg direkt unter der Kopfzeile; gespeichert als `style.spacing_top`, Vorgabe `same`), Trenner; bei Hintergrundbild zusätzlich Bild (Auswahl oder Upload), Fokuspunkt und Überlagerung. Abschnitts- und Widget-Einstellungen sind getrennt.
|
||||
- **Gestaltung des Abschnitts** (eingeklappt, Zusammenfassung im Kopf): Hintergrund, Breite, **Abstand oben**, **Abstand unten**, **Widget-Abstand** (je Kein Abstand / Kompakt / Normal / Großzügig, siehe §11), Trenner; bei Hintergrundbild zusätzlich Bild (Auswahl oder Upload), Fokuspunkt und Überlagerung. Abschnitts- und Widget-Einstellungen sind getrennt.
|
||||
- **Plätze** stehen im Verhältnis des Desktop-Rasters nebeneinander; Widgets lassen sich per Ziehen zwischen Plätzen tauschen. Der Platzkopf nennt Breite und warnt, wenn das Widget breiter sein müsste. Ein freier Platz bietet „Widget einsetzen“ (Auswahl mit Name, Beschreibung, Symbolbild, Mindestbreite), danach öffnet der Widget-Dialog. Ein Klick auf die Vorschau öffnet denselben Dialog: eine Dialogebene.
|
||||
- **Widget-Dialog**: Arten mit Darstellungsoptionen oder Medien gliedern den Dialog in die Reiter **Inhalt**, **Medien** und **Darstellung** (generisch aus der Registry: `editorSchema()`, `mediaSchema()`, Varianten und `settingOptions()`); andere Arten zeigen ihre Felder direkt. Varianten und Höhen sind sichtbare Auswahlknöpfe mit Symbol, Bildfokus zwei Schieberegler (0–100). „Darstellung“ nennt die zulässigen Platzbreiten und das Verhalten bei wenig Platz.
|
||||
- **Live-Vorschau im Dialog**: rendert den ungespeicherten Zustand mit derselben Ansicht wie die Website (`WidgetEditor::renderPreview`) in einer wählbaren logischen Platzbreite (Smartphone 390 px und die zulässigen Einheiten: 310/640/960/1300 px, entsprechend dem Standardabschnitt bei 1440 px Fensterbreite) und verkleinert sie auf die Dialogbreite. Die Breitenwahl wird nicht gespeichert.
|
||||
@@ -156,6 +167,11 @@ ## 8. Editor und Vorschau
|
||||
|
||||
## 9. Rollback und Datenformat (wichtig vor dem Merge nach `main`)
|
||||
|
||||
**Medien aus dem Medienmanager (ADR-40).** Revisionen, die nach der Umstellung gespeichert werden, enthalten im
|
||||
Bildschlüssel eine Kennung (Zahl) statt eines Pfads. Ein Code-Rollback auf eine Fassung davor zeigt diese Bilder nicht
|
||||
(die ältere Fassung kennt nur `cms/`-Pfade); Texte und Gestaltung bleiben. Die Dateien unter `cms/` und frühere
|
||||
Revisionen bleiben unverändert, die Zuordnungstabelle `website_media_aliases` ist additiv.
|
||||
|
||||
**Speicherung.** Jede neue Revision schreibt zwei Spalten:
|
||||
|
||||
| Spalte | Inhalt | Wer liest sie |
|
||||
@@ -187,6 +203,8 @@ ## 9. Rollback und Datenformat (wichtig vor dem Merge nach `main`)
|
||||
|
||||
Die Migrationen (`sections`, `parent_id`) sind ergänzend und müssen beim Rollback nicht zurückgenommen werden; älterer Code ignoriert beide Spalten.
|
||||
|
||||
**Abschnittshülle Version 2 (Abstände)** bringt keine Migration der Datenbank; ältere Hüllen werden beim Lesen übersetzt. Ein Code-Rollback auf eine Fassung vor Version 2 zeigt neue Hüllen mit den alten Vorgaben (Abstand normal), weil sie `spacing_bottom` und `gap` nicht kennt; Speichern im alten Editor weist diese Schlüssel ab. Der Wiederherstellungsweg oben gilt.
|
||||
|
||||
**Adaptive Widgets (ADR-38)** bringen keine Migration. Gespeichert werden ab jetzt `hero` Version 2 und `image_text` Version 3. Ein Code-Rollback auf Designiteration 1 stellt diese Hüllen „bestmöglich“ dar (höhere Version als im Code): unbekannte Varianten fallen auf die Vorgabe zurück, die data-Schlüssel sind unverändert; Höhe, Fläche, Label und Fokus werden nicht dargestellt, aber nicht gelöscht. Speichern im alten Editor ist für diese Hüllen nicht möglich, bis der neue Code wieder läuft.
|
||||
|
||||
**Designiteration 1** bringt keine Migration. Bei einem Code-Rollback auf Iteration 2 fallen die neuen Varianten beim Lesen auf die Vorgabe zurück (`stage`/`editorial` → `standard`, `featured` → `standard`); die neuen Einstellungen und `cta2_*` werden nicht dargestellt, aber nicht gelöscht. Seiten bleiben darstellbar; der Wiederherstellungsweg oben ist dafür nicht nötig. Ein reiner Code-Rollback ist nach redaktionellen Änderungen im neuen Editor **nicht** als sicher anzusehen; der Weg oben ist Teil jedes Rollbacks.
|
||||
@@ -202,12 +220,12 @@ ## 10. Navigation
|
||||
|
||||
## 11. Abschnitte und Plätze
|
||||
|
||||
Gespeicherte Hülle eines Abschnitts (`sections[]`, Version 1):
|
||||
Gespeicherte Hülle eines Abschnitts (`sections[]`, Version 2):
|
||||
|
||||
```json
|
||||
{"id": "uuid", "v": 1, "layout": "u1_3",
|
||||
"style": {"background": "dark", "image": null, "focus": "center", "overlay": "light",
|
||||
"width": "standard", "spacing": "normal", "divider": "line"},
|
||||
{"id": "uuid", "v": 2, "layout": "u1_3",
|
||||
"style": {"background": "dark", "image": null, "focus": "center", "overlay": "light", "width": "standard",
|
||||
"spacing_top": "compact", "spacing_bottom": "compact", "gap": "normal", "divider": "line"},
|
||||
"slots": [{"id": "…", "type": "cards", "v": 1, "…": "…"}, null]}
|
||||
```
|
||||
|
||||
@@ -218,6 +236,7 @@ ## 11. Abschnitte und Plätze
|
||||
| `u1_3` / `u3_1` | 1 + 3 / 3 + 1 | 1 : 3 / 3 : 1 | gestapelt | gestapelt |
|
||||
| `u1_2_1` | 1 + 2 + 1 | 1 : 2 : 1 | gestapelt | gestapelt |
|
||||
| `u1_1_1_1` | 1 + 1 + 1 + 1 | vier Spalten | 2 × 2 | gestapelt |
|
||||
| `u1_1_2` / `u2_1_1` | 1 + 1 + 2 / 2 + 1 + 1 | 1 : 1 : 2 / 2 : 1 : 1 | gestapelt | gestapelt |
|
||||
|
||||
- Die Einheiten werden als Spaltenverhältnis (`fr`) umgesetzt, nicht als zweites CSS-Grundraster. Der Umbruch richtet sich nach der Breite des Abschnitts (Container-Abfrage `section`); ein schmaler Abschnitt stapelt deshalb früher.
|
||||
- Gestapelt wird immer in Platzreihenfolge; Lese- und Fokusreihenfolge bleiben gleich (keine visuelle Umordnung).
|
||||
@@ -225,9 +244,28 @@ ## 11. Abschnitte und Plätze
|
||||
- **Gestaltung**: nur Aufzählungswerte (`SectionStyle`), abgebildet auf Tokens. Freie Werte (Farbcodes, CSS, unbekannte Schlüssel) werden abgewiesen.
|
||||
- Hintergrund: Standard, helle Markenfläche, dunkle Markenfläche, Markenakzent, Hintergrundbild. Jede Fläche setzt die Bedeutungs-Tokens neu (`scope-dark`, `scope-accent`, `scope-light`).
|
||||
- Breite: schmal (45 rem), Standard (75 rem), breit (90 rem), volle Breite. Der Hintergrund reicht immer über die ganze Bildschirmbreite.
|
||||
- Abstand: kompakt, normal (48 → 96 px), großzügig.
|
||||
- **Abstände (Version 2): genau drei unabhängige Werte**, je Kein Abstand / Kompakt / Normal / Großzügig:
|
||||
|
||||
| Wert | Bedeutung | Stufen (390 px → 1440 px) |
|
||||
|---|---|---|
|
||||
| `spacing_top` | Abstand oben (vor dem Inhalt) | 0 / 24 → 45 / 48 → 90 / 72 → 120 px (`--section-space-*`) |
|
||||
| `spacing_bottom` | Abstand unten (nach dem Inhalt) | wie oben |
|
||||
| `gap` | Widget-Abstand zwischen den Plätzen des Rasters, nebeneinander und gestapelt | 0 / 12 → 18 / 20 → 36 / 32 → 56 px (`--section-gap-*`) |
|
||||
|
||||
- Zwischen zwei Abschnitten addieren sich „unten“ des ersten und „oben“ des zweiten; 0 + 0 = 0. Es gibt keine weitere Vorgabe aus Seiten- oder Rasterhüllen (geprüft: kein Außenabstand der Abschnitte, `main` ohne Innenabstand).
|
||||
- Oben und unten sind der Innenabstand des Abschnitts. Bei eigener Fläche (dunkel, Akzent, Bild) liegen sie innerhalb der Fläche, damit Hintergründe nahtlos anschließen.
|
||||
- Vorgabe neuer Abschnitte: oben und unten Kompakt, Widget-Abstand Normal. Damit entspricht der Abstand zwischen zwei neuen Abschnitten dem bisherigen Normalabstand.
|
||||
- Abstände innerhalb eines Widgets (zum Beispiel zwischen Karten, `--grid-gap`) bleiben Sache des Widgets.
|
||||
- Trenner „Linie“ und „Markenakzent“ sind sichtbare Elemente zwischen zwei Abschnitten und bringen ihren eigenen kleinen Rand um die Linie mit (24 bzw. 8 px oben und unten).
|
||||
- **Version 1 → 2** (`SectionStyle::migrateSpacing`, beim Lesen; gespeicherte Revisionen bleiben):
|
||||
- „Abstand oben und unten“ wird zu oben und unten mit demselben Wert.
|
||||
- Die Abweichung „Abstand oben“ ersetzt nur oben: „kein“ → Kein Abstand, „gering“ → Kompakt. Die Stufe „gering“ gibt es nicht mehr; das ist die einzige sichtbare Änderung, auf der Testinstanz nur bei `/praevention-im-alltag`, +24 px.
|
||||
- Die frühere versteckte Regel „Abschnitt ohne Fläche direkt nach Abschnitt ohne Fläche: oben 0“ (ohne Linien- oder Akzenttrenner dazwischen, leere Abschnitte zählen nicht) wird als „oben: Kein Abstand“ ausgeschrieben.
|
||||
- Der Trenner „Zusätzlicher Abstand“ entfällt; er wird zu „Abstand unten“ eine Stufe höher.
|
||||
- Der Widget-Abstand wird Normal (der bisher feste Rasterabstand).
|
||||
- Messung auf der Testinstanz: sieben Seiten bei 1440 und 390 px vor und nach dem Deploy pixelgleich, außer der genannten Stelle.
|
||||
- Hintergrundbild: nur aus `cms/`, Fokuspunkt als `object-position` (neun Positionen), Überlagerung hell (84 % Weiß) oder dunkel (78 % Navy) oder keine. Das Bild des ersten Abschnitts lädt sofort, alle übrigen verzögert.
|
||||
- **Trenner** stehen zwischen Abschnitten, nie nach dem letzten: zusätzlicher Abstand, dezente Linie, Markenakzent (kurzer gelber Balken).
|
||||
- **Trenner** stehen zwischen Abschnitten, nie nach dem letzten: dezente Linie, Markenakzent (kurzer gelber Balken).
|
||||
- **Erstes Widget** der Seite ist der Seiteneinstieg (Überschrift erster Ordnung); seitenweit genau eine.
|
||||
- **Grenzen**: höchstens 30 Abschnitte und 60 Widgets je Seite; keine Verschachtelung.
|
||||
|
||||
@@ -248,9 +286,49 @@ ## 12. Responsive Widget-Regeln und gemeinsamer Layoutvertrag (ADR-38)
|
||||
| Fließtext | 1–4 | – | Zeilenlänge höchstens etwa 70 Zeichen, lange Adressen brechen um |
|
||||
| Redaktionelle Karten | 1–4 | – | so viele Karten nebeneinander, wie bei 15 rem Kartenbreite passen; hervorgehobene Karte ab 44 rem mit Bild neben dem Text |
|
||||
| Programm- und Modulkarten | 1–4 | – | ab 17 rem Kartenbreite mehrspaltig; eine einzelne Karte ab 40 rem mit Tafel neben dem Text |
|
||||
| Premium-Karten (Thema, Medium, Programm) | 1–4 | auto/fill | unter 520 px Platzbreite Bild oder Tafel über dem Text; ab 520 px Bild links (42 %), Text rechts (58 %), außer Variante „Bild immer über dem Text“; nutzbar ab etwa 240 px, empfohlen ab 280 px |
|
||||
| Handlungsaufruf | 1–4 | auto/fill | unter 20 rem Schaltfläche in voller Breite; Beschriftungen brechen um |
|
||||
| FAQ | 2–4 | – | Fragen untereinander, Antworten auf Lesebreite |
|
||||
|
||||
Gemessene Platzbreiten im Standardabschnitt (82 rem) bei 1440 px Fensterbreite: 1 Einheit etwa 301–319 px, 2 Einheiten 638 px, 3 Einheiten 957 px, 4 Einheiten 1312 px. Bei 1200 px Fensterbreite hat ein Platz mit 3 Einheiten 807 px; der Einstieg zeigt dort den Sicherheitsumbruch.
|
||||
|
||||
Ableitung: Bild und Text funktioniert dank gestapelter Darstellung auch in einer Einheit; der Einstieg braucht für seine Komposition mindestens etwa 860 px und ist deshalb nur für 3 oder 4 Einheiten freigegeben. Auf Tablet und Smartphone stapeln die Plätze; dort gelten die Breitenregeln nicht, die Widgets reagieren auf ihre Containerbreite.
|
||||
|
||||
## 13. Premium-Karten (Brand-UI-Kit v1.7, ADR-39)
|
||||
|
||||
Drei Widget-Arten auf der gemeinsamen Basis `App\Domain\Cms\Widgets\Types\PremiumCardWidget`, Ansicht `resources/views/widgets/premium_card.blade.php`, Stylesheet `resources/css/components/lf-premium-card.css` (aus `13_premium_karten_v1.7_entwurf/components/lf-premium-card.css` übernommen und angepasst). Das Kit ist ein **Entwurf zur visuellen Freigabe**; die Freigabe steht aus. Stand nach der fachlichen Nachbesserung vom 18.11.2026.
|
||||
|
||||
| Art | Fachobjekt (Lesesicht) | Wählbar | Gelesen | Bildbereich ohne Kartenbild | Aktion |
|
||||
|---|---|---|---|---|---|
|
||||
| Themenkarte `topic_card` | Säule (`Pillar`) | alle Säulen | Name, Text für die Website, Zahl veröffentlichter Seiten zum Thema | keiner | „Thema entdecken“ → `/themen/{slug}`, nur veröffentlicht |
|
||||
| Medien- und Materialkarte `media_card` | Inhaltselement (`PublicMaterialReader`) | nicht archiviert, mindestens eine nicht gesperrte Fassung | Anzeigetitel (sonst Arbeitstitel), Kurzbeschreibung, Inhaltsart, Ausgabeart, Programmzugehörigkeit; Film: Hinweis auf den geschützten vollständigen Film | Film: Filmtafel (Navy, Filmstreifen, kein Abspielsymbol); Material: Materialsymbol (Creme); Redaktionsvorschau: Vorschaubild der Bibliothek, markiert | „Im Programm ansehen“ → Programmseite, nur öffentlich |
|
||||
| Programm- oder Modulkarte `program_card` | Komposition (`PublicCatalogReader::subject`) | Programm/Modul, nicht archiviert, bereitgestellte Fassung | Anzeigetitel, Kurzbeschreibung (sonst Lernziel), Art, Zahl der Module, Dauer | Navy-Tafel mit Art; Redaktionsvorschau: Vorschaubild der Bibliothek, markiert | „Programm ansehen“ → `/programme/{id}`, nur Programme mit Anzeigefreigabe; Module ohne Link |
|
||||
|
||||
**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` (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).
|
||||
|
||||
**Redaktionsvorschau.** Nicht öffentliche Karten tragen die Marke „Nur Redaktionsvorschau“. Fehlende Inhalte (Kurzbeschreibung, Text für die Website, Anzeigetitel, Dauer, Laufzeit, Kartenbild) stehen eingeklappt unter „Hinweise für die Redaktion“, mit dem Ort, an dem sie gepflegt werden. Öffentlich erscheinen weder Marke noch Hinweise noch Bibliotheksbilder.
|
||||
|
||||
**Raster.** Eine Karte je Platz. Gemischte Raster entstehen über die Abschnittsraster, zum Beispiel 1 + 1 + 2 (`u1_1_2`), 2 + 2, 1 + 1 + 1 + 1. Gleiche Höhe: alle Karten einer Zeile auf „An die Zeile angleichen“ stellen; die Aktion steht dann am unteren Rand. Eine öffentlich nicht sichtbare Karte lässt ihren Platz entfallen; die übrigen Plätze teilen sich die Breite. Solche Karten daher in einen eigenen Abschnitt setzen oder mit einem Platz kombinieren, der allein gut aussieht.
|
||||
|
||||
**Sicherheit.** Der einzuhaltende Weg steht in `medienzugriff-fuer-komponenten.md`. Vorschaubilder der Bibliothek (Filmstandbilder, Modulvorschau) nur über `editorial.card` (Redaktionsanmeldung) und nur in der Redaktionsvorschau; öffentlich nie. Keine Adressen unter `/bereich/` oder `/redaktion/` auf öffentlichen Seiten, kein Abspielen, kein Download, kein Preis, keine Kaufaktion. Nie öffentlich: Beschreibung, Einsatzhinweis, Lizenzvermerk, Lehrtexte, Traineranleitungen. Eine Karte begründet keine Berechtigung (Tests `CmsPremiumCardsTest`).
|
||||
|
||||
**Erweiterungsbedarf für öffentliche Vorschaubilder und Filmvorschauen (nicht umgesetzt, minimal):**
|
||||
1. *Vorschaubild für die Website freigeben:* je `ContentElement` und `Composition` ein Freigabevermerk (`thumbnail_public_at`, `thumbnail_public_by`, Bezug auf `thumbnail_source`), gesetzt nur durch eine ausdrückliche Aktion „Vorschaubild für die Website freigeben“ in der Medien- bzw. Modulbearbeitung. Die Hintergrundverarbeitung kopiert das freigegebene Standbild nach `media_public` (eigener Pfad, zum Beispiel `katalog/`), Zurücknehmen löscht die Kopie. Die Karte nimmt dieses Bild, wenn kein Kartenbild gewählt ist. Der Web-Prozess schreibt weiterhin nicht in den Medienbestand.
|
||||
2. *Öffentliche Filmvorschau (Trailer, Ausschnitt):* eine eigene Ausgabe (`MediaRendition` mit Rolle `preview`) und eine eigene Freigabe je Fassung, getrennt vom lizenzpflichtigen Film; ausgeliefert ohne Signatur nur nach dieser Freigabe. Bis dahin hat die Karte keine Abspielfunktion.
|
||||
3. *Laufzeit:* ein Feld in den Mediendaten der Fassung (zum Beispiel `metadata.duration_seconds`, beim Transkodieren mit ffprobe ermittelt).
|
||||
Alle drei Erweiterungen hängen mit ADR-29 (öffentliche Profile) zusammen und brauchen eine Entscheidung von Lars.
|
||||
|
||||
**Abweichungen vom Kit (bewusst):**
|
||||
- Kein `.lf-pc-grid`/`.lf-pc-section`/Spannweitenklassen: Das Abschnittsraster ist das einzige Raster.
|
||||
- Umschaltung bei 520 px über den Platz-Container `slot` statt eines eigenen Kartencontainers.
|
||||
- Überschriftenebene ohne H1 (Karten sind nie Seiteneinstieg).
|
||||
- Gelber Akzent der Tafel als `components/brand/underline` (SVG); Schriftgewichte 600 statt 750 (vorhandene Schnitte).
|
||||
- Zusätzlich Filmtafel und Materialsymbol für Medien ohne freigegebenes Bild; Tafel neben dem Text mittig statt gestreckt.
|
||||
|
||||
**Grenzen.** Module haben keine öffentliche Seite (ADR-29) und erscheinen nur in der Vorschau. Medien öffentlich nur über ein öffentliches Programm. Keine öffentlichen Vorschaubilder ohne die oben beschriebene Freigabe. Eine **kaufbare Angebotskarte** gibt es nicht; sie braucht ein eigenes Fachobjekt „Angebot“ mit Umfang, Zweck und Lizenzbedingungen und wird gesondert konzipiert.
|
||||
@@ -76,6 +76,7 @@ ## 5. Typografie, Abstände, Maße
|
||||
| Abstände | Grundmaß 4 px: 4, 8, 12, 16, 24, 32, 48, 64, 96 px |
|
||||
| Rundungen | 8 (klein), 14 (Karte), 22 (Fläche), Pille |
|
||||
| Breiten | Lesebereich 44 rem, Standard 82 rem, Breit 96 rem, Vollbreite; Randabstand 16–40 px (siehe Abschnitt 12) |
|
||||
| Abschnittsabstände | `--section-space-{none,compact,normal,large}` (oben/unten) und `--section-gap-{none,compact,normal,large}` (Widget-Abstand); Bedeutung in `cms-widget-registry.md` §11 |
|
||||
| Trefferfläche | mindestens 44 × 44 px |
|
||||
| Fokus | 3 px Rahmen in `--color-focus`, 3 px Abstand, auf jeder Fläche sichtbar |
|
||||
|
||||
@@ -163,3 +164,11 @@ ## 13. Premium-Widgets (Brand-UI-Kit v1.6, ADR-38)
|
||||
| Label `#295b08` auf Creme; `#fff2b0` auf Navy | 7,5 / 13,4 : 1 |
|
||||
|
||||
Bildmotive des Kits (`09_hero_widget/assets`, `10_bild_text_widget/assets`) sind für die öffentliche Verwendung nicht freigegeben; sie wurden nur lokal für die Sichtprüfung verwendet.
|
||||
|
||||
## 14. Premium-Karten (Brand-UI-Kit v1.7, Entwurf, ADR-39)
|
||||
|
||||
- Komponente `lf-pc` mit Varianten `lf-pc--editorial` (ruhige Textaktion mit gelber Unterstreichung), `lf-pc--media` (Metadatenband, grüne Aktion `--lf-green-deep`), `lf-pc--catalog` (Navy-Tafel ohne Foto, Navy-Aktion).
|
||||
- Eigene helle Fläche (`--lf-white`, Rand `--lf-line`, Radius `--radius-panel`, Schatten `--shadow-raised`), auch in dunklen Abschnitten; Bildradius `--radius-card`.
|
||||
- Schriften: Titel `--font-display` 800, Text `--font-reading`; keine neuen Schriften.
|
||||
- Ab 520 px Platzbreite Bild 42 % neben Text 58 %; Bildformat 16:9, 1:1 oder 3:4 bleibt erhalten; kein line-clamp.
|
||||
- Status: Entwurf zur visuellen Freigabe; auf der Testinstanz nur mit gekennzeichneten Platzhalterbildern.
|
||||
@@ -0,0 +1,140 @@
|
||||
# Medienzugriff für CMS-Komponenten
|
||||
|
||||
**Stand:** 18.11.2026. Beschreibt den vorhandenen Weg. Keine neue Freigabe, kein zweites Rechtesystem.
|
||||
|
||||
Eine CMS-Komponente, die im Medienmanager liegt, ist ein Inhaltselement (`ContentElement`). Sie entscheidet den Zugriff nicht selbst. Sie ruft eine der drei vorhandenen Stellen auf, je nachdem, was sie tut.
|
||||
|
||||
## Drei getrennte Stellen
|
||||
|
||||
| Was die Komponente tut | Stelle | Was sie nicht tut |
|
||||
|---|---|---|
|
||||
| Anzeigedaten auf der Website lesen | `PublicMaterialReader` | keine Datei, keine Ausgabeadresse |
|
||||
| Datei an ein Mitglied ausliefern | `DecideAccess`, erneut bei jedem Abruf | keine eigene Erlaubnis, keine Vereinigung von Berechtigungen |
|
||||
| Ein öffentliches Bild zeigen, das kein Bestandsmedium ist | `PublicMedia` | keinen Pfad aus `originals/` oder `derived/` |
|
||||
|
||||
Die Pflege im Medienmanager ist eine vierte, nur redaktionelle Tür: Ansehen dürfen Redaktion und Katalogverwaltung, Ändern nur die Redaktion (`ContentElementResource`). Diese Tür gibt nichts auf der Website und nichts im Mitgliederbereich frei.
|
||||
|
||||
## Anzeige auf der Website
|
||||
|
||||
`PublicMaterialReader` ist die einzige Lesesicht für ein Medium auf einer öffentlichen Seite. Die Medienkarte nutzt sie bereits.
|
||||
|
||||
Öffentlich genannt wird ein Medium nur, wenn alle Punkte zutreffen:
|
||||
|
||||
- es ist nicht archiviert und hat mindestens eine nicht gesperrte Fassung,
|
||||
- es hat eine bereitgestellte Fassung,
|
||||
- die Inhaltsart ist nicht `traineranleitung`,
|
||||
- es gehört zur gezeigten Fassung eines öffentlich gezeigten Programms.
|
||||
|
||||
Solange öffentliche Profile (ADR-29) fehlen, ist das die Übergangsregel. Ein Medium hat keine eigene öffentliche Seite. Die Karte verweist dann auf die Programmseite.
|
||||
|
||||
Gelesen werden Anzeigename (sonst Arbeitstitel), Kurzbeschreibung, Inhaltsart und Ausgabeart. Nicht gelesen und nicht ausgegeben werden Beschreibung, Einsatzhinweis, Lizenzvermerk, Lehrtext und jede Datei.
|
||||
|
||||
Das Vorschaubild der Bibliothek erscheint nur in der Redaktionsvorschau, über die Route `editorial.card`, und nur für angemeldete Redaktion. Auf einer öffentlichen Seite hat dieses Bild keine Adresse.
|
||||
|
||||
## Auslieferung an Mitglieder
|
||||
|
||||
`DecideAccess` ist die einzige Entscheidung über eine Datei. Sie prüft an genau einer Berechtigung: aktives Konto, passender Artikel-Stand, Fassung im fixierten Inhalt dieses Stands, Fassung nicht gesperrt, Aktion im Rechte-Schnappschuss für die Ausgabeart. Zwei Berechtigungen werden nicht zu einer zusammengefügt.
|
||||
|
||||
Die Bibliothek ruft dieselbe Prüfung beim Aufbau der Seite und erneut beim Abruf auf (`LibraryController::media`, signierte Adresse, Leser gebunden). Eine Signatur, eine Karte oder eine gespeicherte Komponente ersetzen diesen zweiten Aufruf nicht.
|
||||
|
||||
Komponenten liefern Dateien nicht selbst aus. Sie bauen keine Adresse auf `content.file`, `content.preview`, `content.rendition` oder `/bereich/`.
|
||||
|
||||
## Öffentliche Bilder außerhalb des Bestands
|
||||
|
||||
Heute liegen Bilder, die nur zur Website gehören, unter dem Präfix `cms/` und laufen über `PublicMedia` und die Route `media.public`. Der Controller liefert nur Pfade, die mit `cms/` beginnen, von den Platten `media_public` und `cms_incoming`.
|
||||
|
||||
Dieser Pfad ist kein Zugang zum Medienmanager. Ein Inhaltselement wird darüber nicht ausgeliefert. Umgekehrt wird eine geschützte Bestandsdatei nicht in `cms/` gelegt, um sie öffentlich zu machen.
|
||||
|
||||
## Website-Medien für Hero, Teaser und Slideshow
|
||||
|
||||
Hero-Grafiken, Teaserfilme und Slideshows liegen im Medienmanager. Sie werden nicht verkauft. Lizenzartikel, Angebot, Grant und `DecideAccess` bleiben dafür unbenutzt.
|
||||
|
||||
Die Website-Freigabe ist eine eigene Entscheidung am Inhaltselement. Sie hängt nicht daran, dass eine Fassung bereit ist, und nicht daran, dass das Medium in einem öffentlichen Programm liegt. `PublicMaterialReader` bleibt die Lesesicht der Programmkarte. Widgets für Hero, Bild und Slideshow lesen `WebsiteMedia`.
|
||||
|
||||
| Aufruf | Klasse | Ergebnis |
|
||||
|---|---|---|
|
||||
| Ein Medium | `WebsiteMedia::present($elementOderId)` | `WebsitePresentation` oder `null` |
|
||||
| Slideshow, Reihenfolge bleibt | `WebsiteMedia::presentMany([$id, ...])` | nur freigegebene Einträge |
|
||||
|
||||
`WebsitePresentation` enthält `elementId`, `title`, `alt`, `credit`, `kind` (`bild` oder `film`) und `url`. `url` ist die einzige Dateiadresse, Route `website.media`. `credit` ist die öffentliche Quellenzeile. `license_note` steht dort nicht.
|
||||
|
||||
Ein Widget speichert die Kennung des Inhaltselements (`refs.element` oder bei einer Slideshow `refs.elements`), nicht einen kopierten Dateipfad. Ist `present` leer, gibt das Widget nichts aus. Vorhandene Bilder unter `cms/` bleiben gültig, bis das jeweilige Widget umgestellt ist.
|
||||
|
||||
### Neues Bild aus dem CMS
|
||||
|
||||
`WebsiteIntake::acceptImage($pfad, $titel, $quellenzeile, $alternativtext, $redakteur)` legt das Medium an und gibt seine Kennung sofort zurück. `$pfad` ist die bereits hochgeladene Datei auf `cms_incoming` und beginnt mit `cms/` oder `vorschau/`. Titel, Quellenzeile und Alternativtext werden am Medium gespeichert. Eine Inhaltsfassung entsteht dabei nicht.
|
||||
|
||||
Die Warteschlange liest die Datei, schreibt das JPEG nach `vorschau/element-{id}.jpg` und gibt danach genau diese Ableitung frei. `present` bleibt leer, bis das abgeschlossen ist. Eine unlesbare Datei bleibt im Eingang, das Medium trägt `thumbnail_error` und wird nicht freigegeben. Fehlt die Datei, liegt sie außerhalb des Eingangs oder fehlt der Titel, entsteht kein Medium.
|
||||
|
||||
Das CMS ruft dafür nicht `DeriveThumbnail` und nicht `WebsiteRelease` auf.
|
||||
|
||||
Freigeben und Zurücknehmen eines schon abgelegten Mediums stehen in der Medienansicht, Bereich Beschreibung (`WebsiteRelease`). Die Warteschlange kopiert die Ableitung nach `media_public` unter `website/{id}/datei.{endung}` und setzt `website_released_at`. Der Web-Prozess schreibt diese Datei nicht. Zurücknehmen löscht nur diese Kopie.
|
||||
|
||||
Was freigegeben werden kann:
|
||||
|
||||
- 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 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 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/`.
|
||||
|
||||
Eine Karte oder eine Komponente begründet keine Berechtigung.
|
||||
|
||||
## Umsetzung im CMS (19.11.2026, ADR-40)
|
||||
|
||||
Alle Bildstellen des CMS lesen den zentralen Medienbestand: Einstieg (Hero), Bild und Text, redaktionelle Karten,
|
||||
Premium-Karten (Kartenbild) und Abschnittshintergrund. Das CMS hat keine eigene Medienverwaltung mehr.
|
||||
|
||||
- **Gespeichert** wird die Kennung des Inhaltselements im jeweiligen Bildschlüssel: `refs.image` (Einstieg, Bild und
|
||||
Text, Premium-Karten), `data.items[].image` (redaktionelle Karten), `style.image` (Abschnittshintergrund).
|
||||
**Abweichung von `refs.element`:** Die Medienkarte verwendet `refs.element` bereits für ihr Fachobjekt; ein
|
||||
gemeinsamer Bildschlüssel `image` hält alle Widgets gleich und ändert die gespeicherte Struktur nicht.
|
||||
- **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:** 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).
|
||||
- **Auswahl:** alle Bilder (`output_class = bild`, nicht archiviert, keine Traineranleitung) mit Vorschaubild, Titel
|
||||
und Website-Status; das gewählte Medium mit Status und Verweis auf den Medienmanager. Die Bildauswahl des
|
||||
Modul-/Programmeditors ist an dessen Livewire-Seite gebunden und lässt sich nicht als Formularfeld einhängen; das
|
||||
Bedienmuster (Suche, Vorschaubild, Auswahl) ist übernommen.
|
||||
- **Alternativtext:** aus dem Medium (`website_alt`, sonst Titel). Das Feld im Widget ist eine optionale Abweichung.
|
||||
- **Website-Ableitung:** Bilder werden bis 2400 px breit abgeleitet (vorher 640 px), nie vergrößert.
|
||||
- **Medienmanager:** Die Medienansicht nennt die Website-Seiten, auf denen ein Bild verwendet wird
|
||||
(`WebsiteImageUsage`), damit vor dem Zurücknehmen sichtbar ist, welche Seiten das Bild verlieren.
|
||||
|
||||
### Übernahme der früheren CMS-Bilder
|
||||
|
||||
- Der Job `ImportCmsImages` (angestoßen von einer Migration, ausgeführt von der Warteschlange) nimmt jede Bilddatei
|
||||
unter `media_public/cms/` über `WebsiteIntake` auf. Bytegleiche Dateien werden ein Medium (SHA-256). Der Titel
|
||||
kommt aus dem Dateinamen ohne Zufallskennung. Nichts wird gelöscht; der Job ist wiederholbar.
|
||||
- `website_media_aliases` ordnet jeden früheren Pfad seinem Medium zu. **Wirksam** wird die Zuordnung erst, wenn das
|
||||
Medium einmal für die Website freigegeben war; bis dahin (oder wenn die Ableitung scheitert) gilt der frühere Pfad
|
||||
weiter, damit keine Seite ihr Bild verliert.
|
||||
- Danach entscheidet die Website-Freigabe des Mediums allein, auch über die frühere Adresse `/medien/cms/…`
|
||||
(404, wenn zurückgenommen).
|
||||
- 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.
|
||||
@@ -13,6 +13,8 @@
|
||||
/* Premium-Widgets nach Brand-UI-Kit v1.6; ersetzen das frühere Hero- und Bild-und-Text-CSS. */
|
||||
@import './components/lf-hero.css';
|
||||
@import './components/lf-bild-text.css';
|
||||
/* Premium-Karten nach Brand-UI-Kit v1.7 (Entwurf zur visuellen Freigabe): Themen-, Medien- und Programmkarte. */
|
||||
@import './components/lf-premium-card.css';
|
||||
|
||||
/*
|
||||
* Mitgliederbereich: eigene Anwendungsoberfläche mit eigener Navigation. Er verwendet die gemeinsamen
|
||||
|
||||
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* Premium-Karten (Themen-, Medien-, Programmkarte) – übernommen aus
|
||||
* docs/Brand-UI-Kit/13_premium_karten_v1.7_entwurf/components/lf-premium-card.css (Entwurf zur visuellen Freigabe).
|
||||
*
|
||||
* Anpassungen an das Repository:
|
||||
* - Eine Karte je Platz im bestehenden Abschnittsraster. Das Beispielraster des Kits (.lf-pc-grid, .lf-pc-section,
|
||||
* Spannweiten-Klassen) wird bewusst nicht übernommen; Spalten und Abstände bestimmt der Abschnitt.
|
||||
* - Breitenumschaltung bei 520 px über den Platz-Container „slot“ (eine Karte füllt ihren Platz), nicht über das Fenster.
|
||||
* - Gleiche Höhe je Zeile über die gemeinsame Höhe „fill“ (widgets.css), Aktion dann am unteren Rand.
|
||||
* - Schriften und Farben ausschließlich über vorhandene Tokens (tokens.css); keine neuen Schriften.
|
||||
* - Die Karte hat ihre eigene helle Fläche und setzt dafür die hellen Bedeutungswerte, auch in dunklen Abschnitten.
|
||||
* - Kein line-clamp, keine feste Höhe: lange Titel und Texte brechen um.
|
||||
*/
|
||||
.lf-pc,
|
||||
.lf-pc * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.lf-pc {
|
||||
--color-heading: var(--lf-navy);
|
||||
--color-text: var(--lf-ink);
|
||||
--color-text-muted: var(--lf-ink-muted);
|
||||
--color-border: var(--lf-line);
|
||||
--color-focus: var(--lf-focus);
|
||||
--pc-surface: var(--lf-white);
|
||||
--pc-subtle: var(--lf-cream);
|
||||
--pc-action: var(--lf-green-deep);
|
||||
--pc-action-hover: #2f6407;
|
||||
--pc-action-text: var(--lf-white);
|
||||
--pc-accent: var(--lf-yellow);
|
||||
--pc-ratio: 16 / 9;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: auto 1fr;
|
||||
min-inline-size: 0;
|
||||
inline-size: 100%;
|
||||
color: var(--color-text);
|
||||
background: var(--pc-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-panel);
|
||||
box-shadow: var(--shadow-raised);
|
||||
font: 400 1rem/1.55 var(--font-reading);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.lf-pc--square { --pc-ratio: 1 / 1; }
|
||||
.lf-pc--portrait { --pc-ratio: 3 / 4; }
|
||||
.lf-pc--landscape { --pc-ratio: 16 / 9; }
|
||||
.lf-pc--without-visual { grid-template-rows: 1fr; }
|
||||
|
||||
/* Gleiche Höhe je Zeile (Höhe „An die Zeile angleichen“): Karte füllt den gestreckten Platz. */
|
||||
.widget-height-fill > .lf-pc {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.lf-pc__visual {
|
||||
position: relative;
|
||||
min-inline-size: 0;
|
||||
align-self: start;
|
||||
margin: 10px 10px 0;
|
||||
}
|
||||
|
||||
.lf-pc__image {
|
||||
display: block;
|
||||
inline-size: 100%;
|
||||
block-size: auto;
|
||||
aspect-ratio: var(--pc-ratio);
|
||||
/* Breite gestapelte Karten (zum Beispiel 4 Einheiten, Hochformat) würden sonst über 1000 px hoch: Das Bild wird
|
||||
begrenzt, „Ganzes Bild“ bleibt vollständig (Rand), „Ausschnitt“ folgt dem Bildfokus. Text wird nie begrenzt. */
|
||||
max-block-size: min(70vh, 640px);
|
||||
object-fit: cover;
|
||||
object-position: var(--pc-focus-x, 66%) var(--pc-focus-y, 45%);
|
||||
border-radius: var(--radius-card);
|
||||
background: var(--pc-subtle);
|
||||
}
|
||||
|
||||
.lf-pc--contain .lf-pc__image {
|
||||
object-fit: contain;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.lf-pc__badge {
|
||||
position: absolute;
|
||||
inset: 12px auto auto 12px;
|
||||
max-inline-size: calc(100% - 24px);
|
||||
padding: 5px 10px;
|
||||
border-radius: var(--radius-pill);
|
||||
color: var(--lf-navy);
|
||||
background: var(--lf-white);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.lf-pc__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: start;
|
||||
min-inline-size: 0;
|
||||
padding: clamp(20px, 4.5cqi, 32px);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.lf-pc__kind {
|
||||
margin: 0;
|
||||
color: var(--pc-action);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.lf-pc .lf-pc__title {
|
||||
margin: 0;
|
||||
color: var(--color-heading);
|
||||
font: 800 clamp(1.35rem, 4.6cqi, 1.75rem) / 1.18 var(--font-display);
|
||||
letter-spacing: -0.025em;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.lf-pc__summary {
|
||||
margin: 0;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.lf-pc__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px 14px;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.lf-pc__meta li {
|
||||
min-inline-size: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.lf-pc__footer {
|
||||
margin-block-start: auto;
|
||||
padding-block-start: 10px;
|
||||
inline-size: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.lf-pc__note {
|
||||
margin: 0;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.lf-pc__cta {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-block-size: 44px;
|
||||
max-inline-size: 100%;
|
||||
padding: 10px 18px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--radius-pill);
|
||||
background: var(--pc-action);
|
||||
color: var(--pc-action-text);
|
||||
font-weight: 600;
|
||||
font-size: 0.9375rem;
|
||||
line-height: 1.4;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.lf-pc__cta:visited { color: var(--pc-action-text); }
|
||||
.lf-pc__cta:hover { background: var(--pc-action-hover); color: var(--pc-action-text); }
|
||||
.lf-pc__cta:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }
|
||||
|
||||
/* Redaktionell: ruhige Textverlinkung mit gelber Unterstreichung. */
|
||||
.lf-pc--editorial .lf-pc__cta {
|
||||
padding-inline: 0;
|
||||
background: transparent;
|
||||
color: var(--color-heading);
|
||||
border-radius: 4px;
|
||||
text-align: start;
|
||||
text-decoration: underline;
|
||||
text-decoration-color: var(--pc-accent);
|
||||
text-decoration-thickness: 3px;
|
||||
text-underline-offset: 7px;
|
||||
}
|
||||
|
||||
.lf-pc--editorial .lf-pc__cta:visited { color: var(--color-heading); }
|
||||
.lf-pc--editorial .lf-pc__cta:hover { background: transparent; color: var(--color-heading); text-decoration-color: currentColor; }
|
||||
|
||||
/* Medien und Material: Metadatenband, grüne Aktion. */
|
||||
.lf-pc--media .lf-pc__meta {
|
||||
padding-block: 10px;
|
||||
inline-size: 100%;
|
||||
border-block: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
/* Programm und Modul: Navy-Tafel mit Art und gelbem Akzent, auch ohne Foto vollständig; Navy-Aktion. */
|
||||
.lf-pc__panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
min-block-size: 140px;
|
||||
margin: 10px 10px 0;
|
||||
padding: 24px;
|
||||
border-radius: var(--radius-card);
|
||||
background: var(--lf-navy);
|
||||
color: var(--lf-white);
|
||||
}
|
||||
|
||||
.lf-pc__panel-label {
|
||||
font: 800 1.6rem / 1.15 var(--font-display);
|
||||
}
|
||||
|
||||
.lf-pc__panel-accent {
|
||||
display: block;
|
||||
inline-size: 72px;
|
||||
block-size: 10px;
|
||||
color: var(--pc-accent);
|
||||
}
|
||||
|
||||
/* Film ohne freigegebenes Bild: Filmtafel (Navy, Filmstreifen-Symbol, kein Abspielsymbol – die Karte spielt nichts ab). */
|
||||
.lf-pc__panel-icon {
|
||||
display: block;
|
||||
inline-size: 44px;
|
||||
block-size: 44px;
|
||||
color: var(--pc-accent);
|
||||
}
|
||||
|
||||
/* Material (Dokument, Text, Hörstück …): ruhige Cremefläche mit Materialsymbol statt Foto. */
|
||||
.lf-pc__panel--material {
|
||||
background: var(--pc-subtle);
|
||||
color: var(--lf-navy);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.lf-pc__panel--material .lf-pc__panel-icon { color: var(--lf-navy); }
|
||||
|
||||
.lf-pc--material .lf-pc__meta {
|
||||
padding-block: 10px;
|
||||
inline-size: 100%;
|
||||
border-block: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
/* Nur Redaktionsvorschau: Vorschaubild der Bibliothek ist markiert, weil es öffentlich nicht erscheint. */
|
||||
.lf-pc__library-flag {
|
||||
position: absolute;
|
||||
inset: auto 12px 12px auto;
|
||||
max-inline-size: calc(100% - 24px);
|
||||
padding: 4px 10px;
|
||||
border-radius: var(--radius-pill);
|
||||
color: var(--lf-white);
|
||||
background: rgb(3 37 81 / 86%);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.lf-pc__editorial {
|
||||
inline-size: 100%;
|
||||
margin: 0;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.lf-pc__editorial summary {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.lf-pc__editorial[open] summary {
|
||||
margin-block-end: 0.4rem;
|
||||
}
|
||||
|
||||
.lf-pc__private-flag {
|
||||
margin: 0;
|
||||
padding: 3px 10px;
|
||||
border-radius: var(--radius-pill);
|
||||
background: var(--color-warning-surface, var(--lf-yellow-tint));
|
||||
color: var(--lf-navy);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.lf-pc__editorial p,
|
||||
.lf-pc__editorial ul {
|
||||
margin: 0 0 0.35rem;
|
||||
}
|
||||
|
||||
.lf-pc__editorial ul {
|
||||
padding-inline-start: 1.1rem;
|
||||
}
|
||||
|
||||
.lf-pc--catalog .lf-pc__kind { color: var(--color-heading); }
|
||||
.lf-pc--catalog .lf-pc__cta { background: var(--lf-navy); color: var(--lf-white); }
|
||||
.lf-pc--catalog .lf-pc__cta:visited { color: var(--lf-white); }
|
||||
.lf-pc--catalog .lf-pc__cta:hover { background: var(--lf-navy-deep); color: var(--lf-white); }
|
||||
|
||||
/* Nur in der Redaktionsvorschau sichtbare Karte: gestrichelter Rand als Hinweis. */
|
||||
.lf-pc--internal { border-style: dashed; }
|
||||
|
||||
/* Ab 520 px Kartenbreite (= Platzbreite) Bild oder Tafel neben dem Text, außer in der Variante „Bild immer oben“. */
|
||||
@container slot (min-width: 520px) {
|
||||
.lf-pc:not(.lf-pc--without-visual, .lf-pc--stacked) {
|
||||
grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.58fr);
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
|
||||
.lf-pc:not(.lf-pc--stacked) .lf-pc__visual {
|
||||
margin: 10px 0 10px 10px;
|
||||
align-self: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Neben dem Text wie ein Bild mittig, auch wenn die Karte auf Zeilenhöhe gestreckt ist. */
|
||||
.lf-pc:not(.lf-pc--stacked) .lf-pc__panel {
|
||||
margin: 10px 0 10px 10px;
|
||||
min-block-size: 220px;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.lf-pc--contain:not(.lf-pc--stacked) .lf-pc__visual {
|
||||
align-items: center;
|
||||
background: var(--pc-subtle);
|
||||
border-radius: var(--radius-card);
|
||||
}
|
||||
|
||||
.lf-pc__body { padding: clamp(22px, 4cqi, 36px); }
|
||||
.lf-pc .lf-pc__title { font-size: clamp(1.45rem, 3.4cqi, 2rem); }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.lf-pc__cta { transition: none; }
|
||||
}
|
||||
+25
-28
@@ -13,40 +13,37 @@ .page-sections {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*
|
||||
* Abstände (Hülle Version 2): genau drei Werte je Abschnitt, keine weitere Vorgabe aus Seiten- oder Rasterhüllen.
|
||||
* - oben/unten: Innenabstand des Abschnitts; zwischen zwei Abschnitten addieren sich „unten“ und „oben“ (0 + 0 = 0).
|
||||
* Bei eigener Fläche liegen beide innerhalb der Fläche, damit Hintergründe nahtlos anschließen.
|
||||
* - Widget-Abstand: Abstand zwischen den Plätzen des Rasters, nebeneinander und gestapelt.
|
||||
* Abstände innerhalb eines Widgets (zum Beispiel zwischen Karten) bleiben im Widget (--grid-gap).
|
||||
*/
|
||||
.page-section {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text);
|
||||
padding-block: var(--section-space);
|
||||
--section-space: clamp(3rem, 2rem + 4vw, 6rem);
|
||||
padding-top: var(--section-space-top);
|
||||
padding-bottom: var(--section-space-bottom);
|
||||
--section-space-top: var(--section-space-compact);
|
||||
--section-space-bottom: var(--section-space-compact);
|
||||
--section-gap: var(--section-gap-normal);
|
||||
}
|
||||
|
||||
.section-space-compact {
|
||||
--section-space: clamp(1.5rem, 1rem + 2vw, 3rem);
|
||||
}
|
||||
|
||||
.section-space-large {
|
||||
--section-space: clamp(4.5rem, 3rem + 5vw, 8rem);
|
||||
}
|
||||
|
||||
/* Abweichender Abstand oben (Abschnittsgestaltung „Abstand oben“); der Abstand unten folgt weiter --section-space. */
|
||||
.page-section.section-space-top-small {
|
||||
padding-top: clamp(0.75rem, 0.5rem + 1vw, 1.25rem);
|
||||
}
|
||||
|
||||
.page-section.section-space-top-none {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
/* Aufeinanderfolgende Abschnitte ohne eigene Fläche teilen sich den Abstand, statt ihn zu verdoppeln. */
|
||||
.section-bg-default + .section-bg-default {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.section-divider-space {
|
||||
margin-bottom: var(--section-space);
|
||||
}
|
||||
.section-space-top-none { --section-space-top: var(--section-space-none); }
|
||||
.section-space-top-compact { --section-space-top: var(--section-space-compact); }
|
||||
.section-space-top-normal { --section-space-top: var(--section-space-normal); }
|
||||
.section-space-top-large { --section-space-top: var(--section-space-large); }
|
||||
.section-space-bottom-none { --section-space-bottom: var(--section-space-none); }
|
||||
.section-space-bottom-compact { --section-space-bottom: var(--section-space-compact); }
|
||||
.section-space-bottom-normal { --section-space-bottom: var(--section-space-normal); }
|
||||
.section-space-bottom-large { --section-space-bottom: var(--section-space-large); }
|
||||
.section-gap-none { --section-gap: var(--section-gap-none); }
|
||||
.section-gap-compact { --section-gap: var(--section-gap-compact); }
|
||||
.section-gap-normal { --section-gap: var(--section-gap-normal); }
|
||||
.section-gap-large { --section-gap: var(--section-gap-large); }
|
||||
|
||||
.page-section-inner {
|
||||
position: relative;
|
||||
@@ -72,7 +69,7 @@ .section-width-full .page-section-inner {
|
||||
|
||||
.section-grid {
|
||||
display: grid;
|
||||
gap: var(--grid-gap);
|
||||
gap: var(--section-gap);
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,16 @@ :root {
|
||||
*/
|
||||
--gutter: clamp(1rem, 4vw, 2.5rem);
|
||||
--grid-gap: clamp(1.25rem, 2.5vw, 2.25rem);
|
||||
|
||||
/* Stufen der Abschnittsabstände (oben, unten) und des Widget-Abstands im Abschnittsraster (SectionStyle::SPACINGS). */
|
||||
--section-space-none: 0px;
|
||||
--section-space-compact: clamp(1.5rem, 1rem + 2vw, 3rem);
|
||||
--section-space-normal: clamp(3rem, 2rem + 4vw, 6rem);
|
||||
--section-space-large: clamp(4.5rem, 3rem + 5vw, 8rem);
|
||||
--section-gap-none: 0px;
|
||||
--section-gap-compact: clamp(0.75rem, 1.25vw, 1.25rem);
|
||||
--section-gap-normal: clamp(1.25rem, 2.5vw, 2.25rem);
|
||||
--section-gap-large: clamp(2rem, 4vw, 3.5rem);
|
||||
--width-reading: 44rem;
|
||||
--width-standard: 82rem;
|
||||
--width-wide: 96rem;
|
||||
|
||||
@@ -54,6 +54,23 @@
|
||||
.luf-sections .fi-fo-repeater-item-header .fi-icon-btn,
|
||||
.luf-sections .fi-fo-builder-item-header .fi-icon-btn { min-width: 2.25rem; min-height: 2.25rem; opacity: 1; }
|
||||
.luf-sections .fi-fo-builder-item-header { flex-wrap: wrap; }
|
||||
/* Medienpicker (Bilder aus dem Medienmanager): Vorschaubild, Titel und Website-Status in der Auswahl. */
|
||||
.luf-media-option { display: flex; align-items: center; gap: .75rem; min-width: 0; }
|
||||
.luf-media-option img, .luf-media-option-empty { flex: none; width: 4.5rem; height: 2.75rem; object-fit: cover; border-radius: .375rem; background: #eef1ee; }
|
||||
.luf-media-option-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
|
||||
.luf-media-option-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.luf-media-badge { align-self: flex-start; padding: 0 .45rem; border-radius: 999px; font-size: .72rem; line-height: 1.35rem; }
|
||||
.luf-media-badge-ok { background: #e3f0d8; color: #2d5c07; }
|
||||
.luf-media-badge-warn { background: #fff1c7; color: #6b4b00; }
|
||||
.luf-media-badge-wait { background: #e5eef8; color: #18456f; }
|
||||
.luf-media-badge-quiet { background: #eceff1; color: #3e4c5c; }
|
||||
.luf-media-status { display: flex; gap: 1rem; align-items: flex-start; padding: .75rem; border: 1px solid #d5ddd6; border-radius: .5rem; }
|
||||
.luf-media-status img { width: 10rem; height: auto; border-radius: .375rem; }
|
||||
.luf-media-status strong { display: block; }
|
||||
.luf-media-status p { margin: .25rem 0 .4rem; font-size: .875rem; }
|
||||
.luf-media-status a { font-size: .875rem; text-decoration: underline; }
|
||||
.luf-media-status-unreleased, .luf-media-status-missing { border-color: #e7c35a; background: #fffaeb; }
|
||||
.luf-media-status-pending { border-color: #9cbbe0; background: #f3f8fd; }
|
||||
</style>
|
||||
<script>
|
||||
// Vorschau-Iframes an ihren Inhalt anpassen (nach Bildern und Schriften erneut), Höhe begrenzen.
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
verkleinert. So greifen die Container-Abfragen der Widgets wie auf der Website.
|
||||
--}}
|
||||
@php
|
||||
$bodyClass = $bodyClass ?? '';
|
||||
$caption = $caption ?? 'Vorschau bei '.$width.' px Platzbreite, verkleinert. Gleiche Darstellung wie auf der Website.';
|
||||
$document = '<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><base target="_blank">'
|
||||
.$stylesheets
|
||||
.'<style>html,body{background:#fff;overflow:hidden}html{scrollbar-gutter:auto}body{margin:0;padding:0;min-height:0}main{display:block}</style>'
|
||||
.'</head><body><main class="sheet-preview"><div class="section-slot">'.$html.'</div></main></body></html>';
|
||||
.'</head><body'.($bodyClass !== '' ? ' class="'.e($bodyClass).'"' : '').'><main class="sheet-preview"><div class="section-slot">'.$html.'</div></main></body></html>';
|
||||
@endphp
|
||||
<div class="luf-live-preview">
|
||||
<p class="luf-live-preview-caption">Vorschau bei {{ $width }} px Platzbreite, verkleinert. Gleiche Darstellung wie auf der Website.</p>
|
||||
<p class="luf-live-preview-caption">{{ $caption }}</p>
|
||||
@if (trim($html) === '')
|
||||
<p class="luf-widget-preview-empty">Dieses Widget zeigt mit den aktuellen Angaben öffentlich nichts an.</p>
|
||||
@else
|
||||
|
||||
@@ -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">
|
||||
@@ -502,10 +519,15 @@
|
||||
<input id="picker-suche" type="search" wire:model.live.debounce.250ms="pickerQuery" placeholder="Titel oder Beschreibung">
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Inhaltsart">
|
||||
@foreach (['alle' => 'Alle', 'film' => 'Filme', 'dokument' => 'Dokumente', 'text' => 'Texte', 'modul' => 'Module'] as $value => $label)
|
||||
@foreach (['alle' => 'Alle', 'film' => 'Filme', 'bild' => 'Bilder', 'dokument' => 'Dokumente', 'text' => 'Texte', 'modul' => 'Module'] as $value => $label)
|
||||
<button type="button" class="luf-quiet" wire:click="$set('pickerKind', '{{ $value }}')" aria-pressed="{{ $this->pickerKind === $value ? 'true' : 'false' }}">{{ $label }}</button>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Darstellung">
|
||||
<button type="button" class="luf-quiet" wire:click="$set('pickerLayout', 'kacheln')" aria-pressed="{{ $this->pickerLayout === 'kacheln' ? 'true' : 'false' }}">Kacheln</button>
|
||||
<button type="button" class="luf-quiet" wire:click="$set('pickerLayout', 'liste')" aria-pressed="{{ $this->pickerLayout === 'liste' ? 'true' : 'false' }}">Liste</button>
|
||||
</div>
|
||||
<p class="luf-note">Entwürfe bleiben sichtbar. So kann ein Modul sie weiterhin gemeinsam mit dem Aufbau freigeben. Eine nicht passende Art filterst du hier, ohne die übrigen Medien zu verstecken.</p>
|
||||
<div class="luf-field">
|
||||
<label for="picker-dimension">Fachliche Einordnung</label>
|
||||
<select id="picker-dimension" wire:model.live="pickerDimension">
|
||||
@@ -524,7 +546,7 @@
|
||||
@if ($result['items'] === [])
|
||||
<p class="luf-empty">Nichts gefunden. Ändere die Suche oder erstelle einen neuen Text.</p>
|
||||
@else
|
||||
<ul class="luf-cards">
|
||||
<ul @class(['luf-cards', 'luf-cards-list' => $this->pickerLayout === 'liste'])>
|
||||
@foreach ($result['items'] as $hit)
|
||||
<li wire:key="treffer-{{ $hit['target'] }}">
|
||||
<button type="button" class="luf-card luf-tone-{{ $hit['tone'] ?? 'text' }}" wire:click="$set('pickerSelected', '{{ $hit['target'] }}')" aria-pressed="{{ $this->pickerMatches((string) ($hit['identity'] ?? '')) ? 'true' : 'false' }}">
|
||||
@@ -546,6 +568,9 @@
|
||||
<span class="luf-summary">{{ \Illuminate\Support\Str::limit((string) $hit['summary'], 120) }}</span>
|
||||
@endif
|
||||
<span class="luf-meta">Aktueller Stand · {{ $hit['version_label'] }}</span>
|
||||
@if (filled($hit['visibility'] ?? null))
|
||||
<span class="luf-note">{{ $hit['visibility'] }}</span>
|
||||
@endif
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
@@ -567,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">
|
||||
@@ -578,8 +605,13 @@
|
||||
@else
|
||||
<p class="luf-note">Das ist der aktuelle Stand. Eine weitere zulässige Fassung liegt nicht vor.</p>
|
||||
@endif
|
||||
@if (filled($detail['visibility'] ?? null))
|
||||
<p class="luf-note">{{ $detail['visibility'] }}</p>
|
||||
@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
|
||||
@@ -587,7 +619,14 @@
|
||||
@if ($detail['open_url'])
|
||||
<a class="luf-link" href="{{ $detail['open_url'] }}" target="_blank" rel="noopener">Ansehen</a>
|
||||
@endif
|
||||
<button type="button" class="luf-primary" wire:click="addPart('{{ $detail['target'] }}')">Übernehmen</button>
|
||||
@if ($detail['edit_url'] ?? null)
|
||||
<a class="luf-link" href="{{ $detail['edit_url'] }}">In der Verwaltung öffnen</a>
|
||||
@endif
|
||||
@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>
|
||||
@@ -139,6 +139,9 @@
|
||||
.luf-kicker { margin: 0; color: var(--luf-pine); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.78rem; }
|
||||
.luf-blocks, .luf-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
|
||||
.luf-cards { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
|
||||
.luf-cards-list { grid-template-columns: 1fr; }
|
||||
.luf-cards-list .luf-card { flex-direction: row; align-items: stretch; }
|
||||
.luf-cards-list .luf-figure { width: 7.5rem; flex: none; }
|
||||
.luf-block {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
|
||||
@@ -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>
|
||||
@@ -0,0 +1,50 @@
|
||||
<article class="luf-medium luf-tone-{{ $card['typeKey'] }} {{ $list ? 'is-list' : 'is-tile' }}">
|
||||
<a class="luf-medium-figure" href="{{ $card['url'] }}" aria-label="{{ $card['title'] }} ansehen">
|
||||
@if ($card['image'])
|
||||
<img src="{{ $card['image'] }}" alt="{{ $card['imageAlt'] }}">
|
||||
@else
|
||||
@include('filament.media.mark', ['typeKey' => $card['typeKey'], 'type' => $card['type']])
|
||||
@endif
|
||||
@if ($card['imageNote'])
|
||||
<span class="luf-medium-figure-note">{{ $card['imageNote'] }}</span>
|
||||
@endif
|
||||
</a>
|
||||
<div class="luf-medium-body">
|
||||
<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>
|
||||
@endif
|
||||
@if ($card['usageNote'])
|
||||
<p class="luf-medium-copy luf-medium-note"><span class="luf-medium-kicker">Einsatz</span> {{ $card['usageNote'] }}</p>
|
||||
@endif
|
||||
@if ($card['licenseNote'])
|
||||
<p class="luf-medium-copy luf-medium-note"><span class="luf-medium-kicker">Interner Lizenzvermerk</span> {{ $card['licenseNote'] }}</p>
|
||||
@endif
|
||||
<div class="luf-medium-flags">
|
||||
<span class="luf-flag luf-flag-{{ $card['standTone'] }}">{{ $card['stand'] }}</span>
|
||||
@if ($card['draftNote'])
|
||||
<span class="luf-flag luf-flag-draft">{{ $card['draftNote'] }}</span>
|
||||
@endif
|
||||
@if ($card['blockedNote'])
|
||||
<span class="luf-flag luf-flag-blocked">{{ $card['blockedNote'] }}</span>
|
||||
@endif
|
||||
@if ($card['processing'])
|
||||
<span class="luf-flag luf-flag-wait">{{ $card['processing'] }}</span>
|
||||
@endif
|
||||
@if ($card['archived'])
|
||||
<span class="luf-flag luf-flag-quiet">Archiviert</span>
|
||||
@endif
|
||||
@if ($card['versionLabel'])
|
||||
<span class="luf-flag luf-flag-quiet">{{ $card['versionLabel'] }}</span>
|
||||
@endif
|
||||
</div>
|
||||
@include('filament.media.usages', ['card' => $card])
|
||||
<div class="luf-medium-actions">
|
||||
<a class="luf-medium-link" href="{{ $card['url'] }}">Ansehen</a>
|
||||
@if ($card['editUrl'])
|
||||
<a class="luf-medium-link" href="{{ $card['editUrl'] }}">Bearbeiten</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,135 @@
|
||||
@php
|
||||
$fokus = $this->bereich;
|
||||
$editable = \App\Filament\Resources\ContentElements\ContentElementResource::editor();
|
||||
$options = [
|
||||
'kinds' => \App\Domain\Catalog\EditorialContentKind::selectOptions(),
|
||||
'pillars' => \App\Domain\Catalog\Pillar::query()->orderBy('name')->get(['id', 'name']),
|
||||
'dimensions' => \App\Domain\Catalog\EditorialDimension::forSubject($this->getRecord()),
|
||||
];
|
||||
@endphp
|
||||
|
||||
<div>
|
||||
@if ($this->editorialFeedback !== '')
|
||||
<p class="luf-editor-status" role="status">{{ $this->editorialFeedback }}</p>
|
||||
@endif
|
||||
|
||||
@if ($fokus === 'beschreibung')
|
||||
<div class="luf-editor-split">
|
||||
<form wire:submit="saveEditorial">
|
||||
<p class="luf-editor-lead">Karten zeigen den Anzeigenamen und die Kurzbeschreibung. Die ausführliche Beschreibung und der Vermerk bleiben in der Verwaltung.</p>
|
||||
<div class="luf-editor-fields">
|
||||
<label>Arbeitstitel
|
||||
<input type="text" wire:model.live.debounce.300ms="workingTitle" @disabled(! $editable) required>
|
||||
</label>
|
||||
<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>
|
||||
<label>Interner Lizenzvermerk
|
||||
<textarea rows="4" wire:model="licenseNote" @disabled(! $editable)></textarea>
|
||||
</label>
|
||||
<label class="is-wide">Quellenzeile für die Website
|
||||
<textarea rows="2" wire:model="websiteCredit" @disabled(! $editable)></textarea>
|
||||
</label>
|
||||
<label>Alternativtext für die Website
|
||||
<input type="text" wire:model="websiteAlt" @disabled(! $editable)>
|
||||
</label>
|
||||
<label>Inhaltsart
|
||||
<select wire:model.live="kindId" @disabled(! $editable)>
|
||||
<option value="">Keine</option>
|
||||
@foreach ($options['kinds'] as $id => $label)
|
||||
<option value="{{ $id }}">{{ $label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend>Fachliche Säulen</legend>
|
||||
<div class="luf-editor-checks">
|
||||
@foreach ($options['pillars'] as $pillar)
|
||||
<label><input type="checkbox" value="{{ $pillar->id }}" wire:model="pillarIds" @disabled(! $editable)> {{ $pillar->name }}</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</fieldset>
|
||||
@foreach ($options['dimensions'] as $dimension)
|
||||
<fieldset>
|
||||
<legend>{{ $dimension->label }}</legend>
|
||||
<div class="luf-editor-checks">
|
||||
@foreach ($dimension->values as $value)
|
||||
<label><input type="checkbox" value="{{ $value->id }}" wire:model="dimensionIds" @disabled(! $editable)> {{ $value->label }}</label>
|
||||
@endforeach
|
||||
</div>
|
||||
</fieldset>
|
||||
@endforeach
|
||||
@if ($editable)
|
||||
<p>
|
||||
<button class="luf-editor-save" type="submit">Speichern</button>
|
||||
@if ($this->websiteIsPublic())
|
||||
<button class="luf-editor-quiet" type="button" wire:click="withdrawWebsite">Website-Freigabe zurücknehmen</button>
|
||||
@else
|
||||
<button class="luf-editor-quiet" type="button" wire:click="releaseForWebsite">Für die Website freigeben</button>
|
||||
@endif
|
||||
</p>
|
||||
<p class="luf-editor-lead">{{ $this->websiteFeedback !== '' ? $this->websiteFeedback : ($this->websiteIsPublic() ? 'Für die Website freigegeben. Öffentliche Seiten lesen nur diese Ableitung.' : 'Noch nicht für die Website freigegeben. Der interne Vermerk bleibt intern.') }}</p>
|
||||
@endif
|
||||
@php($webPages = $this->websitePages())
|
||||
<p class="luf-editor-lead">
|
||||
@if ($webPages === [])
|
||||
Auf keiner Website-Seite als Bild verwendet.
|
||||
@else
|
||||
Als Bild auf der Website verwendet:
|
||||
@foreach ($webPages as $usage)
|
||||
{{ $usage['path'] }} ({{ $usage['published'] ? 'veröffentlicht' : '' }}{{ $usage['published'] && $usage['draft'] ? ', ' : '' }}{{ $usage['draft'] ? 'Entwurf' : '' }}){{ $loop->last ? '' : ',' }}
|
||||
@endforeach
|
||||
@if ($this->websiteIsPublic())
|
||||
– Zurücknehmen entfernt das Bild dort von der öffentlichen Seite.
|
||||
@endif
|
||||
@endif
|
||||
</p>
|
||||
@include('filament.editorial.variants')
|
||||
@php($history = $this->editorialHistory())
|
||||
@if ($history !== [])
|
||||
<details>
|
||||
<summary>Letzte Änderungen</summary>
|
||||
<ul>
|
||||
@foreach ($history as $change)
|
||||
<li>{{ $change['when'] }} · {{ $change['field'] }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</details>
|
||||
@endif
|
||||
</form>
|
||||
@include('filament.media.preview-frame')
|
||||
</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>
|
||||
@include('filament.media.usages', ['card' => $card])
|
||||
@endif
|
||||
|
||||
@if ($fokus === 'vorschau')
|
||||
<p>Die Vorschau nutzt die Website-Karte und die Karte der Bibliothek. Ein Bibliotheksbild ist in der Vorschau sichtbar und damit nicht öffentlich freigegeben. Die ausführliche Beschreibung erscheint auf diesen Karten nicht.</p>
|
||||
@include('filament.media.preview-frame')
|
||||
@endif
|
||||
</div>
|
||||
@@ -0,0 +1,119 @@
|
||||
<style>
|
||||
.luf-editor {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
color: #1b2838;
|
||||
font-size: 1rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.luf-editor-tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.15rem 0.35rem;
|
||||
border-bottom: 1px solid #c5d2cb;
|
||||
margin: 0 0 1.25rem;
|
||||
}
|
||||
.luf-editor-tabs button {
|
||||
appearance: none;
|
||||
font: inherit;
|
||||
font-weight: 650;
|
||||
color: #1b2838;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-bottom: 3px solid transparent;
|
||||
margin: 0 0 -1px;
|
||||
padding: 0.7rem 0.95rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.luf-editor-tabs button[aria-selected="true"] {
|
||||
color: #0f6e56;
|
||||
background: transparent;
|
||||
border-bottom-color: #0f6e56;
|
||||
}
|
||||
.luf-editor-tabs button:focus-visible {
|
||||
outline: 3px solid #1769aa;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.luf-editor-lead {
|
||||
margin: 0 0 1rem;
|
||||
color: #3e4c5c;
|
||||
}
|
||||
.luf-editor-split {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(32rem, 1fr) minmax(20rem, 28rem);
|
||||
gap: 1.75rem;
|
||||
align-items: start;
|
||||
}
|
||||
.luf-editor-fields {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.9rem 1.1rem;
|
||||
}
|
||||
.luf-editor-fields .is-wide { grid-column: 1 / -1; }
|
||||
.luf-editor label {
|
||||
display: grid;
|
||||
gap: 0.3rem;
|
||||
font-weight: 650;
|
||||
}
|
||||
.luf-editor input[type="text"],
|
||||
.luf-editor input[type="search"],
|
||||
.luf-editor textarea,
|
||||
.luf-editor select {
|
||||
font: inherit;
|
||||
font-weight: 450;
|
||||
width: 100%;
|
||||
color: #1b2838;
|
||||
background: #fff;
|
||||
border: 1px solid #c5d2cb;
|
||||
padding: 0.55rem 0.7rem;
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
.luf-editor textarea { min-height: 6.5rem; resize: vertical; }
|
||||
.luf-editor-checks {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.45rem 1.1rem;
|
||||
margin: 0.35rem 0 0;
|
||||
}
|
||||
.luf-editor-checks label {
|
||||
font-weight: 450;
|
||||
grid-auto-flow: column;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
}
|
||||
.luf-editor-quiet {
|
||||
font: inherit;
|
||||
font-weight: 650;
|
||||
color: #1b2838;
|
||||
background: #fff;
|
||||
border: 1px solid #c5d2cb;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.55rem 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.luf-editor-save {
|
||||
justify-self: start;
|
||||
font: inherit;
|
||||
font-weight: 650;
|
||||
color: #fff;
|
||||
background: #0f6e56;
|
||||
border: 0;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.55rem 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.luf-editor-status {
|
||||
margin: 0 0 0.8rem;
|
||||
padding: 0.65rem 0.8rem;
|
||||
background: #e7f3ee;
|
||||
border-left: 4px solid #0f6e56;
|
||||
}
|
||||
.luf-live-preview-stage { width: 100%; overflow: hidden; }
|
||||
.luf-live-preview-frame { border: 0; transform-origin: top left; display: block; background: #fff; }
|
||||
@media (max-width: 1100px) {
|
||||
.luf-editor-split { grid-template-columns: 1fr; }
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.luf-editor-fields { grid-template-columns: 1fr; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,259 @@
|
||||
<style>
|
||||
.luf-media {
|
||||
--luf-ink: #1b2838;
|
||||
--luf-pine: #0f6e56;
|
||||
--luf-paper: #f4f7f5;
|
||||
--luf-line: #c5d2cb;
|
||||
--luf-yellow: #e2b43a;
|
||||
--luf-quiet: #3e4c5c;
|
||||
color: var(--luf-ink);
|
||||
font-size: 1rem;
|
||||
line-height: 1.45;
|
||||
min-width: 0;
|
||||
}
|
||||
.luf-media * { box-sizing: border-box; }
|
||||
.luf-media a:focus-visible,
|
||||
.luf-media button:focus-visible,
|
||||
.luf-media input:focus-visible,
|
||||
.luf-media select:focus-visible,
|
||||
.luf-media summary:focus-visible {
|
||||
outline: 3px solid #1769aa;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.luf-media-bar,
|
||||
.luf-media-reset {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem 1rem;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0 0 0.85rem;
|
||||
}
|
||||
.luf-media-switch { display: flex; flex-wrap: wrap; gap: 0.4rem; }
|
||||
.luf-media-quiet {
|
||||
font: inherit;
|
||||
color: var(--luf-ink);
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
min-height: 2.75rem;
|
||||
padding: 0.35rem 0.8rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.luf-media-quiet[aria-pressed="true"] {
|
||||
background: var(--luf-ink);
|
||||
color: #fff;
|
||||
border-color: var(--luf-ink);
|
||||
}
|
||||
.luf-media-count { margin: 0; color: var(--luf-quiet); }
|
||||
.luf-media-filters {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
|
||||
gap: 0.7rem 0.8rem;
|
||||
margin: 0 0 0.75rem;
|
||||
}
|
||||
.luf-media-field { display: grid; gap: 0.3rem; min-width: 0; }
|
||||
.luf-media-field.is-wide { grid-column: 1 / -1; }
|
||||
@media (min-width: 52rem) {
|
||||
.luf-media-field.is-wide { grid-column: span 2; }
|
||||
}
|
||||
.luf-media-field label { font-weight: 650; }
|
||||
.luf-media input,
|
||||
.luf-media select {
|
||||
width: 100%;
|
||||
min-height: 2.75rem;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
padding: 0.45rem 0.65rem;
|
||||
}
|
||||
.luf-media-hint,
|
||||
.luf-media-loading {
|
||||
margin: 0 0 0.9rem;
|
||||
color: var(--luf-quiet);
|
||||
}
|
||||
.luf-media-empty {
|
||||
margin: 0 0 0.9rem;
|
||||
padding: 1rem 1.1rem;
|
||||
background: #fff;
|
||||
border: 1px dashed var(--luf-line);
|
||||
color: var(--luf-ink);
|
||||
}
|
||||
.luf-media-grid,
|
||||
.luf-media-rows {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.luf-media-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
|
||||
gap: 1rem;
|
||||
align-items: stretch;
|
||||
}
|
||||
.luf-media-rows { display: grid; gap: 0.7rem; }
|
||||
.luf-medium {
|
||||
background: #fff;
|
||||
border: 1px solid var(--luf-line);
|
||||
border-top: 4px solid var(--luf-pine);
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.luf-medium.is-tile { display: flex; flex-direction: column; }
|
||||
.luf-medium.is-list {
|
||||
display: grid;
|
||||
grid-template-columns: 7.5rem minmax(0, 1fr);
|
||||
gap: 0.8rem;
|
||||
align-items: start;
|
||||
height: auto;
|
||||
}
|
||||
.luf-tone-film { border-top-color: #1b2838; }
|
||||
.luf-tone-document { border-top-color: #1769aa; }
|
||||
.luf-tone-text { border-top-color: #c4962a; }
|
||||
.luf-tone-audio { border-top-color: #6d4c7d; }
|
||||
.luf-tone-bild { border-top-color: var(--luf-pine); }
|
||||
.luf-medium-figure {
|
||||
display: block;
|
||||
position: relative;
|
||||
aspect-ratio: 16 / 9;
|
||||
background: var(--luf-paper);
|
||||
color: var(--luf-pine);
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
}
|
||||
.luf-medium.is-list .luf-medium-figure { aspect-ratio: 16 / 10; }
|
||||
.luf-medium-figure img,
|
||||
.luf-medium-mark,
|
||||
.luf-medium-mark svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
.luf-medium-figure img { object-fit: cover; }
|
||||
.luf-medium-mark {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.luf-medium-mark svg { height: 72%; }
|
||||
.luf-medium-figure-note {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 0.35rem 0.55rem;
|
||||
background: rgba(27, 40, 56, 0.88);
|
||||
color: #fff;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.luf-medium-body {
|
||||
display: grid;
|
||||
gap: 0.4rem;
|
||||
padding: 0.8rem 0.9rem 0.95rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.luf-medium-kind {
|
||||
margin: 0;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: var(--luf-pine);
|
||||
}
|
||||
.luf-medium-title {
|
||||
color: inherit;
|
||||
font-family: Georgia, "Source Serif 4", serif;
|
||||
font-size: 1.28rem;
|
||||
font-weight: 650;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1.25;
|
||||
text-decoration: none;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.luf-medium-title:hover { text-decoration: underline; }
|
||||
.luf-medium-copy {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.luf-medium.is-tile .luf-medium-copy {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 4;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
.luf-medium-note { color: var(--luf-quiet); font-size: 0.92rem; }
|
||||
.luf-medium-kicker { font-weight: 700; color: var(--luf-ink); }
|
||||
.luf-medium-flags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.luf-flag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 1.7rem;
|
||||
padding: 0.1rem 0.45rem;
|
||||
border: 1px solid var(--luf-line);
|
||||
background: #fff;
|
||||
font-size: 0.86rem;
|
||||
}
|
||||
.luf-flag-ready { background: #e7f3ee; border-color: var(--luf-pine); }
|
||||
.luf-flag-draft { background: #fff8e6; border-color: #c4962a; }
|
||||
.luf-flag-blocked { background: #f8f1ea; border-color: #8a5a2a; }
|
||||
.luf-flag-wait { background: #eef5fb; border-color: #1769aa; }
|
||||
.luf-flag-quiet { color: var(--luf-quiet); }
|
||||
.luf-medium-usage { display: grid; gap: 0.35rem; }
|
||||
.luf-medium-unused,
|
||||
.luf-medium-license { margin: 0; color: var(--luf-quiet); font-size: 0.92rem; }
|
||||
.luf-medium-usage summary {
|
||||
cursor: pointer;
|
||||
min-height: 2.4rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: 650;
|
||||
}
|
||||
.luf-medium-usage ul {
|
||||
list-style: none;
|
||||
margin: 0.2rem 0 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
.luf-medium-usage li {
|
||||
display: grid;
|
||||
gap: 0.1rem;
|
||||
padding-top: 0.35rem;
|
||||
border-top: 1px solid var(--luf-line);
|
||||
min-width: 0;
|
||||
}
|
||||
.luf-medium-usage a { color: var(--luf-pine); overflow-wrap: anywhere; }
|
||||
.luf-medium-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem 1rem;
|
||||
margin-top: 0.15rem;
|
||||
}
|
||||
.luf-medium-link {
|
||||
color: var(--luf-ink);
|
||||
font-weight: 650;
|
||||
text-underline-offset: 0.18em;
|
||||
}
|
||||
.luf-sr {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
}
|
||||
@media (max-width: 40rem) {
|
||||
.luf-medium.is-list { grid-template-columns: 5.5rem minmax(0, 1fr); }
|
||||
.luf-medium-title { font-size: 1.12rem; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.luf-media * { scroll-behavior: auto; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,144 @@
|
||||
@php
|
||||
$cards = $this->cards();
|
||||
$list = $this->showingList();
|
||||
$count = count($cards);
|
||||
@endphp
|
||||
|
||||
@include('filament.media.library-styles')
|
||||
|
||||
<div class="luf-media">
|
||||
<div class="luf-media-bar">
|
||||
<div class="luf-media-switch" role="group" aria-label="Ansicht">
|
||||
<button type="button" class="luf-media-quiet" wire:click="$set('ansicht', 'kacheln')" aria-pressed="{{ $list ? 'false' : 'true' }}">Kacheln</button>
|
||||
<button type="button" class="luf-media-quiet" wire:click="$set('ansicht', 'liste')" aria-pressed="{{ $list ? 'true' : 'false' }}">Liste</button>
|
||||
</div>
|
||||
<p class="luf-media-count" aria-live="polite">{{ $count === 1 ? '1 Medium' : $count.' Medien' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="luf-media-filters">
|
||||
<div class="luf-media-field is-wide">
|
||||
<label for="medien-suche">Suche</label>
|
||||
<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">Technische Art</label>
|
||||
<select id="medien-art" wire:model.live="art">
|
||||
<option value="">Alle Arten</option>
|
||||
@foreach ($this->typeOptions() as $type)
|
||||
<option value="{{ $type['value'] }}">{{ $type['label'] }}</option>
|
||||
@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">
|
||||
<option value="">Alle Freigaben</option>
|
||||
<option value="freigegeben">Freigegebene Fassung</option>
|
||||
<option value="entwurf">Nur offener Entwurf</option>
|
||||
<option value="ohne">Keine freigegebene Fassung</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-entwurf">Entwurf</label>
|
||||
<select id="medien-entwurf" wire:model.live="entwurf">
|
||||
<option value="">Entwurf egal</option>
|
||||
<option value="offen">Offener Entwurf</option>
|
||||
<option value="keiner">Kein offener Entwurf</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-fassung">Deaktivierte Fassungen</label>
|
||||
<select id="medien-fassung" wire:model.live="fassung">
|
||||
<option value="">Regulärer Bestand</option>
|
||||
<option value="mit">Mit deaktivierter Fassung</option>
|
||||
<option value="nur">Nur deaktivierte Fassungen</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-nutzung">Verwendung</label>
|
||||
<select id="medien-nutzung" wire:model.live="nutzung">
|
||||
<option value="">Verwendung egal</option>
|
||||
<option value="verwendet">Verwendet</option>
|
||||
<option value="unbenutzt">Nicht verwendet</option>
|
||||
</select>
|
||||
</div>
|
||||
@if ($pillars = $this->pillarOptions())
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-saeule">Fachliche Säule</label>
|
||||
<select id="medien-saeule" wire:model.live="saeule">
|
||||
<option value="">Alle Säulen</option>
|
||||
@foreach ($pillars as $pillar)
|
||||
<option value="{{ $pillar['id'] }}">{{ $pillar['name'] }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
@if ($classes = $this->classificationOptions())
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-einordnung">Einordnung</label>
|
||||
<select id="medien-einordnung" wire:model.live="einordnung">
|
||||
<option value="">Alle Einordnungen</option>
|
||||
@foreach ($classes as $class)
|
||||
<option value="{{ $class['id'] }}">{{ $class['label'] }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-verarbeitung">Verarbeitung</label>
|
||||
<select id="medien-verarbeitung" wire:model.live="verarbeitung">
|
||||
<option value="">Verarbeitung egal</option>
|
||||
<option value="fehler">Verarbeitungsfehler</option>
|
||||
<option value="uebernahme">Datei wird übernommen</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="luf-media-field">
|
||||
<label for="medien-archiv">Archiv</label>
|
||||
<select id="medien-archiv" wire:model.live="archiv">
|
||||
<option value="aktiv">Aktive Medien</option>
|
||||
<option value="archiviert">Archivierte Medien</option>
|
||||
<option value="alle">Auch archivierte</option>
|
||||
</select>
|
||||
</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. 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">
|
||||
<button type="button" class="luf-media-quiet" wire:click="resetFilters">Filter zurücksetzen</button>
|
||||
</p>
|
||||
@endif
|
||||
|
||||
<p class="luf-media-loading" wire:loading.delay role="status">Die Übersicht wird aktualisiert.</p>
|
||||
|
||||
<div wire:loading.delay.class="is-pending" aria-busy="false">
|
||||
@if ($cards === [])
|
||||
<div class="luf-media-empty">
|
||||
@if ($this->filtersActive())
|
||||
<p>Keine Medien entsprechen der Auswahl.</p>
|
||||
<button type="button" class="luf-media-quiet" wire:click="resetFilters">Filter zurücksetzen</button>
|
||||
@else
|
||||
<p>Noch keine Medien im regulären Bestand.</p>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<ul class="{{ $list ? 'luf-media-rows' : 'luf-media-grid' }}" data-ansicht="{{ $list ? 'liste' : 'kacheln' }}">
|
||||
@foreach ($cards as $card)
|
||||
<li wire:key="medium-{{ $card['id'] }}">
|
||||
@include('filament.media.card', ['card' => $card, 'list' => $list])
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<span class="luf-medium-mark" data-fallback="{{ $typeKey }}" aria-hidden="true">
|
||||
@switch($typeKey)
|
||||
@case('film')
|
||||
<svg viewBox="0 0 160 90">
|
||||
<rect x="18" y="22" width="124" height="46" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<path d="M72 35 L98 45 L72 55 Z" fill="currentColor"/>
|
||||
</svg>
|
||||
@break
|
||||
@case('audio')
|
||||
<svg viewBox="0 0 160 90">
|
||||
<path d="M30 45 H46 L66 28 V62 L46 45 Z" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<path d="M80 34 Q96 45 80 56 M96 26 Q122 45 96 64" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
</svg>
|
||||
@break
|
||||
@case('bild')
|
||||
<svg viewBox="0 0 160 90">
|
||||
<rect x="22" y="18" width="116" height="54" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<circle cx="58" cy="38" r="7" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<path d="M34 62 L62 44 L84 58 L104 40 L126 62" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
</svg>
|
||||
@break
|
||||
@case('document')
|
||||
<svg viewBox="0 0 160 90">
|
||||
<path d="M58 16 H96 L112 32 V74 H58 Z" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
<path d="M96 16 V32 H112 M70 46 H100 M70 58 H100" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
</svg>
|
||||
@break
|
||||
@default
|
||||
<svg viewBox="0 0 160 90">
|
||||
<path d="M36 28 H124 M36 45 H124 M36 62 H96" fill="none" stroke="currentColor" stroke-width="3"/>
|
||||
</svg>
|
||||
@endswitch
|
||||
<span class="luf-sr">{{ $type }}</span>
|
||||
</span>
|
||||
@@ -0,0 +1,19 @@
|
||||
<div class="luf-ws">
|
||||
<div class="luf-scopes" role="group" aria-label="Darstellung">
|
||||
<button type="button" wire:click="$set('previewSurface', 'website')" aria-pressed="{{ $this->previewSurface === 'website' ? 'true' : 'false' }}">Website-Karte</button>
|
||||
<button type="button" wire:click="$set('previewSurface', 'bibliothek')" aria-pressed="{{ $this->previewSurface === 'bibliothek' ? 'true' : 'false' }}">Bibliothek</button>
|
||||
</div>
|
||||
<div class="luf-scopes" role="group" aria-label="Breite">
|
||||
<button type="button" wire:click="$set('previewWidth', '640')" aria-pressed="{{ $this->previewWidth === '640' ? 'true' : 'false' }}">Desktop</button>
|
||||
<button type="button" wire:click="$set('previewWidth', '390')" aria-pressed="{{ $this->previewWidth === '390' ? 'true' : 'false' }}">Mobil</button>
|
||||
</div>
|
||||
@include('filament.cms.widget-live-preview', [
|
||||
'html' => $this->previewHtml(),
|
||||
'stylesheets' => \App\Filament\Support\WidgetEditor::previewStylesheets(),
|
||||
'width' => (int) $this->previewWidth,
|
||||
'bodyClass' => $this->previewSurface === 'bibliothek' ? 'member' : '',
|
||||
'caption' => $this->previewSurface === 'bibliothek'
|
||||
? 'Bibliothekskarte bei '.$this->previewWidth.' px. Dieselbe Karte wie im Mitgliederbereich.'
|
||||
: 'Website-Karte bei '.$this->previewWidth.' px. Dieselbe Karte wie im öffentlichen Auftritt. Das Bibliotheksbild ist nur hier sichtbar.',
|
||||
])
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="luf-medium-usage">
|
||||
@if ($card['usages'] === [])
|
||||
<p class="luf-medium-unused">{{ $card['usageLabel'] }}</p>
|
||||
@else
|
||||
<details>
|
||||
<summary>{{ $card['usageLabel'] }}</summary>
|
||||
<ul>
|
||||
@foreach ($card['usages'] as $usage)
|
||||
<li>
|
||||
<span class="luf-medium-kicker">{{ $usage['type'] }}</span>
|
||||
<a href="{{ $usage['url'] }}">{{ $usage['name'] }}</a>
|
||||
<span>Medium {{ $usage['mediumVersion'] }}, eingesetzt in {{ $usage['hostVersion'] }}@if ($usage['roles'] !== []) · {{ implode(', ', $usage['roles']) }}@endif</span>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</details>
|
||||
@endif
|
||||
@if ($card['licenseText'])
|
||||
<p class="luf-medium-license">{{ $card['licenseText'] }}</p>
|
||||
@endif
|
||||
</div>
|
||||
@@ -1,8 +1,30 @@
|
||||
@php
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
$fokus = $this->bereich;
|
||||
@endphp
|
||||
|
||||
<div class="luf-editor">
|
||||
@include('filament.media.library-styles')
|
||||
@include('filament.media.editor-styles')
|
||||
|
||||
<nav class="luf-editor-tabs" role="tablist" aria-label="Bereiche des Mediums">
|
||||
@foreach ([
|
||||
'beschreibung' => 'Beschreibung',
|
||||
'praesentation' => 'Präsentation',
|
||||
'inhalt' => 'Inhalt',
|
||||
'fassungen' => 'Fassungen',
|
||||
'verwendung' => 'Verwendung',
|
||||
'vorschau' => 'Vorschau',
|
||||
] as $value => $label)
|
||||
<button type="button" role="tab" wire:click="$set('bereich', '{{ $value }}')" aria-selected="{{ $fokus === $value ? 'true' : 'false' }}">{{ $label }}</button>
|
||||
@endforeach
|
||||
</nav>
|
||||
|
||||
@if (in_array($fokus, ['beschreibung', 'praesentation', 'verwendung', 'vorschau'], true))
|
||||
@include('filament.media.editor-panels')
|
||||
@else
|
||||
<div style="display: grid; gap: 1.5rem;">
|
||||
@if ($fokus !== 'fassungen')
|
||||
<section style="display: grid; gap: 0.75rem;">
|
||||
<h2 style="font-size: 1.125rem; font-weight: 600;">{{ $element->working_title }}</h2>
|
||||
@if (filled($element->description))
|
||||
@@ -60,6 +82,7 @@
|
||||
@endif
|
||||
</section>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<section style="display: grid; gap: 0.75rem;">
|
||||
@if ($shown === null)
|
||||
@@ -127,7 +150,7 @@
|
||||
@endif
|
||||
</section>
|
||||
|
||||
@if ($usage !== [])
|
||||
@if ($fokus !== 'fassungen' && $usage !== [])
|
||||
<section style="display: grid; gap: 0.35rem;">
|
||||
<h2 style="font-size: 1.125rem; font-weight: 600;">Verwendung</h2>
|
||||
@foreach ($usage as $line)
|
||||
@@ -136,3 +159,31 @@
|
||||
</section>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<script>
|
||||
window.lufLivePreview = window.lufLivePreview || function (frame) {
|
||||
const stage = frame.parentElement;
|
||||
const width = Number(frame.dataset.width) || 640;
|
||||
const fit = () => {
|
||||
const doc = frame.contentDocument;
|
||||
if (!doc || !doc.documentElement || !stage) return;
|
||||
const scale = Math.min(1, stage.clientWidth / width);
|
||||
frame.style.width = width + 'px';
|
||||
const height = doc.documentElement.scrollHeight;
|
||||
frame.style.height = height + 'px';
|
||||
frame.style.transform = 'scale(' + scale + ')';
|
||||
stage.style.height = Math.ceil(height * scale) + 'px';
|
||||
};
|
||||
fit();
|
||||
try {
|
||||
const doc = frame.contentDocument;
|
||||
doc.fonts?.ready.then(fit);
|
||||
if (window.ResizeObserver) {
|
||||
new ResizeObserver(fit).observe(doc.body);
|
||||
new ResizeObserver(fit).observe(stage);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
{{-- Seitenvorlage „standard“: Abschnitte untereinander; jeder Abschnitt bestimmt Raster, Fläche und Breite selbst. --}}
|
||||
{{ $content }}
|
||||
@if ($page->path === '/' && $themes->isNotEmpty())
|
||||
<div class="page-section section-bg-default section-width-standard section-space-normal">
|
||||
<div class="page-section section-bg-default section-width-standard section-space-top-none section-space-bottom-normal section-gap-normal">
|
||||
<div class="page-section-inner">
|
||||
<section class="block">
|
||||
<h2>Themenbereiche</h2>
|
||||
|
||||
@@ -35,3 +35,4 @@
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@include('widgets.partials.image-notice')
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="lf-hero lf-hero--{{ $layout }} lf-hero--height-{{ $heightClass }} lf-hero--accent-{{ $accent }}"
|
||||
style="--lf-hero-focus-x: {{ $focus['x'] }}%; --lf-hero-focus-y: {{ $focus['y'] }}%">
|
||||
@if ($layout === 'photo-split' && $imageUrl)
|
||||
<img class="lf-hero__photo" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" {!! $loading !!} decoding="async">
|
||||
<img class="lf-hero__photo" src="{{ $imageUrl }}" alt="{{ $imageAlt ?? '' }}" {!! $loading !!} decoding="async">
|
||||
@endif
|
||||
<div class="lf-hero__inner">
|
||||
<div class="lf-hero__copy">
|
||||
@@ -43,3 +43,4 @@
|
||||
<span class="lf-hero__bottom" aria-hidden="true"></span>
|
||||
</div>
|
||||
</div>
|
||||
@include('widgets.partials.image-notice')
|
||||
@@ -40,8 +40,9 @@
|
||||
</div>
|
||||
@if ($imageUrl)
|
||||
<div class="lf-bt__media">
|
||||
<img class="lf-bt__image" src="{{ $imageUrl }}" alt="{{ $data['alt'] ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
<img class="lf-bt__image" src="{{ $imageUrl }}" alt="{{ $imageAlt ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@include('widgets.partials.image-notice')
|
||||
@@ -0,0 +1,4 @@
|
||||
{{-- Nur Redaktionsvorschau: Das gewählte Bild erscheint öffentlich nicht (fehlende Website-Freigabe, Verarbeitung). --}}
|
||||
@if (! empty($imageNotice) && $context->preview)
|
||||
<p class="preview-note">{{ $imageNotice }}</p>
|
||||
@endif
|
||||
@@ -0,0 +1,108 @@
|
||||
{{--
|
||||
Premium-Karte (Brand-UI-Kit v1.7, Entwurf zur visuellen Freigabe) für Themen-, Medien-, Material- und Programmkarten.
|
||||
Alle Texte und das Linkziel kommen aus $subject (Fachdaten zur Laufzeit, PublicCatalogReader/PublicMaterialReader);
|
||||
redaktionell sind nur Kartenbild, Alternativtext, Bildausschnitt, Beschriftung der Aktion und Hinweis.
|
||||
|
||||
Bildbereich, in dieser Reihenfolge:
|
||||
1. Kartenbild aus dem öffentlichen Website-Bereich (Reiter „Medien“) – öffentlich und in der Vorschau.
|
||||
2. Nur Redaktionsvorschau: Vorschaubild der Bibliothek (Filmstandbild, Modulvorschau), deutlich als nicht
|
||||
öffentlich markiert. Es hat keine Freigabe für die Website und wird öffentlich nie ausgegeben.
|
||||
3. Tafel nach Fachobjekt: Programm/Modul (Navy), Film (Filmtafel), Material (Materialsymbol); Thema ohne Bildbereich.
|
||||
Hinweise auf fehlende Inhalte stehen nur in der Redaktionsvorschau, öffentlich nie.
|
||||
--}}
|
||||
@if ($subject === null)
|
||||
@if ($context->preview)
|
||||
<p class="preview-note">Kein Objekt verknüpft, oder das verknüpfte Objekt ist archiviert beziehungsweise gesperrt. Öffentlich erscheint diese Karte nicht.</p>
|
||||
@endif
|
||||
@elseif ($subject->public || $context->preview)
|
||||
@php
|
||||
$libraryImage = $imageUrl === null && $context->preview ? $subject->previewImage : null;
|
||||
$panel = $imageUrl === null && $libraryImage === null ? $subject->visual : null;
|
||||
$action = $show['action'] && $subject->url !== null ? ['url' => $subject->url, 'label' => $actionLabel] : null;
|
||||
$meta = $show['meta'] ? $subject->meta : [];
|
||||
$hints = $subject->missing;
|
||||
$panelName = ['catalog' => 'die Navy-Tafel', 'film' => 'die Filmtafel', 'material' => 'das Materialsymbol'][$subject->visual] ?? 'die Karte ohne Bild';
|
||||
if ($context->preview && $imageUrl === null) {
|
||||
$hints[] = $subject->previewImage !== null
|
||||
? 'Das Vorschaubild der Bibliothek ist nicht für die Website freigegeben; öffentlich erscheint stattdessen '.$panelName.'. Ein freigegebenes Motiv kann im Reiter „Medien“ als Kartenbild gewählt werden.'
|
||||
: 'Kein Kartenbild gewählt; öffentlich erscheint '.$panelName.' (Kartenbild im Reiter „Medien“).';
|
||||
}
|
||||
@endphp
|
||||
<article @class([
|
||||
'lf-pc',
|
||||
'lf-pc--'.$cardStyle,
|
||||
'lf-pc--'.$format,
|
||||
'lf-pc--'.$fit,
|
||||
'lf-pc--stacked' => $stacked,
|
||||
'lf-pc--without-visual' => $imageUrl === null && $libraryImage === null && $panel === null,
|
||||
'lf-pc--internal' => ! $subject->public,
|
||||
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%">
|
||||
@if ($imageUrl !== null || $libraryImage !== null)
|
||||
<div class="lf-pc__visual">
|
||||
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
|
||||
@if ($show['kind'] && $subject->badge !== null)
|
||||
<span class="lf-pc__badge">{{ $subject->badge }}</span>
|
||||
@endif
|
||||
@if ($libraryImage !== null)
|
||||
<span class="lf-pc__library-flag">Bibliotheksbild · nur Vorschau</span>
|
||||
@endif
|
||||
</div>
|
||||
@elseif ($panel !== null)
|
||||
<div class="lf-pc__panel lf-pc__panel--{{ $panel }}" aria-hidden="true">
|
||||
@if ($panel === 'film')
|
||||
<svg class="lf-pc__panel-icon" viewBox="0 0 48 48" focusable="false"><rect x="6" y="10" width="36" height="28" rx="4" fill="none" stroke="currentColor" stroke-width="3"/><path d="M6 17h36M6 31h36M14 10v7M22 10v7M30 10v7M38 10v7M14 31v7M22 31v7M30 31v7M38 31v7" stroke="currentColor" stroke-width="2.5"/></svg>
|
||||
@elseif ($panel === 'material')
|
||||
<svg class="lf-pc__panel-icon" viewBox="0 0 48 48" focusable="false"><path d="M12 5h17l9 9v29H12z" fill="none" stroke="currentColor" stroke-width="3" stroke-linejoin="round"/><path d="M29 5v9h9M18 24h14M18 30h14M18 36h9" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"/></svg>
|
||||
@endif
|
||||
<span class="lf-pc__panel-label">{{ $subject->visualLabel ?? $subject->kind }}</span>
|
||||
<x-brand.underline class="lf-pc__panel-accent" />
|
||||
</div>
|
||||
@endif
|
||||
<div class="lf-pc__body">
|
||||
@if ($show['kind'] && $subject->kind !== '')
|
||||
<p class="lf-pc__kind">{{ $subject->kind }}</p>
|
||||
@endif
|
||||
<{{ $headingTag }} class="lf-pc__title">{{ $subject->title }}</{{ $headingTag }}>
|
||||
@if ($show['summary'] && filled($subject->summary))
|
||||
<p class="lf-pc__summary">{{ $subject->summary }}</p>
|
||||
@endif
|
||||
@if ($meta !== [])
|
||||
<ul class="lf-pc__meta" aria-label="Weitere Angaben">
|
||||
@foreach ($meta as $item)
|
||||
<li>{{ $item }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@if ($action !== null || $note !== null)
|
||||
<div class="lf-pc__footer">
|
||||
@if ($note !== null)
|
||||
<p class="lf-pc__note">{{ $note }}</p>
|
||||
@endif
|
||||
@if ($action !== null)
|
||||
<a class="lf-pc__cta" href="{{ $action['url'] }}">{{ $action['label'] }}</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if ($context->preview && (! $subject->public || $hints !== []))
|
||||
@unless ($subject->public)
|
||||
<p class="lf-pc__private-flag">Nur Redaktionsvorschau</p>
|
||||
@endunless
|
||||
<details class="preview-note lf-pc__editorial">
|
||||
<summary>Hinweise für die Redaktion ({{ count($hints) + ($subject->public ? 0 : 1) }})</summary>
|
||||
@if (! $subject->public && $subject->notice !== null)
|
||||
<p>{{ $subject->notice }}</p>
|
||||
@endif
|
||||
@if ($hints !== [])
|
||||
<p>Für eine vollständige Karte fehlt:</p>
|
||||
<ul>
|
||||
@foreach ($hints as $hint)
|
||||
<li>{{ $hint }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</details>
|
||||
@endif
|
||||
</div>
|
||||
</article>
|
||||
@include('widgets.partials.image-notice')
|
||||
@endif
|
||||
@@ -13,6 +13,7 @@
|
||||
use App\Http\Controllers\PublicCatalogController;
|
||||
use App\Http\Controllers\PublicMediaController;
|
||||
use App\Http\Controllers\ThemeController;
|
||||
use App\Http\Controllers\WebsiteMediaController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', [PageController::class, 'home'])->name('home');
|
||||
@@ -22,6 +23,7 @@
|
||||
Route::get('/programme/{composition}', [PublicCatalogController::class, 'program'])->name('public.program');
|
||||
Route::get('/themen/{slug}', [ThemeController::class, 'show'])->name('theme')->where('slug', '[a-z0-9]+(?:-[a-z0-9]+)*');
|
||||
Route::get('/medien/{path}', [PublicMediaController::class, 'show'])->where('path', '.*')->name('media.public');
|
||||
Route::get('/website-medien/{element}', [WebsiteMediaController::class, 'show'])->whereNumber('element')->name('website.media');
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('/registrieren', [RegistrationController::class, 'create'])->name('register');
|
||||
|
||||
@@ -96,7 +96,7 @@ public function test_catalog_pages_show_contents_packages_and_resolved_rights():
|
||||
$sheet->load('element');
|
||||
|
||||
$this->actingAs($editor, 'staff')
|
||||
->get(ContentElementResource::getUrl('view', ['record' => $sheet->element]))
|
||||
->get(ContentElementResource::getUrl('view', ['record' => $sheet->element]).'?bereich=inhalt')
|
||||
->assertOk()
|
||||
->assertSee('Hinweis für die Prüfung.')
|
||||
->assertSee('Fassung 1')
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Domain\Cms\NavigationItem;
|
||||
use App\Domain\Cms\Page;
|
||||
@@ -269,15 +270,15 @@ public function test_unsafe_link_is_reported_at_the_section_and_nothing_is_saved
|
||||
|
||||
public function test_errors_found_only_by_the_registry_are_announced_with_the_section(): void
|
||||
{
|
||||
Storage::fake('media_public');
|
||||
Storage::fake('cms_incoming');
|
||||
Storage::disk('media_public')->put('cms/bild.jpg', 'bild');
|
||||
// Bewusst geändert: Der Alternativtext ist keine Pflicht mehr (er gehört zum Medium). Fehler, den nur die Registry
|
||||
// findet: ein Medium, das kein Website-Bild ist.
|
||||
$film = app(ContentService::class)->createElement('film', 'film', 'Ein Film');
|
||||
$page = Page::query()->where('path', '/')->firstOrFail();
|
||||
$revisions = $page->revisions()->count();
|
||||
$component = Livewire::actingAs($this->editor(), 'staff')->test(EditPage::class, ['record' => $page->id]);
|
||||
$state = $component->get('data.sections');
|
||||
$state[(string) Str::uuid()] = $this->sectionState('u4', [
|
||||
['type' => 'hero', 'data' => ['variant' => 'photo_split', 'data' => ['heading' => 'Mit Bild'], 'refs' => ['image' => 'cms/bild.jpg']]],
|
||||
['type' => 'hero', 'data' => ['variant' => 'photo_split', 'data' => ['heading' => 'Mit Bild'], 'refs' => ['image' => $film->id]]],
|
||||
]);
|
||||
|
||||
$component->set('data.sections', $state)
|
||||
|
||||
@@ -65,32 +65,75 @@ public function test_publishing_also_counts_as_an_edit(): void
|
||||
$this->assertSame('2026-11-18 11:00:00', $page->fresh()->updated_at->toDateTimeString());
|
||||
}
|
||||
|
||||
public function test_first_section_can_start_directly_below_the_header_without_changing_other_spacing(): void
|
||||
/**
|
||||
* Drei unabhängige Abstände je Abschnitt; zwischen zwei Abschnitten addieren sich „unten“ und „oben“ (0 + 0 = 0).
|
||||
*/
|
||||
public function test_sections_render_three_independent_spacings(): void
|
||||
{
|
||||
$page = Page::query()->create(['path' => '/abstand']);
|
||||
$service = app(PageService::class);
|
||||
$hero = ['type' => 'hero', 'v' => 2, 'data' => ['heading' => 'Einstieg']];
|
||||
$prose = fn (string $text) => ['type' => 'prose', 'v' => 1, 'data' => ['body' => $text]];
|
||||
$revision = $service->saveRevision($page, [
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing' => 'large'], 'slots' => [$hero]],
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'small'], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]],
|
||||
['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Weiter']]]],
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing_bottom' => 'none', 'gap' => 'none'], 'slots' => [['type' => 'hero', 'v' => 2, 'data' => ['heading' => 'Einstieg']]]],
|
||||
['layout' => 'u3_1', 'style' => ['spacing_top' => 'none', 'spacing_bottom' => 'large', 'gap' => 'compact'], 'slots' => [$prose('Drei'), $prose('Eins')]],
|
||||
['layout' => 'u4', 'style' => [], 'slots' => [$prose('Vorgabe')]],
|
||||
], null, null, null);
|
||||
$service->publish($page, $revision);
|
||||
|
||||
$html = $this->get('/abstand')->assertOk()->getContent();
|
||||
$this->assertMatchesRegularExpression('#class="page-section section-bg-default section-width-standard section-space-large section-space-top-none section-layout-u4"#', $html);
|
||||
$this->assertStringContainsString('section-space-normal section-space-top-small section-layout-u4', $html);
|
||||
$this->assertSame(2, substr_count($html, 'section-space-top-'), 'Ohne Angabe gilt der normale Abstand; keine zusätzliche Klasse.');
|
||||
$this->assertSame('same', $revision->sections[2]['style']['spacing_top']);
|
||||
$this->assertStringContainsString('oben kein abstand', SectionStyle::summary($revision->sections[0]['style']));
|
||||
$this->assertStringContainsString('section-space-top-none section-space-bottom-none section-gap-none section-layout-u4', $html);
|
||||
$this->assertStringContainsString('section-space-top-none section-space-bottom-large section-gap-compact section-layout-u3-1', $html);
|
||||
$this->assertStringContainsString('section-space-top-compact section-space-bottom-compact section-gap-normal section-layout-u4', $html, 'Vorgabe neuer Abschnitte: oben und unten kompakt, Widget-Abstand normal.');
|
||||
$style = $revision->sections[0]['style'];
|
||||
$this->assertSame(['none', 'none', 'none'], [$style['spacing_top'], $style['spacing_bottom'], $style['gap']]);
|
||||
$this->assertStringContainsString('Abstand oben kein abstand, unten großzügig · Widget-Abstand kompakt', SectionStyle::summary($revision->sections[1]['style']));
|
||||
}
|
||||
|
||||
public function test_top_spacing_accepts_only_its_enumerated_values(): void
|
||||
/**
|
||||
* Hüllen der Version 1 werden beim Lesen so übersetzt, dass die Darstellung gleich bleibt (gespeicherte Revision unverändert).
|
||||
*/
|
||||
public function test_version_one_spacing_is_translated_without_changing_the_layout(): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
$prose = ['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']];
|
||||
$v1 = fn (array $style, ?array $slots = null) => ['id' => null, 'v' => 1, 'layout' => 'u4', 'style' => $style + ['divider' => 'none'], 'slots' => $slots ?? [$prose]];
|
||||
|
||||
app(PageSections::class)->normalize([
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => '0px'], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]],
|
||||
$sections = app(PageSections::class)->read([
|
||||
$v1(['background' => 'default', 'spacing' => 'normal', 'spacing_top' => 'none']),
|
||||
$v1(['background' => 'default', 'spacing' => 'normal']),
|
||||
$v1(['background' => 'dark', 'spacing' => 'large']),
|
||||
$v1(['background' => 'default', 'spacing' => 'compact', 'divider' => 'line']),
|
||||
$v1(['background' => 'default', 'spacing' => 'normal', 'spacing_top' => 'small']),
|
||||
$v1(['background' => 'default', 'spacing' => 'compact', 'divider' => 'space']),
|
||||
$v1(['background' => 'default', 'spacing' => 'normal'], [null]),
|
||||
$v1(['background' => 'default', 'spacing' => 'large']),
|
||||
]);
|
||||
|
||||
$spacing = array_map(fn ($s) => [$s['style']['spacing_top'], $s['style']['spacing_bottom'], $s['style']['gap'], $s['style']['divider']], $sections);
|
||||
$this->assertSame([
|
||||
['none', 'normal', 'normal', 'none'], // Abweichung „kein Abstand“
|
||||
['none', 'normal', 'normal', 'none'], // folgt Abschnitt ohne Fläche: bisher oben 0
|
||||
['large', 'large', 'normal', 'none'], // eigene Fläche: oben wie Abstand
|
||||
['compact', 'compact', 'normal', 'line'], // folgt dunkler Fläche: oben wie Abstand
|
||||
['compact', 'normal', 'normal', 'none'], // nach Linientrenner keine Zusammenlegung; „Gering“ wird „Kompakt“
|
||||
['none', 'normal', 'normal', 'none'], // folgt ohne Fläche: oben 0; „Zusätzlicher Abstand“ wird unten eine Stufe mehr
|
||||
['none', 'normal', 'normal', 'none'], // leer, wird nicht dargestellt
|
||||
['none', 'large', 'normal', 'none'], // folgt Abschnitt 5 (leerer Abschnitt dazwischen zählt nicht)
|
||||
], $spacing);
|
||||
$this->assertSame([2, 2], [$sections[0]['v'], $sections[7]['v']]);
|
||||
$this->assertArrayNotHasKey('spacing', $sections[0]['style']);
|
||||
}
|
||||
|
||||
public function test_spacings_accept_only_their_enumerated_values(): void
|
||||
{
|
||||
foreach (['spacing_top' => 'medium', 'spacing_bottom' => '0px', 'gap' => '2rem'] as $key => $value) {
|
||||
try {
|
||||
app(PageSections::class)->normalize([
|
||||
['layout' => 'u4', 'style' => ['spacing_top' => 'none', 'spacing_bottom' => 'none', 'gap' => 'none', $key => $value], 'slots' => [['type' => 'prose', 'v' => 1, 'data' => ['body' => 'Text']]]],
|
||||
]);
|
||||
$this->fail("$key: $value wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertArrayHasKey("sections.0.style.$key", $exception->errors());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user