e23ea901ab76c5a47fc49fdd883d43a99554f98b
[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 luci.i18n.loadc("freifunk")
4
5 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;."))
6
7 s = m:section(NamedSection, "community", "public", "")
8 s.anonymous = true
9
10 di = s:option(Flag, "DefaultText", translate("Disable default content"), translate("If selected then the default content element is not shown."))
11 di.enabled = "disabled"
12 di.disabled = "enabled"
13 di.rmempty = false
14
15 t = s:option(TextValue, "_text")
16 t.rmempty = true
17 t.rows = 20
18
19 function t.cfgvalue()
20         return fs.readfile(file) or ""
21 end
22
23 function t.write(self, section, value)
24         return fs.writefile(file, value)
25 end
26
27 function t.remove(self, section)
28         return fs.unlink(file)
29 end
30
31 return m