Update my email addresses in the license headers
[project/luci.git] / modules / luci-mod-freifunk / luasrc / view / freifunk / index.htm
1 <%#
2 Copyright 2008 Steven Barth <steven@midlink.org>
3 Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
4 Licensed to the public under the Apache License 2.0.
5 -%>
6
7 <%+header%>
8 <%
9 local uci = require "luci.model.uci".cursor()
10 local tpl = require "luci.template"
11 local fs = require "nixio.fs"
12 local ff = {}
13 local ff = uci:get_all("freifunk")
14
15 if not ff or not ff.community.name then
16 community = "Freifunk"
17 DefaultText = ""
18 nickname = "No Nickname set"
19 else
20 community = ff.community.name
21 DefaultText = ff.community.DefaultText
22 nickname = ff.contact.nickname
23 end
24
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"
28
29
30 local usertext = fs.readfile("/www/luci-static/index_user.html")
31
32 if DefaultText ~= "disabled" then
33
34 defaulttext = '<h2><a id="content" name="content">'..
35 (translate("Hello and welcome in the network of"))..
36 ' '..
37 (community or "Freifunk Deutschland")..
38 '!</a></h2><p>'..
39 translate("We are an initiative to establish a free, independent and open wireless mesh network.")..
40 '<br />'..
41 translate("This is the access point")..
42 ' '..
43 luci.sys.hostname()..
44 '. '..
45 translate("It is operated by")..
46 ' <a href="'..
47 luci.dispatcher.build_url("freifunk", "contact")..
48 '">'..
49 (nickname or translate("Please set your contact information"))..
50 '</a>.</p><p>'..
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>'..
55 translate("Notice")..
56 '</strong>: '..
57 translate("Internet access depends on technical and organisational conditions and may or may not work for you.")..
58 '</p>'
59 end
60 %>
61
62 <%=defaulttext%>
63 <%=usertext%>
64
65 <%
66 -- add custom widgets from view/freifunk/widgets
67 local widgets = {}
68 local dir = "/usr/lib/lua/luci/view/freifunk/widgets"
69
70 uci:foreach("freifunk-widgets", "widget",
71 function(s)
72 if s.enabled == "1" then
73 table.insert(widgets, s)
74 end
75 end)
76
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 })
80 end
81 end
82
83 %>
84 <%+footer%>