10c0910bfSGreg Roach<?php 2dd6b2bfcSGreg Roach 30c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 48ce3bd73SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaAction; 58ce3bd73SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaData; 60c0910bfSGreg Roachuse Fisharebest\Webtrees\I18N; 70c0910bfSGreg Roachuse Fisharebest\Webtrees\View; 8*455a30feSGreg Roachuse Illuminate\Support\Collection; 90c0910bfSGreg Roach 10be04b569SDavid Drury/** 11be04b569SDavid Drury * @var string $data_folder 12*455a30feSGreg Roach * @var string $files 13be04b569SDavid Drury * @var string $media_folder 14*455a30feSGreg Roach * @var Collection<string> $media_folders 15*455a30feSGreg Roach * @var array<int|string,string> $media_types 16be04b569SDavid Drury * @var string $subfolders 17*455a30feSGreg Roach * @var string $title 18be04b569SDavid Drury */ 190c0910bfSGreg Roach?> 200c0910bfSGreg Roach 210c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 22dd6b2bfcSGreg Roach 23dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 24dd6b2bfcSGreg Roach 258ce3bd73SGreg Roach<form method="post" action="<?= e(route(ManageMediaAction::class)) ?>" id="admin-media-form"> 263d180ba8SGreg Roach <?= csrf_field() ?> 273d180ba8SGreg Roach 28dd6b2bfcSGreg Roach <table class="table table-bordered table-sm"> 29dd6b2bfcSGreg Roach <thead> 30dd6b2bfcSGreg Roach <tr> 31dd6b2bfcSGreg Roach <th><?= I18N::translate('Media files') ?></th> 32dd6b2bfcSGreg Roach <th><?= I18N::translate('Media folders') ?></th> 33dd6b2bfcSGreg Roach </tr> 34dd6b2bfcSGreg Roach </thead> 35dd6b2bfcSGreg Roach <tbody> 36dd6b2bfcSGreg Roach <tr> 37dd6b2bfcSGreg Roach <td> 38dd6b2bfcSGreg Roach <label> 39b6c326d8SGreg Roach <input type="radio" name="files" value="local" <?= $files === 'local' ? 'checked' : '' ?>> 40dd6b2bfcSGreg Roach <?= /* I18N: “Local files” are stored on this computer */ I18N::translate('Local files') ?> 41dd6b2bfcSGreg Roach </label> 42dd6b2bfcSGreg Roach <br> 43dd6b2bfcSGreg Roach <label> 44b6c326d8SGreg Roach <input type="radio" name="files" value="external" <?= $files === 'external' ? 'checked' : '' ?>> 45dd6b2bfcSGreg Roach <?= /* I18N: “External files” are stored on other computers */ I18N::translate('External files') ?> 46dd6b2bfcSGreg Roach </label> 47dd6b2bfcSGreg Roach <br> 48dd6b2bfcSGreg Roach <label> 49b6c326d8SGreg Roach <input type="radio" name="files" value="unused" <?= $files === 'unused' ? 'checked' : '' ?>> 50dd6b2bfcSGreg Roach <?= I18N::translate('Unused files') ?> 51dd6b2bfcSGreg Roach </label> 52dd6b2bfcSGreg Roach </td> 53dd6b2bfcSGreg Roach <td> 54dd6b2bfcSGreg Roach <?php if ($files === 'local' || $files === 'unused') : ?> 55b6c326d8SGreg Roach <div class="input-group mb-2" dir="ltr"> 56b6c326d8SGreg Roach <div class="input-group-prepend"> 57b6c326d8SGreg Roach <div class="input-group-text"><?= e($data_folder) ?></div> 58b6c326d8SGreg Roach </div> 59b6c326d8SGreg Roach <?php if ($media_folders->count() > 1) : ?> 60c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'media_folder', 'selected' => $media_folder, 'options' => $media_folders]) ?> 61b6c326d8SGreg Roach 62dd6b2bfcSGreg Roach <?php else : ?> 63be04b569SDavid Drury <input aria-label="<?= I18N::translate('Media folder') ?>" 64be04b569SDavid Drury type="text" class="form-control" name="media_folder" value="<?= e($media_folder) ?>" readonly> 65dd6b2bfcSGreg Roach <?php endif ?> 66dd6b2bfcSGreg Roach </div> 67dd6b2bfcSGreg Roach 68dd6b2bfcSGreg Roach <label> 69b6c326d8SGreg Roach <input type="radio" name="subfolders" value="include" <?= $subfolders === 'include' ? 'checked' : '' ?>> 70dd6b2bfcSGreg Roach <?= I18N::translate('Include subfolders') ?> 71dd6b2bfcSGreg Roach </label> 72dd6b2bfcSGreg Roach <br> 73dd6b2bfcSGreg Roach <label> 74b6c326d8SGreg Roach <input type="radio" name="subfolders" value="exclude" <?= $subfolders === 'exclude' ? ' checked' : '' ?>> 75dd6b2bfcSGreg Roach <?= I18N::translate('Exclude subfolders') ?> 76dd6b2bfcSGreg Roach </label> 77dd6b2bfcSGreg Roach 78dd6b2bfcSGreg Roach <?php elseif ($files === 'external') : ?> 79dd6b2bfcSGreg Roach <?= I18N::translate('External media files have a URL instead of a filename.') ?> 80dd6b2bfcSGreg Roach <input type="hidden" name="media_folder" value="<?= e($media_folder) ?>"> 81dd6b2bfcSGreg Roach 82dd6b2bfcSGreg Roach <?php endif ?> 83dd6b2bfcSGreg Roach </td> 84dd6b2bfcSGreg Roach </tr> 85dd6b2bfcSGreg Roach </tbody> 86dd6b2bfcSGreg Roach </table> 87dd6b2bfcSGreg Roach</form> 88dd6b2bfcSGreg Roach<br> 89dd6b2bfcSGreg Roach<br> 90dd6b2bfcSGreg Roach 91b4139381SGreg Roach<table 92b4139381SGreg Roach class="table table-bordered table-sm datatables d-none" 93b6c326d8SGreg Roach <?= view('lists/datatables-attributes') ?> 948ce3bd73SGreg Roach data-ajax="<?= e(route(ManageMediaData::class, ['files' => $files, 'media_folder' => $media_folder, 'subfolders' => $subfolders])) ?>" 9513aa75d8SGreg Roach data-server-side="true" 96b6c326d8SGreg Roach> 97dd6b2bfcSGreg Roach <thead> 98dd6b2bfcSGreg Roach <tr> 9913aa75d8SGreg Roach <th> 10013aa75d8SGreg Roach <?= I18N::translate('Media file') ?> 10113aa75d8SGreg Roach </th> 10213aa75d8SGreg Roach 10313aa75d8SGreg Roach <th data-sortable="false"> 10413aa75d8SGreg Roach <?= I18N::translate('Media') ?> 10513aa75d8SGreg Roach </th> 10613aa75d8SGreg Roach 10713aa75d8SGreg Roach <th data-sortable="<?= $files === 'unused' ? 'false' : 'true' ?>"> 10813aa75d8SGreg Roach <?= I18N::translate('Media object') ?> 10913aa75d8SGreg Roach </th> 110dd6b2bfcSGreg Roach </tr> 111dd6b2bfcSGreg Roach </thead> 112dd6b2bfcSGreg Roach</table> 113*455a30feSGreg Roach<?= view('modals/create-media-from-file', ['media_types' => $media_types]) ?> 114dd6b2bfcSGreg Roach 115dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 116dd6b2bfcSGreg Roach<script> 117b6c326d8SGreg Roach $("#admin-media-form input, #admin-media-form select").change(function () { 118b6c326d8SGreg Roach $("#admin-media-form").submit(); 119b6c326d8SGreg Roach }); 120dd6b2bfcSGreg Roach</script> 121dd6b2bfcSGreg Roach<?php View::endpush() ?> 122