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