<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 type="text/javascript" src="lang/b28n.js"></script>
<script language="javascript"><%ejGetOther(forbidHTMLCode)%></script>
<script language="javascript"> 
<!-- hide 

//var obj1Items = '<%ejGetObject(MDMOID_WAN_IP_CONN)%>';
//var obj1Rows = numOfRow(obj1Items);
/* NOTICE: MDMOID_WAN_IP_CONN is Type1/Type2 object, follow variables are arrays */
//var connectionTypeArray = getColFromList(obj1Items, 'ConnectionType');
//var IfNameArray = getColFromList(obj1Items, 'X_BROADCOM_COM_IfName');


var obj2Items = '<%ejGetObject(MDMOID_DEV2_MAC_FILTER)%>';
var obj2Rows = numOfRow(obj2Items);
var obj2_enableArray = getColFromList(obj2Items, "Enable");
var obj2_iPInterfaceArray = getColFromList(obj2Items, 'X_BROADCOM_COM_IPInterface');
var obj2_policyArray = getColFromList(obj2Items, "Policy");

var obj3Items = '<%ejGetObject(MDMOID_DEV2_MAC_FILTER_CFG)%>';
var obj3Rows = numOfRow(obj3Items);
/* NOTICE: MDMOID_MAC_FILTER_CFG is Type1/Type2 object, follow variables are arrays */
var obj3_enableArray = getColFromList(obj3Items, "Enable");
var obj3_protocolArray = getColFromList(obj3Items, "Protocol");
var obj3_directionArray = getColFromList(obj3Items, "Direction");
var obj3_sourceMACArray = getColFromList(obj3Items, "SourceMAC");
var obj3_destinationMACArray = getColFromList(obj3Items, "DestinationMAC");
//var obj3_userPriorityArray = getColFromList(obj3Items, "");
//var obj3_vlanIDArray = getColFromList(obj3Items, "");

var macFltIfc = new Array(<%ejGetOther(AncestorList, macFltlIfc)%>);
var locationQuery='sessionKey=<%ejGetOther(sessionKey)%>';


function initTranslation() {
	var idArray = new Array("scmacfltview_title1","scmacfltview_title2","scmacfltview_title3","scmacfltview_title4","scmacfltview_title5","scmacfltview_title6","scmacfltview_title7","scmacfltview_title8",
		"scmacfltview_title10","scmacfltview_title11","scmacfltview_title12","scmacfltview_inter","scmacfltview_policy","scmacfltview_change","scmacfltview_chgPly","scmacfltview_confgCh","scmacfltview_interfa",
		"scmacfltview_proto","scmacfltview_dst","scmacfltview_srt","scmacfltview_fram","scmacfltview_remove","scmacfltview_add","scmacfltview_add1","scmacfltview_remove1","scmacfltview_remove2");
	setAllIdValue(idArray);
}

function frmLoad() {
	initTranslation();

}
function fillObj1Items(){
	var i;
	//if(obj1Rows != obj2Rows)
	//	alert(_("scmacfltview_getObjErr"));
	for(i=0; i < obj2Rows; i++){
		if(1/*connectionTypeArray[i] == 'IP_Bridged'*/){
			document.writeln("<tr>");
			document.writeln("<td class='tablesize'>"+ obj2_iPInterfaceArray[i] +"</td>");	
			if(obj2_policyArray[i] == 'FORWARD')
				document.writeln("<td class='tablesize'><b><font color='green'>"+ obj2_policyArray[i] +"</font></b></td>");
			else
				document.writeln("<td class='tablesize'><b><font color='red'>"+ obj2_policyArray[i] +"</font></b></td>");
				document.writeln("<td align='center'><input type='checkbox' name='ChangePolicy' value='" +  obj2_iPInterfaceArray[i] +"' ></td>");
			document.writeln("</tr>");
		}
	}
}

function fillObj3Items(){
	var i;
	for(i=0; i < obj3Rows; i++){
		if(obj3_enableArray[i] == 1){
			document.writeln("<tr>");
			document.writeln("<td class='tablesize'>&nbsp;"+ macFltIfc[i] +"</td>");
			document.writeln("<td class='tablesize'>&nbsp;"+ obj3_protocolArray[i] +"</td>");
			document.writeln("<td class='tablesize'>&nbsp;"+ obj3_destinationMACArray[i] +"</td>");
			document.writeln("<td class='tablesize'>&nbsp;"+ obj3_sourceMACArray[i] +"</td>");
			document.writeln("<td class='tablesize'>&nbsp;"+ obj3_directionArray[i] +"</td>");		
			document.writeln("<td align='center'><input type='checkbox' name='rml' value='" 
				+ obj3_protocolArray[i] + "|"
				+ obj3_destinationMACArray[i] + "|"
				+ obj3_sourceMACArray[i] + "|"
				+ macFltIfc[i] + "|"
				+ obj3_directionArray[i] + "' ></td>");
			document.writeln("</tr>");
		}
	}
}


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

   var loc = 'scmacflt.cmd?action=changemp&changeLst=' + lst +"&"+ locationQuery;
   var code = 'location="' + loc + '"';
   eval(code);
}

