X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-splash%2Fluasrc%2Fview%2Fsplash%2Fsplash.htm;h=9e79b106637e237f910bf8ebd68df3ea3578944d;hp=72f58c2f10cb4156af8c4e27738b9aaaaced0525;hb=3c3e3128bb209401c3d0f20a52599aaf8e29a113;hpb=ec846b538d8717c67fe299624f838b2339c71cc5 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 Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz 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 = "

" .. 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.") .. "

" 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 %> + +

<%:Welcome%>

+ +

<%:You are now connected to the free wireless mesh network%> <%=community%>. + <%:Please note that we are not an internet service provider but an experimental community network.%>

+

<%: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:%>

+
    +
  • <%:use filesharing applications on this network%>
  • +
  • <%:waste bandwidth with unneccesary downloads or streams%>
  • +
  • <%:perform any kind of illegal activities%>
  • +
+
+ + <% if limit_up and limit_down then %> + <%=limit_text%> + <% end %> + +

<%:If you use this network on a regular basis we ask for your support:%>

+ +

<%: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%>