<?php 

require("../../inc/header.inc");
?>
<script language="JavaScript">
	function typeChange(num)
	{
		var cmd='document.setForm.annType_'+num+'.value';
		
		var va=eval(cmd);
		if(va!=3)
		{
			cmd='document.setForm.annMsc0E1_'+num+'.disabled=1';
			eval(cmd);
			cmd='document.setForm.annMsc1E1_'+num+'.disabled=1';
			eval(cmd);
			cmd='document.setForm.annSlot_'+num+'.disabled=1';
			eval(cmd);
			
		}
		else
		{
			cmd='document.setForm.annMsc0E1_'+num+'.disabled=0';
			eval(cmd);
			cmd='document.setForm.annMsc1E1_'+num+'.disabled=0';
			eval(cmd);
			cmd='document.setForm.annSlot_'+num+'.disabled=0';
			eval(cmd);
		}
	
	}
</script>
<?php
$helpId = "1.1.1";
$DEBUG = 0;
 
//==========================================================
//±äÁ¿¶¨Òå
//==========================================================

$pubDb	 = 'OMC_PUB';


$sysId = '322_99_99';
$sysIdArr	= explode('_',$sysId);
$sysTypeNo	= $sysIdArr[0];
$sysNo		= $sysIdArr[1];
$subSysNo	= $sysIdArr[2];

$objDb		= 'OBJ_'.$sysTypeNo;
$paramTable = 'param_'.$sysNo;

$oidstr = '2.1.6';
$objWhereStr =getLevelWhere($oidstr);


?>


<body topmargin="0" leftmargin="12">
<?php
if($_SERVER['REQUEST_METHOD'] == "POST")
{
	for($i=0; $i< 16; $i++)
	{
		$annType=omc_keep_length(dechex(${"annType_$i"}),'0',2);
		$annMs0E1=omc_keep_length(dechex(${"annMsc0E1_$i"}),'0',2);
		$annMs1E1=omc_keep_length(dechex(${"annMsc1E1_$i"}),'0',2);
		$annSlot=omc_keep_length(dechex(${"annSlot_$i"}),'0',2);
		$announceArr[$i] = $annType . $annMs0E1 . $annMs1E1 . $annSlot;
	}
	for($i=0; $i < sizeof($announceArr); $i++)
	{
		$setValue .= $announceArr[$i];
	}
	
	$updSql = "UPDATE $paramTable SET initValue = '$setValue'   
					WHERE $objWhereStr
					";
	mysqli_query($pubConn,$updSql);
	echo mysqli_error($pubConn);			
	
	echo "<script LANGUAGE=\"JavaScript\">";
	if(!$DEBUG){
		echo "\n window.location.href=\"$backurl\";";
	} 
	echo "\n </script>";
	exit();
}

{
	echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF\">";
	echo "<table border=\"0\" width=\"100%\">";
	echo "<tr>";
	echo "<td width=\"50%\">";
	echo "$strConfiguration > <a href=\"../overview/overview.php\">Network</a> > <a href=\"$backurl\">MSC</a> > <a href=\"#\">Announcement</a>";
	echo "</td>";
	echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
	showHelp($helpId);
	echo "</td>";
	echo "</tr>";
	echo "</table>";
	echo "<br>";
	
	echo "<table width=\"100%\">";
	echo "<tr><td width=\"70%\">";
	echo "&nbsp;&nbsp;";
	echo "</td>";
	echo "<td width=\"20%\">";
		echo "<input type=\"submit\" name=\"set\" value=\"Save\" class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
		echo "&nbsp;&nbsp;&nbsp;";
		echo "<input type=\"reset\" name=\"Reset\" value=$strUndo class=\"button\" style=\"left: 1; top: 2; width: 60; height: 25; position: relative\">";
	echo "</td>";
	echo "<td><p width=\"10%\" align=\"right\"><a href=\"$backurl\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
	echo "</td></tr>";
	echo "</table>";
	echo "<br>";
}
?>

<?php
$paramSql = " SELECT initValue,readValue,instanceNo FROM $paramTable  
			WHERE $objWhereStr
			";
$Result = mysqli_query($pubConn,$paramSql);

$Row = mysqli_fetch_array($Result);
for($i=0; $i<16; $i++)
{
	$announcementArr[$i]=substr($Row[initValue], $i*8, 8);
}

$annTypeArr = array(0=>'None',1=>'Tone',2=>'Voice',3=>'lease line');

echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td>No</td>";
	echo "<td>Type</td>";
	echo "<td>MSC0 E1</td>";
	echo "<td>MSC1 E1</td>";
	echo "<td>Time Slot</td>";
	
	echo "<td>No</td>";
	echo "<td>Type</td>";
	echo "<td>MSC0 E1</td>";
	echo "<td>MSC1 E1</td>";
	echo "<td>Time Slot</td>";
	
echo "</tr>";
for($r=0; $r< 8; $r++)
{
	echo "<tr>";
	for($c=0; $c<2; $c++)
	{
		$i=$c*8 + $r;
		$annType = hexdec(getBitValue($announcementArr[$i],'0.0-0.7'));
		$annMs0E1 = hexdec(getBitValue($announcementArr[$i],'1.0-1.7'));
		$annMs1E1 = hexdec(getBitValue($announcementArr[$i],'2.0-2.7'));
		$annSlot = hexdec(getBitValue($announcementArr[$i],'3.0-3.7'));
		
			echo "<td>$i</td>";
			echo "<td>";
				echo "<select size=\"1\" value=\"$annType\" name=\"annType_$i\" onChange=\"javascript:typeChange($i)\">";
				while (list ($key, $val) = each ($annTypeArr)) 
				{
					echo "<option value=\"$key\" ";
					if($key == $annType)
						echo "selected";
					echo ">$val</option>";
				}
				reset($annTypeArr);	
			echo "</td>";
		
			echo "<td>";
			if($annType==3)
				echo "<input type=\"text\" size=\"4\" maxlength=\"3\" name=\"annMsc0E1_$i\" value=\"$annMs0E1\"";
			else
				echo "<input DISABLED type=\"text\" size=\"4\" maxlength=\"3\" name=\"annMsc0E1_$i\" value=\"$annMs0E1\"";
		
			echo "</td>";
		
			echo "<td>";
			if($annType==3)
				echo "<input type=\"text\" size=\"4\" maxlength=\"3\" name=\"annMsc1E1_$i\" value=\"$annMs1E1\"";
			else
				echo "<input DISABLED type=\"text\" size=\"4\" maxlength=\"3\" name=\"annMsc1E1_$i\" value=\"$annMs1E1\"";
			
			echo "</td>";
		
			echo "<td>";
			if($annType==3)
				echo "<input type=\"text\" size=\"4\" maxlength=\"3\" name=\"annSlot_$i\" value=\"$annSlot\"";
			else
				echo "<input DISABLED type=\"text\" size=\"4\" maxlength=\"3\" name=\"annSlot_$i\" value=\"$annSlot\"";
			
			echo "</td>";
	}
	echo "</tr>";
}

echo "<input type=\"hidden\" name=\"initValue\" value=\"$Row[initValue]\">";	
echo "</table>&nbsp;";
echo "<input type=\"hidden\" name=\"backurl\" value=\"$backurl\">";	

//System has up to 11 inline announcements and tones to fit different unattained reasons:
	

?>

</form>

	
<table border=0 width="100%">
	<tr>
		<td width="50%"><font color="#AEAEAE">Remarks:</font></td>
		<td width="50%"><font color="#AEAEAE">&nbsp</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">&nbsp</font></td>
		<td width="50%"><font color="#AEAEAE">&nbsp</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 0: The number dialed is invalid.</font></td>
		<td width="50%"><font color="#AEAEAE">Announcement 6: Feature not available to caller.</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 1: The subscriber dialed is offline.</font></td>
		<td width="50%"><font color="#AEAEAE">Announcement 7: The subscriber dialed is not available.</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 2: The subscriber is busy.</font></td>
		<td width="50%"><font color="#AEAEAE">Announcement 8: Caller's line is stopped.</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 3: The network is busy.</font></td>
		<td width="50%"><font color="#AEAEAE">Announcement 9: Caller's balance is going to be used up. </font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 4: Caller's account is deactivated.</font></td>
		<td width="50%"><font color="#AEAEAE">Announcement 10: The call is cut for account balance exhaust.</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 5: The subscriber dialed is deactivated.</font></td>
		<td width="50%"><font color="#AEAEAE">Announcement 15: Used for call hold.</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">&nbsp</font></td>
		<td width="50%"><font color="#AEAEAE">&nbsp</font></td>
	</tr>
	<tr>
		<td width="50%"><font color="#AEAEAE">Announcement 11-14: Reserved.</font></td>
		<td width="50%"><font color="#AEAEAE">&nbsp</font></td>
	</tr>
</table>

	
	

	


</body>
</html>
