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

<script LANGUAGE="JavaScript">  
function selectSysType()
{      
	var baseURL,addURL,URL; 
	baseURL='<?php echo"$PHP_SELF";?>?systype_no_select=';
	addURL=document.selectform.systype_no_select.value;
	URL=baseURL+addURL;
	window.location=URL;
}   

function selectSysID()
{      
	var baseURL,addURL,URL; 
	baseURL='param_show_down.php?sysId=';
	addURL=document.selectform.system_id_select.value;     
	URL=baseURL+addURL;
	window.parent.param_show_down.location=URL;      
}
</script>

<body  leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('up');javascript:selectSysID();" onresize="javascript:adjust_frame('up');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<!--
<body onload="javascript:selectSysID();">
-->
<?
echo "<base target=\"param_show_down\">";
//global variables
define(EMS_APP_ID,0);
define(MSS_APP_ID,9);
define(VSS_APP_ID,8);
define(AAS_APP_ID,11);

if(!isset($systype_no_select))
	$systype_no_select=320;
if(!isset($system_id_select))
	$system_id_select="320_99_99";


//help id
if($systype_no_select == SYSTYPENO_MSC)
	$helpId="2.1.1.1";
else if($systype_no_select == SYSTYPENO_AAS)
	$helpId="2.1.3.1";
else if($systype_no_select == SYSTYPENO_VLR)
	$helpId="2.1.1.2";
else if($systype_no_select == SYSTYPENO_VLR)
	$helpId="2.1.1.2";
else if($systype_no_select == SYSTYPENO_HLR)
	$helpId="2.1.1.3";
else if($systype_no_select == SYSTYPENO_AUC)
	$helpId="2.1.1.4";
else if($systype_no_select == SYSTYPENO_SMSC)
	$helpId="2.1.1.5";
else if($systype_no_select == SYSTYPENO_SMEG)
	$helpId="2.1.1.8";
else if($systype_no_select == SYSTYPENO_OPPS)
	$helpId="2.1.1.9";
else if($systype_no_select == SYSTYPENO_EIR)
	$helpId="2.1.1.7";
else if($systype_no_select == SYSTYPENO_VSS)
	$helpId="2.1.3.2";
else if($systype_no_select == SYSTYPENO_MRFC)
	$helpId="2.66";
else if($systype_no_select == SYSTYPENO_PALIM)
	$helpId="2.1.1.12";
else if($systype_no_select == SYSTYPENO_RLS)
	$helpId="2.1.1.13";
else
	$helpId="2.1.1.1";
adjust_head_frame("up");
adjust_title_head_frame("up");


echo "<table id=\"table_up\" border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "Configuration > $strNetwork > Parameter";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align=\"left\">";

