<?php
/*********************************************************      
 程序说明：         
    功能说明：cns configuration

    调用关系：调用: header.inc     
              被调用:   
 
    变量说明：

     返回值：无

 作者：  
      
修改注释：      
NO.1      
姓名：            
时间：      
修改说明：      
*********************************************************/  
require("../../inc/header.inc");
$DEBUG = 0;
$dbName = "OMC_PUB";
$tbName = "centralMapInfo";
//$keyNo = 1;//test
$DEBUG = 0;
if($DEBUG)echo "<br>keyNo=$keyNo";
if($DEBUG)echo "<br>setFld=$setFld";

?>
<script LANGUAGE="JavaScript">           
function openSet(){
	URL="./e1Edit.php";
	var msgWindow = open(URL, 'newWin', 'toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=yes,width=400,height=200');
	msgWindow.focus();
}
</script>
<?php
if($Save){
	$udpSql = " UPDATE $tbName SET $setFld = '$editValue' WHERE keyNo = '$keyNo'";
	if($DEBUG)echo "<br>udpSql=$udpSql";
	$udpRes = @mysqli_query($pubConn,$udpSql);
	echo mysqli_error($pubConn);
	if(!$DEBUG){
		echo "<script LANGUAGE=\"JavaScript\">";
		echo "\n window.close();";
		echo "\n </script>";
	}
}
$showNodeFld = "keyNo, keyName, ip, status, objTypeNo, pointX, pointY, remark, updateTime";
$showEdgeFld = "keyNo, keyName, ip, status, objTypeNo, fromNodeNo, toNodeNo, remark, updateTime";

$nodeSql = "SELECT $showNodeFld FROM $tbName WHERE objTypeNo  > 0 ";
echo "<br>nodeSql=$nodeSql db=$dbName";
$nodeRes = mysqli_query($pubConn,$nodeSql);
$nodeRow = mysqli_fetch_array($nodeRes);

$edgeSql = "SELECT $showEdgeFld FROM $tbName WHERE objTypeNo  < 1 ";
//echo "<br>edgeSql=$edgeSql";
$edgeRes = mysqli_query($pubConn,$edgeSql);
$edgeRow = mysqli_fetch_array($edgeRes);


echo "<form method=\"POST\" name=\"confForm\" action=\"$PHP_SELF\">";
echo "<table  border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\" >"; 
$fldArr=explode(',',$showNodeFld);
$fldNum = sizeof($fldArr);
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td colspan=\"$fldNum\">";
echo "Node list";
echo "</td>";
echo "</tr>";
echo "<tr bgcolor=\"#E6E6E6\">";
for($i=0;$i<$fldNum;$i++){
	echo "<td>$fldArr[$i]</td>";
}
echo "</tr>";
do{
	echo "<tr>";
	for($i=0;$i<sizeof($fldArr);$i++){
		
		if($fldArr[$i] == 'keyNo' ){
			echo "<td><a href=cnsConfEdit.php?mode=editNode&keyNo=$nodeRow[keyNo]>";
			echo "&nbsp;$nodeRow[keyNo]";
			echo "</a></td>";
		}else{
			echo "<td>&nbsp;$nodeRow[$i]</td>";
		}
	}
	echo "</tr>";
}while($nodeRow = mysqli_fetch_array($nodeRes));
echo "</table>";

echo "<br><br>";

echo "<table  border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\" >"; 
$fldArr=explode(',',$showEdgeFld);
$fldNum = sizeof($fldArr);
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td colspan=\"$fldNum\">";
echo "Edge list";
echo "</td>";
echo "</tr>";
echo "<tr bgcolor=\"#E6E6E6\">";
for($i=0;$i<$fldNum;$i++){
	echo "<td>$fldArr[$i]</td>";
}
echo "</tr>";
do{
	echo "<tr>";
	for($i=0;$i<sizeof($fldArr);$i++){
		
		if($fldArr[$i] == 'keyNo' ){
			echo "<td><a href=cnsConfEdit.php?mode=editEdge&keyNo=$edgeRow[keyNo]>";
			echo "&nbsp;$edgeRow[keyNo]";
			echo "</a></td>";
		}else{
			echo "<td>&nbsp;$edgeRow[$i]</td>";
		}
	}
	echo "</tr>";
}while($edgeRow = mysqli_fetch_array($edgeRes));
echo "</table>";

echo "<br><br>";
echo "&nbsp;&nbsp;";
echo "<input type=\"hidden\" name=\"keyNo\" value =\"$keyNo\">";
echo "<input type=\"hidden\" name=\"setFld\" value =\"$setFld\">";
echo "</form>";
?>

</body>
</html>