luci-app-travelmate: user interface for Travelmate package
authorHannu Nyman <hannu.nyman@iki.fi>
Sun, 30 Oct 2016 08:10:46 +0000 (10:10 +0200)
committerHannu Nyman <hannu.nyman@iki.fi>
Sun, 30 Oct 2016 08:10:46 +0000 (10:10 +0200)
Create user interface for Travelmate, a new package that
helps in creating travel router functionality.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
applications/luci-app-travelmate/Makefile [new file with mode: 0644]
applications/luci-app-travelmate/luasrc/controller/travelmate.lua [new file with mode: 0644]
applications/luci-app-travelmate/luasrc/model/cbi/travelmate.lua [new file with mode: 0644]
applications/luci-app-travelmate/po/templates/travelmate.pot [new file with mode: 0644]
applications/luci-app-travelmate/root/etc/uci-defaults/40_luci-travelmate [new file with mode: 0755]

diff --git a/applications/luci-app-travelmate/Makefile b/applications/luci-app-travelmate/Makefile
new file mode 100644 (file)
index 0000000..f4b1b0a
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI support for Travelmate
+LUCI_DEPENDS:=+travelmate
+LUCI_PKGARCH:=all
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua
new file mode 100644 (file)
index 0000000..27c19c4
--- /dev/null
@@ -0,0 +1,11 @@
+-- Licensed to the public under the Apache License 2.0.
+
+module("luci.controller.travelmate", package.seeall)
+
+function index()
+       if not nixio.fs.access("/etc/config/travelmate") then
+               return
+       end
+
+       entry({"admin", "services", "travelmate"}, cbi("travelmate"), _("Travelmate"), 60)
+end
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate.lua
new file mode 100644 (file)
index 0000000..9050ae9
--- /dev/null
@@ -0,0 +1,53 @@
+-- Licensed to the public under the Apache License 2.0.
+
+m = Map("travelmate", translate("Travelmate"),
+       translate("Configuration of the Travelmate package to enable travel router functionality. ") .. [[</p>]] ..
+       translate("Brief advice: Create a wwan interface, configure it to use dhcp and " ..
+               "add it to the wan zone in firewall. Create the wifi interfaces to be used ('client' mode, " ..
+               "assigned to wwan network, left as disabled). Travelmate will try " ..
+               "to connect to the known wifi client interfaces in the defined order. ") ..
+       [[<a href="https://github.com/openwrt/packages/tree/master/net/travelmate/files/README.md" target="_blank">]] 
+       .. translate("Link to detailed advice")
+       .. [[</a>]] )
+
+-- General options
+
+s = m:section(NamedSection, "global", "travelmate", translate("Global options"))
+
+o = s:option(Flag, "trm_enabled", translate("Enable Travelmate"))
+o.rmempty = false
+o.default = 0
+
+o = s:option(Value, "trm_loop", translate("Loop timeout in seconds for wlan monitoring"),
+       translate("Default 30, range 5-60"))
+o.rmempty = false
+o.default = 30
+o.datatype = "range(5,60)"
+
+o = s:option(Value, "trm_maxretry", translate("Max. number of connection retries to an uplink"),
+       translate("Default 3, range 0-10. Set to 0 to allow unlimited retries"))
+o.rmempty = false
+o.default = 3
+o.datatype = "range(0,10)"
+
+-- Extra options
+
+e = m:section(NamedSection, "global", "travelmate", translate("Extra options"))
+
+a = e:option(Flag, "trm_debug", translate("Debug logging"))
+a.rmempty = true
+a.default = a.disabled
+
+a = e:option(Value, "trm_device", translate("Use only one radio, e.g. 'radio0'"),
+       translate("Default: empty = use all radios."))
+a.rmempty = true
+a.default = ""
+a.datatype = "uciname"
+
+a = e:option(Flag, "trm_iw", translate("Use iw for scanning"),
+       translate("Disable this if you want to use iwinfo instead of iw"))
+a.rmempty = true
+a.default = a.enabled
+
+return m
+
diff --git a/applications/luci-app-travelmate/po/templates/travelmate.pot b/applications/luci-app-travelmate/po/templates/travelmate.pot
new file mode 100644 (file)
index 0000000..533b3e2
--- /dev/null
@@ -0,0 +1,56 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8"
+
+msgid ""
+"Brief advice: Create a wwan interface, configure it to use dhcp and add it "
+"to the wan zone in firewall. Create the wifi interfaces to be used ('client' "
+"mode, assigned to wwan network, left as disabled). Travelmate will try to "
+"connect to the known wifi client interfaces in the defined order."
+msgstr ""
+
+msgid ""
+"Configuration of the Travelmate package to enable travel router "
+"functionality."
+msgstr ""
+
+msgid "Debug logging"
+msgstr ""
+
+msgid "Default 3, range 0-10. Set to 0 to allow unlimited retries"
+msgstr ""
+
+msgid "Default 30, range 5-60"
+msgstr ""
+
+msgid "Default: empty = use all radios."
+msgstr ""
+
+msgid "Disable this if you want to use iwinfo instead of iw"
+msgstr ""
+
+msgid "Enable Travelmate"
+msgstr ""
+
+msgid "Extra options"
+msgstr ""
+
+msgid "Global options"
+msgstr ""
+
+msgid "Link to detailed advice"
+msgstr ""
+
+msgid "Loop timeout in seconds for wlan monitoring"
+msgstr ""
+
+msgid "Max. number of connection retries to an uplink"
+msgstr ""
+
+msgid "Travelmate"
+msgstr ""
+
+msgid "Use iw for scanning"
+msgstr ""
+
+msgid "Use only one radio, e.g. 'radio0'"
+msgstr ""
diff --git a/applications/luci-app-travelmate/root/etc/uci-defaults/40_luci-travelmate b/applications/luci-app-travelmate/root/etc/uci-defaults/40_luci-travelmate
new file mode 100755 (executable)
index 0000000..f767677
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+uci -q batch <<-EOF >/dev/null
+       delete ucitrack.@travelmate[-1]
+       add ucitrack travelmate
+       set ucitrack.@travelmate[-1].init=travelmate
+       commit ucitrack
+EOF
+
+rm -f /tmp/luci-indexcache
+exit 0