fff-web: store geo location in two variables

Signed-off-by: Tim Niemeyer <tim.niemeyer@mastersword.de>
Reviewed-by: Tobias Klaus <tk+ff@meskal.net>
This commit is contained in:
Tim Niemeyer 2016-01-24 18:51:54 +01:00 committed by Tobias Klaus
parent 04a89f1e9d
commit ba619c8bc8
3 changed files with 20 additions and 13 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-web
PKG_VERSION:=0.0.1
PKG_VERSION:=0.0.2
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-web

View File

@ -18,15 +18,15 @@
<a class="pure-menu-heading" href="http://www.freifunk-franken.de">freifunk-franken.de</a>
<ul>
<%
contact="$(uci get -q freifunk.@settings[0].contact)"
contact="$(uci get -q system.@system[0].contact)"
if [ -n "$contact" ]; then
echo " <li><a href='#'>Kontakt: $contact</a></li>"
fi
geo="$(uci get -q freifunk.@settings[0].geo)"
if [ -n "$geo" ]; then
lat="${geo%% *}" lon="${geo##* }"
echo " <li><a href=\"https://www.openstreetmap.org?mlat=$lat&mlon=$lon&zoom=17\">Position: ${lat:0:8}N, ${lon:0:8}E</a></li>"
lat="$(uci get -q system.@system[0].latitude)"
lon="$(uci get -q system.@system[0].longitude)"
if [ -n "$lat" -a -n "$lon" ]; then
echo " <li><a href=\"https://monitoring.freifunk-franken.de/map?mapcenter=$lat,$lon,16\">Position: ${lat:0:8}N, ${lon:0:8}E</a></li>"
fi
%>
<li><form action="https://<% echo -n "$HTTP_HOST" %>"><button type="submit" class="pure-button">Login</button></form></li>
@ -35,7 +35,7 @@ fi
</div>
<div class="header">
<%
echo " <h1>$(uci get -q freifunk.@settings[0].name)</h1>"
echo " <h1>$(uci get -q system.@system[0].hostname)</h1>"
%>
<h2>Firmware Version <% echo -n $FIRMWARE_VERSION %></h2>
</div>

View File

@ -52,11 +52,17 @@ function appendSetting(p, path, value, mode)
var name = path[path.length-1];
switch(name)
{
case "geo":
b = append_input(p, "GPS-Koordinaten", id, value);
b.lastChild.placeholder = "52.02713078 8.52829987";
addInputCheck(b.lastChild, /^$|^\d{1,3}\.\d{1,8} {1,3}\d{1,3}\.\d{1,8}$/, "Ung\xfcltige Eingabe. Bitte nur maximal 8 Nachkommastellen und keine Kommas verwenden.");
addHelpText(b, "Die Koordinaten dieses Knotens auf der Freifunk-Karte (z.B. \"52.02713078 8.52829987\").");
case "latitude":
b = append_input(p, "GPS-Koordinaten Latitude", id, value);
b.lastChild.placeholder = "52.02713078";
addInputCheck(b.lastChild, /^$|^\d{1,3}\.\d{1,8}$/, "Ung\xfcltige Eingabe. Bitte nur maximal 8 Nachkommastellen und keine Kommas verwenden.");
addHelpText(b, "Die Latitude Koordinate dieses Knotens auf der Freifunk-Karte (z.B. \"52.02713078\").");
break;
case "longitude":
b = append_input(p, "GPS-Koordinaten Longitude", id, value);
b.lastChild.placeholder = "8.52829987";
addInputCheck(b.lastChild, /^$|^\d{1,3}\.\d{1,8}$/, "Ung\xfcltige Eingabe. Bitte nur maximal 8 Nachkommastellen und keine Kommas verwenden.");
addHelpText(b, "Die Longitude Koordinate dieses Knotens auf der Freifunk-Karte (z.B. \"8.52829987\").");
break;
case "hostname":
b = append_input(p, "Knotenname", id, value);
@ -110,7 +116,8 @@ function rebuild_general()
var f = uci['system'];
var i = firstSectionID(f, "system");
appendSetting(gfs, ['system', i, "hostname"], f[i]["hostname"]);
appendSetting(gfs, ['system', i, "geo"], f[i]["geo"]);
appendSetting(gfs, ['system', i, "latitude"], f[i]["latitude"]);
appendSetting(gfs, ['system', i, "longitude"], f[i]["longitude"]);
appendSetting(gfs, ['system', i, "contact"], f[i]["contact"]);
}