Merge pull request #980 from NvrBst/pull-request-upnp_description
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / advanced_mwanconfig.lua
1 -- ------ mwan configuration ------ --
2
3 ut = require "luci.util"
4
5 mwanConfig = "/etc/config/mwan3"
6
7
8 m5 = SimpleForm("luci", nil)
9 m5:append(Template("mwan/advanced_mwanconfig")) -- highlight current tab
10
11
12 f = m5:section(SimpleSection, nil,
13 translate("This section allows you to modify the contents of /etc/config/mwan3"))
14
15 t = f:option(TextValue, "lines")
16 t.rmempty = true
17 t.rows = 20
18
19 function t.cfgvalue()
20 return nixio.fs.readfile(mwanConfig) or ""
21 end
22
23 function t.write(self, section, data) -- format and write new data to script
24 return nixio.fs.writefile(mwanConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
25 end
26
27 function f.handle(self, state, data)
28 return true
29 end
30
31
32 return m5