* Merged Luci to use native UCI-library

This commit is contained in:
Steven Barth 2008-06-05 19:16:38 +00:00
parent 75f3dbaa61
commit dd9606825d
32 changed files with 346 additions and 398 deletions

View file

@ -11,233 +11,220 @@ function action_wizard()
end end
local ifaces = {} local ifaces = {}
local wldevs = luci.model.uci.sections("wireless") luci.model.uci.foreach("wireless", "wifi-device",
function(section)
if wldevs then table.insert(ifaces, section[".name"])
for k, v in pairs(wldevs) do end)
if v[".type"] == "wifi-device" then
table.insert(ifaces, k)
end
end
end
luci.template.render("freifunk/wizard", {ifaces=ifaces}) luci.template.render("freifunk/wizard", {ifaces=ifaces})
end end
function configure_freifunk() function configure_freifunk()
local ip = luci.http.formvalue("ip") local ip = luci.http.formvalue("ip")
local uci = luci.model.uci.Session() local uci = luci.model.uci
local cfg = uci.config
-- Load UCI
uci:t_load("network")
uci:t_load("dhcp")
uci:t_load("freifunk")
uci:t_load("luci_splash")
uci:t_load("olsr")
uci:t_load("wireless")
uci:t_load("luci_fw")
-- Configure FF-Interface -- Configure FF-Interface
uci:t_del("network", "ff") uci.delete("network", "ff")
uci:t_del("network", "ffdhcp") uci.delete("network", "ffdhcp")
uci:t_set("network", "ff", nil, "interface") cfg.network.ff = "interface"
uci:t_set("network", "ff", "type", "bridge") cfg.network.ff.type = "bridge"
uci:t_set("network", "ff", "proto", "static") cfg.network.ff.proto = "static"
uci:t_set("network", "ff", "ipaddr", ip) cfg.network.ff.ipaddr = ip
uci:t_set("network", "ff", "netmask", uci:t_get("freifunk", "community", "mask")) cfg.network.ff.netmask = cfg.freifunk.community.mask
uci:t_set("network", "ff", "dns", uci:t_get("freifunk", "community", "dns")) cfg.network.ff.dns = cfg.freifunk.community.dns
-- Reset Routing -- Reset Routing
local routing = uci:t_sections("luci_fw") uci.foreach("luci_fw", "routing",
if routing then function (section)
for k, v in pairs(routing) do if section.iface == "ff" or section.oface == "ff" then
if v[".type"] == "routing" and (v.iface == "ff" or v.oface == "ff") then uci.delete("luci_fw", section[".name"])
uci:t_del("luci_fw", k)
end end
end end)
local int = uci:t_add("luci_fw", "routing") if cfg.luci_fw then
uci:t_set("luci_fw", int, "iface", "ff") cfg.luci_fw[""] = "routing"
uci:t_set("luci_fw", int, "oface", "ff") cfg.luci_fw[""].iface = "ff"
uci:t_set("luci_fw", int, "fwd", "1") cfg.luci_fw[""].oface = "ff"
cfg.luci_fw[""].fwd = "1"
end end
-- Routing from Internal -- Routing from Internal
local iface = luci.http.formvalue("frominternal") local iface = luci.http.formvalue("frominternal")
if iface and iface ~= "" then if iface and iface ~= "" then
local routing = uci:t_sections("luci_fw") uci.foreach("luci_fw", "routing",
if routing then function (section)
for k, v in pairs(routing) do if section.iface == iface and section.oface == "ff" then
if v[".type"] == "routing" and (v.iface == iface and v.oface == "ff") then uci.delete("luci_fw", section[".name"])
uci:t_del("luci_fw", k)
end end
end end)
local int = uci:t_add("luci_fw", "routing") if cfg.luci_fw then
uci:t_set("luci_fw", int, "iface", iface) cfg.luci_fw[""] = "routing"
uci:t_set("luci_fw", int, "oface", "ff") cfg.luci_fw[""].iface = iface
uci:t_set("luci_fw", int, "fwd", "1") cfg.luci_fw[""].oface = "ff"
uci:t_set("luci_fw", int, "nat", "1") cfg.luci_fw[""].fwd = "1"
end cfg.luci_fw[""].nat = "1"
end
end end
-- Routing to External -- Routing to External
local iface = luci.http.formvalue("toexternal") local iface = luci.http.formvalue("toexternal")
if iface and iface ~= "" then if iface and iface ~= "" then
local routing = uci:t_sections("luci_fw") uci.foreach("luci_fw", "routing",
if routing then function (section)
for k, v in pairs(routing) do if section.oface == iface and section.iface == "ff" then
if v[".type"] == "routing" and (v.oface == iface and v.iface == "ff") then uci.delete("luci_fw", section[".name"])
uci:t_del("luci_fw", k)
end end
end end)
local int = uci:t_add("luci_fw", "routing") if cfg.luci_fw then
uci:t_set("luci_fw", int, "iface", "ff") cfg.luci_fw[""] = "routing"
uci:t_set("luci_fw", int, "oface", iface) cfg.luci_fw[""].oface = iface
uci:t_set("luci_fw", int, "fwd", "1") cfg.luci_fw[""].iface = "ff"
uci:t_set("luci_fw", int, "nat", "1") cfg.luci_fw[""].fwd = "1"
end cfg.luci_fw[""].nat = "1"
end
end end
-- Configure DHCP -- Configure DHCP
if luci.http.formvalue("dhcp") then if luci.http.formvalue("dhcp") then
local dhcpnet = uci:t_get("freifunk", "community", "dhcp"):match("^([0-9]+)") local dhcpnet = cfg.freifunk.community.dhcp:match("^([0-9]+)")
local dhcpip = ip:gsub("^[0-9]+", dhcpnet) local dhcpip = ip:gsub("^[0-9]+", dhcpnet)
uci:t_set("network", "ffdhcp", nil, "interface") cfg.network.ffdhcp = "interface"
uci:t_set("network", "ffdhcp", "proto", "static") cfg.network.ffdhcp.proto = "static"
uci:t_set("network", "ffdhcp", "ifname", "br-ff:dhcp") cfg.network.ffdhcp.ifname = "br-ff:dhcp"
uci:t_set("network", "ffdhcp", "ipaddr", dhcpip) cfg.network.ffdhcp.ipaddr = dhcpip
uci:t_set("network", "ffdhcp", "netmask", uci:t_get("freifunk", "community", "dhcpmask")) cfg.network.ffdhcp.netmask = cfg.freifunk.community.dhcpmask
local dhcp = uci:t_sections("dhcp") uci.foreach("dhcp", "dhcp",
if dhcp then function (section)
for k, v in pairs(dhcp) do if section.interface == "ffdhcp" then
if v[".type"] == "dhcp" and v.interface == "ffdhcp" then uci.delete("dhcp", section[".name"])
uci:t_del("dhcp", k)
end end
end end)
local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4 local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4
local sk = uci:t_add("dhcp", "dhcp")
uci:t_set("dhcp", sk, "interface", "ffdhcp")
uci:t_set("dhcp", sk, "start", dhcpbeg)
uci:t_set("dhcp", sk, "limit", (dhcpbeg < 252) and 3 or 2)
uci:t_set("dhcp", sk, "leasetime", "30m")
end
local splash = uci:t_sections("luci_splash") cfg.dhcp[""] = "dhcp"
if splash then cfg.dhcp[""].interface = "ffdhcp"
for k, v in pairs(splash) do cfg.dhcp[""].start = dhcpbeg
if v[".type"] == "iface" then cfg.dhcp[""].limit = (dhcpbeg < 252) and 3 or 2
uci:t_del("luci_splash", k) cfg.dhcp[""].leasetime = "30m"
end
end
local sk = uci:t_add("luci_splash", "iface")
uci:t_set("luci_splash", sk, "network", "ffdhcp")
end
local routing = uci:t_sections("luci_fw")
if routing then uci.foreach("luci_splash", "iface",
for k, v in pairs(routing) do function (section)
if v[".type"] == "routing" and (v.iface == "ffdhcp" or v.oface == "ffdhcp") then if section.network == "ffdhcp" then
uci:t_del("luci_fw", k) uci.delete("luci_splash", section[".name"])
end end
end end)
local int = uci:t_add("luci_fw", "routing") if cfg.luci_splash then
uci:t_set("luci_fw", int, "iface", "ffdhcp") cfg.luci_splash[""] = "iface"
uci:t_set("luci_fw", int, "oface", "ff") cfg.luci_splash[""].network = "ffdhcp"
uci:t_set("luci_fw", int, "nat", "1") end
uci.foreach("luci_fw", "routing",
function (section)
if section.iface == "ffdhcp" or section.oface == "ffdhcp" then
uci.delete("luci_fw", section[".name"])
end
end)
if cfg.luci_fw then
cfg.luci_fw[""] = "routing"
cfg.luci_fw[""].iface = "ffdhcp"
cfg.luci_fw[""].oface = "ff"
cfg.luci_fw[""].nat = "1"
local iface = luci.http.formvalue("toexternal") local iface = luci.http.formvalue("toexternal")
if iface and iface ~= "" then if iface and iface ~= "" then
local int = uci:t_add("luci_fw", "routing") cfg.luci_fw[""] = "routing"
uci:t_set("luci_fw", int, "iface", "ffdhcp") cfg.luci_fw[""].iface = "ffdhcp"
uci:t_set("luci_fw", int, "oface", iface) cfg.luci_fw[""].oface = iface
uci:t_set("luci_fw", int, "nat", "1") cfg.luci_fw[""].nat = "1"
end end
end end
end end
-- Configure OLSR -- Configure OLSR
if luci.http.formvalue("olsr") and uci:t_sections("olsr") then if luci.http.formvalue("olsr") and cfg.olsr then
for k, v in pairs(uci:t_sections("olsr")) do uci.foreach("olsr", "Interface",
if v[".type"] == "Interface" or v[".type"] == "LoadPlugin" then function (section)
uci:t_del("olsr", k) uci.delete("olsr", section[".name"])
end end)
end
uci.foreach("olsr", "LoadPlugin",
function (section)
uci.delete("olsr", section[".name"])
end)
if luci.http.formvalue("shareinet") then if luci.http.formvalue("shareinet") then
uci:t_set("olsr", "dyn_gw", nil, "LoadPlugin") cfg.olsr.dyn_gw = "LoadPlugin"
uci:t_set("olsr", "dyn_gw", "Library", "olsrd_dyn_gw.so.0.4") cfg.olsr.dyn_gw.Library = "olsrd_dyn_gw.so.0.4"
end end
uci:t_set("olsr", "nameservice", nil, "LoadPlugin") cfg.olsr.nameservice = "LoadPlugin"
uci:t_set("olsr", "nameservice", "Library", "olsrd_nameservice.so.0.3") cfg.olsr.nameservice.Library = "olsrd_nameservice.so.0.3"
uci:t_set("olsr", "nameservice", "name", ip:gsub("%.", "-")) cfg.olsr.nameservice.name = ip:gsub("%.", "-")
uci:t_set("olsr", "nameservice", "hosts_file", "/var/etc/hosts") cfg.olsr.nameservice.hosts_file = "/var/etc/hosts"
uci:t_set("olsr", "nameservice", "suffix", ".olsr") cfg.olsr.nameservice.suffix = ".olsr"
uci:t_set("olsr", "nameservice", "latlon_infile", "/tmp/latlon.txt") cfg.olsr.nameservice.latlon_infile = "/tmp/latlon.txt"
uci:t_set("olsr", "txtinfo", nil, "LoadPlugin") cfg.olsr.txtinfo = "LoadPlugin"
uci:t_set("olsr", "txtinfo", "Library", "olsrd_txtinfo.so.0.1") cfg.olsr.txtinfo.Library = "olsrd_txtinfo.so.0.1"
uci:t_set("olsr", "txtinfo", "Accept", "127.0.0.1") cfg.olsr.txtinfo.Accept = "127.0.0.1"
local oif = uci:t_add("olsr", "Interface") cfg.olsr[""] = "Interface"
uci:t_set("olsr", oif, "Interface", "ff") cfg.olsr[""].Interface = "ff"
uci:t_set("olsr", oif, "HelloInterval", "6.0") cfg.olsr[""].HelloInterval = "6.0"
uci:t_set("olsr", oif, "HelloValidityTime", "108.0") cfg.olsr[""].HelloValidityTime = "108.0"
uci:t_set("olsr", oif, "TcInterval", "4.0") cfg.olsr[""].TcInterval = "4.0"
uci:t_set("olsr", oif, "TcValidityTime", "324.0") cfg.olsr[""].TcValidityTime = "324.0"
uci:t_set("olsr", oif, "MidInterval", "18.0") cfg.olsr[""].MidInterval = "18.0"
uci:t_set("olsr", oif, "MidValidityTime", "324.0") cfg.olsr[""].MidValidityTime = "324.0"
uci:t_set("olsr", oif, "HnaInterval", "18.0") cfg.olsr[""].HnaInterval = "18.0"
uci:t_set("olsr", oif, "HnaValidityTime", "108.0") cfg.olsr[""].HnaValidityTime = "108.0"
end end
-- Configure Wifi -- Configure Wifi
local wcfg = uci:t_sections("wireless") if cfg.wireless then
if wcfg then uci.foreach("wireless", "wifi-device",
for iface, v in pairs(wcfg) do function (section)
if v[".type"] == "wifi-device" and luci.http.formvalue("wifi."..iface) then local device = section[".name"]
-- Cleanup
for k, j in pairs(wcfg) do if luci.http.formvalue("wifi."..iface) then
if j[".type"] == "wifi-iface" and j.device == iface then uci.foreach("wireless", "wifi-iface",
uci:t_del("wireless", k) function (section)
end if section.device == device then
uci.delete("wireless", section[".name"])
end
end)
end end
uci:t_set("wireless", iface, "disabled", "0") cfg.wireless[device].disabled = "0"
uci:t_set("wireless", iface, "mode", "11g") cfg.wireless[device].mode = "11g"
uci:t_set("wireless", iface, "txantenna", 1) cfg.wireless[device].txantenna = "1"
uci:t_set("wireless", iface, "rxantenna", 1) cfg.wireless[device].rxantenna = "1"
uci:t_set("wireless", iface, "channel", uci:t_get("freifunk", "community", "channel")) cfg.wireless[device].channel = cfg.freifunk.community.channel
local wif = uci:t_add("wireless", "wifi-iface") cfg.wireless[""] = "wifi-iface"
uci:t_set("wireless", wif, "device", iface) cfg.wireless[""].device = iface
uci:t_set("wireless", wif, "network", "ff") cfg.wireless[""].network = "ff"
uci:t_set("wireless", wif, "mode", "adhoc") cfg.wireless[""].mode = "adhoc"
uci:t_set("wireless", wif, "ssid", uci:t_get("freifunk", "community", "essid")) cfg.wireless[""].ssid = cfg.freifunk.community.essid
uci:t_set("wireless", wif, "bssid", uci:t_get("freifunk", "community", "bssid")) cfg.wireless[""].bssid = cfg.freifunk.community.bssid
uci:t_set("wireless", wif, "txpower", 13) cfg.wireless[""].txpower = 13
end end)
end
end end
-- Save UCI -- Save UCI
uci:t_save("network") uci.save()
uci:t_save("dhcp")
uci:t_save("freifunk")
uci:t_save("luci_splash")
uci:t_save("olsr")
uci:t_save("wireless")
uci:t_save("luci_fw")
luci.http.redirect(luci.dispatcher.build_url("admin", "uci", "changes")) luci.http.redirect(luci.dispatcher.build_url("admin", "uci", "changes"))
end end

