Freifunk: Make the splash page editable
This commit is contained in:
parent
b054595412
commit
5da3e251c0
6 changed files with 105 additions and 30 deletions
|
@ -2,5 +2,6 @@
|
||||||
|
|
||||||
[ -n "${IPKG_INSTROOT}" ] || {
|
[ -n "${IPKG_INSTROOT}" ] || {
|
||||||
/etc/init.d/luci_splash enabled || /etc/init.d/luci_splash enable
|
/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
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
2
applications/luci-splash/ipkg/postrm
Normal file
2
applications/luci-splash/ipkg/postrm
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
uci del luci.flash_keep.splashtext;uci commit
|
|
@ -1,7 +1,11 @@
|
||||||
module("luci.controller.splash.splash", package.seeall)
|
module("luci.controller.splash.splash", package.seeall)
|
||||||
|
|
||||||
function index()
|
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").target = call("action_dispatch")
|
||||||
node("splash", "activate").target = call("action_activate")
|
node("splash", "activate").target = call("action_activate")
|
||||||
|
|
|
@ -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
|
|
@ -12,36 +12,37 @@ You may obtain a copy of the License at
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
-%>
|
-%>
|
||||||
<% local c = luci.model.uci.cursor():get_all("freifunk", "community") %>
|
<%
|
||||||
|
require("luci.fs")
|
||||||
|
|
||||||
<h2><a id="content" name="content">Willkommen!</a></h2>
|
function expand (e)
|
||||||
<p>
|
return (string.gsub(e, "###([A-Z_]+)###", R))
|
||||||
Du bist jetzt mit dem freien Funknetz
|
end
|
||||||
<a href="<%=c.homepage%>"><%=c.name%></a> verbunden.<br />
|
|
||||||
Wir sind ein experimentelles Gemeinschaftsnetzwerk, aber kein Internetanbieter.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
local c = luci.model.uci.cursor():get_all("freifunk", "community")
|
||||||
Ein Zugang <strong>ins Internet</strong> ist trotzdem möglich,
|
if c and c.name then
|
||||||
da einige Freifunker ihre privaten Internetzugänge zur Verfügung stellen.
|
community = c.name
|
||||||
Diese Zugänge müssen sich hier alle teilen.
|
else
|
||||||
Bitte sei Dir dessen bewusst und verhalte Dich dementsprechend:
|
community = "Freifunk"
|
||||||
<ul>
|
end
|
||||||
<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>
|
if c and c.homepage then
|
||||||
Wenn Du unsere Idee gut findest, kannst Du uns unterstützen:
|
homepage = c.homepage
|
||||||
<ul>
|
else
|
||||||
<li><a href="<%=c.homepage%>">Werde selbst Freifunker oder teile deinen Internetzugang!</a></li>
|
homepage = "http://freifunk.net"
|
||||||
<li>Betreibe deine anderen WLAN-Geräte <em>NICHT</em> auf den Kanälen 1-5, diese stören oft unser Netz.</li>
|
end
|
||||||
</ul>
|
|
||||||
</p>
|
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>
|
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in a new issue