From 0ef557b15c766817ed2e9f90634153cde121205e Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Wed, 2 Nov 2011 08:45:40 +0000 Subject: [PATCH] modules/freifunk: Fix errors on index and contact pages when running the Development Environment --- modules/freifunk/luasrc/view/freifunk/contact.htm | 25 ++++++++++++++++------- modules/freifunk/luasrc/view/freifunk/index.htm | 21 +++++++++++++------ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/modules/freifunk/luasrc/view/freifunk/contact.htm b/modules/freifunk/luasrc/view/freifunk/contact.htm index 72d868b66..23a5e7b1a 100644 --- a/modules/freifunk/luasrc/view/freifunk/contact.htm +++ b/modules/freifunk/luasrc/view/freifunk/contact.htm @@ -16,9 +16,20 @@ You may obtain a copy of the License at <% local uci = require "luci.model.uci".cursor() local contact = uci:get_all("freifunk", "contact") -local location = uci:get_first("system", "system", "location") or contact.location +local nickname, name, mail, phone, location, note local lon = uci:get_first("system", "system", "longitude") local lat = uci:get_first("system", "system", "latitude") + +if not contact then + nickname, name, mail, phone, location, note = "" +else + nickname = contact.nickname or "" + name = contact.name or "" + mail = contact.mail or "" + phone = contact.phone or "" + location = uci:get_first("system", "system", "location") or contact.location + note = contact.note or "" +end %>

<%:Contact%>

@@ -26,10 +37,10 @@ local lat = uci:get_first("system", "system", "latitude")
<%:Operator%> - - - - + + + +
<%:Nickname%>:<%=contact.nickname%>
<%:Realname%>:<%=contact.name%>
<%:E-Mail%>:<%=contact.mail%>
<%:Phone%>:<%=contact.phone%>
<%:Nickname%>:<%=nickname%>
<%:Realname%>:<%=name%>
<%:E-Mail%>:<%=mail%>
<%:Phone%>:<%=phone%>
@@ -41,11 +52,11 @@ local lat = uci:get_first("system", "system", "latitude") -<% if contact.note then %> +<% if note then %>
<%:Notice%> - +
<%=contact.note%>
<%=note%>
<%end%> diff --git a/modules/freifunk/luasrc/view/freifunk/index.htm b/modules/freifunk/luasrc/view/freifunk/index.htm index 82261e56e..e13d7f9c2 100644 --- a/modules/freifunk/luasrc/view/freifunk/index.htm +++ b/modules/freifunk/luasrc/view/freifunk/index.htm @@ -15,19 +15,28 @@ $Id$ <%+header%> <% local uci = require "luci.model.uci".cursor() +local ff = {} local ff = uci:get_all("freifunk") -if not ff.community.name then - ff.community.name = "" + +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_" .. ff.community.name -local community = uci:get_first(co, "community", "name") or "Freifunk" + +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" require("luci.fs") local usertext = luci.fs.readfile("/www/luci-static/index_user.html") -if (ff.community.DefaultText or "") ~= "disabled" then +if DefaultText ~= "disabled" then defaulttext = '

'.. (translate("Hello and welcome in the network of")).. @@ -44,7 +53,7 @@ if (ff.community.DefaultText or "") ~= "disabled" then ' '.. - (ff.contact.nickname or translate("Please set your contact information")).. + (nickname or translate("Please set your contact information")).. '.

'.. translate("You can find further information about the global Freifunk initiative at").. ' Freifunk.net.
'.. -- 2.11.0