<?php

	//--------------------------------------------------------------------------------------------------------
	// On prolonge la session
	//--------------------------------------------------------------------------------------------------------
	include("../M0/session_start.php") ;

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

	include("./AQCM_get_SMS_parameters.php") ;

	include('../M0/display_user_only.php'); 
?>

<div align="center">
<form name="form2" method="post" action="./AQCM_set_SMS_parameters.php">
	
	<table width="<?php echo($tables_width); ?>" border="2" cellspacing="2" cellpadding="2" bordercolor="#ffffff" bgcolor="#000033">	
		
		<tr valign="middle" bordercolor="#666666"> 
			<td align="center">
			
				<table width="90%" align="center" >
					<tr valign="middle" bordercolor="#666666"> 
						<td align="left">
							<font color="orange" >
							Le paramétrage du serveur de SMS est réservé 
							aux administrateurs expérimentés.
							</font>
							<br><br>
							Ce serveur permet d'envoyer des SMS, notamment
							lorsque les authentifications sont de type 2FA.<br>
							( 2FA = Two Factors Authentication )<br><br>
						</td>
					</tr>
				</table>
				
				<table width="98%" align="center" >

					<tr>
						<td align="right"  width="35%">
							<label style="font-size:14px;" >service SMS :&nbsp;</label>
						</td>
						<td align="left">
							<select name="aqcm_SMS_SERVICE" id="aqcm_SMS_SERVICE" onchange="change()" size="1" class="txtField" >
								<option <?php if ( $aqcm_SMS_SERVICE == "OVH" ) {echo('selected ');} ?> >OVH</option>
								<option <?php if ( $aqcm_SMS_SERVICE == "E3531" ) {echo('selected ');} ?> >E3531</option>
								<option <?php if ( $aqcm_SMS_SERVICE == "B525" ) {echo('selected ');} ?> >B525</option>
							</select>
						</td>
					</tr>
					
				</table>
				
				<font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font>

				<table width="98%" align="center" >

					<tr>
						<td align="right"  width="35%">
							<label style="font-size:14px;" >end point :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_end_point" name="aqcm_SMS_end_point" value="<?php echo($aqcm_SMS_end_point);?>" maxlength="64" style="width:262px;"  size="12" class="txtField_H" <?php if ( $aqcm_SMS_SERVICE != 'OVH' ) { echo('disabled'); } ?> >
						</td>
					</tr>
					<tr>
						<td align="right">
							<label style="font-size:14px;" >application key :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_application_key" name="aqcm_SMS_application_key" value="<?php echo($aqcm_SMS_application_key);?>" maxlength="64" style="width:262px;"  class="txtField_H" <?php if ( $aqcm_SMS_SERVICE != 'OVH' ) { echo('disabled'); } ?> >
						</td>
					</tr>
			
					<tr>
						<td align="right">
							<label style="font-size:14px;" >application secret :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_application_secret" name="aqcm_SMS_application_secret" value="<?php echo($aqcm_SMS_application_secret);?>" maxlength="64" style="width:262px;" class="txtField_H" 
							<?php if ( $aqcm_SMS_SERVICE != 'OVH' ) { echo('disabled'); } ?> >
						</td>
					</tr>
					<tr>
						<td align="right">
							<label style="font-size:14px;" >consumer key :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_consumer_key" name="aqcm_SMS_consumer_key" value="<?php echo($aqcm_SMS_consumer_key);?>" maxlength="64" style="width:262px;" class="txtField_H" 
							<?php if ( $aqcm_SMS_SERVICE != 'OVH' ) { echo('disabled'); } ?> >
						</td>
					</tr>

				</table>

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

				<table width="98%" align="center" >
					<tr>
						<td align="right"  width="35%">
							<label style="font-size:14px;" >URL(E3531) :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_E3531_URL" name="aqcm_SMS_E3531_URL" value="<?php echo($aqcm_SMS_E3531_URL);?>" maxlength="100" class="txtField_H"  style="width:262px;" 
							<?php if ( $aqcm_SMS_SERVICE != 'E3531' ) { echo('disabled'); } ?>
							>
						</td>
					</tr>
			
					<tr>
						<td align="right">
							<label style="font-size:14px;" >MAC(E3531) :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_E3531_MAC" name="aqcm_SMS_E3531_MAC" value="<?php echo($aqcm_SMS_E3531_MAC);?>" maxlength="64" style="width:262px;"  class="txtField_H" 
							<?php if ( $aqcm_SMS_SERVICE != 'E3531' ) { echo('disabled'); } ?>
							>
						</td>
					</tr>
					
				</table>

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

				<table width="98%" align="center" >
					<tr>
						<td align="right"  width="35%">
							<label style="font-size:14px;" >URL(B525) :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_B525_URL" name="aqcm_SMS_B525_URL" value="<?php echo($aqcm_SMS_B525_URL);?>" maxlength="100" style="width: 262px;" class="txtField_H" 
							<?php if ( $aqcm_SMS_SERVICE != 'B525' ) { echo('disabled'); } ?>
							>
						</td>
					</tr>
			
					<tr>
						<td align="right">
							<label style="font-size:14px;" >MAC(B525) :&nbsp;</label>
						</td>
						<td align="left">
							<input type="text" id="aqcm_SMS_B525_MAC" name="aqcm_SMS_B525_MAC" value="<?php echo($aqcm_SMS_B525_MAC);?>" maxlength="64" style="width:262px;"  class="txtField_H" 
							<?php if ( $aqcm_SMS_SERVICE != 'B525' ) { echo('disabled'); } ?>
							>
						</td>
					</tr>

				</table>

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

				<table width="98%" align="center">
					<tr>
						<td align="center" colspan="2">
								<button type="button" onclick="SetDefaultsValues()" class="button_A">réinitialiser les valeurs</button>
						</td>
					</tr>
					<tr>
						<td align="center" colspan="2">
								<input type="submit" value="enregistrer ces valeurs" class="button_A" >
						</td>
					</tr>
				</table>

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

	</table>

	
