From 8e4afe121087c05833ee7d567fe45f2ba270e54d Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 15 Aug 2008 20:42:25 +0000 Subject: Several escaping fixes Updated XML translation system Use the new Table widget for DHCP leases --- libs/cbi/luasrc/cbi.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libs/cbi/luasrc') diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 7bcfceb2ef..ab342feec1 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -92,10 +92,10 @@ function Node._i18n(self, config, section, option, title, description) -- i18n loaded? if type(luci.i18n) == "table" then - local key = config:gsub("[^%w]+", "") + local key = config and config:gsub("[^%w]+", "") or "" if section then key = key .. "_" .. section:lower():gsub("[^%w]+", "") end - if option then key = key .. "_" .. option:lower():gsub("[^%w]+", "") end + if option then key = key .. "_" .. tostring(option):lower():gsub("[^%w]+", "") end self.title = title or luci.i18n.translate( key, option or section or config ) self.description = description or luci.i18n.translate( key .. "_desc", "" ) @@ -483,13 +483,15 @@ Table = class(AbstractSection) function Table.__init__(self, form, data, ...) local datasource = {} + datasource.config = "table" self.data = data function datasource.get(self, section, option) - return data[option] + return data[section][option] end - AbstractSection.__init__(self, datasource, nil, ...) + AbstractSection.__init__(self, datasource, "table", ...) + self.template = "cbi/tblsection" end function Table.cfgsections(self) -- cgit v1.2.3