diff --git a/Lora-Map/resources/js/functions.js b/Lora-Map/resources/js/functions.js
index c595df6..8873c70 100644
--- a/Lora-Map/resources/js/functions.js
+++ b/Lora-Map/resources/js/functions.js
@@ -4,7 +4,7 @@ timecorrectionrunner();
function timecorrectionrunner() {
var timecorrection = new XMLHttpRequest();
timecorrection.onreadystatechange = parseAjaxTimecorrection;
- timecorrection.open("GET", "http://{%REQUEST_URL_HOST%}/currenttime", true);
+ timecorrection.open("GET", "/currenttime", true);
timecorrection.send();
}
diff --git a/Lora-Map/resources/js/map.js b/Lora-Map/resources/js/map.js
index 275dd3e..747797c 100644
--- a/Lora-Map/resources/js/map.js
+++ b/Lora-Map/resources/js/map.js
@@ -45,7 +45,7 @@ function GetMapLayers() {
}
}
};
- layergetter.open("GET", "http://{%REQUEST_URL_HOST%}/getlayer", true);
+ layergetter.open("GET", "/getlayer", true);
layergetter.send();
}
@@ -68,8 +68,12 @@ function GetGeoLayer() {
};
},
onEachFeature: function (feature, layer) {
- if (feature.geometry.type === "Polygon" || (feature.geometry.type === "Point" && feature.properties.hasOwnProperty("icon"))) {
- layer.bindPopup(feature.properties.name);
+ if (feature.geometry.type === "Polygon" || feature.geometry.type === "Point" && feature.properties.hasOwnProperty("icon")) {
+ var text = ""+feature.properties.name+"";
+ if (feature.properties.hasOwnProperty("description")) {
+ text = text + "
" + feature.properties.description;
+ }
+ layer.bindPopup(text);
}
},
pointToLayer: function (geoJsonPoint, latlng) {
@@ -100,7 +104,7 @@ function GetGeoLayer() {
}
}
};
- geogetter.open("GET", "http://{%REQUEST_URL_HOST%}/getgeo", true);
+ geogetter.open("GET", "/getgeo", true);
geogetter.send();
}
@@ -117,7 +121,7 @@ mymap.on('zoomend', function () {
elem._icon.style.fontSize = "0px";
}
});
- } else if (currentZoom == 14) {
+ } else if (currentZoom === 14) {
SpecialMarkers.forEach(function (elem, index) {
if (elem.feature.properties["description"] === "snumber") {
elem._icon.style.fontSize = "0px";
@@ -128,7 +132,7 @@ mymap.on('zoomend', function () {
elem._icon.style.fontSize = "6px";
}
});
- } else if (currentZoom == 15) {
+ } else if (currentZoom === 15) {
SpecialMarkers.forEach(function (elem, index) {
if (elem.feature.properties["description"] === "snumber") {
elem._icon.style.fontSize = "0px";
@@ -139,7 +143,7 @@ mymap.on('zoomend', function () {
elem._icon.style.fontSize = "9px";
}
});
- } else if (currentZoom == 16) {
+ } else if (currentZoom === 16) {
SpecialMarkers.forEach(function (elem, index) {
if (elem.feature.properties["description"] === "snumber") {
elem._icon.style.fontSize = "5px";
@@ -150,7 +154,7 @@ mymap.on('zoomend', function () {
elem._icon.style.fontSize = "13px";
}
});
- } else if (currentZoom == 17) {
+ } else if (currentZoom === 17) {
SpecialMarkers.forEach(function (elem, index) {
if (elem.feature.properties["description"] === "snumber") {
elem._icon.style.fontSize = "5px";
@@ -161,7 +165,7 @@ mymap.on('zoomend', function () {
elem._icon.style.fontSize = "16px";
}
});
- } else if (currentZoom == 18) {
+ } else if (currentZoom === 18) {
SpecialMarkers.forEach(function (elem, index) {
if (elem.feature.properties["description"] === "snumber") {
elem._icon.style.fontSize = "8px";
@@ -172,7 +176,7 @@ mymap.on('zoomend', function () {
elem._icon.style.fontSize = "25px";
}
});
- } else if (currentZoom == 19) {
+ } else if (currentZoom === 19) {
SpecialMarkers.forEach(function (elem, index) {
if (elem.feature.properties["description"] === "snumber") {
elem._icon.style.fontSize = "14px";
diff --git a/Lora-Map/resources/js/marker.js b/Lora-Map/resources/js/marker.js
index d0b022f..dea8915 100644
--- a/Lora-Map/resources/js/marker.js
+++ b/Lora-Map/resources/js/marker.js
@@ -2,12 +2,12 @@
function datarunner() {
var loc = new XMLHttpRequest();
loc.onreadystatechange = parseAjaxLoc;
- loc.open("GET", "http://{%REQUEST_URL_HOST%}/loc", true);
+ loc.open("GET", "/loc", true);
loc.send();
var panic = new XMLHttpRequest();
panic.onreadystatechange = parseAjaxPanic;
- panic.open("GET", "http://{%REQUEST_URL_HOST%}/panic", true);
+ panic.open("GET", "/panic", true);
panic.send();
}
@@ -30,7 +30,7 @@ function parseAjaxLoc() {
className: 'pos-marker',
iconSize: [56, 80],
iconAnchor: [0, 80],
- html: ''
+ html: '
'
});
marker = L.marker([positionItem['Latitude'], positionItem['Longitude']], { 'title': positionItem['Name'], 'icon': myIcon });
}
@@ -43,21 +43,33 @@ function parseAjaxLoc() {
className: 'pos-marker',
iconSize: [56, 80],
iconAnchor: [0, 80],
- html: ''
+ html: '
'
}));
- } else if (markers[key]._icon.children[0].hasAttribute("data")) {
- var old = markers[key]._icon.children[0]["data"].substring(markers[key]._icon.children[0]["data"].indexOf("/", 7) + 1);
+ } else if (markers[key]._icon.children[0].hasAttribute("src")) {
+ var old = markers[key]._icon.children[0]["src"].substring(markers[key]._icon.children[0]["src"].indexOf("/", 7) + 1);
if (old !== positionItem['Icon']) {
- markers[key]._icon.children[0]["data"] = positionItem['Icon'];
+ markers[key]._icon.children[0]["src"] = positionItem['Icon'];
}
}
} else {
- if (markers[key]._icon.children.length === 1 && markers[key]._icon.children[0].hasAttribute("data")) {
+ if (markers[key]._icon.children.length === 1 && markers[key]._icon.children[0].hasAttribute("src")) {
markers[key].removeFrom(mymap);
markers[key] = L.marker([positionItem['Latitude'], positionItem['Longitude']], { 'title': positionItem['Name'] }).addTo(mymap).on("click", showMarkerInfo, key);
}
}
}
+ var lasttime = timeCalculation(positionItem['Recievedtime'], "diffraw");
+ if (lasttime <= 5 * 60) {
+ markers[key]._icon.style.opacity = 1;
+ } else if (lasttime > 5 * 60 && lasttime <= 15 * 60) {
+ markers[key]._icon.style.opacity = 0.9 - (lasttime - 5 * 60) / (15 * 60 - 5 * 60) * (0.9 - 0.7);
+ } else if (lasttime > 15 * 60 && lasttime <= 30 * 60) {
+ markers[key]._icon.style.opacity = 0.7 - (lasttime - 15 * 60) / (30 * 60 - 15 * 60) * (0.7 - 0.5);
+ } else if (lasttime > 30 * 60 && lasttime <= 60 * 60) {
+ markers[key]._icon.style.opacity = 0.5 - (lasttime - 30 * 60) / (30 * 60 - 30 * 60) * (0.5 - 0.25);
+ } else if (lasttime > 60 * 60) {
+ markers[key]._icon.style.opacity = 0.25;
+ }
}
}
}
@@ -66,12 +78,13 @@ function parseAjaxLoc() {
}
}
+var serverPanic = {};
function parseAjaxPanic() {
if (this.readyState === 4 && this.status === 200) {
- var panics = JSON.parse(this.responseText);
- for (var id in panics) {
- if (panics.hasOwnProperty(id)) {
- var alertItem = panics[id];
+ serverPanic = JSON.parse(this.responseText);
+ for (var id in serverPanic) {
+ if (serverPanic.hasOwnProperty(id)) {
+ var alertItem = serverPanic[id];
if (markers.hasOwnProperty(id)) {
var marker = markers[id];
if (timeCalculation(alertItem["Recievedtime"], "diffraw") <= 10 && marker._icon.className.indexOf(" marker-alert") === -1) {
diff --git a/Lora-Map/resources/js/menu.js b/Lora-Map/resources/js/menu.js
index 775dad4..871124d 100644
--- a/Lora-Map/resources/js/menu.js
+++ b/Lora-Map/resources/js/menu.js
@@ -57,6 +57,16 @@ function update_pannels_info() {
html += "Letzter Wert: Vor: " + timeCalculation(positionItem["Lastgpspostime"], "difftext") + "
";
html += "Update: " + timeCalculation(positionItem["Recievedtime"], "str") + "
Vor: " + timeCalculation(positionItem["Recievedtime"], "difftext") + "
";
html += "RSSI: " + positionItem["Rssi"] + ", SNR: " + positionItem["Snr"] + "
";
+ if (serverPanic.hasOwnProperty(statusToDevice)) {
+ var panicData = serverPanic[statusToDevice];
+ if (panicData["ButtonPressed"].length > 0) {
+ html += "Alerts:";
+ for (var i = 0; i < panicData["ButtonPressed"].length; i++) {
+ html += "" + timeCalculation(panicData["ButtonPressed"][i], "str")+" (vor " + timeCalculation(panicData["ButtonPressed"][i],"difftext")+")";
+ }
+ html += "
";
+ }
+ }
document.getElementById("pannels_info").innerHTML = html;
}
}
@@ -96,16 +106,16 @@ function updateOverviewElement(positionItem, id) {
document.getElementById("overview-update-id-" + id).innerText = "Letzte Werte: vor " + timeCalculation(positionItem["Recievedtime"], "difftext");
if (positionItem['Icon'] === null) {
var icon = document.getElementById("overview-icon-id-" + id);
- if (icon.children[0].hasAttribute("data")) {
+ if (icon.children[0].hasAttribute("rel")) {
document.getElementById("overview-icon-id-" + id).innerHTML = "
";
}
} else {
- if (document.getElementById("overview-icon-id-" + id).children[0].hasAttribute("data")) {
- if (document.getElementById("overview-icon-id-" + id).children[0]["data"].substring(document.getElementById("overview-icon-id-" + id).children[0]["data"].indexOf("/", 7) + 1) !== positionItem['Icon'] + "&marker-bg=hidden") {
- document.getElementById("overview-icon-id-" + id).children[0]["data"] = positionItem['Icon'] + "&marker-bg=hidden";
+ if (document.getElementById("overview-icon-id-" + id).children[0].hasAttribute("src")) {
+ if (document.getElementById("overview-icon-id-" + id).children[0]["src"].substring(document.getElementById("overview-icon-id-" + id).children[0]["src"].indexOf("/", 7) + 1) !== positionItem['Icon'] + "&marker-bg=hidden") {
+ document.getElementById("overview-icon-id-" + id).children[0]["src"] = positionItem['Icon'] + "&marker-bg=hidden";
}
} else {
- document.getElementById("overview-icon-id-" + id).innerHTML = "";
+ document.getElementById("overview-icon-id-" + id).innerHTML = "
";
}
}
}
@@ -117,9 +127,9 @@ function createOverviewElement(positionItem, id) {
divItem.setAttribute("rel", id);
divItem.innerHTML = "";
if (positionItem['Icon'] !== null) {
- divItem.innerHTML += "";
+ divItem.innerHTML += "
";
} else {
- divItem.innerHTML += "
";
+ divItem.innerHTML += "
";
}
divItem.innerHTML += "" +
"" +
@@ -134,7 +144,7 @@ function createOverviewElement(positionItem, id) {
function update_pannels_admin() {
var testadmin = new XMLHttpRequest();
testadmin.onreadystatechange = parseAjaxPannelAdmin;
- testadmin.open("GET", "http://{%REQUEST_URL_HOST%}/admin", true);
+ testadmin.open("GET", "/admin", true);
testadmin.send();
}
@@ -153,7 +163,7 @@ function parseAjaxPannelAdmin() {
function submitloginform() {
var adminlogin = new XMLHttpRequest();
adminlogin.onreadystatechange = parseAjaxLogin;
- adminlogin.open("POST", "http://{%REQUEST_URL_HOST%}/admin/login", true);
+ adminlogin.open("POST", "/admin/login", true);
adminlogin.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
adminlogin.send("user=" + encodeURI(document.getElementById("pannels_admin_name").value) + "&pass=" + encodeURI(document.getElementById("pannels_admin_pass").value));
}
diff --git a/README.md b/README.md
index 78f61f9..aab53b9 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,6 @@
# Fraunhofer.Fit.IoT.LoraMap (Lora-Map)
Program that displays items with coordinates from Mqtt on a map
-## Docker
-* Build: `docker-compose build`
-* Provide: `./Lora-Map/config/requests.conf` and `./Lora-Map/config/settings.conf`
-* Run `docker-compose up -d`
-
## Linking to
### Internal
* BlubbFish.Utils ([Utils](http://git.blubbfish.net/vs_utils/Utils))