Merge branch 'add-attachment' of DTux/avion-poeme into master
This commit is contained in:
commit
8d8ea7adf3
@ -10,28 +10,22 @@
|
||||
$db = new db();
|
||||
//$db->open();
|
||||
|
||||
foreach ($table as $var)
|
||||
{
|
||||
if ( getpost( $var ) != null )
|
||||
{
|
||||
foreach ($table as $var) {
|
||||
if (getpost($var) != null) {
|
||||
$r = getpost($var);
|
||||
/*if ( $r == "true")
|
||||
{
|
||||
$r = 1;
|
||||
}elseif( $r ="false")*/
|
||||
$db->$var = trim($r, ' \"');
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$erreur[] = $var;
|
||||
}
|
||||
}
|
||||
if (!empty ($erreur))
|
||||
{
|
||||
if (!empty($erreur)) {
|
||||
echo json_encode($erreur);
|
||||
log_error("erreur lors de l'acquisition des données:" . EOLH . print_r($erreur, true));
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
$db->newPlane();
|
||||
}
|
||||
$db->close();
|
||||
?>
|
||||
|
@ -54,6 +54,13 @@
|
||||
<br>
|
||||
<div class="form-control rounded-0" id="messageTextArea"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="bold">Ajouter une piève jointe</label>
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input" id="attachmentPlane" aria-describedby="inputGroupFileAddon01">
|
||||
<label class="custom-file-label" for="attachmentPlane"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="bold" for="selectTime" id="flightTime">Temps de vol</label>
|
||||
<select class="form-control" id="selectTime">
|
||||
|
@ -336,3 +336,7 @@ a#navbarDropdownLang.nav-link.dropdown-toggle::after {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-file-label::after {
|
||||
content: "Parcourir";
|
||||
}
|
||||
|
@ -18,6 +18,12 @@ $("#destMail").change(function() {
|
||||
checkFormValid()
|
||||
})
|
||||
|
||||
document.querySelector('.custom-file-input').addEventListener('change',function(e){
|
||||
var fileName = document.getElementById("attachmentPlane").files[0].name;
|
||||
var nextSibling = e.target.nextElementSibling
|
||||
nextSibling.innerText = fileName
|
||||
})
|
||||
|
||||
function checkFormValid(){
|
||||
if(validExpeMail && validExpeLoc && validDestMail && validDestLoc){
|
||||
$('#sendNewPlane').prop("disabled", false)
|
||||
|
@ -109,7 +109,29 @@ $("#sendNewPlane").on('click',function(){
|
||||
|
||||
var randomColor = getRandomColor()
|
||||
|
||||
console.log(message)
|
||||
var formData = new FormData()
|
||||
var attachment = $("#attachmentPlane").prop('files')[0];
|
||||
formData.append('file', attachment);
|
||||
formData.append('message', encodeURIComponent(message));
|
||||
formData.append('expeMail', $("#expeMail").val());
|
||||
formData.append('expeKnown', expeKnown);
|
||||
formData.append('expeLang', lang);
|
||||
formData.append('destLang', $("#selectDestLang").val());
|
||||
formData.append('startLat', expeLoc.center[1]);
|
||||
formData.append('startLon', expeLoc.center[0]);
|
||||
formData.append('startName', expeLoc.name);
|
||||
formData.append('startTime', sentDate);
|
||||
formData.append('startTZ', expeTimezone);
|
||||
formData.append('destMail', $("#destMail").val());
|
||||
formData.append('destLat', destLoc.center[1]);
|
||||
formData.append('destLon', destLoc.center[0]);
|
||||
formData.append('destName', destLoc.name);
|
||||
formData.append('public', publicMessage, );
|
||||
formData.append('color', randomColor);
|
||||
formData.append('deliveryTime', deliveryDate);
|
||||
formData.append('deliveryTZ', destTimezone);
|
||||
formData.append('deliveryTimeServer', deliverySecondsServer);
|
||||
formData.append('deliveryMethod', $("#selectTime").val());
|
||||
|
||||
var data = {
|
||||
'message':encodeURIComponent(message),
|
||||
@ -131,39 +153,22 @@ $("#sendNewPlane").on('click',function(){
|
||||
'deliveryTime':deliveryDate,
|
||||
'deliveryTZ':destTimezone,
|
||||
'deliveryTimeServer':deliverySecondsServer,
|
||||
'deliveryMethod':$("#selectTime").val()
|
||||
'deliveryMethod':$("#selectTime").val(),
|
||||
}
|
||||
|
||||
|
||||
var query = 'avionpoeme.php?'+
|
||||
'message='+data.message+'&'+
|
||||
'expeMail='+data.expeMail+'&'+
|
||||
'expeKnown='+data.expeKnown+'&'+
|
||||
'expeLang='+data.expeLang+'&'+
|
||||
'destLang='+data.destLang+'&'+
|
||||
'startLat='+data.startLat+'&'+
|
||||
'startLon='+data.startLon+'&'+
|
||||
'startName='+data.startName+'&'+
|
||||
'startTime='+data.startTime+'&'+
|
||||
'startTZ='+data.startTZ+'&'+
|
||||
'destMail='+data.destMail+'&'+
|
||||
'destLat='+data.destLat+'&'+
|
||||
'destLon='+data.destLon+'&'+
|
||||
'destName='+data.destName+'&'+
|
||||
'public='+data.public+'&'+
|
||||
'color='+data.color+'&'+
|
||||
'deliveryTime='+data.deliveryTime+'&'+
|
||||
'deliveryTZ='+data.deliveryTZ+'&'+
|
||||
'deliveryTimeServer='+data.deliveryTimeServer+'&'+
|
||||
'deliveryMethod='+data.deliveryMethod+'';
|
||||
|
||||
$.post(query, function(result) {
|
||||
$.ajax({
|
||||
url: 'avionpoeme.php',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
cache : false,
|
||||
type: 'POST',
|
||||
success: function(result){
|
||||
result = result.replace(/'/g, '"');
|
||||
console.log(result)
|
||||
result = $.parseJSON(result)
|
||||
var planeId = Number(result.uid);
|
||||
//selecting proper color for back
|
||||
$("#back").attr("src","src/img/back-"+data.color+".jpg");
|
||||
$("#back").attr("src","src/img/back-"+randomColor+".jpg");
|
||||
|
||||
// creating image for plane, need to link it to the inputs tog et entered values.
|
||||
var message = quill.root.innerHTML
|
||||
@ -193,14 +198,11 @@ $("#sendNewPlane").on('click',function(){
|
||||
},4400);
|
||||
//reloading page (to change)
|
||||
setInterval(function(){
|
||||
window.location.href ='https://avion-poe.me?avion='+planeId+'';
|
||||
window.location.href ='https://www.avion-poe.me/?avion='+planeId+'';
|
||||
},5500);
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
|
@ -46,7 +46,6 @@ var dictionnary = []
|
||||
|
||||
function translateUI(l){
|
||||
$.getJSON("lang/"+l+"", function(s){
|
||||
console.log(s)
|
||||
dictionnary = s
|
||||
//if arabic : display left to right (ltr) + troubleshooting a lot of individual elements
|
||||
if (lang == "ar"){
|
||||
|
Reference in New Issue
Block a user