rinkplanner/hub/views/upload.php

67 lines
2.9 KiB
PHP
Raw Normal View History

<?php /** @var array $errors */ ?>
<?php /** @var array $input */ ?>
<?php /** @var array|null $routine */ ?>
<?php $isRevision = $routine !== null; ?>
<section class="auth-card wide">
<h1><?= $isRevision ? 'Neue Revision' : 'Kür hochladen' ?></h1>
<?php if ($isRevision): ?>
<p class="muted">Neue Fassung von „<?= e($routine['title']) ?>“. Die bisherige Revision bleibt erhalten.</p>
<?php else: ?>
<p class="muted">Lade die Kür-JSON und – falls die Kür Musik nutzt – die zugehörige Audiodatei hoch. Beide gehören als Paket zusammen.</p>
<?php endif; ?>
<?php if ($errors): ?>
<div class="flash flash-error">
<ul class="plain">
<?php foreach ($errors as $error): ?>
<li><?= e($error) ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<form method="post" enctype="multipart/form-data"
action="<?= e(url($isRevision ? '/routines/' . (int) $routine['id'] . '/revise' : '/upload')) ?>"
class="stack">
<?= csrf_field() ?>
<div class="grid-2">
<label>
Kür-Datei (.json)
<input type="file" name="routine" accept=".json,application/json" required>
<span class="hint">Aus Rinkplanner gespeicherte Kür, max. <?= e(human_bytes((int) config('app.max_routine_bytes', 8 * 1024 * 1024))) ?>.</span>
</label>
<label>
Musikdatei (MP3/OGG/WAV/M4A/AAC)
<input type="file" name="audio" accept=".mp3,.ogg,.wav,.m4a,.aac,audio/*">
<span class="hint">Dateiname muss exakt dem Feld „music_file“ der Kür entsprechen.</span>
</label>
</div>
<label>
Beschreibung (optional)
<textarea name="description" rows="4" maxlength="2000"><?= e($input['description']) ?></textarea>
</label>
<div class="grid-2">
<label>
Musiktitel (optional)
<input type="text" name="music_title" maxlength="190" value="<?= e_attr($input['music_title']) ?>">
</label>
<label>
Interpret (optional)
<input type="text" name="music_artist" maxlength="190" value="<?= e_attr($input['music_artist']) ?>">
</label>
</div>
<label class="check">
<input type="checkbox" name="rights" value="1" required>
Ich habe die Rechte an Kür und Musik und darf sie im geschlossenen Beta-Hub teilen.
</label>
<div class="actions">
<button class="primary" type="submit"><?= $isRevision ? 'Revision veröffentlichen' : 'Kür veröffentlichen' ?></button>
<a class="button" href="<?= e(url($isRevision ? '/routines/' . (int) $routine['id'] : '/')) ?>">Abbrechen</a>
</div>
</form>
</section>