2 Copyright 2008 Steven Barth <steven@midlink.org>
3 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
4 Licensed to the public under the Apache License 2.0.
9 local uci = require "luci.model.uci".cursor()
10 local tpl = require "luci.template"
11 local fs = require "nixio.fs"
13 local ff = uci:get_all("freifunk")
15 if not ff or not ff.community.name then
16 community = "Freifunk"
18 nickname = "No Nickname set"
20 community = ff.community.name
21 DefaultText = ff.community.DefaultText
22 nickname = ff.contact.nickname
25 local co = "profile_" .. community
26 --local community = uci:get_first(co, "community", "name") or "Freifunk"
27 local url = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net"
30 local usertext = fs.readfile("/www/luci-static/index_user.html")
32 if DefaultText ~= "disabled" then
34 defaulttext = '<h2><a id="content" name="content">'..
35 (translate("Hello and welcome in the network of"))..
37 (community or "Freifunk Deutschland")..
39 translate("We are an initiative to establish a free, independent and open wireless mesh network.")..
41 translate("This is the access point")..
45 translate("It is operated by")..
47 luci.dispatcher.build_url("freifunk", "contact")..
49 (nickname or translate("Please set your contact information"))..
51 translate("You can find further information about the global Freifunk initiative at")..
52 ' <a href="http://freifunk.net">Freifunk.net</a>.<br />'..
53 translate("If you are interested in our project then contact the local community")..
54 ' <a href="'..url..'">'..community..'</a>.</p><p><strong>'..
57 translate("Internet access depends on technical and organisational conditions and may or may not work for you.")..
66 -- add custom widgets from view/freifunk/widgets
68 local dir = "/usr/lib/lua/luci/view/freifunk/widgets"
70 uci:foreach("freifunk-widgets", "widget",
72 if s.enabled == "1" then
73 table.insert(widgets, s)
77 for k, v in ipairs(widgets) do
78 if v['template'] and fs.access(dir .. "/" .. v['template'] .. "/main.htm") then
79 tpl.render("freifunk/widgets/" .. v['template'] .. "/main", { data = v })