View file

@ -26,7 +26,7 @@
<div class="cbi-value-title"><%:cfginternal Erlaube Zugriff von internem Netzwerk%>:</div> <div class="cbi-value-title"><%:cfginternal Erlaube Zugriff von internem Netzwerk%>:</div>
<div class="cbi-value-field"><select name="frominternal"> <div class="cbi-value-field"><select name="frominternal">
<option value=""></option> <option value=""></option>
<% for k, v in pairs(luci.model.uci.sections("network")) do <% for k, v in pairs(luci.model.uci.get_all("network")) do
if v[".type"] == "interface" and k ~= "loopback" then %> if v[".type"] == "interface" and k ~= "loopback" then %>
<option value="<%=k%>"<% if k == "lan" then %> selected="selected"<% end %>><%=k%></option> <option value="<%=k%>"<% if k == "lan" then %> selected="selected"<% end %>><%=k%></option>
<% end <% end
@ -37,7 +37,7 @@ end %>
<div class="cbi-value-title"><%:cfgexternal Erlaube Zugriff auf externes Netzwerk%>:</div> <div class="cbi-value-title"><%:cfgexternal Erlaube Zugriff auf externes Netzwerk%>:</div>
<div class="cbi-value-field"><select name="toexternal"> <div class="cbi-value-field"><select name="toexternal">
<option value=""></option> <option value=""></option>
<% for k, v in pairs(luci.model.uci.sections("network")) do <% for k, v in pairs(luci.model.uci.get_all("network")) do
if v[".type"] == "interface" and k ~= "loopback" then %> if v[".type"] == "interface" and k ~= "loopback" then %>
<option value="<%=k%>"<% if k == "wan" then %> selected="selected"<% end %>><%=k%></option> <option value="<%=k%>"<% if k == "wan" then %> selected="selected"<% end %>><%=k%></option>
<% end <% end

