1d70512abSGreg Roach<?php 2d70512abSGreg Roach 3d70512abSGreg Roachuse Fisharebest\Webtrees\GedcomTag; 4d70512abSGreg Roach 5d70512abSGreg Roach?> 6dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?> 7dd6b2bfcSGreg Roach 8dd6b2bfcSGreg Roach<div class="form-group row <?= $media_file ? 'd-none' : '' ?>"> 9dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="file-location"> 10dd6b2bfcSGreg Roach <?= I18N::translate('Media file') ?> 11dd6b2bfcSGreg Roach </label> 12dd6b2bfcSGreg Roach <div class="col-sm-10"> 13dd6b2bfcSGreg Roach <select class="form-control" id="file-location" name="file_location"> 14dd6b2bfcSGreg Roach <option value="upload"> 15dd6b2bfcSGreg Roach <?= I18N::translate('A file on your computer') ?> 16dd6b2bfcSGreg Roach </option> 17dd6b2bfcSGreg Roach <?php if (!empty($unused_files)) : ?> 18dd6b2bfcSGreg Roach <option value="unused"> 19dd6b2bfcSGreg Roach <?= I18N::translate('A file on the server') ?> 20dd6b2bfcSGreg Roach </option> 21dd6b2bfcSGreg Roach <?php endif ?> 22dd6b2bfcSGreg Roach <option value="url"> 23dd6b2bfcSGreg Roach <?= /* I18N: URL = web address */ I18N::translate('A URL') ?> 24dd6b2bfcSGreg Roach </option> 25dd6b2bfcSGreg Roach </select> 26dd6b2bfcSGreg Roach </div> 27dd6b2bfcSGreg Roach</div> 28dd6b2bfcSGreg Roach 29dd6b2bfcSGreg Roach<div class="form-group row file-location file-location-upload <?= $media_file ? 'd-none' : '' ?>"> 30dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="file"> 31dd6b2bfcSGreg Roach <?= I18N::translate('A file on your computer') ?> 32dd6b2bfcSGreg Roach </label> 33dd6b2bfcSGreg Roach <div class="col-sm-10"> 34dd6b2bfcSGreg Roach <input class="form-control" id="file" name="file" type="file"> 35dd6b2bfcSGreg Roach <small class="text-muted"> 36dd6b2bfcSGreg Roach <?= I18N::translate('Maximum upload size: ') ?> 37dd6b2bfcSGreg Roach <?= $max_upload_size ?> 38dd6b2bfcSGreg Roach </small> 39dd6b2bfcSGreg Roach </div> 40dd6b2bfcSGreg Roach</div> 41dd6b2bfcSGreg Roach 42dd6b2bfcSGreg Roach<div class="form-group row file-location file-location-upload <?= $media_file && $media_file->isExternal() ? 'd-none' : '' ?>"> 43dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="folder"> 44dd6b2bfcSGreg Roach <?= I18N::translate('Filename on server') ?> 45dd6b2bfcSGreg Roach </label> 46dd6b2bfcSGreg Roach <div class="col-sm-10"> 47dd6b2bfcSGreg Roach <div class="row"> 48dd6b2bfcSGreg Roach <div class="col-sm-6"> 49dd6b2bfcSGreg Roach <div class="form-check"> 50dd6b2bfcSGreg Roach <label class="form-check-label"> 51dd6b2bfcSGreg Roach <input class="form-check-input" type="radio" name="auto" value="0" checked> 52*c8fdf3b0SGreg Roach <input class="form-control" id="folder" name="folder" placeholder="<?= I18N::translate('Folder') ?>" type="text" value="<?= e(dirname($media_file ? $media_file->filename() : '') === '.' ? '' : dirname($media_file ? $media_file->filename() : '')) ?>" data-autocomplete-url="<?= e(route('autocomplete-folder', ['tree' => $tree->name(), 'query' => 'QUERY'])) ?>" autocomplete="off"> 53dd6b2bfcSGreg Roach <div class="input-group"> 54dd6b2bfcSGreg Roach <div class="input-group-append"> 55dd6b2bfcSGreg Roach <span class="input-group-text">/</span> 56dd6b2bfcSGreg Roach </div> 57dd6b2bfcSGreg Roach </div> 58dd6b2bfcSGreg Roach </label> 59dd6b2bfcSGreg Roach </div> 60dd6b2bfcSGreg Roach </div> 61dd6b2bfcSGreg Roach <div class="col-sm-6"> 6242f5d4a5SGreg Roach <input class="form-control" name="new_file" type="text" placeholder="<?= I18N::translate('Same as uploaded file') ?>" value="<?= e(basename($media_file ? $media_file->filename() : '')) ?>"> 63dd6b2bfcSGreg Roach </div> 64dd6b2bfcSGreg Roach </div> 65dd6b2bfcSGreg Roach <p class="small text-muted"> 66dd6b2bfcSGreg Roach <?= I18N::translate('If you have a large number of media files, you can organize them into folders and subfolders.') ?> 67dd6b2bfcSGreg Roach </p> 68dd6b2bfcSGreg Roach <div class="form-check"> 69dd6b2bfcSGreg Roach <label class="form-check-label"> 70dd6b2bfcSGreg Roach <input class="form-check-input" type="radio" name="auto" value="1"> 71dd6b2bfcSGreg Roach <?= I18N::translate('Create a unique filename') ?> 72dd6b2bfcSGreg Roach </label> 73dd6b2bfcSGreg Roach </div> 74dd6b2bfcSGreg Roach </div> 75dd6b2bfcSGreg Roach</div> 76dd6b2bfcSGreg Roach 77dd6b2bfcSGreg Roach<div class="form-group row file-location file-location-unused d-none"> 78dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="unused"> 79dd6b2bfcSGreg Roach <?= I18N::translate('A file on the server') ?> 80dd6b2bfcSGreg Roach </label> 81dd6b2bfcSGreg Roach <div class="col-sm-10"> 82c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'unused', 'selected' => '', 'options' => $unused_files]) ?> 83dd6b2bfcSGreg Roach <small class="text-muted"> 84dd6b2bfcSGreg Roach </small> 85dd6b2bfcSGreg Roach </div> 86dd6b2bfcSGreg Roach</div> 87dd6b2bfcSGreg Roach 88dd6b2bfcSGreg Roach<div class="form-group row file-location file-location-url <?= $media_file && $media_file->isExternal() ? '' : 'd-none' ?>"> 89dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="remote"> 90dd6b2bfcSGreg Roach <?= I18N::translate('URL') ?> 91dd6b2bfcSGreg Roach </label> 92dd6b2bfcSGreg Roach <div class="col-sm-10"> 93dd6b2bfcSGreg Roach <input class="form-control" type="url" id="remote" name="remote" placeholder="https://www.example.com/photo.jpeg" value="<?= e($media_file && $media_file->isExternal() ? $media_file->filename() : '') ?>"> 94dd6b2bfcSGreg Roach <small class="text-muted"> 956a83cfe8SGreg Roach <?= view('icons/warning') ?> 966a83cfe8SGreg Roach <span class="sr-only"><?= I18N::translate('Caution!') ?></span> 976a83cfe8SGreg Roach 98dd6b2bfcSGreg Roach <?= I18N::translate('The GEDCOM standard does not allow URLs in media objects.') ?> 99dd6b2bfcSGreg Roach <?= I18N::translate('Other genealogy applications might not recognize this data.') ?> 100dd6b2bfcSGreg Roach </small> 101dd6b2bfcSGreg Roach </div> 102dd6b2bfcSGreg Roach</div> 103dd6b2bfcSGreg Roach 104dd6b2bfcSGreg Roach<div class="form-group row"> 105dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="title"> 106dd6b2bfcSGreg Roach <?= I18N::translate('Title') ?> 107dd6b2bfcSGreg Roach </label> 108dd6b2bfcSGreg Roach <div class="col-sm-10"> 109dd6b2bfcSGreg Roach <input class="form-control" id="title" name="title" type="text" value="<?= e($media_file ? $media_file->title() : '') ?>"> 110dd6b2bfcSGreg Roach </div> 111dd6b2bfcSGreg Roach</div> 112dd6b2bfcSGreg Roach 113dd6b2bfcSGreg Roach<div class="form-group row"> 114dd6b2bfcSGreg Roach <label class="col-form-label col-sm-2" for="type"> 115dd6b2bfcSGreg Roach <?= I18N::translate('Media type') ?> 116dd6b2bfcSGreg Roach </label> 117dd6b2bfcSGreg Roach <div class="col-sm-10"> 118c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'type', 'selected' => $media_file ? $media_file->type() : '', 'options' => ['' => ''] + GedcomTag::getFileFormTypes()]) ?> 119dd6b2bfcSGreg Roach </div> 120dd6b2bfcSGreg Roach</div> 121dd6b2bfcSGreg Roach 122dd6b2bfcSGreg Roach<script> 123dd6b2bfcSGreg Roach autocomplete('#folder'); 124dd6b2bfcSGreg Roach document.getElementById('file-location').addEventListener('change', function () { 125dd6b2bfcSGreg Roach $('.file-location').addClass('d-none'); 126dd6b2bfcSGreg Roach $('.file-location-' + $(this).val()).removeClass('d-none'); 127dd6b2bfcSGreg Roach }); 128dd6b2bfcSGreg Roach</script> 129