summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_wirelessconfig.lua
blob: 95e9f7c7e59114688700507d486b38b8f6808e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- ------ wireless configuration ------ --

ut = require "luci.util"

wirelessConfig = "/etc/config/wireless"


m5 = SimpleForm("wirelessconf", nil)
	m5:append(Template("mwan/advanced_wirelessconfig")) -- highlight current tab


f = m5:section(SimpleSection, nil,
	translate("This section allows you to modify the contents of /etc/config/wireless"))

t = f:option(TextValue, "lines")
	t.rmempty = true
	t.rows = 20

	function t.cfgvalue()
		return nixio.fs.readfile(wirelessConfig) or ""
	end

	function t.write(self, section, data) -- format and write new data to script
		return nixio.fs.writefile(wirelessConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
	end

	function f.handle(self, state, data)
		return true
	end


return m5