From 192e1c3edceba75a15ae6653d47712ea14f7bc2a Mon Sep 17 00:00:00 2001 From: kamidu Date: Tue, 31 Jan 2017 13:41:01 +0530 Subject: [PATCH 1/2] adding missing classes in hbs --- .../public/js/load-map.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js index 4a7361e27f..24f1dcec86 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js @@ -19,8 +19,11 @@ var map; function loadLeafletMap() { + console.log("hachind"); var deviceLocationID = "#device-location", locations = $(deviceLocationID).data("locations"), + location_lat = $(deviceLocationID).data("lat"), + location_long = $(deviceLocationID).data("long"), container = "device-location", zoomLevel = 13, tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", @@ -46,6 +49,19 @@ function loadLeafletMap() { $("#map-error").hide(); $("#device-location").show(); + } else if (location_long && location_lat) { + + map = L.map(container).setView([location_lat, location_long], zoomLevel); + L.tileLayer(tileSet, {attribution: attribution}).addTo(map); + + var m = L.marker([location_lat, location_long], {"opacity": opacVal}).addTo(map).bindPopup("Your device is here"); + m.on('mouseover', function (e) { + this.openPopup(); + }); + m.on('mouseout', function (e) { + this.closePopup(); + }); + } else { $("#device-location").hide(); $("#map-error").show(); From 64cb8b522327e17d1f19eea21177fbf42bf6287e Mon Sep 17 00:00:00 2001 From: Kamidu Sachith Punchihewa Date: Tue, 31 Jan 2017 14:10:29 +0530 Subject: [PATCH 2/2] Update load-map.js --- .../public/js/load-map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js index 24f1dcec86..10c4ec4533 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js @@ -19,7 +19,7 @@ var map; function loadLeafletMap() { - console.log("hachind"); + var deviceLocationID = "#device-location", locations = $(deviceLocationID).data("locations"), location_lat = $(deviceLocationID).data("lat"), @@ -72,4 +72,4 @@ $(document).ready(function () { $(".location_tab").on("click", function () { loadLeafletMap(); }); -}); \ No newline at end of file +});