<?php
require("../../inc/header.inc");
?>

<style type="text/css">
<!--
.style {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;background: url(--.gif); border: 0px;  height: 16px;}
-->
</style>

<script language="JavaScript">
	function openSet(mcc,mnc,operation)
	{
		URL="./operation.php?mcc="+mcc+"&mnc="+mnc+"&operation="+operation;
		//var setWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=350');
		//setWindow.focus();
		window.location.href=URL;
	}
</script>
<body leftmargin="15" rightmargin="10" onload="javascript:adjust();" onresize="javascript:adjust();" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">



<?php
adjust_head();
adjust_title_head();
echo "<TABLE id=\"table_up\" border=\"0\" width=\"100%\">";
echo "<TR>";
echo "<TD width=\"50%\" align=\"left\">";
echo "$strMaintenance > Control Panel > NRTRDE HPMN";
echo "</TD>";
echo "<TD width=\"50%\" align=\"right\" title=\"Help\">";
$helpId="5.2.2";
showHelp($helpId);
echo "</TD>";
echo "</TR>";
echo "</TABLE>";

adjust_title_tail();
adjust_content_head();
echo "<br>";

?>	
<?php
	$DEBUG=0;
	
	//delete one hpmn server info
	if($delete==1)
	{
		if($DEBUG)
			echo "mcc=$mcc,mnc=$mnc<br>";
		
		$pubDb="OMC_PUB";
		$delSql = "DELETE FROM hpmnConf WHERE mcc='$mcc' and mnc='$mnc' ";
		//echo "<br>delSql=$delSql";
		$delRes = @mysqli_query($pubConn,$delSql);
		echo mysqli_error($pubConn);	
		echo "<font color=blue>Delete successfully!</font><br>";
	}

	//Get the hpmn server info from database
	$database="OMC_PUB";
	$selSql = "SELECT * FROM hpmnConf ";
	$selRes = @mysqli_query($pubConn,$selSql);
	$HpmnCount=mysqli_num_rows($selRes);
	echo mysqli_error($pubConn);
	//echo "count:$HpmnCount<br>";

	$HpmnIndex=0;
	while($selRow = @mysqli_fetch_array($selRes)){
		$HpmnMcc[$HpmnIndex]=$selRow[mcc];
		$HpmnMnc[$HpmnIndex]=$selRow[mnc];
		$HpmnTadig[$HpmnIndex]=$selRow[tadig];
		$HpmnServerIP[$HpmnIndex]=$selRow[serverIP];
		$HpmnLoginName[$HpmnIndex]=$selRow[loginName];
		$HpmnLoginPass[$HpmnIndex]=$selRow[loginPass];
		$HpmnTimeSlot[$HpmnIndex]=$selRow[timeslot];
		$HpmnReportDir[$HpmnIndex]=$selRow[reportDir];
		$HpmnNrtrdeDir[$HpmnIndex]=$selRow[nrtrdeDir];
		$HpmnIndex++;
		//echo "HpmnMcc[$HpmnIndex]={$HpmnMcc[$HpmnIndex]}<br>";
	};
	
	echo "<p><table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td width=\"4%\" align=center>No.</td>";
	echo "<td width=\"4%\" align=center>MCC</td>";
	echo "<td width=\"4%\" align=center>MNC</td>";
	echo "<td width=\"6%\" align=center>Tadig</td>";
	echo "<td width=\"12%\" align=center><nobr>Server IP</td>";
	echo "<td width=\"8%\" align=center><nobr>Login Name</td>";
	echo "<td width=\"8%\" align=center><nobr>Login PW</td>";
	echo "<td width=\"8%\" align=center>Interval</td>";
	echo "<td width=\"15%\" align=center>Report Directory</td>";
	echo "<td width=\"15%\" align=center>NRTRDE Directory</td>";
	echo "<td width=\"4%\" align=center>Delete</td>";
	echo "</tr>";

	$valueLabel=array("900"=>"15 Min","1800"=>"30 Min","3600"=>"1 Hour","7200"=>"2 Hours","10800"=>"3 Hours","14400"=>"4 Hours");
	for($i=0;$i<$HpmnCount;$i++)
	{
		echo "<tr>";
		echo "<td align=center><a href=# onClick=\"javascript:openSet('{$HpmnMcc[$i]}','{$HpmnMnc[$i]}','edit')\">$i</a></td>";
		echo "<td>{$HpmnMcc[$i]}</td>";
		echo "<td>{$HpmnMnc[$i]}</td>";
		echo "<td>{$HpmnTadig[$i]}</td>";
		echo "<td>{$HpmnServerIP[$i]}</td>";
		echo "<td>{$HpmnLoginName[$i]}</td>";
		echo "<td>{$HpmnLoginPass[$i]}</td>";
		$show=$valueLabel[$HpmnTimeSlot[$i]];
		echo "<td>$show</td>";
		echo "<td>{$HpmnReportDir[$i]}</td>";
		echo "<td>{$HpmnNrtrdeDir[$i]}</td>";
		echo "<td><a href=\"./hpmnInfo.php?mcc={$HpmnMcc[$i]}&mnc={$HpmnMnc[$i]}&delete=1\">Delete</a></td>";
		echo "</tr>";
	}
	
	echo "<tr><td><a href=# onClick=\"javascript:openSet('','','new')\">New</a></td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td><td>--</td>";
	
	echo "</table>";
adjust_content_tail();
?>
