summaryrefslogtreecommitdiffhomepage
path: root/libs/cbi/luasrc/cbi.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-17 18:32:53 +0000
committerSteven Barth <steven@midlink.org>2008-08-17 18:32:53 +0000
commit97ce1ad8adf935e2aa0d1b13f07b16d2d950053f (patch)
treed5eafec4b6996a6dc64046fd1d46a8f299cd4246 /libs/cbi/luasrc/cbi.lua
parent1d08361bea91c11ba2f82f3ab3004c067ebabc85 (diff)
Preparing rewrite of WiFi configuration
Diffstat (limited to 'libs/cbi/luasrc/cbi.lua')
-rw-r--r--libs/cbi/luasrc/cbi.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index fed53f6ee..6cc090882 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -710,7 +710,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 +905,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)