diff --git a/src/main/webapp/m/js/i18n/Messages.js b/src/main/webapp/m/js/i18n/Messages.js index 045c4b42..dc75c080 100644 --- a/src/main/webapp/m/js/i18n/Messages.js +++ b/src/main/webapp/m/js/i18n/Messages.js @@ -27,7 +27,11 @@ var i18n = { address: 'Address', follow: 'Follow', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, bg: { _name_: 'Български', @@ -57,7 +61,11 @@ var i18n = { address: 'Адрес', follow: 'Следвай', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, de: { _name_: 'German', @@ -87,7 +95,11 @@ var i18n = { address: 'Adresse', follow: 'Folgen', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, es: { _name_: 'Spanish', @@ -117,7 +129,11 @@ var i18n = { address: 'Dirección', follow: 'Seguir', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, hu: { _name_: 'Hungarian', @@ -147,7 +163,11 @@ var i18n = { address: 'Cím', follow: 'Követés', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, it: { _name_: 'Italian', @@ -177,7 +197,11 @@ var i18n = { address: 'Indirizzo', follow: 'Segui', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, lt: { _name_: 'Latvian', @@ -207,7 +231,11 @@ var i18n = { address: 'Adresas', follow: 'Centruoti', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, nl: { _name_: 'Danish', @@ -237,7 +265,11 @@ var i18n = { address: 'Adres', follow: 'Volgen', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, pl: { _name_: 'Polish', @@ -267,7 +299,11 @@ var i18n = { address: 'Adres', follow: 'Obserwuj', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, pt_PT: { _name_: 'Portuguese', @@ -297,7 +333,11 @@ var i18n = { address: 'Morada', follow: 'Seguir', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, ru: { _name_: 'Russian', @@ -327,7 +367,11 @@ var i18n = { address: 'Адрес', follow: 'Отслеживать', stop_following: 'Прекратить отслеживание', - geo_fence: 'Геозона' + geo_fence: 'Геозона', + send_location_by_email: 'Отправить по эл. почте', + send_location_url_by_email: 'Отправить ссылку по эл. почте', + send_location_by_sms: 'Отправить по SMS', + send_location_url_by_sms: 'Отправить ссылку по SMS' }, tl: { _name_: 'Tagalog', @@ -357,7 +401,11 @@ var i18n = { address: 'Address', follow: 'Sundin', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' }, sv_SE: { _name_: 'Svenska', @@ -387,6 +435,10 @@ var i18n = { address: 'Adress', follow: 'F\u00f6lj', stop_following: 'Stop following', - geo_fence: 'Geo-fence' + geo_fence: 'Geo-fence', + send_location_by_email: 'Send location by Email', + send_location_url_by_email: 'Send location URL by Email', + send_location_by_sms: 'Send location by SMS', + send_location_url_by_sms: 'Send location URL by SMS' } }; diff --git a/src/main/webapp/m/js/traccar-mobile.js b/src/main/webapp/m/js/traccar-mobile.js index d5cae29a..535e9649 100644 --- a/src/main/webapp/m/js/traccar-mobile.js +++ b/src/main/webapp/m/js/traccar-mobile.js @@ -497,56 +497,57 @@ function drawDeviceDetails(deviceId, position) { drawDeviceDetails(deviceId, position); }); - // register 'send by email' function - $$('#device-' + deviceId + '-send-email').on('click', function () { - var target = this; - var drawSubject = function() { - for (var i = 0; i < appState.devices.length; i++) { - if (appState.devices[i].id == deviceId) { - return appState.devices[i].name; - } - } - return ""; - }; - var drawCoordinatesText = function() { - var p = appState.latestPositions[deviceId]; - var text = - i18n.time + ': ' + formatDate(p.time) + '\n' + - i18n.latitude + ': ' + formatDouble(p.latitude, 4) + '\n' + - i18n.longitude + ': ' + formatDouble(p.longitude, 4) + '\n' + - i18n.speed + ': ' + formatSpeed(p.speed) + '\n' + - i18n.course + ': ' + formatDouble(p.course, 2) + '\n'; - if (p.address != undefined && p.address != null) { - text += i18n.address + ': ' + p.address + '\n'; + var drawSubject = function() { + for (var i = 0; i < appState.devices.length; i++) { + if (appState.devices[i].id == deviceId) { + return appState.devices[i].name; } - var other = parseOther(p); - if (other != undefined && other != null) { - for (var k in other) { - text += k + ': ' + other[k] + '\n'; - } + } + return ""; + }; + var drawCoordinatesText = function() { + var p = appState.latestPositions[deviceId]; + var text = + i18n.time + ': ' + formatDate(p.time) + '\n' + + i18n.latitude + ': ' + formatDouble(p.latitude, 4) + '\n' + + i18n.longitude + ': ' + formatDouble(p.longitude, 4) + '\n' + + i18n.speed + ': ' + formatSpeed(p.speed) + '\n' + + i18n.course + ': ' + formatDouble(p.course, 2) + '\n'; + if (p.address != undefined && p.address != null) { + text += i18n.address + ': ' + p.address + '\n'; + } + var other = parseOther(p); + if (other != undefined && other != null) { + for (var k in other) { + text += k + ': ' + other[k] + '\n'; } - if (p.geoFences != undefined && p.geoFences != null) { - for (var i = 0; i < p.geoFences.length; i++) { - text += i18n.geo_fence + ': ' + p.geoFences[i].name + '\n'; - } + } + if (p.geoFences != undefined && p.geoFences != null) { + for (var i = 0; i < p.geoFences.length; i++) { + text += i18n.geo_fence + ': ' + p.geoFences[i].name + '\n'; } - return text; - }; - var drawURL = function() { - var p = appState.latestPositions[deviceId]; - return 'http://www.openstreetmap.org/?mlat=' + p.latitude + '&mlon=' + p.longitude; - }; + } + return text; + }; + var drawURL = function() { + var p = appState.latestPositions[deviceId]; + return 'http://www.openstreetmap.org/?mlat=' + p.latitude + '&mlon=' + p.longitude; + }; + + // register 'send by email' function + $$('#device-' + deviceId + '-send-email').on('click', function () { + var target = this; var buttons = [ { - text: 'Send coordinates', + text: i18n.send_location_by_email, onClick: function () { - window.open('mailto:?subject=' + encodeURIComponent(drawSubject()) + '&body=' + encodeURIComponent(drawCoordinatesText()), '_blank'); + window.location = 'mailto:?subject=' + encodeURIComponent(drawSubject()) + '&body=' + encodeURIComponent(drawCoordinatesText()); } }, { - text: 'Send location URL', + text: i18n.send_location_url_by_email, onClick: function () { - window.open('mailto:?subject=' + encodeURIComponent(drawSubject()) + '&body=' + encodeURIComponent(drawURL()), '_blank'); + window.location = 'mailto:?subject=' + encodeURIComponent(drawSubject()) + '&body=' + encodeURIComponent(drawURL()); } } ]; @@ -558,20 +559,25 @@ function drawDeviceDetails(deviceId, position) { var target = this; var buttons = [ { - text: 'Send coordinates', + text: i18n.send_location_by_sms, onClick: function () { - myApp.alert('Button1 clicked'); + window.location = 'sms:?body=' + encodeURIComponent(drawCoordinatesText()); } }, { - text: 'Send location URL', + text: i18n.send_location_url_by_sms, onClick: function () { - myApp.alert('Button2 clicked'); + window.location = 'sms:?body=' + encodeURIComponent(drawURL()); } } ]; myApp.actions(target, buttons); }); + + // hide 'send by sms' on ios devices since 'body' is not supported in sms URLs there + if (myApp.device.ios) { + $$('#device-' + deviceId + '-send-sms').hide(); + } } } }