function addClick() {
   var loc = 'scmacflt.html';

   var code = 'location="' + loc + '"';
   eval(code);
}

function removeClick(rml) {
   var lst = '';
   var rmlnum = 0;
   if (rml.length > 0){
      for (i = 0; i < rml.length; i++) {
         if ( rml[i].checked == true ){
            lst += rml[i].value + ', ';
	     rmlnum++;
	  }
      }
	if(rmlnum > 10){
	    alert(_("scmacfltview_removeTooMany"));
	    return;
	}
   }
   else if ( rml.checked == true )
      lst = rml.value;
   var loc = 'scmacflt.cmd?action=remove&rmLst=' + lst+"&"+ locationQuery;

   var code = 'location="' + loc + '"';
   eval(code);
}

// done hiding -->
</script></head>
<body onLoad='frmLoad()'>
<blockquote> 
  <form>
    <b id='scmacfltview_title1'>MAC Filtering Setup</b><br>
    <br><span id='scmacfltview_title2'>MAC Filtering is only effective on ATM PVCs configured in Bridge mode. </span><b><font color='green'><span id='scmacfltview_title3'>FORWARDED</span></font></b> 
    <span id='scmacfltview_title4'>means that all MAC layer frames will be </span><b><font color='green'><span id='scmacfltview_title5'>FORWARDED</span></font></b><span id='scmacfltview_title6'> except those matching with any of the 
    specified rules in the following table.  </span><b><font color='red'><span id='scmacfltview_title7'>BLOCKED</span></font></b>
   <span id='scmacfltview_title8'> means that all MAC layer frames will be </span><b><font color='red'><span id='scmacfltview_title7'>BLOCKED</span></font></b>
   <span id='scmacfltview_title10'> except those matching with any of the specified rules in the following table.</span><br>
    <br><span id='scmacfltview_title11'>MAC Filtering Policy For Each Interface</span><b>(<span span id='scmacfltview_title9'>maxinum 32 entries</span><b>):<br>
    <b><font color='red'><span id='scmacfltview_title12'>WARNING: Changing from one policy to another of an interface will cause 
    all defined rules for that interface to be REMOVED AUTOMATICALLY! You will need to create 
    new rules for the new policy.</span></font></b><br><br>
    <br>
    <center>
      <table border='1' cellpadding='4' cellspacing='0'>
        <tr> 
          <td class='hd' id='scmacfltview_inter'>Interface</td>
          <td class='hd' id='scmacfltview_policy'>Policy</td>
          <td class='hd' id='scmacfltview_change'>Change</td>
        </tr>
        <script language='javascript'>
	<!--hide
		fillObj1Items();
	//-->
	</script>
      </table>
      <br>
      <br>
      <center>
        <input type='button' onClick='chgPolicy(this.form.ChangePolicy)' value='Change Policy' id='scmacfltview_chgPly'>
      </center>
      <br>
    </center>
    <br>
    <center>
   <span id='scmacfltview_confgCh'> Choose Add or Remove to configure MAC filtering rules.</span><br>
    <br>
      <table border='1' cellpadding='4' cellspacing='0'>
        <tr> 
          <td class='hd' id='scmacfltview_interfa'>Interface</td>
          <td class='hd' id='scmacfltview_proto'>Protocol</td>
          <td class='hd' id='scmacfltview_dst'>Destination&nbsp;MAC</td>
          <td class='hd' id='scmacfltview_srt'>Source&nbsp;MAC</td>
          <td class='hd' id='scmacfltview_fram'>Frame&nbsp;Direction</td>
          <td class='hd' id='scmacfltview_remove'>Remove</td>
        </tr>
        <script language='javascript'>
	<!--hide
		fillObj3Items();
	//-->
	</script>
      </table>
      <br>
      <br>
        <script language='javascript'>
	<!--hide
	      if((obj2Rows > 0) &&  (obj3Rows < 32))
	      		document.writeln("<input type='button' onClick='addClick()' value='Add' id='scmacfltview_add'>");
	      else
		  	document.writeln("<input type='button' onClick='addClick()' value='Add' disabled id='scmacfltview_add1'>");
	      if(obj3Rows > 0){
		  	document.writeln("<input type='button' onClick='removeClick(this.form.rml)' value='Remove' id='scmacfltview_remove1'>");
	      }else{
		  	document.writeln("<input type='button' onClick='removeClick(this.form.rml)' value='Remove' disabled id='scmacfltview_remove2'>");
	      }
	//-->
	</script>
    </center>
  </form>
</blockquote>
</body>
</html>