View file

@ -19,12 +19,13 @@ iface.optional = true
oface = s:option(ListValue, "oface", "Ausgangsschnittstelle") oface = s:option(ListValue, "oface", "Ausgangsschnittstelle")
oface.optional = true oface.optional = true
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
iface:value(k) if section[".name"] ~= "loopback" then
oface:value(k) iface:value(section[".name"])
end oface:value(section[".name"])
end end
end)
proto = s:option(ListValue, "proto", "Protokoll") proto = s:option(ListValue, "proto", "Protokoll")
proto.optional = true proto.optional = true

View file

@ -10,11 +10,12 @@ s.anonymous = true
iface = s:option(ListValue, "iface", "Schnittstelle", "Externe Schnittstelle") iface = s:option(ListValue, "iface", "Schnittstelle", "Externe Schnittstelle")
iface.default = "wan" iface.default = "wan"
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
iface:value(k) if section[".name"] ~= "loopback" then
end iface:value(section[".name"])
end end
end)
proto = s:option(ListValue, "proto", "Protokoll") proto = s:option(ListValue, "proto", "Protokoll")
proto:value("tcp", "TCP") proto:value("tcp", "TCP")

View file

@ -14,12 +14,13 @@ s.anonymous = true
iface = s:option(ListValue, "iface", "Eingang", "Eingangsschnittstelle") iface = s:option(ListValue, "iface", "Eingang", "Eingangsschnittstelle")
oface = s:option(ListValue, "oface", "Ausgang", "Ausgangsschnittstelle") oface = s:option(ListValue, "oface", "Ausgang", "Ausgangsschnittstelle")
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
iface:value(k) if section[".name"] ~= "loopback" then
oface:value(k) iface:value(section[".name"])
end oface:value(section[".name"])
end end
end)
s:option(Flag, "fwd", "FWD", "weiterleiten").rmempty = true s:option(Flag, "fwd", "FWD", "weiterleiten").rmempty = true
s:option(Flag, "nat", "NAT", "übersetzen").rmempty = true s:option(Flag, "nat", "NAT", "übersetzen").rmempty = true

