modules/freifunk: Add ipv6 options to community profile form

This commit is contained in:
Manuel Munz 2012-08-20 11:14:13 +00:00
parent 1f1aaf1a66
commit 9e33e992c9

View file

@ -1,7 +1,7 @@
--[[ --[[
LuCI - Lua Configuration Interface LuCI - Lua Configuration Interface
Copyright 2011 Manuel Munz <freifunk at somakoma dot de> Copyright 2011-2012 Manuel Munz <freifunk at somakoma dot de>
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -11,6 +11,7 @@ You may obtain a copy of the License at
]]-- ]]--
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
local ipkg = require "luci.model.ipkg"
local community = uci:get("freifunk", "community", "name") local community = uci:get("freifunk", "community", "name")
luci.i18n.loadc("freifunk") luci.i18n.loadc("freifunk")
@ -22,12 +23,12 @@ else
m = Map(community, translate("Community settings"), translate("These are the settings of your local community.")) m = Map(community, translate("Community settings"), translate("These are the settings of your local community."))
c = m:section(NamedSection, "profile", "community") c = m:section(NamedSection, "profile", "community")
name = c:option(Value, "name", "Name") local name = c:option(Value, "name", "Name")
name.rmempty = false name.rmempty = false
homepage = c:option(Value, "homepage", translate("Homepage")) local homepage = c:option(Value, "homepage", translate("Homepage"))
cc = c:option(Value, "country", translate("Country code")) local cc = c:option(Value, "country", translate("Country code"))
function cc.cfgvalue(self, section) function cc.cfgvalue(self, section)
return uci:get(community, "wifi_device", "country") return uci:get(community, "wifi_device", "country")
end end
@ -38,22 +39,43 @@ else
end end
end end
ssid = c:option(Value, "ssid", translate("ESSID")) local ssid = c:option(Value, "ssid", translate("ESSID"))
ssid.rmempty = false ssid.rmempty = false
prefix = c:option(Value, "mesh_network", translate("Mesh prefix")) local prefix = c:option(Value, "mesh_network", translate("Mesh prefix"))
prefix.datatype = "ip4addr"
prefix.rmempty = false prefix.rmempty = false
splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses")) local splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses"))
splash_net.datatype = "ip4addr"
splash_net.rmempty = false splash_net.rmempty = false
splash_prefix = c:option(Value, "splash_prefix", translate("Client network size")) local splash_prefix = c:option(Value, "splash_prefix", translate("Client network size"))
splash_prefix.datatype = "range(0,32)"
splash_prefix.rmempty = false splash_prefix.rmempty = false
lat = c:option(Value, "latitude", translate("Latitude")) local ipv6 = c:option(Flag, "ipv6", translate("Enable IPv6"))
ipv6.rmempty = true
local ipv6_config = c:option(ListValue, "ipv6_config", translate("IPv6 Config"))
ipv6_config:depends("ipv6", 1)
ipv6_config:value("static")
if ipkg.installed ("auto-ipv6-ib") then
ipv6_config:value("auto-ipv6-random")
ipv6_config:value("auto-ipv6-fromv4")
end
ipv6_config.rmempty = true
local ipv6_prefix = c:option(Value, "ipv6_prefix", translate("IPv6 Prefix"), translate("IPv6 network in CIDR notation."))
ipv6_prefix:depends("ipv6", 1)
ipv6_prefix.datatype = "ip6addr"
ipv6_prefix.rmempty = true
local lat = c:option(Value, "latitude", translate("Latitude"))
lat.datatype = "range(-180, 180)"
lat.rmempty = false lat.rmempty = false
lon = c:option(Value, "longitude", translate("Longitude")) local lon = c:option(Value, "longitude", translate("Longitude"))
lon.rmempty = false lon.rmempty = false
return m return m
end end