-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvanced_GWStaticRoute_Content.asp
329 lines (328 loc) · 12.4 KB
/
Advanced_GWStaticRoute_Content.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns:v>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<link rel="shortcut icon" href="images/favicon.png">
<link rel="icon" href="images/favicon.png">
<title><#548#> - <#197#></title>
<link rel="stylesheet" type="text/css" href="index_style.css">
<link rel="stylesheet" type="text/css" href="form_style.css">
<link rel="stylesheet" type="text/css" href="device-map/device-map.css">
<script language="JavaScript" type="text/javascript" src="/state.js"></script>
<script language="JavaScript" type="text/javascript" src="/general.js"></script>
<script language="JavaScript" type="text/javascript" src="/popup.js"></script>
<script type="text/javascript" language="JavaScript" src="/help.js"></script>
<script type="text/javascript" language="JavaScript" src="/validator.js"></script>
<script language="JavaScript" type="text/javascript" src="/client_function.js"></script>
<script>
var sr_rulelist_array = '<% nvram_get("sr_rulelist"); %>';
function initial(){
show_menu();
showsr_rulelist();
setTimeout("showDropdownClientList('setClientIP', 'ip', 'all', 'ClientList_Block_PC', 'pull_arrow', 'online');", 1000);
}
function applyRule(){
var rule_num = document.getElementById('sr_rulelist_table').rows.length;
var item_num = document.getElementById('sr_rulelist_table').rows[0].cells.length;
var tmp_value = "";
for(i=0; i<rule_num; i++){
tmp_value += "<"
for(j=0; j<item_num-1; j++){
tmp_value += document.getElementById('sr_rulelist_table').rows[i].cells[j].innerHTML;
if(j != item_num-2)
tmp_value += ">";
}
}
if(tmp_value == "<"+"<#1324#>" || tmp_value == "<")
tmp_value = "";
document.form.sr_rulelist.value = tmp_value;
showLoading();
document.form.submit();
}
function done_validating(action){
refreshpage();
}
function GWStatic_validate_duplicate_noalert(o, v, l, off){
for (var i=0; i<o.length; i++)
{
if (entry_cmp(o[i][off], v, l)==0){
return true;
}
}
return false;
}
function GWStatic_validate_duplicate(o, v, l, off){
for(var i = 0; i < o.length; i++){
if(entry_cmp(o[i][off].toLowerCase(), v.toLowerCase(), l) == 0){
alert("<#1363#>");
return true;
}
}
return false;
}
function addRow(obj, head){
if(head == 1)
sr_rulelist_array += "<"
else
sr_rulelist_array += ">"
sr_rulelist_array += obj.value;
obj.value = "";
}
function addRow_Group(upper){
if('<% nvram_get("sr_enable_x"); %>' != "1")
document.form.sr_enable_x[0].checked = true;
var rule_num = document.getElementById('sr_rulelist_table').rows.length;
var item_num = document.getElementById('sr_rulelist_table').rows[0].cells.length;
if(rule_num >= upper){
alert("<#1369#> " + upper + " <#1370#>");
return false;
}
if(document.form.sr_ipaddr_x_0.value==""){
alert("<#140#>");
document.form.sr_ipaddr_x_0.focus();
document.form.sr_ipaddr_x_0.select();
return false;
}else if(document.form.sr_netmask_x_0.value==""){
alert("<#140#>");
document.form.sr_netmask_x_0.focus();
document.form.sr_netmask_x_0.select();
return false;
}else if(document.form.sr_gateway_x_0.value==""){
alert("<#140#>");
document.form.sr_gateway_x_0.focus();
document.form.sr_gateway_x_0.select();
return false;
}else if(validator.validIPForm(document.form.sr_ipaddr_x_0, 0) && validator.validIPForm(document.form.sr_gateway_x_0, 0)){
var default_netmask = "";
var wrong_netmask = 0;
var netmask_obj = document.form.sr_netmask_x_0;
var netmask_num = inet_network(netmask_obj.value);
if(netmask_num==0){
var netmask_reverse_num = 0; //Viz 2011.07 : Let netmask 0.0.0.0 pass
}else{
var netmask_reverse_num = ~netmask_num;
}
if(netmask_num < 0) wrong_netmask = 1;
var test_num = netmask_reverse_num;
while(test_num != 0){
if((test_num+1)%2 == 0)
test_num = (test_num+1)/2-1;
else{
wrong_netmask = 1;
break;
}
}
if(wrong_netmask == 1){
alert(netmask_obj.value+" <#149#>");
netmask_obj.value = default_netmask;
netmask_obj.focus();
netmask_obj.select();
return false;
}
if(item_num >=2){
for(i=0; i<rule_num; i++){
if(document.form.sr_ipaddr_x_0.value == document.getElementById('sr_rulelist_table').rows[i].cells[0].innerHTML
&& document.form.sr_gateway_x_0.value == document.getElementById('sr_rulelist_table').rows[i].cells[2].innerHTML){
alert("<#1363#>");
document.form.sr_ipaddr_x_0.value="";
document.form.sr_ipaddr_x_0.focus();
document.form.sr_ipaddr_x_0.select();
return false;
}
}
}
addRow(document.form.sr_ipaddr_x_0 ,1);
addRow(document.form.sr_netmask_x_0, 0);
addRow(document.form.sr_gateway_x_0, 0);
addRow(document.form.sr_matric_x_0, 0);
addRow(document.form.sr_if_x_0, 0);
document.form.sr_if_x_0.value="LAN";
showsr_rulelist();
}else{
return false;
}
}
function edit_Row(r){
var i=r.parentNode.parentNode.rowIndex;
document.form.sr_ipaddr_x_0.value = document.getElementById('sr_rulelist_table').rows[i].cells[0].innerHTML;
document.form.sr_netmask_x_0.value = document.getElementById('sr_rulelist_table').rows[i].cells[1].innerHTML;
document.form.sr_gateway_x_0.value = document.getElementById('sr_rulelist_table').rows[i].cells[2].innerHTML;
document.form.sr_matric_x_0.value = document.getElementById('sr_rulelist_table').rows[i].cells[3].innerHTML;
document.form.sr_if_x_0.value = document.getElementById('sr_rulelist_table').rows[i].cells[4].innerHTML;
del_Row(r);
}
function del_Row(r){
var i=r.parentNode.parentNode.rowIndex;
document.getElementById('sr_rulelist_table').deleteRow(i);
var sr_rulelist_value = "";
for(k=0; k<document.getElementById('sr_rulelist_table').rows.length; k++){
for(j=0; j<document.getElementById('sr_rulelist_table').rows[k].cells.length-1; j++){
if(j == 0)
sr_rulelist_value += "<";
else
sr_rulelist_value += ">";
sr_rulelist_value += document.getElementById('sr_rulelist_table').rows[k].cells[j].innerHTML;
}
}
sr_rulelist_array = sr_rulelist_value;
if(sr_rulelist_array == "")
showsr_rulelist();
}
function showsr_rulelist(){
var sr_rulelist_row = sr_rulelist_array.split('<');
var code = "";
code +='<table width="100%" border="1" cellspacing="0" cellpadding="4" align="center" class="list_table" id="sr_rulelist_table">';
if(sr_rulelist_row.length == 1)
code +='<tr><td style="color:#FFCC00;" colspan="6"><#1324#></td></tr>';
else{
for(var i = 1; i < sr_rulelist_row.length; i++){
code +='<tr id="row'+i+'">';
var sr_rulelist_col = sr_rulelist_row[i].split('>');
var wid=[20, 20, 28, 8, 12];
for(var j = 0; j < sr_rulelist_col.length; j++){
code +='<td width="'+wid[j]+'%">'+ sr_rulelist_col[j] +'</td>'; //IP width="98"
}
code +='<td width="12%"><!--input class="edit_btn" onclick="edit_Row(this);" value=""/-->';
code +='<input class="remove_btn" onclick="del_Row(this);" value=""/></td></tr>';
}
}
code +='</table>';
document.getElementById("sr_rulelist_Block").innerHTML = code;
}
function setClientIP(ipaddr){
document.form.sr_gateway_x_0.value = ipaddr;
hideClients_Block();
}
function hideClients_Block(){
document.getElementById("pull_arrow").src = "/images/arrow-down.gif";
document.getElementById('ClientList_Block_PC').style.display='none';
}
function pullLANIPList(obj){
var element = document.getElementById('ClientList_Block_PC');
var isMenuopen = element.offsetWidth > 0 || element.offsetHeight > 0;
if(isMenuopen == 0){
obj.src = "/images/arrow-top.gif"
element.style.display = 'block';
document.form.sr_gateway_x_0.focus();
}
else
hideClients_Block();
}
function Ctrl_LANIPList(obj){
if(obj.value != "LAN")
document.getElementById("pull_arrow").style.display ="none";
else
document.getElementById("pull_arrow").style.display ="";
}
</script>
</head>
<body onload="initial();" onunLoad="return unload_body();">
<div id="TopBanner"></div>
<div id="Loading" class="popup_bg"></div>
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
<form method="post" name="form" id="ruleForm" action="/start_apply.htm" target="hidden_frame">
<input type="hidden" name="current_page" value="Advanced_GWStaticRoute_Content.asp">
<input type="hidden" name="next_page" value="">
<input type="hidden" name="modified" value="0">
<input type="hidden" name="action_mode" value="apply_new">
<input type="hidden" name="action_wait" value="10">
<input type="hidden" name="action_script" value="restart_net">
<input type="hidden" name="first_time" value="">
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>">
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>">
<input type="hidden" name="sr_num_x_0" value="<% nvram_get("sr_num_x"); %>" readonly="1">
<input type="hidden" name="sr_rulelist" value=''>
<table class="content" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="17"> </td>
<td valign="top" width="202">
<div id="mainMenu"></div>
<div id="subMenu"></div>
</td>
<td valign="top">
<div id="tabMenu" class="submenuBlock"></div>
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" >
<table width="760px" border="0" cellpadding="4" cellspacing="0" class="FormTitle" id="FormTitle">
<tbody>
<tr>
<td bgcolor="#4D595D" valign="top" >
<div> </div>
<div class="formfonttitle"><#194#> - <#197#></div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
<div class="formfontdesc"><#1777#></div>
<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable">
<thead>
<tr>
<td colspan="2"><#1924#></td>
</tr>
</thead>
<tr>
<th><#1776#></th>
<td>
<input type="radio" value="1" name="sr_enable_x" class="input" onclick="return change_common_radio(this, 'RouterConfig', 'sr_enable_x', '1')" <% nvram_match("sr_enable_x", "1", "checked"); %>><#66#>
<input type="radio" value="0" name="sr_enable_x" class="input" onclick="return change_common_radio(this, 'RouterConfig', 'sr_enable_x', '0')" <% nvram_match("sr_enable_x", "0", "checked"); %>><#65#>
</td>
</tr>
</table>
<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" class="FormTable_table">
<thead>
<tr>
<td colspan="6" id="GWStatic"><#1775#> (<#1473#> 64)</td>
</tr>
</thead>
<tr>
<th><a href="javascript:void(0);" onClick="openHint(6,1);"><div class="table_text"><#1779#></div></a></th>
<th><a href="javascript:void(0);" onClick="openHint(6,2);"><div class="table_text"><#1780#></div></a></th>
<th><a href="javascript:void(0);" onClick="openHint(6,3);"><div class="table_text"><#1778#></div></a></th>
<th><a href="javascript:void(0);" onClick="openHint(6,4);"><div class="table_text"><#1781#></div></a></th>
<th><a href="javascript:void(0);" onClick="openHint(6,5);"><div class="table_text"><#2200#></div></a></th>
<th><#1472#></th>
</tr>
<tr>
<td width="20%">
<input type="text" class="input_15_table" maxlength="15" name="sr_ipaddr_x_0" onKeyPress="return validator.isIPAddr(this, event)" autocorrect="off" autocapitalize="off">
<td width="20%"><input type="text" maxlength="15" class="input_15_table" name="sr_netmask_x_0" onKeyPress="return validator.isIPAddr(this, event)" autocorrect="off" autocapitalize="off"></td>
<td width="28%"><input type="text" class="input_15_table" maxlength="15" name="sr_gateway_x_0" style="margin-left:-22px;width:160px;" onKeyPress="return validator.isIPAddr(this, event)" onClick="hideClients_Block();" autocorrect="off" autocapitalize="off">
<img id="pull_arrow" height="14px;" src="/images/arrow-down.gif" style="position:absolute;" onclick="pullLANIPList(this);" title="<#1809#>">
<div id="ClientList_Block_PC" class="clientlist_dropdown" style="margin-left:7px;"></div>
</td>
<td width="8%"><input type="text" maxlength="3" class="input_3_table" name="sr_matric_x_0" onKeyPress="return validator.isNumber(this, event);" autocorrect="off" autocapitalize="off"></td>
<td width="12%">
<select name="sr_if_x_0" class="input_option" style="width:62px;" onchange="Ctrl_LANIPList(this);">
<option value="LAN">LAN</option>
<option value="MAN">MAN</option>
<option value="WAN">WAN</option>
</select>
</td>
<td width="12%">
<div>
<input type="button" class="add_btn" onClick="addRow_Group(64);" value="">
</div>
</td>
</tr>
</table>
<div id="sr_rulelist_Block"></div>
<div class="apply_gen">
<input name="button" type="button" class="button_gen" onclick="applyRule();" value="<#73#>"/>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</form>
</tr>
</table>
</td>
<td width="10" align="center" valign="top"> </td>
</tr>
</table>
<div id="footer"></div>
</body>
</html>