<?php
/*********************************************************      
 程序说明：         
    功能说明：本程序定义系统配置信息
    调用关系：调用:header.inc     
              被调用:      
 
    变量说明：

     返回值：无

 作者：Cui Ticun    2006-05-15     
      
修改注释：      
NO.1      
姓名        
时间
修改说明
*********************************************************/    
require("../../inc/header.inc");
?>
<script LANGUAGE="JavaScript">
function selCheckBox(thisCheckBox)
{
	if(thisCheckBox.checked == true){
		thisCheckBox.value=1;
	}else{
		thisCheckBox.value=0;
	}
}
</script>

<?php
$db=$omc_db;
$tableName="elementExistConf";
$helpId = "2.1";

/*****************************保存一个类型*****************************/
if($_REQUEST['save'] ){
	$selSql = " SELECT * FROM $tableName ORDER BY elementNo";
	if($DEBUG) echo "<br>selSql=$selSql";
	$res = @mysqli_query($pubConn,$selSql);
	$num=mysqli_num_rows($res);
	echo "num=$num";
	echo "selSql=$selSql";

	for($i=1;$i<$num;$i++){
		$tmpExistFlag=$_REQUEST['existFlag_'.$i];
		//echo "<br>tmpExistFlag=$tmpExistFlag";
		if(!isset($tmpExistFlag))
			$tmpExistFlag=0;
		$updateSql="UPDATE $tableName SET existFlag='$tmpExistFlag' WHERE elementNo='$i'";
		//echo "<br>updateSql=$updateSql";
		mysqli_query($pubConn,$updateSql);
    }
} //end if($save) 
?>


<?php
$selSql = " SELECT * FROM $tableName ORDER BY elementNo";
if($DEBUG) echo "<br>selSql=$selSql";
$res = @mysqli_query($pubConn,$selSql);
?>
<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 "Advanced > Network > Element configuration";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">&nbsp;";
//showHelp($helpId);
echo "</td>";
echo "</tr>";
echo "</table>";
adjust_title_tail();
adjust_content_head();
echo "<br>";
?>

<form method="POST" name=selectform action="<?php echo"$PHP_SELF";?>" >
 
  
  <table  border="1" width="40%" cellpadding="2" cellspacing="0"  bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" > 
<?php  
echo "<tr bgcolor=\"#E6E6E6\">";    
echo "<td width=\"100%\" colspan=\"2\">";
echo "<p align=\"center\"><b>Element Configuration</b></p></td></tr>";
echo "<tr>";    
echo "<td width=\"20%\">Element</td>";
echo "<td width=\"20%\">Exist Flag</td></tr>";

while($row = @mysqli_fetch_array($res)){
	if($row[elementNo]==0)
		continue;
	//if($row[elementName]=="BSS") continue;
	echo "<tr>";    
	echo "<td width=\"20%\">$row[elementName]</td>";
	echo "<td width=\"20%\">";
	$tmpStr="existFlag_".$row[elementNo];
	//echo "<br>tmpStr=$tmpStr";
	if($row[existFlag] == '1'){
		echo "<nobr><input type=\"checkbox\" name=\"$tmpStr\"	 onClick=selCheckBox(this) value=\"1\" checked  ></nobr>";
	}else{
		echo "<nobr><input type=\"checkbox\" name=\"$tmpStr\"	 onClick=selCheckBox(this) value=\"0\" ></nobr>";
	}
}
echo "</table>";
?>
<p><input type="submit" value="<?php echo "$strSave"; ?>" name="save"> 
</p>                
</form>         
<?php
adjust_content_tail();
?>        
</body>                
</html>

