luci-app-firewall: allow "open ports" when no wan zone exists

Arguably this makes little if no wan zone exists but prefer consistency
over heuristics and always render the "open port" shortcut.

Fixes #2056
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2018-08-13 09:20:43 +02:00
parent 849d153851
commit bf123fb7c4

View file

@ -1,11 +1,9 @@
<% <%
local fw = require "luci.model.firewall".init() local fw = require "luci.model.firewall".init()
local wz = fw:get_zone("wan")
local lz = fw:get_zone("lan")
local zones = fw:get_zones() local zones = fw:get_zones()
%> %>
<% if wz then %> <% if #zones > 0 then %>
<h4><%:Open ports on router%></h4> <h4><%:Open ports on router%></h4>
<div class="table"> <div class="table">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
@ -71,7 +69,7 @@
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" /> <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
<% end %> <% end %>
<% if wz then %> <% if #zones > 0 then %>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
cbi_validate_field('_newopen.extport', true, 'list(neg(portrange))'); cbi_validate_field('_newopen.extport', true, 'list(neg(portrange))');
cbi_bind(document.getElementById('_newopen.extport'), 'blur', cbi_bind(document.getElementById('_newopen.extport'), 'blur',