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 --- .../luasrc/model/cbi/admin_network/dhcpleases.lua | 28 ++++++---------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'modules/admin-full') diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua index 8ff1f5293..25187ae90 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcpleases.lua @@ -30,33 +30,19 @@ if leasefp then end if leases then - v = m2:section(TypedSection, "_virtual", translate("dhcp_leases_active")) + v = m2:section(Table, leases, translate("dhcp_leases_active")) v.anonymous = true v.rowcolors = true - v.template = "cbi/tblsection" - function v.cfgsections(self) - local sections = {} - for i=1,#leases do - table.insert(sections, i) - end - return sections - end - - ip = v:option(DummyValue, "ip", translate("ipaddress")) - function ip.cfgvalue(self, section) - return leases[section][3] - end + ip = v:option(DummyValue, 3, translate("ipaddress")) - mac = v:option(DummyValue, "mac", translate("macaddress")) - function mac.cfgvalue(self, section) - return leases[section][2] - end + mac = v:option(DummyValue, 2, translate("macaddress")) - ltime = v:option(DummyValue, "time", translate("dhcp_timeremain")) - function ltime.cfgvalue(self, section) + ltime = v:option(DummyValue, 1, translate("dhcp_timeremain")) + function ltime.cfgvalue(self, ...) + local value = DummyValue.cfgvalue(self, ...) return luci.tools.webadmin.date_format( - os.difftime(tonumber(leases[section][1]), os.time()) + os.difftime(tonumber(value), os.time()) ) end end -- cgit v1.2.3