Merge pull request #2449 from pmelange/backport/PR2448-luci_mod-freifunk_get_all
Backport 18.06: luci-mod-freifunk: replace calls to get_all() with separate get() calls
This commit is contained in:
commit
8fe6f04d61
3 changed files with 15 additions and 37 deletions
|
@ -1,22 +1,15 @@
|
||||||
<%+header%>
|
<%+header%>
|
||||||
<%
|
<%
|
||||||
local uci = require "luci.model.uci".cursor()
|
local uci = require "luci.model.uci".cursor()
|
||||||
local contact = uci:get_all("freifunk", "contact")
|
local nickname = uci:get("freifunk", "contact", "nickname") or ""
|
||||||
|
local name = uci:get("freifunk", "contact", "name") or ""
|
||||||
|
local mail = uci:get("freifunk", "contact", "mail") or ""
|
||||||
local contacturl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "contact")
|
local contacturl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "contact")
|
||||||
local hostname = uci:get_first ("system", "system", "hostname")
|
local hostname = uci:get_first ("system", "system", "hostname")
|
||||||
local latitude = uci:get_first ("system", "system", "latitude")
|
local latitude = uci:get_first ("system", "system", "latitude")
|
||||||
local longitude = uci:get_first ("system", "system", "longitude")
|
local longitude = uci:get_first ("system", "system", "longitude")
|
||||||
local location = uci:get_first ("system", "system", "location")
|
local location = uci:get_first ("system", "system", "location")
|
||||||
local basicsurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "basics")
|
local basicsurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "basics")
|
||||||
local nickname, name, mail
|
|
||||||
if not contact then
|
|
||||||
nickname, name, mail = ""
|
|
||||||
else
|
|
||||||
nickname = contact.nickname
|
|
||||||
name = contact.name
|
|
||||||
mail = contact.mail
|
|
||||||
end
|
|
||||||
|
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<h2><%:Freifunk Overview%></h2>
|
<h2><%:Freifunk Overview%></h2>
|
||||||
|
|
|
@ -9,22 +9,15 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
local uci = require "luci.model.uci".cursor()
|
local uci = require "luci.model.uci".cursor()
|
||||||
local contact = uci:get_all("freifunk", "contact")
|
local nickname = uci:get("freifunk", "contact", "nickname") or ""
|
||||||
local nickname, name, mail, phone, location, note
|
local name = uci:get("freifunk", "contact", "name") or ""
|
||||||
local lon = uci:get_first("system", "system", "longitude")
|
local homepage = uci:get("freifunk", "contact", "homepage") or {}
|
||||||
local lat = uci:get_first("system", "system", "latitude")
|
local mail = uci:get("freifunk", "contact", "mail") or ""
|
||||||
|
local phone = uci:get("freifunk", "contact", "phone") or ""
|
||||||
if not contact then
|
local location = uci:get_first("system", "system", "locaton") or uci:get("freifunk", "contact", "location") or ""
|
||||||
nickname, name, homepage, mail, phone, location, note = ""
|
local note = uci:get("freifunk", "contact", "note") or ""
|
||||||
else
|
local lon = uci:get_first("system", "system", "longitude") or ""
|
||||||
nickname = contact.nickname or ""
|
local lat = uci:get_first("system", "system", "latitude") or ""
|
||||||
name = contact.name or ""
|
|
||||||
homepage = contact.homepage or {}
|
|
||||||
mail = contact.mail or ""
|
|
||||||
phone = contact.phone or ""
|
|
||||||
location = uci:get_first("system", "system", "location") or contact.location
|
|
||||||
note = contact.note or ""
|
|
||||||
end
|
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<h2 name="content"><%:Contact%></h2>
|
<h2 name="content"><%:Contact%></h2>
|
||||||
|
|
|
@ -9,18 +9,10 @@
|
||||||
local uci = require "luci.model.uci".cursor()
|
local uci = require "luci.model.uci".cursor()
|
||||||
local tpl = require "luci.template"
|
local tpl = require "luci.template"
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
local ff = {}
|
|
||||||
local ff = uci:get_all("freifunk")
|
|
||||||
|
|
||||||
if not ff or not ff.community.name then
|
local community = uci:get("freifunk", "community", "name") or "Freifunk"
|
||||||
community = "Freifunk"
|
local DefaultText = uci:get("freifunk", "community", "DefaultText") or ""
|
||||||
DefaultText = ""
|
local nickname = uci:get("freifunk", "contact", "nickname") or "No Nickname set"
|
||||||
nickname = "No Nickname set"
|
|
||||||
else
|
|
||||||
community = ff.community.name
|
|
||||||
DefaultText = ff.community.DefaultText
|
|
||||||
nickname = ff.contact.nickname
|
|
||||||
end
|
|
||||||
|
|
||||||
local co = "profile_" .. community
|
local co = "profile_" .. community
|
||||||
--local community = uci:get_first(co, "community", "name") or "Freifunk"
|
--local community = uci:get_first(co, "community", "name") or "Freifunk"
|
||||||
|
|
Loading…
Reference in a new issue