diff options
Diffstat (limited to 'applications')
3 files changed, 67 insertions, 40 deletions
diff --git a/applications/luci-splash/luasrc/model/cbi/splash/splashtext.lua b/applications/luci-splash/luasrc/model/cbi/splash/splashtext.lua index 453942152..82ba0b9db 100644 --- a/applications/luci-splash/luasrc/model/cbi/splash/splashtext.lua +++ b/applications/luci-splash/luasrc/model/cbi/splash/splashtext.lua @@ -17,7 +17,10 @@ luci.i18n.loadc("splash") local splashtextfile = "/usr/lib/luci-splash/splashtext.html" -f = SimpleForm("splashtext", translate("Edit Splash text"), translate("You can change the text that is displayed to clients here.<br /> It is possible to use the following markers: ###COMMUNITY###, ###COMMUNITY_URL###, ###LEASETIME### and ###ACCEPT###.<br />Click here to <a href='/luci/splash/'>test the splash page</a> after you saved it.")) +f = SimpleForm("splashtext", translate("Edit Splash text"), + translate("You can enter your own text that is displayed to clients here.<br />" .. + "It is possible to use the following markers: " .. + "###COMMUNITY###, ###COMMUNITY_URL###, ###CONTACTURL###, ###LEASETIME###, ###LIMIT### and ###ACCEPT###.")) t = f:field(TextValue, "text") t.rmempty = true diff --git a/applications/luci-splash/luasrc/view/splash/splash.htm b/applications/luci-splash/luasrc/view/splash/splash.htm index 72f58c2f1..9e79b1066 100644 --- a/applications/luci-splash/luasrc/view/splash/splash.htm +++ b/applications/luci-splash/luasrc/view/splash/splash.htm @@ -2,23 +2,26 @@ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> +Copyright 2011 Manuel Munz <freifunk at somakoma dot de> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - -%> <% -require("luci.fs") +local fs = require "luci.fs" +local has_custom_splash = fs.access("/usr/lib/luci-splash/splashtext.html") function expand (e) return (string.gsub(e, "###([A-Z_]+)###", R)) end +local community, homepage, leasetime, limit_up, limit_down, R + +local contacturl = luci.dispatcher.build_url("freifunk", "contact") + local c = luci.model.uci.cursor():get_all("freifunk", "community") if c and c.name then community = c.name @@ -33,16 +36,64 @@ else end local s = luci.model.uci.cursor():get_all("luci_splash", "general") -if s and s.leasetime then - leasetime = s.leasetime -else - leasetime = "" +if s then + leasetime = s.leasetime or "" + limit_up = s.limit_up or nil + limit_down = s.limit_down or nil +end + +local limit_text = "" +if limit_up and limit_down then + limit_text = "<p>" .. translate("Your bandwidth is limited to") .. " " .. limit_down .. "/" .. limit_up .. + " " .. translate("KB/s (Download/Upload). You may be able to remove this limit by actively contributing " .. + "to this project.") .. "</p>" end -R = {COMMUNITY = community, COMMUNITY_URL = homepage, LEASETIME = leasetime, ACCEPT = tostring(translate("Accept"))} +if has_custom_splash then + + R = { + COMMUNITY = community, + COMMUNITY_URL = homepage, + LEASETIME = leasetime, + ACCEPT = tostring(translate("Accept")), + LIMIT = limit_text, + CONTACTURL = contacturl + } + + local splashtext = expand(fs.readfile("/usr/lib/luci-splash/splashtext.html")) + %> + <%=splashtext%> + +<% else %> + + <h2><a id="content" name="content"><%:Welcome%></a></h2> + + <p><%:You are now connected to the free wireless mesh network%> <a href="<%=homepage%>"><%=community%></a>. + <%:Please note that we are not an internet service provider but an experimental community network.%></p> + <p><%:Access to the internet might be possible nevertheless, because some activists of this project share their + private internet connections. These few connections are shared between all users. That means available bandwidth + is limited and because of this we ask you not to do any of the following:%></p> + <ul> + <li><%:use filesharing applications on this network%></li> + <li><%:waste bandwidth with unneccesary downloads or streams%></li> + <li><%:perform any kind of illegal activities%></li> + </ul> + <br /> + + <% if limit_up and limit_down then %> + <%=limit_text%> + <% end %> + + <p><%:If you use this network on a regular basis we ask for your support:%></p> + <ul> + <li><a href="<%=homepage%>"><%:Become an active member of this community and help by operating your own node%></a></li> + <li><a href="<%=contacturl%>"><%:Contact%></a> <%:the owner of this access point.%></li> + <li><%:Donate some money to help us keep this project alive.%></li> + <li><%:If you operate your own wifi equipment use channels different from ours.%> + </ul> + <br/><p><%:By accepting these rules you can use this network for%> <%=leasetime%> + <%:hour(s). After this time you need to accept these rules again.%> +<% end %> -splashtext = expand(luci.fs.readfile("/usr/lib/luci-splash/splashtext.html")) -%> -<%=splashtext%> diff --git a/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html b/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html deleted file mode 100644 index 8075393e7..000000000 --- a/applications/luci-splash/root/usr/lib/luci-splash/splashtext.html +++ /dev/null @@ -1,27 +0,0 @@ -<h2><a id="content" name="content">Willkommen!</a></h2> -<p> -Du bist jetzt mit dem freien Funknetz <a href="###COMMUNITY_URL###">###COMMUNITY###</a> verbunden.<br /> -Wir sind ein experimentelles Gemeinschaftsnetzwerk, aber kein Internetanbieter. -</p> - -Ein Zugang <strong>ins Internet</strong> ist trotzdem möglich, -da einige Freifunker ihre privaten Internetzugänge zur Verfügung stellen. -Diese Zugänge müssen sich hier alle teilen. -Bitte sei Dir dessen bewusst und verhalte Dich dementsprechend: -<ul> -<li>bitte <strong>keine Filesharing-Programme</strong> betreiben!</li> -<li>bitte <strong>keine unnötigen Downloads oder Streams</strong> starten!</li> -<li>bitte <strong>keine illegalen Aktivitäten</strong>!</li> -</ul> - -Wenn Du unsere Idee gut findest und das Netz regelmässig benutzt, dann bitten wir Dich um Unterstützung: -<ul> -<li><a href="###COMMUNITY_URL###">Werde selbst Freifunker oder teile deinen Internetzugang!</a></li> -<li>Spende ein paar Euro, damit wir unser Netz weiter betreiben und ausbauen können.</li> -<li>Wenn Du andere WLAN-Geräte betreibst nutze dafür bitte andere Kanäle als wir.</li> -</ul> - -<p> -Mit einem Klick auf <em>###ACCEPT###</em> kannst du für ###LEASETIME### Stunde(n) -unser Netz verwenden. Dann wirst du erneut aufgefordet, diese Bedingungen zu akzeptieren. -</p> |