0fb464f3e7861672b43afeafd63198428c0cfa25
[project/luci.git] / applications / luci-freifunk-widgets / luasrc / model / cbi / freifunk / widgets / html.lua
1 local map, section = ...
2 local utl = require "luci.util"
3 local fs = require "nixio.fs"
4 local file = "/usr/share/customtext/" .. arg[1] .. ".html"
5
6 local form, ferr = loadfile(utl.libpath() .. "/model/cbi/freifunk/widgets/heightwidth.lua")
7 if form then
8 setfenv(form, getfenv(1))(m, wdg)
9 end
10
11 t = wdg:option(TextValue, "_text")
12 t.rmempty = true
13 t.rows = 20
14
15
16 function t.cfgvalue()
17 return fs.readfile(file) or ""
18 end
19
20 function t.write(self, section, value)
21 return fs.writefile(file, value)
22 end
23
24 function t.remove(self, section)
25 return fs.unlink(file)
26 end
27
28