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 <?= e($media_folder) ?> 52 <input type="hidden" name="media_folder" value="<?= e($media_folder) ?>"> 53 <?php endif ?> 54 </div> 55 </div> 56 57 <label> 58 <input type="radio" name="subfolders" value="include" <?= $subfolders === 'include' ? 'checked' : '' ?>> 59 <?= I18N::translate('Include subfolders') ?> 60 </label> 61 <br> 62 <label> 63 <input type="radio" name="subfolders" value="exclude" <?= $subfolders === 'exclude' ? ' checked' : '' ?>> 64 <?= I18N::translate('Exclude subfolders') ?> 65 </label> 66 67 <?php elseif ($files === 'external') : ?> 68 <?= I18N::translate('External media files have a URL instead of a filename.') ?> 69 <input type="hidden" name="media_folder" value="<?= e($media_folder) ?>"> 70 71 <?php endif ?> 72 </td> 73 </tr> 74 </tbody> 75 </table> 76</form> 77<br> 78<br> 79 80<table class="table table-bordered table-sm" id="media-table-<?= e($table_id) ?>" 81 <?= view('lists/datatables-attributes') ?> 82 data-ajax="<?= e(route('admin-media-data', ['files' => $files, 'media_folder' => $media_folder, 'subfolders' => $subfolders])) ?>" 83> 84 <thead> 85 <tr> 86 <th><?= I18N::translate('Media file') ?></th> 87 <th><?= I18N::translate('Media') ?></th> 88 <th><?= I18N::translate('Media object') ?></th> 89 </tr> 90 </thead> 91 <tbody> 92 </tbody> 93</table> 94<?= view('modals/create-media-from-file') ?> 95 96<?php View::push('javascript') ?> 97<script> 98 $("#admin-media-form input, #admin-media-form select").change(function () { 99 $("#admin-media-form").submit(); 100 }); 101 102 $("#media-table-<?= e($table_id) ?>").dataTable({ 103 processing: true, 104 serverSide: true, 105 autoWidth: false, 106 columns: [ 107 {}, 108 {sortable: false}, 109 {sortable: <?= $files === 'unused' ? 'false' : 'true' ?>} 110 ] 111 }); 112</script> 113<?php View::endpush() ?> 114