[PATCH 5/7] web/nodewatcher: add description/position_comment

Tim Niemeyer tim.niemeyer at mastersword.de
Mi Jan 6 18:39:20 CET 2016


Signed-off-by: Tim Niemeyer <tim.niemeyer at mastersword.de>
---

 src/packages/fff/fff-nodewatcher/Makefile                  |  2 +-
 .../fff/fff-nodewatcher/files/usr/sbin/nodewatcher         | 12 ++++++++++--
 src/packages/fff/fff-web/Makefile                          |  2 +-
 src/packages/fff/fff-web/files/www/public/cgi-bin/status   |  9 +++++++++
 src/packages/fff/fff-web/files/www/ssl/settings.js         | 14 ++++++++++++++
 5 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/packages/fff/fff-nodewatcher/Makefile b/src/packages/fff/fff-nodewatcher/Makefile
index b578db0..8ff1891 100644
--- a/src/packages/fff/fff-nodewatcher/Makefile
+++ b/src/packages/fff/fff-nodewatcher/Makefile
@@ -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
diff --git a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
index 8209f13..b76cb18 100755
--- a/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
+++ b/src/packages/fff/fff-nodewatcher/files/usr/sbin/nodewatcher
@@ -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. at system[0].description)"
+	if [ -n "$description" ]; then
+		description="<description>$description</description>"
+	fi
 	latitude="$(uci get system. at system[0].latitude)"
 	longitude="$(uci get system. at 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. at system[0].position_comment)"
+	if [ -n "$position_comment" ]; then
+		position_comment="<position_comment>$position_comment</position_comment>"
+	fi
 	contact="$(uci get system. at 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"
 
diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile
index 8d19441..aefcaa6 100644
--- a/src/packages/fff/fff-web/Makefile
+++ b/src/packages/fff/fff-web/Makefile
@@ -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
diff --git a/src/packages/fff/fff-web/files/www/public/cgi-bin/status b/src/packages/fff/fff-web/files/www/public/cgi-bin/status
index 3fb1315..5208327 100755
--- a/src/packages/fff/fff-web/files/www/public/cgi-bin/status
+++ b/src/packages/fff/fff-web/files/www/public/cgi-bin/status
@@ -23,11 +23,20 @@ if [ -n "$contact" ]; then
 	echo "				<li><a href='#'>Kontakt: $contact</a></li>"
 fi
 
+description="$(uci get -q system. at system[0].description)"
+if [ -n "$description" ]; then
+	echo "				<li><a href='#'>Beschreibung: $description</a></li>"
+fi
+
 lat="$(uci get -q system. at system[0].latitude)"
 lon="$(uci get -q system. at 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. at 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>
diff --git a/src/packages/fff/fff-web/files/www/ssl/settings.js b/src/packages/fff/fff-web/files/www/ssl/settings.js
index 21d3099..00cc0aa 100644
--- a/src/packages/fff/fff-web/files/www/ssl/settings.js
+++ b/src/packages/fff/fff-web/files/www/ssl/settings.js
@@ -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 at 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"]);
 	}
 
-- 
2.1.4




Mehr Informationen über die Mailingliste franken-dev