Added missing value escaping
Fixed a typo (wrong if-condition) Added support for Table objects in CBI
This commit is contained in:
parent
5941f334ff
commit
d212e531d5
5 changed files with 31 additions and 7 deletions
|
@ -479,6 +479,30 @@ function SimpleSection.__init__(self, form, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Table = class(AbstractSection)
|
||||||
|
|
||||||
|
function Table.__init__(self, form, data, ...)
|
||||||
|
local datasource = {}
|
||||||
|
self.data = data
|
||||||
|
|
||||||
|
function datasource.get(self, section, option)
|
||||||
|
return data[option]
|
||||||
|
end
|
||||||
|
|
||||||
|
AbstractSection.__init__(self, datasource, nil, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Table.cfgsections(self)
|
||||||
|
local sections = {}
|
||||||
|
|
||||||
|
for i, v in pairs(self.data) do
|
||||||
|
table.insert(sections, i)
|
||||||
|
end
|
||||||
|
|
||||||
|
return sections
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
NamedSection - A fixed configuration section defined by its name
|
NamedSection - A fixed configuration section defined by its name
|
||||||
|
@ -707,7 +731,7 @@ function AbstractValue.parse(self, section)
|
||||||
else -- Unset the UCI or error
|
else -- Unset the UCI or error
|
||||||
if self.rmempty or self.optional then
|
if self.rmempty or self.optional then
|
||||||
self:remove(section)
|
self:remove(section)
|
||||||
elseif self.track_missing and not fvalue or fvalue ~= cvalue then
|
elseif self.track_missing and (not fvalue or fvalue ~= cvalue) then
|
||||||
self.tag_missing[section] = true
|
self.tag_missing[section] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -726,10 +750,10 @@ function AbstractValue.render(self, s, scope)
|
||||||
if cond then
|
if cond then
|
||||||
return string.format(
|
return string.format(
|
||||||
' %s="%s"', tostring(key),
|
' %s="%s"', tostring(key),
|
||||||
tostring( val
|
luci.util.pcdata(tostring( val
|
||||||
or scope[key]
|
or scope[key]
|
||||||
or (type(self[key]) ~= "function" and self[key])
|
or (type(self[key]) ~= "function" and self[key])
|
||||||
or "" )
|
or "" ))
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
return ''
|
return ''
|
||||||
|
|
|
@ -34,7 +34,7 @@ function convert_changes(changes)
|
||||||
val = ""
|
val = ""
|
||||||
else
|
else
|
||||||
str = ""
|
str = ""
|
||||||
val = "="..v
|
val = "="..luci.util.pcdata(v)
|
||||||
end
|
end
|
||||||
str = r.."."..s
|
str = r.."."..s
|
||||||
if o ~= ".type" then
|
if o ~= ".type" then
|
||||||
|
|
|
@ -34,7 +34,7 @@ $Id$
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=iface%></td>
|
<td><%=iface%></td>
|
||||||
<td><%=cell.ESSID%></td>
|
<td><%=luci.util.pcdata(cell.ESSID)%></td>
|
||||||
<td><%=cell.Address%></td>
|
<td><%=cell.Address%></td>
|
||||||
<td><%=cell.Mode%></td>
|
<td><%=cell.Mode%></td>
|
||||||
<td><%=(cell.Channel or cell.Frequency or "")%></td>
|
<td><%=(cell.Channel or cell.Frequency or "")%></td>
|
||||||
|
|
|
@ -34,7 +34,7 @@ function convert_changes(changes)
|
||||||
val = ""
|
val = ""
|
||||||
else
|
else
|
||||||
str = ""
|
str = ""
|
||||||
val = "="..v
|
val = "="..luci.util.pcdata(v)
|
||||||
end
|
end
|
||||||
str = r.."."..s
|
str = r.."."..s
|
||||||
if o ~= ".type" then
|
if o ~= ".type" then
|
||||||
|
|
|
@ -34,7 +34,7 @@ $Id$
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%=iface%></td>
|
<td><%=iface%></td>
|
||||||
<td><%=cell.ESSID%></td>
|
<td><%=luci.util.pcdata(cell.ESSID)%></td>
|
||||||
<td><%=cell.Address%></td>
|
<td><%=cell.Address%></td>
|
||||||
<td><%=cell.Mode%></td>
|
<td><%=cell.Mode%></td>
|
||||||
<td><%=(cell.Channel or cell.Frequency or "")%></td>
|
<td><%=(cell.Channel or cell.Frequency or "")%></td>
|
||||||
|
|
Loading…
Reference in a new issue