if not instanceof(map, Node) then
error("CBI map returns no valid map object!")
return nil
+ else
+ map:prepare()
end
end
end
end
+-- Prepare nodes
+function Node.prepare(self, ...)
+ for k, child in ipairs(self.children) do
+ child:prepare(...)
+ end
+end
+
-- Append child nodes
function Node.append(self, obj)
table.insert(self.children, obj)
self.default = nil
self.size = nil
self.optional = false
+end
+function AbstractValue.prepare(self)
-- Use defaults from UVL
if not self.override_scheme
and self.map:get_scheme(self.section.sectiontype, self.option) then
self.vallist = {}
self.size = 1
self.widget = "select"
+end
+function ListValue.prepare(self, ...)
+ AbstractValue.prepare(self, ...)
if not self.override_scheme
and self.map:get_scheme(self.section.sectiontype, self.option) then
local vs = self.map:get_scheme(self.section.sectiontype, self.option)
- if self.value and vs.values and not self.override_values then
- if self.rmempty or self.optional then
- self:value("")
- end
- for k, v in pairs(vs.values) do
+ if self.value and vs.valuelist and not self.override_values then
+ for k, v in ipairs(vs.valuelist) do
local deps = {}
if not self.override_dependencies
- and vs.enum_depends and vs.enum_depends[k] then
- for i, dep in ipairs(vs.enum_depends[k]) do
+ and vs.enum_depends and vs.enum_depends[v.value] then
+ for i, dep in ipairs(vs.enum_depends[v.value]) do
table.insert(deps, _uvl_strip_remote_dependencies(dep))
end
end
- self:value(k, v, unpack(deps))
+ self:value(v.value, v.title or v.value, unpack(deps))
end
end
end
if hwtype == "atheros" then
mode = s:option(ListValue, "mode", translate("mode"))
+ mode.override_values = true
mode:value("", "auto")
mode:value("11b", "802.11b")
mode:value("11g", "802.11g")
end
encr = s:option(ListValue, "encryption", translate("encryption"))
+encr.override_values = true
encr:value("none", "No Encryption")
encr:value("wep", "WEP")