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
, '_');
84 tg
.resetNewEditor = function() {
85 var f
= fields
.getAll(this.newEditor
);
87 f
[1].selectedIndex
= 0;
94 tg
.setup = function() {
95 this.init('tg-grid', 'sort', 50, [
97 { type
: 'select', options
: [[1, 'TCP'],[2, 'UDP'],[3,'Both']] },
98 { type
: 'text', maxlen
: 16 },
99 { type
: 'text', maxlen
: 16 },
100 { type
: 'text', maxlen
: 32 }]);
101 this.headerSet(['On', 'Protocol', 'Trigger Ports', 'Forwarded Ports', 'Description']);
102 var nv
= nvram
.trigforward
.split('>');
103 for (var i
= 0; i
< nv
.length
; ++i
) {
105 if (r
= nv
[i
].match(/^(\d)<(\d)<(.+?)<(.+?)<(.*)$/)) {
108 r
[3] = r
[3].replace(/:/g
, '-');
109 r
[4] = r
[4].replace(/:/g
, '-');
110 tg
.insertData(-1, r
.slice(1, 6));
120 if (tg
.isEditing()) return;
122 var data
= tg
.getAllData();
124 for (var i
= 0; i
< data
.length
; ++i
) {
125 data
[i
][2] = data
[i
][2].replace(/-/g
, ':');
126 data
[i
][3] = data
[i
][3].replace(/-/g
, ':');
127 s
+= data
[i
].join('<') + '>';
130 fom
.trigforward
.value
= s
;
141 <body onload='init()'
>
142 <form id='_fom' method='post' action='tomato.cgi'
>
143 <table id='container' cellspacing=
0>
144 <tr><td colspan=
2 id='header'
>
145 <div class='title'
>Tomato
</div>
146 <div class='version'
>Version <%
version(); %></div>
148 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
150 <div id='ident'
><%
ident(); %></div>
154 <input type='hidden' name='_nextpage' value='forward.asp'
>
155 <input type='hidden' name='_service' value='firewall-restart'
>
157 <input type='hidden' name='trigforward'
>
159 <div class='section-title'
>Triggered Port Forwarding
</div>
160 <div class='section'
>
161 <table class='tomato-grid' cellspacing=
1 id='tg-grid'
></table>
162 <script type='text/javascript'
>tg
.setup();</script>
167 <li>Use
"-" to specify a range of ports (
200-
300).
168 <li>Trigger Ports are the initial LAN to WAN
"trigger".
169 <li>Forwarded Ports are the WAN to LAN ports that are opened if the
"trigger" is activated.
170 <li>These ports are automatically closed after a few minutes of inactivity.
177 <tr><td id='footer' colspan=
2>
178 <span id='footer-msg'
></span>
179 <input type='button' value='Save' id='save-button' onclick='save()'
>
180 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'
>