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 1aa00ee..b5b2c8d 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)