View file

@ -11,11 +11,12 @@ s.addremove = true
s.anonymous = true s.anonymous = true
iface = s:option(ListValue, "network", "Schnittstelle") iface = s:option(ListValue, "network", "Schnittstelle")
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
iface:value(k) if section[".name"] ~= "loopback" then
end iface:value(section[".name"])
end end
end)
s = m:section(TypedSection, "whitelist", "Automatische Freigabe") s = m:section(TypedSection, "whitelist", "Automatische Freigabe")
s.addremove = true s.addremove = true

View file

@ -1,4 +1,4 @@
<% local c = luci.model.uci.sections("freifunk").community %> <% local c = luci.model.uci.get_all("freifunk", "community") %>
<h1><%:welcome Willkommen%>!</h1> <h1><%:welcome Willkommen%>!</h1>
<p> <p>

View file

@ -1,31 +1,33 @@
#!/usr/bin/haserl --shell=luac #!/usr/bin/haserl --shell=luac
package.path = "/usr/lib/lua/?.lua;/usr/lib/lua/?/init.lua;" .. package.path
package.cpath = "/usr/lib/lua/?.so;" .. package.cpath
require("luci.http") require("luci.http")
require("luci.sys") require("luci.sys")
require("luci.model.uci") require("luci.model.uci")
luci.model.uci.set_savedir(luci.model.uci.savedir_state)
local srv local srv
local net local net
local ip = luci.http.env.REMOTE_ADDR local ip = luci.http.env.REMOTE_ADDR
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and v.ipaddr then function (section)
local p = luci.sys.net.mask4prefix(v.netmask) if section.ipaddr then
if luci.sys.net.belongs(ip, v.ipaddr, p) then local p = luci.sys.net.mask4prefix(section.netmask)
net = k if luci.sys.net.belongs(ip, section.ipaddr, p) then
srv = v.ipaddr net = section[".name"]
break srv = section.ipaddr
return
end
end end
end end)
end
local stat = false local stat = false
for k, v in pairs(luci.model.uci.sections("luci_splash")) do luci.model.uci.foreach("luci_splash", "iface",
if v[".type"] == "iface" and v.network == net then function (section)
stat = true if section.network == net then
end stat = true
end end
end)
if not srv then if not srv then
luci.http.prepare_content("text/plain") luci.http.prepare_content("text/plain")

View file

@ -1,13 +1,13 @@
#!/usr/bin/lua #!/usr/bin/lua
package.path = "/usr/lib/lua/?.lua;/usr/lib/lua/?/init.lua;" .. package.path
package.cpath = "/usr/lib/lua/?.so;" .. package.cpath
require("luci.http") require("luci.http")
require("luci.sys") require("luci.sys")
require("luci.model.uci") require("luci.model.uci")
-- Init state session -- Init state session
uci = luci.model.uci.StateSession() luci.model.uci.set_savedir(luci.model.uci.savedir_state)
local uci = luci.model.uci
local cfg = uci.config
function main(argv) function main(argv)
@ -61,10 +61,12 @@ end
-- Add a lease to state and invoke add_rule -- Add a lease to state and invoke add_rule
function add_lease(mac) function add_lease(mac)
local key = uci:add("luci_splash", "lease") cfg.luci_splash[""] = "lease"
uci:set("luci_splash", key, "mac", mac) cfg.luci_splash[""].mac = mac
uci:set("luci_splash", key, "start", os.time()) cfg.luci_splash[""].start = os.time()
add_rule(mac) add_rule(mac)
uci.save()
end end
@ -72,12 +74,15 @@ end
function remove_lease(mac) function remove_lease(mac)
mac = mac:lower() mac = mac:lower()
for k, v in pairs(uci:sections("luci_splash")) do uci.foreach("luci_splash", "lease",
if v[".type"] == "lease" and v.mac:lower() == mac then function (section)
remove_rule(mac) if section.mac:lower() == mac then
uci:del("luci_splash", k) remove_rule(mac)
end uci.delete("luci_splash", section[".name"])
end end
end)
uci.save()
end end
@ -96,14 +101,17 @@ end
-- Check whether a MAC-Address is listed in the lease state list -- Check whether a MAC-Address is listed in the lease state list
function haslease(mac) function haslease(mac)
mac = mac:lower() mac = mac:lower()
local stat = false
for k, v in pairs(uci:sections("luci_splash")) do uci.foreach("luci_splash", "lease",
if v[".type"] == "lease" and v.mac and v.mac:lower() == mac then function (section)
return true if section.mac:lower() == mac then
end stat = true
end return
end
end)
return false return stat
end end
@ -111,11 +119,13 @@ end
function iswhitelisted(mac) function iswhitelisted(mac)
mac = mac:lower() mac = mac:lower()
for k, v in pairs(uci:sections("luci_splash")) do uci.foreach("luci_splash", "whitelist",
if v[".type"] == "whitelist" and v.mac and v.mac:lower() == mac then function (section)
return true if section.mac:lower() == mac then
end stat = true
end return
end
end)
return false return false
end end
@ -134,16 +144,14 @@ function sync()
local written = {} local written = {}
local time = os.time() local time = os.time()
uci:t_load("luci_splash")
-- Current leases in state files -- Current leases in state files
local leases = uci:t_sections("luci_splash") local leases = uci.get_all("luci_splash")
-- Convert leasetime to seconds -- Convert leasetime to seconds
local leasetime = tonumber(uci:t_get("luci_splash", "general", "leasetime")) * 3600 local leasetime = tonumber(cfg.luci_splash.general.leasetime) * 3600
-- Clean state file -- Clean state file
uci:t_revert("luci_splash") uci.revert("luci_splash")
-- For all leases -- For all leases
@ -154,9 +162,9 @@ function sync()
remove_rule(v.mac) remove_rule(v.mac)
else else
-- Rewrite state -- Rewrite state
local n = uci:t_add("luci_splash", "lease") cfg.luci_splash[""] = "lease"
uci:t_set("luci_splash", n, "mac", v.mac) cfg.luci_splash[""].mac = v.mac
uci:t_set("luci_splash", n, "start", v.start) cfg.luci_splash[""].start = v.start
written[v.mac:lower()] = 1 written[v.mac:lower()] = 1
end end
end end
@ -170,7 +178,7 @@ function sync()
end end
end end
uci:t_save("luci_splash") uci.save("luci_splash")
end end
main(arg) main(arg)

