user_index.lua 899 B

123456789101112131415161718192021222324252627282930
  1. local fs = require "nixio.fs"
  2. local file = "/www/luci-static/index_user.html"
  3. m = Map("freifunk", translate("Edit index page"), translate("You can display additional content on the public index page by inserting valid XHTML in the form below.<br />Headlines should be enclosed between &lt;h2&gt; and &lt;/h2&gt;."))
  4. s = m:section(NamedSection, "community", "public", "")
  5. s.anonymous = true
  6. di = s:option(Flag, "DefaultText", translate("Disable default content"), translate("If selected then the default content element is not shown."))
  7. di.enabled = "disabled"
  8. di.disabled = "enabled"
  9. di.rmempty = false
  10. t = s:option(TextValue, "_text")
  11. t.rmempty = true
  12. t.rows = 20
  13. function t.cfgvalue()
  14. return fs.readfile(file) or ""
  15. end
  16. function t.write(self, section, value)
  17. return fs.writefile(file, value)
  18. end
  19. function t.remove(self, section)
  20. return fs.unlink(file)
  21. end
  22. return m