diff --git a/src/main/webapp/m/index.html b/src/main/webapp/m/index.html index db66a98e..1cc59b8c 100644 --- a/src/main/webapp/m/index.html +++ b/src/main/webapp/m/index.html @@ -113,6 +113,14 @@
{{address}}
{{/if}} + {{#if other}} + {{#each other}} +
+
{{@key}}
+
{{this}}
+
+ {{/each}} + {{/if}} diff --git a/src/main/webapp/m/js/traccar-mobile.js b/src/main/webapp/m/js/traccar-mobile.js index 0057efce..0a36e2de 100644 --- a/src/main/webapp/m/js/traccar-mobile.js +++ b/src/main/webapp/m/js/traccar-mobile.js @@ -343,6 +343,31 @@ function drawDeviceDetails(deviceId, position) { if (position == undefined) { deviceDetails.html('
No data available
'); } else { + // parse 'other' field + if (window.DOMParser) { + parser = new DOMParser(); + xmlDoc = parser.parseFromString(position.other, "text/xml"); + // Internet Explorer + } else { + xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); + xmlDoc.async = false; + xmlDoc.loadXML(position.other); + } + + if (xmlDoc.documentElement == null) { + position.other = null; + } else { + position.other = {}; + var nodes = xmlDoc.documentElement.childNodes; + for (i = 0; i < nodes.length; i++) { + if (nodes[i].textContent == null) { + position.other[nodes[i].nodeName] = nodes[i].nodeValue; + } else { + position.other[nodes[i].nodeName] = nodes[i].textContent; + } + } + } + var source = $$('#device-details-template').html(); var template = Handlebars.compile(source);