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