diff --git a/Lora-Map/Model/Settings.cs b/Lora-Map/Model/Settings.cs
index bf4d88d..b1130c6 100644
--- a/Lora-Map/Model/Settings.cs
+++ b/Lora-Map/Model/Settings.cs
@@ -124,6 +124,18 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
}
this.External.Sensors = sensors;
}
+ if(json.ContainsKey("History") && json["History"].IsObject) {
+ if(json["History"].ContainsKey("enabled") && json["History"]["enabled"].IsBoolean) {
+ this.External.History.Enabled = (Boolean)json["History"]["enabled"];
+ }
+ if(this.External.History.Enabled) {
+ this.External.History.Time = json["History"].ContainsKey("time") && json["History"]["time"].IsInt ? (Int32)json["History"]["time"] : 0;
+ this.External.History.Time = json["History"].ContainsKey("amount") && json["History"]["amount"].IsInt ? (Int32)json["History"]["amount"] : 0;
+ } else {
+ this.External.History.Amount = 0;
+ this.External.History.Time = 0;
+ }
+ }
this.gridradius = json.ContainsKey("GridRadius") && json["GridRadius"].IsInt && this.External.Startloclat != 0 && this.External.Startloclon != 0 ? (Int32)json["GridRadius"] : 0;
this.GenerateGrid();
this.FindMapLayer();
@@ -294,6 +306,18 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
}
}
+ public class History {
+ public Boolean Enabled {
+ get; set;
+ } = false;
+ public Int32 Time {
+ get; set;
+ } = 0;
+ public Int32 Amount {
+ get; set;
+ } = 0;
+ }
+
public class PublicSettings {
public Double Startloclat {
get; set;
@@ -319,6 +343,9 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model {
public JsonData GeoLayer {
get; set;
}
+ public History History {
+ get; set;
+ } = new History();
}
public class PrivateSettings {
diff --git a/Lora-Map/resources/admin/js/settings.js b/Lora-Map/resources/admin/js/settings.js
index def9417..2519a52 100644
--- a/Lora-Map/resources/admin/js/settings.js
+++ b/Lora-Map/resources/admin/js/settings.js
@@ -58,34 +58,38 @@
"
Einstellungen
";
- html += "
Startpunkt: Lat, Lon
";
- html += "
";
- html += "
Radius für das Grid um den Startpunkt: m
";
- html += "
Fight Dedection Kameras:
" + this._renderFightDedection(jsonsettings.FightDedection) + "
";
- html += "
Crowd Density Kameras:
" + this._renderCrowdDensity(jsonsettings.CrwodDensity) + "
";
- html += "
Sensors:
" + this._renderSensorSettings(jsonsettings.Sensors) + "
";
+ html += "
Startpunkt: Lat, Lon
";
+ html += "
";
+ html += "
Radius für das Grid um den Startpunkt: m
";
+ html += "
Fight Dedection Kameras:
" + this._renderFightDedection(jsonsettings.FightDedection) + "
";
+ html += "
Crowd Density Kameras:
" + this._renderCrowdDensity(jsonsettings.CrwodDensity) + "
";
+ html += "
Sensors:
" + this._renderSensorSettings(jsonsettings.Sensors) + "
";
+ html += "
History: "+this._renderHistorySettings(jsonsettings.History)+"
";
html += "
";
document.getElementById("content").innerHTML = html + "
";
},
@@ -159,6 +163,29 @@
}
ret.Sensors = sensorjson;
+ ret.History = {};
+ if (document.getElementById("hist_yes").checked && !document.getElementById("hist_no").checked) {
+ ret.History.enabled = true;
+ var time = parseInt(document.getElementById("history_time").value);
+ if (isNaN(time)) {
+ time = 0;
+ }
+ var amount = parseInt(document.getElementById("history_amount").value);
+ if (isNaN(amount)) {
+ amount = 0;
+ }
+ if (time !== 0 && amount !== 0) {
+ alert("History: Entweder Zeit oder Menge muss 0 sein.");
+ return;
+ }
+ ret.History.time = time;
+ ret.History.amount = amount;
+ } else {
+ ret.History.enabled = false;
+ ret.History.time = 0;
+ ret.History.amount = 0;
+ }
+
var savesettings = new XMLHttpRequest();
savesettings.onreadystatechange = function () {
if (savesettings.readyState === 4) {
@@ -306,6 +333,20 @@
ret += "";
return ret;
},
+ _renderHistorySettings: function (json) {
+ if (!Object.prototype.hasOwnProperty.call(json, "enabled")) {
+ json.enabled = false;
+ }
+ if (!Object.prototype.hasOwnProperty.call(json, "time")) {
+ json.time = 0;
+ }
+ if (!Object.prototype.hasOwnProperty.call(json, "amount")) {
+ json.amount = 0;
+ }
+ var html = "Aktiv: