Merge pull request #980 from NvrBst/pull-request-upnp_description
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / advanced_networkconfig.lua
1 -- ------ network configuration ------ --
2
3 ut = require "luci.util"
4
5 networkConfig = "/etc/config/network"
6
7
8 m5 = SimpleForm("networkconf", nil)
9 m5:append(Template("mwan/advanced_networkconfig")) -- highlight current tab
10
11
12 f = m5:section(SimpleSection, nil,
13 translate("This section allows you to modify the contents of /etc/config/network"))
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(networkConfig) or ""
21 end
22
23 function t.write(self, section, data) -- format and write new data to script
24 return nixio.fs.writefile(networkConfig, "\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