summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2017-04-21 21:01:52 +0200
committerDirk Brenken <dev@brenken.org>2017-04-21 21:09:14 +0200
commitbbd2c52a1690f82965d17104c33f02dc09e7eb82 (patch)
tree3467e10d3a961b89f687ec0837b0dc00d94f40ba /applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua
parent3dc08a354b4f5212fdaf54764729a025a14167cf (diff)
travelmate: major frontend update
* all options are full configurable via frontend * show current runtime information * show current travelmate logfile information * automatic wwan network interface setup (advanced section) * direct access to all relevant configuration files (advanced section) Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua')
-rw-r--r--applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua
new file mode 100644
index 0000000000..6e9e2872fc
--- /dev/null
+++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/configuration_tab.lua
@@ -0,0 +1,36 @@
+-- Copyright 2017 Dirk Brenken (dev@brenken.org)
+-- This is free software, licensed under the Apache License, Version 2.0
+
+local fs = require("nixio.fs")
+local util = require("luci.util")
+local trminput = "/etc/config/travelmate"
+
+if not nixio.fs.access(trminput) then
+ m = SimpleForm("error", nil, translate("Input file not found, please check your configuration."))
+ return m
+end
+
+m = SimpleForm("input", nil)
+m:append(Template("travelmate/config_css"))
+m.reset = false
+
+s = m:section(SimpleSection, nil,
+ translate("This form allows you to modify the content of the main travelmate configuration file (/etc/config/travelmate)."))
+
+f = s:option(TextValue, "data")
+f.rows = 20
+f.rmempty = true
+
+function f.cfgvalue()
+ return nixio.fs.readfile(trminput) or ""
+end
+
+function f.write(self, section, data)
+ return nixio.fs.writefile(trminput, "\n" .. util.trim(data:gsub("\r\n", "\n")) .. "\n")
+end
+
+function s.handle(self, state, data)
+ return true
+end
+
+return m