<html>
   <head>
      <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
      <link rel="stylesheet" href='stylemain.css' type='text/css'>
         <link rel="stylesheet" href='colors.css' type='text/css'>
            <script language="javascript" src="util.js"></script>
            <script type="text/javascript" src="lang/b28n.js"></script>
<script language="javascript"><%ejGetOther(forbidHTMLCode)%></script>
<script language="javascript">
<!-- hide

//var lanIpIfc = new Array(<%ejGetOther(AncestorList, lanIpFirewallIfc)%>);
//var wanIpIfc = new Array(<%ejGetOther(AncestorList, wanIpFirewallIfc)%>);
//var wanPppIfc = new Array(<%ejGetOther(AncestorList, wanPppFirewallIfc)%>);

var obj1Items = '<%ejGetObject(MDMOID_DEV2_FIREWALL_EXCEPTION)%>';

var obj1Rows = numOfRow(obj1Items);
/* NOTICE: MDMOID_LAN_IP_INTF_FIREWALL_EXCEPTION is Type1/Type2 object, follow variables are arrays */
var iPInterfaceArray = getColFromList(obj1Items, "IPInterface");


var obj2Items = '<%ejGetObject(MDMOID_DEV2_FIREWALL_EXCEPTION_RULE)%>';

var obj2Rows = numOfRow(obj2Items);
/* NOTICE: MDMOID_WAN_IP_CONN_FIREWALL_EXCEPTION is Type1/Type2 object, follow variables are arrays */
var obj2_enableArray = getColFromList(obj2Items, "Enable");
var obj2_filterNameArray = getColFromList(obj2Items, "FilterName");
var obj2_ipverArray = getColFromList(obj2Items, "IPVersion");
var obj2_protocolArray = getColFromList(obj2Items, "Protocol");
var obj2_sourcePortStartArray = getColFromList(obj2Items, "SourcePortStart");
var obj2_sourcePortEndArray = getColFromList(obj2Items, "SourcePortEnd");
var obj2_destinationPortStartArray = getColFromList(obj2Items, "DestinationPortStart");
var obj2_destinationPortEndArray = getColFromList(obj2Items, "DestinationPortEnd");
var obj2_sourceIPAddressArray = getColFromList(obj2Items, "SourceIPAddress");
//var obj2_endSourceIPAddressArray = getColFromList(obj2Items, "SourceIPAddress");
var obj2_sourceNetMaskArray = getColFromList(obj2Items, "SourceNetMask");
var obj2_destinationIPAddressArray = getColFromList(obj2Items, "DestinationIPAddress");
//var obj2_endDestinationIPAddressArray = getColFromList(obj2Items, "DestinationIPAddress");
var obj2_destinationNetMaskArray = getColFromList(obj2Items, "DestinationNetMask");

var locationQuery='sessionKey=<%ejGetOther(sessionKey)%>';
var NumOfRowWithLst = 0;


function initTranslation() {	
	var idArray = new Array("scinfltview_title","scinfltview_tips1","scinfltview_accepted","scinfltview_tips2","scinfltview_configGuid","scinfltview_inter","scoutfltview_filterName","scoutfltview_ipVersion","scoutfltview_proto",
		"scoutfltview_srcPre","scoutfltview_srcPort","scoutfltview_dstPre","scoutfltview_dstPort","scoutfltview_remove","scoutfltview_add","scoutfltview_add1","scoutfltview_remove1","scoutfltview_remove2");
	setAllIdValue(idArray);
}

function frmLoad() {
	initTranslation();

}

function displayIp(ip, mask){
	if(ip != ''){
		if(0)//( endip != '')
			document.writeln("<td class='tablesize'>&nbsp;"+ ip +"</td>");
		else if( mask != '')
			document.writeln("<td class='tablesize'>&nbsp;"+ ip +" / "+ mask +"</td>");
		else
			document.writeln("<td class='tablesize'>&nbsp;"+ ip +"</td>");
	}
	else
		document.writeln("<td class='tablesize'>&nbsp;</td>");
}

function displayPort(start, end){
	if(start != '0'){
		if( end != '0')
			document.writeln("<td class='tablesize'>&nbsp;"+ start +":"+ end +"</td>");
		else
			document.writeln("<td class='tablesize'>&nbsp;"+ start +"</td>");
	}
	else
		document.writeln("<td class='tablesize'>&nbsp;</td>");
}

function displayProtocol(protocol){
	if(protocol == 'TCP or UDP')
		document.writeln("<td class='tablesize'>&nbsp;TCP/UDP</td>");
	else
		document.writeln("<td class='tablesize'>&nbsp;"+ protocol +"</td>");
}

