1<?php use Fisharebest\Webtrees\Bootstrap4; ?> 2<?php use Fisharebest\Webtrees\I18N; ?> 3<?php use Fisharebest\Webtrees\View; ?> 4 5<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('map-data') => I18N::translate('Geographic data'), $title]]) ?> 6 7<h3><?= $title ?></h3> 8 9<form id="upload_form" method="post" enctype="multipart/form-data"> 10 <?= csrf_field() ?> 11 12 <!-- Server file --> 13 <div class="row form-group"> 14 <label class="col-form-label col-sm-4" for="serverfile"> 15 <?= I18N::translate('A file on the server') ?> 16 </label> 17 <div class="col-sm-8"> 18 <div class="input-group" dir="ltr"> 19 <div class="input-group-prepend"> 20 <span class="input-group-text"> 21 <?= e($data_folder) ?>places/ 22 </span> 23 </div> 24 <select id="serverfile" name="serverfile" class="form-control"> 25 <option selected value=""></option> 26 <?php foreach ($files as $file) : ?> 27 <option value="<?= e($file) ?>"> 28 <?= e($file) ?> 29 </option> 30 <?php endforeach ?> 31 </select> 32 </div> 33 </div> 34 </div> 35 36 <!-- local file --> 37 <div class="row form-group"> 38 <label class="col-form-label col-sm-4" for="localfile"> 39 <?= I18N::translate('A file on your computer') ?> 40 </label> 41 <div class="col-sm-8"> 42 <input id="localfile" type="file" name="localfile" class="form-control-file"> 43 </div> 44 </div> 45 46 <!-- CLEAR DATABASE --> 47 <fieldset class="form-group"> 48 <div class="row"> 49 <legend class="col-form-label col-sm-4"> 50 <?= I18N::translate('Delete all existing geographic data before importing the file.') ?> 51 </legend> 52 <div class="col-sm-8"> 53 <?= Bootstrap4::radioButtons( 54 'cleardatabase', 55 [I18N::translate('no'), I18N::translate('yes')], 56 '0', 57 true 58 ) ?> 59 </div> 60 </div> 61 </fieldset> 62 63 <!-- Import options --> 64 <fieldset class="form-group"> 65 <div class="row"> 66 <legend class="col-form-label col-sm-4" for="import-options"> 67 <?= I18N::translate('Import Options.') ?> 68 </legend> 69 <div class="col-sm-8"> 70 <?= Bootstrap4::select( 71 [ 72 'addupdate' => I18N::translate('Add new, and update existing records'), 73 'add' => I18N::translate('Only add new records'), 74 'update' => I18N::translate('Only update existing records'), 75 ], 76 '0', 77 ['id' => 'import-options', 'name' => 'import-options'] 78 ) ?> 79 </div> 80 </div> 81 </fieldset> 82 83 <!-- SAVE BUTTON --> 84 <div class="row form-group"> 85 <div class="offset-sm-4 col-sm-8"> 86 <button type="submit" class="btn btn-primary"> 87 <?= view('icons/save') ?> 88 <?= I18N::translate('continue') ?> 89 </button> 90 </div> 91 </div> 92</form> 93 94<?php View::push('javascript') ?> 95 <script> 96 $('#upload_form').on('submit', function(e) { 97 let self = this; 98 e.preventDefault(); 99 if($('input[name="cleardatabase"]:checked').val() === '1') { 100 if (!confirm('<?= I18N::translate('Really delete all geographic data?') ?> ')) { 101 return false; 102 } 103 } 104 self.submit(); 105 }); 106 </script> 107<?php View::endpush() ?> 108