<?php

	include("../M0/session_start.php") ;

	include("../M0/communs_en_tete_HTML.html") ;
	$back_link = "../M5/gestion_sondes.php";
	include('../M0/communs_en_tete_home_back.html');

	$return_path = "/M2/gestion_users.php" ;
	include('../M0/display_user_site.php'); 

?>

<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

<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>

			<font size="4" color="lightblue" face="Arial, Helvetica, sans-serif">
				</br><u>- suppression de sondes -</u></br></br>
			</font>	
		
			<table width="98%" align="center">
			
				<tr>
				
					<td align="center">

						<?php

							$p_aqcm_SITE_ID = $_SESSION['SITE_ID'] ;
							include('../M0/get_sondes_of_one_site_BAT_NIV.php');
							
							if ( $get_sondes_of_one_site_erreur == 0 ) {
								
								if ( sizeof($aqcm_NAME) >= 1 ) {

									echo( '<select name="select_sondes_macs[]" id="select_sondes_macs" size="7" class="txtField_A" multiple style="width: 85%;font-family:monospace;font-size:16px;" onclick="koko_1()" >' ) ;

									for ($i = 0; $i < sizeof($aqcm_NAME); $i++) {
										
										echo( '<option value="' . $aqcm_MAC[$i] . '"' ) ;
										echo( '>' ) ;
										echo( $aqcm_MAC[$i] . ' | ' . $aqcm_NAME[$i] . '' ) ;
										echo( '</option>' ) ;

									}
									echo( '</select>' ) ;
									
								}
								else {
								echo( '<label>' ) ;
								echo( 'erreur : liste des sondes vide !!!' ) ;
								echo( '</label>' ) ;
								}
								
							}
							else {
								echo( '<label>' ) ;
								//echo( 'erreur (' . strval( $get_sondes_of_one_site_erreur ) . ') !!!' ) ;
								echo( "</br><font color='salmon'>$get_sondes_of_one_site_message</font></br></br>" ) ;
								echo( '</label>' ) ;
							}


						?>
						

						
					</td>
					
				</tr>
				
				<tr>
					<td colspan="2">
						<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
					</td>
				</tr>

				
				<tr>
					<td align="center" colspan="2">
					
						<?php

							if ( ( $_SESSION['user_type'] == "super_user" ) || ( $get_users_of_one_site_erreur == 0 ) ) {
								echo( '<input type="submit" id="submit_form" onclick="my_confirm_function()" value="supprimer les sondes sélectionnés" disabled class="button_A" >' ) ;
							}
						?>
							
					</td>
				</tr>
				
			</table>
			
			<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>
			
		</td>
	</tr>
	
</table>

</form>

<script>

function my_confirm_function() {
	var msg="attention : voulez-vous vraiment supprimer les sondes sélectionnés ?";
	var txt;
	var r = confirm(msg);
	if (r == true) {
		txt = "./delete_some_sondes_of_one_site_target_execute.php";
	} else {
		txt = "./delete_some_sondes_of_one_site_target.php";
	}
	document.getElementById("form2").action = txt;

}

function koko_1() {
	
	var f = document.getElementById("submit_form");

	var options = document.getElementById("select_sondes_macs").options, count = 0;
	for (var i=0; i < options.length; i++) {
	  if (options[i].selected) count++;
	}

	if ( count == 0 ) {
		f.disabled = true;
	} else {
		f.disabled = false;
	}

}

</script>


 </body>
</html>