Merge pull request #1818 from dibdot/lxc_fix
[project/luci.git] / applications / luci-app-unbound / luasrc / model / cbi / unbound / extended.lua
1 -- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local m4, s4, frm
5 local filename = "/etc/unbound/unbound_ext.conf"
6 local description =  translatef("Here you may edit 'forward:' and 'remote-control:' in an extended 'include:'")
7 description = description .. " (" .. filename .. ")"
8
9 m4 = SimpleForm("editing", nil)
10 m4:append(Template("unbound/css-editing"))
11 m4.submit = translate("Save")
12 m4.reset = false
13 s4 = m4:section(SimpleSection, "Unbound Extended Conf", description)
14 frm = s4:option(TextValue, "data")
15 frm.datatype = "string"
16 frm.rows = 20
17
18
19 function frm.cfgvalue()
20   return nixio.fs.readfile(filename) or ""
21 end
22
23
24 function frm.write(self, section, data)
25   return nixio.fs.writefile(filename, luci.util.trim(data:gsub("\r\n", "\n")))
26 end
27
28
29 return m4
30