Rebased from upstream / out of band repository.
[librecmc/librecmc.git] / package / luci / applications / luci-app-firewall / luasrc / view / firewall / cbi_addforward.htm
index b3079f3a4812adc0fcaec4a5791f542da1a2b1a9..38f36b49c87363e932def79e424b480ebfbcbddf 100644 (file)
                vals[#vals+1] = '%s (%s)' %{ ip, name }
        end)
 -%>
-<div class="cbi-section-create cbi-tblsection-create">
-       <br />
-       <table class="cbi-section-table" style="width:810px; margin-left:5px">
-               <tr class="cbi-section-table-titles">
-                       <th class="cbi-section-table-cell" colspan="8"><%:New port forward%>:</th>
-               </tr>
-               <tr class="cbi-section-table-descr">
-                       <th class="cbi-section-table-cell"><%:Name%></th>
-                       <th class="cbi-section-table-cell"><%:Protocol%></th>
-                       <th class="cbi-section-table-cell"><%:External zone%></th>
-                       <th class="cbi-section-table-cell"><%:External port%></th>
-                       <th class="cbi-section-table-cell"><%:Internal zone%></th>
-                       <th class="cbi-section-table-cell"><%:Internal IP address%></th>
-                       <th class="cbi-section-table-cell"><%:Internal port%></th>
-                       <th class="cbi-section-table-cell"></th>
-               </tr>
-               <tr class="cbi-section-table-row">
-                       <td class="cbi-section-table-cell">
-                               <input type="text" class="cbi-input-text" id="_newfwd.name" name="_newfwd.name" placeholder="<%:New port forward%>" />
-                       </td>
-                       <td class="cbi-section-table-cell" style="width:110px">
-                               <select class="cbi-input-select" id="_newfwd.proto" name="_newfwd.proto">
-                                       <option value="tcp udp">TCP+UDP</option>
-                                       <option value="tcp">TCP</option>
-                                       <option value="udp">UDP</option>
-                                       <option value="other"><%:Other...%></option>
-                               </select>
-                       </td>
-                       <td class="cbi-section-table-cell" style="width:55px">
-                               <select class="cbi-input-select" id="_newfwd.extzone" name="_newfwd.extzone">
-                                       <% for _, z in ipairs(ezl) do -%><option value="<%=z:name()%>"><%=z:name()%></option><%- end %>
-                               </select>
-                       </td>
-                       <td class="cbi-section-table-cell" style="width:110px">
-                               <input type="text" class="cbi-input-text" id="_newfwd.extport" name="_newfwd.extport" data-type="portrange" data-optional="true" />
-                       </td>
-                       <td class="cbi-section-table-cell" style="width:55px">
-                               <select class="cbi-input-select" id="_newfwd.intzone" name="_newfwd.intzone">
-                                       <% for _, z in ipairs(izl) do -%><option value="<%=z:name()%>"><%=z:name()%></option><%- end %>
-                               </select>
-                       </td>
-                       <td class="cbi-section-table-cell" style="width:110px">
-                               <input type="text" class="cbi-input-text" id="_newfwd.intaddr" name="_newfwd.intaddr" data-type="host" data-optional="true"<%=
-                                       ifattr(#keys > 0, "data-choices", {keys, vals})
-                               %>/>
-                       </td>
-                       <td class="cbi-section-table-cell" style="width:110px">
-                               <input type="text" class="cbi-input-text" id="_newfwd.intport" name="_newfwd.intport" data-type="portrange" data-optional="true" />
-                       </td>
-                       <td class="cbi-section-table-cell">
-                               <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
-                       </td>
-               </tr>
-       </table>
 
-       <script type="text/javascript">//<![CDATA[
-               cbi_bind(document.getElementById('_newfwd.extport'), 'blur',
-                       function() {
-                               var n = document.getElementById('_newfwd.name');
-                               var p = document.getElementById('_newfwd.proto');
-                               var i = document.getElementById('_newfwd.intport');
-                               var hints = {
-                               /*  port    name     0=both, 1=tcp, 2=udp, 3=other */
-                                       21:   [ 'FTP',   1 ],
-                                       22:   [ 'SSH',   1 ],
-                                       53:   [ 'DNS',   0 ],
-                                       80:   [ 'HTTP',  1 ],
-                                       443:  [ 'HTTPS', 1 ],
-                                       3389: [ 'RDP',   1 ],
-                                       5900: [ 'VNC',   1 ],
-                               };
+<h4><%:New port forward%></h4>
+<div class="table">
+       <div class="tr table-titles">
+               <div class="th"><%:Name%></div>
+               <div class="th"><%:Protocol%></div>
+               <div class="th"><%:External zone%></div>
+               <div class="th"><%:External port%></div>
+               <div class="th"><%:Internal zone%></div>
+               <div class="th"><%:Internal IP address%></div>
+               <div class="th"><%:Internal port%></div>
+               <div class="th"></div>
+       </div>
+       <div class="tr">
+               <div class="td">
+                       <input type="text" class="cbi-input-text" id="_newfwd.name" name="_newfwd.name" placeholder="<%:New port forward%>" />
+               </div>
+               <div class="td">
+                       <select class="cbi-input-select" id="_newfwd.proto" name="_newfwd.proto">
+                               <option value="tcp udp">TCP+UDP</option>
+                               <option value="tcp">TCP</option>
+                               <option value="udp">UDP</option>
+                               <option value="other"><%:Other...%></option>
+                       </select>
+               </div>
+               <div class="td">
+                       <select class="cbi-input-select" id="_newfwd.extzone" name="_newfwd.extzone">
+                               <% for _, z in ipairs(ezl) do -%><option value="<%=z:name()%>"><%=z:name()%></option><%- end %>
+                       </select>
+               </div>
+               <div class="td">
+                       <input type="text" class="cbi-input-text" id="_newfwd.extport" name="_newfwd.extport" data-type="portrange" data-optional="true" />
+               </div>
+               <div class="td">
+                       <select class="cbi-input-select" id="_newfwd.intzone" name="_newfwd.intzone">
+                               <% for _, z in ipairs(izl) do -%><option value="<%=z:name()%>"><%=z:name()%></option><%- end %>
+                       </select>
+               </div>
+               <div class="td">
+                       <input type="text" class="cbi-input-text" id="_newfwd.intaddr" name="_newfwd.intaddr" data-type="host" data-optional="true"<%=
+                               ifattr(#keys > 0, "data-choices", {keys, vals})
+                       %>/>
+               </div>
+               <div class="td">
+                       <input type="text" class="cbi-input-text" id="_newfwd.intport" name="_newfwd.intport" data-type="portrange" data-optional="true" />
+               </div>
+               <div class="td bottom">
+                       <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" value="<%:Add%>" />
+               </div>
+       </div>
+</div>
 
-                               if (!this.className.match(/invalid/))
-                               {
-                                       if (!i.value) i.value = this.value;
+<script type="text/javascript">//<![CDATA[
+       document.getElementById('_newfwd.extport').addEventListener('blur',
+               function() {
+                       var n = document.getElementById('_newfwd.name');
+                       var p = document.getElementById('_newfwd.proto');
+                       var i = document.getElementById('_newfwd.intport');
 
-                                       var hint = hints[this.value || 0] || hints[i.value || 0];
-                                       if (hint)
-                                       {
-                                               p.selectedIndex = hint[1];
+                       if (!this.className.match(/invalid/))
+                       {
+                               if (!i.value) i.value = this.value;
 
-                                               if (!n.value)
-                                                       n.value = hint[0];
-                                       }
-                                       else if (!n.value)
-                                       {
-                                               n.value = 'Forward' + this.value;
-                                       }
+                               if (!n.value)
+                               {
+                                       n.value = 'Forward' + this.value;
                                }
-                       });
-       //]]></script>
-</div>
+                       }
+               });
+//]]></script>