1
0

manual.lua 795 B

123456789101112131415161718192021222324252627282930
  1. -- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local m2, s2, frm
  4. local filename = "/etc/unbound/unbound.conf"
  5. local description = translatef("Here you may edit raw 'unbound.conf' when you don't use UCI:")
  6. description = description .. " (" .. filename .. ")"
  7. m2 = SimpleForm("editing", nil)
  8. m2:append(Template("unbound/css-editing"))
  9. m2.submit = translate("Save")
  10. m2.reset = false
  11. s2 = m2:section(SimpleSection, "Unbound Conf", description)
  12. frm = s2:option(TextValue, "data")
  13. frm.datatype = "string"
  14. frm.rows = 20
  15. function frm.cfgvalue()
  16. return nixio.fs.readfile(filename) or ""
  17. end
  18. function frm.write(self, section, data)
  19. return nixio.fs.writefile(filename, luci.util.trim(data:gsub("\r\n", "\n")))
  20. end
  21. return m2