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: UPnP / NAT-PMP
</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>
21 <style type='text/css'
>
22 #upnp-grid .co1
, #upnp-grid
.co2
{
36 <script type='text/javascript' src='debug.js'
></script>
38 <script type='text/javascript'
>
40 // <% nvram("upnp_enable"); %>
43 nvram
.upnp_enable
= fixInt(nvram
.upnp_enable
, 0, 3, 0);
46 function submitDelete(proto
, eport
)
48 form
.submitHidden('upnp.cgi', {
51 _redirect
: 'forward-upnp.asp' });
54 function deleteData(data
)
56 if (!confirm('Delete ' + data
[3] + ' ' + data
[0] + ' -> ' + data
[2] + ':' + data
[1] + ' ?')) return;
57 submitDelete(data
[3], data
[0]);
60 var ug
= new TomatoGrid();
62 ug
.onClick = function(cell
) {
63 deleteData(cell
.parentNode
.getRowData());
66 ug
.rpDel = function(e
) {
67 deleteData(PR(e
).getRowData());
71 ug
.setup = function() {
72 this.init('upnp-grid', 'sort delete');
73 this.headerSet(['External', 'Internal', 'Internal Address', 'Protocol', 'Description']);
77 ug
.populate = function() {
78 var i
, j
, r
, row
, data
;
80 if (nvram
.upnp_enable
!= 0) {
81 var data
= mupnp_data
.split('\n');
82 for (i
= 0; i
< data
.length
; ++i
) {
83 r
= data
[i
].match(/^(UDP|TCP)\s+(\d+)\s+(.+?)\s+(\d+)\s+\[(.*)\]$/);
84 if (r
== null) continue;
85 row
= this.insertData(-1, [r
[2], r
[4], r
[3], r
[1], r
[5]]);
88 for (j
= 0; j
< 5; ++j
) {
89 elem
.addClass(row
.cells
[j
], 'disabled');
92 for (j
= 0; j
< 5; ++j
) {
93 row
.cells
[j
].title
= 'Click to delete';
98 E('upnp-delete-all').disabled
= (ug
.getDataCount() == 0);
103 if (!confirm('Delete all entries?')) return;
104 submitDelete('*', '0');
107 function verifyFields(focused
, quiet
)
115 fom
.upnp_enable
.value
= 0;
116 if (fom
.f_enable_upnp
.checked
) fom
.upnp_enable
.value
= 1;
117 if (fom
.f_enable_natpmp
.checked
) fom
.upnp_enable
.value
|= 2;
128 <body onload='init()'
>
129 <form id='_fom' method='post' action='tomato.cgi'
>
130 <table id='container' cellspacing=
0>
131 <tr><td colspan=
2 id='header'
>
132 <div class='title'
>Tomato
</div>
133 <div class='version'
>Version <%
version(); %></div>
135 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
137 <div id='ident'
><%
ident(); %></div>
141 <input type='hidden' name='_nextpage' value='forward-upnp.asp'
>
142 <input type='hidden' name='_service' value='upnp-restart'
>
144 <input type='hidden' name='upnp_enable'
>
146 <div class='section-title'
>Forwarded Ports
</div>
147 <div class='section'
>
148 <table id='upnp-grid' class='tomato-grid'
></table>
149 <div style='width:
100%; text-align: right'
><input type='button' value='Delete All' onclick='deleteAll()' id='upnp-delete-all'
> <input type='button' value='Refresh' onclick='javascript:reloadPage();'
></div>
152 <div class='section-title'
>Settings
</div>
153 <div class='section'
>
154 <script type='text/javascript'
>
155 createFieldTable('', [
156 { title
: 'Enable UPnP', name
: 'f_enable_upnp', type
: 'checkbox', value
: (nvram
.upnp_enable
& 1) },
157 { title
: 'Enable NAT-PMP', name
: 'f_enable_natpmp', type
: 'checkbox', value
: (nvram
.upnp_enable
& 2) }
166 <tr><td id='footer' colspan=
2>
167 <span id='footer-msg'
></span>
168 <input type='button' value='Save' id='save-button' onclick='save()'
>
169 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'
>
173 <script type='text/javascript'
>ug
.setup();</script>