echo "<form method=\"post\" name=\"selectform\" action=\"$PHP_SELF\">";

	echo "Module:";
	echo "<select name=\"systype_no_select\" onChange=\"javascript:selectSysType();\">";
		$sql="select sysTypeNo,sysTypeName,maxSysNum,maxSubSysNum from OMC_PUB.sysConf where needParamConf = '1' order by sysTypeNo ";
		//echo "sql=$sql<br>";
		$res=@mysqli_query($pubConn,$sql);
		$row=@mysqli_fetch_array($res);
		do
		{
			$sysTypeNo=$row[sysTypeNo]+0;
			if($sysTypeNo == 311 || 
				 $sysTypeNo == 320 || 
				 $sysTypeNo == 340 || 
				 $sysTypeNo == 380 || 
				 $sysTypeNo == 330 || 
				 $sysTypeNo == 375 ||
				 $sysTypeNo == 355 ||
				 $sysTypeNo == 260 ||
				 $sysTypeNo == 350 ||
				 $sysTypeNo == 325 ||
				 $sysTypeNo == 225 ||
				 $sysTypeNo == 385 ||
			//	 $sysTypeNo == 360 ||
				 $sysTypeNo == 390 ||
				 $sysTypeNo == 378 ||
				 $sysTypeNo == 379 ||
				 $sysTypeNo == 386 ||
				 $sysTypeNo == 389
				)
			{
				echo "<option value=\"$row[sysTypeNo]\" ";
				if($row[sysTypeNo] == $systype_no_select && isset($row[sysTypeNo]))
				{
					echo "selected";
					$sysTypeName=$row[sysTypeName];
					$maxSysNum=$row[maxSysNum];
					$maxSubSysNum=$row[maxSubSysNum]; 
				}
				echo ">";
				echo "$row[sysTypeName]";
				echo "</option>";
			}
		}while($row=@mysqli_fetch_array($res));
	echo "</select>";
	echo "&nbsp;&nbsp;";
	echo "System ID:";
	echo "<select name=\"system_id_select\" onChange=\"javascript:selectSysID()\">";
	//application
	if(floor($systype_no_select/100) == 3)
	{
		$sysid=$systype_no_select."_99_99";
		//The AAS do not need public parameter setting
		if($systype_no_select != SYSTYPENO_AAS && $systype_no_select != SYSTYPENO_TMG && $systype_no_select != SYSTYPENO_AMRMG && $systype_no_select != SYSTYPENO_GbC && $systype_no_select != SYSTYPENO_VSS)
		{
			if($system_id_select == $sysid)
				echo "<option value=\"$sysid\" selected>";
			else
				echo "<option value=\"$sysid\">";
			echo "{$sysTypeName}_pub</option>";
		}
			
		for($i=0;$i<$maxSysNum;$i++)
		{
			$sysid=$systype_no_select."_".$i."_0";
			echo "<option value=\"$sysid\" ";
			if($sysid == $system_id_select)
				echo "selected";
			echo ">";
			echo "{$sysTypeName}_{$i}</option>";
		}
	}
	//platform
	else
	{
		//mtp3,sccp
		if($systype_no_select == SYSTYPENO_MTP3 || $systype_no_select == SYSTYPENO_SCCP)
		{
			for($i=0;$i<$maxSysNum;$i++)
			{
				//Now,only VSS MSS and AAS use MTP3 or SSCP Parameters
				if($i == MSS_APP_ID || $i == AAS_APP_ID || $i == VSS_APP_ID)
				{
					$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_Pub)';
					$sysId=$systype_no_select.'_'.$i.'_99';
					//default display MSS
					if(MSS_APP_ID == $i)
					{
						echo "<option value=\"$sysId\" selected>$sysName</option>";
					}else{
						echo "<option value=\"$sysId\">$sysName</option>";
					}
					/*
					for($j=0;$j<$PlatTypeDefArr[$i][maxSysNum];$j++)
					{
						$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_'.$j.')';
						$sysId =$systype_no_select.'_'.$i.'_'.$j;
						echo "<option value=\"$sysId\">$sysName</option>";
					}
					*/
				}
			}
		}
		//other platform
		else
		{
			for($i=0;$i<$maxSysNum;$i++)
			{
				//Now,only MSS use other plat modules' Parameters
				if($systype_no_select == SYSTYPENO_SMPP)
				{
					if($i == MSS_APP_ID || $i == VSS_APP_ID || $i == EMS_APP_ID)
					{
						//ISSUE-3
						if($i == MSS_APP_ID)
						{
							$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_pub)';
							$sysId =$systype_no_select.'_'.$i.'_99';
							if(MSS_APP_ID == $i)
								echo "<option value=\"$sysId\" selected>$sysName</option>";
							else
								echo "<option value=\"$sysId\">$sysName</option>";
						}
						else if($i == EMS_APP_ID)
						{
							$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_0)';
							$sysId =$systype_no_select.'_'.$i.'_0';
							echo "<option value=\"$sysId\" selected>$sysName</option>";
							
							$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_1)';
							$sysId =$systype_no_select.'_'.$i.'_1';
							echo "<option value=\"$sysId\" selected>$sysName</option>";
						}
						else if($i == VSS_APP_ID)
						{
							for($si=0;$si<10;$si++)
							{
								$sysName=$sysTypeName."(".$PlatTypeDefArr[$i][remark]."_$si)";
								$sysId =$systype_no_select."_".$i."_$si";
								echo "<option value=\"$sysId\" selected>$sysName</option>";
							}
						}
						
						//now the system is all public
						/*
						for($j=0;$j<$PlatTypeDefArr[$i][maxSysNum];$j++)
						{
							$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_'.$j.')';
							$sysId=$systype_no_select.'_'.$i.'_'.$j;
							echo "<option value=\"$sysId\">$sysName</option>";
						}
						*/
					}
				}
				else
				{
					if($i == MSS_APP_ID)
					{
						$sysName=$sysTypeName.'('.$PlatTypeDefArr[$i][remark].'_pub)';
						$sysId =$systype_no_select.'_'.$i.'_99';
						if(MSS_APP_ID == $i)
							echo "<option value=\"$sysId\" selected>$sysName</option>";
						else
							echo "<option value=\"$sysId\">$sysName</option>";
					}
				}
			}
		}
	}
	echo "</select>";


echo "</td>";
echo "<td>&nbsp;</td>";
echo "</table>";


adjust_title_tail_frame("up");
adjust_content_head_frame("up");
adjust_content_tail_frame("up");
//echo "sysTypeName=$sysTypeName,maxSysNum=$maxSysNum,maxSubSysNum=$maxSubSysNum,systype_no_select=$systype_no_select<br>";

?>
</body>