// JavaScript Document // C:\myproducts_sites\ow\scripts\presidential.js.php myDebug.line=1;try{ var script_presidential='js:presidential',presidential_stop=0; ///alert("ljs:5 - "+script_presidential); jsscriptslist=jsscriptslist.concat(new Array(script_presidential)); myDebug.checkjsload(script_presidential); //tagfct = {kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'load: '+script_presidential,kjsstop:presidential_stop}; tagfct.kjsfct='load: '+script_presidential; tagfct.kjsfile=script_presidential;tagfct.kjsline=myDebug.line;tagfct.kjsstop=presidential_stop; ///}catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct);} /* if(!myApp){ var myApp={}; alert('presidential-d.js, line 4, coco myApp?'); } */ function goajaxhtmlcontentforapplication(demand,value,pass_sctappli){ myDebug.line=34;try{ ///isNavigator ///isApplication allAll=Object.assign(isNavigator,isApplication); alert("allAll.appW3: "+allAll.appW3); ////tagfct = {kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'goajaxhtmlcontentforapplication(demand,value,pass_sctappli)',kjsstop:presidential_stop}; tagfct.kjsfct='goajaxhtmlcontentforapplication(demand,value,pass_sctappli)'; tagfct.kjsfile=script_presidential;tagfct.kjsline=myDebug.line;tagfct.kjsstop=presidential_stop; //////alert("ljs:36 presidential.js.php???? "+myDebug.chrrc+"demand: "+demand+myDebug.chrrc+"value: "+value+myDebug.chrrc+"pass_sctappli: "+pass_sctappli); var urlphp=div=datasform=urlhtml='',isform=false; var file='updatepageapplication.php'; var divname='tdpopup0'; ///alert("ljs:41 "+myDebug.chrrc+"pass_sctappli: "+pass_sctappli); if(pass_sctappli&&pass_sctappli[1]){ isform=true; /// sctappli='../../../'+pass_sctappli[0]; sctappli='/myproducts_sites/'+pass_sctappli[0]; divname=pass_sctappli[1]; ////E:\myproducts_sites\labo\tabber\ow\french_presidential_election_2017\saveaverageapplication.php if(demand=='saveaverage'){ file='saveaverageapplication.php';isform=false;datasform+='demand='+demand+'&value='+value+'&'; } else file='savedatapageapplication.php'; var pass=pass_sctappli; alert(demand+myDebug.chrrc+file+myDebug.chrrc+value); } //=== /// urlphp = sctappli+file; // C:\myproducts_sites\ow\scripts ///sctappli="/myproducts_sites/ow/scripts/";// file=presidential.js.php ///C:\res\scripts\plugins\presidential\updatepageapplication.php sctappli="/res/scripts/plugins/presidential/gridFaces/";// file=presidential.js.php ////sctappli="";// file=presidential.js.php urlphp = sctappli+file; /// urlhtml = ''; ////div=$(divname);///myDebug.GetId(divname); div=divname;///myDebug.GetId(divname); div=myDebug.GetId(divname); myDebug.line=63; /// tagfct.kjsparams={'isform':isform,'urlphp':urlphp,'div':div,'divname':divname}; ///tagfct = "".assign(tagfct,tagfct.kjsparams); ////Object.assign(tagfct,tagfct.kjsparams); ///myDebug.line=34;myDebug.debug_view_e_catch('',tagfct); //=== // alert("ljs:52 "+myDebug.chrrc+"!isform: "+!isform+myDebug.chrrc+"sctappli: "+sctappli+myDebug.chrrc+"file: "+file+myDebug.chrrc+"div: "+div); if(!isform){ /// if(div)div.innerHTML = '';///'

Loading... '+'[' + 'bootajax' + ']<\/p>'; if(div){ /// div.setAttribute("align","center"); div.style.textAlign="center";///setAttribute("align","center"); div.innerHTML = '';///'

Loading... '+'[' + 'bootajax' + ']<\/p>'; } datasform+='demand='+demand+'&value='+value+'&ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn; /// datasform='ps='+ps; /// sctappli="/myproducts_sites/ow/scripts/"; //// urlphp = sctappli+file; } else datasform=Form.serialize('form'+value); // alert("ljs:61 "+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"datasform: "+datasform); //=== //alert("ljs:74 "+myDebug.chrrc+"pass_sctappli: "+pass_sctappli+myDebug.chrrc+"urlphp: "+urlphp); tagfct.kjsparams={'isform':isform,'urlphp':urlphp,'div':div,'divname':divname,'value':value,'demand':demand}; params=datasform; // https://www.tutorialspoint.com/prototype/prototype_ajax_request.htm { success: 'xhr', failure: 'notice' }, // var toAjax = new Ajax.Updater(div, urlphp, myDebug.line=78; ///alert('lj:217 div='+div+myDebug.chrrc+'params='+JSON.stringify(params)); ///alert("ljs:89 divname: "+div+myDebug.chrrc+"myDebug.GetId(div): "+myDebug.GetId(div)+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"value: "+value+myDebug.chrrc+"datasform: "+JSON.stringify(datasform)); /* var myAjax=new Ajax.Updater(div,urlphp,{ postBody: $H({'datasform':datasform}).toQueryString(), evalScripts: true, https://www.tutorialspoint.com/prototype/prototype_ajax_updater.htm#:~:text=This%20AJAX%20Ajax.,is%20a%20specialization%20of%20Ajax. https://stackoverflow.com/questions/15565203/what-is-the-equivalent-of-ajax-updater-in-jquery https://mahtonu.wordpress.com/2010/05/06/updating-your-page-dynamically-with-ajax-updater-prototype-api/ https://openclassrooms.com/forum/sujet/ajax-prototype-ajax-updater-gt-jascript-non-evalue-14078 https://itecnote.com/tecnote/javascript-ajax-updater-problem/ https://cscie12.dce.harvard.edu/lecture_notes/2006-07/20070320/slide46.html https://www.petefreitag.com/item/515.cfm if($F('username').length == 5) { var url = 'chkusername.php'; var params = 'username=' + $F('username'); var ajax = new Ajax.Updater( {success: 'availability'}, url, {method: 'get', parameters: params, onFailure: reportError}); } */ alert("ljs:82 divname: "+div+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"value: "+value+myDebug.chrrc+"datasform: "+JSON.stringify(datasform)); /* var renderParms = "userLogon=xxx&reportID=23"; var divstyledefault=js_get_image_of_loader(); myDebug.GetId("masterdiv").style.background=divstyledefault["bg"]; myDebug.GetId(divname).style.background=divstyledefault["bg"]; myDebug.GetId(divname).innerHTML=divstyledefault["img"]; */ /* var pluginW3AppDirname="'.$ p_pluginApp["appdirname"].'"; var pluginW3appname="'.$ p_pluginApp["w3appname"].'"; var pluginW3apptag="'.$ p_pluginApp["w3apptag"].'"; */ filehere="index.php"; /* "pluginW3Index0": pluginW3Index0, "pluginW3AppDirname": pluginW3AppDirname, "pluginW3appname": pluginW3appname, "pluginW3apptag": pluginW3apptag, */ var data= { ///// datasform+='demand='+demand+'&value='+value+'&ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn; "pluginFunction": pluginFunction, "demand": demand, "value": value, "ps": ps, "sctappli": sctappli, "jslang": jslang, "refdat": refdat, "dirr": dirr, "filehere": filehere, "conn": conn }; myDebug.line=141; myDebug.debug_view_e_catch("w3apptag",tagfct,1); ///myDebug.GetId("tablemasterdiv").innerHTML = ''; var xhr = new XMLHttpRequest(); var urlEncodedData = ""; var urlEncodedDataPairs = []; var name,success=false; // Transformez l'objet data en un tableau de paires clé/valeur codées URL. for(name in data) { urlEncodedDataPairs.push(encodeURIComponent(name) + '=' + encodeURIComponent(data[name])); } // Combinez les paires en une seule chaîne de caractères et remplacez tous // les espaces codés en % par le caractère'+' ; cela correspond au comportement // des soumissions de formulaires de navigateur. urlEncodedData = urlEncodedDataPairs.join('&').replace(/%20/g, '+'); // Définissez ce qui se passe en cas de succès de soumission de données xhr.addEventListener('load', function(event) { success=true; myDebug.GetId(divname).innerHTML=xhr.responseText;////"Data: " + data + "\nStatus: " + status; /// alert('Ouais ! Données envoyées et réponse chargée. -> '+xhr.responseText); //================ /// div= myDebug.GetId(divname); var tag,skip=false,response=xhr.responseText,jsonResponse=JSON.parse(response); /// alert(demand+' -\n '+divname+' -\n '+success+' -\n '+response); /// if(!skip&&success&&demand=='fsend'){ /// ///alert(demand+' \n '+jsonResponse['return']); //c jsonResponse['return']='ok' /// alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok' /// } if(!skip&&success&&(demand=='ftest'||demand=='fsend')){ var total=0; for(var j=0;j /// o=myDebug.GetId('evalpersonality');if(o)o.innerHTML=updateaverage; /// location.href = location.href; $_POST['updateaverage'] skip=true; // 'collsarray' // myDebug.GetId('resultpolitic').innerHTML=jsonResponse['politic']['average']; /// alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok' } myDebug.line=150; if(!skip&&success&&demand=='saveaverage'){ alert(demand+' '+myDebug.chrrc+' '+'1 '+myDebug.chrrc+' pass '+myDebug.chrrc+' '+pass); location.href = location.href; skip=true; } //==================== }); // Définissez ce qui arrive en cas d'erreur xhr.addEventListener('error', function(event) { alert('Oups! Quelque chose s\'est mal passé.'); }); // Définissez ce qui arrive en cas d'erreur // https://www.tabnine.com/code/javascript/functions/builtins/XMLHttpRequest/addEventListener xhr.addEventListener('progress', function(event) { ///alert('Oups! terminé.'); ///myDebug.GetId("id_ajax_loader_gif").style.display="none";////"Data: " + data + "\nStatus: " + status; }); // Configurez la requête /// XHR.open('POST', 'https://example.com/cors.php'); /// C:\atelier\upload-file\upload.php xhr.open('POST', urlphp); //'/atelier/upload-file/upload.php'); // Ajoutez l'en-tête HTTP requise pour requêtes POST de données de formulaire xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // Finalement, envoyez les données. xhr.send(urlEncodedData); /* myDebug.GetId("id_ajax_loader_gif").style.display="none"; onload="onMyFrameLoad(this)" */ ///return(false); /* $.post(urlphp, { ///// datasform+='demand='+demand+'&value='+value+'&ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn; "pluginFunction": pluginFunction, / * "pluginW3Index0": pluginW3Index0, "pluginW3AppDirname": pluginW3AppDirname, "pluginW3appname": pluginW3appname, "pluginW3apptag": pluginW3apptag, * / "demand": demand, "value": value, "ps": ps, "sctappli": sctappli, "jslang": jslang, "refdat": refdat, "dirr": dirr, "filehere": filehere, "conn": conn }, // JSON.stringify(datasform) function(data, status){ alert("ljs:146 Data: " + data + "\nStatus: " + status+ "\ndivname: " + divname); myDebug.GetId(divname).style.color="black"; myDebug.GetId(divname).innerHTML="Data: " + data + "\nStatus: " + status; }); */ /* new Ajax.Updater(div, urlphp, {asynchronous:true, method: 'post', evalScripts: true, parameters: renderParms, onSuccess:function(request) { $(div).style.color="black"; alert("in-out: \n"+xhr.responseText); ///Element.hide($('spinner')); }, onException: function(request) { ///Element.hide($('spinner')); }}); */ /* var myAjax = new Ajax.Updater( /// {success: 'availability'}, div, urlphp, { postBody: $H({///'urlhtml': urlhtml, demand: demand, value: value, /// 'datasform':JSON.stringify(datasform) /// 'datasform':JSON.stringify(tagfct.kjsparams) parameters:datasform }).toQueryString(), //// {method: 'post', parameters: JSON.stringify(datasform), onFailure: reportError , evalScripts: true, /// onSuccess: successFunc, /// onFailure: failureFunc, onComplete : function(xhr){ var success=(xhr.status==200); myDebug.line=95; alert("ljs:70 success: "+success+myDebug.chrrc+"xhr.responseText: "+xhr.responseText +myDebug.chrrc+"xhr.responseText.parse: "+JSON.parse(xhr.responseText)+myDebug.chrrc); ///alert("ljs:70 "+myDebug.chrrc+"sctappli: "+sctappli+myDebug.chrrc+"file: "+file+myDebug.chrrc+"isform: "+isform+myDebug.chrrc+"success: "+success+myDebug.chrrc+"xhr.responseText: "+xhr.responseText); /// div= myDebug.GetId(divname); var tag,skip=false,response=xhr.responseText,jsonResponse=JSON.parse(response); /// alert(demand+' -\n '+divname+' -\n '+success+' -\n '+response); /// if(!skip&&success&&demand=='fsend'){ /// ///alert(demand+' \n '+jsonResponse['return']); //c jsonResponse['return']='ok' /// alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok' /// } if(!skip&&success&&(demand=='ftest'||demand=='fsend')){ var total=0; for(var j=0;j /// o=myDebug.GetId('evalpersonality');if(o)o.innerHTML=updateaverage; /// location.href = location.href; $_POST['updateaverage'] skip=true; // 'collsarray' // myDebug.GetId('resultpolitic').innerHTML=jsonResponse['politic']['average']; /// alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok' } myDebug.line=150; if(!skip&&success&&demand=='saveaverage'){ alert(demand+' '+myDebug.chrrc+' '+'1 '+myDebug.chrrc+' pass '+myDebug.chrrc+' '+pass); location.href = location.href; skip=true; } /// if(!skip&&success&&demand=='ulang'&&response[0]=='ret:'+demand){ /// location.href = location.href; //c reload sans demande de renvoie de données /// } } } ); */ /* function successFunc(response) { if (200 == response.status) { alert("Call is success"); } var container = $('notice'); var content = response.responseText; container.update(content); } function failureFunc(response) { alert("Call is failed" ); } */ /// var theObject = "[object Object]" ;///{name:{firstName:"Mark", lastName:"Bob"}}; /// alert(JSON.stringify(myAjax)); /// alert("ljs:134 "+myDebug.chrrc+"sctappli+file: "+sctappli+file+myDebug.chrrc+"isform: "+isform+myDebug.chrrc+"myAjax: "+myAjax); }catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct);} }//c function goajaxhtmlcontentforapplication(demand,value) function initialize_multiple_select(selectname,select1,select2,titlelist2,options_list2,options_list3,announcestyle){ myDebug.line=242;try{ ////tagfct = {kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'initialize_multiple_select(selectname,select1,select2,titlelist2,options_list2,options_list3,announcestyle)',kjsstop:presidential_stop}; tagfct.kjsfct='initialize_multiple_select(selectname,select1,select2,titlelist2,options_list2,options_list3,announcestyle)'; tagfct.kjsfile=script_presidential;tagfct.kjsline=myDebug.line;tagfct.kjsstop=presidential_stop; /* Script Double Select Dropdown List, from: coursesweb.net/javascript/ */ ///var dbl_list=new Object(); // JS object that stores data for options function set_choices_multiple_select(selectname,select){ myDebug.line=248;try{ ///tagfct = {kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'set_choices_multiple_select(selectname,select)',kjsstop:presidential_stop}; tagfct.kjsfct='set_choices_multiple_select(selectname,select)'; tagfct.kjsfile=script_presidential;tagfct.kjsline=myDebug.line;tagfct.kjsstop=presidential_stop; //// var x=name.substring(0,3); //// var slist2='list2'+x;var slist3='list3'+x; alert('790 ici '+select); var objchoice=myDebug.GetId('choice'+selectname); if(objchoice)objchoice.innerHTML=''; var x=myDebug.GetId('list1cat');var i=x.selectedIndex; objchoice.innerHTML+=x.options[i].value+'::'; //====== x=myDebug.GetId(slist2);i=x.selectedIndex; objchoice.innerHTML+=x.options[i].value+'::'; //====== x=myDebug.GetId(slist3);i=x.selectedIndex; objchoice.innerHTML+=x.options[i].value+'::'; //====== }catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct);} } //if(myApp.dbl_list[selectname])return(true); myApp.dbl_list[selectname]={};///new Object(); // HERE replace the value with the text you want to be displayed near Select var txtsl2=titlelist2; alert('193 ici selectname='+selectname); /* Property with options for the Seccond select list The key in this object must be the same with the values of the options added in the first select The values in the array associated to each key represent options of the seccond select */ ////myApp.dbl_list['$i_selectname'].$i_select2 slist2={ ///alert(options_list2); //administration:impots-CAF,suppliers:employeur-health-bank,customers:announces,others:amis-family-loisirs-cadeaux ///options_list2 myApp.dbl_list[selectname][select2]={ "administration": ['impots', 'CAF'], "suppliers": ['employeur', 'health', 'bank'], "customers": ['announces'], "others": ['amis', 'family', 'loisirs', 'cadeaux'] }; /* Property with text-content associated with the options of the 2nd select list The key in this object must be the same with the values (options) added in each Array in "slist2" above The values of each key represent the content displayed after the user selects an option in 2nd dropdown list */ ////alert(options_list3); ///impots:www.marplo.net/ajax/,CAF:www.marplo.net/jocuri/,employeur:coursesweb.net/php-mysql/,health:coursesweb.net/javascript/,bank:coursesweb.net/flash/,announces:coursesweb.net/php-mysql/,amis:coursesweb.net/php-mysql/,family:coursesweb.net/javascript/,loisirs:coursesweb.net/flash/ ///options_list3 myApp.dbl_list[selectname].scontent={ "impots": 'www.marplo.net/ajax/', "CAF": 'www.marplo.net/jocuri/', "employeur": 'www.marplo.net/anime/', "health": 'coursesweb.net/php-mysql/', "bank": 'coursesweb.net/javascript/', "announces": 'coursesweb.net/flash/', "amis": 'coursesweb.net/flash/', "family": 'coursesweb.net/flash/', "loisirs": 'coursesweb.net/flash/', "cadeaux": 'coursesweb.net/flash/' }; /* From here no need to modify */ // function to get the dropdown list, or content myApp.dbl_list[selectname].getSelect=function(slist,option){ myDebug.line=317;try{ ///tagfct = {kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'myApp.dbl_list[selectname].getSelect=function(slist,option)',kjsstop:presidential_stop}; tagfct.kjsfct='myApp.dbl_list[selectname].getSelect=function(slist,option)'; tagfct.kjsfile=script_presidential;tagfct.kjsline=myDebug.line;tagfct.kjsstop=presidential_stop; alert('lj:254 E:\myproducts_sites\labo\tabber\ow\scripts\presidential.js.php /getSelect slist='+slist); /// var itemcontent=myDebug.GetId('itemcontent'); ////if(itemcontent) //// itemcontent.innerHTML=''; // empty option-content if(myApp.dbl_list[selectname][slist][option]) { // if option from the last Select, add text-content, else, set dropdown list if(slist == 'scontent') { ///myDebug._alert(new Array('script)',776,'lefttabmenu0-c.php')); alert(myApp.dbl_list[selectname][slist][option]); var itemcontent=myDebug.GetId('itemcontent'); if(!itemcontent)return(false); itemcontent.innerHTML=myApp.dbl_list[selectname][slist][option]; } else if(slist == select2) { var addata='';//''; for(var i=0; i'+myApp.dbl_list[selectname][slist][option][i]+''; } //// myDebug.GetId('slist2').innerHTML=txtsl2+' '; myDebug.GetId(select2).innerHTML=txtsl2+' '; } } else if(slist == select2) { // empty the tag for 2nd select list myDebug.GetId(select2).innerHTML=''; } }catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct);} } var o=myDebug.GetId(select1); if(o){ o.selectedIndex=1; myApp.dbl_list[selectname].getSelect(select2,o.value); } }catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct);} } }catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct);}