X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Ffreifunk%2Fluasrc%2Fview%2Ffreifunk%2Findex.htm;h=d1862bd3a6d725c2b52e4c53baff8e205ca0eadd;hp=d4af849ebc51561a90f12e3b9246f27f261f576c;hb=613de9b48f0aa8bf7fb170080d4ceb103702425d;hpb=5c31a68a53e636c36e74426e2b6c70debf33ac89 diff --git a/modules/freifunk/luasrc/view/freifunk/index.htm b/modules/freifunk/luasrc/view/freifunk/index.htm index d4af849ebc..d1862bd3a6 100644 --- a/modules/freifunk/luasrc/view/freifunk/index.htm +++ b/modules/freifunk/luasrc/view/freifunk/index.htm @@ -13,12 +13,85 @@ $Id$ -%> <%+header%> -<% local ff = luci.model.uci.cursor():get_all("freifunk") %> -

<%:ff_hellonet%> <%=ff.community.name or 'Freifunk Deutschland'%>!

-

<%:ff_public1%>
-<%:ff_public2%><%=luci.sys.hostname()%>. <%:ff_public3%> -<%=ff.contact.nickname or 'anonym'%>.

-

<%:ff_public4%> Freifunk.net.
-<%:ff_public5%> <%=ff.community.name or 'Freifunk'%>.

-

<%:note%>: <%:ff_public6%>

+<% +local uci = require "luci.model.uci".cursor() +local tpl = require "luci.template" +local fs = require "luci.fs" +local ff = {} +local ff = uci:get_all("freifunk") + +if not ff or not ff.community.name then + community = "Freifunk" + DefaultText = "" + nickname = "No Nickname set" +else + community = ff.community.name + DefaultText = ff.community.DefaultText + nickname = ff.contact.nickname +end + +local co = "profile_" .. community +--local community = uci:get_first(co, "community", "name") or "Freifunk" +local url = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net" + + +local usertext = fs.readfile("/www/luci-static/index_user.html") + +if DefaultText ~= "disabled" then + + defaulttext = '

'.. + (translate("Hello and welcome in the network of")).. + ' '.. + (community or "Freifunk Deutschland").. + '!

'.. + translate("We are an initiative to establish a free, independent and open wireless mesh network.").. + '
'.. + translate("This is the access point").. + ' '.. + luci.sys.hostname().. + '. '.. + translate("It is operated by").. + ' '.. + (nickname or translate("Please set your contact information")).. + '.

'.. + translate("You can find further information about the global Freifunk initiative at").. + ' Freifunk.net.
'.. + translate("If you are interested in our project then contact the local community").. + ' '..community..'.

'.. + translate("Notice").. + ': '.. + translate("Internet access depends on technical and organisational conditions and may or may not work for you.").. + '

' +end +%> + +<%=defaulttext%> +<%=usertext%> + +<% +-- add custom widgets from view/freifunk/widgets +local widgets = {} +local dir = "/usr/lib/lua/luci/view/freifunk/widgets" + +uci:foreach("freifunk-widgets", "widget", + function(s) + if s.enabled == "1" then + local name = s[".name"] + widgets[name] = s + end + end) + +local function cmp(a, b) + return (widgets[a].order or 100) > (widgets[b].order or 100) +end + +for k, v in luci.util.spairs(widgets, function(a,b) return (tonumber(widgets[a].order) < tonumber(widgets[b].order)) end) do + if v['template'] and fs.access(dir .. "/" .. v['template'] .. "/main.htm") then + tpl.render("freifunk/widgets/" .. v['template'] .. "/main", { name = k, data = v }) + end +end + +%> <%+footer%>