View file

@ -146,9 +146,9 @@ function statistics_render()
local vars = luci.http.formvalues() local vars = luci.http.formvalues()
local req = luci.dispatcher.request local req = luci.dispatcher.request
local path = luci.dispatcher.dispatched.path local path = luci.dispatcher.dispatched.path
local uci = luci.model.uci.Session() local uci = luci.model.uci
local spans = luci.util.split( uci:get( "luci_statistics", "collectd_rrdtool", "RRATimespans" ), "%s+", nil, true ) local spans = luci.util.split( uci.get( "luci_statistics", "collectd_rrdtool", "RRATimespans" ), "%s+", nil, true )
local span = vars.timespan or uci:get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1] local span = vars.timespan or uci.get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) ) local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) )
local plugin, instances local plugin, instances

View file

@ -18,8 +18,8 @@ module("luci.statistics.datatree", package.seeall)
local util = require("luci.util") local util = require("luci.util")
local sys = require("luci.sys") local sys = require("luci.sys")
local fs = require("luci.fs") local fs = require("luci.fs")
local uci = require("luci.model.uci").Session() local uci = require("luci.model.uci")
local sections = uci:sections( "luci_statistics" ) local sections = uci.get_all( "luci_statistics" )
Instance = util.class() Instance = util.class()

View file

@ -31,8 +31,8 @@ function Graph.__init__( self, timespan, opts )
opts = opts or { } opts = opts or { }
local uci = luci.model.uci.Session() local uci = luci.model.uci
local sections = uci:sections( "luci_statistics" ) local sections = uci.get_all( "luci_statistics" )
-- helper classes -- helper classes
self.colors = luci.statistics.rrdtool.colors.Instance() self.colors = luci.statistics.rrdtool.colors.Instance()

View file

@ -21,8 +21,8 @@ require("luci.sys.iptparser")
require("luci.util") require("luci.util")
local ipt = luci.sys.iptparser.IptParser() local ipt = luci.sys.iptparser.IptParser()
local uci = luci.model.uci.Session() local uci = luci.model.uci
local sections = uci:sections( "luci_statistics" ) local sections = uci.get_all( "luci_statistics" )
function section( plugin ) function section( plugin )

View file

@ -112,6 +112,7 @@ endef
define Package/luci-uci define Package/luci-uci
$(call Package/luci/libtemplate) $(call Package/luci/libtemplate)
DEPENDS+=+libuci-lua
TITLE:=High-Level UCI API TITLE:=High-Level UCI API
endef endef

View file

