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