applications/luci-firewall: fix wrong location of cbi templates
[project/luci.git] / applications / luci-firewall / luasrc / view / firewall / cbi_addsnat.htm
1 <%
2 local fw = require "luci.model.firewall".init()
3 local nw = require "luci.model.network".init()
4 local wz = fw:get_zone("wan")
5 local lz = fw:get_zone("lan")
6 %>
7
8 <div class="cbi-section-create cbi-tblsection-create">
9 <% if wz and lz then %>
10 <br />
11 <table class="cbi-section-table" style="width:700px; margin-left:5px">
12 <tr class="cbi-section-table-titles">
13 <th class="cbi-section-table-cell left" colspan="6"><%:New source NAT%>:</th>
14 </tr>
15 <tr class="cbi-section-table-descr">
16 <th class="cbi-section-table-cell"><%:Name%></th>
17 <th class="cbi-section-table-cell"><%:Source zone%></th>
18 <th class="cbi-section-table-cell"><%:Destination zone%></th>
19 <th class="cbi-section-table-cell"><%:To source IP%></th>
20 <th class="cbi-section-table-cell"><%:To source port%></th>
21 <th class="cbi-section-table-cell"></th>
22 </tr>
23 <tr class="cbi-section-table-row">
24 <td class="cbi-section-table-cell">
25 <input type="text" class="cbi-input-text" id="_newsnat.name" name="_newsnat.name" placeholder="<%:New SNAT rule%>" />
26 </td>
27 <td class="cbi-section-table-cell" style="width:110px">
28 <select class="cbi-input-text" id="_newsnat.src" name="_newsnat.src">
29 <% local k, v; for k, v in ipairs(fw:get_zones()) do -%>
30 <option<%=ifattr(v:name() == "lan", "selected", "selected")%> value="<%=v:name()%>"><%=v:name()%></option>
31 <%- end %>
32 </select>
33 </td>
34 <td class="cbi-section-table-cell" style="width:110px">
35 <select class="cbi-input-text" id="_newsnat.dest" name="_newsnat.dest">
36 <% local k, v; for k, v in ipairs(fw:get_zones()) do -%>
37 <option<%=ifattr(v:name() == "wan", "selected", "selected")%> value="<%=v:name()%>"><%=v:name()%></option>
38 <%- end %>
39 </select>
40 </td>
41 <td class="cbi-section-table-cell" style="width:110px">
42 <input type="text" class="cbi-input-text" id="_newsnat.dip" name="_newsnat.dip" />
43 </td>
44 <td class="cbi-section-table-cell" style="width:110px">
45 <input type="text" class="cbi-input-text" id="_newsnat.dport" name="_newsnat.dport" placeholder="<%:Do not rewrite%>" />
46 </td>
47 <td class="cbi-section-table-cell">
48 <input type="submit" class="cbi-button cbi-button-link" name="_newsnat.submit" value="<%:Add and edit...%>" />
49 </td>
50 </tr>
51 </table>
52
53 <script type="text/javascript">//<![CDATA[
54 cbi_validate_field('_newsnat.dport', true, 'portrange');
55 cbi_combobox_init('_newsnat.dip', {
56 <% local c, k, v = 0; for k, v in ipairs(nw:get_interfaces()) do -%>
57 <%- local a; for k, a in ipairs(v:ipaddrs()) do c = c + 1 -%>
58 <% if c > 1 then %>,<% end %>'<%=a:host():string()%>': '<%=a:host():string()%> (<%=v:shortname()%>)',
59 <%- end %>
60 <%- end %> }, '<%: -- Please choose -- %>', '<%: -- custom -- %>');
61 //]]></script>
62 <% else %>
63 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
64 <% end %>
65 </div>