@ -1,3 +1,6 @@
uci_applied = "The following changes have been applied"
uci_reverted = "The following changes have been reverted"
a_i_ui = "User Interface" a_i_ui = "User Interface"
c_lucidesc = [[LuCI is a free Lua library with integrated MVC-Webframework and webinterface for embedded devices, c_lucidesc = [[LuCI is a free Lua library with integrated MVC-Webframework and webinterface for embedded devices,

View file

@ -31,9 +31,11 @@ require("luci.util")
require("luci.http") require("luci.http")
require("luci.model.uci") require("luci.model.uci")
local uci = luci.model.uci
local class = luci.util.class local class = luci.util.class
local instanceof = luci.util.instanceof local instanceof = luci.util.instanceof
-- Loads a CBI map from given file, creating an environment and returns it -- Loads a CBI map from given file, creating an environment and returns it
function load(cbimap) function load(cbimap)
require("luci.fs") require("luci.fs")
@ -141,18 +143,16 @@ function Map.__init__(self, config, ...)
self.config = config self.config = config
self.template = "cbi/map" self.template = "cbi/map"
self.uci = luci.model.uci.Session() if not uci.load(self.config) then
self.ucidata, self.uciorder = self.uci:sections(self.config)
if not self.ucidata or not self.uciorder then
error("Unable to read UCI data: " .. self.config) error("Unable to read UCI data: " .. self.config)
end end
end end
-- Use optimized UCI writing -- Use optimized UCI writing
function Map.parse(self, ...) function Map.parse(self, ...)
self.uci:t_load(self.config)
Node.parse(self, ...) Node.parse(self, ...)
self.uci:t_save(self.config) uci.save(self.config)
uci.unload(self.config)
end end
-- Creates a child section -- Creates a child section
@ -168,59 +168,31 @@ end
-- UCI add -- UCI add
function Map.add(self, sectiontype) function Map.add(self, sectiontype)
local name = self.uci:t_add(self.config, sectiontype) return uci.add(self.config, sectiontype)
if name then
self.ucidata[name] = {}
self.ucidata[name][".type"] = sectiontype
table.insert(self.uciorder, name)
end
return name
end end
-- UCI set -- UCI set
function Map.set(self, section, option, value) function Map.set(self, section, option, value)
local stat = self.uci:t_set(self.config, section, option, value) return uci.set(self.config, section, option or value, option and value)
if stat then
local val = self.uci:t_get(self.config, section, option)
if option then
self.ucidata[section][option] = val
else
if not self.ucidata[section] then
self.ucidata[section] = {}
end
self.ucidata[section][".type"] = val
table.insert(self.uciorder, section)
end
end
return stat
end end
-- UCI del -- UCI del
function Map.del(self, section, option) function Map.del(self, section, option)
local stat = self.uci:t_del(self.config, section, option) if option then
if stat then return uci.delete(self.config, section, option)
if option then else
self.ucidata[section][option] = nil return uci.delete(self.config, section)
else
self.ucidata[section] = nil
for i, k in ipairs(self.uciorder) do
if section == k then
table.remove(self.uciorder, i)
end
end
end
end end
return stat
end end
-- UCI get (cached) -- UCI get
function Map.get(self, section, option) function Map.get(self, section, option)
if not section then if not section then
return self.ucidata, self.uciorder return uci.get_all(self.config)
elseif option and self.ucidata[section] then elseif option then
return self.ucidata[section][option] return uci.get(self.config, section, option)
else else
return self.ucidata[section] return uci.get_all(self.config, section)
end end
end end
@ -396,15 +368,12 @@ end
-- Return all matching UCI sections for this TypedSection -- Return all matching UCI sections for this TypedSection
function TypedSection.cfgsections(self) function TypedSection.cfgsections(self)
local sections = {} local sections = {}
local map, order = self.map:get() uci.foreach(self.map.config, self.sectiontype,
function (section)
for i, k in ipairs(order) do if self:checkscope(section[".name"]) then
if map[k][".type"] == self.sectiontype then table.insert(sections, section[".name"])
if self:checkscope(k) then end
table.insert(sections, k) end)
end
end
end
return sections return sections
end end

View file

@ -37,6 +37,11 @@ local configs_mt = {}
local sections_mt = {} local sections_mt = {}
local options_mt = {} local options_mt = {}
savedir_default = "/tmp/.uci"
confdir_default = "/etc/config"
savedir_state = "/var/state"
config = {} config = {}
setmetatable(config, configs_mt) setmetatable(config, configs_mt)
@ -44,6 +49,9 @@ setmetatable(config, configs_mt)
function configs_mt.__index(self, key) function configs_mt.__index(self, key)
local node = rawget(self, key) local node = rawget(self, key)
if not node then if not node then
if not uci.load(key) then
return nil
end
node = {} node = {}
node[".name"] = key node[".name"] = key
setmetatable(node, sections_mt) setmetatable(node, sections_mt)

View file

@ -25,23 +25,7 @@ limitations under the License.
]]-- ]]--
local uci = require("luci.model.uci") module("luci.config",
local util = require("luci.util") function(m)
module("luci.config") setmetatable(m, {__index = require("luci.model.uci").get_all("luci")})
end)
-- Warning! This is only for fallback and compatibility purporses! --
main = {}
-- This is where stylesheets and images go
main.mediaurlbase = "/luci/media"
-- Does anybody think about browser autodetect here?
-- Too bad busybox doesn't populate HTTP_ACCEPT_LANGUAGE
main.lang = "de"
-- Now overwrite with UCI values
local ucidata = uci.sections("luci")
if ucidata then
util.update(_M, ucidata)
end

View file

@ -162,6 +162,7 @@ function dispatch()
tpl.viewns.uploadctrl = luci.http.dispatcher_upload() tpl.viewns.uploadctrl = luci.http.dispatcher_upload()
tpl.viewns.media = luci.config.main.mediaurlbase tpl.viewns.media = luci.config.main.mediaurlbase
tpl.viewns.resource = luci.config.main.resourcebase tpl.viewns.resource = luci.config.main.resourcebase
tpl.viewns.uci = require("luci.model.uci").config
tpl.viewns.REQUEST_URI = luci.http.env.SCRIPT_NAME .. luci.http.env.PATH_INFO tpl.viewns.REQUEST_URI = luci.http.env.SCRIPT_NAME .. luci.http.env.PATH_INFO

View file

@ -1,12 +1,5 @@
module("luci.controller.admin.system", package.seeall) module("luci.controller.admin.system", package.seeall)
require("luci.sys")
require("luci.http")
require("luci.util")
require("luci.fs")
require("luci.model.ipkg")
require("luci.model.uci")
function index() function index()
luci.i18n.loadc("admin-core") luci.i18n.loadc("admin-core")
local i18n = luci.i18n.translate local i18n = luci.i18n.translate
@ -65,7 +58,7 @@ function action_ipkg()
end end
function action_packages() function action_packages()
local ipkg = luci.model.ipkg local ipkg = require("luci.model.ipkg")
local void = nil local void = nil
local submit = luci.http.formvalue("submit") local submit = luci.http.formvalue("submit")
@ -190,6 +183,7 @@ function action_sshkeys()
end end
function action_upgrade() function action_upgrade()
require("luci.model.uci")
local ret = nil local ret = nil
local plat = luci.fs.mtime("/lib/upgrade/platform.sh") local plat = luci.fs.mtime("/lib/upgrade/platform.sh")
@ -199,7 +193,7 @@ function action_upgrade()
if plat and image then if plat and image then
local kpattern = nil local kpattern = nil
if keepcfg then if keepcfg then
local files = luci.model.uci.sections("luci").flash_keep local files = luci.model.uci.get_all("luci", "flash_keep")
if files.luci and files.luci.flash_keep then if files.luci and files.luci.flash_keep then
kpattern = "" kpattern = ""
for k,v in pairs(files.luci.flash_keep) do for k,v in pairs(files.luci.flash_keep) do

View file

