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