applications/freifunk-widgets: remove order variable, fix html in rss view, fix searc...
[project/luci.git] / applications / luci-freifunk-widgets / luasrc / model / cbi / freifunk / widgets / html.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2012 Manuel Munz <freifunk at somakoma dot de>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 ]]--
13
14 local map, section = ...
15 local utl = require "luci.util"
16 local fs = require "nixio.fs"
17 local file = "/usr/share/customtext/" .. arg[1] .. ".html"
18
19 local form, ferr = loadfile(utl.libpath() .. "/model/cbi/freifunk/widgets/heightwidth.lua")
20 if form then
21 setfenv(form, getfenv(1))(m, wdg)
22 end
23
24 t = wdg:option(TextValue, "_text")
25 t.rmempty = true
26 t.rows = 20
27
28
29 function t.cfgvalue()
30 return fs.readfile(file) or ""
31 end
32
33 function t.write(self, section, value)
34 return fs.writefile(file, value)
35 end
36
37 function t.remove(self, section)
38 return fs.unlink(file)
39 end
40
41