Small bug fixes
[project/luci.git] / libs / cbi / luasrc / cbi.lua
index fed53f6..9a32dd6 100644 (file)
@@ -162,6 +162,15 @@ function Map.__init__(self, config, ...)
        end
 end
 
+function Map.render(self, ...)
+       if self.stateful then
+               uci.load_state(self.config)
+       else
+               uci.load_config(self.config)
+       end
+       Node.render(self, ...)
+end
+
 
 -- Chain foreign config
 function Map.chain(self, config)
@@ -710,7 +719,15 @@ end
 
 -- Add a dependencie to another section field
 function AbstractValue.depends(self, field, value)
-       table.insert(self.deps, {field=field, value=value})
+       local deps
+       if type(field) == "string" then
+               deps = {}
+               deps[field] = value
+       else
+               deps = field
+       end
+       
+       table.insert(self.deps, {deps=deps, add=""})
 end
 
 -- Generates the unique CBID
@@ -897,10 +914,14 @@ function ListValue.__init__(self, ...)
        self.widget = "select"
 end
 
-function ListValue.value(self, key, val)
+function ListValue.value(self, key, val, ...)
        val = val or key
        table.insert(self.keylist, tostring(key))
        table.insert(self.vallist, tostring(val))
+       
+       for i, deps in ipairs({...}) do
+               table.insert(self.deps, {add = "-"..key, deps=deps})
+       end
 end
 
 function ListValue.validate(self, val)