You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
4.2 KiB
Plaintext
179 lines
4.2 KiB
Plaintext
<!DOCTYPE html>
|
|
<!--
|
|
Tomato GUI
|
|
Copyright (C) 2006-2010 Jonathan Zarate
|
|
http://www.polarcloud.com/tomato/
|
|
|
|
For use with Tomato Firmware only.
|
|
No part of this file may be used without permission.
|
|
-->
|
|
<html lang="en-GB">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
|
<meta name="robots" content="noindex,nofollow">
|
|
<title>[<% ident(); %>] Forwarding: Triggered</title>
|
|
<link rel="stylesheet" type="text/css" href="tomato.css?rel=<% version(); %>">
|
|
<% css(); %>
|
|
<script src="tomato.js?rel=<% version(); %>"></script>
|
|
|
|
<script>
|
|
|
|
// <% nvram("trigforward"); %>
|
|
|
|
var tg = new TomatoGrid();
|
|
|
|
|
|
tg.setup = function() {
|
|
this.init('tg-grid', 'sort', 50, [
|
|
{ type: 'checkbox', prefix: '<div class="centered">', suffix: '<\/div>' },
|
|
{ type: 'select', options: [[1, 'TCP'],[2, 'UDP'],[3,'Both']] },
|
|
{ type: 'text', maxlen: 16 },
|
|
{ type: 'text', maxlen: 16 },
|
|
{ type: 'text', maxlen: 32 }]);
|
|
this.headerSet(['On','Protocol','Trigger Ports','Forwarded Ports','Description']);
|
|
var nv = nvram.trigforward.split('>');
|
|
for (var i = 0; i < nv.length; ++i) {
|
|
var r;
|
|
if (r = nv[i].match(/^(\d)<(\d)<(.+?)<(.+?)<(.*)$/)) {
|
|
r[1] *= 1;
|
|
r[2] *= 1;
|
|
r[3] = r[3].replace(/:/g, '-');
|
|
r[4] = r[4].replace(/:/g, '-');
|
|
tg.insertData(-1, r.slice(1, 6));
|
|
}
|
|
}
|
|
tg.sort(4);
|
|
tg.showNewEditor();
|
|
}
|
|
|
|
tg.resetNewEditor = function() {
|
|
var f = fields.getAll(this.newEditor);
|
|
f[0].checked = 1;
|
|
f[1].selectedIndex = 0;
|
|
f[2].value = '';
|
|
f[3].value = '';
|
|
f[4].value = '';
|
|
ferror.clearAll(f);
|
|
}
|
|
|
|
tg.dataToView = function(data) {
|
|
return [data[0] ? '⭐' : '', ['TCP', 'UDP', 'Both'][data[1] - 1], data[2], data[3], data[4]];
|
|
}
|
|
|
|
tg.fieldValuesToData = function(row) {
|
|
var f = fields.getAll(row);
|
|
|
|
return [f[0].checked ? 1 : 0,f[1].value,f[2].value,f[3].value,f[4].value];
|
|
}
|
|
|
|
tg.sortCompare = function(a, b) {
|
|
var col = this.sortColumn;
|
|
var da = a.getRowData();
|
|
var db = b.getRowData();
|
|
var r;
|
|
|
|
switch (col) {
|
|
case 2:
|
|
case 3:
|
|
r = cmpInt(da[col], db[col]);
|
|
break;
|
|
default:
|
|
r = cmpText(da[col], db[col]);
|
|
break;
|
|
}
|
|
|
|
return this.sortAscending ? r : -r;
|
|
}
|
|
|
|
tg.verifyFields = function(row, quiet) {
|
|
var f = fields.getAll(row);
|
|
|
|
ferror.clearAll(f);
|
|
|
|
if (!v_portrange(f[2], quiet))
|
|
return 0;
|
|
|
|
if (!v_portrange(f[3], quiet))
|
|
return 0;
|
|
|
|
f[4].value = f[4].value.replace(/>/g, '_');
|
|
if (!v_nodelim(f[4], quiet, 'Description'))
|
|
return 0;
|
|
|
|
return 1;
|
|
}
|
|
|
|
function save() {
|
|
if (tg.isEditing())
|
|
return;
|
|
|
|
var data = tg.getAllData();
|
|
var s = '';
|
|
for (var i = 0; i < data.length; ++i) {
|
|
data[i][2] = data[i][2].replace(/-/g, ':');
|
|
data[i][3] = data[i][3].replace(/-/g, ':');
|
|
s += data[i].join('<') + '>';
|
|
}
|
|
var fom = E('t_fom');
|
|
fom.trigforward.value = s;
|
|
form.submit(fom, 1);
|
|
}
|
|
|
|
function init() {
|
|
tg.recolor();
|
|
tg.resetNewEditor();
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body onload="init()">
|
|
<form id="t_fom" method="post" action="tomato.cgi">
|
|
<table id="container">
|
|
<tr><td colspan="2" id="header">
|
|
<div class="title"><a href="/">FreshTomato</a></div>
|
|
<div class="version">Version <% version(); %> on <% nv("t_model_name"); %></div>
|
|
</td></tr>
|
|
<tr id="body"><td id="navi"><script>navi()</script></td>
|
|
<td id="content">
|
|
<div id="ident"><% ident(); %> | <script>wikiLink();</script></div>
|
|
|
|
<!-- / / / -->
|
|
|
|
<input type="hidden" name="_nextpage" value="forward.asp">
|
|
<input type="hidden" name="_service" value="firewall-restart">
|
|
<input type="hidden" name="trigforward">
|
|
|
|
<!-- / / / -->
|
|
|
|
<div class="section-title">Triggered Port Forwarding</div>
|
|
<div class="section">
|
|
<div class="tomato-grid" id="tg-grid"></div>
|
|
</div>
|
|
|
|
<!-- / / / -->
|
|
|
|
<div class="section-title">Notes</div>
|
|
<div class="section">
|
|
<ul>
|
|
<li>Use "-" to specify a range of ports (200-300).</li>
|
|
<li>Trigger Ports are the initial LAN to WAN "trigger".</li>
|
|
<li>Forwarded Ports are the WAN to LAN ports that are opened if the "trigger" is activated.</li>
|
|
<li>These ports are automatically closed after a few minutes of inactivity.</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- / / / -->
|
|
|
|
<div id="footer">
|
|
<span id="footer-msg"></span>
|
|
<input type="button" value="Save" id="save-button" onclick="save()">
|
|
<input type="button" value="Cancel" id="cancel-button" onclick="reloadPage();">
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
</form>
|
|
<script>tg.setup();</script>
|
|
</body>
|
|
</html>
|