// JavaScript Document // C:\myproducts_sites\ow\scripts\presidential.js.php myDebug.line=1;try{ var script_presidential='js:presidential',presidential_stop=0; 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}; /* if(!myApp){ var myApp={}; alert('presidential-d.js, line 4, coco myApp?'); } */ function goajaxhtmlcontentforapplication(demand,value,pass_sctappli){ myDebug.line=34;try{ tagfct = ={kjsfile:script_presidential,kjsline:myDebug.line,kjsfct:'goajaxhtmlcontentforapplication(demand,value,pass_sctappli)',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 ////sctappli="";// file=presidential.js.php urlphp = sctappli+file; /// urlhtml = ''; ////div=$(divname);///$Prot(divname); div=divname;///$Prot(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>'; 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); //=== 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=82; myDebug.debug_view_e_catch(myDebug.line,tagfct = ); ///alert('lj:217 div='+div+myDebug.chrrc+'params='+JSON.stringify(params)); ///alert("ljs:89 divname: "+div+myDebug.chrrc+"$Prot(div): "+$Prot(div)+myDebug.chrrc+"urlphp: "+urlphp+myDebug.chrrc+"value: "+value+myDebug.chrrc+"datasform: "+JSON.stringify(datasform)); alert("ljs:89 divname: "+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}); } */ var renderParms = "userLogon=xxx&reportID=23"; var divstyledefault=js_get_image_of_loader(); document.getElementById("masterdiv").style.background=divstyledefault["bg"]; document.getElementById(divname).style.background=divstyledefault["bg"]; document.getElementById(divname).innerHTML=divstyledefault["img"]; $.post(urlphp, { ///// datasform+='demand='+demand+'&value='+value+'&ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn; "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("Data: " + data + "\nStatus: " + status+ "\ndivname: " + divname); document.getElementById(divname).style.color="black"; document.getElementById(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= $Prot(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=$Prot('evalpersonality');if(o)o.innerHTML=updateaverage; /// location.href = location.href; $_POST['updateaverage'] skip=true; // 'collsarray' // $Prot('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}; /* 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}; //// var x=name.substring(0,3); //// var slist2='list2'+x;var slist3='list3'+x; alert('790 ici '+select); var objchoice=document.getElementById('choice'+selectname); if(objchoice)objchoice.innerHTML=''; var x=document.getElementById('list1cat');var i=x.selectedIndex; objchoice.innerHTML+=x.options[i].value+'::'; //====== x=document.getElementById(slist2);i=x.selectedIndex; objchoice.innerHTML+=x.options[i].value+'::'; //====== x=document.getElementById(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}; alert('lj:254 E:\myproducts_sites\labo\tabber\ow\scripts\presidential.js.php /getSelect slist='+slist); /// var itemcontent=document.getElementById('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=document.getElementById('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]+''; } //// document.getElementById('slist2').innerHTML=txtsl2+' '; document.getElementById(select2).innerHTML=txtsl2+' '; } } else if(slist == select2) { // empty the tag for 2nd select list document.getElementById(select2).innerHTML=''; } }catch(e){if(myDebug)myDebug.debug_view_e_catch(e,tagfct = );} } var o=document.getElementById(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 = );}