modules/freifunk: Fix errors on index and contact pages when running the Development...
[project/luci.git] / modules / freifunk / luasrc / view / freifunk / index.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15 <%+header%>
16 <% 
17 local uci = require "luci.model.uci".cursor()
18 local ff = {}
19 local ff = uci:get_all("freifunk")
20
21 if not ff or not ff.community.name then
22         community = "Freifunk"
23         DefaultText = ""
24         nickname = "No Nickname set"
25 else
26         community = ff.community.name
27         DefaultText = ff.community.DefaultText
28         nickname = ff.contact.nickname
29 end
30
31 local co = "profile_" .. community
32 --local community = uci:get_first(co, "community", "name") or "Freifunk"
33 local url = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net"
34
35
36 require("luci.fs")
37 local usertext = luci.fs.readfile("/www/luci-static/index_user.html")
38
39 if DefaultText ~= "disabled" then
40
41         defaulttext = '<h2><a id="content" name="content">'..
42         (translate("Hello and welcome in the network of"))..
43         ' '..
44         (community or "Freifunk Deutschland")..
45         '!</a></h2><p>'..
46         translate("We are an initiative to establish a free, independent and open wireless mesh network.")..
47         '<br />'..
48         translate("This is the access point")..
49         ' '..
50         luci.sys.hostname()..
51         '. '..
52         translate("It is operated by")..
53         ' <a href="'..
54         luci.dispatcher.build_url("freifunk", "contact")..
55         '">'..
56         (nickname or translate("Please set your contact information"))..
57         '</a>.</p><p>'..
58         translate("You can find further information about the global Freifunk initiative at")..
59         ' <a href="http://freifunk.net">Freifunk.net</a>.<br />'..
60         translate("If you are interested in our project then contact the local community")..
61         ' <a href="'..url..'">'..community..'</a>.</p><p><strong>'..
62         translate("Notice")..
63         '</strong>: '..
64         translate("Internet access depends on technical and organisational conditions and may or may not work for you.")..
65         '</p>'
66 end
67 %>
68
69 <%=defaulttext%>
70 <%=usertext%>
71
72 <%+footer%>