error dialog if try to load anything else than gpx,kml,csv,jpg

merge-requests/1/head
Julien Veyssier 2016-12-15 04:07:29 +01:00
parent 6c81585e33
commit 07540659c9
1 changed files with 12 additions and 0 deletions

View File

@ -171,6 +171,10 @@ var defaultStyle = {
weight: 7
};
function endsWith(str, suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
function load_map() {
var layer = getUrlParameter('layer');
console.log('layer '+layer);
@ -821,6 +825,14 @@ function hideSaveSuccessAnimation(){
}
function loadAction(file){
if (!endsWith(file, '.gpx') ||
!endsWith(file, '.kml') ||
!endsWith(file, '.jpg') ||
!endsWith(file, '.csv')){
OC.dialogs.alert(t('gpxedit', 'This file cannot be loaded'),t('gpxedit', 'Load error'));
return;
}
loadFile(file);
// set save name
var spl = file.split('/');