From bec91e4cafbe830e96cb9a3b3199d5c75da3c011 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 27 Oct 2009 21:42:40 +0000 Subject: libs/cbi: fixes for widget templates --- libs/cbi/luasrc/view/cbi/firewall_zonelist.htm | 44 +++++++++++++++++++------- libs/cbi/luasrc/view/cbi/network_netlist.htm | 35 ++++++++++---------- 2 files changed, 52 insertions(+), 27 deletions(-) (limited to 'libs/cbi/luasrc/view') diff --git a/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm b/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm index 199d9ac9ae..94186954d9 100644 --- a/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm +++ b/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm @@ -20,38 +20,60 @@ $Id$ local zone, net, iface local zones = fwm:get_zones() - local value = self:cfgvalue(section) or self.default + local value = self:formvalue(section) + if not value or value == "-" then value = self:cfgvalue(section) or self.default end + local selected = false + local checked = { } - if value and #value == 0 then value = nil end + if value and #value == 0 then + value = nil + elseif type(value) == "table" then + for _, value in ipairs(value) do + checked[value] = true + end + elseif value then + checked[value] = true + end -%> -