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