2b8cef96899e5914da2061936f8b73289b5b30f8
[project/luci.git] / modules / freifunk / luasrc / model / cbi / freifunk / user_index.lua
1 local fs = require "nixio.fs"
2 local file = "/www/luci-static/index_user.html"
3
4 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;."))
5
6 s = m:section(NamedSection, "community", "public", "")
7 s.anonymous = true
8
9 di = s:option(Flag, "DefaultText", translate("Disable default content"), translate("If checked then the default content element is not shown."))
10 di.enabled = "disabled"
11 di.disabled = "enabled"
12 di.rmempty = false
13
14 t = s:option(TextValue, "_text")
15 t.rmempty = true
16 t.rows = 20
17
18 function t.cfgvalue()
19         return fs.readfile(file) or ""
20 end
21
22 function t.write(self, section, value)
23         return fs.writefile(file, value)
24 end
25
26 function t.remove(self, section)
27         return fs.unlink(file)
28 end
29
30 return m