1<?php 2 3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 4use Fisharebest\Webtrees\I18N; 5use Fisharebest\Webtrees\View; 6 7?> 8 9<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 10 11<h1><?= $title ?></h1> 12 13<form method="post" action="<?= e(route('admin-media-select')) ?>" id="admin-media-form"> 14 <?= csrf_field() ?> 15 16 <table class="table table-bordered table-sm"> 17 <thead> 18 <tr> 19 <th><?= I18N::translate('Media files') ?></th> 20 <th><?= I18N::translate('Media folders') ?></th> 21 </tr> 22 </thead> 23 <tbody> 24 <tr> 25 <td> 26 <label> 27 <input type="radio" name="files" value="local" <?= $files === 'local' ? 'checked' : '' ?>> 28 <?= /* I18N: “Local files” are stored on this computer */ I18N::translate('Local files') ?> 29 </label> 30 <br> 31 <label> 32 <input type="radio" name="files" value="external" <?= $files === 'external' ? 'checked' : '' ?>> 33 <?= /* I18N: “External files” are stored on other computers */ I18N::translate('External files') ?> 34 </label> 35 <br> 36 <label> 37 <input type="radio" name="files" value="unused" <?= $files === 'unused' ? 'checked' : '' ?>> 38 <?= I18N::translate('Unused files') ?> 39 </label> 40 </td> 41 <td> 42 <?php if ($files === 'local' || $files === 'unused') : ?> 43 <div class="input-group mb-2" dir="ltr"> 44 <div class="input-group-prepend"> 45 <div class="input-group-text"><?= e($data_folder) ?></div> 46 </div> 47 <?php if ($media_folders->count() > 1) : ?> 48 <?= view('components/select', ['name' => 'media_folder', 'selected' => $media_folder, 'options' => $media_folders]) ?> 49 50 <?php else : ?> 51 <input type="text" class="form-control" name="media_folder" value="<?= e($media_folder) ?>" readonly> 52 <?php endif ?> 53 </div> 54 </div> 55 56 <label> 57 <input type="radio" name="subfolders" value="include" <?= $subfolders === 'include' ? 'checked' : '' ?>> 58 <?= I18N::translate('Include subfolders') ?> 59 </label> 60 <br> 61 <label> 62 <input type="radio" name="subfolders" value="exclude" <?= $subfolders === 'exclude' ? ' checked' : '' ?>> 63 <?= I18N::translate('Exclude subfolders') ?> 64 </label> 65 66 <?php elseif ($files === 'external') : ?> 67 <?= I18N::translate('External media files have a URL instead of a filename.') ?> 68 <input type="hidden" name="media_folder" value="<?= e($media_folder) ?>"> 69 70 <?php endif ?> 71 </td> 72 </tr> 73 </tbody> 74 </table> 75</form> 76<br> 77<br> 78 79<table class="table table-bordered table-sm" id="media-table-<?= e($table_id) ?>" 80 <?= view('lists/datatables-attributes') ?> 81 data-ajax="<?= e(route('admin-media-data', ['files' => $files, 'media_folder' => $media_folder, 'subfolders' => $subfolders])) ?>" 82> 83 <thead> 84 <tr> 85 <th><?= I18N::translate('Media file') ?></th> 86 <th><?= I18N::translate('Media') ?></th> 87 <th><?= I18N::translate('Media object') ?></th> 88 </tr> 89 </thead> 90 <tbody> 91 </tbody> 92</table> 93<?= view('modals/create-media-from-file') ?> 94 95<?php View::push('javascript') ?> 96<script> 97 $("#admin-media-form input, #admin-media-form select").change(function () { 98 $("#admin-media-form").submit(); 99 }); 100 101 $("#media-table-<?= e($table_id) ?>").dataTable({ 102 processing: true, 103 serverSide: true, 104 autoWidth: false, 105 columns: [ 106 {}, 107 {sortable: false}, 108 {sortable: <?= $files === 'unused' ? 'false' : 'true' ?>} 109 ] 110 }); 111</script> 112<?php View::endpush() ?> 113