@ -3,7 +3,7 @@ require("luci.util")
require("luci.sys") require("luci.sys")
function index() function index()
node("admin", "uci", "changes").target = template("admin_uci/changes") node("admin", "uci", "changes").target = call("action_changes")
node("admin", "uci", "revert").target = call("action_revert") node("admin", "uci", "revert").target = call("action_revert")
node("admin", "uci", "apply").target = call("action_apply") node("admin", "uci", "apply").target = call("action_apply")
end end
@ -21,7 +21,7 @@ function convert_changes(changes)
str = "" str = ""
val = "="..v val = "="..v
end end
str = str.."."..r str = r.."."..s
if o ~= ".type" then if o ~= ".type" then
str = str.."."..o str = str.."."..o
end end
@ -29,9 +29,14 @@ function convert_changes(changes)
end end
end end
end end
return table.concat(ret, "\n")
end
function action_changes()
local changes = convert_changes(luci.model.uci.changes())
luci.template.render("admin_uci/changes", {changes=changes})
end end
-- This function has a higher priority than the admin_uci/apply template
function action_apply() function action_apply()
local changes = luci.model.uci.changes() local changes = luci.model.uci.changes()
local output = "" local output = ""
@ -43,19 +48,15 @@ function action_apply()
-- Collect files to be applied and commit changes -- Collect files to be applied and commit changes
for r, tbl in pairs(changes) do for r, tbl in pairs(changes) do
if r then if r then
com[r] = true luci.model.uci.load(r)
luci.model.uci.commit(r)
luci.model.uci.unload(r)
if luci.config.uci_oncommit and luci.config.uci_oncommit[r] then if luci.config.uci_oncommit and luci.config.uci_oncommit[r] then
run[luci.config.uci_oncommit[r]] = true run[luci.config.uci_oncommit[r]] = true
end end
end end
end end
-- Apply
for config, i in pairs(com) do
luci.model.uci.commit(config)
end
-- Search for post-commit commands -- Search for post-commit commands
for cmd, i in pairs(run) do for cmd, i in pairs(run) do
output = output .. cmd .. ":" .. luci.sys.exec(cmd) .. "\n" output = output .. cmd .. ":" .. luci.sys.exec(cmd) .. "\n"
@ -73,15 +74,10 @@ function action_revert()
local revert = {} local revert = {}
-- Collect files to be reverted -- Collect files to be reverted
for r, tbl in ipairs(changes) do for r, tbl in pairs(changes) do
if r then luci.model.uci.load(r)
revert[r] = true luci.model.uci.revert(r)
end luci.model.uci.unload(r)
end
-- Revert them
for k, v in pairs(revert) do
luci.model.uci.revert(k)
end end
end end

View file

@ -10,12 +10,13 @@ s.addremove = true
s.anonymous = true s.anonymous = true
iface = s:option(ListValue, "interface", "Schnittstelle") iface = s:option(ListValue, "interface", "Schnittstelle")
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
iface:value(k) if section[".name"] ~= "loopback" then
s:depends("interface", k) -- Only change sections with existing interfaces iface:value(section[".name"])
end s:depends("interface", section[".name"])
end end
end)
s:option(Value, "start", "Start", "Erste vergebene Adresse (letztes Oktett)").rmempty = true s:option(Value, "start", "Start", "Erste vergebene Adresse (letztes Oktett)").rmempty = true

View file

@ -9,11 +9,12 @@ s.anonymous = true
s.template = "cbi/tblsection" s.template = "cbi/tblsection"
iface = s:option(ListValue, "interface", "Schnittstelle") iface = s:option(ListValue, "interface", "Schnittstelle")
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
iface:value(k) if section[".name"] ~= "loopback" then
end iface:value(section[".name"])
end end
end)
s:option(Value, "target", "Ziel", "Host-IP oder Netzwerk") s:option(Value, "target", "Ziel", "Host-IP oder Netzwerk")

View file

@ -51,11 +51,12 @@ i.dynamic = true
network = i:option(ListValue, "Interface", "Netzwerkschnittstellen") network = i:option(ListValue, "Interface", "Netzwerkschnittstellen")
network:value("") network:value("")
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
network:value(k) if section[".name"] ~= "loopback" then
end network:value(section[".name"])
end end
end)
i:option(Value, "HelloInterval", "Hello-Intervall") i:option(Value, "HelloInterval", "Hello-Intervall")

View file

@ -11,22 +11,19 @@ s.anonymous = true
s:option(Value, "ssid", translate("a_w_netid", "Netzkennung (ESSID)")).maxlength = 32 s:option(Value, "ssid", translate("a_w_netid", "Netzkennung (ESSID)")).maxlength = 32
device = s:option(ListValue, "device", translate("device", "Gerät")) device = s:option(ListValue, "device", translate("device", "Gerät"))
local d = luci.model.uci.sections("wireless") luci.model.uci.foreach("wireless", "wifi-device",
if d then function (section)
for k, v in pairs(d) do device:value(section[".name"])
if v[".type"] == "wifi-device" then end)
device:value(k)
end
end
end
network = s:option(ListValue, "network", translate("network", "Netzwerk"), translate("a_w_network1", "WLAN-Netz zu Netzwerk hinzufügen")) network = s:option(ListValue, "network", translate("network", "Netzwerk"), translate("a_w_network1", "WLAN-Netz zu Netzwerk hinzufügen"))
network:value("") network:value("")
for k, v in pairs(luci.model.uci.sections("network")) do luci.model.uci.foreach("network", "interface",
if v[".type"] == "interface" and k ~= "loopback" then function (section)
network:value(k) if section[".name"] ~= "loopback" then
end network:value(section[".name"])
end end
end)
mode = s:option(ListValue, "mode", translate("mode", "Modus")) mode = s:option(ListValue, "mode", translate("mode", "Modus"))
mode:value("ap", "Access Point") mode:value("ap", "Access Point")

View file

