From 536430d0eeecf5c75651ff625b97c9fa4fc646b4 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 15 Oct 2009 16:37:29 +0000 Subject: [PATCH] libs/cbi: change widgets using model.network to new api --- libs/cbi/luasrc/view/cbi/firewall_zonelist.htm | 2 +- libs/cbi/luasrc/view/cbi/network_ifacelist.htm | 22 ++++++++++++++++------ libs/cbi/luasrc/view/cbi/network_netlist.htm | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm b/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm index 26c46cb54..199d9ac9a 100644 --- a/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm +++ b/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm @@ -44,7 +44,7 @@ $Id$ empty = false %> .png" /> - <% if iface:name() == self.iface then %><%=iface:name()%><% else %><%=iface:name()%><% end %>   + <% if iface:name() == self.iface then %><%=iface:shortname()%><% else %><%=iface:shortname()%><% end %>   <% end end end %> <% if empty then %><%:a_s_ipt_zone_empty (no interfaces attached)%><% end %> diff --git a/libs/cbi/luasrc/view/cbi/network_ifacelist.htm b/libs/cbi/luasrc/view/cbi/network_ifacelist.htm index 00bb83a2e..2f9821817 100644 --- a/libs/cbi/luasrc/view/cbi/network_ifacelist.htm +++ b/libs/cbi/luasrc/view/cbi/network_ifacelist.htm @@ -19,23 +19,33 @@ $Id$ local iface local ifaces = net:get_interfaces() - local value = (self:cfgvalue(section) or self.default or "") + local value = (self:formvalue(section) or self.default or "") local checked = { } - if type(value) == "table" then value = table.concat(value, " ") end - for value in value:gmatch("%S+") do - checked[value] = true + if value and #value > 0 then + if type(value) == "table" then value = table.concat(value, " ") end + for value in value:gmatch("%S+") do + checked[value] = true + end + else + local n = self.network and net:get_network(self.network) + if n then + local i + for _, i in ipairs(n:get_interfaces()) do + checked[i:name()] = true + end + end end -%>