Freifunk: Make the splash page editable

This commit is contained in:
Manuel Munz 2010-11-17 22:59:08 +00:00
parent b054595412
commit 5da3e251c0
6 changed files with 105 additions and 30 deletions

View file

@ -2,5 +2,6 @@
[ -n "${IPKG_INSTROOT}" ] || {
/etc/init.d/luci_splash enabled || /etc/init.d/luci_splash enable
uci set luci.flash_keep.splashtext="/usr/lib/luci-splash/splashtext.html";uci commit
exit 0
}

View file

@ -0,0 +1,2 @@
#!/bin/sh
uci del luci.flash_keep.splashtext;uci commit

View file

@ -1,7 +1,11 @@
module("luci.controller.splash.splash", package.seeall)
function index()
entry({"admin", "services", "splash"}, cbi("splash/splash"), "Client-Splash")
require("luci.i18n")
luci.i18n.loadc("freifunk")
entry({"admin", "services", "splash"}, cbi("splash/splash"), luci.i18n.translate("Client-Splash"), 90)
entry({"admin", "services", "splash", "splashtext" }, form("splash/splashtext"), luci.i18n.translate("Splashtext"), 10)
node("splash").target = call("action_dispatch")
node("splash", "activate").target = call("action_activate")

View file

@ -0,0 +1,36 @@
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
Copyright 2010 Manuel Munz <freifunk@somakoma.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
]]--
local fs = require "nixio.fs"
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."))
t = f:field(TextValue, "text")
t.rmempty = true
t.rows = 30
function t.cfgvalue()
return fs.readfile(splashtextfile) or ""
end
function f.handle(self, state, data)
if state == FORM_VALID then
if data.text then
fs.writefile(splashtextfile, data.text:gsub("\r\n", "\n"))
end
end
return true
end
return f

View file

@ -12,36 +12,37 @@ You may obtain a copy of the License at
$Id$
-%>
<% local c = luci.model.uci.cursor():get_all("freifunk", "community") %>
<%
require("luci.fs")
<h2><a id="content" name="content">Willkommen!</a></h2>
<p>
Du bist jetzt mit dem freien Funknetz
<a href="<%=c.homepage%>"><%=c.name%></a> verbunden.<br />
Wir sind ein experimentelles Gemeinschaftsnetzwerk, aber kein Internetanbieter.
</p>
function expand (e)
return (string.gsub(e, "###([A-Z_]+)###", R))
end
<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>
</p>
local c = luci.model.uci.cursor():get_all("freifunk", "community")
if c and c.name then
community = c.name
else
community = "Freifunk"
end
<p>
Wenn Du unsere Idee gut findest, kannst Du uns unterstützen:
<ul>
<li><a href="<%=c.homepage%>">Werde selbst Freifunker oder teile deinen Internetzugang!</a></li>
<li>Betreibe deine anderen WLAN-Geräte <em>NICHT</em> auf den Kanälen 1-5, diese stören oft unser Netz.</li>
</ul>
</p>
if c and c.homepage then
homepage = c.homepage
else
homepage = "http://freifunk.net"
end
local s = luci.model.uci.cursor():get_all("luci_splash", "general")
if s and s.leasetime then
leasetime = s.leasetime
else
leasetime = ""
end
R = {COMMUNITY = community, COMMUNITY_URL = homepage, LEASETIME = leasetime, ACCEPT = tostring(translate("Accept"))}
splashtext = expand(luci.fs.readfile("/usr/lib/luci-splash/splashtext.html"))
%>
<%=splashtext%>
<p>
Mit einem Klick auf <em><%:Accept%></em> kannst du für <%=c.leasetime%> Stunden
über unser Netz das Internet verwenden. Dann wirst du erneut aufgefordet, diese Bedingungen zu akzeptieren.
</p>

View file

@ -0,0 +1,31 @@
<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>
<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>
</p>
<p>
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 selbst privat genutzte WLAN-Geräte betreibst nutze dafür bitte andere Kanäle als wir.</li>
</ul>
</p>
<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>