1 <div class="cbi-section-create cbi-tblsection-create">
3 <table class="cbi-section-table" style="width:700px; margin-left:5px">
4 <tr class="cbi-section-table-titles">
5 <th class="cbi-section-table-cell" colspan="6"><%:New port forward%>:</th>
7 <tr class="cbi-section-table-descr">
8 <th class="cbi-section-table-cell"><%:Name%></th>
9 <th class="cbi-section-table-cell"><%:Protocol%></th>
10 <th class="cbi-section-table-cell"><%:External port%></th>
11 <th class="cbi-section-table-cell"><%:Internal IP address%></th>
12 <th class="cbi-section-table-cell"><%:Internal port%></th>
13 <th class="cbi-section-table-cell"></th>
15 <tr class="cbi-section-table-row">
16 <td class="cbi-section-table-cell">
17 <input type="text" class="cbi-input-text" id="_newfwd.name" name="_newfwd.name" placeholder="<%:New port forward%>" />
19 <td class="cbi-section-table-cell" style="width:110px">
20 <select class="cbi-input-select" id="_newfwd.proto" name="_newfwd.proto">
21 <option value="tcp udp">TCP+UDP</option>
22 <option value="tcp">TCP</option>
23 <option value="udp">UDP</option>
24 <option value="other"><%:Other...%></option>
27 <td class="cbi-section-table-cell" style="width:110px">
28 <input type="text" class="cbi-input-text" id="_newfwd.extport" name="_newfwd.extport" />
30 <td class="cbi-section-table-cell" style="width:110px">
31 <input type="text" class="cbi-input-text" id="_newfwd.intaddr" name="_newfwd.intaddr" />
33 <td class="cbi-section-table-cell" style="width:110px">
34 <input type="text" class="cbi-input-text" id="_newfwd.intport" name="_newfwd.intport" />
36 <td class="cbi-section-table-cell">
37 <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
42 <script type="text/javascript">//<![CDATA[
43 cbi_validate_field('_newfwd.extport', true, 'portrange');
44 cbi_validate_field('_newfwd.intaddr', true, 'host');
45 cbi_validate_field('_newfwd.intport', true, 'portrange');
47 cbi_combobox_init('_newfwd.intaddr', {
48 <% first = true; luci.sys.net.ipv4_hints(function(ip, name) %>
49 <%- if first then first = false else %>,<% end -%>'<%=ip%>': '<%=ip%> (<%=name%>)'
50 <%- end) %> }, '', '<%: -- custom -- %>');
52 cbi_bind(document.getElementById('_newfwd.extport'), 'blur',
54 var n = document.getElementById('_newfwd.name');
55 var p = document.getElementById('_newfwd.proto');
56 var i = document.getElementById('_newfwd.intport');
58 /* port name 0=both, 1=tcp, 2=udp, 3=other */
68 if (!this.className.match(/invalid/))
70 if (!i.value) i.value = this.value;
72 var hint = hints[this.value || 0] || hints[i.value || 0];
75 p.selectedIndex = hint[1];
82 n.value = 'Forward' + this.value;
88 cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>', true, 'uciname');