Migrate UI cleanup phase 4 from MIPS into ARM
[tomato.git] / release / src-rt-6.x.4708 / router / www / forward-dmz.asp
blob5456a41436d069afad871f4519273877851ac35d
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <meta name="viewport" content="width=device-width">
15 <title>[<% ident(); %>] Forwarding: DMZ</title>
16 <link rel='stylesheet' type='text/css' href='tomato.css'>
17 <link rel='stylesheet' type='text/css' href='color.css'>
18 <script type='text/javascript' src='tomato.js'></script>
20 <!-- / / / -->
22 <script type='text/javascript' src='debug.js'></script>
24 <script type='text/javascript' src='interfaces.js'></script>
26 <script type='text/javascript'>
28 // <% nvram("dmz_enable,dmz_ipaddr,dmz_sip,dmz_ifname,dmz_ra,lan_ifname,lan1_ifname,lan2_ifname,lan3_ifname"); %>
30 var lipp = '<% lipp(); %>.';
32 function verifyFields(focused, quiet)
34 var sip, dip, off;
36 off = !E('_f_dmz_enable').checked;
38 dip = E('_f_dmz_ipaddr')
39 dip.disabled = off;
41 sip = E('_f_dmz_sip');
42 sip.disabled = off;
44 sip = E('_f_dmz_ra');
45 sip.disabled = off;
47 var dif = E('_dmz_ifname');
48 dif.disabled = off;
49 if (dif.options[(dif.selectedIndex)].disabled) dif.selectedIndex = 0;
51 if (off) {
52 ferror.clearAll(dip, sip);
53 return 1;
56 if (dip.value.indexOf('.') == -1) dip.value = lipp + dip.value;
57 if (!v_ip(dip)) return 0;
59 if ((sip.value.length) && (!v_iptaddr(sip, quiet, 15))) return 0;
60 ferror.clear(sip);
62 return 1;
65 function save()
67 var fom;
68 var en;
69 var s;
71 if (!verifyFields(null, false)) return;
73 fom = E('_fom');
74 en = fom.f_dmz_enable.checked;
75 fom.dmz_enable.value = en ? 1 : 0;
76 if (en) {
77 // shorten it if possible to be more compatible with original
78 s = fom.f_dmz_ipaddr.value;
79 fom.dmz_ipaddr.value = (s.indexOf(lipp) == 0) ? s.replace(lipp, '') : s;
81 fom.dmz_sip.value = fom.f_dmz_sip.value.split(/\s*,\s*/).join(',');
82 fom.dmz_ra.value = E('_f_dmz_ra').checked ? 1 : 0;
83 form.submit(fom, 0);
86 function init() {
87 var dif = E('_dmz_ifname');
88 if(nvram.lan_ifname.length < 1)
89 dif.options[0].disabled=true;
90 if(nvram.lan1_ifname.length < 1)
91 dif.options[1].disabled=true;
92 if(nvram.lan2_ifname.length < 1)
93 dif.options[2].disabled=true;
94 if(nvram.lan3_ifname.length < 1)
95 dif.options[3].disabled=true;
96 if(nvram.dmz_enable == '1')
97 verifyFields(null,true);
100 </script>
102 </head>
103 <body onload='init()'>
104 <form id='_fom' method='post' action='tomato.cgi'>
105 <table id='container' cellspacing=0>
106 <tr><td colspan=2 id='header'>
107 <div class='title'>Tomato</div>
108 <div class='version'>Version <% version(); %></div>
109 </td></tr>
110 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
111 <td id='content'>
112 <div id='ident'><% ident(); %></div>
114 <!-- / / / -->
116 <input type='hidden' name='_nextpage' value='forward-dmz.asp'>
117 <input type='hidden' name='_service' value='firewall-restart'>
119 <input type='hidden' name='dmz_enable'>
120 <input type='hidden' name='dmz_ipaddr'>
121 <input type='hidden' name='dmz_sip'>
122 <input type='hidden' name='dmz_ra'>
124 <div class='section-title'>DMZ</div>
125 <div class='section'>
126 <script type='text/javascript'>
127 createFieldTable('', [
128 { title: 'Enable DMZ', name: 'f_dmz_enable', type: 'checkbox', value: (nvram.dmz_enable == '1') },
129 { title: 'Destination Address', indent: 2, name: 'f_dmz_ipaddr', type: 'text', maxlen: 15, size: 17,
130 value: (nvram.dmz_ipaddr.indexOf('.') != -1) ? nvram.dmz_ipaddr : (lipp + nvram.dmz_ipaddr) },
131 { title: 'Destination Interface', indent: 2, name: 'dmz_ifname', type: 'select',
132 options: [['br0','LAN (br0)'],['br1','LAN1 (br1)'],['br2','LAN2 (br2)'],['br3','LAN3 (br3)']], value: nvram.dmz_ifname },
133 { title: 'Source Address<br>Restriction', indent: 2, name: 'f_dmz_sip', type: 'text', maxlen: 512, size: 64,
134 value: nvram.dmz_sip, suffix: '<br><small>(optional; ex: "1.1.1.1", "1.1.1.0/24", "1.1.1.1 - 2.2.2.2" or "me.example.com")</small>' },
135 null,
136 { title: 'Leave Remote Access', indent: 2, name: 'f_dmz_ra', type: 'checkbox', value: (nvram.dmz_ra == '1'), suffix: ' &nbsp;<small>(Redirect remote access ports for SSH and HTTP(s) to router)</small>' }
138 </script>
139 </div>
141 <br>
142 <script type='text/javascript'>if (nvram.dmz_enable == '1') show_notice1('<% notice("iptables"); %>');</script>
144 <!-- / / / -->
146 </td></tr>
147 <tr><td id='footer' colspan=2>
148 <span id='footer-msg'></span>
149 <input type='button' value='Save' id='save-button' onclick='save()'>
150 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
151 </td></tr>
152 </table>
153 </form>
154 <script type='text/javascript'>verifyFields(null, 1);</script>
155 </body>
156 </html>