📄 reservationformular.js
字号:
/** * Objet javascript permettant de gérer les données d'affichage * du "bloc" réservation. */var ReservationFormular = { bookingEngineViewBean: null, profileViewBean: null, countriesViewBean: null, interHotelsViewBean: null, actionErrorViewBean: null, currenciesViewBean: null, /** * Liste des noms d'objets à utiliser. */ getBeans: function() { return "BookingEngineViewBean;ProfileViewBean;CountriesViewBean;InterHotelsViewBean;ActionErrorViewBean;CurrenciesViewBean"; }, /** * Initialisation de la variable JSON */ initJSON: function() { var num; try { for( num in beans) { if("BookingEngineViewBean" == beans[num].nom) { bookingEngineViewBean = beans[num].bean; } else if("ProfileViewBean" == beans[num].nom) { profileViewBean = beans[num].bean; } else if("CountriesViewBean" == beans[num].nom) { countriesViewBean = beans[num].bean; } else if("InterHotelsViewBean" == beans[num].nom) { interHotelsViewBean = beans[num].bean; } else if("CurrenciesViewBean" == beans[num].nom) { currenciesViewBean = beans[num].bean; } else if("ActionErrorViewBean" == beans[num].nom) { actionErrorViewBean = beans[num].bean; } } } catch(e) { alert(e); } }, getProfileViewBean: function() { return profileViewBean; }, getCountriesViewBean: function() { return countriesViewBean; }, getActionErrorViewBean: function() { return actionErrorViewBean; }, /** * Ecrivez votre code sur l'initialisation des affichage de la page * ici. * Cette méthode est appelée sur le onload de la page. */ rewrite: function() { if(actionErrorViewBean) this.rewriteActionErrorMessage(); else this.rewriteFormular(); }, rewriteActionErrorMessage: function() { if("login"==actionErrorViewBean.actionName && actionErrorViewBean.errorMessage && $("loginErrorMessage")){ $("loginErrorMessage").innerHTML=actionErrorViewBean.errorMessage; $("loginErrorMessage").style.display="block"; } else { $("loginErrorMessage").innerHTML=""; $("loginErrorMessage").style.display="none"; } }, rewriteFormular: function() { this.rewriteAdditionnalInformations(); this.rewriteCountriesStates(); this.rewriteIdentification(); if($("i_vcd_pays")) Event.observe("i_vcd_pays", "change", function(event){ ReservationFormular.rewriteStates("i_vcd_pays","i_vcd_etat","div_vcd_etat");}); if($("i_vcd_pays1")) Event.observe("i_vcd_pays1", "change", function(event){ ReservationFormular.rewriteStates("i_vcd_pays1","i_vcd_etat1","div_vcd_etat1");}); this.rewriteFormTabindex(); }, rewriteCountriesStates: function() { if($("i_vcd_pays")){ fillSelect("i_vcd_pays", countriesViewBean.countries, null, "-"); if($("i_vcd_etat")){ this.rewriteStates("i_vcd_pays","i_vcd_etat","div_vcd_etat"); Event.observe("i_vcd_pays", "change", function(event){ ReservationFormular.rewriteStates("i_vcd_pays","i_vcd_etat","div_vcd_etat");}); } if(!interHotelsViewBean && ($("i_vcd_telephone") || $("i_telmobile"))){ Event.observe("i_vcd_pays", "change", function(event){ ReservationFormular.rewritePhonePrefix();}); } } if($("i_vcd_pays1")){ fillSelect("i_vcd_pays1", countriesViewBean.countries, null, "-"); if($("i_vcd_etat1")){ this.rewriteStates("i_vcd_pays1","i_vcd_etat1","div_vcd_etat1"); Event.observe("i_vcd_pays1", "change", function(event){ ReservationFormular.rewriteStates("i_vcd_pays1","i_vcd_etat1","div_vcd_etat1");}); } } if($("i_vcd_pays2")){ fillSelect("i_vcd_pays2", countriesViewBean.countries, null, "-"); if($("i_vcd_etat2")){ this.rewriteStates("i_vcd_pays2","i_vcd_etat2","div_vcd_etat2"); Event.observe("i_vcd_pays2", "change", function(event){ ReservationFormular.rewriteStates("i_vcd_pays2","i_vcd_etat2","div_vcd_etat2");}); } } if($("i_vcd_pays3")){ fillSelect("i_vcd_pays3", countriesViewBean.countries, null, "-"); if($("i_vcd_etat3")){ this.rewriteStates("i_vcd_pays3","i_vcd_etat3","div_vcd_etat3"); Event.observe("i_vcd_pays3", "change", function(event){ ReservationFormular.rewriteStates("i_vcd_pays3","i_vcd_etat3","div_vcd_etat3");}); } } }, rewriteStates: function(countryId, stateId, stateBlockId) { if(countriesViewBean.countriesStates[$(countryId).value]){ fillSelect(stateId, countriesViewBean.countriesStates[$(countryId).value], null, "-"); $(stateBlockId).style.display="block"; } else { $(stateBlockId).style.display="none"; $(stateId).selectedIndex=0; } }, rewritePhonePrefix: function() { if($("i_vcd_pays") && countriesViewBean.countriesPhonePrefixes){ if($("i_vcd_telephone")){ if(countriesViewBean.countriesPhonePrefixes[$("i_vcd_pays").value]) $("i_vcd_telephone").value=countriesViewBean.countriesPhonePrefixes[$("i_vcd_pays").value]; else $("i_vcd_telephone").value=""; } if($("i_telmobile")){ //if(countriesViewBean.countriesPhonePrefixes[$("i_vcd_pays").value]) // $("i_telmobile").value=countriesViewBean.countriesPhonePrefixes[$("i_vcd_pays").value]; //else $("i_telmobile").value=""; } } }, rewriteIdentification: function() { if(interHotelsViewBean){ getElementByIdIfExists("i_confmailresa_non").checked = true; if($("wantMailNotIdentified")) $("wantMailNotIdentified").show(); if($("mnotidentified")) $("mnotidentified").hide(); if($("sendSms")) $("sendSms").hide(); $("i_vcd_mdp").value=interHotelsViewBean.selectedhotelEmail; $("i_vcd_telephone").value=interHotelsViewBean.selectedhotelPhone; } else if(profileViewBean){ if($("mnotidentified")) $("mnotidentified").hide(); if($("wantMailIdentified")){ $("wantMailIdentified").show(); if($("i_confmailresa_oui")) $("i_confmailresa_oui").checked=true; } if($("wantMailNotIdentified")) $("wantMailNotIdentified").hide(); if($("sendSms")){ $("sendSms").show(); $("sendSms").setStyle({display:"block"}); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -