// alert(9900); //C:\iC\_scripts\js\firstForm.js.php // https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON // texte de clé : https://codes-sources.commentcamarche.net/source/36434-permet-de-crypter-coder-facilement-un-texte-a-l-aide-d-une-cle-mot-de-passe-indechiffrable // https://codes-sources.commentcamarche.net/source/30279-cryptage-de-texte // https://tzi.fr/js/code-vigenere/ // https://www.google.com/search?q=js+coder+un+mot&sca_esv=567294360&ei=Ul0MZevxMaajkdUP3_qPkA8&start=10&sa=N&ved=2ahUKEwjr4oPY_ruBAxWmUaQEHV_9A_IQ8tMDegQIBBAE&biw=1440&bih=789&dpr=1 // ok https://waytolearnx.com/2019/09/chiffrement-de-cesar-en-javascript.html // C:\ic\_scripts\js\firstForm.js.php /* function essai(){ jsidAddress="¤isRemoteIP"; let myObj = { name: jsidAddress, age: 38 }; alert('line 5 : '+myObj.name+' - '+jsidAddress+' - '+'toto'); } alain.perrier@univ-rennes1.fr; "Michel Vergnaud" , "Jacques Ledig" , "Alain Perrier" , "Laurent Surcin" , "Michel Moulin" , "Michel Boussekeyt" , "Philippe Costes" , "Patrick Chanot" https://www.galaxie.enseignementsup-recherche.gouv.fr/ensup/etab_recrutement_PRAG_PRCE.htm#:~:text=Les%20candidats%20doivent%20d%C3%A9poser%20leur,les%20documents%20sp%C3%A9cifiques%20que%20chaque https://www.neoprofs.org/t125977-universite-ou-lycee-quel-est-le-meilleur-salaire https://www.foesr.fr/index.php/9-uncategorised/171-grilles-indiciaires-prag-prce */ try{ // ¤DIR_iC '/iC/_DB/ajax-email.php' jsDIR_iC+'_DB/ajax-email.php' var jspageFileSource='/iC/_scripts/js/firstForm'; var upButton,formdata,iData,oData,xdr,synchro,linkAjax=jspageFileAXForum,iDataSerialize;//,synchro; serialize(iData) var orientationScreen=window.screen.orientation.type; //alert(orientationScreen);//landscape-primary var orientationAngleScreen=window.screen.orientation.angle; //alert(orientationAngleScreen);//0 var orientation=orientationScreen+"-"+orientationAngleScreen; //alert(orientation);//landscape-primary-0 //var x=myDebug.getCookie("orientation"); if(1){ let paramsScreen = "paramsScreen"; // Apply setCookie setCookie("paramsScreen", window.screen.width+"x"+window.screen.height, 30); } /* alert(window.screen.width+"x"+window.screen.height);//1280x1024 alert(document.cookie); var x=getCookie("orientation"); if(x!=orientation){ document.cookie = "orientation="+orientation; window.location.reload(); ///break; // try{break;}catch(e){throw new Error();} ///exit(0); //break; //throw new Error(); } else{ var screenSizes=window.screen.width+"x"+window.screen.height; alert(screenSizes); document.cookie = "screenSizes="+screenSizes+"-"+window.screen.availWidth+"x"+window.screen.availHeight; ////al ert("orientation",getCookie("orientation")); var x=getCookie("orientation"); } */ //===== if(0){ jsline=71;jsfct_dvlptAlert(['!',l2p+jsline,h2p+fct,"nbrVignettes orientation" ]); } var jsuserSitename=jsStartSite.userSite; var jsidAddress=jsStartSite.isRemoteIP;//''; jsStartSite.isLOCALHOST='http:\/\/localhost\/'.includes('localhost')&&(jsidAddress==jslocalhost); document.getElementById("idparamA").value=""; document.getElementById("idclickA").value=""; //=== function padTo2Digits(num){fct="fct:jsb:padTo2Digits(num)"; return num.toString().padStart(2, '0'); }//!\end:function padTo2Digits(num){fct="fct:jsb:padTo2Digits(num)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function formatTimeMMSS(date){fct="fct:jsb:formatTimeMMSS(date)"; return ( [ padTo2Digits(date.getHours()), padTo2Digits(date.getMinutes()), padTo2Digits(date.getSeconds()), ].join('')//.join(':') ); }//!\end:function formatTimeMMSS(date){fct="fct:jsb:formatTimeMMSS(date)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function formatDate(date){fct="fct:jsb:formatDate(date)"; return ( [ date.getFullYear(), padTo2Digits(date.getMonth() + 1), padTo2Digits(date.getDate()), ].join('-') + ' ' + [ padTo2Digits(date.getHours()), padTo2Digits(date.getMinutes()), padTo2Digits(date.getSeconds()), ].join(':') ); }//!\end:function formatDate(date){fct="fct:jsb:formatDate(date)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ //====== ///function goNewContentPostit(ta blez,thIs,mode){ function goNewContentPostit(thIs,mode){fct="fct:jsb:goNewContentPostit(thIs,mode)"; tablex=document.getElementById(jlist_Postits.table);//jlist_Postits.table=ta blez; switch(mode){ case "new0": //new Date(tdate) let d=formatDate(new Date());//let d=new Date().getTime();//d=d.split(" ");d=d[0]+' '+d[1]; content='
'+d+' | ID: '+jlist_Postits.NumberID+' | ADNK: '+'ADNKID'+'
'; // content='
'+d+' | '+'numberID'+' | '+'ADNK'+'

'; content+='
'; content+='
(zone du contenu qui sera enregistré)
'; break; case "new1": default: valueOnsubmit="goSaveNewPostit(this);return(false);";//"goSaveNewPostit(this,'ta blez');return(false);"; valueSuccess='Postit Form'; value_form_='postit.0,'+tablez+',password,record,keywords,content'; array=[valueOnsubmit,valueSuccess,value_form_]; content=''; content+=''; content+='
'+'//!\fr Mots clés'+': '; content+='
'+''; content=goConstructForm(array,content); break; } return(content); }//!\end:function goNewContentPostit(thIs,mode){fct="fct:jsb:goNewContentPostit(thIs,mode)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function getXDomainRequest(){fct="fct:jsb:getXDomainRequest()"; // let xdr = null; if (window.XDomainRequest) {xdr = new XDomainRequest(); }  else if (window.XMLHttpRequest) { xdr = new XMLHttpRequest(); }  else { jsline=146;jsfct_dvlptAlert(['',l2p,h2p,"//!\fr Votre navigateur ne gère pas l'AJAX cross-domain !" ]); } return xdr;         }//!\end:function getXDomainRequest(){fct="fct:jsb:getXDomainRequest()"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsc_getformDataObj(formthis){fct="fct:jsb:jsc_getformDataObj(formthis)"; //---- formData=new FormData(formthis); formData.append("FileAX",jspageFileAXForum); formData.append("userSite",jsStartSite.userSite); formData.append("isDir_iC",jsStartSite.isDir_iC); formData.append("isDir_Site",jsStartSite.isDir_Site); formData.append("isLOCALHOST",jsStartSite.isLOCALHOST); formData.append("isRemoteIP",jsStartSite.isRemoteIP); formData.append("isLang",jsStartSite.isLang); formData.append("isConnected",jsStartSite.isConnected); //---- iData={};formData.forEach((value,key)=>(iData[key]=value)); return(new Array(formData,iData));//formDataObj)); }//!\end:function jsc_getformDataObj(formthis){fct="fct:jsb:jsc_getformDataObj(formthis)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function sendDataOpenResults(formthis){fct="fct:jsb:sendDataOpenResults(formthis)"; //!\sendX //step:logger:8 traitment of xdr.responseText let d0=formatTimeMMSS(new Date(),'');d1=d0; while(d1-d0<3) {//inférieur à 3s d1=formatTimeMMSS(new Date(),''); if((d1-d0)){ // https://dmitripavlutin.com/foreach-iterate-array-javascript/ // https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Statements/for...of //----- msg="";sparseArray=["'xdebug-error'","Notice: Undefined Index","Parse error: syntax error"]; for(element of sparseArray){indexOfFirst=xdr.responseText.indexOf(element); if(indexOfFirst>-1){msg="Warning! "+element+"\n"+xdr.responseText;break;} } if(msg){alert(msg);return;} //----- oData=JSON.parse(xdr.responseText); msg="";sparseArray=["oData.success"]; for(element of sparseArray){if(!oData.success){msg="Warning! "+element;break;}} if(msg){alert(msg);return;} //----- dataSuccessForm=iData.success.split("|");iT=dataSuccessForm[0];dataSuccessForm=dataSuccessForm[1]; dataSuccessoData=oData.success.split("|");oT=dataSuccessoData[0];dataSuccessoData=dataSuccessoData[1]; sameSuccess=(iT==0&&oT==1&&(dataSuccessForm===dataSuccessoData)); if(0){ jsline=249;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,"action= "+fctAction ,'iData.success= '+iData.success ,'oData.success= '+oData.success,'sameSuccess= '+sameSuccess ]); } //----- if(sameSuccess){ idSuccessHx=document.getElementById(formthis.idSuccessHx.name); if(idSuccessHx){ idSuccessHx.style.padding="5"; idSuccessHx.style.margin="5"; idSuccessHx.style.border="dashed 2px green";//"dashed 1px green"; idSuccessHx.style.background="#efeeef";//"dashed 1px green"; idSuccessHx.style.fontWeight="bold"; idSuccessHx.style.fontSize="1.5vw"; idSuccessHx.style.display="inline"; jsmethodControlCommonWaiting("idSuccessHx","//!\fr réussite","green"); } //----- idResponseHx=document.getElementById("idResponseHx"); if(idResponseHx){ idResponseHx.style.fontSize="0.8vw"; idResponseHx.innerHTML=iData.mail+", "+iData.pass+", "+" | "+oData.mail+", "+oData.pass+" | " +(iData.mail==oData.mail&&iData.pass==oData.pass); } //----- idobjectConON0=document.getElementById("idobjectConON0"); //idobjectConON0.style.display="inline"; idobjectConON1=document.getElementById("idobjectConON1"); if(idobjectConON0){ idobjectConON0.style.display=idobjectConON1.style.display="inline"; } //----- idobjectConOFF=document.getElementById("idobjectConOFF"); if(idobjectConOFF){ idobjectConOFF.style.display="none"; } //----- if(0){ jsline=283;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,"oData.Connected= "+oData.Connected ,"oData.userSite= "+oData.userSite,"oData.fluxX= "+oData.fluxX ]); } return(true); } jsline=305;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,"idSuccessHx.style.color= "+idSuccessHx.style.color ]); idSuccessHx.style.color="red"; break;//!\sendX //step:logger:9 traitment of xdr.responseText ready }//!\end:js:if((d1-d0)){ }//!\end:js:while (d1-d0<3) {//inférieur à 3s // step=1; }//!\end:function sendDataOpenResults(formthis){fct="fct:jsb:sendDataOpenResults(formthis)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function goConstructForm(array,content){fct="fct:jsb:goConstructForm(array,content)"; return(jsmethodConstructFORM(true,array)+content+jsmethodConstructFORM(false));// head+content+end }//!\end:function goConstructForm(array,content){fct="fct:jsb:goConstructForm(array,content)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodConstructFORM(mode,xarray){fct="fct:jsb:jsmethodConstructFORM(mode,xarray)"; // permet de créer une form pour ajax content=''; if(mode===false)return(''); if(jsStartSite.isLOCALHOST){ content='
'; content+='

idResponseHx

'; } if(mode&&xarray){//[0]){ xonsubmit=xarray[0];//'goSaveNewPostit(this,\'ta blez\');return(false);'; valueSuccess=xarray[1];//'Postit Form'; value_form_=xarray[2];//'postit.0,ta blez,password,record,keywords,content'; content='
'; content+='
'; content+='

'; content+='
'; content+=''; content+=''; content+=''; content+=''; } return(content); }//!\end:js:function jsmethodConstructFORM(mode,xarray){fct="jsmethodConstructFORM(mode,xarray)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // jsmethodControlCommonWaiting(idTopInfo,jslangSystem.Cochez_pour_enregistrer_depuis_ce_bouton);return(false); function jsmethodTestElementFORM(idTopInfo,message,elmValue,warning,fct){fct="fct:jsb:jsmethodTestElementFORM(idTopInfo,message,elmValue,warning,fct)"; tobor='tobor';xfalse=true; if(fct==tobor) {if(elmValue!==""){jsmethodControlCommonWaiting(idTopInfo,message);return(false);};} else{ if(elmValue==""){jsmethodControlCommonWaiting(idTopInfo,message);return(false);}; switch(fct){ case 'mail': /// if(!jsmethodControlLoginValidateEmail(elmValue)){jsmethodControlCommonWaiting(idTopInfo,message);return(false);}; if(!jsmethodControlLoginValidateEmail(elmValue)){jsmethodControlCommonWaiting(idTopInfo,message);return(false);}; break; case 'pass': if(!jsmethodControlLoginValidatePass(elmValue)){jsmethodControlCommonWaiting(idTopInfo,message);return(false);}; // if(!jsmethodControlLoginValidatePass(elmValue)){return(false);}; break; default: return(false); }//!\end:switch(fct){ } //jsmethodControlCommonWaiting(idTopInfo,""); obj=document.getElementById(idTopInfo); if(obj=="[object HTMLHeadingElement]")y=(obj.style.display=="none"); return(true); }//!\end:function jsmethodTestElementFORM(idTopInfo,message,elmValue,warning,fct){fct="fct:jsb:jsmethodTestElementFORM(idTopInfo,message,elmValue,warning,fct)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodControlCommonSetElementTitleFORM(infoStart,value){fct="fct:jsb:jsmethodControlCommonSetElementTitleFORM(infoStart,value)"; // return(new Array(info0,info1)); info0=document.getElementById('infoId'+'0'+infoStart);///keyT); info1=document.getElementById('infoId'+'1'+infoStart);///keyT); if(value>-1){ if(info0)info0.style.display=(value==0?'inline':'none'); if(info1)info1.style.display=(value==1?'inline':'none'); } return(new Array(info0,info1)); }//!\end:function jsmethodControlCommonSetElementTitleFORM(infoStart,value){fct="fct:jsb:jsmethodControlCommonSetElementTitleFORM(infoStart,value)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodControlCommonSetElementContent(element,ok,value,color,opacity,disabled){fct="fct:jsb:jsmethodControlCommonSetElementContent(element,ok,value,color,opacity,disabled)"; if(ok){ //element.value=value; element.style.color='green';element.style.opacity=.3;element.disabled=true; return; } element.value=(value?value:'');element.style.color=(color?color:'black'); element.style.opacity=(opacity?opacity:1);element.disabled=(disabled?disabled:false); }//!\end:function jsmethodControlCommonSetElementContent(element,ok,value,color,opacity,disabled){fct="fct:jsb:jsmethodControlCommonSetElementContent(element,ok,value,color,opacity,disabled)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsfct_dvlptWriteLoginMailPass(mail,pass){fct="fct:jsb:jsfct_dvlptWriteLoginMailPass(mail,pass"; x=document.getElementById('mail');if(x)x.value=mail; x=document.getElementById('pass');if(x)x.value=pass; }//!\end:function jsfct_dvlptWriteLoginMailPass(mail,pass){fct=fct:jsb:jsfct_dvlptWriteLoginMailPass(mail,pass"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodControlLoginValidatePass(pass){fct="fct:jsb:jsmethodControlLoginValidatePass(pass)"; date=new Date(); passDate=[ padTo2Digits(date.getDate()) ,padTo2Digits(date.getMonth() + 1) ].join(''); if(passDate==pass)return(true); alert('mediumRegex : '+passDate+'\n'+'pass : '+pass); // https://www.geeksforgeeks.org/how-to-validate-confirm-password-using-javascript/ /* var strongRegex = new RegExp(“^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})”); RegEx Description ^ The password string starting. (?=.*[a-z]) Must contain at least 1 lowercase alphabetical character from a to z. (?=.*[A-Z]) Must contain at least 1 uppercase alphabetical character from A to Z. (?=.*[0-9]) Must contain at least 1 numeric character from 0 to 9. (?=.*[!@#$%^&*]) Must contain at least one special character. (?=.{8,}) Must be eight characters or longer string */ strongRegex=new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})"); mediumRegex=new RegExp("^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})"); ///alert('mediumRegex : '+mediumRegex.test(pass)+' - strongRegex : '+strongRegex.test(pass)); x=mediumRegex.test(pass); return(x); return(mediumRegex.test(pass)); //if(mediumRegex.test(pass))return(false); }//!\end:function jsmethodControlLoginValidatePass(pass){fct="fct:jsb:jsmethodControlLoginValidatePass(pass)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodControlLoginValidateEmail(mail){fct="fct:jsb:jsmethodControlLoginValidateEmail(mail)"; jsline='110 jsmethodControlLoginValidateEmail(mail)'; //alert('1111 '+mail); //mail='fatima@gmail.com / 5555'; var re=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; ///jsline=180;jsfct_dvlptAlert(jsline+" line =\n re.test(mail) = "+re.test(mail)); x=re.test(mail); return(x); }//!\end:function jsmethodControlLoginValidateEmail(mail){fct="fct:jsb:jsmethodControlLoginValidateEmail(mail)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodControlLoginDisplayPass(thIs,f_name){fct="fct:jsb:jsmethodControlLoginDisplayPass(thIs,f_name)"; jsline='117 jsmethodControlLoginDisplayPass(thIs,f_name)'; x=document.getElementById(f_name);x.type=(x.type==="password"?"text":"password"); y=f_name;if(y==="mail")x.type="email"; if(y==="pass"){i=thIs.parentNode.children[0];x.type=(thIs.checked?'text':'password');} }//!\end:function jsmethodControlLoginDisplayPass(thIs,f_name){fct="fct:jsb:jsmethodControlLoginDisplayPass(thIs,f_name)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodControlCommonWaiting(key,text,color){fct="fct:jsb:jsmethodControlCommonWaiting(key,text,color)"; jsline='line 176 jsmethodControlCommonWaiting(thIs,text)'; content=''; obj=document.getElementById(key); if(obj=="[object HTMLHeadingElement]"){ ////alert('line 173\n'+obj.type+'\n'+typeof obj+'\n'+obj.innerHTML+'\n'+obj.style.display); y=(obj.style.display=="none"); obj.innerHTML=(y?text:""); //obj.innerHTML=text; obj.style.display=(y?"inline":"none"); obj.style.color=(y?"red":"green"); if(color)obj.style.color=color; return; } msg=document.getElementById('infoId'+key); if(obj){ switch(obj.type){ case '[object HTMLHeadingElement]': case 'xxxxtextarea': content=obj.innerHTML; break; default://input type="text et email et textarea" content=obj.value; } } //jsline=162;jsfct_dvlptAlert(jsline+'\nobj.name= '+obj.name+'\ncontent= '+content+'\nmsg= '+msg.innerHTML); if(!content&&msg){ /// err=document.getElementById('infoId'+thIs.name); msg.style.display='inline-block';msg.style.fontSize='12pt';msg.style.weight='bold'; msg.style.color='red'; msg.innerHTML=text; return(false); } ///if(content)thIs.innerHTML=text; }//!\end:function jsmethodControlCommonWaiting(key,text,color){fct="fct:jsb:jsmethodControlCommonWaiting(key,text,color)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodDetectionForm(formthis){fct="fct:jsb:jsmethodDetectionForm(formthis)"; ///let iData; ///if(element == "[object HTMLFormElement]") if(formthis=="[object HTMLFormElement]"){ spanButton=formthis.parentElement; //upButton=thIs;//.parentElement.children[0]; upCheckbox=formthis.parentElement.children[1]; //idsuccessHx, _form_, success, tobor, buttonCheckbox, mail, pass, taskLoginSelect, idnahiddenSelect, testdata, fileX, userSite, isDir_Site arr0=jsc_getformDataObj(formthis);//,iData);//new FormData(thIs);// //step:logger:2 search the iDatas here formdata+iData formdata=arr0[0];iData=arr0[1];// iDataSerialize /* C:\iC\v0\iCv0_index.php var jsStartSite = { userSite: "'.strtolower(¤APP_nameDir_SITE).'" , sedocList: "'.¤sedocList.'" , isDir_Site: "'.¤DIR_SITE.'" , isDir_iC: "'.¤DIR_iC.'", isV_XX: "'.¤vXX.'" , isRemoteIP: "'.¤RemoteIP.'", isSmarphone: "'.(integer)¤isSmartphone.'" , isScreenSizes: screenSizes, isOrientationScreen: x , isLang: "'.@$_SESSION[¤APP_nameDir_SITE][¤lang].'" , isConnected: "'.@$_SESSION[¤APP_nameDir_SITE][¤Connected].'" , isWifi: "'.¤isWIFI.'", isLOCALHOST: "'.¤isLOCALHOST.'", isforceDevlptAlerts: '.(integer)¤forceDevlptAlerts.' , isnbrDiapos: "'.(integer)@$_SESSION[¤APP_nameDir_SITE]['listProducts'].'" , isindexProduct: "'.(integer)@$_SESSION[¤APP_nameDir_SITE]['indexProduct'].'" , iswebmaster: "'.¤MAIL_WEBMASTER_SITE.'" , senderHostTo: "'.¤MAIL_senderHostTo_SITE.'" , senderHostToReply: "'.¤MAIL_senderHostToReply_SITE.'" formData.append("userSite",jsStartSite.userSite); formData.append("isDir_Site",jsStartSite.isDir_Site); formData.append("isLOCALHOST",jsStartSite.isLOCALHOST); formData.append("isRemoteIP",jsStartSite.isRemoteIP); formData.append("isLang",jsStartSite.isLang); formData.append("isConnected",jsStartSite.isConnected); */ iData.fileX=jspageFileAXForum;//linkAjax; iData.userSite=jsStartSite.userSite; iData.isDir_iC=jsStartSite.isDir_iC; iData.isDir_Site=jsStartSite.isDir_Site; iData.isLang=jsStartSite.isLang; iData.isConnected=jsStartSite.isConnected; jsline=356;jsfct_dvlptAlert(['!',l2p+jsline,'formdata= '+formdata,'iData= '+iData,'upCheckbox= '+upCheckbox ,'upCheckbox.checked= '+upCheckbox.checked,'iData.mail= '+iData.mail] ); } //alert('line 200 \n'+'form= '+thIs+' \n'+'iData= '+Object.keys(iData)); if(!upButton)upButton=formthis; //if (node.parentElement) { // node.parentElement.style.color = "red"; //} myElement.children // $i_id="formDoc"; //if(!thIs.parentElement){} spanButton=formthis.parentElement; //upButton=thIs;//.parentElement.children[0]; upCheckbox=formthis.parentElement.children[1]; //==== //alert('line 185 \n thIs= '+thIs+'\n newInputs= '+newInputs+'\n upButton= '+upButton); xid='infoIdCheckbox';upLabelMsg=document.getElementById(xid); if(!upLabelMsg){jsmethodControlCommonWaiting(upLabelMsg,'not '+xid);return(false);}; upLabelMsg.style.display='none';//x.style.color='red'; titleId=''; for(i=0;i { input = obj[key]; ///jsline=227;jsfct_dvlptAlert(jsline+' jsmethodDetectionForm(thIs)\n thIs= '+thIs //+'\n input.name= '+input.name+'\n newInputs= '+newInputs+ '\n ok'); ////if(!input)break; if(input){ input.style.color='black'; switch(newInputs){ case 'newInputs': jsmethodControlCommonSetElementContent(input,false); // jsmethodControlCommonSetElementContent(element,ok,value,color,opacity,disabled,display) // input.value='';input.style.color='black';input.style.opacity=1;input.disabled=false; // input.display='block-inline'; break; case 'pdfInputs': break; case 'setInputs': jsmethodControlCommonSetElementContent(input,false,obj3[key]); // input.value=obj3[key]; // input.style.color='black';input.style.opacity=1;input.disabled=false; break; default: z=1; if(input.type=='email'){// // fatima@gmail.com / _Sys.fatima0 z=jsmethodControlLoginValidateEmail(input.value); } if(!input.value||!z){error++;jsmethodControlCommonWaiting(key,obj2[key]);};//return(false);}; if(input.value){ jsmethodControlCommonSetElementContent(input,true); // input.style.color='red';input.style.opacity=.3;input.disabled=true; } } }//if(input){ }); return([z,error]); //jsline=188;jsfct_dvlptAlert(jsline+'\nupButton: '+arrO.upButton+'\nx.ftarget: '+arrO.ftarget+'\nupCheckbox: '+arrO.upCheckbox //+'\nftarget.yourMail: '+ftarget.name+ '\n ok'); //==== }//!\end:function jsmethodWriteCommonBase(thIs,obj,obj2,obj3,newInputs){fct="fct:jsb:jsmethodWriteCommonBase(thIs,obj,obj2,obj3,newInputs)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsmethodWriteEmailBase(thIs,newInputs){fct="fct:jsb:jsmethodWriteEmailBase(thIs,newInputs)"; if(test==true)newInputs='setInputs'; xid='infoIdCheckbox';//x=document.getElementById(xid); x=document.querySelector(xid).innerHTML; jsline=477;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,"thIs = "+thIs,"xid = "+xid,"x = "+x ,"jsStartSite.isLOCALHOST = "+jsStartSite.isLOCALHOST] ); if(!x){jsmethodControlCommonWaiting(x,'not '+xid);return(false);}; ////test=false; //newInputs=(!newInputs?true:newInputs); let arrO=jsmethodDetectionForm(thIs); ftarget=arrO.ftarget; //infoStart=arrO.fsuccess; //jsline=324;alert(jsline+' line \n '+'\n newInputs= '+newInputs+'\n arrO= '+arrO); //alert('line 252 '+'\narrO= '+arrO+'\n ftarget= '+ftarget+'\n test= '+test); ///x={'spanButton':spanButton,'upButton':upButton,'upCheckbox':upCheckbox,'upLabelMsg':upLabelMsg,'ftarget':ftarget}; obj = { yourName: ftarget.yourName, yourMail: ftarget.yourMail, namesubject: ftarget.namesubject, messageContent: ftarget.messageContent }; obj2 = { yourName: jslangSystem.Le_nom_est_vide, yourMail: jslangSystem.Le_mail_est_vide , namesubject: jslangSystem.Le_sujet_est_vide, messageContent: jslangSystem.Le_message_est_vide }; obj3 = { yourName: 'michel boussekeyt', yourMail: 'michel.boussekeyt@univ-lille.fr' , namesubject: '//!\fr devis en maçonnerie', messageContent: "//!\fr Bonjour, j'ai besoin de réparer un escalier. Merci."}; e=jsmethodWriteCommonBase(thIs,obj,obj2,obj3,newInputs); z=e[0];error=e[1];// 1 et 4 si les cases sont vides //return(new Array(z,error)); //==== //jsline=269;alert(jsline+' ok? \n z= '+z+'\n error= '+error); if(error!=0||newInputs=='newInputs'||newInputs=='setInputs'){ //jsline=325;alert(jsline+' line \n '+'\n jsDIR_iC+/_DB/ajax-email.php= '+jsDIR_iC+'/_DB/ajax-email.php' //+'\n error= '+error+'\n newInputs= '+newInputs); arrO=jsmethodDetectionForm(thIs); return(false); } // https://www.nicesnippets.com/blog/jquery-ajax-form-submit-with-formdata-example // https://thoughtbot.com/blog/ridiculously-simple-ajax-uploads-with-formdata // https://copyprogramming.com/howto/how-to-pass-the-form-data-in-ajax // https://www.delftstack.com/howto/javascript/javascript-serialize-form/ // https://www.tutsplanet.com/how-to-send-all-form-form-data-in-ajax/ /* $.ajax({ type:'POST', url:'formpost.php', data:$('#contact_form').serialize(), success:function(msg){ alert(msg); } }); */ //jsline=346;alert(jsline+' line \n '+'\n ftarget= '+ftarget); var form = (ftarget.name?document.getElementById(ftarget.name):ftarget); //var form = document.getElementById(ftarget.name); //jsline=348;alert(jsline+' line \n '+'\n ftarget.name= '+ftarget.name); var iData = new FormData(form); //jsline=350;alert(jsline+' line \n '+'\n ftarget.name= '+ftarget.name); //var iData = new FormData(); oReq.open("POST",jsDIR_iC+'/_DB/ajax-email.php',true); // iData.append("datas", iData.serialize()); //data: $('form#data-form').serialize(), ////var iData = new FormData(arrO.fsuccess); /* jsline=332;jsfct_dvlptAlert(jsline+'\nform.serialize()= '+'form.serialize()' +'\nObject.keys(form)[10].name= '+Object.keys(form)[10].name +'\nObject.values(form)[10].value= '+Object.values(form)[10].value +'\nObject.keys(iData)= '+Object.keys(iData)+'\nftarget.yourMail= '+ftarget.yourMail+ '\n ok'); */ /// iData.append("result", paramsA_in.result);// passage des résultats OUT/IN //=== // ne pas mémoriser le texte pour ne pas avoir en mémoire le même texte se qui surcharge Ajax // pour comparer 2 textes filesize est utile, peut-être comparer entête + footer + middle ??? // filemtime non peu comparer 2 dates celle du fichier et une date mémorisée ??? //=== //alert("line 350 iData: "+iData); C:\w3\renov-az\userSite\ajax-email.php // https://robertnyman.com/2013/02/11/using-formdata-to-send-forms-with-xhr-as-keyvalue-pairs/ // https://javascript.info/xmlhttprequest // https://developer.mozilla.org/en-US/docs/Learn/Forms/Sending_forms_through_JavaScript var oReq = new XMLHttpRequest(); // Push our data into our FormData object iData.append('senderHostFrom',jsStartSite.iswebmaster);//'webmaster@pooletude.com'); //najehchawel3@gmail.com //michel.boussekeyt@univ-lille.fr iData.append('senderHostToReply',jsStartSite.senderHostToReply);//,'michel.boussekeyt@univ-lille.fr'); iData.append('senderHostTo',jsStartSite.senderHostTo);//,'najehchawel3@gmail.com'); // iData.append('senderHostFrom',jsStartSite.iswebmaster);//'webmaster@pooletude.com'); // iData.append('senderHostToReply','michel.boussekeyt@univ-lille.fr'); // iData.append('senderHostTo','michel.boussekeyt@univ-lille.fr');// 'najehchawel3@gmail.com'); iData.append('idForm',arrO.fsuccess);//arrO.fsuccess); for (const [name, value] of Object.entries(form)) { // let view = new TextEncoder('utf-8').encode(value.value);// view=liste de caractères // iData.append(value.name, view); // iData.append(value.name, decodeURI(value.value).replace(/\\"/gi,"")); iData.append(value.name, value.value); } // async: true (asynchronous libère le serveur pour retourner le résultat quand // il peut) or false (synchronous bloque le serveur pour retourner le résultat) //jsline=227;jsfct_dvlptAlert(jsline+'\n pmsErr: '+jsDIR_iC+'_DB/ajax-email.php'); oReq.open("POST",jsDIR_iC+'/_DB/ajax-email.php',true);// url ok false = synchrone attendre le résultat avant de le renvoyer / true = asynchrone // oReq.open("POST",'/renov-az/userSite/ajax-email.php',true);// url ok false = synchrone attendre le résultat avant de le renvoyer / true = asynchrone /// oReq.open("POST", url, paramsA.async);// url ok false = synchrone attendre le résultat avant de le renvoyer / true = asynchrone /// oReq.open("POST", iData.url, true); // ne marche pas not ok oReq.onload = function(oEvent) { //infoStart=arrO.fsuccess; //i=jsmethodControlCommonSetElementTitleFORM(infoStart,-1);//chercher les 2 infoId i=jsmethodControlCommonSetElementTitleFORM(arrO.fsuccess,-1);//chercher les 2 infoId info0=i[0];//document.getElementById('infoId0'+arrO.fsuccess);///keyT); info1=i[1];//document.getElementById('infoId1'+arrO.fsuccess);///keyT); jsline=852;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,'arrO.fsuccess= '+arrO.fsuccess,'oReq.responseText= '+oReq.responseText,'i= '+i ]); if(info1){ // jsmethodControlCommonSetElementTitleFORM(infoStart,1); jsmethodControlCommonSetElementTitleFORM(arrO.fsuccess,1); /* $i_test='';// idButtonUp jsmethodWriteEmailBase(upButton,'setInputs','$i_id') if(¤isLOCALHOST) $i_test=<<   TEST; 'votre mail est bien arrivé !' xyzEnvoyer un autre mail xyzRemplir le mail automatiquement pour test xyzEnvoyer le mail en PDF aussi $p_jsSystem['mmail0']=$g_langFIRST[¤langT]['Le mail est vide']; $p_jsSystem['mmail1']=$g_langFIRST[¤langT]['Le mail est invalide']; $p_jsSystem['mmail2']=$g_langFIRST[¤langT]['votre mail est bien arrivé']; $p_jsSystem['mmail3']=$g_langFIRST[¤langT]['Envoyer un autre mail']; $p_jsSystem['mmail4']=$g_langFIRST[¤langT]['Remplir le mail automatiquement pour test']; Nouveau Test PDF $p_jsSystem['mmail5']=$g_langFIRST[¤langT]['Envoyer le mail en PDF aussi']; */ // info0.style.display='none'; // info1.style.display='block-inline'; n=''+ftarget.yourName.value+' ,
'; info1.innerHTML=jslangSystem.Bravo+' '+n+jslangSystem.votre_mail_est_bien_arrive+' !'; info1.innerHTML+='   '; if(jsStartSite.isLOCALHOST){ info1.innerHTML+=' '; } info1.innerHTML+=' '; jsline=433;alert(jsline+' line \n arrO.fsuccess= '+arrO.fsuccess+'\n oReq.responseText= '+oReq.responseText); // arrO=jsmethodDetectionForm(thIs); } return(new Array(iData,oReq)); }; oReq.send(iData); // ev.preventDefault(); jsline=440;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,'iData='+iDatas,'oReq='+oReq ]); return(false); }//!\end:function jsmethodWriteEmailBase(thIs,newInputs){fct="fct:jsb:jsmethodWriteEmailBase(thIs,newInputs)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function jsGoLogger(formthis){fct="fct:jsb:jsGoLogger(formthis){"; jsline=900;jsfct_dvlptAlert([l2p+jsline,h2p+fct,h2p+"fct ="+formthis ]); idSuccessIHx=formthis.idSuccessHx; jsline=903;jsfct_dvlptAlert(['!',l2p+jsline,h2p+fct,'idSuccessIHx.name='+idSuccessIHx.name ]); idSuccessHx=document.getElementById(idSuccessIHx.name); idSuccessHx.innerHTML="En cours "+idSuccessIHx.value; idSuccessHx.style.display="inline"; //

// //----- jsline=911;jsfct_dvlptAlert(['!',l2p+jsline,h2p+fct,'Object.keys(iData)='+Object.keys(iData) ,'Data.mail='+Data.mail ]); //} //----- //!\sendX //step:logger:5 send formdata+iData -> X.php -> return oData oData=sendDataOpen(formthis);//linkAjax,synchro,xdr); return(false); //----- /* if(1){ jsline=614;jsfct_dvlptAlert('line= forum.js.php+connection.php,'+jsline+'\n'+'oData= '+oData); //jsline=613;jsfct_dvlptAlert('line= forum.js.php+connection.php,'+jsline+'\n'+'oData= '+Object.keys(oData)); } //!\sendX //step:logger:11 final oData <- traitment of xdr.responseText ready if(oData.success){ idSuccessHx.style.color="green"; if(0){ jsline=618;jsfct_dvlptAlert('line= forum.js.php+connection.php,'+jsline+'\n'+'linkAjax fonctionne ? = '+oData.success +'\n'+'oData._form_= '+oData._form_ +'\n'+'oData.mail= '+oData.mail +'\n'+'oData.pass= '+oData.pass +'\n'+'oData.dataSerialize= '+oData.dataSerialize +'\n'+'oData.okX= '+oData.okX +'\n'+'oData.login= '+oData.login +'\n'+'oData.Connected= '+oData.Connected +'\n'+'oData.userSite= '+oData.userSite +'\n'+'oData.fluxX= '+oData.fluxX ); } if(oData.login.connecting)return(true); //!\sendX //step:logger:12 traitment of dataBase ?? return(true); } idSuccessHx.style.color="red"; return(false); */ }//!\end:function jsGoLogger(formthis){fct="fct:jsb:jsGoLogger(formthis){"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ //var formdata,iData,oData,xdr,synchro,linkAjax;//,synchro; function jsmethodControlLogin(formthis,linkX){fct="fct:jsb:jsmethodControlLogin(formthis,linkX)"; //step:logger:0 form button to save linkAjax=linkX;xdr=getXDomainRequest();synchro=false; jsline=956;jsfct_dvlptAlert(['!',l2p+jsline,h2p+fct,'Object.keys(iData)='+Object.keys(iData) ,'Data.mail='+Data.mail ]); ///jsline='499 firstForm.js.php / jsmethodControlLogin(thIs)';// C:\ic\_scripts\js\firstForm.js.php ///xid='infoIdCheckbox';//x=document.getElementById(xid); idTopInfo='idSuccessHx'; //----- //step:logger:1 search the iDatas jsmethodDetectionForm(formthis);//step:logger:2 search the iDatas here formdata+iData //!\security //step:logger:3 tobor+buttonCheckbox+mail+pass+ if(iData.tobor){jsmethodControlCommonWaiting(idTopInfo,'//!\fr Un robot tente d\'envoyer une donnée interdite !');return(false);}; //----- if(iData.buttonCheckbox!="on"){ jsmethodControlCommonWaiting(idTopInfo,jslangSystem.Cochez_pour_enregistrer_depuis_ce_bouton);return(false); } //----- if(!jsmethodTestElementFORM(idTopInfo,jslangSystem.Le_mail_est_invalide,iData.mail,'not mail','mail'))return(false); //----- if(!jsmethodTestElementFORM(idTopInfo,jslangSystem.Le_password_est_invalide,iData.pass,'not pass','pass'))return(false); //----- //!\sendX //step:logger:4 send formdata+iData -> X.php -> return oData oData=jsGoLogger(formthis); //----- formthisFieldset=formthis.getElementsByTagName('fieldset')[0]; formthisFieldset.setAttribute('disabled','disabled');// https://linkedlist.ch/disabling_an_entire_form_in_html_37/ jsmethodControlCommonWaiting(idTopInfo,'//!\fr La connection est valide',"green"); return false; }//!\end:function jsmethodControlLogin(formthis,linkX){fct="fct:jsb:jsmethodControlLogin(formthis,linkX)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function idformALink(param,value){fct="ifct:jsb:dformALink(param,value)";// lang,en_gb //jsline='159 idformALink(param,value)'; //if(!param)param=''; jsline=989;jsfct_dvlptAlert(['!',l2p+jsline,h2p+fct,'param = '+param,'value = '+value ,'jsidAddress = '+jsidAddress,'jsStartSite.isLOCALHOST = '+jsStartSite.isLOCALHOST ]); $('#idimgStandbyLang').css('display','inline');//idimgStandbyLang //idimgStandbyLang //if(param=='lang'){ // document.getElementById('idimgStandbyLang').style.display='inline'; //} //==== var idparamA=document.getElementById('idparamA'); idparamA.value=value;// ex:lang //$('#idparamA').css('display','inline');//idimgStandbyLang //==== var idformA=document.getElementById('idformA'); idformA.value='idformA'+'='+param;// ex: idformA=lang //==== var idclickA=document.getElementById('idclickA'); idclickA.value='idclickA'+'='+true;// ex: click internaute //==== jsline=1010;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,'idclickA.value = '+idclickA.value,'value = '+value ,'idformA.value = '+idformA.value,'jsStartSite.isLOCALHOST = '+jsStartSite.isLOCALHOST ]); idformA.click(); }//!\end:function idformALink(param,value){fct="ifct:jsb:dformALink(param,value)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ function idformASaveDvlptLocal(that,param,value,file){fct="fct:jsb:idformALink(param,value)"; // messageContent marche :: https://here.tf/_systemboost/ https://here.tf/_systemboost/ http://here.tf/_systemboost/ http://www.here.tf/_systemboost/ jsline=1018;jsfct_dvlptAlert(['',l2p+jsline,h2p+fct,'value = '+value ,'jsidAddress = '+jsidAddress,'jsStartSite.isLOCALHOST = '+jsStartSite.isLOCALHOST ]); if(value.value)value=value.value; if(value.innerHTML)value=value.innerHTML; // https://www.scaler.com/topics/window-object-in-javascript/ jsline=874;jsfct_dvlptAlert(['',l2p,h2p,'value = '+value ,'param = '+param,'that.id = '+that.id ]); $('#idimgStandbyLang').css('display','inline');//idimgStandbyLang //idimgStandbyLang //if(param=='lang'){ // document.getElementById('idimgStandbyLang').style.display='inline'; //} //==== var idparamA=document.getElementById('idparamA'); if(idparamA)idparamA.value=(value?value:"");//that.messageContent.innerHTML;// ex:lang //$('#idparamA').css('display','inline');//idimgStandbyLang //==== var idfileA=document.getElementById('idfileA'); if(idfileA)idfileA.value=(file?file:"");// ex: idfileA=file //==== var idformA=document.getElementById('idformA'); if(idformA)idformA.value=(param?'idformA'+'='+param+(idfileA.value?"="+idfileA.value:""):"");// ex: idformA=un=deux=file //==== var idclickA=document.getElementById('idclickA'); if(idclickA)idclickA.value='idclickA'+'='+true;// ex: click internaute //==== idformA.click(); }//!\end:function idformASaveDvlptLocal(that,param,value,file){fct="fct:jsb:idformALink(param,value)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ //function sendDataOpen(iData,linkAjax,synchro,xdr) { function sendDataOpen(formthis){fct="fct:jsb:aX:sendDataOpen(formthis)";fctAction="send datas to aX"; xdr=getXDomainRequest(); arr0=jsc_getformDataObj(formthis); formdata=arr0[0];iData=arr0[1];// iDataSerialize xdr.onload=function(){sendDataOpenResults(formthis);} //----- xdr.open("POST",linkAjax,synchro);// synchro=false permet d'ATTENDRE que results vers return(results); xdr.send(formdata); }//!\end:function sendDataOpen(formthis){fct="fct:jsb:aX:sendDataOpen(formthis)"; //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ///try{jsDIR_iC+'_DB/ajax-email.php' //}catch(e){fct="try/catch:jsb:error";jsline=917;jsfct_dvlptAlert(['',l2p,h2p,ce2p+e]);} }catch(e){fct="try/catch:jsb:error";jsline=917;alert(['',l2p,h2p,ce2p+e]);} //3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ /* jsline=65;jsfct_dvlptAlert([l2p+jsline,h2p+"nbrVignettes orientation"]); const obj={ name: 'yourName', value: f.yourName }; // Prints "name Jean-Luc Picard" followed by "rank Captain" Object.entries(obj).forEach(entry => { const [key, value] = entry; if(!value){jsmethodControlCommonWaiting(y,'not '+key);return(false);}; // console.log(key, value); }); */ /* obj = { yourName: jslangSystem.Le_nom_est_vide, yourMail: jslangSystem.Le_mail_est_vide , namesubject: jslangSystem.Le_sujet_est_vide, messageContent: jslangSystem.Le_message_est_vide }; Object.keys(obj).forEach(key => { const value = obj[key];
Vous pouvez ici contacter à une personne par mail.
m=document.getElementById('infoId'+key);if(m)m.style.display='none'; if(!m){jsmethodControlCommonWaiting(m,value);return(false);}; }); */ ///if(!f.yourName){jsmethodControlCommonWaiting(y,'not yourName');return(false);}; //if(!f.yourMail){jsmethodControlCommonWaiting(y,'not yourMail');return(false);}; //if(!f.namesubject){jsmethodControlCommonWaiting(y,'not namesubject');return(false);}; //if(!f.messageContent){jsmethodControlCommonWaiting(y,'not messageContent');return(false);}; /* jsline='207 jsmethodWriteEmailBase(thIs)'; //==== //yourName , yourMail, namesubject, messageContent $i_yourMessage='messageContent'; yourName=f.yourName.value;yourMail=f.yourMail.value; namesubject=f.namesubject.value;messageContent=f.messageContent.value; m=document.getElementById('infoId'+'yourName');if(m)m.style.display='none'; if(!yourName){jsmethodControlCommonWaiting(m,jslangSystem.Le_nom_est_vide);return(false);}; //==== m=document.getElementById('infoId'+'yourMail');if(m)m.style.display='none'; if(!yourMail){jsmethodControlCommonWaiting(m,jslangSystem.Le_mail_est_vide);return(false);}; //==== m=document.getElementById('infoId'+'namesubject');if(m)m.style.display='none'; if(!namesubject){jsmethodControlCommonWaiting(m,jslangSystem.Le_sujet_est_vide);return(false);}; //==== m=document.getElementById('infoId'+'messageContent');if(m)m.style.display='none'; if(!messageContent){jsmethodControlCommonWaiting(m,jslangSystem.Le_message_est_vide);return(false);}; */ /* if(0){ jsline='182 jsmethodWriteEmailBase(thIs)'; xid='infoIdCheckbox';x=document.getElementById(xid); if(!x){jsmethodControlCommonWaiting(x,'not '+xid);return(false);}; x.style.display='none';//x.style.color='red'; if(!thIs.form){jsmethodControlCommonWaiting(x,'not form-this');return(false);}; f=thIs.form; //==== //yourName , yourMail, namesubject, messageContent jsline='192 jsmethodWriteEmailBase(thIs)'; alert(jsline+'\n'+xid+'\n'+f.name); //-->