bfcbfc4706ccb4c8ac3b7c20db33f523f77c2841
[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 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12 -%>
13 <%
14 local fs = require "luci.fs"
15 local has_custom_splash = fs.access("/usr/lib/luci-splash/splashtext.html")
16
17 function expand (e)
18 return (string.gsub(e, "###([A-Z_]+)###", R))
19 end
20
21 local community, homepage, leasetime, limit_up, limit_down, R
22
23 local contacturl = luci.dispatcher.build_url("freifunk", "contact")
24
25 local c = luci.model.uci.cursor():get_all("freifunk", "community")
26 if c and c.name then
27 community = c.name
28 else
29 community = "Freifunk"
30 end
31
32 if c and c.homepage then
33 homepage = c.homepage
34 else
35 homepage = "http://freifunk.net"
36 end
37
38 local s = luci.model.uci.cursor():get_all("luci_splash", "general")
39 if s then
40 leasetime = s.leasetime or ""
41 limit_up = s.limit_up or nil
42 limit_down = s.limit_down or nil
43 end
44
45 local limit_text = ""
46 if limit_up and limit_down then
47 limit_text = "<p>" .. translate("Your bandwidth is limited to") .. " " .. limit_down .. "/" .. limit_up ..
48 " " .. translate("KB/s (Download/Upload). You may be able to remove this limit by actively contributing " ..
49 "to this project.") .. "</p>"
50 end
51
52 if has_custom_splash then
53
54 R = {
55 COMMUNITY = community,
56 COMMUNITY_URL = homepage,
57 LEASETIME = leasetime,
58 ACCEPT = tostring(translate("Accept")),
59 LIMIT = limit_text,
60 CONTACTURL = contacturl
61 }
62
63 local splashtext = expand(fs.readfile("/usr/lib/luci-splash/splashtext.html"))
64 %>
65 <%=splashtext%>
66
67 <% else %>
68
69 <h2><a id="content" name="content"><%:Welcome%></a></h2>
70
71 <p><%:You are now connected to the free wireless mesh network%> <a href="<%=homepage%>"><%=community%></a>.
72 <%:Please note that we are not an internet service provider but an experimental community network.%></p>
73 <p><%:Access to the internet might be possible nevertheless, because some activists of this project share their
74 private internet connections. These few connections are shared between all users. That means available bandwidth
75 is limited and because of this we ask you not to do any of the following:%></p>
76 <ul>
77 <li><%:use filesharing applications on this network%></li>
78 <li><%:waste bandwidth with unneccesary downloads or streams%></li>
79 <li><%:perform any kind of illegal activities%></li>
80 </ul>
81 <br />
82
83 <% if limit_up and limit_down then %>
84 <%=limit_text%>
85 <% end %>
86
87 <p><%:If you use this network on a regular basis we ask for your support:%></p>
88 <ul>
89 <li><a href="<%=homepage%>"><%:Become an active member of this community and help by operating your own node%></a></li>
90 <li><a href="<%=contacturl%>"><%:Contact%></a> <%:the owner of this access point.%></li>
91 <li><%:Donate some money to help us keep this project alive.%></li>
92 <li><%:If you operate your own wifi equipment use channels different from ours.%></li>
93 </ul>
94 <br/><p><%:By accepting these rules you can use this network for%> <%=leasetime%>
95 <%:hour(s). After this time you need to accept these rules again.%></br>
96 <% end %>
97
98
99