Nimm die kleine Filmstufe für die Titelbildwahl und verankere Hinweise ohne neue Fassung.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c47c3b9b32
commit
f86032cb5f
14 files changed
+283
-46
No files matched your search
@@ -11,6 +11,7 @@ class CompositionMember extends Model
|
||||
'composition_version_id',
|
||||
'position',
|
||||
'role',
|
||||
'placement_note',
|
||||
'content_element_version_id',
|
||||
'nested_composition_version_id',
|
||||
];
|
||||
|
||||
@@ -15,6 +15,8 @@ class ContentElement extends Model
|
||||
'working_title',
|
||||
'display_title',
|
||||
'description',
|
||||
'usage_note',
|
||||
'license_note',
|
||||
'summary',
|
||||
'thumbnail_path',
|
||||
'thumbnail_alt',
|
||||
|
||||
@@ -115,6 +115,7 @@ public function publishComposition(
|
||||
$version->members()->create([
|
||||
'position' => $index + 1,
|
||||
'role' => $this->required($member['role'], 'Die Rolle eines Mitglieds fehlt.'),
|
||||
'placement_note' => $this->optionalText($member['note'] ?? null),
|
||||
'content_element_version_id' => $target instanceof ContentElementVersion ? $target->id : null,
|
||||
'nested_composition_version_id' => $target instanceof CompositionVersion ? $target->id : null,
|
||||
]);
|
||||
@@ -215,6 +216,7 @@ private function membersHash(array $members): string
|
||||
$list[] = [
|
||||
'position' => $index + 1,
|
||||
'role' => $member['role'],
|
||||
'note' => $this->optionalText($member['note'] ?? null),
|
||||
'element_version_id' => $target instanceof ContentElementVersion ? $target->id : null,
|
||||
'composition_version_id' => $target instanceof CompositionVersion ? $target->id : null,
|
||||
];
|
||||
|
||||
@@ -83,24 +83,36 @@ public function forCompositionFrame(Composition $composition, ContentElementVers
|
||||
$this->rememberChoice($composition, 'frame:'.$version->id.'@'.$this->secondText($seconds));
|
||||
}
|
||||
|
||||
public function jpegAtVersion(ContentElementVersion $version, float $seconds): ?string
|
||||
public function frameInput(ContentElementVersion $version): ?string
|
||||
{
|
||||
$file = is_array($version->metadata) ? ($version->metadata['file'] ?? null) : null;
|
||||
$proxy = MediaRendition::query()
|
||||
->where('content_element_version_id', $version->id)
|
||||
->where('role', 'variant')
|
||||
->where('label', '480')
|
||||
->value('path');
|
||||
|
||||
if (! is_string($file) || $file === '' || str_contains($file, '..') || ! str_starts_with($file, 'inhalte/')) {
|
||||
return null;
|
||||
if (is_string($proxy) && $this->readableDerived($proxy, 'ableitungen/')) {
|
||||
return $proxy;
|
||||
}
|
||||
|
||||
$file = is_array($version->metadata) ? ($version->metadata['file'] ?? null) : null;
|
||||
|
||||
return $this->readableDerived($file, 'inhalte/') ? $file : null;
|
||||
}
|
||||
|
||||
public function jpegAtVersion(ContentElementVersion $version, float $seconds): ?string
|
||||
{
|
||||
if ($seconds < 0 || $seconds > 7200) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$disk = Storage::disk('media_derived');
|
||||
$file = $this->frameInput($version);
|
||||
|
||||
if (! $disk->exists($file)) {
|
||||
if ($file === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$disk = Storage::disk('media_derived');
|
||||
$binary = (new ExecutableFinder)->find('ffmpeg');
|
||||
|
||||
if ($binary === null) {
|
||||
@@ -112,19 +124,21 @@ public function jpegAtVersion(ContentElementVersion $version, float $seconds): ?
|
||||
'-hide_banner',
|
||||
'-loglevel',
|
||||
'error',
|
||||
'-i',
|
||||
$disk->path($file),
|
||||
'-ss',
|
||||
$this->secondText($seconds),
|
||||
'-i',
|
||||
$disk->path($file),
|
||||
'-frames:v',
|
||||
'1',
|
||||
'-vf',
|
||||
'scale=640:-2',
|
||||
'-f',
|
||||
'image2pipe',
|
||||
'-vcodec',
|
||||
'mjpeg',
|
||||
'pipe:1',
|
||||
]);
|
||||
$process->setTimeout(30);
|
||||
$process->setTimeout(15);
|
||||
$process->run();
|
||||
$bytes = $process->getOutput();
|
||||
|
||||
@@ -135,6 +149,15 @@ public function jpegAtVersion(ContentElementVersion $version, float $seconds): ?
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
private function readableDerived(mixed $path, string $prefix): bool
|
||||
{
|
||||
if (! is_string($path) || $path === '' || str_contains($path, '..') || ! str_starts_with($path, $prefix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Storage::disk('media_derived')->exists($path);
|
||||
}
|
||||
|
||||
private function secondText(float $seconds): string
|
||||
{
|
||||
$seconds = max(0, min(7200, $seconds));
|
||||
|
||||
@@ -65,6 +65,15 @@ abstract class EditComposition extends EditRecord
|
||||
|
||||
public string $roleDraft = '';
|
||||
|
||||
public string $noteDraft = '';
|
||||
|
||||
public string $imageCaptionText = '';
|
||||
|
||||
public ?string $thumbnailSource = null;
|
||||
|
||||
/** @var list<array{version_id: int, title: string, label: string, file_url: ?string}> */
|
||||
public array $frameFilmChoices = [];
|
||||
|
||||
public string $panel = 'angaben';
|
||||
|
||||
public bool $pickerOpen = false;
|
||||
@@ -685,6 +694,7 @@ public function addPart(string $target): void
|
||||
}
|
||||
|
||||
$row['role'] = app(EditorialCatalog::class)->defaultRole((string) $row['kind']);
|
||||
$row['note'] = '';
|
||||
$this->members[] = $row;
|
||||
$this->members = array_values($this->members);
|
||||
$this->selected = array_key_last($this->members);
|
||||
@@ -711,6 +721,7 @@ public function removePart(int $index): void
|
||||
$this->members = array_values($this->members);
|
||||
$this->selected = null;
|
||||
$this->roleDraft = '';
|
||||
$this->noteDraft = '';
|
||||
$this->panel = 'angaben';
|
||||
$this->partOpen = false;
|
||||
$this->partSnapshot = [];
|
||||
@@ -750,6 +761,7 @@ public function useVersion(int $index, string $target): void
|
||||
|
||||
$this->commitRoleDraft();
|
||||
$row['role'] = $this->members[$index]['role'] ?? $row['kind'];
|
||||
$row['note'] = $this->members[$index]['note'] ?? '';
|
||||
$this->members[$index] = $row;
|
||||
$this->syncRoleDraft();
|
||||
$this->feedback = $row['version_label'].' ist für diese Stelle ausgewählt. Der Entwurf speichert das. Eine freigegebene Fassung bleibt unverändert.';
|
||||
@@ -845,7 +857,8 @@ public function openModule(): void
|
||||
$this->partOpen = false;
|
||||
$this->textOpen = false;
|
||||
$this->moduleTab = 'beschreibung';
|
||||
$films = $this->frameFilms();
|
||||
$this->frameFilmChoices = $this->frameFilms();
|
||||
$films = $this->frameFilmChoices;
|
||||
$this->imageMode = $films === [] ? 'bestand' : 'film';
|
||||
|
||||
if ($films !== [] && $this->frameVersionId === null) {
|
||||
@@ -982,20 +995,31 @@ public function framePreviewUrl(): ?string
|
||||
|
||||
public function imageCaption(): ?string
|
||||
{
|
||||
/** @var Composition $composition */
|
||||
$composition = $this->getRecord();
|
||||
$composition->refresh();
|
||||
$source = $composition->thumbnail_source;
|
||||
return $this->imageCaptionText !== '' ? $this->imageCaptionText : null;
|
||||
}
|
||||
|
||||
protected function captionFor(mixed $source): string
|
||||
{
|
||||
if (! is_string($source) || $source === '') {
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
if (preg_match('/^frame:(\d+)@([\d.]+)$/', $source, $match) === 1) {
|
||||
$version = ContentElementVersion::query()->with('element')->find($match[1]);
|
||||
$title = $version?->element?->working_title ?: 'dem Film';
|
||||
$title = null;
|
||||
|
||||
return 'Titelbild aus '.$title.' bei '.$match[2].' Sekunden.';
|
||||
foreach ($this->members as $member) {
|
||||
if (($member['target'] ?? '') === 'element:'.$match[1]) {
|
||||
$title = $member['title'] ?? null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($title === null) {
|
||||
$version = ContentElementVersion::query()->with('element')->find($match[1]);
|
||||
$title = $version?->element?->working_title;
|
||||
}
|
||||
|
||||
return 'Titelbild aus '.($title ?: 'dem Film').' bei '.$match[2].' Sekunden.';
|
||||
}
|
||||
|
||||
if ($source === 'eigen') {
|
||||
@@ -1006,7 +1030,13 @@ public function imageCaption(): ?string
|
||||
return 'Titelbild aus einem vorhandenen Bild.';
|
||||
}
|
||||
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function rememberCaption(Composition $record): void
|
||||
{
|
||||
$this->thumbnailSource = $record->thumbnail_source;
|
||||
$this->imageCaptionText = $this->captionFor($record->thumbnail_source);
|
||||
}
|
||||
|
||||
public function savePreview(): void
|
||||
@@ -1064,6 +1094,7 @@ public function adoptPicture(int $elementId): void
|
||||
$record->refresh();
|
||||
$this->thumbnailPath = $record->thumbnail_path;
|
||||
$this->thumbnailError = $record->thumbnail_error;
|
||||
$this->rememberCaption($record);
|
||||
$this->feedback = $this->previewFeedback($record, $before);
|
||||
}
|
||||
|
||||
@@ -1172,7 +1203,11 @@ public function publishRevision(): bool
|
||||
return false;
|
||||
}
|
||||
|
||||
$payload[] = ['role' => $role, 'target' => $model];
|
||||
$payload[] = [
|
||||
'role' => $role,
|
||||
'target' => $model,
|
||||
'note' => trim((string) ($member['note'] ?? '')),
|
||||
];
|
||||
}
|
||||
|
||||
/** @var Composition $record */
|
||||
@@ -1258,6 +1293,8 @@ protected function loadEditor(): void
|
||||
$this->thumbnailPath = $composition->thumbnail_path;
|
||||
$this->thumbnailAlt = (string) ($composition->thumbnail_alt ?? '');
|
||||
$this->thumbnailError = $composition->thumbnail_error;
|
||||
$this->thumbnailSource = $composition->thumbnail_source;
|
||||
$this->imageCaptionText = $this->captionFor($composition->thumbnail_source);
|
||||
$this->dimensionIds = IdentityDimensionValue::query()
|
||||
->where('subject_type', $composition->getMorphClass())
|
||||
->where('subject_id', $composition->id)
|
||||
@@ -1313,6 +1350,7 @@ protected function applyDraft(array $draft): void
|
||||
}
|
||||
|
||||
$row['role'] = (string) ($member['role'] ?? $row['kind']);
|
||||
$row['note'] = trim((string) ($member['note'] ?? ''));
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
@@ -1323,6 +1361,7 @@ protected function applyDraft(array $draft): void
|
||||
$this->revisionNote = (string) ($draft['revision_note'] ?? '');
|
||||
$this->selected = null;
|
||||
$this->roleDraft = '';
|
||||
$this->noteDraft = '';
|
||||
$this->panel = 'angaben';
|
||||
|
||||
if ($requested > count($rows) && $this->feedback === '') {
|
||||
@@ -1338,6 +1377,7 @@ protected function applyVersion(CompositionVersion $version): void
|
||||
$this->materialNote = (string) ($version->material_note ?? '');
|
||||
$this->selected = null;
|
||||
$this->roleDraft = '';
|
||||
$this->noteDraft = '';
|
||||
$this->panel = 'angaben';
|
||||
}
|
||||
|
||||
@@ -1353,13 +1393,14 @@ protected function commitRoleDraft(?string $value = null): void
|
||||
}
|
||||
|
||||
$this->members[$this->selected]['role'] = trim($value ?? $this->roleDraft);
|
||||
$this->members[$this->selected]['note'] = trim($this->noteDraft);
|
||||
}
|
||||
|
||||
protected function syncRoleDraft(): void
|
||||
{
|
||||
$this->roleDraft = $this->selected !== null && isset($this->members[$this->selected])
|
||||
? (string) ($this->members[$this->selected]['role'] ?? '')
|
||||
: '';
|
||||
$member = $this->selected !== null ? ($this->members[$this->selected] ?? null) : null;
|
||||
$this->roleDraft = is_array($member) ? (string) ($member['role'] ?? '') : '';
|
||||
$this->noteDraft = is_array($member) ? (string) ($member['note'] ?? '') : '';
|
||||
}
|
||||
|
||||
public function releaseDisplay(): void
|
||||
@@ -1421,10 +1462,10 @@ protected function sameMembers(CompositionVersion $version): bool
|
||||
? 'element:'.$member->content_element_version_id
|
||||
: 'composition:'.$member->nested_composition_version_id;
|
||||
|
||||
return $member->role.'|'.$target;
|
||||
return $member->role.'|'.$target.'|'.trim((string) ($member->placement_note ?? ''));
|
||||
})->all();
|
||||
$next = array_values(array_map(
|
||||
fn (array $member): string => trim((string) ($member['role'] ?? '')).'|'.($member['target'] ?? ''),
|
||||
fn (array $member): string => trim((string) ($member['role'] ?? '')).'|'.($member['target'] ?? '').'|'.trim((string) ($member['note'] ?? '')),
|
||||
$this->members,
|
||||
));
|
||||
|
||||
@@ -1587,6 +1628,7 @@ protected function applyChosenImage(): string|false
|
||||
$record->refresh();
|
||||
$this->thumbnailPath = $record->thumbnail_path;
|
||||
$this->thumbnailError = $record->thumbnail_error;
|
||||
$this->rememberCaption($record);
|
||||
$note = $this->previewFeedback($record, $before);
|
||||
|
||||
if (! str_contains($note, 'unverändert')) {
|
||||
@@ -1616,6 +1658,7 @@ protected function storePreview(string $path): void
|
||||
$record->refresh();
|
||||
$this->thumbnailPath = $record->thumbnail_path;
|
||||
$this->thumbnailError = $record->thumbnail_error;
|
||||
$this->rememberCaption($record);
|
||||
$this->feedback = $this->previewFeedback($record, $before);
|
||||
}
|
||||
|
||||
@@ -1663,6 +1706,7 @@ protected function payload(): array
|
||||
fn (array $member): array => [
|
||||
'role' => trim((string) ($member['role'] ?? '')),
|
||||
'target' => (string) ($member['target'] ?? ''),
|
||||
'note' => trim((string) ($member['note'] ?? '')),
|
||||
],
|
||||
$members,
|
||||
)),
|
||||
@@ -1713,6 +1757,7 @@ protected function readyPayload(): array
|
||||
fn (array $row): array => [
|
||||
'role' => trim((string) ($row['role'] ?? '')),
|
||||
'target' => (string) ($row['target'] ?? ''),
|
||||
'note' => trim((string) ($row['note'] ?? '')),
|
||||
],
|
||||
$rows,
|
||||
)),
|
||||
@@ -1735,6 +1780,7 @@ protected function normalizePayload(array $payload): array
|
||||
$members[] = [
|
||||
'role' => trim((string) ($member['role'] ?? '')),
|
||||
'target' => (string) ($member['target'] ?? ''),
|
||||
'note' => trim((string) ($member['note'] ?? '')),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,9 @@ public static function table(Table $table): Table
|
||||
fn (ContentElement $record): string => static::getUrl('view', ['record' => $record])
|
||||
)->columns([
|
||||
TextColumn::make('working_title')->label('Arbeitstitel')->searchable(),
|
||||
TextColumn::make('summary')->label('Kurzbeschreibung')->limit(80),
|
||||
TextColumn::make('usage_note')->label('Einsatzhinweis')->limit(80),
|
||||
TextColumn::make('license_note')->label('Lizenzvermerk')->limit(40),
|
||||
TextColumn::make('kind')->label('Art'),
|
||||
TextColumn::make('pillar_names')->label('Säulen')->state(
|
||||
fn (ContentElement $record): string => $record->pillars->pluck('name')->join(', ') ?: '—'
|
||||
|
||||
@@ -58,7 +58,11 @@ public function form(Schema $schema): Schema
|
||||
->helperText('Erscheint in der Bibliothek. Leer lässt den Arbeitstitel stehen. Speichern legt keine Fassung an.'),
|
||||
Textarea::make('summary')->label('Kurzbeschreibung')->rows(3),
|
||||
Textarea::make('description')->label('Beschreibung')->rows(4)
|
||||
->helperText('Gilt für das Medium, nicht für eine einzelne Fassung.'),
|
||||
->helperText('Allgemeine Beschreibung des Mediums. Gilt nicht für eine einzelne Fassung und nicht nur für ein Modul.'),
|
||||
Textarea::make('usage_note')->label('Hinweise für den Einsatz')->rows(4)
|
||||
->helperText('Gilt für das Medium in jeder Verwendung. Speichern legt keine Fassung an.'),
|
||||
Textarea::make('license_note')->label('Interner Lizenzvermerk')->rows(3)
|
||||
->helperText('Nur in der Verwaltung sichtbar. Erscheint nicht in der Bibliothek und nicht auf der Website.'),
|
||||
Select::make('editorial_content_kind_id')
|
||||
->label('Inhaltsart')
|
||||
->options(fn (): array => EditorialContentKind::selectOptions())
|
||||
@@ -170,6 +174,8 @@ protected function mutateFormDataBeforeFill(array $data): array
|
||||
'working_title' => $this->getRecord()->working_title,
|
||||
'display_title' => $this->getRecord()->display_title,
|
||||
'description' => $this->getRecord()->description,
|
||||
'usage_note' => $this->getRecord()->usage_note,
|
||||
'license_note' => $this->getRecord()->license_note,
|
||||
'summary' => $this->getRecord()->summary,
|
||||
'editorial_content_kind_id' => $this->getRecord()->editorial_content_kind_id,
|
||||
'dimension_ids' => IdentityDimensionValue::query()
|
||||
@@ -193,6 +199,8 @@ protected function handleRecordUpdate(Model $record, array $data): Model
|
||||
app(IdentityProfile::class)->fill($record, [
|
||||
'display_title' => $data['display_title'] ?? null,
|
||||
'summary' => $data['summary'] ?? null,
|
||||
'usage_note' => $data['usage_note'] ?? null,
|
||||
'license_note' => $data['license_note'] ?? null,
|
||||
], auth()->user());
|
||||
if (array_key_exists('editorial_content_kind_id', $data)) {
|
||||
$record->editorial_content_kind_id = filled($data['editorial_content_kind_id'] ?? null)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Catalog\IdentityProfile;
|
||||
use App\Domain\Catalog\Pillar;
|
||||
use App\Domain\Catalog\PillarService;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
@@ -91,12 +92,17 @@ protected function getHeaderActions(): array
|
||||
->fillForm(fn (): array => [
|
||||
'working_title' => $this->getRecord()->working_title,
|
||||
'description' => $this->getRecord()->description,
|
||||
'usage_note' => $this->getRecord()->usage_note,
|
||||
'license_note' => $this->getRecord()->license_note,
|
||||
'pillars' => $this->getRecord()->pillars()->pluck('pillars.id')->all(),
|
||||
])
|
||||
->schema([
|
||||
TextInput::make('working_title')->label('Arbeitstitel')->required(),
|
||||
Textarea::make('description')->label('Beschreibung')->rows(4)
|
||||
->helperText('Gilt für das Medium. Speichern legt keine neue Fassung an.'),
|
||||
Textarea::make('usage_note')->label('Hinweise für den Einsatz')->rows(4),
|
||||
Textarea::make('license_note')->label('Interner Lizenzvermerk')->rows(3)
|
||||
->helperText('Nur in der Verwaltung. Nicht in der Bibliothek und nicht auf der Website.'),
|
||||
CheckboxList::make('pillars')
|
||||
->label('Fachliche Säulen')
|
||||
->options(fn (): array => Pillar::query()->orderBy('name')->pluck('name', 'id')->all()),
|
||||
@@ -106,6 +112,10 @@ protected function getHeaderActions(): array
|
||||
/** @var ContentElement $element */
|
||||
$element = $this->getRecord();
|
||||
app(ContentService::class)->describe($element, (string) $data['working_title'], $data['description'] ?? null);
|
||||
app(IdentityProfile::class)->fill($element, [
|
||||
'usage_note' => $data['usage_note'] ?? null,
|
||||
'license_note' => $data['license_note'] ?? null,
|
||||
], auth()->user());
|
||||
app(PillarService::class)->assign($element, array_map(intval(...), $data['pillars'] ?? []));
|
||||
}, 'Die Beschreibung ist gespeichert.');
|
||||
$this->getRecord()->refresh();
|
||||
|
||||
@@ -47,6 +47,7 @@ public function rows(CompositionVersion $version, int $exceptCompositionId): arr
|
||||
}
|
||||
|
||||
$row['role'] = $member->role;
|
||||
$row['note'] = trim((string) ($member->placement_note ?? ''));
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
@@ -80,6 +81,9 @@ public function rowForTarget(string $target, int $exceptCompositionId, bool $all
|
||||
'title' => $title,
|
||||
'kind' => $kind,
|
||||
'summary' => (string) ($element->summary ?: $element->description ?: ''),
|
||||
'medium_description' => (string) ($element->description ?? ''),
|
||||
'usage_note' => (string) ($element->usage_note ?? ''),
|
||||
'license_note' => (string) ($element->license_note ?? ''),
|
||||
'tone' => $this->tone((string) $element->output_class, $kind),
|
||||
'image' => $this->cardUrl('element', $element->id, $element->thumbnail_path),
|
||||
'version_label' => 'Fassung '.$version->number,
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('content_elements', function (Blueprint $table) {
|
||||
$table->text('usage_note')->nullable()->after('description');
|
||||
$table->text('license_note')->nullable()->after('usage_note');
|
||||
});
|
||||
|
||||
Schema::table('composition_members', function (Blueprint $table) {
|
||||
$table->text('placement_note')->nullable()->after('role');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('content_elements', function (Blueprint $table) {
|
||||
$table->dropColumn(['usage_note', 'license_note']);
|
||||
});
|
||||
|
||||
Schema::table('composition_members', function (Blueprint $table) {
|
||||
$table->dropColumn('placement_note');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -78,6 +78,9 @@
|
||||
<span class="luf-kind">{{ $member['kind'] }}</span>
|
||||
<strong>{{ $member['title'] }}</strong>
|
||||
<span class="luf-meta">{{ $member['role'] }} · {{ $member['version_label'] }}</span>
|
||||
@if (filled($member['note'] ?? null))
|
||||
<span class="luf-meta">{{ \Illuminate\Support\Str::limit($member['note'], 120) }}</span>
|
||||
@endif
|
||||
@if ($children = $this->childrenOf((string) $member['target']))
|
||||
<span class="luf-meta">Enthält {{ $children }}</span>
|
||||
@endif
|
||||
@@ -288,31 +291,22 @@
|
||||
<button type="button" class="luf-quiet" wire:click="$set('imageMode', 'upload')" aria-pressed="{{ $this->imageMode === 'upload' ? 'true' : 'false' }}">Hochladen</button>
|
||||
</div>
|
||||
@if ($this->imageMode === 'film')
|
||||
@php($films = $this->frameFilms())
|
||||
@if ($films === [])
|
||||
@if ($this->frameFilmChoices === [])
|
||||
<p class="luf-empty">In diesem Aufbau ist kein Film. Nimm zuerst einen Film in den Aufbau auf.</p>
|
||||
@else
|
||||
<div class="luf-scopes" role="group" aria-label="Filmfassung">
|
||||
@foreach ($films as $film)
|
||||
@foreach ($this->frameFilmChoices as $film)
|
||||
<button type="button" class="luf-quiet" wire:click="$set('frameVersionId', {{ $film['version_id'] }})" aria-pressed="{{ (int) $this->frameVersionId === $film['version_id'] ? 'true' : 'false' }}">{{ $film['title'] }}, {{ $film['label'] }}</button>
|
||||
@endforeach
|
||||
</div>
|
||||
@php($chosen = collect($films)->firstWhere('version_id', (int) $this->frameVersionId))
|
||||
@if (is_array($chosen) && filled($chosen['file_url']))
|
||||
<div x-data="{ maxSeconds: 120, second: {{ json_encode($this->frameSecond) }} }">
|
||||
<video class="luf-video" controls preload="metadata" playsinline src="{{ $chosen['file_url'] }}" @loadedmetadata="maxSeconds = Math.max(1, $event.target.duration || 120)"></video>
|
||||
<div class="luf-field">
|
||||
<label for="filmstelle">Zeitposition in Sekunden</label>
|
||||
<input id="filmstelle" type="range" min="0" :max="maxSeconds" step="0.1" x-model="second" @change="$wire.set('frameSecond', second)">
|
||||
<input type="number" min="0" max="7200" step="0.1" x-model="second" @change="$wire.set('frameSecond', second)" aria-label="Zeitposition als Zahl">
|
||||
</div>
|
||||
</div>
|
||||
<p class="luf-note">Die Vorschau zeigt die Stelle, die als Titelbild übernommen wird. Die Filmdatei selbst bleibt unverändert.</p>
|
||||
@if ($frameUrl = $this->framePreviewUrl())
|
||||
<img class="luf-frame-still" src="{{ $frameUrl }}" alt="Vorschau der gewählten Filmstelle">
|
||||
@endif
|
||||
@elseif (is_array($chosen))
|
||||
<p class="luf-empty">Für diese Filmfassung liegt noch keine abspielbare Datei vor.</p>
|
||||
<div class="luf-field" x-data="{ second: {{ json_encode($this->frameSecond) }} }">
|
||||
<label for="filmstelle">Zeitposition in Sekunden</label>
|
||||
<input id="filmstelle" type="range" min="0" max="120" step="0.5" x-model="second" @change="$wire.set('frameSecond', second)">
|
||||
<input type="number" min="0" max="7200" step="0.1" x-model="second" @change="$wire.set('frameSecond', second)" aria-label="Zeitposition als Zahl">
|
||||
</div>
|
||||
<p class="luf-note">Die Vorschau nimmt die kleine Filmstufe, sofern sie vorliegt. Die Filmdatei selbst bleibt unverändert.</p>
|
||||
@if ($frameUrl = $this->framePreviewUrl())
|
||||
<img class="luf-frame-still" src="{{ $frameUrl }}" alt="Vorschau der gewählten Filmstelle">
|
||||
@endif
|
||||
@endif
|
||||
@elseif ($this->imageMode === 'bestand')
|
||||
@@ -357,6 +351,23 @@
|
||||
<p class="luf-kicker">{{ $member['kind'] }}</p>
|
||||
<h3>{{ $member['title'] }}</h3>
|
||||
<p class="luf-meta">{{ $member['version_label'] }}</p>
|
||||
@if (filled($member['medium_description'] ?? null))
|
||||
<p class="luf-kicker">Beschreibung des Mediums</p>
|
||||
<p>{{ $member['medium_description'] }}</p>
|
||||
@endif
|
||||
@if (filled($member['usage_note'] ?? null))
|
||||
<p class="luf-kicker">Hinweise für den Einsatz</p>
|
||||
<p>{{ $member['usage_note'] }}</p>
|
||||
@endif
|
||||
@if (filled($member['license_note'] ?? null))
|
||||
<p class="luf-kicker">Interner Lizenzvermerk</p>
|
||||
<p>{{ $member['license_note'] }}</p>
|
||||
@endif
|
||||
<div class="luf-field">
|
||||
<label for="stelle">Beschreibung an dieser Stelle</label>
|
||||
<textarea id="stelle" rows="4" wire:model="noteDraft"></textarea>
|
||||
<span class="luf-meta">Gilt nur in diesem Aufbau. Das Medium selbst bleibt unverändert.</span>
|
||||
</div>
|
||||
@if ($this->feedback !== '')
|
||||
<p class="luf-feedback" role="status">{{ $this->feedback }}</p>
|
||||
@endif
|
||||
@@ -460,7 +471,7 @@
|
||||
@endif
|
||||
@if (($detail['tone'] ?? '') === 'film')
|
||||
@if (filled($detail['file_url'] ?? null))
|
||||
<video class="luf-video" controls preload="metadata" playsinline src="{{ $detail['file_url'] }}"></video>
|
||||
<video class="luf-video" controls preload="none" playsinline src="{{ $detail['file_url'] }}"></video>
|
||||
@else
|
||||
<p class="luf-note">Für diese Fassung liegt noch keine abspielbare Datei vor. Ansehen öffnet die vorhandene Vorschau.</p>
|
||||
@endif
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
@else
|
||||
<p>Noch keine Beschreibung. Beschreibung, Arbeitstitel und Säulen lassen sich ändern, ohne eine neue Fassung anzulegen.</p>
|
||||
@endif
|
||||
@if (filled($element->usage_note))
|
||||
<h3 style="font-size: 1rem; font-weight: 600;">Hinweise für den Einsatz</h3>
|
||||
<p>{{ $element->usage_note }}</p>
|
||||
@endif
|
||||
@if (filled($element->license_note))
|
||||
<h3 style="font-size: 1rem; font-weight: 600;">Interner Lizenzvermerk</h3>
|
||||
<p>{{ $element->license_note }}</p>
|
||||
@endif
|
||||
<p>{{ $pillars === [] ? 'Keiner Säule zugeordnet.' : implode(' · ', $pillars) }}</p>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -526,6 +526,32 @@ public function test_a_missing_film_frame_does_not_create_a_version(): void
|
||||
Storage::disk('media_derived')->assertMissing('inhalte/lara.mp4');
|
||||
}
|
||||
|
||||
public function test_a_placement_note_waits_for_release_and_keeps_the_old_version(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
|
||||
$version = $content->publishComposition(
|
||||
$content->createComposition('Stellenmodul', CompositionKind::Uebung),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->call('openPart', 0)
|
||||
->assertSee('Beschreibung an dieser Stelle')
|
||||
->set('noteDraft', 'Hier zuerst den Abstand ansprechen.')
|
||||
->call('savePart')
|
||||
->assertSee('Es entsteht keine neue Fassung')
|
||||
->call('publishRevision');
|
||||
|
||||
$composition = $version->composition->fresh();
|
||||
$this->assertSame(2, $composition->versions()->count());
|
||||
$this->assertNull($version->fresh()->members()->first()->placement_note);
|
||||
$released = $composition->versions()->where('number', 2)->first();
|
||||
$this->assertSame('Hier zuerst den Abstand ansprechen.', $released->members()->first()->placement_note);
|
||||
$this->assertSame(ContentVersionStatus::Bereit, $released->status);
|
||||
}
|
||||
|
||||
private function filmWithPicture(ContentService $content, string $title): ContentElementVersion
|
||||
{
|
||||
$element = $content->createElement('film', 'film', $title);
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Domain\Media\MediaRendition;
|
||||
use App\Domain\Media\ThumbnailDeriver;
|
||||
use App\Filament\Resources\Combinations\CombinationResource;
|
||||
use App\Filament\Resources\ContentElements\ContentElementResource;
|
||||
use App\Filament\Resources\ContentElements\Pages\EditContentElement;
|
||||
use App\Filament\Resources\ContentElements\Pages\ListContentElements;
|
||||
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||
@@ -250,4 +253,63 @@ public function test_a_description_does_not_create_a_version_and_an_older_versio
|
||||
->get(route('content.file', $first))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_usage_and_license_notes_stay_on_the_medium_and_in_the_list(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$element = $content->createElement('film', 'film', 'Lara im Park');
|
||||
$content->publishElementVersion($element, 'Film');
|
||||
$editor = User::factory()->redakteur()->create();
|
||||
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditContentElement::class, ['record' => $element->getKey()])
|
||||
->fillForm([
|
||||
'working_title' => 'Lara im Park',
|
||||
'description' => 'Lara spielt im Park.',
|
||||
'usage_note' => 'Vor dem Film den Abstand ansprechen.',
|
||||
'license_note' => 'Nur intern: Archivmaterial der Produktion.',
|
||||
'pillars' => [],
|
||||
])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$element->refresh();
|
||||
$this->assertSame(1, $element->versions()->count());
|
||||
$this->assertSame('Vor dem Film den Abstand ansprechen.', $element->usage_note);
|
||||
$this->assertSame('Nur intern: Archivmaterial der Produktion.', $element->license_note);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(ListContentElements::class)
|
||||
->assertSee('Vor dem Film den Abstand ansprechen.')
|
||||
->assertSee('Nur intern: Archivmaterial');
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(ViewContentElement::class, ['record' => $element->getKey()])
|
||||
->assertSee('Hinweise für den Einsatz')
|
||||
->assertSee('Interner Lizenzvermerk');
|
||||
|
||||
$this->get('/')->assertDontSee('Nur intern: Archivmaterial der Produktion.');
|
||||
}
|
||||
|
||||
public function test_a_frame_uses_the_small_film_rendition_when_it_exists(): void
|
||||
{
|
||||
Storage::fake('media_derived');
|
||||
$content = app(ContentService::class);
|
||||
$element = $content->createElement('film', 'film', 'Lara im Park');
|
||||
$version = $content->publishElementVersion($element, null, ['file' => 'inhalte/lara.mp4']);
|
||||
Storage::disk('media_derived')->put('inhalte/lara.mp4', 'original');
|
||||
Storage::disk('media_derived')->put('ableitungen/'.$version->id.'/480/index.m3u8', '#EXTM3U');
|
||||
MediaRendition::query()->create([
|
||||
'content_element_version_id' => $version->id,
|
||||
'role' => 'variant',
|
||||
'label' => '480',
|
||||
'path' => 'ableitungen/'.$version->id.'/480/index.m3u8',
|
||||
]);
|
||||
|
||||
$this->assertSame(
|
||||
'ableitungen/'.$version->id.'/480/index.m3u8',
|
||||
app(ThumbnailDeriver::class)->frameInput($version),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user