diff --git a/index.php b/index.php index 334f0167..30a7e021 100644 --- a/index.php +++ b/index.php @@ -961,10 +961,23 @@ if ( ! isset($_SESSION['c_category']) && ! $hesk_settings['select_cat']) +
+ +
+

+
+
+
+
+ @@ -1032,7 +1045,7 @@ if ($modsForHesk_settings['request_location']) { echo ' '; } diff --git a/js/modsForHesk-javascript.js b/js/modsForHesk-javascript.js index dd249c46..d53a887e 100644 --- a/js/modsForHesk-javascript.js +++ b/js/modsForHesk-javascript.js @@ -106,11 +106,17 @@ function changeText(id, checkedValue, uncheckedValue, object) { } } -function requestUserLocation() { +function requestUserLocation(yourLocationText, unableToDetermineText) { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { - setLatLon(position.coords.latitude, position.coords.longitude); + var latitude = position.coords.latitude; + var longitude = position.coords.longitude; + setLatLon(latitude, longitude); + $('#console').hide(); + initializeMapForCustomer(latitude, longitude, yourLocationText); }, function(error) { + $('#map').hide(); + $('#console').text(unableToDetermineText).show(); switch(error.code) { case error.PERMISSION_DENIED: setLatLon('E-1','E-1'); @@ -149,6 +155,20 @@ function closeAndReset(lat, lon) { resetLatLon(lat, lon); } +function initializeMapForCustomer(latitude, longitude, yourLocationText) { + map = L.map('map').setView([latitude, longitude], 15); + L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { + attribution: '© OpenStreetMap contributors' + }).addTo(map); + marker = L.marker([latitude, longitude], {draggable: true}) + .addTo(map) + .bindPopup(yourLocationText); + + marker.on('dragend', function(event) { + setLatLon(event.target.getLatLng().lat, event.target.getLatLng().lng); + }); +} + function initializeMapForStaff(latitude, longitude, usersLocationText) { map = L.map('map').setView([latitude, longitude], 15); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { diff --git a/language/en/text.php b/language/en/text.php index 6573d3c4..8417dae5 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -61,6 +61,10 @@ requirements for tracking their location when the ticket was submitted."; $hesklang['save_location'] = 'Save Location'; $hesklang['close_modal_without_saving'] = 'Close without saving'; $hesklang['ticket_location_updated'] = 'Ticket location has been updated!'; +$hesklang['location_colon'] = 'Location:'; +$hesklang['your_current_location'] = 'Your location'; +$hesklang['requesting_location_ellipsis'] = 'Requesting location...'; +$hesklang['unable_to_determine_location'] = 'Unable to determine your location, or you declined to share it.'; // ADDED OR MODIFIED IN Mods for HESK 2.2.1 $hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)