</form>
</div>

<script>
function SetDefaultsValues() {
  document.getElementById("aqcm_SMS_end_point").value = "ovh-eu";
  document.getElementById("aqcm_SMS_application_key").value = "1234567812345678";
  document.getElementById("aqcm_SMS_application_secret").value = "12345678123456781234567812345678";
  document.getElementById("aqcm_SMS_consumer_key").value = "12345678123456781234567812345678";
}
</script>

<script>
function change(){
		
	var SMS_SERVICE = document.getElementById('aqcm_SMS_SERVICE');
	var SMS_SERVICE_TEXT = SMS_SERVICE.options[SMS_SERVICE.selectedIndex].text;

	if ( SMS_SERVICE_TEXT == "OVH" ) { 
		document.getElementById("aqcm_SMS_end_point").disabled = false;
		document.getElementById("aqcm_SMS_application_key").disabled = false;
		document.getElementById("aqcm_SMS_application_secret").disabled = false;
		document.getElementById("aqcm_SMS_consumer_key").disabled = false;
		document.getElementById("aqcm_SMS_E3531_URL").disabled = true;
		document.getElementById("aqcm_SMS_E3531_MAC").disabled = true;
		document.getElementById("aqcm_SMS_B525_URL").disabled = true;
		document.getElementById("aqcm_SMS_B525_MAC").disabled = true;
	} 
	else if ( SMS_SERVICE_TEXT == "E3531" ) { 
		document.getElementById("aqcm_SMS_end_point").disabled = true;
		document.getElementById("aqcm_SMS_application_key").disabled = true;
		document.getElementById("aqcm_SMS_application_secret").disabled = true;
		document.getElementById("aqcm_SMS_consumer_key").disabled = true;
		document.getElementById("aqcm_SMS_E3531_URL").disabled = false;
		document.getElementById("aqcm_SMS_E3531_MAC").disabled = false;
		document.getElementById("aqcm_SMS_B525_URL").disabled = true;
		document.getElementById("aqcm_SMS_B525_MAC").disabled = true;
	}
	else if ( SMS_SERVICE_TEXT == "B525" ) {
		document.getElementById("aqcm_SMS_end_point").disabled = true;
		document.getElementById("aqcm_SMS_application_key").disabled = true;
		document.getElementById("aqcm_SMS_application_secret").disabled = true;
		document.getElementById("aqcm_SMS_consumer_key").disabled = true;
		document.getElementById("aqcm_SMS_E3531_URL").disabled = true;
		document.getElementById("aqcm_SMS_E3531_MAC").disabled = true;
		document.getElementById("aqcm_SMS_B525_URL").disabled = false;
		document.getElementById("aqcm_SMS_B525_MAC").disabled = false;
	}
	else {
		document.getElementById("aqcm_SMS_end_point").disabled = false;
		document.getElementById("aqcm_SMS_application_key").disabled = false;
		document.getElementById("aqcm_SMS_application_secret").disabled = false;
		document.getElementById("aqcm_SMS_consumer_key").disabled = false;
		document.getElementById("aqcm_SMS_E3531_URL").disabled = false;
		document.getElementById("aqcm_SMS_E3531_MAC").disabled = false;
		document.getElementById("aqcm_SMS_B525_URL").disabled = false;
		document.getElementById("aqcm_SMS_B525_MAC").disabled = false;
	}

}
</script>


</body>
</html>