function displayIfc(name){
	var i;
	var ifcNum = 0;

	document.writeln("<td class='tablesize'>&nbsp;");

	for(i=0; i < obj1Rows; i++){ //LAN IP Ifc
		if(enableArray[i] == 1 && filterNameArray[i] == name){
			if(ifcNum > 0)
				document.writeln(",");
			document.writeln(lanIpIfc[i]);
			enableArray[i] = 0;
			ifcNum++;
		}
	}

	for(i=0;  i < obj2Rows; i++){//WAN IP Ifc
		if(obj2_enableArray[i] == 1 && obj2_filterNameArray[i] == name){
			if(ifcNum > 0)
				document.writeln(",");
			document.writeln(wanIpIfc[i]);
			obj2_enableArray[i] = 0;
			ifcNum++;
		}
	}

	for(i=0;  i < obj3Rows; i++){//WAN PPP Ifc
		if(obj3_enableArray[i] == 1 && obj3_filterNameArray[i] == name){
			if(ifcNum > 0)
				document.writeln(",");
			document.writeln(wanPppIfc[i]);
			obj3_enableArray[i] = 0;
			ifcNum++;
		}
	}
	document.writeln("</td>");
}


function fillObj2Items(){
	var i;
	for(i=0; i < obj2Rows; i++){
		if(obj2_enableArray[i] == 1){
			document.writeln("<tr>");
			document.writeln("<td class='tablesize'>&nbsp;"+ obj2_filterNameArray[i] +"</td>");
			//displayIfc(obj2_filterNameArray[i]);
			document.writeln("<td class='tablesize'>&nbsp;"+ iPInterfaceArray[i] +"</td>");			
			document.writeln("<td class='tablesize'>&nbsp;"+ obj2_ipverArray[i] +"</td>");
			displayProtocol(obj2_protocolArray[i]);
			displayIp(obj2_sourceIPAddressArray[i], obj2_sourceNetMaskArray[i]);
			displayPort(obj2_sourcePortStartArray[i], obj2_sourcePortEndArray[i]);
			displayIp(obj2_destinationIPAddressArray[i], obj2_destinationNetMaskArray[i]);
			displayPort(obj2_destinationPortStartArray[i], obj2_destinationPortEndArray[i]);
			document.writeln("<td align='center'><input type='checkbox' name='rml' value='" + obj2_filterNameArray[i] +"' ></td>");
			document.writeln("</tr>");
		       NumOfRowWithLst++;
		}
	}
}


function addClick() {
   var loc = 'scinflt.html';
   var code = 'location="' + loc + '"';
   eval(code);
}

function removeClick(rml) {
   var lst = '';
   if (rml.length > 0)
      for (i = 0; i < rml.length; i++) {
         if ( rml[i].checked == true )
            lst += rml[i].value + ', ';
      }
   else if ( rml.checked == true )
      lst = rml.value;

   var loc = 'scinflt.cmd?action=remove&rmLst=' + lst + '&' + locationQuery;
   var code = 'location="' + loc + '"';
   eval(code);
}

// done hiding -->
</script>

</head>
<body onLoad='frmLoad()'>
<blockquote>
  <form>
    <b><span id='scinfltview_title'>Incoming IP Filtering Setup</span></b><br><br>
    <br><span id='scinfltview_tips1'>When the firewall is enabled on a WAN or LAN interface, all incoming IP traffic is BLOCKED. However, some IP traffic can be </span><b><font color='green'><span id='scinfltview_accepted'>ACCEPTED</span></font></b><span id='scinfltview_tips2'> by setting up filters.</span><br>
    <br><span id='scinfltview_configGuid'>Choose Add or Remove to configure incoming IP filters.</span><br>
    <br>
    <center>
	<table border='1' cellpadding='4' cellspacing='0'>
	<tr>
          <td class='hd' id='scoutfltview_filterName'>Filter Name</td> 
          <td class='hd' id='scinfltview_inter'>Interfaces</td>
          <td class='hd' id='scoutfltview_ipVersion'>IP Version</td>
          <td class='hd' id='scoutfltview_proto'>Protocol</td>
          <td class='hd' id='scoutfltview_srcPre'>SrcIP/ PrefixLength</td>
          <td class='hd' id='scoutfltview_srcPort'>SrcPort</td>
          <td class='hd' id='scoutfltview_dstPre'>DstIP/ PrefixLength</td>
          <td class='hd' id='scoutfltview_dstPort'>DstPort</td>
          <td class='hd' id='scoutfltview_remove'>Remove</td>
	</tr>
	<script language='javascript'>
	<!--hide
		fillObj2Items();
	//-->
	</script>
      </table>
      <br>
      <br>
	<script language='javascript'>
	<!--hide
		if(NumOfRowWithLst >= 128){
			document.writeln("<input type='button' onClick='addClick()' value='Add' disabled id='scoutfltview_add'>");
		}else{
			document.writeln("<input type='button' onClick='addClick()' value='Add' id='scoutfltview_add1'>");
		}
		if((obj1Rows > 0)||(obj2Rows > 0)||(obj3Rows > 0)){
			document.writeln("<input type='button' onClick='removeClick(this.form.rml)' value='Remove' id='scoutfltview_remove1'>");
		}else{
			document.writeln("<input type='button' onClick='removeClick(this.form.rml)' value='Remove' disabled id='scoutfltview_remove2'>");
		}
	//-->
	</script>
    </center>
  </form>
</blockquote>
</body>
</html>
