From 988de587ee5e159f4991f8ab855c75b9cfcee847 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 10 Oct 2009 14:47:37 +0000 Subject: [PATCH] libs/cbi: various widget fixes --- .../cbi/luasrc/view/cbi/firewall_zonelist.htm | 35 ++++++++++--------- libs/cbi/luasrc/view/cbi/fvalue.htm | 2 +- .../cbi/luasrc/view/cbi/network_ifacelist.htm | 1 + libs/cbi/luasrc/view/cbi/value.htm | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm b/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm index 847010b7c..26c46cb54 100644 --- a/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm +++ b/libs/cbi/luasrc/view/cbi/firewall_zonelist.htm @@ -15,48 +15,51 @@ $Id$ <%- local utl = require "luci.util" - local wba = require "luci.tools.webadmin" - local wbi = require "luci.tools.webadmin_interfaces" local fwm = require "luci.model.firewall" + local nwm = require "luci.model.network" - wbi.init(self.map.uci) - - local zone, iface, ifname + local zone, net, iface local zones = fwm:get_zones() local value = self:cfgvalue(section) or self.default + local selected = false if value and #value == 0 then value = nil end -%> <%+cbi/valuefooter%> diff --git a/libs/cbi/luasrc/view/cbi/fvalue.htm b/libs/cbi/luasrc/view/cbi/fvalue.htm index b46817c6f..35ebac6e1 100644 --- a/libs/cbi/luasrc/view/cbi/fvalue.htm +++ b/libs/cbi/luasrc/view/cbi/fvalue.htm @@ -13,5 +13,5 @@ $Id$ -%> <%+cbi/valueheader%> - value="1" /> + value="1" /> <%+cbi/valuefooter%> diff --git a/libs/cbi/luasrc/view/cbi/network_ifacelist.htm b/libs/cbi/luasrc/view/cbi/network_ifacelist.htm index b3a61fa6a..00bb83a2e 100644 --- a/libs/cbi/luasrc/view/cbi/network_ifacelist.htm +++ b/libs/cbi/luasrc/view/cbi/network_ifacelist.htm @@ -22,6 +22,7 @@ $Id$ local value = (self:cfgvalue(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 end diff --git a/libs/cbi/luasrc/view/cbi/value.htm b/libs/cbi/luasrc/view/cbi/value.htm index e6a7ab6d9..de083e62c 100644 --- a/libs/cbi/luasrc/view/cbi/value.htm +++ b/libs/cbi/luasrc/view/cbi/value.htm @@ -13,7 +13,7 @@ $Id$ -%> <%+cbi/valueheader%> - /> + /> <% if #self.keylist > 0 then -%>