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