<?php
/*************************************************************************      
* 文件说明：         
*    功能说明:批量或单个修改LED灯的各个属性
*
*    调用关系：被调用:applet_display.php        
*
*
* 作者：      
*      
*修改注释：      
*NO.1      
*姓名：            
*时间：      
*修改说明：      
*************************************************************************/
require("../../inc/header.inc");
$DEBUG = 0;
$db=$omc_db;
$table_name = sysLedConf; 
?>
<base target="main_up" >
<BODY>

<form method="POST" action="./led_set_list.php">
<?php 
if($mode == 'batch'){
	//================================================批量LED间隔位移设定============================================================
	if($submode =='mid'){
	?>
	<table><tr><td></td><td></td></tr></table>
	<table   border="1" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" width="100%">
	  <tr>
		<td colspan="3"><?php echo"$strBatchOfLEDClearanceSetting";?></td>
	  </tr>
	  <tr>
		<td><?php echo"$strLEDIDRange";?>:<input type="text" name="bgn_led" size="5">-<input type="text" name="end_led" size="5"></td>
		<td><?php echo"$strPointOfStart";?>:&nbsp; x:<input type="text" name="bgn_x" maxlength="4" size="5"> y:<input type="text" name="bgn_y" maxlength="4" size="5"></td>  
		<td><?php echo"$strPointOfClearance";?>:&nbsp; x:<input type="text" name="move_x" maxlength="4" size="5">y:<input type="text" name="move_y" maxlength="4" size="5"></td> 
	  </tr>  
	  <tr>  
		<td>&nbsp;</td>  
		<td>&nbsp;</td>
		<td><input type="submit" value="<?php echo "$strSubmit";?>" name="submit"><input type="reset" value="<?php echo "$strCancel";?>" name="reset"></td>  
	  </tr>  
	</table>
	<?php
	}elseif($submode == 'move'){
	//================================================批量LED设定============================================================
	?>
	<table border="1" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF" width="100%">
	  <tr>
		<td colspan="3"><?php echo "$strBatchOfLEDDefineSetting";?></td>

	  </tr>
	  <tr>
		<td><?php echo"$strLEDIDRange";?>:<input type="text" name="bgn_led" size="5">-<input type="text" name="end_led" size="5"></td>
		<td>
		<?php echo"$strSourcePageNumber";?>:<input type="text" name="src_page_type" size="5"><input type="text" name="src_page_num" size="5">
		<input type=checkbox name="sel_src_page">
		</td><td>
		<?php echo"$strTargetPageNumber";?>:<input type="text" name="dst_page_type" size="5"><input type="text" name="dst_page_num" size="5">
		<input type=checkbox name="sel_dst_page">
		</td>
	  </tr>
	  <tr>
		<td>
	<?php
	//形状
	echo "$strShape";
	echo "<select size=\"1\" name=\"shape\"> ";
	echo "<option value=\"0\" {$selected_shape[0]}>$strRound</option>";
	echo "<option value=\"1\" {$selected_shape[1]}>$strSquare</option>";
	echo "<option value=\"2\" {$selected_shape[2]}>$strLandscapeRectangle</option>";
	echo "<option value=\"3\" {$selected_shape[3]}>$strTriangle</option>";
	echo "<option value=\"4\" {$selected_shape[4]}>$strPortraitRectangle</option>";
	echo "</select>";
	echo "<input type=\"checkbox\" name=\"sel_shape\">";
	echo "</td><td>";
	//状态
	/*
	$status_arr=array('blink gray','blink green','blink yellow','blink red','blink blue','blink umbra','blink white','not use','gray','green','yellow','red','blue','umbra','white','not use');
	echo "$strStatus : ";
	echo "<select size=\"1\" name=\"status\"> ";
	for($j=0;$j < sizeOf($status_arr);$j++){
		echo "<option value=\"$j\" ";
		if($j == 15) echo "selected";
		echo " >{$status_arr[$j]}</option>";
	}
	echo "</select>";
	*/
	echo "$strInitLEDStatus";
	echo "<input type=\"hidden\" name=\"status\" vlaue=\"15151515151515151515151515151515\">";
	echo "<input type=\"checkbox\" name=\"sel_status\">";
	echo "</td><td>";
	//偏移坐标
	echo "$strPointOfMove";
	?>	
	&nbsp; x:<input type="text" name="move_x" size="5" value="0">y:<input type="text" name="move_y" size="5" value="0">
	<input type="submit" value="<?php echo "$strSubmit";?>" name="submit">
	<input type="reset" value="<?php echo "$strCancel";?>" name="reset"></td>
	</tr>
	</table>
	<?php
	}
}else{
	//================================================单个LED添加或设定================================================
	if(isset($led_num)){
		echo "Edit LED = $led_num";
		$sel_sql = "SELECT * FROM $table_name WHERE key_led_num ='$led_num'";
		$result = mysqli_query($pubConn,$sel_sql);
		echo mysqli_error($pubConn);
		if($DEBUG) echo "<br> sel_sql = $sel_sql";
		$rows = mysqli_fetch_array($result);
		$shape = $rows[shape];
		//$status = $rows[key_status];
		$src_page_type = $rows[key_src_page_type];
		$src_page_num  = $rows[key_src_page_num];
		$dst_page_type = $rows[dst_page_type];
		$dst_page_num  = $rows[dst_page_num];
		$point_x = $rows[point_x];
		$point_y = $rows[point_y];
		$src_led = $rows[sync_from_led];
		$remark  = $rows[remark];
		$mode = edit;
	}else{
		/*
		echo "$strAddLED:";
		echo "ID = <input type=\"text\" name=\"add_led_num\"  value=\"\" size=\"8\" maxlength=\"5\" >";
		$mode = add;		
		*/
		?>
		<script LANGUAGE="JavaScript">
			window.parent.document.body.rows="*,0%";
		</script>
		</form>
		</body>
		</html>
		<?php
		exit();
	}
	?>

	<table  border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
	  <tr bgcolor="#CCFFCC" >
	    <td colspan="2"  align="center"><?php echo "$strSourcePage";?></td>     
	    <td colspan="2"  align="center"><?php echo "$strTargetPage";?></td>
	    <td colspan="1"><?php echo "Source led num";?></td>
	  </tr>      
	  <tr bgcolor="#CCFFCC">      
	    <td><?php echo "$strPageType";?>:  <input type="text" name="src_page_type" size="5" maxlength="2" value="<?php echo "$src_page_type";?>"> </td>             
	    <td><?php echo "$strPageNumber";?>:<input type="text" name="src_page_num"  size="5" maxlength="5" value="<?php echo "$src_page_num"; ?>"> </td>             
	    <td><?php echo "$strPageType";?>:  <input type="text" name="dst_page_type" size="5" maxlength="3" value="<?php echo "$dst_page_type";?>"> </td>            
	    <td><?php echo "$strPageNumber";?>:<input type="text" name="dst_page_num" size="5" maxlength="5" value="<?php echo "$dst_page_num"; ?>"> </td>   
	    <td><input type="text" name="src_led" size="10" maxlength="10" value="<?php echo "$src_led";?>"></nobr></td>      
	  </tr>             
	  <tr bgcolor="#C0C0C0">     
	    <td colspan="5">	                
	<?php
	echo "<nobr>";
	echo "$strShape";
	echo "<select size=\"1\" name=\"shape\"> ";
	for($i =0; $i<5;$i++){
		if($i == $shape){
			$selected_shape[$i] = 'selected';
		}
	}
	echo "<option value=\"0\" {$selected_shape[0]}>$strRound</option>";
	echo "<option value=\"1\" {$selected_shape[1]}>$strSquare</option>";
	echo "<option value=\"2\" {$selected_shape[2]}>$strLandscapeRectangle</option>";
	echo "<option value=\"3\" {$selected_shape[3]}>$strTriangle</option>";
	echo "<option value=\"4\" {$selected_shape[4]}>$strPortraitRectangle</option>";
	echo "</select>";
	/*
	$status_arr=array('blink gray','blink green','blink yellow','blink red','blink blue','blink umbra','blink white','not use','gray','green','yellow','red','blue','umbra','white','not use');
	echo "$strStatus";
	echo "<select size=\"1\" name=\"status\"> ";
	for($j=0;$j < sizeOf($status_arr);$j++){
		echo "<option value=\"$j\" ";
		if($j == $status){
			echo "selected";
		}
		echo ">{$status_arr[$j]}</option>";
	}
	echo "</select>";
	*/
	?>
	              
	<?php echo "$strPointOfMove";?>:&nbsp;
	    x=<input type="text" name="point_x" size="3" maxlength="3" value="<?php echo "$point_x";?>">,
	    y=<input type="text" name="point_y" size="3" maxlength="3" value="<?php echo "$point_y";?>">     
	  <?php echo "$strRemark";?>&nbsp; <input type="text" name="remark" size="25" maxlength="32" value="<?php echo "$remark";?>" >    
	  <input type="submit" value="<?php echo "$strSubmit";?>" name="submit"><input type="reset" value="<?php echo "$strCancel";?>" name="reset">
	  </nobr>        
	 </td>             
	  </tr>              
	</table>
	<?php
	if($mode == 'edit'){
		echo "\n <input type=\"hidden\" name=\"selected_led_num\"  value=\"$led_num\">";
	}
}
?>
<script LANGUAGE="JavaScript">
	window.parent.document.body.rows="*,20%";
</script>
<?php
echo "\n <input type=\"hidden\" name=\"mode\"              value=\"$mode\">";
echo "\n <input type=\"hidden\" name=\"submode\"              value=\"$submode\">";
echo "\n <input type=\"hidden\" name=\"all_page_num\"      value=\"$all_page_num\">";
echo "\n <input type=\"hidden\" name=\"initial_record\"    value=\"$initial_record\">";
echo "\n <input type=\"hidden\" name=\"number_of_records\" value=\"$number_of_records\">";
echo "\n <input type=\"hidden\" name=\"scroll_y\"	   value=\"$scroll_y\">";
?>

</form>   
   
</body>   
   
</html>   
