1<?php use Fisharebest\Webtrees\I18N; ?> 2<?php use Fisharebest\Webtrees\View; ?> 3 4<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-trees') => I18N::translate('Manage family trees'), $title]]) ?> 5 6<h1><?= $title ?></h1> 7 8<div class="alert alert-warning"> 9 <?= /* 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->title())) ?> 10</div> 11 12<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?')) ?>');"> 13 <input type="hidden" name="ged" value="<?= $tree->name() ?>"> 14 <input type="hidden" id="gedcom_filename" value="<?= e($default_gedcom_file) ?>"> 15 <?= csrf_field() ?> 16 17 <fieldset class="form-group"> 18 <div class="row"> 19 <legend class="col-form-label col-sm-3"> 20 <?= I18N::translate('Select a GEDCOM file to import') ?> 21 </legend> 22 <div class="col-sm-9"> 23 <div class="row form-group"> 24 <label class="col-sm-3"> 25 <input type="radio" name="source" id="import-computer" value="client" checked> 26 <?= I18N::translate('A file on your computer') ?> 27 </label> 28 <div class="col-sm-9"> 29 <div class="btn btn-default"> 30 <input type="file" class="form-control-file" name="tree_name" id="import-computer-file"> 31 </div> 32 </div> 33 </div> 34 <div class="row"> 35 <label class="col-sm-3"> 36 <input type="radio" name="source" id="import-server" value="server"> 37 <?= I18N::translate('A file on the server') ?> 38 </label> 39 <div class="col-sm-9"> 40 <div class="input-group"> 41 <div class="input-group-prepend"> 42 <span class="input-group-text"> 43 <?= e($data_folder) ?> 44 </span> 45 </div> 46 <select name="tree_name" class="form-control" id="import-server-file"> 47 <option value=""></option> 48 <?php foreach ($gedcom_files as $gedcom_file) : ?> 49 <option value="<?= e($gedcom_file) ?>" <?= $gedcom_file === $default_gedcom_file ? 'selected' : '' ?>> 50 <?= e($gedcom_file) ?> 51 </option> 52 <?php endforeach ?> 53 <?php if (empty($gedcom_files)) : ?> 54 <option disabled selected> 55 <?= I18N::translate('No GEDCOM files found.') ?> 56 </option> 57 <?php endif ?> 58 </select> 59 </div> 60 </div> 61 </div> 62 </div> 63 </div> 64 </fieldset> 65 66 <hr> 67 68 <fieldset class="form-group"> 69 <div class="row"> 70 <legend class="col-form-label col-sm-3"> 71 <?= I18N::translate('Import preferences') ?> 72 </legend> 73 <div class="col-sm-9"> 74 <label> 75 <input type="checkbox" name="keep_media" value="1" <?= $tree->getPreference('keep_media') ? 'checked' : '' ?>> 76 <?= /* I18N: A configuration setting */ I18N::translate('Keep media objects') ?> 77 </label> 78 <p class="small text-muted"> 79 <?= 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.') ?> 80 </p> 81 <label> 82 <input type="checkbox" name="WORD_WRAPPED_NOTES" value="1" <?= $tree->getPreference('WORD_WRAPPED_NOTES') ? 'checked' : '' ?>> 83 <?= I18N::translate('Add spaces where long lines were wrapped') ?> 84 </label> 85 <p class="small text-muted"> 86 <?= 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.') ?> 87 </p> 88 <label for="GEDCOM_MEDIA_PATH"> 89 <?= /* 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') ?> 90 </label> 91 <input 92 class="form-control" 93 dir="ltr" 94 id="GEDCOM_MEDIA_PATH" 95 maxlength="255" 96 name="GEDCOM_MEDIA_PATH" 97 type="text" 98 value="<?= e($gedcom_media_path) ?>" 99 > 100 <p class="small text-muted"> 101 <?= /* 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.') ?> 102 <?= /* 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>') ?> 103 </p> 104 </div> 105 </div> 106 </fieldset> 107 108 <div class="row form-group"> 109 <div class="offset-sm-3 col-sm-9"> 110 <button type="submit" class="btn btn-primary"> 111 <?= /* I18N: A button label. */ I18N::translate('continue') ?> 112 </button> 113 </div> 114 </div> 115</form> 116 117<?php View::push('javascript') ?> 118<script> 119 function checkGedcomImportForm (message) { 120 var oldFile = $('#gedcom_filename').val(); 121 var method = $('input[name=source]:checked').val(); 122 var newFile = method === 'server' ? $('#import-server-file').val() : $('#import-computer-file').val(); 123 124 // Some browsers include c:\fakepath\ in the filename. 125 newFile = newFile.replace(/.*[/\\]/, ''); 126 if (newFile !== oldFile && oldFile !== '') { 127 return window.confirm(message); 128 } else { 129 return true; 130 } 131 } 132 133 document.getElementById("import-computer-file").addEventListener("click", function () { 134 document.getElementById("import-computer").checked = true; 135 }); 136 137 document.getElementById("import-server-file").addEventListener("focus", function () { 138 document.getElementById("import-server").checked = true; 139 }); 140</script> 141<?php View::endpush() ?> 142