add option to toggle clear map before loading

merge-requests/1/head
Julien Veyssier 2016-12-05 12:29:55 +01:00
parent 7f323b030c
commit 39b2eea922
2 changed files with 9 additions and 2 deletions

View File

@ -461,7 +461,9 @@ function loadFile(file){
} }
var url = OC.generateUrl('/apps/gpxedit/getgpx'); var url = OC.generateUrl('/apps/gpxedit/getgpx');
$.post(url, req).done(function (response) { $.post(url, req).done(function (response) {
if ($('#clearbeforeload').is(':checked')){
clear(); clear();
}
if (response.gpx === ''){ if (response.gpx === ''){
alert('The file does not exist or it is not a gpx'); alert('The file does not exist or it is not a gpx');
} }

View File

@ -25,7 +25,12 @@ p($_['gpxedit_version']);
<hr/> <hr/>
<h2 id="loadtitle">Load <b id="loadoptiontoggle"><i class="fa fa-expand"></i></b></h2> <h2 id="loadtitle">Load <b id="loadoptiontoggle"><i class="fa fa-expand"></i></b></h2>
<div id="loaddiv" style="display:none;"> <div id="loaddiv" style="display:none;">
<p>Select a gpx file to load it on the map</p><br/> <p>Select a gpx file to load it on the map</p>
<div>
<input type="checkbox" id="clearbeforeload"></input>
<label for="clearbeforeload">Clear map before loading</label>
</div>
<br/>
<div id="loadtree"></div> <div id="loadtree"></div>
</div> </div>
<hr/> <hr/>