xref: /webtrees/resources/views/admin/media-upload.phtml (revision 99c2ebaa768bfd7df48b9fc54e9134bbe9898e94)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\UploadMediaPage;
6use Fisharebest\Webtrees\I18N;
7use Illuminate\Support\Collection;
8
9/**
10 * @var string                       $filesize
11 * @var int                          $max_upload_files
12 * @var Collection<array-key,string> $media_folders
13 * @var string                       $title
14 */
15
16?>
17
18<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageMediaPage::class) => I18N::translate('Manage media'), $title]]) ?>
19
20<h1><?= $title ?></h1>
21
22<p>
23    <?= I18N::translate('Upload one or more media files from your local computer. Media files can be pictures, video, audio, or other formats.') ?>
24    <?= I18N::translate('Maximum upload size: ') ?><?= e($filesize) ?>
25</p>
26
27<form method="post" action="<?= e(route(UploadMediaPage::class)) ?>" name="uploadmedia" enctype="multipart/form-data">
28    <?php for ($i = 1; $i <= $max_upload_files; $i++) : ?>
29        <h2><?= I18N::translate('Media file') ?> <?= I18N::number($i) ?></h2>
30
31        <div class="row mb-3">
32            <label class="form-control-label col-sm-3" for="mediafile<?= e($i) ?>">
33                <?= I18N::translate('Media file to upload') ?>
34                <span class="visually-hidden"><?= e($i) ?></span>
35            </label>
36            <div class="col-sm-9">
37                <input class="form-control" id="mediafile<?= e($i) ?>" name="mediafile<?= e($i) ?>" type="file">
38            </div>
39        </div>
40
41        <div class="row mb-3">
42            <label class="form-control-label col-sm-3" for="filename<?= e($i) ?>">
43                <?= I18N::translate('Filename on server') ?>
44                <span class="visually-hidden"><?= e($i) ?></span>
45            </label>
46            <div class="col-sm-9">
47                <input class="form-control" id="filename<?= e($i) ?>" name="filename<?= e($i) ?>" type="text">
48                <div class="form-text">
49                    <?= I18N::translate('Leave this entry blank to keep the original filename') ?>
50                </div>
51            </div>
52        </div>
53
54        <div class="row mb-3">
55            <label class="form-control-label col-sm-3" for="folder_list<?= e($i) ?>">
56                <?= I18N::translate('Folder name on server') ?>
57                <span class="visually-hidden"><?= e($i) ?></span>
58            </label>
59            <div class="col-sm-9">
60                <select class="form-select" id="folder_list<?= e($i) ?>" name="folder<?= e($i) ?>">
61                    <?php foreach ($media_folders as $media_folder) : ?>
62                        <option value="<?= e($media_folder) ?>">
63                            <?= e($media_folder) ?>
64                        </option>
65                    <?php endforeach ?>
66                </select>
67            </div>
68        </div>
69    <?php endfor ?>
70
71    <button class="btn btn-primary" type="submit">
72        <?= /* I18N: A button label. */ I18N::translate('upload') ?>
73    </button>
74
75    <?= csrf_field() ?>
76</form>
77