luci-app-firewall: only show SNAT template if there are more then one zone
authorFlorian Eckert <fe@dev.tdt.de>
Tue, 30 Jan 2018 10:52:32 +0000 (11:52 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Thu, 1 Mar 2018 11:33:43 +0000 (12:33 +0100)
Only show SNAT template if there are more then one zone.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-firewall/luasrc/view/firewall/cbi_addsnat.htm

index ce27511..0a5913f 100644 (file)
@@ -1,8 +1,7 @@
 <%
        local fw = require "luci.model.firewall".init()
        local nw = require "luci.model.network".init()
 <%
        local fw = require "luci.model.firewall".init()
        local nw = require "luci.model.network".init()
-       local wz = fw:get_zone("wan")
-       local lz = fw:get_zone("lan")
+       local zones = fw:get_zones()
 
        local keys, vals, a, k, v = {}, {}
        for k, v in ipairs(nw:get_interfaces()) do
 
        local keys, vals, a, k, v = {}, {}
        for k, v in ipairs(nw:get_interfaces()) do
@@ -14,7 +13,7 @@
 %>
 
 <div class="cbi-section-create cbi-tblsection-create">
 %>
 
 <div class="cbi-section-create cbi-tblsection-create">
-       <% if wz and lz then %>
+       <% if #zones > 1 then %>
                <br />
                <table class="cbi-section-table" style="width:700px; margin-left:5px">
                        <tr class="cbi-section-table-titles">
                <br />
                <table class="cbi-section-table" style="width:700px; margin-left:5px">
                        <tr class="cbi-section-table-titles">