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