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

var obj1Items = '<%ejGetObject(MDMOID_WAN_PPTP_CONN)%>';
var obj2Items = '<%ejGetObject(MDMOID_WAN_IP_CONN)%>';
var obj3Items = '<%ejGetObject(MDMOID_WAN_PPP_CONN)%>';

var obj1Rows = numOfRow(obj1Items);
var obj2Rows = numOfRow(obj2Items);
var obj3Rows = numOfRow(obj3Items);

var connectionStatusArray = getColFromList(obj1Items, 'connectionStatus');
var ServerIpArray = getColFromList(obj1Items, 'ServerIp');
var LocalIpArray = getColFromList(obj1Items, 'LocalIp');
var RemoteIpArray = getColFromList(obj1Items, 'RemoteIp');
var NatEnabledArray = getColFromList(obj1Items, 'NatEnabled');
var MppeEnabledArray = getColFromList(obj1Items, 'MppeEnabled');
//var MppcEnabledArray = getColFromList(obj1Items, 'MppcEnabled');
var DescriptionArray = getColFromList(obj1Items, 'Description');
var EnabledArray = getColFromList(obj1Items, 'Enabled');
var IfNameArray = getColFromList(obj1Items, 'IfName');

var locationQuery="sessionKey=<%ejGetOther(sessionKey)%>";


function initTranslation()
{
		var idArray = new Array("pptpacview_title","pptpacview_prompt","pptpacview_t_status","pptpacview_t_serverip","pptpacview_t_localip","pptpacview_t_remoteip",
			"pptpacview_t_nat","pptpacview_t_mppe","pptpacview_t_mppc","pptpacview_t_description","pptpacview_t_enable","pptpacview_t_remove","pptpacview_t_edit",
			"pptpacview_b_add","pptpacview_b_remove","pptpacview_b_edit");
		setAllIdValue(idArray);
}

function frmLoad()
{
 		 initTranslation();
}

function editClick(ifname)
{
    var loc ="pptpwanadd.cgi?pptp_edit=1&pptp_ifname=" + ifname + "&" + locationQuery;
    var code = 'location="' + loc + '"';
    eval(code);
}

function fillObj1Items()
{
	var i;
	for(i=0; i < obj1Rows; i++){
		document.writeln("<tr align='center'>");
		document.writeln("<td class='tablesize'>"+ connectionStatusArray[i] +"&nbsp;</td>");
		document.writeln("<td class='tablesize'>"+ ServerIpArray[i] +"&nbsp;</td>");
		document.writeln("<td class='tablesize'>"+ LocalIpArray[i] +"&nbsp;</td>");
		document.writeln("<td class='tablesize'>"+ RemoteIpArray[i] +"&nbsp;</td>");
		if(NatEnabledArray[i] == '1')
			document.writeln("<td class='tablesize'> " + _('Enabled') +  " </td>");
		else
			document.writeln("<td class='tablesize'> " + _('Disabled') +  " </td>");
		if(MppeEnabledArray[i] == 'MPPE-128bit')
			document.writeln("<td class='tablesize'> " + _('Enabled') +  " </td>");
		else
			document.writeln("<td class='tablesize'> " + _('Disabled') +  " </td>");
/*
		if(MppcEnabledArray[i] == '1')
			document.writeln("<td class='tablesize'>Enabled</td>");
		else
			document.writeln("<td class='tablesize'>Disabled</td>");
*/			
		document.writeln("<td class='tablesize'>"+ DescriptionArray[i] +"&nbsp;</td>");
		if(EnabledArray[i] == '1')
			document.writeln("<td class='tablesize'> " + _('Enabled') +  " </td>");
		else
			document.writeln("<td class='tablesize'> " + _('Disabled') +  " </td>");
		document.writeln("<td align='center'><input type='checkbox' name='rml' value='" + IfNameArray[i] + "'></td>");
		document.writeln("<td align='center'><input type='button' name='edit' onClick='editClick(\"" + IfNameArray[i] + "\")' value=\""+_("pptpacview_b_edit")+"\" ></td>");
		document.writeln("</tr>");
	}
}

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

function removeClick(rml)
{
	var i;
	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 = 'pptpacwan.cmd?action=remove&rmLst=' + lst +"&"+ locationQuery;
	var code = 'location="' + loc + '"';
	eval(code);
}

// done hiding -->
</script></head>
<body onLoad='frmLoad()'>
<blockquote> 
  <form>
      <b><span id='pptpacview_title'></span></b><br>
      <br>
      <span id='pptpacview_prompt'></span><br>
      <br>
    <center>
	 <table border='1' cellpadding='4' cellspacing='0'>
        <tr align='center'> 
          <td class='hd' id='pptpacview_t_status'></td>
          <td class='hd' id='pptpacview_t_serverip'></td>
          <td class='hd' id='pptpacview_t_localip'></td>
          <td class='hd' id='pptpacview_t_remoteip'></td>
          <td class='hd' id='pptpacview_t_nat'></td>
          <td class='hd' id='pptpacview_t_mppe'></td>
<!--
          <td class='hd' id='pptpacview_t_mppc'></td>
-->          
          <td class='hd' id='pptpacview_t_description'></td>
          <td class='hd' id='pptpacview_t_enable'></td>
          <td class='hd' id='pptpacview_t_remove'></td>
          <td class='hd' width='40' id='pptpacview_t_edit'></td>
        </tr>
        <script language='javascript'>
	<!--hide
		fillObj1Items();
	//-->
	</script>
      </table>
      <br>
      <br>
      <script language='javascript'>
		<!--hide
		if((obj2Rows + obj3Rows >= 8) ||obj1Rows >= 4)
		{
			document.writeln("<input type='button' id='pptpacview_b_add' onClick='addClick()' disabled>");
		}
		else
		{
	   		document.writeln("<input type='button' id='pptpacview_b_add' onClick='addClick()'>");
		}
		if(obj1Rows > 0){
			document.writeln("<input type='button' id='pptpacview_b_remove' onClick='removeClick(this.form.rml)'>");
		}else{
			document.writeln("<input type='button' id='pptpacview_b_remove' onClick='removeClick(this.form.rml)' disabled>");
		}
	//-->
	</script>
    </center>
  </form>
</blockquote>
</body>
</html>

