
<form name="form2" id="form2" method="post" action="">

<table align="center" width="<?php echo $tables_width ; ?>"  border="2" cellspacing="2" cellpadding="2" bordercolor="#ffffff" bgcolor="#000033">	
	<tr align="center">
		<td >

			<div>
			<label style="display: block;font-size:24px; color:lightblue;margin-top:10px;margin-bottom:25px;" >
			<u>- modifier une sonde -</u>
			</label>
			</div>
		
			<table width="100%" align="center">
		
				<tr>

					<td align="right" width="140px" >
						<label>
							nom actuel :&nbsp;
						</label>
					</td>
					
					<td align="left" >
						<select name="aqcm_SONDE_PARAMS" size="1" class="txtField_A" onChange="one_sonde_consult_2_change()"  style="width:256px;">
						<?php
						
							
							if ( $NB_sondes >= 1 ) {
								
								$FLAG_selection = false ;
								for ( $i = 0; $i < sizeof($aqcm_MAC); $i++ ) {
									if ( ( ! $FLAG_selection ) && ( $aqcm_MAC[$i] == $_SESSION['SONDE_MAC'] ) ) { 
										$FLAG_selection = true ;
									}
								}

								if ( ( $_SESSION['SONDE_MAC'] == "00_00_00_00_00_00" ) || ( ! $FLAG_selection ) ) {
									
									$_SESSION['SONDE_MAC'] = $aqcm_MAC[0] ;
									include("../M0/get_parameters_of_session_sonde.php") ;
									if ( $GPOSS_code_erreur == 0 ) {
										$_SESSION['SONDE_NAME']					= $aqcm_SONDE_NAME ;
										$_SESSION['SONDE_BAT']					= $aqcm_SONDE_BAT ;
										$_SESSION['SONDE_NIVEAU']					= $aqcm_SONDE_NIVEAU ;
										$_SESSION['SONDE_T_MAX']					= $aqcm_SONDE_T_MAX ;
										$_SESSION['SONDE_SPL_TRIG_MODE_BIQUO']	= $aqcm_SONDE_SPL_TRIG_MODE_BIQUO ;
										$_SESSION['SONDE_SPL_TRIG_MOY']			= $aqcm_SONDE_SPL_TRIG_MOY ;
										$_SESSION['SONDE_SPL_TRIG_MAX']			= $aqcm_SONDE_SPL_TRIG_MAX ;
										$_SESSION['SONDE_SCHEDULER']				= $aqcm_SONDE_SCHEDULER ;
										$_SESSION['SONDE_CO2_TRIG_LOW']			= $aqcm_SONDE_CO2_TRIG_LOW ;
										$_SESSION['SONDE_CO2_TRIG_HIGH']		= $aqcm_SONDE_CO2_TRIG_HIGH ;
										$_SESSION['SONDE_RX_WARNING_EN']		= $aqcm_SONDE_RX_WARNING_EN ;
									}
									
								}
								
								for ($i = 0; $i < sizeof($aqcm_MAC); $i++) {
									echo( '<option ' );
									if ( $aqcm_MAC[$i] == $_SESSION['SONDE_MAC'] ) { echo("selected "); }
									echo( 'value="' . $aqcm_MAC[$i] . ',' . $aqcm_NAME[$i] . ',' . $aqcm_SERVER_PWD[$i] . '">' );
									echo( $aqcm_NAME[$i] );
									echo( '</option>' ) ;
								}
								
							}
							else {
									echo('<option value="' . '00_00_00_00_00_00' . ',' . 'None' . ',' . '12345678' . '">' . 'None' . '</option>') ;
							}
							
						?>
						</select>

					</td>
					
				</tr>

				<tr>
					<td align="right" >
						<label>
							nouveau nom :&nbsp;
						</label>
					</td>
					<td align="left">
						<input type="text" id="aqcm_SONDE_NAME" name="aqcm_SONDE_NAME" value="<?php echo($_SESSION['SONDE_NAME']); ?>" maxlength="64" size="12" class="txtField_A"	style="width:256px;" >
					</td>
				</tr>

				<tr>
					<td align="right" width="140px" >
						<label>
							alertes SMS :
						</label>
					</td>
					<td align="left">
						<select name="aqcm_SONDE_RX_WARNING" id="aqcm_RX_SONDE_WARNING" size="1" class="txtField_A" style="width:80px;" >
							<?php
								include ("./selection_SMS_ON_OFF.php");
							?>
						</select>
					</td>
				</tr>

				<tr>
					<td align="right" width="140px" >
						<label>
							bâtiment :
						</label>
					</td>
					<td align="left">
						<select name="aqcm_SONDE_BAT" id="aqcm_SONDE_BAT" size="1" class="txtField_A" style="width:80px;" >
							<?php
								include ("./selection_SONDE_BAT.php");
							?>
						</select>
					</td>
				</tr>

				<tr>
					<td align="right" width="140px" >
						<label>
							niveau :
						</label>
					</td>
					<td align="left">
						<select name="aqcm_SONDE_NIVEAU" id="aqcm_SONDE_NIVEAU" size="1" class="txtField_A" style="width:80px;" >
							<?php
								include ("./selection_SONDE_NIVEAU.php");
							?>
						</select>
					</td>
				</tr>
			
				<tr>
					<td align="right">
						<label>
							valide jusqu'au :&nbsp;
						</label>
					</td>
					<td align="left" colspan="2">
						<?php
							if ( $_SESSION['level'] >= 90 ) {
								include("./modify_one_sonde_of_one_site_OK_T_MAX.php");
							}
							else {
								include("./modify_one_sonde_of_one_site_OK_T_MAX_disabled.php");
							}
						?>
					</td>
				</tr>

				<tr>
					<td align="center" colspan="2" >
					
						<input	type="submit" id="submit_form" onclick="my_confirm_function()" 
								value="appliquer" class="button_A" style="margin-top:25px;margin-bottom:15px;" >
							
					</td>
				</tr>
				
			</table>
			
		</td>
	</tr>
	
</table>

</form>

<script>

function one_sonde_consult_2_change(){
	document.getElementById("form2").requestSubmit();
}

function my_confirm_function() {
	
	var msg="attention : voulez-vous vraiment modifier la sonde sélectionnée ?";
	var txt;
	var r = confirm(msg);
	
	if (r == true) {
		txt = "./modify_one_sonde_of_one_site_target_execute.php";
	} else {
		txt = "./modify_one_sonde_of_one_site_target.php";
	}
	document.getElementById("form2").action = txt;

}

</script>

