cbi.lua: Implement "readonly" property for "Value" 529/head
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>
Sat, 31 Oct 2015 22:09:40 +0000 (23:09 +0100)
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>
Sat, 31 Oct 2015 22:09:40 +0000 (23:09 +0100)
cbi.lua: Implement "readonly" property for "Value"

Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
modules/luci-base/luasrc/cbi.lua

index 1aa00eed9e8aeb2e1bc588203015033f5082fb5a..b5b2c8d8f201b5ca1cd3aec091720adfc83a0074 100644 (file)
@@ -1471,6 +1471,7 @@ function Value.__init__(self, ...)
        self.template  = "cbi/value"
        self.keylist = {}
        self.vallist = {}
+       self.readonly = nil
 end
 
 function Value.reset_values(self)
@@ -1484,6 +1485,10 @@ function Value.value(self, key, val)
        table.insert(self.vallist, tostring(val))
 end
 
+function Value.parse(self, section, novld)
+       if self.readonly then return end
+       AbstractValue.parse(self, section, novld)
+end
 
 -- DummyValue - This does nothing except being there
 DummyValue = class(AbstractValue)