web/nodewatcher: add description/position_comment

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:57 +01:00 committed by Tobias Klaus
parent 34b11267e5
commit 5940b43765
5 changed files with 35 additions and 4 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-nodewatcher
PKG_VERSION:=35
PKG_VERSION:=36
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/fff-nodewatcher

View File

@ -2,7 +2,7 @@
# Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
# License; GPL v3
SCRIPT_VERSION="35"
SCRIPT_VERSION="36"
test -f /tmp/started || exit
@ -57,11 +57,19 @@ crawl() {
#Get system data from other locations
err "`date`: Collecting basic system status data"
hostname="$(cat /proc/sys/kernel/hostname)"
description="$(uci get system.@system[0].description)"
if [ -n "$description" ]; then
description="<description>$description</description>"
fi
latitude="$(uci get system.@system[0].latitude)"
longitude="$(uci get system.@system[0].longitude)"
if [ -n "$longitude" -a -n "$latitude" ]; then
geo="<geo><lat>$latitude</lat><lng>$longitude</lng></geo>";
fi
position_comment="$(uci get system.@system[0].position_comment)"
if [ -n "$position_comment" ]; then
position_comment="<position_comment>$position_comment</position_comment>"
fi
contact="$(uci get system.@system[0].contact)"
if [ -n "$contact" ]; then
contact="<contact>$contact</contact>"
@ -110,7 +118,7 @@ crawl() {
#OPENWRT_CORE_REVISION="35298"
#OPENWRT_FEEDS_PACKAGES_REVISION="35298"
. /etc/firmware_release
SYSTEM_DATA="<status>online</status>$status_text<hostname>$hostname</hostname>${geo}${contact}<distname>$distname</distname><distversion>$distversion</distversion>$cpu$model$memory$load$uptime<local_time>$local_time</local_time><batman_advanced_version>$batman_adv_version</batman_advanced_version><kernel_version>$kernel_version</kernel_version><fastd_version>$fastd_version</fastd_version><nodewatcher_version>$nodewatcher_version</nodewatcher_version><firmware_version>$FIRMWARE_VERSION</firmware_version><firmware_community>$FIRMWARE_COMMUNITY</firmware_community><firmware_revision>$BUILD_DATE</firmware_revision><openwrt_core_revision>$OPENWRT_CORE_REVISION</openwrt_core_revision><openwrt_feeds_packages_revision>$OPENWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_packages_revision>"
SYSTEM_DATA="<status>online</status>$status_text<hostname>$hostname</hostname>${description}${geo}${position_comment}${contact}<distname>$distname</distname><distversion>$distversion</distversion>$cpu$model$memory$load$uptime<local_time>$local_time</local_time><batman_advanced_version>$batman_adv_version</batman_advanced_version><kernel_version>$kernel_version</kernel_version><fastd_version>$fastd_version</fastd_version><nodewatcher_version>$nodewatcher_version</nodewatcher_version><firmware_version>$FIRMWARE_VERSION</firmware_version><firmware_community>$FIRMWARE_COMMUNITY</firmware_community><firmware_revision>$BUILD_DATE</firmware_revision><openwrt_core_revision>$OPENWRT_CORE_REVISION</openwrt_core_revision><openwrt_feeds_packages_revision>$OPENWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_packages_revision>"
err "`date`: Collecting information from network interfaces"

View File

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

View File

@ -23,11 +23,20 @@ if [ -n "$contact" ]; then
echo " <li><a href='#'>Kontakt: $contact</a></li>"
fi
description="$(uci get -q system.@system[0].description)"
if [ -n "$description" ]; then
echo " <li><a href='#'>Beschreibung: $description</a></li>"
fi
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
position_comment="$(uci get -q system.@system[0].position_comment)"
if [ -n "$position_comment" ]; then
echo " <li>${position_comment}</li>"
fi
%>
<li><form action="https://<% echo -n "$HTTP_HOST" %>"><button type="submit" class="pure-button">Login</button></form></li>
</ul>

View File

@ -64,12 +64,24 @@ function appendSetting(p, path, value, mode)
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 "position_comment":
b = append_input(p, "Standort Beschreibung", id, value);
b.lastChild.placeholder = "Am Antennenmast";
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,255}$/, "Ung\xfcltige Eingabe.");
addHelpText(b, "Eine genauere Beschreibung zum Standort");
break;
case "hostname":
b = append_input(p, "Knotenname", id, value);
b.lastChild.placeholder = "MeinRouter";
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,32}$/, "Ung\xfcltige Eingabe.");
addHelpText(b, "Der Name dieses Knotens auf der Freifunk-Karte.");
break;
case "description":
b = append_input(p, "Knotenbeschreibung", id, value);
b.lastChild.placeholder = "In einer grauen Kiste versteckt";
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,255}$/, "Ung\xfcltige Eingabe.");
addHelpText(b, "Beschreibung dieses Knotens.");
break;
case "contact":
b = append_input(p, "Kontaktdaten", id, value);
b.lastChild.placeholder = "info@example.com";
@ -116,8 +128,10 @@ function rebuild_general()
var f = uci['system'];
var i = firstSectionID(f, "system");
appendSetting(gfs, ['system', i, "hostname"], f[i]["hostname"]);
appendSetting(gfs, ['system', i, "description"], f[i]["description"]);
appendSetting(gfs, ['system', i, "latitude"], f[i]["latitude"]);
appendSetting(gfs, ['system', i, "longitude"], f[i]["longitude"]);
appendSetting(gfs, ['system', i, "position_comment"], f[i]["position_comment"]);
appendSetting(gfs, ['system', i, "contact"], f[i]["contact"]);
}