72f58c2f10cb4156af8c4e27738b9aaaaced0525
[project/luci.git] / applications / luci-splash / luasrc / view / splash / splash.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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 $Id$
13
14 -%>
15 <%
16 require("luci.fs")
17
18 function expand (e)        
19         return (string.gsub(e, "###([A-Z_]+)###", R))
20 end
21
22 local c = luci.model.uci.cursor():get_all("freifunk", "community")
23 if c and c.name then
24         community = c.name
25 else
26         community = "Freifunk"
27 end
28
29 if c and c.homepage then
30         homepage = c.homepage
31 else
32         homepage = "http://freifunk.net"
33 end
34
35 local s = luci.model.uci.cursor():get_all("luci_splash", "general")
36 if s and s.leasetime then
37         leasetime = s.leasetime
38 else
39         leasetime = ""
40 end
41
42 R = {COMMUNITY = community, COMMUNITY_URL = homepage, LEASETIME = leasetime, ACCEPT = tostring(translate("Accept"))}
43
44 splashtext = expand(luci.fs.readfile("/usr/lib/luci-splash/splashtext.html"))
45 %>
46
47 <%=splashtext%>
48