1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?> 2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?> 3dd6b2bfcSGreg Roach 4dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-trees') => I18N::translate('Manage family trees'), $title]]) ?> 5dd6b2bfcSGreg Roach 6dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 7dd6b2bfcSGreg Roach 8dd6b2bfcSGreg Roach<div class="alert alert-warning"> 9dd6b2bfcSGreg Roach <?= /* I18N: %s is the name of a family tree */ I18N::translate('This will delete all the genealogy data from “%s” and replace it with data from a GEDCOM file.', e($tree->getTitle())) ?> 10dd6b2bfcSGreg Roach</div> 11dd6b2bfcSGreg Roach 12dd6b2bfcSGreg Roach<form class="form form-horizontal" method="post" enctype="multipart/form-data" onsubmit="return checkGedcomImportForm('<?= e(I18N::translate('You have selected a GEDCOM file with a different name. Is this correct?')) ?>');"> 13dd6b2bfcSGreg Roach <input type="hidden" name="ged" value="<?= $tree->getName() ?>"> 14dd6b2bfcSGreg Roach <input type="hidden" id="gedcom_filename" value="<?= e($default_gedcom_file) ?>"> 15dd6b2bfcSGreg Roach <?= csrf_field() ?> 16dd6b2bfcSGreg Roach 17dd6b2bfcSGreg Roach <fieldset class="form-group"> 18dd6b2bfcSGreg Roach <div class="row"> 19dd6b2bfcSGreg Roach <legend class="col-form-label col-sm-3"> 20dd6b2bfcSGreg Roach <?= I18N::translate('Select a GEDCOM file to import') ?> 21dd6b2bfcSGreg Roach </legend> 22dd6b2bfcSGreg Roach <div class="col-sm-9"> 23dd6b2bfcSGreg Roach <div class="row form-group"> 24dd6b2bfcSGreg Roach <label class="col-sm-3"> 25dd6b2bfcSGreg Roach <input type="radio" name="source" id="import-computer" value="client" checked> 26dd6b2bfcSGreg Roach <?= I18N::translate('A file on your computer') ?> 27dd6b2bfcSGreg Roach </label> 28dd6b2bfcSGreg Roach <div class="col-sm-9"> 29dd6b2bfcSGreg Roach <div class="btn btn-default"> 30dd6b2bfcSGreg Roach <input type="file" class="form-control-file" name="tree_name" id="import-computer-file"> 31dd6b2bfcSGreg Roach </div> 32dd6b2bfcSGreg Roach </div> 33dd6b2bfcSGreg Roach </div> 34dd6b2bfcSGreg Roach <div class="row"> 35dd6b2bfcSGreg Roach <label class="col-sm-3"> 36dd6b2bfcSGreg Roach <input type="radio" name="source" id="import-server" value="server"> 37dd6b2bfcSGreg Roach <?= I18N::translate('A file on the server') ?> 38dd6b2bfcSGreg Roach </label> 39dd6b2bfcSGreg Roach <div class="col-sm-9"> 40dd6b2bfcSGreg Roach <div class="input-group"> 41dd6b2bfcSGreg Roach <div class="input-group-prepend"> 42dd6b2bfcSGreg Roach <span class="input-group-text"> 43dd6b2bfcSGreg Roach <?= WT_DATA_DIR ?> 44dd6b2bfcSGreg Roach </span> 45dd6b2bfcSGreg Roach </div> 46dd6b2bfcSGreg Roach <select name="tree_name" class="form-control" id="import-server-file"> 47dd6b2bfcSGreg Roach <option value=""></option> 48dd6b2bfcSGreg Roach <?php foreach ($gedcom_files as $gedcom_file) : ?> 49dd6b2bfcSGreg Roach <option value="<?= e($gedcom_file) ?>" <?= $gedcom_file === $default_gedcom_file ? 'selected' : '' ?>> 50dd6b2bfcSGreg Roach <?= e($gedcom_file) ?> 51dd6b2bfcSGreg Roach </option> 52dd6b2bfcSGreg Roach <?php endforeach ?> 53dd6b2bfcSGreg Roach <?php if (empty($gedcom_files)) : ?> 54dd6b2bfcSGreg Roach <option disabled selected> 55dd6b2bfcSGreg Roach <?= I18N::translate('No GEDCOM files found.') ?> 56dd6b2bfcSGreg Roach </option> 57dd6b2bfcSGreg Roach <?php endif ?> 58dd6b2bfcSGreg Roach </select> 59dd6b2bfcSGreg Roach </div> 60dd6b2bfcSGreg Roach </div> 61dd6b2bfcSGreg Roach </div> 62dd6b2bfcSGreg Roach </div> 63dd6b2bfcSGreg Roach </div> 64dd6b2bfcSGreg Roach </fieldset> 65dd6b2bfcSGreg Roach 66dd6b2bfcSGreg Roach <hr> 67dd6b2bfcSGreg Roach 68dd6b2bfcSGreg Roach <fieldset class="form-group"> 69dd6b2bfcSGreg Roach <div class="row"> 70dd6b2bfcSGreg Roach <legend class="col-form-label col-sm-3"> 71dd6b2bfcSGreg Roach <?= I18N::translate('Import preferences') ?> 72dd6b2bfcSGreg Roach </legend> 73dd6b2bfcSGreg Roach <div class="col-sm-9"> 74dd6b2bfcSGreg Roach <label> 75dd6b2bfcSGreg Roach <input type="checkbox" name="keep_media" value="1" <?= $tree->getPreference('keep_media') ? 'checked' : '' ?>> 76dd6b2bfcSGreg Roach <?= /* I18N: A configuration setting */ I18N::translate('Keep media objects') ?> 77dd6b2bfcSGreg Roach </label> 78dd6b2bfcSGreg Roach <p class="small text-muted"> 79dd6b2bfcSGreg Roach <?= I18N::translate('If you have created media objects in webtrees, and have subsequently edited this GEDCOM file using genealogy software that deletes media objects, then select this option to merge the current media objects with the new GEDCOM file.') ?> 80dd6b2bfcSGreg Roach </p> 81dd6b2bfcSGreg Roach <label> 82dd6b2bfcSGreg Roach <input type="checkbox" name="WORD_WRAPPED_NOTES" value="1" <?= $tree->getPreference('WORD_WRAPPED_NOTES') ? 'checked' : '' ?>> 83dd6b2bfcSGreg Roach <?= I18N::translate('Add spaces where long lines were wrapped') ?> 84dd6b2bfcSGreg Roach </label> 85dd6b2bfcSGreg Roach <p class="small text-muted"> 86dd6b2bfcSGreg Roach <?= I18N::translate('If you created this GEDCOM file using genealogy software that omits spaces when splitting long lines, then select this option to reinsert the missing spaces.') ?> 87dd6b2bfcSGreg Roach </p> 88dd6b2bfcSGreg Roach <label for="GEDCOM_MEDIA_PATH"> 89dd6b2bfcSGreg Roach <?= /* I18N: A media path (e.g. c:\aaa\bbb\ccc\ddd.jpeg) in a GEDCOM file */ I18N::translate('Remove the GEDCOM media path from filenames') ?> 90dd6b2bfcSGreg Roach </label> 91dd6b2bfcSGreg Roach <input 92dd6b2bfcSGreg Roach class="form-control" 93dd6b2bfcSGreg Roach dir="ltr" 94dd6b2bfcSGreg Roach id="GEDCOM_MEDIA_PATH" 95dd6b2bfcSGreg Roach maxlength="255" 96dd6b2bfcSGreg Roach name="GEDCOM_MEDIA_PATH" 97dd6b2bfcSGreg Roach type="text" 98dd6b2bfcSGreg Roach value="<?= e($gedcom_media_path) ?>" 99dd6b2bfcSGreg Roach > 100dd6b2bfcSGreg Roach <p class="small text-muted"> 101dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “GEDCOM media path” configuration setting. A “path” is something like “C:\Documents\Genealogy\Photos\John_Smith.jpeg” */ I18N::translate('Some genealogy software creates GEDCOM files that contain media filenames with full paths. These paths will not exist on the web-server. To allow webtrees to find the file, the first part of the path must be removed.') ?> 102dd6b2bfcSGreg Roach <?= /* I18N: Help text for the “GEDCOM media path” configuration setting. %s are all folder names */ I18N::translate('For example, if the GEDCOM file contains %1$s and webtrees expects to find %2$s in the media folder, then you would need to remove %3$s.', '<code>C:\\Documents\\family\\photo.jpeg</code>', '<code>family\\photo.jpeg</code>', '<code>C:\\Documents\\</code>') ?> 103dd6b2bfcSGreg Roach </p> 104dd6b2bfcSGreg Roach </div> 105dd6b2bfcSGreg Roach </div> 106dd6b2bfcSGreg Roach </fieldset> 107dd6b2bfcSGreg Roach 108dd6b2bfcSGreg Roach <div class="row form-group"> 109dd6b2bfcSGreg Roach <div class="offset-sm-3 col-sm-9"> 110dd6b2bfcSGreg Roach <button type="submit" class="btn btn-primary"> 111dd6b2bfcSGreg Roach <?= /* I18N: A button label. */ I18N::translate('continue') ?> 112dd6b2bfcSGreg Roach </button> 113dd6b2bfcSGreg Roach </div> 114dd6b2bfcSGreg Roach </div> 115dd6b2bfcSGreg Roach</form> 116dd6b2bfcSGreg Roach 117dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 118dd6b2bfcSGreg Roach<script> 119dd6b2bfcSGreg Roach function checkGedcomImportForm (message) { 120dd6b2bfcSGreg Roach var oldFile = $('#gedcom_filename').val(); 121*708b06c1SGreg Roach var method = $('input[name=source]:checked').val(); 122*708b06c1SGreg Roach var newFile = method === 'server' ? $('#import-server-file').val() : $('#import-computer-file').val(); 123dd6b2bfcSGreg Roach 124dd6b2bfcSGreg Roach // Some browsers include c:\fakepath\ in the filename. 125dd6b2bfcSGreg Roach newFile = newFile.replace(/.*[/\\]/, ''); 126dd6b2bfcSGreg Roach if (newFile !== oldFile && oldFile !== '') { 127dd6b2bfcSGreg Roach return window.confirm(message); 128dd6b2bfcSGreg Roach } else { 129dd6b2bfcSGreg Roach return true; 130dd6b2bfcSGreg Roach } 131dd6b2bfcSGreg Roach } 132dd6b2bfcSGreg Roach 133dd6b2bfcSGreg Roach document.getElementById("import-computer-file").addEventListener("click", function () { 134dd6b2bfcSGreg Roach document.getElementById("import-computer").checked = true; 135dd6b2bfcSGreg Roach }); 136dd6b2bfcSGreg Roach 137dd6b2bfcSGreg Roach document.getElementById("import-server-file").addEventListener("focus", function () { 138dd6b2bfcSGreg Roach document.getElementById("import-server").checked = true; 139dd6b2bfcSGreg Roach }); 140dd6b2bfcSGreg Roach</script> 141dd6b2bfcSGreg Roach<?php View::endpush() ?> 142