extended.lua 824 B

123456789101112131415161718192021222324252627282930
  1. -- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local m4, s4, frm
  4. local filename = "/etc/unbound/unbound_ext.conf"
  5. local description = translatef("Here you may edit 'forward:' and 'remote-control:' in an extended 'include:'")
  6. description = description .. " (" .. filename .. ")"
  7. m4 = SimpleForm("editing", nil)
  8. m4:append(Template("unbound/css-editing"))
  9. m4.submit = translate("Save")
  10. m4.reset = false
  11. s4 = m4:section(SimpleSection, "Unbound Extended Conf", description)
  12. frm = s4: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 m4