summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua
diff options
context:
space:
mode:
authordanrl <mail@danrl.com>2017-02-17 11:22:01 +0100
committerdanrl <mail@danrl.com>2017-02-17 11:22:01 +0100
commita25c71f55697d13c0a12da104bde7fee57d00f2c (patch)
tree7398b15679d049fc3eb9db06451e6898991fd68e /applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua
parent9726e26a7a2ea6052827472bfbec3c9914abedf8 (diff)
luci-app-mwan3: initial commit
Moved over here from the packages repository. Signed-off-by: Dan Luedtke <mail@danrl.com>
Diffstat (limited to 'applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua')
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua
new file mode 100644
index 000000000..e0a99e836
--- /dev/null
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_mwanconfig.lua
@@ -0,0 +1,32 @@
+-- ------ mwan configuration ------ --
+
+ut = require "luci.util"
+
+mwanConfig = "/etc/config/mwan3"
+
+
+m5 = SimpleForm("luci", nil)
+ m5:append(Template("mwan/advanced_mwanconfig")) -- highlight current tab
+
+
+f = m5:section(SimpleSection, nil,
+ translate("This section allows you to modify the contents of /etc/config/mwan3"))
+
+t = f:option(TextValue, "lines")
+ t.rmempty = true
+ t.rows = 20
+
+ function t.cfgvalue()
+ return nixio.fs.readfile(mwanConfig) or ""
+ end
+
+ function t.write(self, section, data) -- format and write new data to script
+ return nixio.fs.writefile(mwanConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
+ end
+
+ function f.handle(self, state, data)
+ return true
+ end
+
+
+return m5