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