@ -10,12 +10,12 @@ speziell Netzwerkrouter unter OpenWRT. Luci steht unter der Apache-Lizenz.%></p>
<ul style="font-weight: bold"> <ul style="font-weight: bold">
<li><a href="mailto:steven-at-midlink-dot-org">Steven "Cyrus" Barth</a> (OpenWRT, Freifunk Halle)</li> <li><a href="mailto:steven-at-midlink-dot-org">Steven "Cyrus" Barth</a> (OpenWRT, Freifunk Halle)</li>
<li><a href="mailto:xm-at-leipzig.freifunk-dot-net">Jo-Philipp "Jow" Wich</a> (Freifunk Leipzig)</li> <li><a href="mailto:xm-at-leipzig.freifunk-dot-net">Jo-Philipp "Jow" Wich</a> (Freifunk Leipzig)</li>
<li><a href="mailto:nbd-at-openwrt-dot-org">Felix "nbd" Fietkau</a> (OpenWRT)</li>
</ul> </ul>
<br /> <br />
<h2><%:c_contributors Mitwirkende Entwickler%></h2> <h2><%:c_contributors Mitwirkende Entwickler%></h2>
<ul style="font-weight: bold"> <ul style="font-weight: bold">
<li><a href="mailto:nbd-at-openwrt-dot-org">Felix "nbd" Fietkau</a> (OpenWRT)</li>
</ul> </ul>
<br /> <br />

View file

@ -1,7 +1,7 @@
<%+header%> <%+header%>
<h1><%:config Konfiguration%></h1> <h1><%:config Konfiguration%></h1>
<h2><%:changes Änderungen%></h2> <h2><%:changes Änderungen%></h2>
<code><%=luci.model.uci.changes()%></code> <code><%=changes%></code>
<form class="inline" method="get" action="<%=controller%>/admin/uci/apply"> <form class="inline" method="get" action="<%=controller%>/admin/uci/apply">
<input type="submit" value="<%:apply Anwenden%>" /> <input type="submit" value="<%:apply Anwenden%>" />
</form> </form>

View file

@ -5,8 +5,7 @@ function index()
end end
function action_index() function action_index()
local uci = luci.model.uci.StateSession() local uci = luci.model.uci
luci.http.prepare_content("text/plain") luci.http.prepare_content("text/plain")
-- General -- General
@ -30,7 +29,7 @@ function action_index()
-- Freifunk -- Freifunk
local ff = uci:sections("freifunk") or {} local ff = uci.get_all("freifunk") or {}
for k, v in pairs(ff) do for k, v in pairs(ff) do
for i, j in pairs(v) do for i, j in pairs(v) do
if i:sub(1, 1) ~= "." then if i:sub(1, 1) ~= "." then

View file

@ -1,5 +1,5 @@
<%+header%> <%+header%>
<% local contact = luci.model.uci.sections("freifunk").contact %> <% local contact = luci.model.uci.get_all("freifunk", "contact") %>
<h1><%:contact Kontakt%></h1> <h1><%:contact Kontakt%></h1>
<table cellspacing="0" cellpadding="6"> <table cellspacing="0" cellpadding="6">
<tr><th><%:nickname Pseudonym%>:</th><td><%=contact.nickname%></td></tr> <tr><th><%:nickname Pseudonym%>:</th><td><%=contact.nickname%></td></tr>

View file

@ -1,5 +1,5 @@
<%+header%> <%+header%>
<% local ff = luci.model.uci.sections("freifunk") %> <% local ff = luci.model.uci.get_all("freifunk") %>
<h1><%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!</h1> <h1><%:hellonet Hallo und willkommen im Netz von%> <%=ff.community.name%>!</h1>
<p><%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%><br /> <p><%:public1 Wir sind eine Initiative zur Schaffung eines freien, offenen und unabhängigen Funknetzwerks auf WLAN-Basis.%><br />
<%:public2 Dies ist der Zugangspunkt %><%=luci.sys.hostname()%>. <%:public3 Er wird betrieben von %> <%:public2 Dies ist der Zugangspunkt %><%=luci.sys.hostname()%>. <%:public3 Er wird betrieben von %>

View file

@ -119,20 +119,16 @@ end
</div> </div>
<% <%
if "admin" == request[1] then if "admin" == request[1] then
require("luci.model.uci")
local ucic = 0 local ucic = 0
local changes = luci.model.uci.changes() for n, s in pairs(require("luci.model.uci").changes()) do
if type(changes) == "table" then -- XXX: sometimes string or nil / needs investigation for no, o in pairs(s) do
for n, s in pairs(changes) do ucic = ucic + 1;
for no, o in pairs(s) do
ucic = ucic + 1;
end
end end
end end
%> %>
<div><%:config Konfiguration%> <div><%:config Konfiguration%>
<ul> <ul>
<% if ucic then %> <% if ucic > 0 then %>
<li><a href="<%=controller%>/admin/uci/changes"><%:changes Änderungen%>: <%=ucic%></a></li> <li><a href="<%=controller%>/admin/uci/changes"><%:changes Änderungen%>: <%=ucic%></a></li>
<li><a href="<%=controller%>/admin/uci/apply"><%:apply Anwenden%></a></li> <li><a href="<%=controller%>/admin/uci/apply"><%:apply Anwenden%></a></li>
<li><a href="<%=controller%>/admin/uci/revert"><%:revert Verwerfen%></a></li> <li><a href="<%=controller%>/admin/uci/revert"><%:revert Verwerfen%></a></li>

View file

@ -119,20 +119,16 @@ end
</div> </div>
<% <%
if "admin" == request[1] then if "admin" == request[1] then
require("luci.model.uci")
local ucic = 0 local ucic = 0
local changes = luci.model.uci.changes() for n, s in pairs(require("luci.model.uci").changes()) do
if type(changes) == "table" then -- XXX: sometimes string or nil / needs investigation for no, o in pairs(s) do
for n, s in pairs(changes) do ucic = ucic + 1;
for no, o in pairs(s) do
ucic = ucic + 1;
end
end end
end end
%> %>
<div><%:config Konfiguration%> <div><%:config Konfiguration%>
<ul> <ul>
<% if ucic then %> <% if ucic > 0 then %>
<li><a href="<%=controller%>/admin/uci/changes"><%:changes Änderungen%>: <%=ucic%></a></li> <li><a href="<%=controller%>/admin/uci/changes"><%:changes Änderungen%>: <%=ucic%></a></li>
<li><a href="<%=controller%>/admin/uci/apply"><%:apply Anwenden%></a></li> <li><a href="<%=controller%>/admin/uci/apply"><%:apply Anwenden%></a></li>
<li><a href="<%=controller%>/admin/uci/revert"><%:revert Verwerfen%></a></li> <li><a href="<%=controller%>/admin/uci/revert"><%:revert Verwerfen%></a></li>