b3eddc615086e55f5700426df08f743a4ac283e5
[project/luci.git] / applications / luci-app-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 "nixio.fs"
15 local has_custom_splash = fs.access("/usr/lib/luci-splash/splashtext.html")
16 local has_custom_splashinclude = fs.access("/usr/lib/luci-splash/splashtextinclude.html")
17
18 function expand (e, R)        
19         return (string.gsub(e, "###([A-Z_]+)###", R))
20 end
21
22 local community, homepage, leasetime, limit_up, limit_down
23
24 local contacturl = luci.dispatcher.build_url("freifunk", "contact")
25
26 local c = luci.model.uci.cursor():get_all("freifunk", "community")
27 if c and c.name then
28         name = luci.model.uci.cursor():get('profile_' .. c.name, 'profile', 'name')
29         if name then
30                 community = name
31         else
32                 community = c.name
33         end
34 else
35         community = "Freifunk"
36 end
37
38 if c and c.homepage then
39         homepage = c.homepage
40 else
41         homepage = "http://freifunk.net"
42 end
43
44 local s = luci.model.uci.cursor():get_all("luci_splash", "general")
45 if s then
46         leasetime = s.leasetime or ""
47         limit_up = s.limit_up or nil
48         limit_down = s.limit_down or nil
49 end
50
51 local limit_text = ""
52 if limit_up and limit_down then
53         limit_text = "<p>" .. translate("Your bandwidth is limited to") .. " " .. limit_down .. "/" .. limit_up ..
54         " " .. translate("KB/s (Download/Upload). You may be able to remove this limit by actively contributing " ..
55         "to this project.") .. "</p>"
56 end
57
58 local contact = translate('Get in %s with the operator of this access point.')
59 contact = contact % ('<a href="' .. contacturl .. '">' .. translatef('Contact') .. '</a>')
60
61 local accepttext = translate('By accepting these rules you can use this network for %s hour(s). After this time you need to accept these rules again.')
62 accepttext = accepttext % leasetime
63
64
65 if has_custom_splash then
66         local R = {
67                 COMMUNITY = community,
68                 COMMUNITY_URL = homepage,
69                 LEASETIME = leasetime,
70                 ACCEPT = tostring(translate("Accept")),
71                 LIMIT = limit_text,
72                 CONTACTURL = contacturl
73         }
74         local splashtext = expand(fs.readfile("/usr/lib/luci-splash/splashtext.html"), R)
75         %>
76         <%=splashtext%>
77
78 <% else %>
79
80         <h2><a id="content" name="content"><%:Welcome%></a></h2>
81
82         <p><%:You are now connected to the free wireless mesh network%> <a href="<%=homepage%>"><%=community%></a>.
83         <%:Please note that we are not an internet service provider but an experimental community network.%></p>
84         <p><%:Access to the internet might be possible nevertheless, because some activists of this project share their
85         private internet connections. These few connections are shared between all users. That means available bandwidth
86         is limited and because of this we ask you not to do any of the following:%></p>
87         <ul>
88                 <li><%:use filesharing applications on this network%></li>
89                 <li><%:waste bandwidth with unneccesary downloads or streams%></li>
90                 <li><%:perform any kind of illegal activities%></li>
91         </ul>
92         <br />
93
94         <% if limit_up and limit_down then %>
95                 <%=limit_text%>
96         <% end %>
97         
98         <p><%:If you use this network on a regular basis we ask for your support:%></p>
99         <ul>
100                 <li><a href="<%=homepage%>"><%:Become an active member of this community and help by operating your own node%></a></li>
101                 <li><%=contact%></li>
102                 <li><%:Donate some money to help us keep this project alive.%></li>
103                 <li><%:If you operate your own wifi equipment use channels different from ours.%></li>
104         </ul>
105
106         <%
107         if has_custom_splashinclude then
108                 local splashtextinclude = fs.readfile("/usr/lib/luci-splash/splashtextinclude.html")
109         %>
110                 <%=splashtextinclude%>
111         <% end %>
112
113         <h2><%:Usage Agreement%></h2>
114         <p>
115         <%:The open and free wireless network of volunteers ("Operators") provides the necessary equipment and Internet connections ("Infrastructure") at their own expense.%>
116         <%:These Terms of Use govern the use of the network by its participants' computer, PDA, or similar device ("Devices") within the network.%>
117         <%:Access to the network is not guaranteed. It can be interrupted at any time without notice for any reason, for certain devices, and/or may be blocked for certain users.%>
118         </p>
119
120         <h3><%:Legally Prohibited Activities%></h3>
121         <p><%:The participant agrees to not perform any action and refrain from acts which may violate the law or infringe upon the rights of third parties.%></p>
122  
123         <h3><%:Legally Prohibited content%></h3>
124         <p><%:The participant agrees to not transfer content over the network which violates the law.%></p>
125  
126         <h3><%:Fair Use Policy%></h3>
127         <p><%:The participant agrees to not use the network in any way which will harm the infrastructure, the network itself, its operators or other participants.%></p>
128  
129         <h3><%:Safety%></h3>
130         <p><%:The network, like the Internet, is unencrypted and open. Each participant is responsible for the safety of their own connections and devices.%></p>
131  
132         <h3>Disclaimer</h3>
133         <p><%:The operator claims no liability for loss of data, unauthorized access/damage to devices, or financial losses that participants may suffer from the use of the network.%></p>
134
135         <br /><p><b><%=accepttext%></b></p>
136 <% end %>
137
138
139