function NamedSection.__init__(self, map, section, type, ...)
AbstractSection.__init__(self, map, type, ...)
Node._i18n(self, map.config, section, nil, ...)
-
+
self.template = "cbi/nsection"
self.section = section
self.addremove = false
function (section)
if self:checkscope(section[".name"]) then
table.insert(sections, section[".name"])
- end
+ end
end)
return sections
if not self.optional or self:cfgvalue(s) or self:formcreated(s) then
scope = scope or {}
scope.section = s
-
+ scope.cbid = "cbid." .. self.config ..
+ "." .. s ..
+ "." .. self.option
+
+ scope.ifattr = function(cond,key,val)
+ if cond then
+ return string.format(
+ ' %s="%s"', tostring(key),
+ tostring( val or scope[key] or self[key] or "" )
+ )
+ else
+ return ''
+ end
+ end
+
+ scope.attr = function(...)
+ return scope.ifattr( true, ... )
+ end
+
Node.render(self, scope)
end
end
end
function MultiValue.validate(self, val)
- val = (type(val) == "table") and val or {val}
+ val = (type(val) == "table") and val or {val}
local result