1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
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.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Forwarding: Triggered
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
16 <link rel='stylesheet' type='text/css' href='color.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
20 <style type='text/css'
>
39 <script type='text/javascript' src='debug.js'
></script>
41 <script type='text/javascript'
>
43 // <% nvram("trigforward"); %>
45 var tg
= new TomatoGrid();
47 tg
.sortCompare = function(a
, b
) {
48 var col
= this.sortColumn
;
49 var da
= a
.getRowData();
50 var db
= b
.getRowData();
56 r
= cmpInt(da
[col
], db
[col
]);
59 r
= cmpText(da
[col
], db
[col
]);
63 return this.sortAscending
? r
: -r
;
66 tg
.dataToView = function(data
) {
67 return [data
[0] ? 'On' : '', ['TCP', 'UDP', 'Both'][data
[1] - 1], data
[2], data
[3], data
[4]];
70 tg
.fieldValuesToData = function(row
) {
71 var f
= fields
.getAll(row
);
72 return [f
[0].checked
? 1 : 0, f
[1].value
, f
[2].value
, f
[3].value
, f
[4].value
];
75 tg
.verifyFields = function(row
, quiet
) {
76 var f
= fields
.getAll(row
);
78 if (!v_portrange(f
[2], quiet
)) return 0;
79 if (!v_portrange(f
[3], quiet
)) return 0;
80 f
[4].value
= f
[4].value
.replace(/>/g
, '_');
81 if (!v_nodelim(f
[4], quiet
, 'Description')) return 0;
85 tg
.resetNewEditor = function() {
86 var f
= fields
.getAll(this.newEditor
);
88 f
[1].selectedIndex
= 0;
95 tg
.setup = function() {
96 this.init('tg-grid', 'sort', 50, [
98 { type
: 'select', options
: [[1, 'TCP'],[2, 'UDP'],[3,'Both']] },
99 { type
: 'text', maxlen
: 16 },
100 { type
: 'text', maxlen
: 16 },
101 { type
: 'text', maxlen
: 32 }]);
102 this.headerSet(['On', 'Protocol', 'Trigger Ports', 'Forwarded Ports', 'Description']);
103 var nv
= nvram
.trigforward
.split('>');
104 for (var i
= 0; i
< nv
.length
; ++i
) {
106 if (r
= nv
[i
].match(/^(\d)<(\d)<(.+?)<(.+?)<(.*)$/)) {
109 r
[3] = r
[3].replace(/:/g
, '-');
110 r
[4] = r
[4].replace(/:/g
, '-');
111 tg
.insertData(-1, r
.slice(1, 6));
121 if (tg
.isEditing()) return;
123 var data
= tg
.getAllData();
125 for (var i
= 0; i
< data
.length
; ++i
) {
126 data
[i
][2] = data
[i
][2].replace(/-/g
, ':');
127 data
[i
][3] = data
[i
][3].replace(/-/g
, ':');
128 s
+= data
[i
].join('<') + '>';
131 fom
.trigforward
.value
= s
;
140 if (((c
= cookie
.get('forward_triggered_notes_vis')) != null) && (c
== '1')) toggleVisibility("notes");
143 function toggleVisibility(whichone
) {
144 if (E('sesdiv_' + whichone
).style
.display
== '') {
145 E('sesdiv_' + whichone
).style
.display
= 'none';
146 E('sesdiv_' + whichone
+ '_showhide').innerHTML
= '(Click here to show)';
147 cookie
.set('forward_triggered_' + whichone
+ '_vis', 0);
149 E('sesdiv_' + whichone
).style
.display
='';
150 E('sesdiv_' + whichone
+ '_showhide').innerHTML
= '(Click here to hide)';
151 cookie
.set('forward_triggered_' + whichone
+ '_vis', 1);
156 <body onload='init()'
>
157 <form id='_fom' method='post' action='tomato.cgi'
>
158 <table id='container' cellspacing=
0>
159 <tr><td colspan=
2 id='header'
>
160 <div class='title'
>Tomato
</div>
161 <div class='version'
>Version <%
version(); %></div>
163 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
165 <div id='ident'
><%
ident(); %></div>
169 <input type='hidden' name='_nextpage' value='forward.asp'
>
170 <input type='hidden' name='_service' value='firewall-restart'
>
172 <input type='hidden' name='trigforward'
>
174 <div class='section-title'
>Triggered Port Forwarding
</div>
175 <div class='section'
>
176 <table class='tomato-grid' cellspacing=
1 id='tg-grid'
></table>
177 <script type='text/javascript'
>tg
.setup();</script>
180 <div class='section-title'
>Notes
<small><i><a href='javascript:toggleVisibility(
"notes");'
><span id='sesdiv_notes_showhide'
>(Click here to show)
</span></a></i></small></div>
181 <div class='section' id='sesdiv_notes' style='display:none'
>
183 <li>Use
"-" to specify a range of ports (
200-
300).
184 <li>Trigger Ports are the initial LAN to WAN
"trigger".
185 <li>Forwarded Ports are the WAN to LAN ports that are opened if the
"trigger" is activated.
186 <li>These ports are automatically closed after a few minutes of inactivity.
193 <tr><td id='footer' colspan=
2>
194 <span id='footer-msg'
></span>
195 <input type='button' value='Save' id='save-button' onclick='save()'
>
196 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>