2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
6 Copyright 2010 Manuel Munz <freifunk@somakoma.de>
8 Licensed under the Apache License, Version 2.0 (the "License");
9 you may not use this file except in compliance with the License.
10 You may obtain a copy of the License at
12 http://www.apache.org/licenses/LICENSE-2.0
15 local fs = require "nixio.fs"
17 local splashtextfile = "/usr/lib/luci-splash/splashtext.html"
18 local splashtextinclude = "/usr/lib/luci-splash/splashtextinclude.html"
21 f = SimpleForm("splashtext", translate("Edit the complete splash text"),
22 translate("You can enter your own text that is displayed to clients here.<br />" ..
23 "It is possible to use the following markers: " ..
24 "###COMMUNITY###, ###COMMUNITY_URL###, ###CONTACTURL###, ###LEASETIME###, ###LIMIT### and ###ACCEPT###."))
26 t = f:field(TextValue, "text")
30 return fs.readfile(splashtextfile) or ""
33 function f.handle(self, state, data)
34 if state == FORM_VALID then
36 fs.writefile(splashtextfile, data.text:gsub("\r\n", "\n"))
38 fs.unlink(splashtextfile)
44 g = SimpleForm("splashtextinclude", translate("Include your own text in the default splash"),
45 translate("As an alternative to editing the complete splash text you can also just include some custom text in the default splash page by entering it here."))
47 t = g:field(TextValue, "text")
51 return fs.readfile(splashtextinclude) or ""
54 function g.handle(self, state, data)
55 if state == FORM_VALID then
57 fs.writefile(splashtextinclude, data.text:gsub("\r\n", "\n"))
59 fs.unlink(splashtextinclude)