<%
local fw = require "luci.model.firewall".init()
- local wz = fw:get_zone("wan")
- local lz = fw:get_zone("lan")
local zones = fw:get_zones()
%>
-<% if wz then %>
+<% if #zones > 0 then %>
<h4><%:Open ports on router%></h4>
<div class="table">
<div class="tr cbi-section-table-titles">
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
<% end %>
-<% if wz then %>
+<% if #zones > 0 then %>
<script type="text/javascript">//<![CDATA[
cbi_validate_field('_newopen.extport', true, 'list(neg(portrange))');
- cbi_bind(document.getElementById('_newopen.extport'), 'blur',
+ document.getElementById('_newopen.extport').addEventListener('blur',
function() {
var n = document.getElementById('_newopen.name');
var p = document.getElementById('_newopen.proto');
- var hints = {
- /* port name 0=both, 1=tcp, 2=udp, 3=other */
- 22: [ 'SSH', 1 ],
- 53: [ 'DNS', 0 ],
- 80: [ 'HTTP', 1 ],
- 443: [ 'HTTPS', 1 ],
- };
if (!this.className.match(/invalid/))
{
- var hint = hints[this.value || 0];
- if (hint)
- {
- p.selectedIndex = hint[1];
-
- if (!n.value)
- n.value = hint[0];
- }
- else if (!n.value && this.value)
+ if (!n.value && this.value)
{
n.value = 'Open' + this.value;
}
}
});
-
-
- cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname');
//]]></script>
<% end %>