2 local fw = require "luci.model.firewall".init()
3 local wz = fw:get_zone("wan")
4 local lz = fw:get_zone("lan")
7 <div class="cbi-section-create cbi-tblsection-create">
10 <table class="cbi-section-table" style="margin-left:5px">
11 <tr class="cbi-section-table-titles">
12 <th class="cbi-section-table-cell left" colspan="4"><%:Open ports on router%>:</th>
14 <tr class="cbi-section-table-descr">
15 <th class="cbi-section-table-cell"><%:Name%></th>
16 <th class="cbi-section-table-cell"><%:Protocol%></th>
17 <th class="cbi-section-table-cell"><%:External port%></th>
18 <th class="cbi-section-table-cell"></th>
20 <tr class="cbi-section-table-row">
21 <td class="cbi-section-table-cell" style="width:130px">
22 <input type="text" class="cbi-input-text" id="_newopen.name" name="_newopen.name" placeholder="<%:New input rule%>" />
24 <td class="cbi-section-table-cell" style="width:110px">
25 <select class="cbi-input-select" id="_newopen.proto" name="_newopen.proto">
26 <option value="tcp udp">TCP+UDP</option>
27 <option value="tcp">TCP</option>
28 <option value="udp">UDP</option>
29 <option value="other"><%:Other...%></option>
32 <td class="cbi-section-table-cell" style="width:110px">
33 <input type="text" class="cbi-input-text" id="_newopen.extport" name="_newopen.extport" />
35 <td class="cbi-section-table-cell left">
36 <input type="submit" class="cbi-button cbi-button-add" name="_newopen.submit" value="<%:Add%>" />
41 <% if wz and lz then %>
42 <table class="cbi-section-table" style="margin-left:5px">
43 <tr class="cbi-section-table-titles">
44 <th class="cbi-section-table-cell left" colspan="6"><br /><%:New forward rule%>:</th>
46 <tr class="cbi-section-table-descr">
47 <th class="cbi-section-table-cell"><%:Name%></th>
48 <th class="cbi-section-table-cell"><%:Source zone%></th>
49 <th class="cbi-section-table-cell"><%:Destination zone%></th>
50 <th class="cbi-section-table-cell"></th>
52 <tr class="cbi-section-table-row">
53 <td class="cbi-section-table-cell" style="width:130px">
54 <input type="text" class="cbi-input-text" id="_newfwd.name" name="_newfwd.name" placeholder="<%:New forward rule%>" />
56 <td class="cbi-section-table-cell" style="width:110px">
57 <select class="cbi-input-text" id="_newfwd.src" name="_newfwd.src">
58 <% local k, v; for k, v in ipairs(fw:get_zones()) do -%>
59 <option<%=ifattr(v:name() == "lan", "selected", "selected")%> value="<%=v:name()%>"><%=v:name()%></option>
63 <td class="cbi-section-table-cell" style="width:110px">
64 <select class="cbi-input-text" id="_newfwd.dest" name="_newfwd.dest">
65 <% local k, v; for k, v in ipairs(fw:get_zones()) do -%>
66 <option<%=ifattr(v:name() == "wan", "selected", "selected")%> value="<%=v:name()%>"><%=v:name()%></option>
70 <td class="cbi-section-table-cell left">
71 <input type="submit" class="cbi-button cbi-button-link" name="_newfwd.submit" value="<%:Add and edit...%>" />
76 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
80 <script type="text/javascript">//<![CDATA[
81 cbi_validate_field('_newopen.extport', true, 'list(neg(portrange))');
82 cbi_bind(document.getElementById('_newopen.extport'), 'blur',
84 var n = document.getElementById('_newopen.name');
85 var p = document.getElementById('_newopen.proto');
87 /* port name 0=both, 1=tcp, 2=udp, 3=other */
94 if (!this.className.match(/invalid/))
96 var hint = hints[this.value || 0];
99 p.selectedIndex = hint[1];
104 else if (!n.value && this.value)
106 n.value = 'Open' + this.value;
112 cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname');