Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f7c645baf |
No files matched your search
@@ -265,13 +265,6 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
|||||||
$profile = app(EditorialProfileReader::class)->read($composition, 'kachel');
|
$profile = app(EditorialProfileReader::class)->read($composition, 'kachel');
|
||||||
$summary = $profile->value('teaser') ?: $profile->value('summary');
|
$summary = $profile->value('teaser') ?: $profile->value('summary');
|
||||||
$goal = filled($version?->learning_goal) ? trim((string) $version->learning_goal) : null;
|
$goal = filled($version?->learning_goal) ? trim((string) $version->learning_goal) : null;
|
||||||
// Zentrale Texte, aus denen die Redaktion den Kartentext wählen kann (Zielgruppe „Öffentliche Kachel“).
|
|
||||||
$texts = [
|
|
||||||
'teaser' => $profile->value('teaser'),
|
|
||||||
'summary' => $profile->value('summary'),
|
|
||||||
'description' => $profile->value('description'),
|
|
||||||
'goal' => $goal,
|
|
||||||
];
|
|
||||||
$missing = [];
|
$missing = [];
|
||||||
|
|
||||||
if ($summary === null) {
|
if ($summary === null) {
|
||||||
@@ -320,7 +313,6 @@ public function subject(mixed $id, bool $includeNonPublic): ?CardSubject
|
|||||||
visualLabel: $kind,
|
visualLabel: $kind,
|
||||||
previewImage: $includeNonPublic ? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path) : null,
|
previewImage: $includeNonPublic ? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path) : null,
|
||||||
missing: $missing,
|
missing: $missing,
|
||||||
texts: $texts,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
* erscheint nur, wenn die Redaktion sie ausdrücklich wählt. Nie: Einsatzhinweis, Lizenzvermerk, Dateien, Lehrtexte,
|
* erscheint nur, wenn die Redaktion sie ausdrücklich wählt. Nie: Einsatzhinweis, Lizenzvermerk, Dateien, Lehrtexte,
|
||||||
* Ausgabeadressen. Das Vorschaubild der Bibliothek ist nicht für die Website freigegeben; es erscheint nur in der
|
* Ausgabeadressen. Das Vorschaubild der Bibliothek ist nicht für die Website freigegeben; es erscheint nur in der
|
||||||
* Redaktionsvorschau und kann in der Karte ausdrücklich als Website-Bild übernommen werden (FilmStill).
|
* Redaktionsvorschau und kann in der Karte ausdrücklich als Website-Bild übernommen werden (FilmStill).
|
||||||
* Eine Karte spielt höchstens den für die Website freigegebenen Trailer ab (CardClip), bietet keinen Download und gibt kein Medium frei.
|
* Eine Karte spielt nichts ab, bietet keinen Download und gibt kein Medium frei.
|
||||||
*/
|
*/
|
||||||
class PublicMaterialReader
|
class PublicMaterialReader
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domain\Cms\Widgets\Support;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use App\Domain\Catalog\PresentationAssignment;
|
|
||||||
use App\Domain\Media\WebsiteMedia;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Der kurze Clip, den eine Premium-Karte beim Überfahren oder Antippen abspielt.
|
|
||||||
*
|
|
||||||
* Gelesen wird nur, was die Redaktion ohnehin für die Website freigegeben hat (WebsiteMedia, Route website.media):
|
|
||||||
* 1. der Trailer des Fachobjekts (Präsentationsrolle „Trailer“), sonst der Vorschauclip,
|
|
||||||
* 2. bei einem Film ersatzweise dessen eigener freigegebener Teaser.
|
|
||||||
* Der vollständige Film, die Originaldatei und nicht freigegebene Clips kommen nie über die Karte. Die Karte gibt
|
|
||||||
* nichts frei; ohne freigegebenen Clip bleibt es beim Kartenbild.
|
|
||||||
*
|
|
||||||
* In der Redaktionsvorschau erklärt `notice`, warum kein Clip läuft (zugeordnet, aber nicht freigegeben).
|
|
||||||
*/
|
|
||||||
class CardClip
|
|
||||||
{
|
|
||||||
/** Rollen in der Reihenfolge, in der ein Clip gesucht wird. */
|
|
||||||
public const ROLES = ['trailer', 'vorschauclip'];
|
|
||||||
|
|
||||||
public function __construct(private readonly WebsiteMedia $media) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array{url: string|null, title: string, source: string, notice: string|null, hint: string|null}
|
|
||||||
*/
|
|
||||||
public function for(Model $subject, bool $preview): array
|
|
||||||
{
|
|
||||||
$assigned = PresentationAssignment::query()
|
|
||||||
->with(['role', 'element'])
|
|
||||||
->where('subject_type', $subject->getMorphClass())
|
|
||||||
->where('subject_id', $subject->getKey())
|
|
||||||
->whereHas('role', fn ($query) => $query->whereIn('slug', self::ROLES))
|
|
||||||
->orderBy('position')
|
|
||||||
->orderBy('id')
|
|
||||||
->get()
|
|
||||||
->sortBy(fn (PresentationAssignment $row): int => (int) array_search($row->role?->slug, self::ROLES, true))
|
|
||||||
->values();
|
|
||||||
|
|
||||||
$unreleased = null;
|
|
||||||
|
|
||||||
foreach ($assigned as $assignment) {
|
|
||||||
$element = $assignment->element;
|
|
||||||
|
|
||||||
if (! $element instanceof ContentElement || $element->archived_at !== null || $element->output_class !== 'film') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$present = $this->media->present($element);
|
|
||||||
|
|
||||||
if ($present !== null && $present->kind === 'film') {
|
|
||||||
return $this->found($present->url, $present->title, $assignment->role?->slug === 'trailer' ? 'trailer' : 'vorschauclip');
|
|
||||||
}
|
|
||||||
|
|
||||||
$unreleased ??= $element;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($subject instanceof ContentElement && $subject->output_class === 'film') {
|
|
||||||
$own = $this->media->present($subject);
|
|
||||||
|
|
||||||
if ($own !== null && $own->kind === 'film') {
|
|
||||||
return $this->found($own->url, $own->title, 'teaser');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $preview) {
|
|
||||||
return $this->none();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($unreleased instanceof ContentElement) {
|
|
||||||
$title = (string) ($unreleased->display_title ?: $unreleased->working_title);
|
|
||||||
|
|
||||||
return $this->none('Der Trailer „'.$title.'“ ist nicht für die Website freigegeben; öffentlich bleibt es beim Kartenbild (Medium öffnen → Reiter „Website“ → freigeben).');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->none(null, 'Kein Trailer zugeordnet; die Karte zeigt nur das Bild (Rolle „Trailer“ in der Präsentation des Mediums).');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array{url: string|null, title: string, source: string, notice: string|null, hint: string|null}
|
|
||||||
*/
|
|
||||||
private function found(string $url, string $title, string $source): array
|
|
||||||
{
|
|
||||||
return ['url' => $url, 'title' => $title, 'source' => $source, 'notice' => null, 'hint' => null];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array{url: string|null, title: string, source: string, notice: string|null, hint: string|null}
|
|
||||||
*/
|
|
||||||
private function none(?string $notice = null, ?string $hint = null): array
|
|
||||||
{
|
|
||||||
return ['url' => null, 'title' => '', 'source' => 'none', 'notice' => $notice, 'hint' => $hint];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,16 +8,14 @@
|
|||||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||||
use App\Domain\Cms\Widgets\RenderContext;
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
use App\Domain\Media\FilmStill;
|
use App\Domain\Media\FilmStill;
|
||||||
use App\Domain\Media\ThumbnailRef;
|
|
||||||
use Filament\Forms\Components\ViewField;
|
use Filament\Forms\Components\ViewField;
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Medien- und Materialkarte (Kit v1.7 „media“): ein Inhaltselement mit Anzeigetitel, Kurzbeschreibung, Inhaltsart und
|
* 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
|
* 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
|
* Materialien als Materialkarte (Materialsymbol). Öffentlich nur nach den Regeln von PublicMaterialReader; die Aktion
|
||||||
* führt auf die öffentliche Programmseite. Die Karte spielt höchstens den für die Website freigegebenen Trailer ab (CardClip), bietet keinen Download und gibt kein Medium frei.
|
* führt auf die öffentliche Programmseite. Die Karte spielt nichts ab, bietet keinen Download und gibt kein Medium frei.
|
||||||
*/
|
*/
|
||||||
class MediaCardWidget extends PremiumCardWidget
|
class MediaCardWidget extends PremiumCardWidget
|
||||||
{
|
{
|
||||||
@@ -33,7 +31,7 @@ public function label(): string
|
|||||||
|
|
||||||
public function description(): string
|
public function description(): string
|
||||||
{
|
{
|
||||||
return 'Karte zu einem Film oder Material aus der Bibliothek; Titel und Art kommen aus den Fachdaten, Trailer nur wenn freigegeben, kein Download.';
|
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
|
public function icon(): string
|
||||||
@@ -117,7 +115,6 @@ protected function imageSourceFields(): array
|
|||||||
'filmTitle' => $film instanceof ContentElement ? (string) ($film->display_title ?: $film->working_title) : '',
|
'filmTitle' => $film instanceof ContentElement ? (string) ($film->display_title ?: $film->working_title) : '',
|
||||||
'filmVersionId' => $version?->id,
|
'filmVersionId' => $version?->id,
|
||||||
'filmHasThumbnail' => $film instanceof ContentElement && is_string($film->thumbnail_path) && $film->thumbnail_path !== '',
|
'filmHasThumbnail' => $film instanceof ContentElement && is_string($film->thumbnail_path) && $film->thumbnail_path !== '',
|
||||||
'filmThumbnailUrl' => $film instanceof ContentElement ? ThumbnailRef::url('editorial.card', 'element', (int) $film->id, $film->thumbnail_path) : null,
|
|
||||||
'filmStartSecond' => $film instanceof ContentElement ? ($stills->thumbnailSecond($film) ?? '0') : '0',
|
'filmStartSecond' => $film instanceof ContentElement ? ($stills->thumbnailSecond($film) ?? '0') : '0',
|
||||||
];
|
];
|
||||||
}),
|
}),
|
||||||
@@ -131,11 +128,6 @@ private function filmFor(mixed $id): ?ContentElement
|
|||||||
return $element instanceof ContentElement && app(FilmStill::class)->refusal($element) === null ? $element : null;
|
return $element instanceof ContentElement && app(FilmStill::class)->refusal($element) === null ? $element : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function subjectNoun(): string
|
|
||||||
{
|
|
||||||
return 'Medium';
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function textChoices(): array
|
protected function textChoices(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -146,18 +138,6 @@ protected function textChoices(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function supportsClip(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function clipSubject(mixed $id): ?Model
|
|
||||||
{
|
|
||||||
$element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null;
|
|
||||||
|
|
||||||
return $element instanceof ContentElement ? $element : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function centralCoverId(mixed $id): ?int
|
protected function centralCoverId(mixed $id): ?int
|
||||||
{
|
{
|
||||||
$element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null;
|
$element = is_numeric($id) ? ContentElement::query()->find((int) $id) : null;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
use App\Domain\Cms\Catalog\CardSubject;
|
use App\Domain\Cms\Catalog\CardSubject;
|
||||||
use App\Domain\Cms\Widgets\RenderContext;
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
use App\Domain\Cms\Widgets\Support\CardClip;
|
|
||||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Schemas\Components\Group;
|
use Filament\Schemas\Components\Group;
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
use Filament\Schemas\Components\Utilities\Get;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,6 +33,13 @@ abstract class PremiumCardWidget extends WidgetType
|
|||||||
{
|
{
|
||||||
public const SHOW = ['yes' => 'Anzeigen', 'no' => 'Ausblenden'];
|
public const SHOW = ['yes' => 'Anzeigen', 'no' => 'Ausblenden'];
|
||||||
|
|
||||||
|
/** Hinweise der Redaktionsvorschau, wenn der gewählte zentrale Text nicht gepflegt ist. */
|
||||||
|
public const TEXT_MISSING = [
|
||||||
|
'teaser' => 'Kein Teaser gepflegt (Medium bearbeiten → Teaser).',
|
||||||
|
'summary' => 'Keine Kurzbeschreibung gepflegt (Medium bearbeiten → Kurzbeschreibung).',
|
||||||
|
'description' => 'Keine ausführliche Beschreibung gepflegt (Medium bearbeiten → Beschreibung).',
|
||||||
|
];
|
||||||
|
|
||||||
/** Schlüssel des Fachobjekts in refs, zum Beispiel 'pillar'. */
|
/** Schlüssel des Fachobjekts in refs, zum Beispiel 'pillar'. */
|
||||||
abstract protected function refKey(): string;
|
abstract protected function refKey(): string;
|
||||||
|
|
||||||
@@ -69,15 +74,6 @@ protected function imageSourceFields(): array
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fachobjekt, dessen Trailer die Karte beim Überfahren oder Antippen abspielt (Medium, Programm, Modul).
|
|
||||||
* Null: diese Karte hat keinen Clip (Thema). Der Clip kommt aus der Präsentation des Objekts (CardClip).
|
|
||||||
*/
|
|
||||||
protected function clipSubject(mixed $id): ?Model
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zentrale Texte des Fachobjekts, aus denen die Redaktion den Kartentext wählen kann: Wert => Bezeichnung.
|
* Zentrale Texte des Fachobjekts, aus denen die Redaktion den Kartentext wählen kann: Wert => Bezeichnung.
|
||||||
* Leer: keine Wahl (die Karte nimmt den Text ihrer Vorgabe). Mit Wahl gilt „auto“ als Vorgabe.
|
* Leer: keine Wahl (die Karte nimmt den Text ihrer Vorgabe). Mit Wahl gilt „auto“ als Vorgabe.
|
||||||
@@ -89,26 +85,6 @@ protected function textChoices(): array
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Was die Redaktion bearbeitet, um einen Text zu pflegen („Medium“, „Programm oder Modul“); für Hinweise. */
|
|
||||||
protected function subjectNoun(): string
|
|
||||||
{
|
|
||||||
return 'Objekt';
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Hinweis der Redaktionsvorschau, wenn der gewählte zentrale Text nicht gepflegt ist. */
|
|
||||||
private function missingTextHint(string $field): string
|
|
||||||
{
|
|
||||||
$noun = $this->subjectNoun();
|
|
||||||
|
|
||||||
return match ($field) {
|
|
||||||
'teaser' => 'Kein Teaser gepflegt ('.$noun.' bearbeiten → Teaser).',
|
|
||||||
'summary' => 'Keine Kurzbeschreibung gepflegt ('.$noun.' bearbeiten → Kurzbeschreibung).',
|
|
||||||
'description' => 'Keine ausführliche Beschreibung gepflegt ('.$noun.' bearbeiten → Beschreibung).',
|
|
||||||
'goal' => 'Kein Lernziel gepflegt ('.$noun.' bearbeiten → Lernziel der Fassung).',
|
|
||||||
default => '',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public function view(): string
|
public function view(): string
|
||||||
{
|
{
|
||||||
return 'widgets.premium_card';
|
return 'widgets.premium_card';
|
||||||
@@ -165,7 +141,7 @@ public function settings(): array
|
|||||||
{
|
{
|
||||||
$choices = $this->textChoices();
|
$choices = $this->textChoices();
|
||||||
|
|
||||||
return ($choices === [] ? [] : ['text_source' => $choices]) + ($this->supportsClip() ? ['clip' => ['yes' => 'Abspielen', 'no' => 'Nicht abspielen']] : []) + [
|
return ($choices === [] ? [] : ['text_source' => $choices]) + [
|
||||||
'format' => ['landscape' => 'Querformat 16:9', 'square' => 'Quadrat 1:1', 'portrait' => 'Hochformat 3:4'],
|
'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)'],
|
'fit' => ['cover' => 'Ausschnitt füllt die Fläche', 'contain' => 'Ganzes Bild zeigen (Dokument, Poster)'],
|
||||||
'heading_level' => ['h3' => 'H3', 'h2' => 'H2', 'h4' => 'H4'],
|
'heading_level' => ['h3' => 'H3', 'h2' => 'H2', 'h4' => 'H4'],
|
||||||
@@ -180,7 +156,6 @@ public function settingLabels(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'text_source' => ['Text der Karte', 'Welche Angabe aus der Redaktion die Karte zeigt. Vorgabe: Automatisch. Der gewählte Text erscheint öffentlich, wenn die Karte öffentlich ist; ist er nicht gepflegt, bleibt die Karte ohne Text.'],
|
'text_source' => ['Text der Karte', 'Welche Angabe aus der Redaktion die Karte zeigt. Vorgabe: Automatisch. Der gewählte Text erscheint öffentlich, wenn die Karte öffentlich ist; ist er nicht gepflegt, bleibt die Karte ohne Text.'],
|
||||||
'clip' => ['Trailer auf der Karte', 'Spielt den freigegebenen Trailer stumm ab, solange die Maus auf der Karte steht; am Handy mit Tippen auf das Bild, per Tastatur über die Schaltfläche am Bild. Gewählt wird der Trailer (sonst der Vorschauclip) in der Präsentation des Objekts, bei einem Film ersatzweise sein freigegebener Teaser. Ohne freigegebenen Clip bleibt das Kartenbild. Vorgabe: Abspielen.'],
|
|
||||||
'format' => ['Bildformat', 'Vorgabe: Querformat 16:9. Gilt auch neben dem Text; das Motiv wird nicht nachträglich hochkant beschnitten.'],
|
'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.'],
|
'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).'],
|
'heading_level' => ['Überschriftenebene', 'Vorgabe: H3, passend unter einer Abschnittsüberschrift (H2).'],
|
||||||
@@ -308,7 +283,7 @@ public function resolve(array $widget, RenderContext $context): array
|
|||||||
$textSource = $option('text_source', 'auto');
|
$textSource = $option('text_source', 'auto');
|
||||||
|
|
||||||
if ($subject instanceof CardSubject && $textSource !== 'auto' && isset($this->textChoices()[$textSource])) {
|
if ($subject instanceof CardSubject && $textSource !== 'auto' && isset($this->textChoices()[$textSource])) {
|
||||||
$subject = $subject->withTextChoice($textSource, $this->missingTextHint($textSource));
|
$subject = $subject->withTextChoice($textSource, self::TEXT_MISSING[$textSource] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$heading = filled($data['heading'] ?? null) ? trim((string) $data['heading']) : null;
|
$heading = filled($data['heading'] ?? null) ? trim((string) $data['heading']) : null;
|
||||||
@@ -321,16 +296,8 @@ public function resolve(array $widget, RenderContext $context): array
|
|||||||
$storedImage = WebsiteImage::normalize($widget['refs']['image'] ?? null);
|
$storedImage = WebsiteImage::normalize($widget['refs']['image'] ?? null);
|
||||||
$imageRef = $storedImage ?? $this->centralCoverId($widget['refs'][$this->refKey()] ?? null);
|
$imageRef = $storedImage ?? $this->centralCoverId($widget['refs'][$this->refKey()] ?? null);
|
||||||
|
|
||||||
$clip = null;
|
|
||||||
|
|
||||||
if ($this->supportsClip() && $option('clip', 'yes') === 'yes' && $subject instanceof CardSubject) {
|
|
||||||
$owner = $this->clipSubject($widget['refs'][$this->refKey()] ?? null);
|
|
||||||
$clip = $owner instanceof Model ? app(CardClip::class)->for($owner, $context->preview) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'clip' => $clip,
|
|
||||||
'cardStyle' => $subject?->style ?? $this->cardStyle(),
|
'cardStyle' => $subject?->style ?? $this->cardStyle(),
|
||||||
'imageUrl' => app(WebsiteImage::class)->url($imageRef, $context->preview),
|
'imageUrl' => app(WebsiteImage::class)->url($imageRef, $context->preview),
|
||||||
'alt' => app(WebsiteImage::class)->alt($imageRef, $data['alt'] ?? null),
|
'alt' => app(WebsiteImage::class)->alt($imageRef, $data['alt'] ?? null),
|
||||||
@@ -370,11 +337,6 @@ protected function centralCoverId(mixed $id): ?int
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function supportsClip(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zentraler Anzeigename oder Teaser des gewählten Objekts (Redaktionsstand) für Platzhalter im Editor.
|
* Zentraler Anzeigename oder Teaser des gewählten Objekts (Redaktionsstand) für Platzhalter im Editor.
|
||||||
*/
|
*/
|
||||||
@@ -391,7 +353,7 @@ private function centralText(mixed $id, string $field, mixed $textSource = null)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($subject instanceof CardSubject && is_string($textSource) && isset($this->textChoices()[$textSource]) && $textSource !== 'auto') {
|
if ($subject instanceof CardSubject && is_string($textSource) && isset($this->textChoices()[$textSource]) && $textSource !== 'auto') {
|
||||||
$subject = $subject->withTextChoice($textSource, $this->missingTextHint($textSource));
|
$subject = $subject->withTextChoice($textSource, self::TEXT_MISSING[$textSource] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = $subject?->{$field};
|
$text = $subject?->{$field};
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
use App\Domain\Cms\Catalog\CardSubject;
|
use App\Domain\Cms\Catalog\CardSubject;
|
||||||
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
use App\Domain\Cms\Catalog\PublicCatalogReader;
|
||||||
use App\Domain\Cms\Widgets\RenderContext;
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
use App\Domain\Media\CompositionStill;
|
|
||||||
use App\Domain\Media\ThumbnailRef;
|
|
||||||
use Filament\Forms\Components\ViewField;
|
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modul- und Programmkarte (Kit v1.7 „catalog“): ein Programm oder Modul über PublicCatalogReader, dieselbe
|
* Modul- und Programmkarte (Kit v1.7 „catalog“): ein Programm oder Modul über PublicCatalogReader, dieselbe
|
||||||
@@ -46,59 +41,6 @@ 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']];
|
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']];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Das Vorschaubild des Programms oder Moduls als Kartenbild übernehmen. Es wird einmal als Bild-Medium abgelegt
|
|
||||||
* (CompositionStill) und wie jedes andere Bild ausgewählt; die Karte liest nur diese Datei.
|
|
||||||
*/
|
|
||||||
protected function imageSourceFields(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ViewField::make('_programmbild')
|
|
||||||
->label('Bild aus dem Programm oder Modul')
|
|
||||||
->view('filament.cms.kompositionsbild-feld')
|
|
||||||
->dehydrated(false)
|
|
||||||
->visible(fn (Get $get): bool => $this->compositionFor($get('composition')) !== null)
|
|
||||||
->viewData(function (Get $get): array {
|
|
||||||
$composition = $this->compositionFor($get('composition'));
|
|
||||||
|
|
||||||
return [
|
|
||||||
'composition' => $composition,
|
|
||||||
'compositionTitle' => $composition instanceof Composition ? (string) ($composition->display_title ?: $composition->designation) : '',
|
|
||||||
'compositionThumbnailUrl' => $composition instanceof Composition && app(CompositionStill::class)->hasThumbnail($composition)
|
|
||||||
? ThumbnailRef::url('editorial.card', 'komposition', (int) $composition->id, $composition->thumbnail_path)
|
|
||||||
: null,
|
|
||||||
];
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function compositionFor(mixed $id): ?Composition
|
|
||||||
{
|
|
||||||
$composition = is_numeric($id) ? Composition::query()->with('editorialContentKind')->find((int) $id) : null;
|
|
||||||
|
|
||||||
return $composition instanceof Composition && app(PublicCatalogReader::class)->isCardSelectable($composition) ? $composition : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function subjectNoun(): string
|
|
||||||
{
|
|
||||||
return 'Programm oder Modul';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wählbare Texte: die zentralen Texte des Programms oder Moduls und das Lernziel der Fassung. „Automatisch“ bleibt
|
|
||||||
* wie bisher: Teaser, sonst Kurzbeschreibung, sonst Lernziel. Die ausführliche Beschreibung erscheint nur auf Wahl.
|
|
||||||
*/
|
|
||||||
protected function textChoices(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'auto' => 'Automatisch (Teaser, sonst Kurzbeschreibung, sonst Lernziel)',
|
|
||||||
'teaser' => 'Teaser',
|
|
||||||
'summary' => 'Kurzbeschreibung',
|
|
||||||
'description' => 'Ausführliche Beschreibung (erscheint öffentlich)',
|
|
||||||
'goal' => 'Lernziel der Fassung',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function settings(): array
|
public function settings(): array
|
||||||
{
|
{
|
||||||
// Die Art (Programm oder Modul) bleibt immer sichtbar; sie lässt sich nicht ausblenden.
|
// Die Art (Programm oder Modul) bleibt immer sichtbar; sie lässt sich nicht ausblenden.
|
||||||
@@ -157,18 +99,6 @@ protected function cardStyle(): string
|
|||||||
return 'catalog';
|
return 'catalog';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function supportsClip(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function clipSubject(mixed $id): ?Model
|
|
||||||
{
|
|
||||||
$composition = is_numeric($id) ? Composition::query()->find((int) $id) : null;
|
|
||||||
|
|
||||||
return $composition instanceof Composition ? $composition : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function centralCoverId(mixed $id): ?int
|
protected function centralCoverId(mixed $id): ?int
|
||||||
{
|
{
|
||||||
$composition = is_numeric($id) ? Composition::query()->find((int) $id) : null;
|
$composition = is_numeric($id) ? Composition::query()->find((int) $id) : null;
|
||||||
|
|||||||
@@ -140,6 +140,27 @@ private function createOrder(User $user, Party $holder, array $pairs): Order
|
|||||||
public function confirmTestPayment(Order $order, string $reference): Order
|
public function confirmTestPayment(Order $order, string $reference): Order
|
||||||
{
|
{
|
||||||
$this->assertTestDriver();
|
$this->assertTestDriver();
|
||||||
|
|
||||||
|
return $this->settle($order, 'test', $reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zahlung eines Anbieters (Stripe): wie die Testzahlung, aber erst nach Prüfung von Betrag und Währung gegen die
|
||||||
|
* Bestellung. Wiederholte Meldungen sind wirkungslos.
|
||||||
|
*/
|
||||||
|
public function confirmProviderPayment(Order $order, string $provider, string $reference, int $amountCents, string $currency): Order
|
||||||
|
{
|
||||||
|
$expected = (int) ($order->total_cents ?? $order->lines()->sum('price_cents'));
|
||||||
|
|
||||||
|
if ($amountCents !== $expected || strtoupper($currency) !== strtoupper((string) ($order->currency ?? 'EUR'))) {
|
||||||
|
throw new DomainRuleException('Der gezahlte Betrag weicht von der Bestellung ab.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->settle($order, $provider, $reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function settle(Order $order, string $provider, string $reference): Order
|
||||||
|
{
|
||||||
$reference = trim($reference);
|
$reference = trim($reference);
|
||||||
|
|
||||||
if ($reference === '') {
|
if ($reference === '') {
|
||||||
@@ -147,7 +168,7 @@ public function confirmTestPayment(Order $order, string $reference): Order
|
|||||||
}
|
}
|
||||||
|
|
||||||
$paidNow = false;
|
$paidNow = false;
|
||||||
$order = DB::transaction(function () use ($order, $reference, &$paidNow): Order {
|
$order = DB::transaction(function () use ($order, $provider, $reference, &$paidNow): Order {
|
||||||
$order = Order::query()->lockForUpdate()->findOrFail($order->id);
|
$order = Order::query()->lockForUpdate()->findOrFail($order->id);
|
||||||
|
|
||||||
if ($order->status === 'bezahlt') {
|
if ($order->status === 'bezahlt') {
|
||||||
@@ -158,11 +179,11 @@ public function confirmTestPayment(Order $order, string $reference): Order
|
|||||||
throw new DomainRuleException('Diese Bestellung nimmt keine Zahlung mehr an.');
|
throw new DomainRuleException('Diese Bestellung nimmt keine Zahlung mehr an.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->payments()->create([
|
// Eine bei Stripe angelegte offene Zahlung mit derselben Referenz wird bestätigt statt doppelt geführt.
|
||||||
'provider' => 'test',
|
$order->payments()->updateOrCreate(
|
||||||
'status' => 'bestaetigt',
|
['provider_reference' => $reference],
|
||||||
'provider_reference' => $reference,
|
['provider' => $provider, 'status' => 'bestaetigt'],
|
||||||
]);
|
);
|
||||||
$order->status = 'bezahlt';
|
$order->status = 'bezahlt';
|
||||||
$order->save();
|
$order->save();
|
||||||
$paidNow = true;
|
$paidNow = true;
|
||||||
|
|||||||
@@ -9,8 +9,19 @@
|
|||||||
*/
|
*/
|
||||||
final class Shop
|
final class Shop
|
||||||
{
|
{
|
||||||
|
public static function driver(): string
|
||||||
|
{
|
||||||
|
return (string) config('services.payment.driver');
|
||||||
|
}
|
||||||
|
|
||||||
public static function enabled(): bool
|
public static function enabled(): bool
|
||||||
{
|
{
|
||||||
return ! app()->isProduction() && config('services.payment.driver') === 'test';
|
return ! app()->isProduction() && in_array(self::driver(), ['test', 'stripe'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stripe-Kasse (Etappe 1: nur Testmodus, nie in Produktion). */
|
||||||
|
public static function stripe(): bool
|
||||||
|
{
|
||||||
|
return ! app()->isProduction() && self::driver() === 'stripe';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Commerce\Stripe;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\DomainRuleException;
|
||||||
|
use App\Domain\Commerce\Order;
|
||||||
|
use Illuminate\Http\Client\ConnectionException;
|
||||||
|
use Illuminate\Http\Client\PendingRequest;
|
||||||
|
use Illuminate\Http\Client\Response;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stripe-Kasse (Checkout Session) für die Testzahlung in Etappe 1. Ausschließlich Testschlüssel: Ein Live-Schlüssel
|
||||||
|
* oder die Produktionsumgebung werden abgewiesen, bevor ein Aufruf an Stripe geht. Bezahlt wird bei Stripe; Kartendaten
|
||||||
|
* berühren diese Anwendung nie. Die Freischaltung erfolgt allein über die signierte Meldung (StripeWebhook).
|
||||||
|
*/
|
||||||
|
class StripeGateway
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Legt für die Bestellung eine Checkout Session an oder liefert die noch offene wieder.
|
||||||
|
*
|
||||||
|
* @return array{id: string, url: string}
|
||||||
|
*/
|
||||||
|
public function checkoutFor(Order $order): array
|
||||||
|
{
|
||||||
|
$this->assertSandbox();
|
||||||
|
$order->loadMissing('lines', 'user');
|
||||||
|
|
||||||
|
if ($order->status !== 'offen') {
|
||||||
|
throw new DomainRuleException('Diese Bestellung nimmt keine Zahlung mehr an.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$open = $this->reusableSession($order);
|
||||||
|
|
||||||
|
if ($open !== null) {
|
||||||
|
return $open;
|
||||||
|
}
|
||||||
|
|
||||||
|
$attempt = $order->payments()->where('provider', 'stripe')->count() + 1;
|
||||||
|
$params = [
|
||||||
|
'mode' => 'payment',
|
||||||
|
'client_reference_id' => (string) $order->id,
|
||||||
|
'customer_email' => $order->user->email,
|
||||||
|
'locale' => 'de',
|
||||||
|
'success_url' => route('member.order', $order).'?zahlung=zurueck',
|
||||||
|
'cancel_url' => route('member.order', $order).'?zahlung=abbruch',
|
||||||
|
'metadata' => ['order_id' => (string) $order->id],
|
||||||
|
'payment_intent_data' => ['metadata' => ['order_id' => (string) $order->id]],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($order->lines->values() as $index => $line) {
|
||||||
|
$params['line_items'][$index] = [
|
||||||
|
'quantity' => 1,
|
||||||
|
'price_data' => [
|
||||||
|
'currency' => strtolower((string) ($line->currency ?? $order->currency ?? 'EUR')),
|
||||||
|
'unit_amount' => (int) $line->price_cents,
|
||||||
|
'product_data' => ['name' => filled($line->offer_name) ? (string) $line->offer_name : 'Lizenz'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->request()
|
||||||
|
->withHeaders(['Idempotency-Key' => 'luf-order-'.$order->id.'-'.$attempt])
|
||||||
|
->post('/v1/checkout/sessions', $params);
|
||||||
|
|
||||||
|
$this->assertOk($response, 'angelegt');
|
||||||
|
$id = (string) $response->json('id');
|
||||||
|
$url = (string) $response->json('url');
|
||||||
|
|
||||||
|
if ($id === '' || $url === '') {
|
||||||
|
throw new DomainRuleException('Stripe hat keine Kasse geliefert. Bitte versuche es später noch einmal.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$order->payments()->create(['provider' => 'stripe', 'status' => 'offen', 'provider_reference' => $id]);
|
||||||
|
|
||||||
|
return ['id' => $id, 'url' => $url];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function assertSandbox(): void
|
||||||
|
{
|
||||||
|
$secret = (string) config('services.stripe.secret');
|
||||||
|
|
||||||
|
if (app()->isProduction()) {
|
||||||
|
throw new DomainRuleException('Stripe ist in Produktion nicht freigegeben.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($secret === '') {
|
||||||
|
throw new DomainRuleException('Stripe ist nicht eingerichtet: Der Schlüssel fehlt.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! str_starts_with($secret, 'sk_test_') && ! str_starts_with($secret, 'rk_test_')) {
|
||||||
|
throw new DomainRuleException('Etappe 1 erlaubt nur den Stripe-Testmodus (Schlüssel sk_test_).');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{id: string, url: string}|null
|
||||||
|
*/
|
||||||
|
private function reusableSession(Order $order): ?array
|
||||||
|
{
|
||||||
|
$payment = $order->payments()->where('provider', 'stripe')->where('status', 'offen')->latest('id')->first();
|
||||||
|
|
||||||
|
if ($payment === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = $this->request()->get('/v1/checkout/sessions/'.$payment->provider_reference);
|
||||||
|
} catch (ConnectionException) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($response->successful() && $response->json('status') === 'open' && filled($response->json('url'))) {
|
||||||
|
return ['id' => (string) $payment->provider_reference, 'url' => (string) $response->json('url')];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function request(): PendingRequest
|
||||||
|
{
|
||||||
|
return Http::baseUrl(rtrim((string) config('services.stripe.api_base'), '/'))
|
||||||
|
->withToken((string) config('services.stripe.secret'))
|
||||||
|
->asForm()
|
||||||
|
->acceptJson()
|
||||||
|
->timeout(15);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function assertOk(Response $response, string $what): void
|
||||||
|
{
|
||||||
|
if ($response->successful()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nur Statuscode und Fehlertyp ins Log, nie Schlüssel oder Kundendaten.
|
||||||
|
Log::warning('Stripe-Anfrage fehlgeschlagen', [
|
||||||
|
'status' => $response->status(),
|
||||||
|
'type' => $response->json('error.type'),
|
||||||
|
'code' => $response->json('error.code'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
throw new DomainRuleException('Die Zahlung konnte bei Stripe nicht '.$what.' werden. Bitte versuche es später noch einmal.');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Commerce\Stripe;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\DomainRuleException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft die Signatur einer Stripe-Meldung (Header „Stripe-Signature“: t=Zeit, v1=HMAC-SHA256 über „t.Nutzlast“).
|
||||||
|
* Eine Meldung ohne gültige Signatur oder außerhalb der Zeittoleranz wird abgewiesen.
|
||||||
|
*/
|
||||||
|
class StripeSignature
|
||||||
|
{
|
||||||
|
public const TOLERANCE_SECONDS = 300;
|
||||||
|
|
||||||
|
public function verify(string $payload, ?string $header, ?int $now = null): void
|
||||||
|
{
|
||||||
|
$secret = (string) config('services.stripe.webhook_secret');
|
||||||
|
|
||||||
|
if ($secret === '') {
|
||||||
|
throw new DomainRuleException('Das Webhook-Geheimnis ist nicht eingerichtet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($header === null || trim($header) === '') {
|
||||||
|
throw new DomainRuleException('Die Signatur fehlt.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$timestamp = null;
|
||||||
|
$signatures = [];
|
||||||
|
|
||||||
|
foreach (explode(',', $header) as $part) {
|
||||||
|
[$key, $value] = array_pad(explode('=', trim($part), 2), 2, '');
|
||||||
|
|
||||||
|
if ($key === 't') {
|
||||||
|
$timestamp = ctype_digit($value) ? (int) $value : null;
|
||||||
|
} elseif ($key === 'v1' && $value !== '') {
|
||||||
|
$signatures[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($timestamp === null || $signatures === []) {
|
||||||
|
throw new DomainRuleException('Die Signatur ist unvollständig.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$expected = hash_hmac('sha256', $timestamp.'.'.$payload, $secret);
|
||||||
|
$valid = false;
|
||||||
|
|
||||||
|
foreach ($signatures as $signature) {
|
||||||
|
$valid = hash_equals($expected, $signature) || $valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $valid) {
|
||||||
|
throw new DomainRuleException('Die Signatur stimmt nicht.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abs(($now ?? now()->getTimestamp()) - $timestamp) > self::TOLERANCE_SECONDS) {
|
||||||
|
throw new DomainRuleException('Die Meldung ist zu alt.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domain\Media;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\Composition;
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use App\Domain\Catalog\DomainRuleException;
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Database\QueryException;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Übernimmt das Vorschaubild eines Programms oder Moduls als gewöhnliches Bild-Medium im Medienmanager
|
|
||||||
* (Programm- und Modulkarte), nach demselben Prinzip wie FilmStill.
|
|
||||||
*
|
|
||||||
* - Ausdrückliche Handlung der Redaktion. Das Vorschaubild ist ein geschütztes Bibliotheksbild; erst die Übernahme
|
|
||||||
* legt ein Medium an, das für die Website freigegeben werden kann (WebsiteIntake, Warteschlange).
|
|
||||||
* - Die Datei wird einmal kopiert. Dieselbe Vorschaudatei ergibt dasselbe Medium (composition_still_sources).
|
|
||||||
* - Es entsteht keine Fassung, keine Berechtigung, kein Lizenzartikel.
|
|
||||||
*/
|
|
||||||
class CompositionStill
|
|
||||||
{
|
|
||||||
/** Wahr, wenn der letzte Aufruf ein schon vorhandenes Bild geliefert hat. */
|
|
||||||
public bool $reused = false;
|
|
||||||
|
|
||||||
public function __construct(private readonly WebsiteIntake $intake) {}
|
|
||||||
|
|
||||||
public function refusal(Composition $composition): ?string
|
|
||||||
{
|
|
||||||
if ($composition->archived_at !== null) {
|
|
||||||
return 'Das Programm oder Modul ist archiviert.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasThumbnail(Composition $composition): bool
|
|
||||||
{
|
|
||||||
$path = $composition->thumbnail_path;
|
|
||||||
|
|
||||||
return is_string($path) && str_starts_with($path, 'vorschau/') && ! str_contains($path, '..')
|
|
||||||
&& Storage::disk('media_derived')->exists($path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function fromThumbnail(Composition $composition, ?User $actor = null): ContentElement
|
|
||||||
{
|
|
||||||
$this->reused = false;
|
|
||||||
$refusal = $this->refusal($composition);
|
|
||||||
|
|
||||||
if ($refusal !== null) {
|
|
||||||
throw new DomainRuleException($refusal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $this->hasThumbnail($composition)) {
|
|
||||||
throw new DomainRuleException('Dieses Programm oder Modul hat noch kein Vorschaubild. Setzen Sie es im Redaktionsmanager.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$bytes = Storage::disk('media_derived')->get((string) $composition->thumbnail_path);
|
|
||||||
|
|
||||||
if (! is_string($bytes) || $bytes === '') {
|
|
||||||
throw new DomainRuleException('Das Vorschaubild ließ sich nicht lesen.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$key = 'file:'.hash('sha256', $bytes);
|
|
||||||
$existing = $this->existing($composition, $key);
|
|
||||||
|
|
||||||
if ($existing instanceof ContentElement) {
|
|
||||||
$this->reused = true;
|
|
||||||
|
|
||||||
return $existing;
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = (string) ($composition->display_title ?: $composition->designation);
|
|
||||||
$path = 'cms/titelbild-'.$composition->id.'-'.Str::lower(Str::random(8)).'.jpg';
|
|
||||||
Storage::disk('cms_incoming')->put($path, $bytes);
|
|
||||||
|
|
||||||
$still = $this->intake->acceptImage($path, 'Titelbild: '.$title, null, 'Titelbild zu „'.$title.'“', $actor);
|
|
||||||
|
|
||||||
try {
|
|
||||||
CompositionStillSource::query()->updateOrCreate(
|
|
||||||
['composition_id' => $composition->id, 'source_key' => $key],
|
|
||||||
['still_element_id' => $still->id, 'actor_id' => $actor?->id],
|
|
||||||
);
|
|
||||||
} catch (QueryException) {
|
|
||||||
return $this->existing($composition, $key) ?? $still;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $still;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function existing(Composition $composition, string $key): ?ContentElement
|
|
||||||
{
|
|
||||||
$source = CompositionStillSource::query()->with('still')->where('composition_id', $composition->id)->where('source_key', $key)->first();
|
|
||||||
$still = $source?->still;
|
|
||||||
|
|
||||||
// Ein archiviertes oder bei der Verarbeitung gescheitertes Bild wird nicht wiederverwendet.
|
|
||||||
return $still instanceof ContentElement && $still->archived_at === null && ! filled($still->thumbnail_error) ? $still : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Domain\Media;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\Composition;
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Herkunft eines Bild-Mediums aus dem Vorschaubild eines Programms oder Moduls (source_key file:{SHA-256}).
|
|
||||||
*/
|
|
||||||
class CompositionStillSource extends Model
|
|
||||||
{
|
|
||||||
protected $fillable = ['composition_id', 'still_element_id', 'source_key', 'actor_id'];
|
|
||||||
|
|
||||||
public function composition(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Composition::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function still(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(ContentElement::class, 'still_element_id');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,72 +4,39 @@
|
|||||||
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
use App\Domain\Catalog\ContentElement;
|
||||||
use App\Domain\Catalog\DomainRuleException;
|
use App\Domain\Catalog\DomainRuleException;
|
||||||
use App\Jobs\StorePresentationFile;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Legt die technische Ableitung eines Präsentationsmediums (Website-Datei) an der Medienidentität ab.
|
* Legt die technische Ableitung eines Präsentationsmediums an der Medienidentität ab.
|
||||||
* Es entsteht keine Inhaltsfassung, keine Freigabe und keine Berechtigung. Eine vorhandene Inhaltsfassung bleibt
|
* Es entsteht keine Inhaltsfassung, keine Freigabe und keine Berechtigung.
|
||||||
* unverändert und geschützt; die Website-Datei ist eine eigene, bewusst gewählte Datei daneben.
|
|
||||||
*
|
|
||||||
* Der Web-Prozess hat `derived/` nur lesend. Er prüft deshalb nur und gibt das Kopieren an die Warteschlange
|
|
||||||
* (`StorePresentationFile`, ruft `place()` auf).
|
|
||||||
*/
|
*/
|
||||||
class PresentationFile
|
class PresentationFile
|
||||||
{
|
{
|
||||||
/**
|
public function store(ContentElement $element, string $incoming): void
|
||||||
* Dateiendungen, die ein Browser auf der Website abspielen kann.
|
|
||||||
*
|
|
||||||
* @var array<string, list<string>>
|
|
||||||
*/
|
|
||||||
public const EXTENSIONS = [
|
|
||||||
'bild' => ['jpg', 'jpeg', 'png', 'webp', 'gif'],
|
|
||||||
'audio' => ['mp3', 'm4a', 'ogg'],
|
|
||||||
'film' => ['mp4', 'webm'],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prüft die Datei im Eingang, ohne etwas zu verändern. Wirft eine verständliche Regelverletzung.
|
|
||||||
*/
|
|
||||||
public function validate(string $outputClass, string $incoming): void
|
|
||||||
{
|
{
|
||||||
if (! isset(self::EXTENSIONS[$outputClass])) {
|
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.');
|
throw new DomainRuleException('Eine Präsentationsdatei ist ein Bild, ein Film oder ein Hörstück.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = strtolower(pathinfo($incoming, PATHINFO_EXTENSION));
|
if ($element->versions()->exists()) {
|
||||||
|
throw new DomainRuleException('Dieses Medium hat bereits eine Inhaltsfassung. Die Präsentationsdatei ersetzt sie nicht.');
|
||||||
if (! in_array($extension, self::EXTENSIONS[$outputClass], true)) {
|
|
||||||
throw new DomainRuleException(sprintf(
|
|
||||||
'Für die Website geht nur %s. Eine %s-Datei kann der Browser nicht direkt abspielen; wandle sie vorher um oder lade sie ohne „Eigenständiges Präsentationsmedium“ hoch.',
|
|
||||||
$this->formats($outputClass),
|
|
||||||
$extension === '' ? 'Datei ohne Endung' : '.'.$extension,
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->readable($incoming)) {
|
if (! $this->readable($incoming)) {
|
||||||
throw new DomainRuleException('Die Datei liegt nicht im Eingang.');
|
throw new DomainRuleException('Die Datei liegt nicht im Eingang.');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function store(ContentElement $element, string $incoming): void
|
|
||||||
{
|
|
||||||
$this->validate((string) $element->output_class, $incoming);
|
|
||||||
|
|
||||||
$element->thumbnail_error = null;
|
|
||||||
$element->save();
|
|
||||||
|
|
||||||
StorePresentationFile::dispatch($element->id, $incoming);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Kopiert die Datei nach `derived/`. Läuft nur in der Warteschlange, die dort schreiben darf.
|
|
||||||
*/
|
|
||||||
public function place(ContentElement $element, string $incoming): void
|
|
||||||
{
|
|
||||||
$this->validate((string) $element->output_class, $incoming);
|
|
||||||
|
|
||||||
$extension = strtolower(pathinfo($incoming, PATHINFO_EXTENSION));
|
$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';
|
$prefix = $element->output_class === 'bild' ? 'vorschau' : 'teaser';
|
||||||
$target = $prefix.'/'.$element->id.'/datei.'.$extension;
|
$target = $prefix.'/'.$element->id.'/datei.'.$extension;
|
||||||
$stream = Storage::disk('cms_incoming')->readStream($incoming);
|
$stream = Storage::disk('cms_incoming')->readStream($incoming);
|
||||||
@@ -79,15 +46,11 @@ public function place(ContentElement $element, string $incoming): void
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$written = Storage::disk('media_derived')->writeStream($target, $stream);
|
Storage::disk('media_derived')->writeStream($target, $stream);
|
||||||
} finally {
|
} finally {
|
||||||
fclose($stream);
|
fclose($stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($written === false) {
|
|
||||||
throw new DomainRuleException('Die Datei ließ sich nicht ablegen.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($element->output_class === 'bild') {
|
if ($element->output_class === 'bild') {
|
||||||
$element->thumbnail_path = $target;
|
$element->thumbnail_path = $target;
|
||||||
$element->thumbnail_source = 'eigen';
|
$element->thumbnail_source = 'eigen';
|
||||||
@@ -95,18 +58,7 @@ public function place(ContentElement $element, string $incoming): void
|
|||||||
$element->preview_path = $target;
|
$element->preview_path = $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
$element->thumbnail_error = null;
|
|
||||||
$element->save();
|
$element->save();
|
||||||
Storage::disk('cms_incoming')->delete($incoming);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function formats(string $outputClass): string
|
|
||||||
{
|
|
||||||
return match ($outputClass) {
|
|
||||||
'bild' => 'JPG, PNG, WebP oder GIF',
|
|
||||||
'audio' => 'MP3, M4A oder OGG',
|
|
||||||
default => 'MP4 (H.264) oder WebM',
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function readable(string $path): bool
|
private function readable(string $path): bool
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public function refusal(ContentElement $element): ?string
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->derivedPath($element) === null) {
|
if ($this->derivedPath($element) === null) {
|
||||||
return 'Für die Website fehlt eine freigebbare Datei. Beim Bild ist das das Vorschaubild. Bei Film und Hörstück lädst du unter „Website-Freigabe“ eine Website-Datei hoch (Film als MP4 oder WebM); die geschützte Originaldatei bleibt unberührt.';
|
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;
|
return null;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
use App\Domain\Cms\Catalog\PublicMaterialReader;
|
||||||
use App\Domain\Cms\WebsiteImageUsage;
|
use App\Domain\Cms\WebsiteImageUsage;
|
||||||
use App\Domain\Cms\Widgets\RenderContext;
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
use App\Domain\Media\PresentationFile;
|
|
||||||
use App\Domain\Media\ThumbnailRef;
|
use App\Domain\Media\ThumbnailRef;
|
||||||
use App\Domain\Media\WebsiteMedia;
|
use App\Domain\Media\WebsiteMedia;
|
||||||
use App\Domain\Media\WebsiteRelease;
|
use App\Domain\Media\WebsiteRelease;
|
||||||
@@ -93,9 +92,6 @@ class ViewContentElement extends ViewRecord
|
|||||||
|
|
||||||
public string $websiteFeedback = '';
|
public string $websiteFeedback = '';
|
||||||
|
|
||||||
/** Gewählte Website-Datei für Film oder Hörstück (ungeschützt, getrennt von der Inhaltsfassung). */
|
|
||||||
public mixed $websiteUpload = null;
|
|
||||||
|
|
||||||
public int|string|null $kindId = null;
|
public int|string|null $kindId = null;
|
||||||
|
|
||||||
/** @var list<int|string> */
|
/** @var list<int|string> */
|
||||||
@@ -848,61 +844,6 @@ public function releaseForWebsite(): void
|
|||||||
$element->refresh();
|
$element->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Legt die Datei ab, die auf der Website laufen soll (zum Beispiel ein Trailer). Die geschützte Inhaltsfassung
|
|
||||||
* bleibt unberührt; öffentlich wird die Datei erst mit der Website-Freigabe.
|
|
||||||
*/
|
|
||||||
public function storeWebsiteFile(): void
|
|
||||||
{
|
|
||||||
abort_unless(ContentElementResource::editor(), 403);
|
|
||||||
|
|
||||||
/** @var ContentElement $element */
|
|
||||||
$element = $this->getRecord();
|
|
||||||
|
|
||||||
if (! in_array($element->output_class, ['film', 'audio'], true)) {
|
|
||||||
$this->websiteFeedback = 'Eine Website-Datei gibt es nur für Filme und Hörstücke.';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $this->websiteUpload instanceof TemporaryUploadedFile) {
|
|
||||||
$this->websiteFeedback = 'Wähle zuerst eine Datei.';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$files = app(PresentationFile::class);
|
|
||||||
$extension = strtolower($this->websiteUpload->getClientOriginalExtension());
|
|
||||||
|
|
||||||
if (! in_array($extension, PresentationFile::EXTENSIONS[$element->output_class], true)) {
|
|
||||||
$this->websiteFeedback = 'Für die Website geht nur '.$files->formats($element->output_class).'. Eine .'.$extension.'-Datei kann der Browser nicht direkt abspielen.';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = $this->websiteUpload->storeAs('inhalte', 'web-'.bin2hex(random_bytes(6)).'.'.$extension, 'cms_incoming');
|
|
||||||
$this->websiteUpload = null;
|
|
||||||
|
|
||||||
if (! is_string($path)) {
|
|
||||||
$this->websiteFeedback = 'Die Datei wurde nicht übernommen.';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$files->store($element, $path);
|
|
||||||
} catch (DomainRuleException $e) {
|
|
||||||
$this->websiteFeedback = $e->getMessage();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$element->refresh();
|
|
||||||
$this->websiteFeedback = filled($element->thumbnail_error)
|
|
||||||
? (string) $element->thumbnail_error
|
|
||||||
: 'Die Website-Datei ist übernommen. Sie ist erst nach „Für die Website freigeben“ öffentlich. Ein bereits freigegebenes Medium zeigt danach die neue Datei.';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function withdrawWebsite(): void
|
public function withdrawWebsite(): void
|
||||||
{
|
{
|
||||||
abort_unless(ContentElementResource::editor(), 403);
|
abort_unless(ContentElementResource::editor(), 403);
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Filament\Support;
|
namespace App\Filament\Support;
|
||||||
|
|
||||||
use App\Domain\Catalog\Composition;
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
use App\Domain\Catalog\ContentElement;
|
||||||
use App\Domain\Catalog\DomainRuleException;
|
use App\Domain\Catalog\DomainRuleException;
|
||||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
||||||
use App\Domain\Media\CompositionStill;
|
|
||||||
use App\Domain\Media\FilmStill;
|
use App\Domain\Media\FilmStill;
|
||||||
use App\Domain\Media\WebsiteMedia;
|
use App\Domain\Media\WebsiteMedia;
|
||||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||||
@@ -60,38 +58,6 @@ public function adoptFilmFrame(string $pfad, int $elementId, string $sekunde): v
|
|||||||
$this->adoptFilmStill($pfad, $elementId, fn (FilmStill $stills, ContentElement $film): ContentElement => $stills->fromSecond($film, (float) $sekunde, auth('staff')->user()));
|
$this->adoptFilmStill($pfad, $elementId, fn (FilmStill $stills, ContentElement $film): ContentElement => $stills->fromSecond($film, (float) $sekunde, auth('staff')->user()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Programm- und Modulkarte: das Vorschaubild des Programms oder Moduls als Bild für die Website übernehmen
|
|
||||||
* (Bild-Medium im Medienmanager, einmal kopiert).
|
|
||||||
*/
|
|
||||||
public function adoptCompositionThumbnail(string $pfad, int $compositionId): void
|
|
||||||
{
|
|
||||||
abort_unless(ContentElementResource::editor(), 403);
|
|
||||||
|
|
||||||
if ($this->imageTargetIsInvalid($pfad)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$composition = Composition::query()->find($compositionId);
|
|
||||||
|
|
||||||
if (! $composition instanceof Composition) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$stills = app(CompositionStill::class);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$still = $stills->fromThumbnail($composition, auth('staff')->user());
|
|
||||||
} catch (DomainRuleException $exception) {
|
|
||||||
Notification::make()->danger()->title($exception->getMessage())->send();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
data_set($this, $pfad, $still->id);
|
|
||||||
$this->announceAdoptedStill($still, $stills->reused, 'Dieses Vorschaubild war schon übernommen.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param callable(FilmStill, ContentElement): ContentElement $make
|
* @param callable(FilmStill, ContentElement): ContentElement $make
|
||||||
*/
|
*/
|
||||||
@@ -99,7 +65,7 @@ private function adoptFilmStill(string $pfad, int $elementId, callable $make): v
|
|||||||
{
|
{
|
||||||
abort_unless(ContentElementResource::editor(), 403);
|
abort_unless(ContentElementResource::editor(), 403);
|
||||||
|
|
||||||
if ($this->imageTargetIsInvalid($pfad)) {
|
if (preg_match('/^(data|mountedActions\.\d+\.data)(\.[A-Za-z0-9_-]+)+\.image$/', $pfad) !== 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,24 +86,9 @@ private function adoptFilmStill(string $pfad, int $elementId, callable $make): v
|
|||||||
}
|
}
|
||||||
|
|
||||||
data_set($this, $pfad, $still->id);
|
data_set($this, $pfad, $still->id);
|
||||||
$this->announceAdoptedStill($still, $stills->reused, 'Diese Stelle war schon übernommen.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Nur das Bildfeld eines Widgets oder Abschnitts ist ein zulässiges Ziel (…image). */
|
|
||||||
private function imageTargetIsInvalid(string $pfad): bool
|
|
||||||
{
|
|
||||||
return preg_match('/^(data|mountedActions\.\d+\.data)(\.[A-Za-z0-9_-]+)+\.image$/', $pfad) !== 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Meldung nach dem tatsächlichen Stand des Bildes: neu angelegt, schon vorhanden und freigegeben, wird verarbeitet
|
|
||||||
* oder Website-Freigabe zurückgenommen (bleibt zurückgenommen).
|
|
||||||
*/
|
|
||||||
private function announceAdoptedStill(ContentElement $still, bool $reused, string $reusedText): void
|
|
||||||
{
|
|
||||||
$title = ($still->display_title ?: $still->working_title);
|
$title = ($still->display_title ?: $still->working_title);
|
||||||
|
|
||||||
if (! $reused) {
|
if (! $stills->reused) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->success()
|
->success()
|
||||||
->title('Im Medienmanager angelegt: „'.$title.'“')
|
->title('Im Medienmanager angelegt: „'.$title.'“')
|
||||||
@@ -147,13 +98,14 @@ private function announceAdoptedStill(ContentElement $still, bool $reused, strin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dieselbe Stelle war schon übernommen: Der tatsächliche Stand des Bildes entscheidet über die Meldung.
|
||||||
if (app(WebsiteMedia::class)->present($still) !== null) {
|
if (app(WebsiteMedia::class)->present($still) !== null) {
|
||||||
Notification::make()->success()->title('Bereits im Medienmanager: „'.$title.'“')->body($reusedText.' Das Bild ist als Kartenbild ausgewählt.')->send();
|
Notification::make()->success()->title('Bereits im Medienmanager: „'.$title.'“')->body('Diese Stelle war schon übernommen. Das Bild ist als Kartenbild ausgewählt.')->send();
|
||||||
} elseif (blank($still->thumbnail_path) && blank($still->thumbnail_error)) {
|
} elseif (blank($still->thumbnail_path) && blank($still->thumbnail_error)) {
|
||||||
Notification::make()->success()->title('Bereits im Medienmanager: „'.$title.'“')->body('Das Bild wird noch verarbeitet und danach für die Website freigegeben.')->send();
|
Notification::make()->success()->title('Bereits im Medienmanager: „'.$title.'“')->body('Das Bild wird noch verarbeitet und danach für die Website freigegeben.')->send();
|
||||||
} else {
|
} else {
|
||||||
Notification::make()->warning()->title('Bild ausgewählt, aber nicht für die Website freigegeben: „'.$title.'“')
|
Notification::make()->warning()->title('Bild ausgewählt, aber nicht für die Website freigegeben: „'.$title.'“')
|
||||||
->body($reusedText.' Die Website-Freigabe wurde zurückgenommen. Das Bild erscheint öffentlich erst wieder, wenn sie im Medienmanager (Reiter „Website“) erneut gegeben wird.')
|
->body('Diese Stelle war schon übernommen und die Website-Freigabe wurde zurückgenommen. Das Bild erscheint öffentlich erst wieder, wenn sie im Medienmanager (Reiter „Website“) erneut gegeben wird.')
|
||||||
->persistent()
|
->persistent()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public static function fields(bool $creating, ?ContentElement $element = null):
|
|||||||
->required(fn ($get): bool => filled($get('shape')) && $get('shape') !== 'text');
|
->required(fn ($get): bool => filled($get('shape')) && $get('shape') !== 'text');
|
||||||
$fields[] = Checkbox::make('without_version')
|
$fields[] = Checkbox::make('without_version')
|
||||||
->label('Eigenständiges Präsentationsmedium')
|
->label('Eigenständiges Präsentationsmedium')
|
||||||
->helperText('Bild, Film oder Hörstück ohne fachliche Inhaltsfassung, zum Beispiel ein Trailer, der ungeschützt auf der Website laufen soll. Der Film muss dafür MP4 (H.264) oder WebM sein. Er wird nicht lizenziert und erst nach „Für die Website freigeben“ öffentlich.')
|
->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));
|
->visible(fn ($get): bool => in_array($get('shape'), ['film', 'audio', 'bild'], true));
|
||||||
} elseif ($element?->output_class === 'text') {
|
} elseif ($element?->output_class === 'text') {
|
||||||
$fields[] = Textarea::make('body')->label('Text')->rows(8)->required();
|
$fields[] = Textarea::make('body')->label('Text')->rows(8)->required();
|
||||||
@@ -94,10 +94,20 @@ public static function create(array $data, bool $hold): ContentElement
|
|||||||
{
|
{
|
||||||
$service = app(ContentService::class);
|
$service = app(ContentService::class);
|
||||||
[$kind, $output] = self::shape($data['shape'] ?? null);
|
[$kind, $output] = self::shape($data['shape'] ?? null);
|
||||||
$incoming = null;
|
$element = $service->createElement($kind, $output, (string) $data['working_title']);
|
||||||
|
self::remember($element, $data);
|
||||||
|
|
||||||
if ($output !== 'text') {
|
if ($output === 'text') {
|
||||||
// Alles prüfen, bevor etwas angelegt wird: Eine abgelehnte Datei darf kein leeres Medium hinterlassen.
|
$body = trim((string) ($data['body'] ?? ''));
|
||||||
|
|
||||||
|
if ($body === '') {
|
||||||
|
throw new DomainRuleException('Der Text braucht einen Inhalt.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$hold
|
||||||
|
? $service->draftElementVersion($element, $body)
|
||||||
|
: $service->publishElementVersion($element, $body);
|
||||||
|
} else {
|
||||||
$incoming = IncomingFile::store($data['incoming'] ?? null);
|
$incoming = IncomingFile::store($data['incoming'] ?? null);
|
||||||
|
|
||||||
if ($incoming === null) {
|
if ($incoming === null) {
|
||||||
@@ -116,25 +126,6 @@ public static function create(array $data, bool $hold): ContentElement
|
|||||||
throw new DomainRuleException('Diese Datei passt nicht zur gewählten Art.');
|
throw new DomainRuleException('Diese Datei passt nicht zur gewählten Art.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['without_version']) && in_array($output, ['bild', 'film', 'audio'], true)) {
|
|
||||||
app(PresentationFile::class)->validate($output, $incoming);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$element = $service->createElement($kind, $output, (string) $data['working_title']);
|
|
||||||
self::remember($element, $data);
|
|
||||||
|
|
||||||
if ($output === 'text') {
|
|
||||||
$body = trim((string) ($data['body'] ?? ''));
|
|
||||||
|
|
||||||
if ($body === '') {
|
|
||||||
throw new DomainRuleException('Der Text braucht einen Inhalt.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$hold
|
|
||||||
? $service->draftElementVersion($element, $body)
|
|
||||||
: $service->publishElementVersion($element, $body);
|
|
||||||
} else {
|
|
||||||
if (! empty($data['without_version']) && in_array($output, ['bild', 'film', 'audio'], true)) {
|
if (! empty($data['without_version']) && in_array($output, ['bild', 'film', 'audio'], true)) {
|
||||||
app(PresentationFile::class)->store($element, $incoming);
|
app(PresentationFile::class)->store($element, $incoming);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
use App\Domain\Commerce\Checkout;
|
use App\Domain\Commerce\Checkout;
|
||||||
use App\Domain\Commerce\Order;
|
use App\Domain\Commerce\Order;
|
||||||
use App\Domain\Commerce\OrderHolders;
|
use App\Domain\Commerce\OrderHolders;
|
||||||
|
use App\Domain\Commerce\Shop;
|
||||||
use App\Domain\Commerce\StaleOverview;
|
use App\Domain\Commerce\StaleOverview;
|
||||||
|
use App\Domain\Commerce\Stripe\StripeGateway;
|
||||||
use App\Domain\Entitlement\GrantIssuer;
|
use App\Domain\Entitlement\GrantIssuer;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
@@ -99,9 +101,26 @@ public function show(Request $request, Order $order): View
|
|||||||
return view('member.order', [
|
return view('member.order', [
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'testPayment' => ! app()->isProduction() && config('services.payment.driver') === 'test',
|
'testPayment' => ! app()->isProduction() && config('services.payment.driver') === 'test',
|
||||||
|
'stripePayment' => Shop::stripe(),
|
||||||
|
'zahlung' => $request->query('zahlung'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Leitet zur Stripe-Kasse (Testmodus). Freigeschaltet wird erst durch die signierte Meldung von Stripe. */
|
||||||
|
public function pay(Request $request, Order $order, StripeGateway $stripe): RedirectResponse
|
||||||
|
{
|
||||||
|
abort_unless($order->user_id === $request->user()->id, 403);
|
||||||
|
abort_unless(Shop::stripe(), 404);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$session = $stripe->checkoutFor($order);
|
||||||
|
} catch (DomainRuleException $exception) {
|
||||||
|
return back()->withErrors(['payment' => $exception->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->away($session['url']);
|
||||||
|
}
|
||||||
|
|
||||||
public function confirm(Request $request, Order $order, Checkout $checkout): RedirectResponse
|
public function confirm(Request $request, Order $order, Checkout $checkout): RedirectResponse
|
||||||
{
|
{
|
||||||
abort_unless($order->user_id === $request->user()->id, 403);
|
abort_unless($order->user_id === $request->user()->id, 403);
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Domain\Catalog\DomainRuleException;
|
||||||
|
use App\Domain\Commerce\Checkout;
|
||||||
|
use App\Domain\Commerce\Order;
|
||||||
|
use App\Domain\Commerce\Payment;
|
||||||
|
use App\Domain\Commerce\Shop;
|
||||||
|
use App\Domain\Commerce\Stripe\StripeSignature;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empfängt die signierten Meldungen von Stripe (Etappe 1: Testmodus). Ohne gültige Signatur geschieht nichts. Die
|
||||||
|
* Freischaltung nutzt denselben geprüften Weg wie die Testzahlung und ist bei Wiederholung wirkungslos.
|
||||||
|
* Antworten: 404 wenn Stripe nicht aktiv ist, 400 bei ungültiger Signatur, sonst 200 (Stripe wiederholt sonst).
|
||||||
|
*/
|
||||||
|
class StripeWebhookController extends Controller
|
||||||
|
{
|
||||||
|
public function __invoke(Request $request, StripeSignature $signature, Checkout $checkout): JsonResponse
|
||||||
|
{
|
||||||
|
abort_unless(Shop::stripe(), 404);
|
||||||
|
|
||||||
|
$payload = $request->getContent();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$signature->verify($payload, $request->header('Stripe-Signature'));
|
||||||
|
} catch (DomainRuleException $exception) {
|
||||||
|
Log::warning('Stripe-Meldung abgewiesen', ['grund' => $exception->getMessage()]);
|
||||||
|
|
||||||
|
return response()->json(['error' => 'Ungültige Signatur.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$event = json_decode($payload, true);
|
||||||
|
|
||||||
|
if (! is_array($event) || ! isset($event['type'])) {
|
||||||
|
return response()->json(['error' => 'Ungültige Nutzlast.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$session = (array) ($event['data']['object'] ?? []);
|
||||||
|
|
||||||
|
return match ($event['type']) {
|
||||||
|
'checkout.session.completed', 'checkout.session.async_payment_succeeded' => $this->paid($session, $checkout),
|
||||||
|
'checkout.session.expired', 'checkout.session.async_payment_failed' => $this->notPaid($session, (string) $event['type']),
|
||||||
|
default => response()->json(['received' => true, 'handled' => false]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $session
|
||||||
|
*/
|
||||||
|
private function paid(array $session, Checkout $checkout): JsonResponse
|
||||||
|
{
|
||||||
|
if (($session['payment_status'] ?? null) !== 'paid') {
|
||||||
|
return response()->json(['received' => true, 'handled' => false]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = $this->orderOf($session);
|
||||||
|
$reference = (string) ($session['id'] ?? '');
|
||||||
|
|
||||||
|
if ($order === null || $reference === '') {
|
||||||
|
Log::warning('Stripe-Zahlung ohne zugehörige Bestellung', ['session' => $reference]);
|
||||||
|
|
||||||
|
return response()->json(['received' => true, 'handled' => false]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$checkout->confirmProviderPayment(
|
||||||
|
$order,
|
||||||
|
'stripe',
|
||||||
|
$reference,
|
||||||
|
(int) ($session['amount_total'] ?? -1),
|
||||||
|
(string) ($session['currency'] ?? ''),
|
||||||
|
);
|
||||||
|
} catch (DomainRuleException $exception) {
|
||||||
|
// Dauerhafter Fehler (Betragsabweichung, Bestellung nicht mehr offen): nichts freischalten, Zahlung zur
|
||||||
|
// Prüfung festhalten und 200 antworten, damit Stripe nicht endlos wiederholt.
|
||||||
|
Log::warning('Stripe-Zahlung nicht übernommen', ['order' => $order->id, 'session' => $reference, 'grund' => $exception->getMessage()]);
|
||||||
|
$order->payments()->updateOrCreate(['provider_reference' => $reference], ['provider' => 'stripe', 'status' => 'zu_pruefen']);
|
||||||
|
|
||||||
|
return response()->json(['received' => true, 'handled' => false]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['received' => true, 'handled' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $session
|
||||||
|
*/
|
||||||
|
private function notPaid(array $session, string $type): JsonResponse
|
||||||
|
{
|
||||||
|
$payment = Payment::query()->where('provider', 'stripe')->where('provider_reference', (string) ($session['id'] ?? ''))->first();
|
||||||
|
|
||||||
|
// Die Bestellung bleibt offen und lässt sich erneut bezahlen; nur diese Kasse gilt nicht mehr.
|
||||||
|
if ($payment !== null && $payment->status === 'offen') {
|
||||||
|
$payment->status = $type === 'checkout.session.expired' ? 'abgelaufen' : 'fehlgeschlagen';
|
||||||
|
$payment->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['received' => true, 'handled' => $payment !== null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $session
|
||||||
|
*/
|
||||||
|
private function orderOf(array $session): ?Order
|
||||||
|
{
|
||||||
|
$id = $session['client_reference_id'] ?? ($session['metadata']['order_id'] ?? null);
|
||||||
|
|
||||||
|
return is_numeric($id) ? Order::query()->find((int) $id) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,15 +4,12 @@
|
|||||||
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
use App\Domain\Catalog\ContentElement;
|
||||||
use App\Domain\Media\WebsiteMedia;
|
use App\Domain\Media\WebsiteMedia;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
class WebsiteMediaController extends Controller
|
class WebsiteMediaController extends Controller
|
||||||
{
|
{
|
||||||
private const CHUNK = 262144;
|
public function show(ContentElement $element, WebsiteMedia $media): StreamedResponse
|
||||||
|
|
||||||
public function show(Request $request, ContentElement $element, WebsiteMedia $media): StreamedResponse
|
|
||||||
{
|
{
|
||||||
$presentation = $media->present($element);
|
$presentation = $media->present($element);
|
||||||
abort_if($presentation === null, 404);
|
abort_if($presentation === null, 404);
|
||||||
@@ -20,81 +17,9 @@ public function show(Request $request, ContentElement $element, WebsiteMedia $me
|
|||||||
$path = $element->website_public_path;
|
$path = $element->website_public_path;
|
||||||
abort_if(! is_string($path), 404);
|
abort_if(! is_string($path), 404);
|
||||||
|
|
||||||
$headers = [
|
return Storage::disk('media_public')->response($path, null, [
|
||||||
'Content-Disposition' => 'inline',
|
'Content-Disposition' => 'inline',
|
||||||
'X-Content-Type-Options' => 'nosniff',
|
'X-Content-Type-Options' => 'nosniff',
|
||||||
'Accept-Ranges' => 'bytes',
|
|
||||||
];
|
|
||||||
|
|
||||||
$range = $request->header('Range');
|
|
||||||
|
|
||||||
// Filme und Hörstücke brauchen Bereichsabrufe (Safari und iOS spielen sonst nicht ab, Springen ist sonst unmöglich).
|
|
||||||
if (! is_string($range) || $presentation->kind === 'bild') {
|
|
||||||
return Storage::disk('media_public')->response($path, null, $headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
$disk = Storage::disk('media_public');
|
|
||||||
$size = (int) $disk->size($path);
|
|
||||||
$bounds = $this->bounds($range, $size);
|
|
||||||
|
|
||||||
if ($bounds === null) {
|
|
||||||
return response()->stream(fn () => null, 416, $headers + ['Content-Range' => 'bytes */'.$size]);
|
|
||||||
}
|
|
||||||
|
|
||||||
[$start, $end] = $bounds;
|
|
||||||
$length = $end - $start + 1;
|
|
||||||
$stream = $disk->readStream($path);
|
|
||||||
abort_if(! is_resource($stream), 404);
|
|
||||||
|
|
||||||
return response()->stream(function () use ($stream, $start, $length): void {
|
|
||||||
fseek($stream, $start);
|
|
||||||
$left = $length;
|
|
||||||
|
|
||||||
while ($left > 0 && ! feof($stream)) {
|
|
||||||
$chunk = fread($stream, min(self::CHUNK, $left));
|
|
||||||
|
|
||||||
if ($chunk === false || $chunk === '') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $chunk;
|
|
||||||
$left -= strlen($chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose($stream);
|
|
||||||
}, 206, $headers + [
|
|
||||||
'Content-Type' => (string) ($disk->mimeType($path) ?: 'application/octet-stream'),
|
|
||||||
'Content-Length' => (string) $length,
|
|
||||||
'Content-Range' => 'bytes '.$start.'-'.$end.'/'.$size,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Erster Bereich aus „bytes=a-b“, „bytes=a-“ oder „bytes=-n“; null, wenn er nicht erfüllbar ist.
|
|
||||||
*
|
|
||||||
* @return array{0: int, 1: int}|null
|
|
||||||
*/
|
|
||||||
private function bounds(string $header, int $size): ?array
|
|
||||||
{
|
|
||||||
if ($size < 1 || preg_match('/^bytes=(\d*)-(\d*)(?:,.*)?$/', trim($header), $match) !== 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
[, $from, $to] = $match;
|
|
||||||
|
|
||||||
if ($from === '' && $to === '') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($from === '') {
|
|
||||||
$suffix = min((int) $to, $size);
|
|
||||||
|
|
||||||
return $suffix < 1 ? null : [$size - $suffix, $size - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$start = (int) $from;
|
|
||||||
$end = $to === '' ? $size - 1 : min((int) $to, $size - 1);
|
|
||||||
|
|
||||||
return $start > $end || $start >= $size ? null : [$start, $end];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Jobs;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use App\Domain\Catalog\DomainRuleException;
|
|
||||||
use App\Domain\Media\PresentationFile;
|
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Foundation\Queue\Queueable;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Kopiert die Website-Datei eines Mediums nach `derived/`. Nur die Warteschlange darf dort schreiben.
|
|
||||||
* Ein Fehler wird am Medium vermerkt (`thumbnail_error`), damit die Verwaltung ihn zeigen kann.
|
|
||||||
*/
|
|
||||||
class StorePresentationFile implements ShouldQueue
|
|
||||||
{
|
|
||||||
use Queueable;
|
|
||||||
|
|
||||||
public int $timeout = 3600;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
public int $elementId,
|
|
||||||
public string $incoming,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function handle(PresentationFile $file): void
|
|
||||||
{
|
|
||||||
$element = ContentElement::query()->find($this->elementId);
|
|
||||||
|
|
||||||
if (! $element instanceof ContentElement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$file->place($element, $this->incoming);
|
|
||||||
|
|
||||||
// Ein schon freigegebenes Medium zeigt sonst weiter die alte öffentliche Kopie.
|
|
||||||
if ($element->website_released_at !== null) {
|
|
||||||
PublishWebsiteMedia::dispatch($element->id, 'release');
|
|
||||||
}
|
|
||||||
} catch (DomainRuleException $e) {
|
|
||||||
$this->remember($element, $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function failed(\Throwable $e): void
|
|
||||||
{
|
|
||||||
$element = ContentElement::query()->find($this->elementId);
|
|
||||||
|
|
||||||
if ($element instanceof ContentElement) {
|
|
||||||
$this->remember($element, 'Die Datei ließ sich nicht übernehmen: '.Str::limit($e->getMessage(), 120));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function remember(ContentElement $element, string $message): void
|
|
||||||
{
|
|
||||||
$element->thumbnail_error = $message;
|
|
||||||
$element->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
)
|
)
|
||||||
->withMiddleware(function (Middleware $middleware): void {
|
->withMiddleware(function (Middleware $middleware): void {
|
||||||
$middleware->trustProxies(at: '*');
|
$middleware->trustProxies(at: '*');
|
||||||
|
// Stripe sendet ohne Sitzung und CSRF-Token; die Signatur der Meldung ersetzt beides.
|
||||||
|
$middleware->validateCsrfTokens(except: ['stripe/webhook']);
|
||||||
$middleware->prepend(UseStaffSessionCookie::class);
|
$middleware->prepend(UseStaffSessionCookie::class);
|
||||||
$middleware->prepend(UseRequestRootUrl::class);
|
$middleware->prepend(UseRequestRootUrl::class);
|
||||||
$middleware->prepend(IgnoreEmptyForwardedHeaders::class);
|
$middleware->prepend(IgnoreEmptyForwardedHeaders::class);
|
||||||
|
|||||||
@@ -29,9 +29,16 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
'payment' => [
|
'payment' => [
|
||||||
|
// test: Testweg ohne Anbieter. stripe: Stripe-Kasse, in Etappe 1 nur mit Testschlüsseln (sk_test_).
|
||||||
'driver' => env('PAYMENT_DRIVER', 'test'),
|
'driver' => env('PAYMENT_DRIVER', 'test'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'stripe' => [
|
||||||
|
'secret' => env('STRIPE_SECRET'),
|
||||||
|
'webhook_secret' => env('STRIPE_WEBHOOK_SECRET'),
|
||||||
|
'api_base' => env('STRIPE_API_BASE', 'https://api.stripe.com'),
|
||||||
|
],
|
||||||
|
|
||||||
'slack' => [
|
'slack' => [
|
||||||
'notifications' => [
|
'notifications' => [
|
||||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Herkunft der Bild-Medien, die aus dem Vorschaubild eines Programms oder Moduls übernommen wurden
|
|
||||||
* (Programm- und Modulkarte). Additiv. Verhindert, dass dasselbe Vorschaubild mehrfach als neues Medium entsteht.
|
|
||||||
* Das übernommene Bild ist ein gewöhnliches Medium (output_class bild) mit eigener Website-Freigabe.
|
|
||||||
*/
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::create('composition_still_sources', function (Blueprint $table) {
|
|
||||||
$table->id();
|
|
||||||
$table->foreignId('composition_id')->constrained('compositions')->cascadeOnDelete();
|
|
||||||
$table->foreignId('still_element_id')->constrained('content_elements')->cascadeOnDelete();
|
|
||||||
$table->string('source_key', 120);
|
|
||||||
$table->unsignedBigInteger('actor_id')->nullable();
|
|
||||||
$table->timestamps();
|
|
||||||
|
|
||||||
$table->unique(['composition_id', 'source_key']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('composition_still_sources');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -27,7 +27,10 @@ MAIL_MAILER=log
|
|||||||
MAIL_FROM_ADDRESS="noreply@example.invalid"
|
MAIL_FROM_ADDRESS="noreply@example.invalid"
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
# test bleibt der lokale Testweg. Ein echter Zahlungsdienst ist noch nicht festgelegt.
|
# test: lokaler Testweg ohne Anbieter. stripe: Stripe-Kasse, in Etappe 1 nur mit Testschlüsseln und nie in Produktion.
|
||||||
|
# Die Schlüssel stehen nur in /etc/luf/<umgebung>.env auf dem Server, nie im Repo.
|
||||||
PAYMENT_DRIVER=test
|
PAYMENT_DRIVER=test
|
||||||
|
# STRIPE_SECRET=sk_test_... (Entwickler > API-Schlüssel, Testmodus)
|
||||||
|
# STRIPE_WEBHOOK_SECRET=whsec_... (Entwickler > Webhooks > Endpunkt > Signiergeheimnis)
|
||||||
|
|
||||||
# Medienpfade setzt Compose auf den Host-Mount (/srv/luf/<env>/media/...). Hier nichts eintragen.
|
# Medienpfade setzt Compose auf den Host-Mount (/srv/luf/<env>/media/...). Hier nichts eintragen.
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# Programm- und Modulkarte: Textwahl und Bild, Filmbild-Regler – Bericht (21.11.2026)
|
|
||||||
|
|
||||||
Branch `feature/karten-text-und-bild-programm`, separater Worktree, Deploy ausschließlich über `develop` (Testinstanz), kein Merge nach `main`. Baut auf `medienkarte-text-und-filmbild-bericht-2026-11-21.md` auf. Technik: `medienzugriff-fuer-komponenten.md`, Registry §13, ADR-39.
|
|
||||||
|
|
||||||
## 1. Rückmeldung aus der Abnahme und Umsetzung
|
|
||||||
|
|
||||||
| Rückmeldung | Umsetzung |
|
|
||||||
|---|---|
|
|
||||||
| Der Bildwähler aus dem Film ist nicht gelungen; im Medienmanager gibt es einen Regler, der das Bild fast in Echtzeit zeigt | Der Dialog arbeitet jetzt wie der Medienmanager: Regler und Zahlenfeld zeigen dieselbe Zeitposition, das Bild der Stelle folgt dem Regler nach kurzer Pause (ohne weiteren Knopf), „Diese Stelle übernehmen“ legt genau die angezeigte Stelle ab. Das im Medienmanager gesetzte Vorschaubild des Films lässt sich mit kleiner Ansicht daneben übernehmen. Der Regler reicht bis 120 s und wächst mit dem Zahlenfeld (bis 7200 s). |
|
|
||||||
| Textwahl soll auch an der Programm- und Modulkarte gelten | „Text der Karte“: Automatisch (wie bisher: Teaser, sonst Kurzbeschreibung, sonst Lernziel), Teaser, Kurzbeschreibung, Ausführliche Beschreibung, **Lernziel der Fassung**. Gelesen mit der Zielgruppe „Öffentliche Kachel“. Eine ausdrückliche Wahl ersetzt nicht still; die Vorschau nennt „Programm oder Modul bearbeiten → …“. |
|
|
||||||
| Die übrigen Anpassungen auch für Programm und Modul | Das Vorschaubild des Programms oder Moduls lässt sich als Bild-Medium übernehmen („Vorschaubild übernehmen“, `CompositionStill`), einmal kopiert, dieselbe Datei ergibt dasselbe Medium, ehrliche Meldung auch bei zurückgenommener Freigabe. |
|
|
||||||
|
|
||||||
Die Themenkarte hat nur einen Text („Text für die Website“) und bekommt deshalb keine Wahl.
|
|
||||||
|
|
||||||
## 2. Prüfung
|
|
||||||
|
|
||||||
| Prüfung | Ergebnis |
|
|
||||||
|---|---|
|
|
||||||
| Testsuite, Pint | 459 grün, Pint sauber (neu: 6 Tests Programm- und Modulkarte; bewusst geändert: die Programmkarte hat jetzt eine Textwahl) |
|
|
||||||
| CI und Deploy | CI 4987, Deploy 4988 (Commit `3825f53`) |
|
|
||||||
| Oberfläche lokal, echter Test-Film | Filmkarte 19/19 (Regler bewegt, Bild folgt, Zahl und Regler gleich), Programmkarte 13/13 |
|
|
||||||
| Testinstanz, Filmkarte „Lara im Park“, regulärer Seitenkonfigurator | **23 von 23**: Regler und Bild sofort da, Bild folgt dem Regler, Zahleneingabe führt es nach, Stelle übernommen (1600 px), dieselbe Stelle ergibt dasselbe Medium, vier Textstufen entsprechen den gepflegten Feldern, interne Angaben nie sichtbar, Rücknahme der Freigabe verifiziert (404) |
|
|
||||||
| Testinstanz, Modul „UX-Pilot Entwurf“ (Kurzbeschreibung, Beschreibung, Lernziel, Vorschaubild) | **15 von 15**: Vorschaubild übernommen und wiederverwendet, Textwahl mit Lernziel, nicht gepflegter Teaser zeigt keinen Text, Karten nennen „Modul“, Entwurf öffentlich nicht erreichbar |
|
|
||||||
| Aufräumen auf der Testinstanz | die angelegten Bilder 27, 28, 29 über „Medium löschen“ entfernt, Herkunftszeilen mit gelöscht (Datenbank geprüft) |
|
|
||||||
| Bestehende Seiten vor und nach dem Deploy | unverändert (16 Messungen, 12 Textvergleiche) |
|
|
||||||
|
|
||||||
**Nicht live gezeigt:** die öffentliche Darstellung der Karten auf einer veröffentlichten Seite der Testinstanz (nur Entwürfe); die öffentlichen Regeln belegen die Feature-Tests.
|
|
||||||
|
|
||||||
## 3. Auf der Testinstanz zurückgeblieben
|
|
||||||
|
|
||||||
- Entwürfe `/medienkarte-regler-entwurf` (Seite 24) und `/programmkarte-regler-entwurf` (Seite 25) sowie ältere Prüfentwürfe. Seiten lassen sich nicht löschen.
|
|
||||||
- Das Standbild „Standbild: Felix beim Onkel (Fassung 1, 22,5 s)“ (Medium 26, freigegeben) stammt nicht von dieser Arbeit (angelegt 19:51, vermutlich bei der Abnahme); unangetastet.
|
|
||||||
|
|
||||||
## 4. Grenzen
|
|
||||||
|
|
||||||
- Das übernommene Programm-Vorschaubild hat die Größe der Vorschaudatei (640 px); für ein breites Kartenbild reicht das, für ein Hero nicht. Ein Film-Standbild kommt bis 1600 px aus der Mediendatei.
|
|
||||||
- Eine Filmstelle direkt für ein Programm zu wählen gibt es nicht; das Vorschaubild des Programms lässt sich im Redaktionsmanager aus einem Film setzen und dann übernehmen.
|
|
||||||
- Das übernommene Bild folgt späteren Änderungen am Vorschaubild nicht (eigenes Medium).
|
|
||||||
|
|
||||||
## 5. Prod
|
|
||||||
|
|
||||||
Die Vorbereitung des Merges `develop` → `main` (Inhalt, Migrationen, Prod-Stand, Entscheidungen) steht in `docs/betrieb/Release-Vorbereitung_2026-11-21.md`. Den Merge löst Lars in Gitea aus.
|
|
||||||
@@ -63,7 +63,6 @@ ## Übersicht der Architekturentscheidungen
|
|||||||
| 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-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 |
|
| 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 |
|
||||||
| ADR-42 | Angebot und Warenkorb | Fachlich beschlossen | Gemeinsame Angebotsseite mit Lizenzwahl, Mehrangebotswarenkorb und Geltung der Bestellfassung je Position |
|
| ADR-42 | Angebot und Warenkorb | Fachlich beschlossen | Gemeinsame Angebotsseite mit Lizenzwahl, Mehrangebotswarenkorb und Geltung der Bestellfassung je Position |
|
||||||
| ADR-43 | Trailer auf Karten | Umgesetzt auf Test (21.11.2026); Abnahme offen | Medien-, Programm- und Modulkarte spielen den für die Website freigegebenen Trailer beim Überfahren oder Antippen; ohne Freigabe nur das Bild |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -520,7 +519,6 @@ ## ADR-39 – Premium-Karten mit Fachbezug
|
|||||||
**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).
|
**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.
|
**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.
|
||||||
**Nachbesserung 2 (21.11.2026, Betreiberwunsch).** Die Medienkarte wählt ihren Text je Karte (Automatisch, Teaser, Kurzbeschreibung, Ausführliche Beschreibung; `settings.text_source`). Die ausführliche Beschreibung ist damit auf ausdrückliche Wahl öffentlich (vorher nie). Ein Film liefert über `FilmStill` ein Einzelbild für die Karte: das Vorschaubild des Films oder eine gewählte Stelle, einmal gezogen (bis 1600 px) und als gewöhnliches Bild-Medium abgelegt, mit eigener Website-Freigabe; der Film bleibt geschützt. Additive Tabelle `film_still_sources`.
|
**Nachbesserung 2 (21.11.2026, Betreiberwunsch).** Die Medienkarte wählt ihren Text je Karte (Automatisch, Teaser, Kurzbeschreibung, Ausführliche Beschreibung; `settings.text_source`). Die ausführliche Beschreibung ist damit auf ausdrückliche Wahl öffentlich (vorher nie). Ein Film liefert über `FilmStill` ein Einzelbild für die Karte: das Vorschaubild des Films oder eine gewählte Stelle, einmal gezogen (bis 1600 px) und als gewöhnliches Bild-Medium abgelegt, mit eigener Website-Freigabe; der Film bleibt geschützt. Additive Tabelle `film_still_sources`.
|
||||||
**Nachbesserung 3 (21.11.2026, nach Betreiberprüfung).** Der Bildwähler im Dialog arbeitet wie im Medienmanager (Regler, Zahlenfeld, Live-Bild). Die Textwahl gilt auch an der Programm- und Modulkarte (zusätzlich Lernziel); deren Vorschaubild lässt sich wie ein Filmbild als Bild-Medium übernehmen (`CompositionStill`, additive Tabelle `composition_still_sources`).
|
|
||||||
**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).
|
**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).
|
**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.
|
**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.
|
||||||
@@ -563,19 +561,3 @@ ## ADR-42 – Öffentliche Angebotsdarstellung und Mehrangebotswarenkorb
|
|||||||
Die bestehende vorbelegte Angebotsmaske bleibt für Etappe 1 maßgeblich. Neue Fassungen werden ausdrücklich aktiviert. Abbrechen verwirft offene Eingaben. Im Warenkorb bleibt eine identisch bereits erworbene Lizenz gekennzeichnet und entfernbar. Sie geht weder in die Kaufsumme noch in die Bestellpositionen ein. Der ursprüngliche Erwerb bleibt der Nachweis.
|
Die bestehende vorbelegte Angebotsmaske bleibt für Etappe 1 maßgeblich. Neue Fassungen werden ausdrücklich aktiviert. Abbrechen verwirft offene Eingaben. Im Warenkorb bleibt eine identisch bereits erworbene Lizenz gekennzeichnet und entfernbar. Sie geht weder in die Kaufsumme noch in die Bestellpositionen ein. Der ursprüngliche Erwerb bleibt der Nachweis.
|
||||||
|
|
||||||
Pro Bestellung gilt höchstens ein Rabattcode. Allgemeine und produktspezifische Geltung sowie ein mehrfach nutzbarer Zertifizierungscode für geprüfte Konten gehören zum Verkaufsumfang. Verkaufskreis ist Deutschland einschließlich Privatkunden, Vereinen und Organisationen. Der Startumfang enthält keine freiwilligen Teilerstattungen und behandelt Bundles bei Rückgabe als Einheit. Zahlungs- und Rechnungsregeln stehen in ADR-14 und ADR-21.
|
Pro Bestellung gilt höchstens ein Rabattcode. Allgemeine und produktspezifische Geltung sowie ein mehrfach nutzbarer Zertifizierungscode für geprüfte Konten gehören zum Verkaufsumfang. Verkaufskreis ist Deutschland einschließlich Privatkunden, Vereinen und Organisationen. Der Startumfang enthält keine freiwilligen Teilerstattungen und behandelt Bundles bei Rückgabe als Einheit. Zahlungs- und Rechnungsregeln stehen in ADR-14 und ADR-21.
|
||||||
|
|
||||||
## ADR-43 – Trailer auf Karten
|
|
||||||
|
|
||||||
**Status am 21.11.2026:** Umgesetzt auf `develop`/Testinstanz (Branch `feature/karten-trailer`); Abnahme durch den Betreiber offen.
|
|
||||||
**Kontext.** FACH-46 fordert öffentliche Teaservideos; die Rollen Trailer und Vorschauclip gibt es im Medienmanager, ein freigegebener Clip wird über `website.media` ausgeliefert. Auf einer Karte war bisher nur ein Bild vorgesehen („kein Abspielen“, ADR-39). Die Grenze galt dem vollständigen Film und dem Bibliotheksmaterial, nicht einem für die Website bestimmten Trailer. Ein Trailer ist kein Lizenzelement; er braucht keine Lizenzentscheidung, nur die Website-Freigabe nach ADR-40.
|
|
||||||
**Entscheidung.**
|
|
||||||
- **Welche Karten:** Medien- und Materialkarte, Programm- und Modulkarte. Die Themenkarte hat keinen Trailer.
|
|
||||||
- **Welcher Clip:** der Trailer des Fachobjekts (Präsentationsrolle „Trailer“), sonst der Vorschauclip. Bei einem Film ersatzweise sein eigener für die Website freigegebener Teaser. Gewählt wird einmal in der Präsentation des Mediums, Programms oder Moduls; alle Karten desselben Objekts zeigen denselben Clip. Je Karte lässt sich der Trailer ausschalten (Darstellung → „Trailer auf der Karte“, Vorgabe: Abspielen).
|
|
||||||
- **Wann er läuft:** Am Desktop spielt er stumm und in Schleife, solange die Maus auf der Karte steht, und endet beim Verlassen. Am Handy und auf Wunsch auch am Desktop startet und stoppt ihn ein Tipp auf das Bild oder die Schaltfläche „Trailer“ am Bild, die auch die Tastatur bedient (`aria-pressed`). Es spielt nie mehr als ein Clip zugleich; er hält an, wenn die Karte aus dem Bild scrollt oder die Seite verdeckt wird.
|
|
||||||
- **Rücksicht:** Bei „reduzierte Bewegung“ und im Datensparmodus startet nichts von selbst, nur auf ausdrückliche Bedienung und dann ohne Schleife. Der Clip wird erst beim ersten Start geladen (`preload="none"`, Quelle erst dann gesetzt). Ohne JavaScript bleibt es beim Kartenbild.
|
|
||||||
- **Rechte:** Es spielt nur ein für die Website freigegebener Clip. Der vollständige Film, die Originaldatei und nicht freigegebene Clips kommen nie über eine Karte, auch nicht in der Redaktionsvorschau; diese nennt stattdessen, dass der Trailer nicht freigegeben ist. Die Karte gibt nichts frei und bietet keinen Download. Die Karte einer Traineranleitung erscheint weiter öffentlich nie.
|
|
||||||
- **Auslieferung:** Die Route `website.media` beantwortet Bereichsabrufe (`Range`, Antwort 206/416) für Filme und Hörstücke. Safari und iOS spielen sonst nicht ab.
|
|
||||||
**Alternativen.** Clip je Karte frei wählen (verworfen: mehrere Wege, doppelte Pflege); Autoplay mit Ton oder ohne Bedienung (verworfen: Barrierefreiheit, Datenvolumen); Clip aus dem vollständigen Film erzeugen (verworfen: Rechte, kein freigegebener Clip).
|
|
||||||
**Folgen.** Neue Einstellung `clip` an der Medien-, Programm- und Modulkarte, Klasse `CardClip`, Skript `resources/js/card-clip.js`; keine Migration. Bereits gespeicherte Karten ohne Wahl spielen einen freigegebenen Trailer ab (Vorgabe Abspielen). Offen: Trailer im Hero-Widget als Hintergrund (nicht entschieden); Hinweis „Mit Ton starten“ nicht vorgesehen.
|
|
||||||
**Quelle.** `docs/ux/verwaltung/04-fachliche-anforderungen.md` FACH-46; `medienzugriff-fuer-komponenten.md`; `cms-widget-registry.md`; ADR-39, ADR-40, ADR-41.
|
|
||||||
|
|
||||||
@@ -312,17 +312,15 @@ ## 13. Premium-Karten (Brand-UI-Kit v1.7, ADR-39)
|
|||||||
|
|
||||||
**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).
|
**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).
|
||||||
|
|
||||||
**Trailer auf der Karte (Medien-, Programm- und Modulkarte).** Einstellung `settings.clip` (`yes` Vorgabe, `no`). Der Clip ist der Trailer des Objekts (Präsentationsrolle „Trailer“, sonst „Vorschauclip“, bei einem Film ersatzweise sein freigegebener Teaser), nur wenn er für die Website freigegeben ist (`CardClip`). Er liegt stumm über dem Kartenbild und startet beim Überfahren mit der Maus, am Handy mit Tippen, per Tastatur über die Schaltfläche am Bild; `resources/js/card-clip.js`. Ohne Freigabe bleibt das Bild; die Redaktionsvorschau nennt den Grund. Entscheidung: ADR-43.
|
**Text der Medienkarte.** Einstellung `settings.text_source` (`auto` Vorgabe, `teaser`, `summary`, `description`); nur an der Medienkarte. `auto` entspricht dem bisherigen Verhalten (Kurzbeschreibung, sonst Teaser). Eine ausdrückliche Wahl ersetzt nicht still durch ein anderes Feld. Die ausführliche Beschreibung erscheint nur auf diese Wahl (öffentlich, sofern die Karte öffentlich ist). Der eigene Text der Karte (`data.summary`) hat Vorrang.
|
||||||
|
|
||||||
**Text der Karte.** Einstellung `settings.text_source` (`auto` Vorgabe, `teaser`, `summary`, `description`; an der Programm- und Modulkarte zusätzlich `goal`, das Lernziel der Fassung). `auto` entspricht dem bisherigen Verhalten je Karte (Medien: Kurzbeschreibung, sonst Teaser; Programm und Modul: Teaser, sonst Kurzbeschreibung, sonst Lernziel); die Themenkarte hat nur einen Text und keine Wahl. Eine ausdrückliche Wahl ersetzt nicht still durch ein anderes Feld. Die ausführliche Beschreibung erscheint nur auf diese Wahl (öffentlich, sofern die Karte öffentlich ist). Der eigene Text der Karte (`data.summary`) hat Vorrang.
|
**Bild aus dem Film (Medienkarte).** Reiter „Medien“, nur bei einem Film: „Vorschaubild des Films übernehmen“ oder eine Stelle wählen. `FilmStill` legt das Einzelbild (bis 1600 px) einmal als Bild-Medium ab; `refs.image` trägt dessen Kennung. Details und Grenzen: `medienzugriff-fuer-komponenten.md`, Abschnitt „Text der Medien- und Materialkarte, Bild aus dem Film“.
|
||||||
|
|
||||||
**Bild aus dem Film (Medienkarte).** Reiter „Medien“, nur bei einem Film: eine Stelle mit Regler und Live-Bild wählen („Diese Stelle übernehmen“) oder „Vorschaubild des Films übernehmen“. An der Programm- und Modulkarte entsprechend „Vorschaubild übernehmen“ (`CompositionStill`). `FilmStill` legt das Einzelbild (bis 1600 px) einmal als Bild-Medium ab; `refs.image` trägt dessen Kennung. Details und Grenzen: `medienzugriff-fuer-komponenten.md`, Abschnitt „Text der Medien- und Materialkarte, Bild aus dem Film“.
|
|
||||||
|
|
||||||
**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.
|
**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.
|
**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 außer eines für die Website freigegebenen Trailers (ADR-43), kein Download, kein Preis, keine Kaufaktion. Nie öffentlich: Beschreibung, Einsatzhinweis, Lizenzvermerk, Lehrtexte, Traineranleitungen. Eine Karte begründet keine Berechtigung (Tests `CmsPremiumCardsTest`).
|
**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):**
|
**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.
|
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.
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ ### Neues Bild aus dem CMS
|
|||||||
|
|
||||||
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.
|
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. Der Web-Prozess liest `derived/` nur; er prüft die Datei (Film: MP4 oder WebM, Hörstück: MP3, M4A oder OGG) und übergibt das Kopieren an die Warteschlange (`StorePresentationFile`). Dieselbe Website-Datei lässt sich unter „Website-Freigabe“ am Medium auch zu einem Film mit geschützter Inhaltsfassung hinzufügen, zum Beispiel für einen ungeschützten Trailer; die Fassung bleibt dabei unverändert. Öffentliche Profile nach ADR-29 sind damit nicht umgesetzt.
|
Ein neues Website-Bild nimmt `WebsiteIntake` auf und gibt es nach der Ableitung frei. Ein eigenständiges Präsentationsmedium legt `PresentationFile` ohne Inhaltsfassung an und gibt es nicht von selbst frei. Öffentliche Profile nach ADR-29 sind damit nicht umgesetzt.
|
||||||
|
|
||||||
## Was eine Komponente einhält
|
## Was eine Komponente einhält
|
||||||
|
|
||||||
@@ -157,15 +157,14 @@ ### Text
|
|||||||
- Eine ausdrückliche Wahl ersetzt nicht still durch ein anderes Feld. Ist der gewählte Text nicht gepflegt, bleibt die Karte ohne Text; die Redaktionsvorschau nennt, wo er zu pflegen ist. Öffentlich erscheint nie ein Hinweis.
|
- Eine ausdrückliche Wahl ersetzt nicht still durch ein anderes Feld. Ist der gewählte Text nicht gepflegt, bleibt die Karte ohne Text; die Redaktionsvorschau nennt, wo er zu pflegen ist. Öffentlich erscheint nie ein Hinweis.
|
||||||
- Der eigene Text der Karte (`data.summary`, „Text nur für diese Karte“) hat Vorrang vor der Wahl.
|
- Der eigene Text der Karte (`data.summary`, „Text nur für diese Karte“) hat Vorrang vor der Wahl.
|
||||||
- **Neu öffentlich auf ausdrückliche Wahl:** die ausführliche Beschreibung, die bisher Bibliothekstext war. Der Dialog sagt das („erscheint öffentlich“). Einsatzhinweis und Lizenzvermerk sind nicht wählbar. Öffentlich ist die Karte weiterhin nur, wenn das Medium zu einem öffentlich gezeigten Programm gehört.
|
- **Neu öffentlich auf ausdrückliche Wahl:** die ausführliche Beschreibung, die bisher Bibliothekstext war. Der Dialog sagt das („erscheint öffentlich“). Einsatzhinweis und Lizenzvermerk sind nicht wählbar. Öffentlich ist die Karte weiterhin nur, wenn das Medium zu einem öffentlich gezeigten Programm gehört.
|
||||||
- Die Wahl gibt es an der Medien- und Materialkarte und an der Programm- und Modulkarte. Ein Thema hat nur einen Text („Text für die Website“); dort gibt es nichts zu wählen.
|
- Die Wahl gibt es nur an der Medien- und Materialkarte; Themen- und Programmkarte lesen weiter ihren Text.
|
||||||
- **Programm- und Modulkarte:** Wahl Automatisch (Teaser, sonst Kurzbeschreibung, sonst Lernziel, wie bisher), Teaser, Kurzbeschreibung, Ausführliche Beschreibung oder **Lernziel der Fassung** (steht auf der öffentlichen Programmseite bereits öffentlich). Die Texte werden mit der Zielgruppe „Öffentliche Kachel“ gelesen. Auch hier ersetzt eine ausdrückliche Wahl nicht still durch ein anderes Feld; die Vorschau nennt, wo der Text zu pflegen ist („Programm oder Modul bearbeiten“).
|
|
||||||
|
|
||||||
### Bild aus dem Film
|
### Bild aus dem Film
|
||||||
|
|
||||||
Das Vorschaubild eines Films (Medienmanager) und jede Filmstelle sind geschützt und erscheinen öffentlich nie. Für die Karte gibt es einen ausdrücklichen Weg, daraus ein Website-Bild zu machen. Im Reiter „Medien“ der Medienkarte, bei einem Film:
|
Das Vorschaubild eines Films (Medienmanager) und jede Filmstelle sind geschützt und erscheinen öffentlich nie. Für die Karte gibt es einen ausdrücklichen Weg, daraus ein Website-Bild zu machen. Im Reiter „Medien“ der Medienkarte, bei einem Film:
|
||||||
|
|
||||||
1. eine Stelle wählen: Regler und Zahlenfeld zeigen dieselbe Zeitposition, das Bild der Stelle folgt dem Regler nach kurzer Pause (wie im Medienmanager); „Diese Stelle übernehmen“ legt genau die angezeigte Stelle ab, oder
|
1. „Vorschaubild des Films übernehmen“ oder
|
||||||
2. „Vorschaubild des Films übernehmen“ (das im Medienmanager gesetzte Vorschaubild; mit kleiner Ansicht daneben).
|
2. eine Zeitposition wählen, „Anzeigen“, „Dieses Bild übernehmen“.
|
||||||
|
|
||||||
`FilmStill` zieht das Einzelbild **einmal** und legt es über `WebsiteIntake` als gewöhnliches Bild-Medium (`output_class = bild`) im Medienmanager ab. Die Warteschlange leitet es ab und gibt genau diese Ableitung frei, wie bei jedem Upload aus dem CMS. Die Karte speichert die Kennung dieses Bildes in `refs.image`.
|
`FilmStill` zieht das Einzelbild **einmal** und legt es über `WebsiteIntake` als gewöhnliches Bild-Medium (`output_class = bild`) im Medienmanager ab. Die Warteschlange leitet es ab und gibt genau diese Ableitung frei, wie bei jedem Upload aus dem CMS. Die Karte speichert die Kennung dieses Bildes in `refs.image`.
|
||||||
|
|
||||||
@@ -177,12 +176,3 @@ ### Bild aus dem Film
|
|||||||
- **Rechte:** Es wird nie der Film abgelegt, nur ein Einzelbild; keine Fassung, keine Berechtigung, kein Lizenzartikel. Ausgeschlossen sind Traineranleitungen, archivierte Filme und Filme ohne bereitgestellte Fassung. Die Handlung ist ausdrücklich (Redakteur, wie beim Upload); die Freigabe des entstandenen Bildes lässt sich im Medienmanager zurücknehmen (Wirkung: das Bild entfällt auf allen Seiten).
|
- **Rechte:** Es wird nie der Film abgelegt, nur ein Einzelbild; keine Fassung, keine Berechtigung, kein Lizenzartikel. Ausgeschlossen sind Traineranleitungen, archivierte Filme und Filme ohne bereitgestellte Fassung. Die Handlung ist ausdrücklich (Redakteur, wie beim Upload); die Freigabe des entstandenen Bildes lässt sich im Medienmanager zurücknehmen (Wirkung: das Bild entfällt auf allen Seiten).
|
||||||
- **Das Bild ist ein eigenes Medium** mit Titel „Standbild: {Film} (Fassung n, x s)“, Alternativtext „Szene aus dem Film …“ und der Quellenzeile des Films. Es folgt späteren Änderungen des Film-Vorschaubilds nicht; wer es als Titelbild des Films verwenden will, ordnet es im Medienmanager als Präsentationsmedium zu (dann nutzen alle Karten des Films es automatisch).
|
- **Das Bild ist ein eigenes Medium** mit Titel „Standbild: {Film} (Fassung n, x s)“, Alternativtext „Szene aus dem Film …“ und der Quellenzeile des Films. Es folgt späteren Änderungen des Film-Vorschaubilds nicht; wer es als Titelbild des Films verwenden will, ordnet es im Medienmanager als Präsentationsmedium zu (dann nutzen alle Karten des Films es automatisch).
|
||||||
- **Nicht umgesetzt:** eine öffentliche Filmvorschau (Trailer, Ausschnitt) und die Laufzeit. Beides bleibt Erweiterungsbedarf (Registry §13).
|
- **Nicht umgesetzt:** eine öffentliche Filmvorschau (Trailer, Ausschnitt) und die Laufzeit. Beides bleibt Erweiterungsbedarf (Registry §13).
|
||||||
|
|
||||||
### Vorschaubild eines Programms oder Moduls (Programm- und Modulkarte)
|
|
||||||
|
|
||||||
Das Vorschaubild eines Programms oder Moduls (Redaktionsmanager) ist ebenfalls ein geschütztes Bibliotheksbild. Im Reiter „Medien“ der Programm- und Modulkarte übernimmt „Vorschaubild übernehmen“ es als Bild-Medium („Titelbild: {Titel}“); `CompositionStill` arbeitet wie `FilmStill`: einmal kopiert (bis zur Größe der Vorschaudatei, 640 px), über `WebsiteIntake` abgelegt, Herkunft in `composition_still_sources` (dasselbe Vorschaubild ergibt dasselbe Medium), ein gescheitertes oder archiviertes Bild wird nicht wiederverwendet, die Meldung nennt den tatsächlichen Stand (auch bei zurückgenommener Freigabe). Ein Programm ohne Vorschaubild zeigt den Hinweis, es im Redaktionsmanager zu setzen. Eine Stelle aus einem Film des Programms zu wählen gibt es hier nicht; das Vorschaubild des Programms selbst lässt sich im Redaktionsmanager aus einem Film setzen.
|
|
||||||
|
|
||||||
### Trailer auf Medien-, Programm- und Modulkarten
|
|
||||||
|
|
||||||
Ein Trailer ist ein eigenes Medium (Film ohne Fassung, Ableitung unter `teaser/`), das im Medienmanager einem Medium, Programm oder Modul in der Präsentation mit der Rolle „Trailer“ oder „Vorschauclip“ zugeordnet wird. Die Karte spielt ihn ab, wenn er für die Website freigegeben ist (Reiter „Website“ am Trailer). Lesende Klasse: `CardClip` (Trailer, sonst Vorschauclip, bei einem Film ersatzweise sein eigener freigegebener Teaser). Ausgeliefert wird über `website.media`, die Bereichsabrufe (`Range`) beantwortet. Nicht freigegebene Clips, der vollständige Film und Originale kommen nie über die Karte. Die Redaktionsvorschau spielt ebenfalls nur freigegebene Clips und nennt sonst den Grund. Verhalten (Maus, Tipp, Tastatur, reduzierte Bewegung, Datensparmodus): ADR-43.
|
|
||||||
|
|
||||||
@@ -27,6 +27,30 @@ ## Env-Datei ändern (zum Beispiel Mail, `APP_URL`)
|
|||||||
|
|
||||||
**nginx findet die neue App selbst (seit 21.11.2026).** Der Web-Container löst den Namen `app` über Dockers DNS zur Laufzeit auf (`resolver 127.0.0.11` in `docker/nginx/default.conf`). Vorher war die Adresse beim Start von nginx festgeschrieben: Ein erneuter Lauf mit unverändertem Code erzeugte die App neu, nicht aber den Web-Container, und Prod antwortete mit 502, bis `luf-prod-web-1` neu gestartet wurde (20.11.2026). Ein Test (`tests/Unit/NginxConfigTest.php`) hält die Konfiguration fest.
|
**nginx findet die neue App selbst (seit 21.11.2026).** Der Web-Container löst den Namen `app` über Dockers DNS zur Laufzeit auf (`resolver 127.0.0.11` in `docker/nginx/default.conf`). Vorher war die Adresse beim Start von nginx festgeschrieben: Ein erneuter Lauf mit unverändertem Code erzeugte die App neu, nicht aber den Web-Container, und Prod antwortete mit 502, bis `luf-prod-web-1` neu gestartet wurde (20.11.2026). Ein Test (`tests/Unit/NginxConfigTest.php`) hält die Konfiguration fest.
|
||||||
|
|
||||||
|
## Stripe-Sandbox (nur Test, Etappe 1)
|
||||||
|
|
||||||
|
Die Stripe-Kasse läuft ausschließlich im Testmodus und nie in Produktion. Sie ist nur aktiv, wenn `PAYMENT_DRIVER=stripe` gesetzt ist; sonst bleibt es beim Testweg (`test`). Ein Schlüssel ohne `sk_test_` (oder `rk_test_`) wird abgewiesen, in Produktion lehnt die Anwendung Stripe ganz ab. Kartendaten berühren die Anwendung nie, bezahlt wird bei Stripe.
|
||||||
|
|
||||||
|
**Ablauf:** Bestellung anlegen, „Jetzt bezahlen (Stripe-Testmodus)“, Weiterleitung zur Stripe-Kasse. Freigeschaltet wird erst durch die signierte Meldung von Stripe an `POST /stripe/webhook` (Ereignis `checkout.session.completed`). Betrag und Währung werden gegen die Bestellung geprüft; wiederholte Meldungen schalten nichts doppelt frei. Eine Zahlung mit falschem Betrag oder auf eine nicht mehr offene Bestellung schaltet nichts frei und steht als Zahlung mit Status `zu_pruefen` in der Bestellung.
|
||||||
|
|
||||||
|
**Einrichten (Test):**
|
||||||
|
|
||||||
|
1. In Stripe den Testmodus („Sandbox“) wählen. Unter Entwickler > API-Schlüssel den Geheimschlüssel `sk_test_…` kopieren.
|
||||||
|
2. Unter Entwickler > Webhooks einen Endpunkt anlegen: URL `https://dev.laraundfelix.de/stripe/webhook`, Ereignisse `checkout.session.completed`, `checkout.session.expired`, `checkout.session.async_payment_succeeded`, `checkout.session.async_payment_failed`. Das Signiergeheimnis `whsec_…` des Endpunkts kopieren.
|
||||||
|
3. Auf llm-node in `/etc/luf/test.env` eintragen (Rechte `640`, nichts davon ins Repo, in Commits, Logs oder Chat):
|
||||||
|
|
||||||
|
```
|
||||||
|
PAYMENT_DRIVER=stripe
|
||||||
|
STRIPE_SECRET=sk_test_...
|
||||||
|
STRIPE_WEBHOOK_SECRET=whsec_...
|
||||||
|
```
|
||||||
|
|
||||||
|
4. In Gitea den letzten Lauf von „Deploy Test“ erneut starten (siehe „Env-Datei ändern“). `docker exec luf-test-app-1 printenv PAYMENT_DRIVER` muss `stripe` zeigen.
|
||||||
|
5. Testkauf mit der Stripe-Testkarte `4242 4242 4242 4242` (beliebiges künftiges Ablaufdatum, beliebige Prüfziffer). In Stripe unter Entwickler > Webhooks > Endpunkt > Ereignisse ist jede Zustellung samt Antwortcode zu sehen.
|
||||||
|
|
||||||
|
**Zurück zum Testweg:** `PAYMENT_DRIVER=test` setzen und neu ausrollen. Offene Stripe-Bestellungen bleiben offen.
|
||||||
|
|
||||||
|
**Grenzen:** Erstattungen laufen nicht über Stripe. Die Schaltfläche „Widerrufen“ ist im Stripe-Modus ausgeblendet; die Rückzahlung gehört zum Verkaufsstart (Live-Stripe, Belegprozess, Rückabwicklung). Steuer, Rechnung, Rabattcodes und Rechtstexte sind nicht Teil der Sandbox.
|
||||||
## Trennung Test und Prod (beide auf llm-node)
|
## Trennung Test und Prod (beide auf llm-node)
|
||||||
|
|
||||||
| | Test | Prod |
|
| | Test | Prod |
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
# Release-Vorbereitung develop → main (21.11.2026)
|
|
||||||
|
|
||||||
Vorbereitet von Claude. **Den Merge nach `main` löst Lars in Gitea aus** (Pull Request `develop` → `main`, nach Prüfung des Teststands). Claude merged, pusht und deployt nicht nach `main`. Ein Merge löst über `deploy-prod.yml` sofort das Produktiv-Deployment aus.
|
|
||||||
|
|
||||||
Stand: `develop` mit der Programm- und Modulkarte (Commit `3825f53` plus die Dokumentation dieser Übergabe), `main` auf `759b3e1` (PR #2).
|
|
||||||
|
|
||||||
## 1. Inhalt (Stand 21.11.2026 abends: 22 Commits seit `main`)
|
|
||||||
|
|
||||||
| Bereich | Inhalt | Von |
|
|
||||||
|---|---|---|
|
|
||||||
| Medien- und Materialkarte | Text der Karte wählen (Teaser, Kurzbeschreibung, Ausführliche Beschreibung); Bild aus dem Film (Regler mit Live-Bild, Vorschaubild übernehmen) | Claude |
|
|
||||||
| Programm- und Modulkarte | Text der Karte wählen (zusätzlich Lernziel); Vorschaubild als Website-Bild übernehmen | Claude |
|
|
||||||
| Trailer auf Karten | Medien-, Programm- und Modulkarte spielen den für die Website freigegebenen Trailer (Rolle Trailer, sonst Vorschauclip, bei Filmen ersatzweise der eigene Teaser) stumm beim Überfahren mit der Maus oder per Tipp ab; je Karte abschaltbar; die Medienroute beantwortet Bereichsabrufe (ADR-43). Auf luf-test mit einem echten Clip geprüft. Keine Migration | Claude |
|
|
||||||
| Website-Datei eines Films | Ablage der Datei eines eigenständigen Präsentationsmediums über die Warteschlange, nachträgliches Hochladen am Medium (Behebung: der Web-Prozess darf `derived/` nicht schreiben) | Lars (anderer Rechner) |
|
|
||||||
| Medienmanager | „Medium löschen“ erreicht Standbilder und übernommene CMS-Bilder (Fremdschlüssel gelockert) | Claude |
|
|
||||||
| Fachliche Säulen | Vereinheitlichung auf die zentrale Säulenverwaltung | Lars (anderer Rechner) |
|
|
||||||
| Shop | Shop-Verwaltung, Warenkorb, Artikel/Paket/Angebot mit Voraussetzungen, Mehrpositionen-Kasse, Organisationskäufe | Lars (anderer Rechner) |
|
|
||||||
| Dokumentation | Anforderungen FACH-56 bis FACH-59, Brand-UI-Kit 1.2 bis 1.7 ohne Originalmotive, Berichte | beide |
|
|
||||||
|
|
||||||
Der Shop-Teil ist umfangreich (neue Tabellen, Routen, Kasse, Tests). Ich habe ihn nicht inhaltlich geprüft; die Abnahme steht in `docs/ux/verwaltung/abnahme/`.
|
|
||||||
|
|
||||||
**Fakten zum Shop nach dem Merge (aus dem Code geprüft):**
|
|
||||||
- **In Produktion nicht erreichbar.** `/shop`, `/warenkorb…` und `/kasse` liegen hinter `EnsureShopEnabled`; `Shop::enabled()` ist nur wahr, wenn die Umgebung **nicht** Produktion ist und der Zahlungstreiber `test` gilt („Etappe 1 erteilt keine Produktivfreigabe“). Prod läuft als `APP_ENV=production` (lesend bestätigt): Alle Shop-Adressen antworten dort mit 404, der Kopflink erscheint nicht.
|
|
||||||
- **Keine neuen Umgebungsschlüssel.** Gegenüber `main` gibt es keinen neuen `env()`-Zugriff, `.env.example`, `docker-compose.yml` und `scripts/deploy.sh` sind unverändert. `/etc/luf/prod.env` braucht nichts Neues (die Datei selbst habe ich nicht geöffnet). Die bisherigen Werte `LUF_CART_ENABLED` und `LUF_CART_URL` werden nicht mehr gelesen.
|
|
||||||
- **Folge:** Der Shop schadet in Prod nicht, ist aber auch nicht nutzbar. Er wird dort erst mit einer späteren Produktivfreigabe aktiv.
|
|
||||||
- **Entscheidung für Lars:** Mit diesem Merge nach Prod, oder die Shop-Commits erst später? (Eine Trennung wäre nur über einen eigenen Branch ohne die Shop-Commits möglich.)
|
|
||||||
|
|
||||||
## 2. Teststand
|
|
||||||
|
|
||||||
- Testsuite lokal: 459 grün, Pint sauber. Gate in Gitea (`ci-feature`, `develop`): CI 4987 und Deploy 4988 grün für den Stand der Karten.
|
|
||||||
- Die neuen Karten und Bildwähler sind in einem echten Browser gegen die Testinstanz (`luf-test`) im regulären Seitenkonfigurator geprüft (Berichte `docs/analysen/medienkarte-text-und-filmbild-bericht-2026-11-21.md` und `karten-text-und-bild-programm-bericht-2026-11-21.md`).
|
|
||||||
- Nicht gezeigt: die öffentliche Darstellung der neuen Karten auf einer veröffentlichten Seite der Testinstanz (nur Entwurf); die öffentlichen Regeln belegen die Feature-Tests.
|
|
||||||
|
|
||||||
## 3. Migrationen (Prod steht bei der 32. Migration `2026_11_20_200000_editorial_master_data_management`)
|
|
||||||
|
|
||||||
| Migration | Wirkung | Rückwärtskompatibel |
|
|
||||||
|---|---|---|
|
|
||||||
| `2026_11_21_100000_unify_pillar_assignments` | neue Tabellen `composition_pillar`, `license_article_pillar`, Anpassung `editorial_dimension_values` | ja, additiv |
|
|
||||||
| `2026_11_21_120000_create_film_still_sources` | neue Tabelle | ja |
|
|
||||||
| `2026_11_21_130000_add_shop_foundation` | Spalten an `offers`, `orders`, `order_lines`, `acquisitions`, neue Tabelle `memberships`, Rückrechnung bestehender Bestellungen | additiv; Daten werden berechnet, nicht gelöscht |
|
|
||||||
| `2026_11_21_130000_allow_deleting_media_with_stills_and_aliases` | lockert zwei Fremdschlüssel (`film_still_sources`, `website_media_aliases`) | ja, lockert nur |
|
|
||||||
| `2026_11_21_140000_create_composition_still_sources` | neue Tabelle | ja |
|
|
||||||
|
|
||||||
Keine bestehende Migration wurde geändert. Verglichen mit der Migrationstabelle von Prod (lesend): Prod hat 32 angewendet, `develop` 37 Dateien, **genau diese fünf sind ausstehend**, nichts auf Prod fehlt in `develop`. Prod hat 0 Bestellungen; die Rückrechnung in `add_shop_foundation` hat dort nichts zu tun. Der Rollback des Deploy-Skripts setzt nur den Code zurück, nicht die Datenbank; die neuen Tabellen und gelockerten Schlüssel stören älteren Code nicht.
|
|
||||||
|
|
||||||
## 4. Stand von Prod (lesend geprüft, 21.11.2026)
|
|
||||||
|
|
||||||
- 8 Seiten, alle veröffentlicht; 2 Medien (1 Bild, 1 Film), 1 davon für die Website freigegeben; **keine fachlichen Säulen** (Themenkarte hat dort noch nichts zur Auswahl); keine früheren CMS-Bilder unter `cms/` (die Bildübernahme früherer Bilder ist dort ohne Wirkung).
|
|
||||||
- Alle Container laufen; der Queue-Container startet planmäßig stündlich neu.
|
|
||||||
- Voraussetzungen für Bilder aus dem Film: `ffmpeg` ist im Image (`Dockerfile`); Warteschlange schreibt `public/derived/originals` (wie bisher).
|
|
||||||
|
|
||||||
## 5. Was Lars nach dem Deploy für die Pflege der Webseite wissen sollte
|
|
||||||
|
|
||||||
- Themenkarte: erst Säulen anlegen und veröffentlichen (mit Adresse und „Text für die Website“), sonst bleibt sie leer.
|
|
||||||
- Medienkarte und Programm-/Modulkarte erscheinen öffentlich nur, wenn das Medium bzw. Programm die Freigaberegeln erfüllt (Medium im öffentlichen Programm, Programm mit Anzeigefreigabe; Module nie).
|
|
||||||
- **Ausführliche Beschreibung** wird öffentlich, sobald sie als Kartentext gewählt wird. Trainermaterialien vorher als „Traineranleitung“ einordnen (die erscheinen nie öffentlich).
|
|
||||||
- Ein Bild aus einem Film oder aus dem Vorschaubild eines Programms entsteht als eigenes Bild im Medienmanager und wird nach der Verarbeitung automatisch für die Website freigegeben; die Freigabe lässt sich im Medienmanager (Reiter „Website“) zurücknehmen.
|
|
||||||
|
|
||||||
## 6. Ablauf (nur Lars)
|
|
||||||
|
|
||||||
1. Teststand und Shop-Entscheidung prüfen.
|
|
||||||
2. Pull Request `develop` → `main` in Gitea anlegen und nach Prüfung zusammenführen.
|
|
||||||
3. Der Workflow `deploy-prod.yml` testet und deployt; den Verlauf in Gitea beobachten.
|
|
||||||
4. Nach dem Deploy: Prod-Seiten und die neuen Karten ansehen (`/`, eine Seite mit Karte).
|
|
||||||
|
|
||||||
## 7. Hinweis zum Trailer nach dem Deploy
|
|
||||||
|
|
||||||
In Prod gibt es noch keinen Trailer. Ablauf für die Pflege: Medium anlegen (Film, „Eigenständiges Präsentationsmedium“, MP4 H.264 oder WebM) → im Reiter „Website“ freigeben → am Film, Programm oder Modul unter „Präsentationsmedien“ als Trailer zuordnen → „Redaktion speichern“. Bis ein Trailer freigegeben ist, ändert sich auf keiner Karte etwas.
|
|
||||||
@@ -229,7 +229,7 @@ .lf-pc__panel-accent {
|
|||||||
color: var(--pc-accent);
|
color: var(--pc-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Film ohne freigegebenes Bild: Filmtafel (Navy, Filmstreifen-Symbol, der Clip, falls freigegeben, liegt über dem Bildbereich). */
|
/* Film ohne freigegebenes Bild: Filmtafel (Navy, Filmstreifen-Symbol, kein Abspielsymbol – die Karte spielt nichts ab). */
|
||||||
.lf-pc__panel-icon {
|
.lf-pc__panel-icon {
|
||||||
display: block;
|
display: block;
|
||||||
inline-size: 44px;
|
inline-size: 44px;
|
||||||
@@ -340,93 +340,3 @@ @container slot (min-width: 520px) {
|
|||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.lf-pc__cta { transition: none; }
|
.lf-pc__cta { transition: none; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Trailer (CardClip, resources/js/card-clip.js): Der Clip liegt über dem Bildbereich und blendet erst mit dem ersten
|
|
||||||
* Bild ein; bis dahin und danach bleibt das Kartenbild stehen. Ohne JavaScript erscheint die Schaltfläche nicht.
|
|
||||||
* Bei einem Film ohne Kartenbild liegt der Clip über der Filmtafel (lf-pc__visual--panel).
|
|
||||||
*/
|
|
||||||
.lf-pc__visual--panel {
|
|
||||||
display: flex;
|
|
||||||
align-self: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc .lf-pc__visual--panel > .lf-pc__panel {
|
|
||||||
flex: 1 1 auto;
|
|
||||||
min-inline-size: 0;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
inline-size: 100%;
|
|
||||||
block-size: 100%;
|
|
||||||
object-fit: cover;
|
|
||||||
object-position: var(--pc-focus-x, 66%) var(--pc-focus-y, 45%);
|
|
||||||
border-radius: var(--radius-card);
|
|
||||||
background: var(--lf-navy);
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: opacity 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc--contain .lf-pc__clip {
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-clip-playing > .lf-pc__clip {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip-toggle {
|
|
||||||
position: absolute;
|
|
||||||
inset: 12px 12px auto auto;
|
|
||||||
display: none;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
min-block-size: 44px;
|
|
||||||
padding: 8px 14px 8px 10px;
|
|
||||||
border: 0;
|
|
||||||
border-radius: var(--radius-pill);
|
|
||||||
color: var(--lf-white);
|
|
||||||
background: rgb(3 37 81 / 86%);
|
|
||||||
font: 600 0.8125rem/1.2 var(--font-reading);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-clip-ready > .lf-pc__clip-toggle {
|
|
||||||
display: inline-flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip-toggle:hover {
|
|
||||||
background: var(--lf-navy-deep, var(--lf-navy));
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip-toggle:focus-visible {
|
|
||||||
outline: 3px solid var(--color-focus);
|
|
||||||
outline-offset: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip-icon {
|
|
||||||
inline-size: 20px;
|
|
||||||
block-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip-pause,
|
|
||||||
.lf-pc__clip-toggle[aria-pressed="true"] .lf-pc__clip-play {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.lf-pc__clip-toggle[aria-pressed="true"] .lf-pc__clip-pause {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-clip-playing > .lf-pc__badge {
|
|
||||||
opacity: 0.85;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.lf-pc__clip { transition: none; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import Hls from 'hls.js';
|
import Hls from 'hls.js';
|
||||||
import './site-nav.js';
|
import './site-nav.js';
|
||||||
import './card-clip.js';
|
|
||||||
|
|
||||||
function attachPlayback(video) {
|
function attachPlayback(video) {
|
||||||
if (!(video instanceof HTMLVideoElement) || video.dataset.playbackReady === '1') {
|
if (!(video instanceof HTMLVideoElement) || video.dataset.playbackReady === '1') {
|
||||||
|
|||||||
@@ -1,180 +0,0 @@
|
|||||||
/*
|
|
||||||
* Trailer auf Premium-Karten (Medien-, Programm- und Modulkarte).
|
|
||||||
*
|
|
||||||
* Eine Karte mit [data-card-clip] trägt einen für die Website freigegebenen Clip (data-clip-src). Der Clip
|
|
||||||
* - startet beim Überfahren mit der Maus und endet beim Verlassen (nur Zeigergeräte mit Maus),
|
|
||||||
* - startet am Handy und auf Wunsch auch am Desktop mit der Schaltfläche oder einem Tipp auf das Bild und endet mit dem nächsten,
|
|
||||||
* - läuft stumm; solange er nicht spielt, bleibt das Kartenbild sichtbar (der Clip blendet erst mit dem ersten Bild ein),
|
|
||||||
* - spielt bei „reduzierte Bewegung“ und im Datensparmodus nie von selbst, sondern nur auf ausdrückliche Bedienung, dann ohne Schleife,
|
|
||||||
* - wird erst beim ersten Start geladen (preload="none", Quelle erst dann gesetzt),
|
|
||||||
* - hält an, sobald die Karte aus dem Bild scrollt, und es spielt immer nur ein Clip zugleich.
|
|
||||||
* Ohne JavaScript bleibt es beim Kartenbild; die Schaltfläche erscheint erst, wenn dieses Skript sie freigibt.
|
|
||||||
*/
|
|
||||||
const REDUCED = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : { matches: false };
|
|
||||||
|
|
||||||
let active = null;
|
|
||||||
|
|
||||||
function saveData() {
|
|
||||||
return Boolean(navigator.connection && navigator.connection.saveData);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setup(card) {
|
|
||||||
if (card.dataset.clipReady === '1') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const video = card.querySelector('video.lf-pc__clip');
|
|
||||||
const toggle = card.querySelector('[data-clip-toggle]');
|
|
||||||
const source = card.dataset.clipSrc;
|
|
||||||
|
|
||||||
if (!(video instanceof HTMLVideoElement) || !toggle || !source) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
card.dataset.clipReady = '1';
|
|
||||||
|
|
||||||
const title = card.dataset.clipTitle || '';
|
|
||||||
const host = card.closest('.lf-pc') || card;
|
|
||||||
let mode = 'off'; // off | hover | manual
|
|
||||||
let failed = false;
|
|
||||||
|
|
||||||
function label(playing) {
|
|
||||||
toggle.setAttribute('aria-pressed', playing ? 'true' : 'false');
|
|
||||||
toggle.setAttribute('aria-label', (playing ? 'Trailer anhalten: ' : 'Trailer abspielen: ') + title);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stop() {
|
|
||||||
mode = 'off';
|
|
||||||
card.classList.remove('is-clip-playing');
|
|
||||||
video.pause();
|
|
||||||
|
|
||||||
try {
|
|
||||||
video.currentTime = 0;
|
|
||||||
} catch (error) {
|
|
||||||
// Noch keine Daten geladen: nichts zurückzusetzen.
|
|
||||||
}
|
|
||||||
|
|
||||||
label(false);
|
|
||||||
|
|
||||||
if (active === stop) {
|
|
||||||
active = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function start(nextMode) {
|
|
||||||
if (failed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (active && active !== stop) {
|
|
||||||
active();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!video.getAttribute('src')) {
|
|
||||||
video.src = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
video.muted = true;
|
|
||||||
video.loop = !REDUCED.matches;
|
|
||||||
mode = nextMode;
|
|
||||||
active = stop;
|
|
||||||
label(true);
|
|
||||||
|
|
||||||
const attempt = video.play();
|
|
||||||
|
|
||||||
if (attempt && typeof attempt.catch === 'function') {
|
|
||||||
attempt.catch(() => {
|
|
||||||
if (mode === nextMode) {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
video.addEventListener('playing', () => {
|
|
||||||
if (mode !== 'off') {
|
|
||||||
card.classList.add('is-clip-playing');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
video.addEventListener('ended', stop);
|
|
||||||
|
|
||||||
video.addEventListener('error', () => {
|
|
||||||
failed = true;
|
|
||||||
stop();
|
|
||||||
card.classList.add('is-clip-failed');
|
|
||||||
toggle.hidden = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
toggle.addEventListener('click', (event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
if (mode === 'off') {
|
|
||||||
start('manual');
|
|
||||||
} else {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Tipp auf das Bild (Handy): wie die Schaltfläche.
|
|
||||||
card.addEventListener('click', (event) => {
|
|
||||||
if (event.target.closest('a, button')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode === 'off') {
|
|
||||||
start('manual');
|
|
||||||
} else {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
host.addEventListener('pointerenter', (event) => {
|
|
||||||
if (event.pointerType !== 'mouse' || REDUCED.matches || saveData() || mode !== 'off') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
start('hover');
|
|
||||||
});
|
|
||||||
|
|
||||||
host.addEventListener('pointerleave', (event) => {
|
|
||||||
if (event.pointerType === 'mouse' && mode === 'hover') {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if ('IntersectionObserver' in window) {
|
|
||||||
new IntersectionObserver((entries) => {
|
|
||||||
entries.forEach((entry) => {
|
|
||||||
if (!entry.isIntersecting && mode !== 'off') {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, { threshold: 0.2 }).observe(card);
|
|
||||||
}
|
|
||||||
|
|
||||||
label(false);
|
|
||||||
card.classList.add('is-clip-ready');
|
|
||||||
}
|
|
||||||
|
|
||||||
function scan(root) {
|
|
||||||
if (root instanceof Element) {
|
|
||||||
if (root.matches('[data-card-clip]')) {
|
|
||||||
setup(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
root.querySelectorAll('[data-card-clip]').forEach(setup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scan(document.documentElement);
|
|
||||||
|
|
||||||
new MutationObserver((records) => {
|
|
||||||
records.forEach((record) => record.addedNodes.forEach(scan));
|
|
||||||
}).observe(document.documentElement, { childList: true, subtree: true });
|
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', () => {
|
|
||||||
if (document.hidden && active) {
|
|
||||||
active();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
{{--
|
{{--
|
||||||
Medien- und Materialkarte, Reiter „Medien“: ein Bild aus dem Film als Kartenbild übernehmen.
|
Medien- und Materialkarte, Reiter „Medien“: ein Bild aus dem Film als Kartenbild übernehmen.
|
||||||
Bedienung wie im Medienmanager: Regler und Zahlenfeld zeigen dieselbe Zeitposition, das Bild der Stelle folgt
|
- „Vorschaubild des Films übernehmen“ und „Dieses Bild übernehmen“ legen das Bild einmal als Bild-Medium im
|
||||||
dem Regler nach kurzer Pause (Route editorial.frame, nur angemeldete Redaktion). „Diese Stelle übernehmen“ legt genau
|
Medienmanager ab (FilmStill) und wählen es im Bildfeld aus. Seitenaufrufe lesen nur diese Datei.
|
||||||
die angezeigte Stelle einmal als Bild-Medium im Medienmanager ab (FilmStill) und wählt es als Kartenbild.
|
- Die Vorschau der gewählten Stelle zieht ein Bild über die Redaktionsroute editorial.frame (nur angemeldete
|
||||||
|
Redaktion) und startet erst nach „Anzeigen“, nicht bei jeder Eingabe.
|
||||||
Die Datei des Films bleibt geschützt; übernommen wird nur ein Einzelbild bis 1600 px Breite.
|
Die Datei des Films bleibt geschützt; übernommen wird nur ein Einzelbild bis 1600 px Breite.
|
||||||
--}}
|
--}}
|
||||||
@php
|
@php
|
||||||
@@ -11,44 +12,38 @@
|
|||||||
$framePfad = $filmVersionId !== null ? route('editorial.frame', ['version' => $filmVersionId]) : null;
|
$framePfad = $filmVersionId !== null ? route('editorial.frame', ['version' => $filmVersionId]) : null;
|
||||||
@endphp
|
@endphp
|
||||||
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
|
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
|
||||||
<div class="luf-filmbild"
|
<div class="luf-filmbild" x-data="{ second: @js((string) $filmStartSecond), shown: null, base: @js($framePfad) }">
|
||||||
x-data="{ second: @js((string) $filmStartSecond), shown: @js((string) $filmStartSecond), base: @js($framePfad), ziel: @js($ziel), id: {{ (int) $film->id }},
|
|
||||||
show() { if (this.second !== '' && ! isNaN(Number(this.second)) && Number(this.second) >= 0) { this.shown = this.second; } } }">
|
|
||||||
<p class="luf-filmbild-lead">
|
<p class="luf-filmbild-lead">
|
||||||
Aus dem Film „{{ $filmTitle }}“ ein Bild für die Website übernehmen. Das Bild wird einmal gespeichert und im
|
Aus dem Film „{{ $filmTitle }}“ ein Bild für die Website übernehmen. Das Bild wird einmal gespeichert und im
|
||||||
Medienmanager als Bild angelegt. Der Film selbst wird nicht veröffentlicht; die Karte spielt nichts ab.
|
Medienmanager als Bild angelegt. Der Film selbst wird nicht veröffentlicht; die Karte spielt nichts ab.
|
||||||
</p>
|
</p>
|
||||||
@if ($framePfad !== null)
|
@if ($filmHasThumbnail)
|
||||||
<div class="luf-filmbild-regler">
|
<x-filament::button color="gray" size="sm" icon="heroicon-o-photo" wire:loading.attr="disabled"
|
||||||
<label class="luf-filmbild-label" for="filmbild-stelle-{{ $film->id }}">Zeitposition in Sekunden</label>
|
wire:click="adoptFilmThumbnail({{ \Illuminate\Support\Js::from($ziel) }}, {{ (int) $film->id }})">
|
||||||
<input id="filmbild-stelle-{{ $film->id }}" type="range" min="0" step="0.5"
|
Vorschaubild des Films übernehmen
|
||||||
:max="Math.max(120, Math.ceil(Number(second) || 0))" x-model="second" x-on:input.debounce.250ms="show()">
|
|
||||||
<input type="number" min="0" max="7200" step="0.1" class="luf-filmbild-second" aria-label="Zeitposition als Zahl"
|
|
||||||
x-model="second" x-on:input.debounce.250ms="show()">
|
|
||||||
</div>
|
|
||||||
<img class="luf-filmbild-bild" :src="base + '?sekunde=' + encodeURIComponent(shown)" alt="Vorschau der gewählten Filmstelle">
|
|
||||||
<div>
|
|
||||||
<x-filament::button color="primary" size="sm" icon="heroicon-o-check-circle" type="button" wire:loading.attr="disabled"
|
|
||||||
x-on:click="$wire.adoptFilmFrame(ziel, id, String(shown))">
|
|
||||||
Diese Stelle übernehmen
|
|
||||||
</x-filament::button>
|
</x-filament::button>
|
||||||
|
@endif
|
||||||
|
@if ($framePfad !== null)
|
||||||
|
<div class="luf-filmbild-frame">
|
||||||
|
<label class="luf-filmbild-label">
|
||||||
|
Zeitposition in Sekunden
|
||||||
|
<input type="number" min="0" max="7200" step="0.5" x-model.lazy="second" class="luf-filmbild-second">
|
||||||
|
</label>
|
||||||
|
<x-filament::button color="gray" size="sm" icon="heroicon-o-eye" type="button" x-on:click="shown = second">
|
||||||
|
Anzeigen
|
||||||
|
</x-filament::button>
|
||||||
|
<template x-if="shown !== null">
|
||||||
|
<div class="luf-filmbild-preview">
|
||||||
|
<img :src="base + '?sekunde=' + encodeURIComponent(shown)" alt="Vorschau der gewählten Filmstelle">
|
||||||
|
<x-filament::button color="primary" size="sm" icon="heroicon-o-check-circle" type="button" wire:loading.attr="disabled"
|
||||||
|
x-on:click="$wire.adoptFilmFrame({{ \Illuminate\Support\Js::from($ziel) }}, {{ (int) $film->id }}, String(shown))">
|
||||||
|
Dieses Bild übernehmen
|
||||||
|
</x-filament::button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<p class="luf-filmbild-lead">Der Film hat noch keine bereitgestellte Fassung; eine Stelle lässt sich erst danach wählen.</p>
|
<p class="luf-filmbild-lead">Der Film hat noch keine bereitgestellte Fassung; eine Stelle lässt sich erst danach wählen.</p>
|
||||||
@endif
|
@endif
|
||||||
@if ($filmHasThumbnail)
|
|
||||||
<div class="luf-filmbild-aktuell">
|
|
||||||
@if ($filmThumbnailUrl)
|
|
||||||
<img src="{{ $filmThumbnailUrl }}" alt="Aktuelles Vorschaubild des Films">
|
|
||||||
@endif
|
|
||||||
<div>
|
|
||||||
<p class="luf-filmbild-lead">Oder das Vorschaubild übernehmen, das im Medienmanager für diesen Film gesetzt ist.</p>
|
|
||||||
<x-filament::button color="gray" size="sm" icon="heroicon-o-photo" type="button" wire:loading.attr="disabled"
|
|
||||||
wire:click="adoptFilmThumbnail({{ \Illuminate\Support\Js::from($ziel) }}, {{ (int) $film->id }})">
|
|
||||||
Vorschaubild des Films übernehmen
|
|
||||||
</x-filament::button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
</x-dynamic-component>
|
</x-dynamic-component>
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
{{--
|
|
||||||
Programm- und Modulkarte, Reiter „Medien“: das Vorschaubild des Programms oder Moduls als Kartenbild übernehmen.
|
|
||||||
Das Vorschaubild ist ein geschütztes Bibliotheksbild und erscheint öffentlich nie. „Vorschaubild übernehmen“ legt es
|
|
||||||
einmal als Bild-Medium im Medienmanager ab (CompositionStill) und wählt es als Kartenbild; die Website-Freigabe
|
|
||||||
geschieht dort nach der Verarbeitung automatisch und lässt sich zurücknehmen.
|
|
||||||
--}}
|
|
||||||
@php
|
|
||||||
$ziel = preg_replace('/[^.]+$/', 'image', $getStatePath());
|
|
||||||
@endphp
|
|
||||||
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
|
|
||||||
<div class="luf-filmbild">
|
|
||||||
@if ($compositionThumbnailUrl)
|
|
||||||
<div class="luf-filmbild-aktuell">
|
|
||||||
<img src="{{ $compositionThumbnailUrl }}" alt="Aktuelles Vorschaubild von „{{ $compositionTitle }}“">
|
|
||||||
<div>
|
|
||||||
<p class="luf-filmbild-lead">
|
|
||||||
Das Vorschaubild von „{{ $compositionTitle }}“ aus dem Redaktionsmanager als Bild für die Website
|
|
||||||
übernehmen. Es wird einmal gespeichert und im Medienmanager als Bild angelegt.
|
|
||||||
</p>
|
|
||||||
<x-filament::button color="gray" size="sm" icon="heroicon-o-photo" type="button" wire:loading.attr="disabled"
|
|
||||||
wire:click="adoptCompositionThumbnail({{ \Illuminate\Support\Js::from($ziel) }}, {{ (int) $composition->id }})">
|
|
||||||
Vorschaubild übernehmen
|
|
||||||
</x-filament::button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<p class="luf-filmbild-lead">
|
|
||||||
„{{ $compositionTitle }}“ hat noch kein Vorschaubild. Es lässt sich im Redaktionsmanager setzen und danach hier übernehmen,
|
|
||||||
oder ein anderes Bild oben auswählen.
|
|
||||||
</p>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</x-dynamic-component>
|
|
||||||
@@ -92,11 +92,6 @@
|
|||||||
.luf-filmbild-frame { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
|
.luf-filmbild-frame { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
|
||||||
.luf-filmbild-label { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; }
|
.luf-filmbild-label { display: flex; flex-direction: column; gap: .25rem; font-size: .875rem; }
|
||||||
.luf-filmbild-second { width: 8rem; padding: .35rem .5rem; border: 1px solid #b9c4bd; border-radius: .375rem; }
|
.luf-filmbild-second { width: 8rem; padding: .35rem .5rem; border: 1px solid #b9c4bd; border-radius: .375rem; }
|
||||||
.luf-filmbild-regler { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
|
|
||||||
.luf-filmbild-regler input[type=range] { flex: 1 1 14rem; min-width: 10rem; }
|
|
||||||
.luf-filmbild-bild { width: 100%; max-width: 28rem; height: auto; border-radius: .375rem; background: #eef1ee; }
|
|
||||||
.luf-filmbild-aktuell { display: flex; gap: .75rem; align-items: flex-start; padding-top: .5rem; border-top: 1px solid #e3e8e4; }
|
|
||||||
.luf-filmbild-aktuell img { width: 9rem; height: auto; border-radius: .375rem; background: #eef1ee; }
|
|
||||||
.luf-filmbild-preview { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; width: 100%; }
|
.luf-filmbild-preview { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; width: 100%; }
|
||||||
.luf-filmbild-preview img { width: 100%; max-width: 28rem; height: auto; border-radius: .375rem; background: #eef1ee; }
|
.luf-filmbild-preview img { width: 100%; max-width: 28rem; height: auto; border-radius: .375rem; background: #eef1ee; }
|
||||||
.luf-media-status { display: flex; gap: 1rem; align-items: flex-start; padding: .75rem; border: 1px solid #d5ddd6; border-radius: .5rem; }
|
.luf-media-status { display: flex; gap: 1rem; align-items: flex-start; padding: .75rem; border: 1px solid #d5ddd6; border-radius: .5rem; }
|
||||||
|
|||||||
@@ -340,32 +340,6 @@
|
|||||||
@if ($this->websiteFeedback !== '')
|
@if ($this->websiteFeedback !== '')
|
||||||
<p class="vw-meldung" role="status"><span>{{ $this->websiteFeedback }}</span></p>
|
<p class="vw-meldung" role="status"><span>{{ $this->websiteFeedback }}</span></p>
|
||||||
@endif
|
@endif
|
||||||
@if (in_array($element->output_class, ['film', 'audio'], true))
|
|
||||||
@php
|
|
||||||
$webDatei = filled($element->preview_path);
|
|
||||||
$webFehler = ! $webDatei && filled($element->thumbnail_error) ? $element->thumbnail_error : null;
|
|
||||||
$webTypen = $element->output_class === 'audio' ? '.mp3,.m4a,.ogg' : '.mp4,.webm';
|
|
||||||
@endphp
|
|
||||||
<dl class="vw-angaben">
|
|
||||||
<dt>Website-Datei</dt>
|
|
||||||
<dd>{{ $webDatei ? 'Vorhanden (ungeschützte Datei für die Website)' : 'Noch keine. Ohne sie lässt sich nur eine bereitgestellte Fassung mit Teaser freigeben.' }}</dd>
|
|
||||||
</dl>
|
|
||||||
@if ($webFehler)
|
|
||||||
<p class="vw-meldung is-fehler" role="alert"><span>{{ $webFehler }}</span></p>
|
|
||||||
@endif
|
|
||||||
@if ($editable)
|
|
||||||
<div style="display: grid; gap: 0.4rem; max-width: 34rem;">
|
|
||||||
<label class="vw-feld-label" for="website-datei">{{ $webDatei ? 'Website-Datei ersetzen' : 'Website-Datei hochladen' }}</label>
|
|
||||||
<input id="website-datei" type="file" accept="{{ $webTypen }}" wire:model="websiteUpload">
|
|
||||||
<p class="vw-feld-hilfe">{{ $element->output_class === 'audio' ? 'MP3, M4A oder OGG.' : 'MP4 (H.264) oder WebM; andere Formate spielt der Browser nicht.' }} Die Datei ist nicht geschützt und läuft ohne Lizenz. Die geschützte Fassung bleibt unverändert.</p>
|
|
||||||
@if ($this->websiteUpload instanceof \Livewire\Features\SupportFileUploads\TemporaryUploadedFile)
|
|
||||||
<p class="vw-feld-hilfe">Ausgewählt, noch nicht übernommen: {{ $this->websiteUpload->getClientOriginalName() }}
|
|
||||||
<button type="button" class="vw-link is-quiet" wire:click="$set('websiteUpload', null)">Auswahl verwerfen</button></p>
|
|
||||||
@endif
|
|
||||||
<div><button type="button" class="vw-btn" wire:click="storeWebsiteFile">Website-Datei übernehmen</button></div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
@if ($editable)
|
@if ($editable)
|
||||||
<div>
|
<div>
|
||||||
@if ($webOffen)
|
@if ($webOffen)
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
<div class="errors" role="alert">{{ $errors->first() }}</div>
|
<div class="errors" role="alert">{{ $errors->first() }}</div>
|
||||||
@endif
|
@endif
|
||||||
<p class="state">Status: {{ $statusText }}</p>
|
<p class="state">Status: {{ $statusText }}</p>
|
||||||
|
@if ($order->status === 'offen' && $zahlung === 'zurueck')
|
||||||
|
<p class="state" role="status">Danke. Wir warten auf die Bestätigung von Stripe. Sobald sie da ist, steht die Bestellung auf „Bezahlt“. <a href="{{ route('member.order', $order) }}">Status neu laden</a></p>
|
||||||
|
@elseif ($order->status === 'offen' && $zahlung === 'abbruch')
|
||||||
|
<p class="state" role="status">Die Zahlung wurde abgebrochen. Es wurde nichts abgebucht. Du kannst erneut bezahlen.</p>
|
||||||
|
@endif
|
||||||
<dl class="facts">
|
<dl class="facts">
|
||||||
<div><dt>Lizenzinhaber</dt><dd>{{ $order->party?->display_name }}</dd></div>
|
<div><dt>Lizenzinhaber</dt><dd>{{ $order->party?->display_name }}</dd></div>
|
||||||
<div><dt>Bestellt von</dt><dd>{{ $order->user?->name }}</dd></div>
|
<div><dt>Bestellt von</dt><dd>{{ $order->user?->name }}</dd></div>
|
||||||
@@ -32,6 +37,12 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
<p class="state">Summe: {{ \App\Domain\Commerce\Money::format($order->total_cents ?? $order->lines->sum('price_cents')) }}</p>
|
<p class="state">Summe: {{ \App\Domain\Commerce\Money::format($order->total_cents ?? $order->lines->sum('price_cents')) }}</p>
|
||||||
|
@if ($stripePayment && $order->status === 'offen')
|
||||||
|
<form method="post" action="{{ route('member.order.pay', $order) }}">
|
||||||
|
@csrf
|
||||||
|
<button class="button" type="submit">Jetzt bezahlen (Stripe-Testmodus)</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
@if ($testPayment && $order->status === 'offen')
|
@if ($testPayment && $order->status === 'offen')
|
||||||
<form method="post" action="{{ route('member.order.confirm', $order) }}">
|
<form method="post" action="{{ route('member.order.confirm', $order) }}">
|
||||||
@csrf
|
@csrf
|
||||||
@@ -44,9 +55,11 @@
|
|||||||
@endif
|
@endif
|
||||||
@if ($order->status === 'bezahlt')
|
@if ($order->status === 'bezahlt')
|
||||||
<p><a class="button" href="{{ route('member.library') }}">Zur Bibliothek</a></p>
|
<p><a class="button" href="{{ route('member.library') }}">Zur Bibliothek</a></p>
|
||||||
|
@if (! $stripePayment)
|
||||||
<form method="post" action="{{ route('member.order.refund', $order) }}">
|
<form method="post" action="{{ route('member.order.refund', $order) }}">
|
||||||
@csrf
|
@csrf
|
||||||
<button class="button button-quiet" type="submit">Widerrufen</button>
|
<button class="button button-quiet" type="submit">Widerrufen</button>
|
||||||
</form>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
|
@endif
|
||||||
@endsection
|
@endsection
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{{--
|
|
||||||
Trailer der Premium-Karte (CardClip): stummer Clip über dem Kartenbild plus Schaltfläche. Das <video> bekommt seine
|
|
||||||
Quelle erst beim ersten Start (resources/js/card-clip.js, preload="none"). Der Clip ist Beiwerk; Titel und Text der
|
|
||||||
Karte stehen daneben, deshalb ist das Video für Hilfstechnik verborgen und die Schaltfläche trägt die Bedeutung.
|
|
||||||
--}}
|
|
||||||
@if (($clipUrl ?? null) !== null)
|
|
||||||
<video class="lf-pc__clip" muted loop playsinline preload="none" disablepictureinpicture disableremoteplayback tabindex="-1" aria-hidden="true"></video>
|
|
||||||
<button type="button" class="lf-pc__clip-toggle" aria-pressed="false" data-clip-toggle aria-label="Trailer abspielen: {{ $clipTitle }}">
|
|
||||||
<svg class="lf-pc__clip-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true"><path class="lf-pc__clip-play" d="M8 5.5v13l11-6.5z" fill="currentColor"/><path class="lf-pc__clip-pause" d="M7 5h4v14H7zM13 5h4v14h-4z" fill="currentColor"/></svg>
|
|
||||||
<span class="lf-pc__clip-label" aria-hidden="true">Trailer</span>
|
|
||||||
</button>
|
|
||||||
@endif
|
|
||||||
@@ -9,11 +9,6 @@
|
|||||||
öffentlich markiert. Es hat keine Freigabe für die Website und wird öffentlich nie ausgegeben.
|
ö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.
|
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.
|
Hinweise auf fehlende Inhalte stehen nur in der Redaktionsvorschau, öffentlich nie.
|
||||||
|
|
||||||
Trailer: Ist für das Objekt ein für die Website freigegebener Clip da ($clip['url'], CardClip), liegt er stumm und
|
|
||||||
unsichtbar über dem Bildbereich und startet beim Überfahren mit der Maus, am Handy mit Tippen auf das Bild, per
|
|
||||||
Tastatur über die Schaltfläche (resources/js/card-clip.js). Ohne JavaScript bleibt es beim Bild. Der Clip wird erst
|
|
||||||
beim ersten Start geladen.
|
|
||||||
--}}
|
--}}
|
||||||
@if ($subject === null)
|
@if ($subject === null)
|
||||||
@if ($context->preview)
|
@if ($context->preview)
|
||||||
@@ -26,11 +21,6 @@
|
|||||||
$action = $show['action'] && $subject->url !== null ? ['url' => $subject->url, 'label' => $actionLabel] : null;
|
$action = $show['action'] && $subject->url !== null ? ['url' => $subject->url, 'label' => $actionLabel] : null;
|
||||||
$meta = $show['meta'] ? $subject->meta : [];
|
$meta = $show['meta'] ? $subject->meta : [];
|
||||||
$hints = $subject->missing;
|
$hints = $subject->missing;
|
||||||
$clipUrl = $clip['url'] ?? null;
|
|
||||||
$clipTitle = (string) ($clip['title'] ?? '') !== '' ? $clip['title'] : $subject->title;
|
|
||||||
if ($context->preview && ! empty($clip['hint'])) {
|
|
||||||
$hints[] = $clip['hint'];
|
|
||||||
}
|
|
||||||
$panelName = ['catalog' => 'die Navy-Tafel', 'film' => 'die Filmtafel', 'material' => 'das Materialsymbol'][$subject->visual] ?? 'die Karte ohne Bild';
|
$panelName = ['catalog' => 'die Navy-Tafel', 'film' => 'die Filmtafel', 'material' => 'das Materialsymbol'][$subject->visual] ?? 'die Karte ohne Bild';
|
||||||
if ($context->preview && $imageUrl === null) {
|
if ($context->preview && $imageUrl === null) {
|
||||||
$hints[] = $subject->previewImage !== null
|
$hints[] = $subject->previewImage !== null
|
||||||
@@ -48,9 +38,8 @@
|
|||||||
'lf-pc--internal' => ! $subject->public,
|
'lf-pc--internal' => ! $subject->public,
|
||||||
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%">
|
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%">
|
||||||
@if ($imageUrl !== null || $libraryImage !== null)
|
@if ($imageUrl !== null || $libraryImage !== null)
|
||||||
<div class="lf-pc__visual" @if ($clipUrl !== null) data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}" @endif>
|
<div class="lf-pc__visual">
|
||||||
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
|
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
|
||||||
@include('widgets.partials.card-clip')
|
|
||||||
@if ($show['kind'] && $subject->badge !== null)
|
@if ($show['kind'] && $subject->badge !== null)
|
||||||
<span class="lf-pc__badge">{{ $subject->badge }}</span>
|
<span class="lf-pc__badge">{{ $subject->badge }}</span>
|
||||||
@endif
|
@endif
|
||||||
@@ -58,14 +47,6 @@
|
|||||||
<span class="lf-pc__library-flag">Bibliotheksbild · nur Vorschau</span>
|
<span class="lf-pc__library-flag">Bibliotheksbild · nur Vorschau</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@elseif ($panel !== null && $clipUrl !== null)
|
|
||||||
<div class="lf-pc__visual lf-pc__visual--panel" data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}">
|
|
||||||
<div class="lf-pc__panel lf-pc__panel--{{ $panel }}" aria-hidden="true">
|
|
||||||
<span class="lf-pc__panel-label">{{ $subject->visualLabel ?? $subject->kind }}</span>
|
|
||||||
<x-brand.underline class="lf-pc__panel-accent" />
|
|
||||||
</div>
|
|
||||||
@include('widgets.partials.card-clip')
|
|
||||||
</div>
|
|
||||||
@elseif ($panel !== null)
|
@elseif ($panel !== null)
|
||||||
<div class="lf-pc__panel lf-pc__panel--{{ $panel }}" aria-hidden="true">
|
<div class="lf-pc__panel lf-pc__panel--{{ $panel }}" aria-hidden="true">
|
||||||
@if ($panel === 'film')
|
@if ($panel === 'film')
|
||||||
@@ -124,7 +105,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
@include('widgets.partials.image-notice')
|
@include('widgets.partials.image-notice')
|
||||||
@if ($context->preview && ! empty($clip['notice']))
|
|
||||||
<p class="preview-note">{{ $clip['notice'] }}</p>
|
|
||||||
@endif
|
|
||||||
@endif
|
@endif
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
use App\Http\Controllers\PublicCatalogController;
|
use App\Http\Controllers\PublicCatalogController;
|
||||||
use App\Http\Controllers\PublicMediaController;
|
use App\Http\Controllers\PublicMediaController;
|
||||||
use App\Http\Controllers\ShopController;
|
use App\Http\Controllers\ShopController;
|
||||||
|
use App\Http\Controllers\StripeWebhookController;
|
||||||
use App\Http\Controllers\ThemeController;
|
use App\Http\Controllers\ThemeController;
|
||||||
use App\Http\Controllers\WebsiteMediaController;
|
use App\Http\Controllers\WebsiteMediaController;
|
||||||
use App\Http\Middleware\EnsureShopEnabled;
|
use App\Http\Middleware\EnsureShopEnabled;
|
||||||
@@ -42,6 +43,8 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::post('/stripe/webhook', StripeWebhookController::class)->name('stripe.webhook');
|
||||||
|
|
||||||
Route::middleware('guest')->group(function () {
|
Route::middleware('guest')->group(function () {
|
||||||
Route::get('/registrieren', [RegistrationController::class, 'create'])->name('register');
|
Route::get('/registrieren', [RegistrationController::class, 'create'])->name('register');
|
||||||
Route::post('/registrieren', [RegistrationController::class, 'store']);
|
Route::post('/registrieren', [RegistrationController::class, 'store']);
|
||||||
@@ -121,6 +124,7 @@
|
|||||||
Route::post('/angebote/{offer}/abrufen', [CheckoutController::class, 'claim'])->name('offers.claim');
|
Route::post('/angebote/{offer}/abrufen', [CheckoutController::class, 'claim'])->name('offers.claim');
|
||||||
Route::post('/angebote/{offer}/kaufen', [CheckoutController::class, 'place'])->name('offers.buy');
|
Route::post('/angebote/{offer}/kaufen', [CheckoutController::class, 'place'])->name('offers.buy');
|
||||||
Route::get('/bestellung/{order}', [CheckoutController::class, 'show'])->name('order');
|
Route::get('/bestellung/{order}', [CheckoutController::class, 'show'])->name('order');
|
||||||
|
Route::post('/bestellung/{order}/bezahlen', [CheckoutController::class, 'pay'])->name('order.pay');
|
||||||
Route::post('/bestellung/{order}/bestaetigen', [CheckoutController::class, 'confirm'])->name('order.confirm');
|
Route::post('/bestellung/{order}/bestaetigen', [CheckoutController::class, 'confirm'])->name('order.confirm');
|
||||||
Route::post('/bestellung/{order}/ablehnen', [CheckoutController::class, 'fail'])->name('order.fail');
|
Route::post('/bestellung/{order}/ablehnen', [CheckoutController::class, 'fail'])->name('order.fail');
|
||||||
Route::post('/bestellung/{order}/widerrufen', [CheckoutController::class, 'refund'])->name('order.refund');
|
Route::post('/bestellung/{order}/widerrufen', [CheckoutController::class, 'refund'])->name('order.refund');
|
||||||
|
|||||||
@@ -1,389 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\Composition;
|
|
||||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use App\Domain\Catalog\ContentService;
|
|
||||||
use App\Domain\Catalog\EditorialContentKind;
|
|
||||||
use App\Domain\Catalog\PresentationAssignment;
|
|
||||||
use App\Domain\Catalog\PresentationRole;
|
|
||||||
use App\Domain\Cms\Page;
|
|
||||||
use App\Domain\Cms\PageRevision;
|
|
||||||
use App\Domain\Cms\PageService;
|
|
||||||
use App\Domain\Cms\Widgets\Support\CardClip;
|
|
||||||
use App\Domain\Cms\Widgets\Support\WebsiteImage;
|
|
||||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
|
||||||
use App\Domain\Media\PresentationFile;
|
|
||||||
use App\Domain\Media\WebsiteMedia;
|
|
||||||
use App\Domain\Media\WebsiteRelease;
|
|
||||||
use App\Models\User;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Validation\ValidationException;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trailer auf Medien-, Programm- und Modulkarte: Die Karte spielt beim Überfahren oder Antippen nur einen für die
|
|
||||||
* Website freigegebenen Clip ab (Präsentationsrolle „Trailer“, sonst „Vorschauclip“, bei einem Film ersatzweise sein
|
|
||||||
* freigegebener Teaser). Ohne freigegebenen Clip bleibt es beim Bild; der Film selbst kommt nie über die Karte.
|
|
||||||
*/
|
|
||||||
class CmsCardTrailerTest extends TestCase
|
|
||||||
{
|
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
private const BYTES = '0123456789abcdefghij';
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
Storage::fake('cms_incoming');
|
|
||||||
Storage::fake('media_derived');
|
|
||||||
Storage::fake('media_public');
|
|
||||||
Storage::fake('media_originals');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_a_released_trailer_is_offered_on_the_public_media_card(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
$this->release($trailer);
|
|
||||||
|
|
||||||
$this->publish('/trailer', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$card = $this->card($this->get('/trailer')->assertOk()->getContent());
|
|
||||||
$this->assertStringContainsString('data-card-clip', $card);
|
|
||||||
$this->assertStringContainsString('data-clip-src="'.route('website.media', $trailer).'"', $card);
|
|
||||||
$this->assertStringContainsString('<video class="lf-pc__clip" muted loop playsinline preload="none"', $card, 'Stumm, nur Schleife, nichts wird vorab geladen.');
|
|
||||||
$this->assertDoesNotMatchRegularExpression('/<video[^>]* src=/', $card, 'Die Quelle wird erst beim ersten Start gesetzt.');
|
|
||||||
$this->assertStringNotContainsString('autoplay', $card);
|
|
||||||
$this->assertStringContainsString('aria-label="Trailer abspielen: Trailer Denkpause"', $card);
|
|
||||||
$this->assertStringContainsString('lf-pc__visual--panel', $card, 'Ohne Kartenbild liegt der Clip über der Filmtafel.');
|
|
||||||
$this->assertStringNotContainsString('originals/', $card);
|
|
||||||
$this->assertStringNotContainsString('teaser/', $card);
|
|
||||||
$this->assertStringNotContainsString('Der Trailer', $card, 'Hinweise für die Redaktion erscheinen öffentlich nie.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_trailer_lies_over_the_card_image_when_there_is_one(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$image = $this->image('Kartenbild Denkpause');
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
$this->release($trailer);
|
|
||||||
$this->release($image);
|
|
||||||
|
|
||||||
$this->publish('/trailer-bild', [$this->mediaCard($film, ['image' => $image->id])]);
|
|
||||||
|
|
||||||
$card = $this->card($this->get('/trailer-bild')->assertOk()->getContent());
|
|
||||||
$this->assertStringContainsString('<img class="lf-pc__image" src="'.route('website.media', $image).'"', $card);
|
|
||||||
$this->assertStringContainsString('data-clip-src="'.route('website.media', $trailer).'"', $card);
|
|
||||||
$this->assertStringNotContainsString('lf-pc__visual--panel', $card);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_an_unreleased_trailer_is_not_played_publicly_and_explained_in_the_preview(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$trailer = $this->clip('Trailer ohne Freigabe');
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
|
|
||||||
$revision = $this->publish('/trailer-offen', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$public = $this->get('/trailer-offen')->assertOk()->getContent();
|
|
||||||
$this->assertStringNotContainsString('data-card-clip', $public);
|
|
||||||
$this->assertStringNotContainsString('<video', $public);
|
|
||||||
$this->assertStringNotContainsString('Trailer ohne Freigabe', $public);
|
|
||||||
$this->get(route('website.media', $trailer))->assertNotFound();
|
|
||||||
|
|
||||||
$preview = $this->actingAs(User::factory()->redakteur()->create(), 'staff')->get(route('pages.preview', $revision))->assertOk()->getContent();
|
|
||||||
$this->assertStringNotContainsString('<video', $preview, 'Auch die Redaktionsvorschau spielt keinen nicht freigegebenen Clip.');
|
|
||||||
$this->assertStringContainsString('Der Trailer „Trailer ohne Freigabe“ ist nicht für die Website freigegeben', $preview);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_withdrawing_the_release_removes_the_trailer_from_the_page(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
$this->release($trailer);
|
|
||||||
$this->publish('/trailer-zurueck', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$this->assertStringContainsString('data-card-clip', $this->get('/trailer-zurueck')->getContent());
|
|
||||||
|
|
||||||
app(WebsiteRelease::class)->withdraw($trailer->fresh());
|
|
||||||
$this->flushScoped();
|
|
||||||
|
|
||||||
$this->assertStringNotContainsString('data-card-clip', $this->get('/trailer-zurueck')->assertOk()->getContent());
|
|
||||||
$this->get(route('website.media', $trailer))->assertNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_trailer_role_wins_over_the_preview_clip_and_the_film_teaser_is_the_last_resort(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$clip = $this->clip('Vorschauclip Denkpause');
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$this->assign($film, 'vorschauclip', $clip);
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
$this->release($clip);
|
|
||||||
$this->release($trailer);
|
|
||||||
$this->publish('/trailer-rollen', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$this->assertStringContainsString('data-clip-src="'.route('website.media', $trailer).'"', $this->get('/trailer-rollen')->getContent());
|
|
||||||
|
|
||||||
app(WebsiteRelease::class)->withdraw($trailer->fresh());
|
|
||||||
$this->flushScoped();
|
|
||||||
$this->assertStringContainsString('data-clip-src="'.route('website.media', $clip).'"', $this->get('/trailer-rollen')->getContent(), 'Ohne freigegebenen Trailer gilt der Vorschauclip.');
|
|
||||||
|
|
||||||
PresentationAssignment::query()->delete();
|
|
||||||
$this->flushScoped();
|
|
||||||
$this->assertStringNotContainsString('data-card-clip', $this->get('/trailer-rollen')->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_a_film_released_for_the_website_is_its_own_teaser_clip(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$film->forceFill(['preview_path' => 'teaser/film-'.$film->id.'.mp4'])->save();
|
|
||||||
Storage::disk('media_derived')->put($film->preview_path, self::BYTES);
|
|
||||||
$this->release($film);
|
|
||||||
|
|
||||||
$this->publish('/trailer-teaser', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$this->assertStringContainsString('data-clip-src="'.route('website.media', $film).'"', $this->get('/trailer-teaser')->assertOk()->getContent(), 'Ersatzweise der eigene freigegebene Teaser des Films.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_other_roles_and_images_never_become_a_clip(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$interview = $this->clip('Interview Denkpause');
|
|
||||||
$image = $this->image('Bild als Trailer');
|
|
||||||
$this->assign($film, 'interview', $interview);
|
|
||||||
$this->assign($film, 'trailer', $image);
|
|
||||||
$this->release($interview);
|
|
||||||
$this->release($image);
|
|
||||||
|
|
||||||
$this->publish('/trailer-falsch', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$this->assertStringNotContainsString('data-card-clip', $this->get('/trailer-falsch')->assertOk()->getContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_editor_can_switch_the_trailer_off_per_card_and_the_choice_is_validated(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm();
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
$this->release($trailer);
|
|
||||||
|
|
||||||
$this->publish('/trailer-aus', [[
|
|
||||||
'layout' => 'u1_1_1_1',
|
|
||||||
'style' => [],
|
|
||||||
'slots' => [
|
|
||||||
$this->mediaCard($film, [], ['clip' => 'yes'])['slots'][0],
|
|
||||||
$this->mediaCard($film, [], ['clip' => 'no'])['slots'][0],
|
|
||||||
$this->mediaCard($film)['slots'][0],
|
|
||||||
],
|
|
||||||
]]);
|
|
||||||
|
|
||||||
$cards = $this->cards($this->get('/trailer-aus')->assertOk()->getContent());
|
|
||||||
$this->assertCount(3, $cards);
|
|
||||||
$this->assertStringContainsString('data-card-clip', $cards[0]);
|
|
||||||
$this->assertStringNotContainsString('data-card-clip', $cards[1], 'Ausgeschaltet bleibt es beim Bild.');
|
|
||||||
$this->assertStringContainsString('data-card-clip', $cards[2], 'Vorgabe: Abspielen, auch für schon gespeicherte Karten ohne Wahl.');
|
|
||||||
|
|
||||||
$registry = app(WidgetRegistry::class);
|
|
||||||
$this->assertSame(['yes', 'no'], array_keys($registry->get('media_card')->settingOptions()['clip']));
|
|
||||||
$this->assertSame(['yes', 'no'], array_keys($registry->get('program_card')->settingOptions()['clip']));
|
|
||||||
$this->assertArrayNotHasKey('clip', $registry->get('topic_card')->settingOptions(), 'Ein Thema hat keinen Trailer.');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$registry->normalize([['type' => 'media_card', 'v' => 1, 'variant' => 'adaptive', 'settings' => ['clip' => 'immer'], 'data' => [], 'refs' => ['element' => $film->id]]]);
|
|
||||||
$this->fail('Eine unbekannte Trailer-Wahl wurde angenommen.');
|
|
||||||
} catch (ValidationException $exception) {
|
|
||||||
$this->assertArrayHasKey('blocks.0.settings.clip', $exception->errors());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_program_card_plays_the_trailer_of_the_program(): void
|
|
||||||
{
|
|
||||||
$program = $this->program('Programm Mut');
|
|
||||||
$trailer = $this->clip('Trailer Mut');
|
|
||||||
$this->assign($program, 'trailer', $trailer);
|
|
||||||
$this->release($trailer);
|
|
||||||
|
|
||||||
$this->publish('/trailer-programm', [['layout' => 'u4', 'style' => [], 'slots' => [
|
|
||||||
['type' => 'program_card', 'v' => 1, 'variant' => 'adaptive', 'settings' => [], 'data' => [], 'refs' => ['composition' => $program->id]],
|
|
||||||
]]]);
|
|
||||||
|
|
||||||
$card = $this->card($this->get('/trailer-programm')->assertOk()->getContent());
|
|
||||||
$this->assertStringContainsString('data-clip-src="'.route('website.media', $trailer).'"', $card);
|
|
||||||
$this->assertStringContainsString('lf-pc__visual--panel', $card);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_a_confidential_film_never_offers_a_trailer(): void
|
|
||||||
{
|
|
||||||
$film = $this->publicFilm(kind: 'traineranleitung');
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$this->assign($film, 'trailer', $trailer);
|
|
||||||
$this->release($trailer);
|
|
||||||
|
|
||||||
$this->publish('/trailer-vertraulich', [$this->mediaCard($film)]);
|
|
||||||
|
|
||||||
$html = $this->get('/trailer-vertraulich')->assertOk()->getContent();
|
|
||||||
$this->assertStringNotContainsString('data-card-clip', $html);
|
|
||||||
$this->assertStringNotContainsString('Denkpause', $html, 'Die Karte einer Traineranleitung erscheint öffentlich nie.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_media_route_serves_byte_ranges_for_clips(): void
|
|
||||||
{
|
|
||||||
$trailer = $this->clip('Trailer Denkpause');
|
|
||||||
$this->release($trailer);
|
|
||||||
$url = route('website.media', $trailer);
|
|
||||||
|
|
||||||
$whole = $this->get($url)->assertOk();
|
|
||||||
$this->assertSame('bytes', $whole->headers->get('Accept-Ranges'));
|
|
||||||
$whole->assertStreamedContent(self::BYTES);
|
|
||||||
|
|
||||||
$part = $this->get($url, ['Range' => 'bytes=2-5'])->assertStatus(206);
|
|
||||||
$this->assertSame('bytes 2-5/20', $part->headers->get('Content-Range'));
|
|
||||||
$this->assertSame('4', $part->headers->get('Content-Length'));
|
|
||||||
$part->assertStreamedContent('2345');
|
|
||||||
|
|
||||||
$this->get($url, ['Range' => 'bytes=15-'])->assertStatus(206)->assertStreamedContent('fghij');
|
|
||||||
$this->get($url, ['Range' => 'bytes=-3'])->assertStatus(206)->assertStreamedContent('hij');
|
|
||||||
$this->get($url, ['Range' => 'bytes=0-999'])->assertStatus(206)->assertStreamedContent(self::BYTES);
|
|
||||||
|
|
||||||
$unsatisfiable = $this->get($url, ['Range' => 'bytes=40-50'])->assertStatus(416);
|
|
||||||
$this->assertSame('bytes */20', $unsatisfiable->headers->get('Content-Range'));
|
|
||||||
$this->get($url, ['Range' => 'bytes=abc'])->assertStatus(416);
|
|
||||||
|
|
||||||
app(WebsiteRelease::class)->withdraw($trailer->fresh());
|
|
||||||
$this->get($url, ['Range' => 'bytes=0-3'])->assertNotFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_images_ignore_range_requests(): void
|
|
||||||
{
|
|
||||||
$image = $this->image('Bild ohne Bereich');
|
|
||||||
$this->release($image);
|
|
||||||
|
|
||||||
$this->get(route('website.media', $image), ['Range' => 'bytes=0-3'])->assertOk();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function publicFilm(string $kind = 'unterrichtsfilm'): ContentElement
|
|
||||||
{
|
|
||||||
$content = app(ContentService::class);
|
|
||||||
$film = $content->createElement('film', 'film', 'Denkpause Rohschnitt');
|
|
||||||
$film->update(['display_title' => 'Eine Pause, die stark macht', 'summary' => 'KURZ-TEXT']);
|
|
||||||
$film->forceFill(['editorial_content_kind_id' => EditorialContentKind::query()->where('slug', $kind)->value('id')])->save();
|
|
||||||
$version = $content->publishElementVersion($film, 'Film');
|
|
||||||
$composition = $content->createComposition('Programm Denkpause');
|
|
||||||
$composition->editorial_content_kind_id = EditorialContentKind::query()->where('slug', 'programm')->value('id');
|
|
||||||
$composition->save();
|
|
||||||
$shown = $content->publishComposition($composition, [['role' => 'Film', 'target' => $version]]);
|
|
||||||
app(CompositionDisplayRelease::class)->release($shown, User::factory()->create());
|
|
||||||
|
|
||||||
return $film->refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function program(string $designation): Composition
|
|
||||||
{
|
|
||||||
$content = app(ContentService::class);
|
|
||||||
$composition = $content->createComposition($designation);
|
|
||||||
$composition->forceFill(['editorial_content_kind_id' => EditorialContentKind::query()->where('slug', 'programm')->value('id'), 'summary' => 'KURZ-TEXT'])->save();
|
|
||||||
$version = $content->publishComposition(
|
|
||||||
$composition,
|
|
||||||
[['role' => 'Text', 'target' => $content->publishElementVersion($content->createElement('text', 'text', $designation.' Blatt'), 'Inhalt')]],
|
|
||||||
);
|
|
||||||
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
|
|
||||||
|
|
||||||
return $composition->refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Ein kurzer Clip als eigenes Medium ohne Fassung, wie ihn die Präsentation anlegt. */
|
|
||||||
private function clip(string $title): ContentElement
|
|
||||||
{
|
|
||||||
return $this->presentation('film', $title, self::BYTES, 'mp4');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function image(string $title): ContentElement
|
|
||||||
{
|
|
||||||
return $this->presentation('bild', $title, 'bild-bytes', 'jpg');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function presentation(string $output, string $title, string $bytes, string $extension): ContentElement
|
|
||||||
{
|
|
||||||
$path = 'inhalte/'.md5($title).'.'.$extension;
|
|
||||||
Storage::disk('cms_incoming')->put($path, $bytes);
|
|
||||||
$element = app(ContentService::class)->createElement($output, $output, $title);
|
|
||||||
$element->display_title = $title;
|
|
||||||
$element->save();
|
|
||||||
app(PresentationFile::class)->store($element, $path);
|
|
||||||
|
|
||||||
return $element->fresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function assign(Composition|ContentElement $subject, string $role, ContentElement $clip): void
|
|
||||||
{
|
|
||||||
PresentationAssignment::query()->create([
|
|
||||||
'subject_type' => $subject->getMorphClass(),
|
|
||||||
'subject_id' => $subject->getKey(),
|
|
||||||
'content_element_id' => $clip->id,
|
|
||||||
'presentation_role_id' => PresentationRole::query()->where('slug', $role)->value('id'),
|
|
||||||
'position' => 1,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function release(ContentElement $element): void
|
|
||||||
{
|
|
||||||
app(WebsiteRelease::class)->release($element->fresh());
|
|
||||||
$this->flushScoped();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function flushScoped(): void
|
|
||||||
{
|
|
||||||
foreach ([WebsiteImage::class, CardClip::class, WebsiteMedia::class] as $class) {
|
|
||||||
$this->app->forgetInstance($class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<string, mixed> $refs
|
|
||||||
* @param array<string, string> $settings
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
private function mediaCard(ContentElement $film, array $refs = [], array $settings = []): array
|
|
||||||
{
|
|
||||||
return ['layout' => 'u4', 'style' => [], 'slots' => [
|
|
||||||
['type' => 'media_card', 'v' => 1, 'variant' => 'adaptive', 'settings' => $settings, 'data' => [], 'refs' => ['element' => $film->id] + $refs],
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param list<array<string, mixed>> $sections
|
|
||||||
*/
|
|
||||||
private function publish(string $path, array $sections): PageRevision
|
|
||||||
{
|
|
||||||
$page = Page::query()->create(['path' => $path]);
|
|
||||||
$service = app(PageService::class);
|
|
||||||
$revision = $service->saveRevision($page, $sections, null, null, null);
|
|
||||||
$service->publish($page, $revision);
|
|
||||||
|
|
||||||
return $revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function card(string $html): string
|
|
||||||
{
|
|
||||||
return $this->cards($html)[0] ?? '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return list<string>
|
|
||||||
*/
|
|
||||||
private function cards(string $html): array
|
|
||||||
{
|
|
||||||
preg_match_all('#<article class="lf-pc .*?</article>#s', $html, $matches);
|
|
||||||
|
|
||||||
return $matches[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -98,8 +98,7 @@ public function test_the_choice_is_limited_to_the_three_central_texts_and_to_the
|
|||||||
$registry = app(WidgetRegistry::class);
|
$registry = app(WidgetRegistry::class);
|
||||||
|
|
||||||
$this->assertSame(['auto', 'teaser', 'summary', 'description'], array_keys($registry->get('media_card')->settingOptions()['text_source']));
|
$this->assertSame(['auto', 'teaser', 'summary', 'description'], array_keys($registry->get('media_card')->settingOptions()['text_source']));
|
||||||
// Seit 21.11.2026 hat auch die Programm- und Modulkarte die Wahl (mit Lernziel); ein Thema hat nur einen Text.
|
$this->assertArrayNotHasKey('text_source', $registry->get('program_card')->settingOptions());
|
||||||
$this->assertSame(['auto', 'teaser', 'summary', 'description', 'goal'], array_keys($registry->get('program_card')->settingOptions()['text_source']));
|
|
||||||
$this->assertArrayNotHasKey('text_source', $registry->get('topic_card')->settingOptions());
|
$this->assertArrayNotHasKey('text_source', $registry->get('topic_card')->settingOptions());
|
||||||
|
|
||||||
foreach (['usage_note', 'license_note', 'working_title'] as $internal) {
|
foreach (['usage_note', 'license_note', 'working_title'] as $internal) {
|
||||||
|
|||||||
@@ -1,252 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\Composition;
|
|
||||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use App\Domain\Catalog\ContentService;
|
|
||||||
use App\Domain\Catalog\DomainRuleException;
|
|
||||||
use App\Domain\Catalog\EditorialContentKind;
|
|
||||||
use App\Domain\Cms\Page;
|
|
||||||
use App\Domain\Cms\PageRevision;
|
|
||||||
use App\Domain\Cms\PageService;
|
|
||||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
|
||||||
use App\Domain\Media\CompositionStill;
|
|
||||||
use App\Domain\Media\CompositionStillSource;
|
|
||||||
use App\Domain\Media\WebsiteRelease;
|
|
||||||
use App\Filament\Resources\Pages\Pages\EditPage;
|
|
||||||
use App\Models\User;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Livewire\Livewire;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Programm- und Modulkarte: Die Redaktion wählt den Kartentext (Teaser, Kurzbeschreibung, ausführliche Beschreibung,
|
|
||||||
* Lernziel) und kann das Vorschaubild des Programms oder Moduls als Website-Bild übernehmen.
|
|
||||||
*/
|
|
||||||
class CmsProgramCardTextAndImageTest extends TestCase
|
|
||||||
{
|
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
Storage::fake('cms_incoming');
|
|
||||||
Storage::fake('media_derived');
|
|
||||||
Storage::fake('media_public');
|
|
||||||
Storage::fake('media_originals');
|
|
||||||
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_card_shows_the_chosen_text_and_the_default_keeps_its_order(): void
|
|
||||||
{
|
|
||||||
$program = $this->program('Programm Selbstvertrauen', [
|
|
||||||
'teaser' => 'TEASER-TEXT',
|
|
||||||
'summary' => 'KURZ-TEXT',
|
|
||||||
'description' => "LANG-TEXT erster Absatz\n\nzweiter Absatz",
|
|
||||||
], goal: 'LERNZIEL-TEXT');
|
|
||||||
|
|
||||||
$this->publish('/programmtext', [
|
|
||||||
$this->card($program, []),
|
|
||||||
$this->card($program, ['text_source' => 'auto']),
|
|
||||||
$this->card($program, ['text_source' => 'teaser']),
|
|
||||||
$this->card($program, ['text_source' => 'summary']),
|
|
||||||
$this->card($program, ['text_source' => 'description']),
|
|
||||||
$this->card($program, ['text_source' => 'goal']),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$cards = $this->cards($this->get('/programmtext')->assertOk()->getContent());
|
|
||||||
$this->assertCount(6, $cards);
|
|
||||||
$this->assertStringContainsString('TEASER-TEXT', $cards[0], 'Automatisch: Teaser vor Kurzbeschreibung, wie bisher.');
|
|
||||||
$this->assertStringContainsString('TEASER-TEXT', $cards[1]);
|
|
||||||
$this->assertStringContainsString('TEASER-TEXT', $cards[2]);
|
|
||||||
$this->assertStringContainsString('KURZ-TEXT', $cards[3]);
|
|
||||||
$this->assertStringNotContainsString('TEASER-TEXT', $cards[3]);
|
|
||||||
$this->assertStringContainsString('LANG-TEXT', $cards[4]);
|
|
||||||
$this->assertStringContainsString('zweiter Absatz', $cards[4]);
|
|
||||||
$this->assertStringContainsString('LERNZIEL-TEXT', $cards[5]);
|
|
||||||
$this->assertStringNotContainsString('LANG-TEXT', $cards[0], 'Die ausführliche Beschreibung erscheint nur auf ausdrückliche Wahl.');
|
|
||||||
$this->assertStringNotContainsString('LANG-TEXT', $cards[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_automatic_falls_back_to_summary_then_goal_but_an_explicit_choice_does_not(): void
|
|
||||||
{
|
|
||||||
$withSummary = $this->program('Programm Nur Kurz', ['summary' => 'KURZ-TEXT'], goal: 'LERNZIEL-TEXT');
|
|
||||||
$onlyGoal = $this->program('Programm Nur Lernziel', [], goal: 'LERNZIEL-TEXT');
|
|
||||||
|
|
||||||
$revision = $this->publish('/programmtext-ersatz', [
|
|
||||||
$this->card($withSummary, []),
|
|
||||||
$this->card($onlyGoal, []),
|
|
||||||
$this->card($onlyGoal, ['text_source' => 'teaser']),
|
|
||||||
$this->card($onlyGoal, ['text_source' => 'description']),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$cards = $this->cards($this->get('/programmtext-ersatz')->assertOk()->getContent());
|
|
||||||
$this->assertStringContainsString('KURZ-TEXT', $cards[0]);
|
|
||||||
$this->assertStringContainsString('LERNZIEL-TEXT', $cards[1], 'Automatisch: ohne Teaser und Kurzbeschreibung das Lernziel, wie bisher.');
|
|
||||||
$this->assertStringNotContainsString('lf-pc__summary', $cards[2], 'Gewählter, nicht gepflegter Teaser: kein stiller Ersatz.');
|
|
||||||
$this->assertStringNotContainsString('lf-pc__summary', $cards[3]);
|
|
||||||
|
|
||||||
$public = $this->get('/programmtext-ersatz')->getContent();
|
|
||||||
$this->assertStringNotContainsString('Kein Teaser gepflegt', $public, 'Hinweise erscheinen öffentlich nie.');
|
|
||||||
|
|
||||||
$preview = $this->actingAs(User::factory()->redakteur()->create(), 'staff')->get(route('pages.preview', $revision))->assertOk()->getContent();
|
|
||||||
$this->assertStringContainsString('Kein Teaser gepflegt (Programm oder Modul bearbeiten → Teaser).', $preview);
|
|
||||||
$this->assertStringContainsString('Keine ausführliche Beschreibung gepflegt (Programm oder Modul bearbeiten → Beschreibung).', $preview);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_text_choice_is_offered_on_the_program_card_only_with_its_own_choices(): void
|
|
||||||
{
|
|
||||||
$registry = app(WidgetRegistry::class);
|
|
||||||
|
|
||||||
$this->assertSame(['auto', 'teaser', 'summary', 'description', 'goal'], array_keys($registry->get('program_card')->settingOptions()['text_source']));
|
|
||||||
$this->assertArrayNotHasKey('text_source', $registry->get('topic_card')->settingOptions(), 'Ein Thema hat nur einen Text.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_thumbnail_of_a_program_becomes_one_image_medium_for_the_website(): void
|
|
||||||
{
|
|
||||||
$program = $this->program('Programm Mut', ['summary' => 'x'], thumbnail: true);
|
|
||||||
$editor = User::factory()->redakteur()->create();
|
|
||||||
|
|
||||||
$still = app(CompositionStill::class)->fromThumbnail($program, $editor)->refresh();
|
|
||||||
|
|
||||||
$this->assertSame('bild', $still->output_class);
|
|
||||||
$this->assertSame('Titelbild: Programm Mut', $still->display_title);
|
|
||||||
$this->assertSame('Titelbild zu „Programm Mut“', $still->website_alt);
|
|
||||||
$this->assertSame(0, $still->versions()->count());
|
|
||||||
$this->assertNotNull($still->website_released_at, 'Die Warteschlange gibt das abgeleitete Bild für die Website frei.');
|
|
||||||
$this->assertSame($still->id, CompositionStillSource::query()->where('composition_id', $program->id)->value('still_element_id'));
|
|
||||||
|
|
||||||
$stills = app(CompositionStill::class);
|
|
||||||
$this->assertSame($still->id, $stills->fromThumbnail($program)->id, 'Dasselbe Vorschaubild ergibt dasselbe Medium.');
|
|
||||||
$this->assertTrue($stills->reused);
|
|
||||||
$this->assertSame(1, ContentElement::query()->where('output_class', 'bild')->count());
|
|
||||||
|
|
||||||
$still->forceFill(['thumbnail_error' => 'Die Bilddatei ließ sich nicht lesen.'])->save();
|
|
||||||
$this->assertNotSame($still->id, $stills->fromThumbnail($program)->id, 'Ein gescheitertes Bild wird nicht wiederverwendet.');
|
|
||||||
|
|
||||||
$this->get(route('website.media', $still))->assertOk();
|
|
||||||
$still->delete();
|
|
||||||
$this->assertSame(1, CompositionStillSource::query()->count(), 'Nur die Herkunft des gelöschten Bildes entfällt.');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_programs_without_thumbnail_or_archived_yield_no_image(): void
|
|
||||||
{
|
|
||||||
$without = $this->program('Programm Ohne Bild', ['summary' => 'x']);
|
|
||||||
$archived = $this->program('Programm Archiv', ['summary' => 'x'], thumbnail: true);
|
|
||||||
$archived->update(['archived_at' => now()]);
|
|
||||||
|
|
||||||
foreach ([[$without, 'noch kein Vorschaubild'], [$archived, 'archiviert']] as [$composition, $message]) {
|
|
||||||
try {
|
|
||||||
app(CompositionStill::class)->fromThumbnail($composition);
|
|
||||||
$this->fail("Erwartete Ablehnung: $message");
|
|
||||||
} catch (DomainRuleException $exception) {
|
|
||||||
$this->assertStringContainsString($message, $exception->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertSame(0, ContentElement::query()->where('output_class', 'bild')->count());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_editor_adopts_the_thumbnail_into_the_image_field_and_says_when_the_release_was_withdrawn(): void
|
|
||||||
{
|
|
||||||
$program = $this->program('Programm Park', ['summary' => 'x'], thumbnail: true);
|
|
||||||
$editor = User::factory()->redakteur()->create();
|
|
||||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
|
||||||
$page = Page::query()->create(['path' => '/programmbild-editor']);
|
|
||||||
app(PageService::class)->saveRevision($page, [
|
|
||||||
['layout' => 'u4', 'style' => [], 'slots' => [['type' => 'program_card', 'v' => 1, 'variant' => 'adaptive', 'settings' => [], 'data' => [], 'refs' => ['composition' => $program->id]]]],
|
|
||||||
], null, null, null);
|
|
||||||
$component = Livewire::actingAs($editor, 'staff')->test(EditPage::class, ['record' => $page->id]);
|
|
||||||
|
|
||||||
$component->call('adoptCompositionThumbnail', 'data.ziel.image', $program->id);
|
|
||||||
$still = ContentElement::query()->where('output_class', 'bild')->latest('id')->firstOrFail();
|
|
||||||
$component->assertNotified('Im Medienmanager angelegt: „Titelbild: Programm Park“');
|
|
||||||
$this->assertSame($still->id, $component->get('data.ziel.image'));
|
|
||||||
|
|
||||||
$component->call('adoptCompositionThumbnail', 'data.ziel2.image', $program->id);
|
|
||||||
$component->assertNotified('Bereits im Medienmanager: „Titelbild: Programm Park“');
|
|
||||||
|
|
||||||
app(WebsiteRelease::class)->withdraw($still);
|
|
||||||
$component->call('adoptCompositionThumbnail', 'data.ziel3.image', $program->id);
|
|
||||||
$component->assertNotified('Bild ausgewählt, aber nicht für die Website freigegeben: „Titelbild: Programm Park“');
|
|
||||||
|
|
||||||
$before = ContentElement::query()->count();
|
|
||||||
$component->call('adoptCompositionThumbnail', 'umgebung.geheim', $program->id);
|
|
||||||
$component->call('adoptCompositionThumbnail', 'data.ziel4.bild', $program->id);
|
|
||||||
$component->call('adoptCompositionThumbnail', 'data.ziel5.image', 999999);
|
|
||||||
$this->assertSame($before, ContentElement::query()->count(), 'Fremde Ziele und fehlende Programme legen nichts an.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<string, string> $texts
|
|
||||||
*/
|
|
||||||
private function program(string $designation, array $texts, ?string $goal = null, bool $thumbnail = false): Composition
|
|
||||||
{
|
|
||||||
$content = app(ContentService::class);
|
|
||||||
$composition = $content->createComposition($designation);
|
|
||||||
$composition->forceFill(['editorial_content_kind_id' => EditorialContentKind::query()->where('slug', 'programm')->value('id')] + $texts)->save();
|
|
||||||
|
|
||||||
if ($thumbnail) {
|
|
||||||
$composition->forceFill(['thumbnail_path' => 'vorschau/komposition-'.$composition->id.'.jpg', 'thumbnail_source' => 'eigen'])->save();
|
|
||||||
Storage::disk('media_derived')->put($composition->thumbnail_path, $this->jpeg());
|
|
||||||
}
|
|
||||||
|
|
||||||
$version = $content->publishComposition(
|
|
||||||
$composition,
|
|
||||||
[['role' => 'Text', 'target' => $content->publishElementVersion($content->createElement('text', 'text', $designation.' Blatt'), 'Inhalt')]],
|
|
||||||
didactic: $goal !== null ? ['learning_goal' => $goal] : [],
|
|
||||||
);
|
|
||||||
app(CompositionDisplayRelease::class)->release($version, User::factory()->create());
|
|
||||||
|
|
||||||
return $composition->refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array<string, string> $settings
|
|
||||||
* @return array<string, mixed>
|
|
||||||
*/
|
|
||||||
private function card(Composition $program, array $settings): array
|
|
||||||
{
|
|
||||||
return ['layout' => 'u4', 'style' => [], 'slots' => [
|
|
||||||
['type' => 'program_card', 'v' => 1, 'variant' => 'adaptive', 'settings' => $settings, 'data' => [], 'refs' => ['composition' => $program->id]],
|
|
||||||
]];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param list<array<string, mixed>> $sections
|
|
||||||
*/
|
|
||||||
private function publish(string $path, array $sections): PageRevision
|
|
||||||
{
|
|
||||||
$page = Page::query()->create(['path' => $path]);
|
|
||||||
$service = app(PageService::class);
|
|
||||||
$revision = $service->saveRevision($page, $sections, null, null, null);
|
|
||||||
$service->publish($page, $revision);
|
|
||||||
|
|
||||||
return $revision;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return list<string>
|
|
||||||
*/
|
|
||||||
private function cards(string $html): array
|
|
||||||
{
|
|
||||||
preg_match_all('#<article class="lf-pc .*?</article>#s', $html, $matches);
|
|
||||||
|
|
||||||
return $matches[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function jpeg(): string
|
|
||||||
{
|
|
||||||
$image = imagecreatetruecolor(800, 450);
|
|
||||||
imagefill($image, 0, 0, imagecolorallocate($image, 20, 80, 150));
|
|
||||||
ob_start();
|
|
||||||
imagejpeg($image);
|
|
||||||
|
|
||||||
return (string) ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -136,7 +136,7 @@ public function test_public_page_is_identical_for_guests_and_members(): void
|
|||||||
public function test_global_layout_has_header_navigation_mobile_menu_and_footer(): void
|
public function test_global_layout_has_header_navigation_mobile_menu_and_footer(): void
|
||||||
{
|
{
|
||||||
// Der Warenkorb gehört zum Shop (Etappe 1, nur Testzahlung). Ohne aktiven Shop erscheint kein Kaufknopf.
|
// Der Warenkorb gehört zum Shop (Etappe 1, nur Testzahlung). Ohne aktiven Shop erscheint kein Kaufknopf.
|
||||||
config(['services.payment.driver' => 'stripe']);
|
config(['services.payment.driver' => 'unbekannt']);
|
||||||
$html = $this->get('/praevention')->assertOk()->getContent();
|
$html = $this->get('/praevention')->assertOk()->getContent();
|
||||||
|
|
||||||
$this->assertStringContainsString('<a class="skip" href="#inhalt">', $html);
|
$this->assertStringContainsString('<a class="skip" href="#inhalt">', $html);
|
||||||
@@ -161,7 +161,7 @@ public function test_cart_entry_appears_only_when_the_shop_is_enabled(): void
|
|||||||
// statt der früheren Vorbereitung über cms.cart.*.
|
// statt der früheren Vorbereitung über cms.cart.*.
|
||||||
$this->get('/praevention')->assertSee('Warenkorb')->assertSee('href="'.route('cart').'"', false);
|
$this->get('/praevention')->assertSee('Warenkorb')->assertSee('href="'.route('cart').'"', false);
|
||||||
|
|
||||||
config(['services.payment.driver' => 'stripe']);
|
config(['services.payment.driver' => 'unbekannt']);
|
||||||
$this->get('/praevention')->assertDontSee('Warenkorb');
|
$this->get('/praevention')->assertDontSee('Warenkorb');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ public function test_the_shop_exists_only_with_test_payment_and_never_in_product
|
|||||||
{
|
{
|
||||||
$this->assertTrue(Shop::enabled());
|
$this->assertTrue(Shop::enabled());
|
||||||
|
|
||||||
config(['services.payment.driver' => 'stripe']);
|
// Ein nicht freigegebener Zahlungsweg (Stripe ist seit der Sandbox-Anbindung freigegeben, siehe StripeSandboxTest).
|
||||||
|
config(['services.payment.driver' => 'unbekannt']);
|
||||||
$this->get(route('shop'))->assertNotFound();
|
$this->get(route('shop'))->assertNotFound();
|
||||||
$this->get(route('cart'))->assertNotFound();
|
$this->get(route('cart'))->assertNotFound();
|
||||||
$this->post(route('cart.add', $this->privateKonflikte()))->assertNotFound();
|
$this->post(route('cart.add', $this->privateKonflikte()))->assertNotFound();
|
||||||
|
|||||||
@@ -0,0 +1,314 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Domain\Commerce\Order;
|
||||||
|
use App\Domain\Commerce\Shop;
|
||||||
|
use App\Domain\Entitlement\Acquisition;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Http\Client\Request as HttpRequest;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Testing\TestResponse;
|
||||||
|
use Tests\Support\BuildsShop;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stripe-Sandbox (Etappe 1): Kasse über eine Checkout Session, Freischaltung nur durch die signierte Meldung.
|
||||||
|
* Alle Aufrufe an Stripe sind gefälscht (Http::fake); es geht nie ein echter Aufruf hinaus.
|
||||||
|
*/
|
||||||
|
class StripeSandboxTest extends TestCase
|
||||||
|
{
|
||||||
|
use BuildsShop;
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
private const WEBHOOK_SECRET = 'whsec_testgeheimnis_nur_fuer_tests';
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->seedShop();
|
||||||
|
config([
|
||||||
|
'services.payment.driver' => 'stripe',
|
||||||
|
'services.stripe.secret' => 'sk_test_nur_fuer_tests',
|
||||||
|
'services.stripe.webhook_secret' => self::WEBHOOK_SECRET,
|
||||||
|
'services.stripe.api_base' => 'https://stripe.test',
|
||||||
|
]);
|
||||||
|
$this->travelTo('2026-11-22 10:00:00');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_stripe_is_a_shop_driver_but_never_in_production(): void
|
||||||
|
{
|
||||||
|
$this->assertTrue(Shop::enabled());
|
||||||
|
$this->assertTrue(Shop::stripe());
|
||||||
|
|
||||||
|
$this->app['env'] = 'production';
|
||||||
|
$this->assertFalse(Shop::enabled());
|
||||||
|
$this->assertFalse(Shop::stripe());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_the_order_page_offers_stripe_and_not_the_test_buttons(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
|
||||||
|
$this->actingAs($this->tina())->get(route('member.order', $order))
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('Jetzt bezahlen (Stripe-Testmodus)')
|
||||||
|
->assertDontSee('Testzahlung bestätigen')
|
||||||
|
->assertDontSee('Testzahlung ablehnen');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_paying_creates_a_checkout_session_with_the_order_amounts_and_redirects(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte(), $this->privateGrenzen()]);
|
||||||
|
Http::fake(['stripe.test/v1/checkout/sessions' => Http::response(['id' => 'cs_test_1', 'url' => 'https://checkout.stripe.test/c/pay/cs_test_1'])]);
|
||||||
|
|
||||||
|
$this->actingAs($this->tina())->post(route('member.order.pay', $order))
|
||||||
|
->assertRedirect('https://checkout.stripe.test/c/pay/cs_test_1');
|
||||||
|
|
||||||
|
Http::assertSent(function (HttpRequest $request) use ($order): bool {
|
||||||
|
parse_str($request->body(), $body);
|
||||||
|
|
||||||
|
return $request->url() === 'https://stripe.test/v1/checkout/sessions'
|
||||||
|
&& $request->hasHeader('Authorization', 'Bearer sk_test_nur_fuer_tests')
|
||||||
|
&& $request->hasHeader('Idempotency-Key', 'luf-order-'.$order->id.'-1')
|
||||||
|
&& $body['mode'] === 'payment'
|
||||||
|
&& $body['client_reference_id'] === (string) $order->id
|
||||||
|
&& $body['metadata']['order_id'] === (string) $order->id
|
||||||
|
&& $body['line_items'][0]['price_data']['currency'] === 'eur'
|
||||||
|
&& (int) $body['line_items'][0]['price_data']['unit_amount'] === 4900
|
||||||
|
&& (int) $body['line_items'][1]['price_data']['unit_amount'] === 2900
|
||||||
|
&& str_ends_with($body['success_url'], '?zahlung=zurueck')
|
||||||
|
&& str_ends_with($body['cancel_url'], '?zahlung=abbruch');
|
||||||
|
});
|
||||||
|
$this->assertSame('offen', $order->payments()->where('provider', 'stripe')->value('status'));
|
||||||
|
$this->assertSame('offen', $order->fresh()->status, 'Bezahlt wird erst durch die signierte Meldung.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_an_open_session_is_reused(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$order->payments()->create(['provider' => 'stripe', 'status' => 'offen', 'provider_reference' => 'cs_test_alt']);
|
||||||
|
|
||||||
|
Http::fake(['stripe.test/v1/checkout/sessions/cs_test_alt' => Http::response(['id' => 'cs_test_alt', 'status' => 'open', 'url' => 'https://checkout.stripe.test/alt'])]);
|
||||||
|
$this->actingAs($this->tina())->post(route('member.order.pay', $order))->assertRedirect('https://checkout.stripe.test/alt');
|
||||||
|
Http::assertNotSent(fn (HttpRequest $request): bool => $request->method() === 'POST');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_an_expired_session_is_replaced_by_a_new_one(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$order->payments()->create(['provider' => 'stripe', 'status' => 'offen', 'provider_reference' => 'cs_test_alt']);
|
||||||
|
|
||||||
|
Http::fake([
|
||||||
|
'stripe.test/v1/checkout/sessions/cs_test_alt' => Http::response(['id' => 'cs_test_alt', 'status' => 'expired']),
|
||||||
|
'stripe.test/v1/checkout/sessions' => Http::response(['id' => 'cs_test_neu', 'url' => 'https://checkout.stripe.test/neu']),
|
||||||
|
]);
|
||||||
|
$this->actingAs($this->tina())->post(route('member.order.pay', $order))->assertRedirect('https://checkout.stripe.test/neu');
|
||||||
|
Http::assertSent(fn (HttpRequest $request): bool => $request->hasHeader('Idempotency-Key', 'luf-order-'.$order->id.'-2'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_only_the_buyer_pays_and_only_an_open_order(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
Http::fake();
|
||||||
|
|
||||||
|
$this->actingAs($this->max())->post(route('member.order.pay', $order))->assertForbidden();
|
||||||
|
Http::assertNothingSent();
|
||||||
|
|
||||||
|
$order->forceFill(['status' => 'bezahlt'])->save();
|
||||||
|
$this->actingAs($this->tina())->post(route('member.order.pay', $order))
|
||||||
|
->assertSessionHasErrors('payment');
|
||||||
|
Http::assertNothingSent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_only_test_keys_reach_stripe(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
Http::fake();
|
||||||
|
|
||||||
|
foreach (['sk_live_abc', '', 'pk_test_abc'] as $secret) {
|
||||||
|
config(['services.stripe.secret' => $secret]);
|
||||||
|
$this->actingAs($this->tina())->post(route('member.order.pay', $order))->assertSessionHasErrors('payment');
|
||||||
|
}
|
||||||
|
|
||||||
|
Http::assertNothingSent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_a_stripe_error_leaves_the_order_open_and_shows_a_plain_message(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
Http::fake(['stripe.test/*' => Http::response(['error' => ['type' => 'api_error']], 500)]);
|
||||||
|
|
||||||
|
$this->actingAs($this->tina())->post(route('member.order.pay', $order))
|
||||||
|
->assertSessionHasErrors(['payment' => 'Die Zahlung konnte bei Stripe nicht angelegt werden. Bitte versuche es später noch einmal.']);
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
$this->assertSame(0, $order->payments()->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_a_signed_paid_event_grants_every_line_once_even_when_repeated(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte(), $this->privateGrenzen()]);
|
||||||
|
$payload = $this->sessionEvent('checkout.session.completed', $order, 'cs_test_bezahlt', 7800);
|
||||||
|
|
||||||
|
$this->webhook($payload)->assertOk()->assertJson(['handled' => true]);
|
||||||
|
$this->webhook($payload)->assertOk();
|
||||||
|
|
||||||
|
$this->assertSame('bezahlt', $order->fresh()->status);
|
||||||
|
$this->assertSame(2, Acquisition::query()->where('reference_type', 'order_line')->whereIn('reference_id', $order->lines()->pluck('id'))->count(), 'Je Position genau ein Erwerb.');
|
||||||
|
$this->assertSame(1, $order->payments()->count());
|
||||||
|
$payment = $order->payments()->first();
|
||||||
|
$this->assertSame('stripe', $payment->provider);
|
||||||
|
$this->assertSame('bestaetigt', $payment->status);
|
||||||
|
$this->assertSame('cs_test_bezahlt', $payment->provider_reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_a_paid_event_confirms_the_open_payment_row_instead_of_adding_one(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$order->payments()->create(['provider' => 'stripe', 'status' => 'offen', 'provider_reference' => 'cs_test_zeile']);
|
||||||
|
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.completed', $order, 'cs_test_zeile', 4900))->assertOk();
|
||||||
|
|
||||||
|
$this->assertSame(1, $order->payments()->count());
|
||||||
|
$this->assertSame('bestaetigt', $order->payments()->first()->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_an_unsigned_wrongly_signed_or_stale_message_does_nothing(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$payload = $this->sessionEvent('checkout.session.completed', $order, 'cs_test_x', 4900);
|
||||||
|
$before = Acquisition::query()->count();
|
||||||
|
|
||||||
|
$this->call('POST', route('stripe.webhook'), [], [], [], ['CONTENT_TYPE' => 'application/json'], $payload)->assertStatus(400);
|
||||||
|
$this->webhook($payload, 'sig-falsch')->assertStatus(400);
|
||||||
|
$this->webhook($payload, 't='.now()->getTimestamp().',v1=abc')->assertStatus(400);
|
||||||
|
$this->webhook($payload, $this->signature($payload, now()->subMinutes(10)->getTimestamp()))->assertStatus(400);
|
||||||
|
$this->webhook($payload.' ', $this->signature($payload))->assertStatus(400);
|
||||||
|
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
$this->assertSame($before, Acquisition::query()->count(), 'Es wird nichts freigeschaltet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_a_wrong_amount_or_currency_grants_nothing_and_is_marked_for_review(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.completed', $order, 'cs_test_zuwenig', 100))->assertOk()->assertJson(['handled' => false]);
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.completed', $order, 'cs_test_usd', 4900, 'usd'))->assertOk()->assertJson(['handled' => false]);
|
||||||
|
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
$this->assertSame(['zu_pruefen', 'zu_pruefen'], $order->payments()->orderBy('id')->pluck('status')->all());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_an_unpaid_session_an_unknown_order_and_unknown_events_are_ignored(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.completed', $order, 'cs_test_offen', 4900, 'eur', 'unpaid'))->assertOk()->assertJson(['handled' => false]);
|
||||||
|
$this->webhook($this->event('checkout.session.completed', ['id' => 'cs_x', 'client_reference_id' => '999999', 'payment_status' => 'paid', 'amount_total' => 1, 'currency' => 'eur']))->assertOk()->assertJson(['handled' => false]);
|
||||||
|
$this->webhook($this->event('customer.created', ['id' => 'cus_1']))->assertOk()->assertJson(['handled' => false]);
|
||||||
|
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_an_expired_session_keeps_the_order_open_and_payable(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$order->payments()->create(['provider' => 'stripe', 'status' => 'offen', 'provider_reference' => 'cs_test_abgelaufen']);
|
||||||
|
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.expired', $order, 'cs_test_abgelaufen', 4900, 'eur', 'unpaid'))->assertOk();
|
||||||
|
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
$this->assertSame('abgelaufen', $order->payments()->first()->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_a_payment_for_an_order_that_is_no_longer_open_is_not_applied(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$order->forceFill(['status' => 'fehlgeschlagen'])->save();
|
||||||
|
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.completed', $order, 'cs_test_spaet', 4900))->assertOk()->assertJson(['handled' => false]);
|
||||||
|
|
||||||
|
$this->assertSame('fehlgeschlagen', $order->fresh()->status);
|
||||||
|
$this->assertSame('zu_pruefen', $order->payments()->first()->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_the_webhook_does_not_exist_outside_stripe_mode_or_in_production(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$payload = $this->sessionEvent('checkout.session.completed', $order, 'cs_test_x', 4900);
|
||||||
|
|
||||||
|
config(['services.payment.driver' => 'test']);
|
||||||
|
$this->webhook($payload)->assertNotFound();
|
||||||
|
|
||||||
|
config(['services.payment.driver' => 'stripe']);
|
||||||
|
$this->app['env'] = 'production';
|
||||||
|
$this->webhook($payload)->assertNotFound();
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_without_a_webhook_secret_every_message_is_refused(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$payload = $this->sessionEvent('checkout.session.completed', $order, 'cs_test_x', 4900);
|
||||||
|
$header = $this->signature($payload);
|
||||||
|
config(['services.stripe.webhook_secret' => '']);
|
||||||
|
|
||||||
|
$this->webhook($payload, $header)->assertStatus(400);
|
||||||
|
$this->assertSame('offen', $order->fresh()->status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_the_return_page_explains_waiting_and_cancelling(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
|
||||||
|
$this->actingAs($this->tina())->get(route('member.order', $order).'?zahlung=zurueck')->assertSee('Wir warten auf die Bestätigung von Stripe');
|
||||||
|
$this->actingAs($this->tina())->get(route('member.order', $order).'?zahlung=abbruch')->assertSee('Es wurde nichts abgebucht');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_a_paid_order_offers_the_library_and_no_withdrawal_that_would_not_refund_money(): void
|
||||||
|
{
|
||||||
|
$order = $this->orderOf($this->tina(), [$this->privateKonflikte()]);
|
||||||
|
$this->webhook($this->sessionEvent('checkout.session.completed', $order, 'cs_test_ok', 4900))->assertOk();
|
||||||
|
|
||||||
|
$this->actingAs($this->tina())->get(route('member.order', $order))
|
||||||
|
->assertSee('Zur Bibliothek')
|
||||||
|
->assertDontSee('Widerrufen');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $object
|
||||||
|
*/
|
||||||
|
private function event(string $type, array $object): string
|
||||||
|
{
|
||||||
|
return json_encode(['id' => 'evt_'.$type, 'object' => 'event', 'type' => $type, 'data' => ['object' => $object]], JSON_THROW_ON_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sessionEvent(string $type, Order $order, string $sessionId, int $amount, string $currency = 'eur', string $paymentStatus = 'paid'): string
|
||||||
|
{
|
||||||
|
return $this->event($type, [
|
||||||
|
'id' => $sessionId,
|
||||||
|
'object' => 'checkout.session',
|
||||||
|
'client_reference_id' => (string) $order->id,
|
||||||
|
'payment_status' => $paymentStatus,
|
||||||
|
'amount_total' => $amount,
|
||||||
|
'currency' => $currency,
|
||||||
|
'metadata' => ['order_id' => (string) $order->id],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function signature(string $payload, ?int $timestamp = null): string
|
||||||
|
{
|
||||||
|
$timestamp ??= now()->getTimestamp();
|
||||||
|
|
||||||
|
return 't='.$timestamp.',v1='.hash_hmac('sha256', $timestamp.'.'.$payload, self::WEBHOOK_SECRET);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function webhook(string $payload, ?string $signature = null): TestResponse
|
||||||
|
{
|
||||||
|
return $this->call('POST', route('stripe.webhook'), [], [], [], [
|
||||||
|
'CONTENT_TYPE' => 'application/json',
|
||||||
|
'HTTP_STRIPE_SIGNATURE' => $signature ?? $this->signature($payload),
|
||||||
|
], $payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Domain\Catalog\ContentElement;
|
|
||||||
use App\Domain\Catalog\ContentService;
|
|
||||||
use App\Domain\Catalog\DomainRuleException;
|
|
||||||
use App\Domain\Entitlement\Grant;
|
|
||||||
use App\Domain\Media\PresentationFile;
|
|
||||||
use App\Domain\Media\WebsiteMedia;
|
|
||||||
use App\Domain\Media\WebsiteRelease;
|
|
||||||
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
|
|
||||||
use App\Filament\Support\MediumForm;
|
|
||||||
use App\Jobs\PublishWebsiteMedia;
|
|
||||||
use App\Jobs\StorePresentationFile;
|
|
||||||
use App\Models\User;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Http\UploadedFile;
|
|
||||||
use Illuminate\Support\Facades\Queue;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Livewire\Livewire;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Website-Datei eines Films (zum Beispiel ein Trailer ohne Schutz). Der Web-Prozess hat `derived/` nur lesend
|
|
||||||
* (docker-compose.yml); die Datei muss deshalb die Warteschlange ablegen.
|
|
||||||
*/
|
|
||||||
class WebsiteFileTest extends TestCase
|
|
||||||
{
|
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
Filament::setCurrentPanel(Filament::getPanel('verwaltung'));
|
|
||||||
Storage::fake('cms_incoming');
|
|
||||||
Storage::fake('media_derived');
|
|
||||||
Storage::fake('media_public');
|
|
||||||
Storage::fake('media_originals');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_web_process_does_not_write_to_the_derived_store_but_hands_the_copy_to_the_queue(): void
|
|
||||||
{
|
|
||||||
Queue::fake();
|
|
||||||
Storage::disk('cms_incoming')->put('inhalte/trailer.mp4', 'trailer-bytes');
|
|
||||||
$this->actingAs($this->editor(), 'staff');
|
|
||||||
|
|
||||||
$element = MediumForm::create([
|
|
||||||
'working_title' => 'Trailer',
|
|
||||||
'shape' => 'film',
|
|
||||||
'incoming' => 'inhalte/trailer.mp4',
|
|
||||||
'without_version' => true,
|
|
||||||
], hold: false);
|
|
||||||
|
|
||||||
Queue::assertPushed(StorePresentationFile::class, fn (StorePresentationFile $job): bool => $job->elementId === $element->id);
|
|
||||||
$this->assertEmpty(Storage::disk('media_derived')->allFiles());
|
|
||||||
$this->assertNull($element->fresh()->preview_path);
|
|
||||||
$this->assertSame(0, $element->versions()->count());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_queue_places_the_file_and_the_film_can_then_be_released_without_a_license(): void
|
|
||||||
{
|
|
||||||
Storage::disk('cms_incoming')->put('inhalte/trailer.mp4', 'trailer-bytes');
|
|
||||||
$this->actingAs($this->editor(), 'staff');
|
|
||||||
|
|
||||||
$element = MediumForm::create([
|
|
||||||
'working_title' => 'Trailer',
|
|
||||||
'shape' => 'film',
|
|
||||||
'incoming' => 'inhalte/trailer.mp4',
|
|
||||||
'without_version' => true,
|
|
||||||
], hold: false)->fresh();
|
|
||||||
|
|
||||||
$this->assertSame('teaser/'.$element->id.'/datei.mp4', $element->preview_path);
|
|
||||||
Storage::disk('media_derived')->assertExists($element->preview_path);
|
|
||||||
Storage::disk('cms_incoming')->assertMissing('inhalte/trailer.mp4');
|
|
||||||
|
|
||||||
$this->assertNull(app(WebsiteRelease::class)->refusal($element));
|
|
||||||
app(WebsiteRelease::class)->release($element);
|
|
||||||
$this->assertNotNull(app(WebsiteMedia::class)->present($element->fresh()));
|
|
||||||
$this->assertSame(0, Grant::query()->count());
|
|
||||||
Storage::disk('media_originals')->assertDirectoryEmpty('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_a_film_format_the_browser_cannot_play_is_refused_before_anything_is_created(): void
|
|
||||||
{
|
|
||||||
Storage::disk('cms_incoming')->put('inhalte/trailer.mov', 'mov-bytes');
|
|
||||||
$this->actingAs($this->editor(), 'staff');
|
|
||||||
|
|
||||||
try {
|
|
||||||
MediumForm::create([
|
|
||||||
'working_title' => 'Trailer als MOV',
|
|
||||||
'shape' => 'film',
|
|
||||||
'incoming' => 'inhalte/trailer.mov',
|
|
||||||
'without_version' => true,
|
|
||||||
], hold: false);
|
|
||||||
$this->fail('Eine MOV-Datei darf keine Website-Datei werden.');
|
|
||||||
} catch (DomainRuleException $e) {
|
|
||||||
$this->assertStringContainsString('.mov', $e->getMessage());
|
|
||||||
$this->assertStringContainsString('MP4', $e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertSame(0, ContentElement::query()->count());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_a_failed_copy_is_shown_at_the_medium_instead_of_getting_lost(): void
|
|
||||||
{
|
|
||||||
$element = app(ContentService::class)->createElement('film', 'film', 'Trailer');
|
|
||||||
|
|
||||||
(new StorePresentationFile($element->id, 'inhalte/fehlt.mp4'))->handle(app(PresentationFile::class));
|
|
||||||
|
|
||||||
$this->assertStringContainsString('nicht im Eingang', (string) $element->fresh()->thumbnail_error);
|
|
||||||
$this->assertNull($element->fresh()->preview_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_a_film_with_a_protected_version_gets_a_separate_unprotected_website_file(): void
|
|
||||||
{
|
|
||||||
Queue::fake([PublishWebsiteMedia::class]);
|
|
||||||
$content = app(ContentService::class);
|
|
||||||
$film = $content->createElement('film', 'film', 'Unterrichtsfilm');
|
|
||||||
$version = $content->publishElementVersion($film, null, ['incoming' => 'inhalte/ganz.mp4']);
|
|
||||||
$this->assertNotNull(app(WebsiteRelease::class)->refusal($film->fresh()));
|
|
||||||
|
|
||||||
$this->actingAs($this->editor(), 'staff');
|
|
||||||
Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
|
|
||||||
->set('bereich', 'website')
|
|
||||||
->set('websiteUpload', UploadedFile::fake()->create('trailer.mp4', 100, 'video/mp4'))
|
|
||||||
->call('storeWebsiteFile')
|
|
||||||
->assertSee('Die Website-Datei ist übernommen');
|
|
||||||
|
|
||||||
$film = $film->fresh();
|
|
||||||
$this->assertSame('teaser/'.$film->id.'/datei.mp4', $film->preview_path);
|
|
||||||
$this->assertSame([$version->id], $film->versions()->pluck('id')->all());
|
|
||||||
$this->assertNull(app(WebsiteRelease::class)->refusal($film));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_the_upload_in_the_viewer_refuses_wrong_formats_and_missing_files(): void
|
|
||||||
{
|
|
||||||
$film = app(ContentService::class)->createElement('film', 'film', 'Film');
|
|
||||||
$this->actingAs($this->editor(), 'staff');
|
|
||||||
|
|
||||||
Livewire::test(ViewContentElement::class, ['record' => $film->getKey()])
|
|
||||||
->set('bereich', 'website')
|
|
||||||
->call('storeWebsiteFile')
|
|
||||||
->assertSee('Wähle zuerst eine Datei.')
|
|
||||||
->set('websiteUpload', UploadedFile::fake()->create('trailer.mov', 10))
|
|
||||||
->call('storeWebsiteFile')
|
|
||||||
->assertSee('kann der Browser nicht direkt abspielen');
|
|
||||||
|
|
||||||
$this->assertNull($film->fresh()->preview_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test_replacing_the_file_of_a_released_film_publishes_the_new_copy(): void
|
|
||||||
{
|
|
||||||
Storage::disk('cms_incoming')->put('inhalte/neu.mp4', 'neu');
|
|
||||||
$film = app(ContentService::class)->createElement('film', 'film', 'Trailer');
|
|
||||||
$film->website_released_at = now();
|
|
||||||
$film->save();
|
|
||||||
Queue::fake([PublishWebsiteMedia::class]);
|
|
||||||
|
|
||||||
app(PresentationFile::class)->store($film, 'inhalte/neu.mp4');
|
|
||||||
|
|
||||||
Queue::assertPushed(PublishWebsiteMedia::class, fn (PublishWebsiteMedia $job): bool => $job->elementId === $film->id && $job->action === 'release');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function editor(): User
|
|
||||||
{
|
|
||||||
$editor = User::factory()->redakteur()->create();
|
|
||||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
|
||||||
|
|
||||||
return $editor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user