This commit is contained in:
2020-11-12 22:44:25 +00:00
parent a8fc8f4cbf
commit 0084036334
3 changed files with 27 additions and 0 deletions

View File

@@ -534,6 +534,25 @@ export default {
{ maximumAge: 600000, timeout: 5000, enableHighAccuracy: true }
);
});
},
///////////////////////////////////////////////
// Open map url
//
//
viewGeoLocation: function(obj) {
if (!obj.latitude || !obj.longitude) {
throw new Error("View map: missing latitude or longitude, can't view");
}
let mapUrl =
window.$gz.store.state.userOptions.mapUrlTemplate ||
"https://www.google.com/maps/search/?api=1&query={aylatitude},{aylongitude}";
mapUrl = mapUrl.split("{aylatitude}").join(obj.latitude);
mapUrl = mapUrl.split("{aylongitude}").join(obj.longitude);
if (window.open(mapUrl, "map") == null) {
throw new Error(
"Problem displaying map in new window. Browser must allow pop-ups to view maps; check your browser setting"
);
}
}
/**

View File

@@ -902,6 +902,12 @@ async function clickHandler(menuItem) {
window.$gz.errorHandler.handleFormError(ex, m.vm);
}
break;
case "geoview":
window.$gz.util.viewGeoLocation({
latitude: m.vm.obj.latitude,
longitude: m.vm.obj.longitude
});
break;
default:
window.$gz.eventBus.$emit(

View File

@@ -365,6 +365,8 @@ export default {
l.emailAddress = vm.obj.emailAddress;
}
l.mapUrlTemplate = vm.obj.mapUrlTemplate;
window.$gz.store.commit("setUserOptions", l);
if (