function log(){ document.body.style.backgroundColor="#000000"; } function ajoutChamp(){ var obj = document.getElementById('selectEncar'); var cachIn = document.getElementsByClassName('hide'); //var tiny = tinyMCE.get('zone_encar'); if(obj.value == "aucun"){ for(var i = 0; i < cachIn.length; i++) { cachIn[i].style.display = 'none'; } } else { for(var i = 0; i < cachIn.length; i++) { cachIn[i].style.display = 'inline-block'; } if(obj.value == "autre"){ document.getElementById('autre_cache').style.display = 'inline-block'; } else { document.getElementById('autre_cache').style.display = 'none'; } } } //fonction pour calculer le nb de caractere avec comme argument la longeur max de l'article function countCaract(){ var longSurtitre = document.getElementById('in_surtitre').value.length; var longtitre = document.getElementById('in_titre').value.length; var longChapeau = tinyMCE.get('zone_chapeau').getContent().length; var longText = tinyMCE.get('zone_article').getContent().length; var longEncTitre = document.getElementById('enc_titre').value.length; var longEnc = tinyMCE.get('zone_encar').getContent().length; var counter = document.getElementById('modifCounter'); var compteur = longSurtitre + longtitre + longChapeau + longText + longEncTitre + longEnc; counter.innerHTML = compteur; verifNbCaract(); } function countCaract2(){ var longSurtitre = document.getElementById('in_surtitre').value.length; var longtitre = document.getElementById('in_titre').value.length; var longChapeau = tinyMCE.get('zone_chapeau').getContent().length; var longText = tinyMCE.get('zone_article').getContent().length; var longEncTitre = document.getElementById('enc_titre').value.length; var longEnc = tinyMCE.get('zone_encar').getContent().length; var counter = document.getElementById('modifCounter'); var compteur = longSurtitre + longtitre + longChapeau + longText + longEncTitre + longEnc; counter.innerHTML = compteur; } function verifNbCaract(){ var nbCaract = document.getElementById('modifCounter'); var nbCaractTt = document.getElementById('baseCaract').innerHTML; var nbCaractMin = (parseInt(nbCaractTt) * 0.85); var nbCaractMax = (parseInt(nbCaractTt) * 1.15); if(nbCaract.innerHTML>nbCaractMin && nbCaract.innerHTMLnbCaractMax){ nbCaract.style.color = 'red'; }else { nbCaract.style.color = 'black'; } } function afficheSelectActiv(reponse, tab){ var activ1 = document.getElementById('prospect_activ1'); var activ2 = document.getElementById('prospect_activ2'); var activ3 = document.getElementById('prospect_activ3'); var activ1Liste = activ1.getElementsByTagName("option"); while(activ1.hasChildNodes()){ activ1.removeChild(activ1.lastChild); } var activ2Liste = activ2.getElementsByTagName("option"); while(activ2.hasChildNodes()){ activ2.removeChild(activ2.lastChild); } var activ3Liste = activ3.getElementsByTagName("option"); while(activ3.hasChildNodes()){ activ3.removeChild(activ3.lastChild); } if(reponse=='Agriculteur'){ for(var i= 0; i < tab[0].length; i++){ var option1 = document.createElement("option"); var option2 = document.createElement("option"); var option3 = document.createElement("option"); option1.text = tab[0][i]; option1.value = tab[0][i]; option2.text = tab[0][i]; option2.value = tab[0][i]; option3.text = tab[0][i]; option3.value = tab[0][i]; activ1.appendChild(option1); activ2.appendChild(option2); activ3.appendChild(option3); } } else if(reponse=='Fournisseur'){ for(var i= 0; i < tab[2].length; i++){ var option1 = document.createElement("option"); var option2 = document.createElement("option"); var option3 = document.createElement("option"); option1.text = tab[2][i]; option1.value = tab[2][i]; option2.text = tab[2][i]; option2.value = tab[2][i]; option3.text = tab[2][i]; option3.value = tab[2][i]; activ1.appendChild(option1); activ2.appendChild(option2); activ3.appendChild(option3); } } else if(reponse=='OPA'){ for(var i= 0; i < tab[4].length; i++){ var option1 = document.createElement("option"); var option2 = document.createElement("option"); var option3 = document.createElement("option"); option1.text = tab[4][i]; option1.value = tab[4][i]; option2.text = tab[4][i]; option2.value = tab[4][i]; option3.text = tab[4][i]; option3.value = tab[4][i]; activ1.appendChild(option1); activ2.appendChild(option2); activ3.appendChild(option3); } } else { } } function afficheSelectActivAbon(reponse, tab){ var activ1 = document.getElementById('abon_activ1'); var activ2 = document.getElementById('abon_activ2'); var activ3 = document.getElementById('abon_activ3'); var activ1Liste = activ1.getElementsByTagName("option"); while(activ1.hasChildNodes()){ activ1.removeChild(activ1.lastChild); } var activ2Liste = activ2.getElementsByTagName("option"); while(activ2.hasChildNodes()){ activ2.removeChild(activ2.lastChild); } var activ3Liste = activ3.getElementsByTagName("option"); while(activ3.hasChildNodes()){ activ3.removeChild(activ3.lastChild); } if(reponse=='Agriculteur'){ for(var i= 0; i < tab[0].length; i++){ var option1 = document.createElement("option"); var option2 = document.createElement("option"); var option3 = document.createElement("option"); option1.text = tab[0][i]; option1.value = tab[0][i]; option2.text = tab[0][i]; option2.value = tab[0][i]; option3.text = tab[0][i]; option3.value = tab[0][i]; activ1.appendChild(option1); activ2.appendChild(option2); activ3.appendChild(option3); } } else if(reponse=='Fournisseur'){ for(var i= 0; i < tab[2].length; i++){ var option1 = document.createElement("option"); var option2 = document.createElement("option"); var option3 = document.createElement("option"); option1.text = tab[2][i]; option1.value = tab[2][i]; option2.text = tab[2][i]; option2.value = tab[2][i]; option3.text = tab[2][i]; option3.value = tab[2][i]; activ1.appendChild(option1); activ2.appendChild(option2); activ3.appendChild(option3); } } else if(reponse=='OPA'){ for(var i= 0; i < tab[4].length; i++){ var option1 = document.createElement("option"); var option2 = document.createElement("option"); var option3 = document.createElement("option"); option1.text = tab[4][i]; option1.value = tab[4][i]; option2.text = tab[4][i]; option2.value = tab[4][i]; option3.text = tab[4][i]; option3.value = tab[4][i]; activ1.appendChild(option1); activ2.appendChild(option2); activ3.appendChild(option3); } } else { } } function callScript ( scriptName, args ){ var xhr_object = null; // ### Construction de l’objet XMLHttpRequest selon le type de navigateur // Cas des navigateurs de type Netscape (Firefore, Conqueror, etc.) if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); // Cas du navigateur Internet Explorer else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); // Cas des navigateurs ne comprenant pas cette technologie (anciens navigateurs) else { // XMLHttpRequest non supporté par le navigateur alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); return; } if(xhr_object){document.getElementById('tempo').innerHTML = ''; } xhr_object.open("POST", scriptName, true); // Définition du comportement à adopter sur le changement d’état de l’objet // XMLHttpRequest xhr_object.onreadystatechange = function() { // Etat : requête terminée, réponse récupérée if(xhr_object.readyState == 4) { //alert(xhr_object.responseText); // DEBUG MODE // ### Interprétation du retour du script appellé // Mode d’interprétation 1: on affiche dans la page le retour // comme s’il s’agissait de code HTML //document.write(xhr_object.responseText); // Mode d’interprétation 2: on interprète le retour comme // s’il s’agissait de code javascript document.getElementById('tempo').innerHTML = ''; eval(xhr_object.responseText); } return xhr_object.readyState; } xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Envoi de la requête xhr_object.send(args); } function boutonSuiv(tab){ // recuperer $i var btPrec = document.getElementById('numPrec'); var btSuiv = document.getElementById('numSuiv'); var i = document.getElementById('valI').innerHTML; i = parseInt(i); var longTab = tab.length; if(i+1=0){ btSuiv.innerHTML = tab[i]; i = i - 1; if(i-1>=0){ btPrec.innerHTML = tab[i-1]; } else { btPrec.innerHTML = ''; } } else { btPrec.innerHTML = ''; } document.getElementById('valI').innerHTML = i; document.getElementById('affNbTt').innerHTML = i+1; afficheAbon(tab[i]); } } function afficherInputSupplement(valeur){ if(valeur == 'choixSem'){ document.getElementById('inputDate').innerHTML = '
'; } else { document.getElementById('inputDate').innerHTML = ''; } } function callScript ( scriptName, args ){ var xhr_object = null; // ### Construction de l’objet XMLHttpRequest selon le type de navigateur // Cas des navigateurs de type Netscape (Firefore, Conqueror, etc.) if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); // Cas du navigateur Internet Explorer else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); // Cas des navigateurs ne comprenant pas cette technologie (anciens navigateurs) else { // XMLHttpRequest non supporté par le navigateur alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); return; } if(xhr_object){document.getElementById('tempo').innerHTML = ''} xhr_object.open("POST", scriptName, true); // Définition du comportement à adopter sur le changement d’état de l’objet // XMLHttpRequest xhr_object.onreadystatechange = function() { // Etat : requête terminée, réponse récupérée if(xhr_object.readyState == 4) { //alert(xhr_object.responseText); // DEBUG MODE // ### Interprétation du retour du script appellé // Mode d’interprétation 1: on affiche dans la page le retour // comme s’il s’agissait de code HTML //document.write(xhr_object.responseText); // Mode d’interprétation 2: on interprète le retour comme // s’il s’agissait de code javascript document.getElementById('tempo').innerHTML = ''; eval(xhr_object.responseText); } return xhr_object.readyState; } xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Envoi de la requête xhr_object.send(args); } function afficheAbon (id){ // --- Récupération des paramètres nécessaire au script PHP // --- Appel au script PHP de traitement var _id = id; var _data = "abon_id="+_id; callScript("modules/abo/abon_fiche.php", _data); } function majAbon(){ var _abon_id = document.getElementById('abon_id').innerHTML; var _abon_num = document.getElementById('abon_num').value; var _abon_raison_sociale = document.getElementById('abon_raison_sociale').value; var _abon_nom_societe = document.getElementById('abon_nom_societe').value; var _abon_civil = document.getElementById('abon_civil').value; var _abon_nom = document.getElementById('abon_nom').value; var _abon_prenom = document.getElementById('abon_prenom').value; var _abon_adresse = document.getElementById('abon_adresse').value; var _abon_adresse2 = document.getElementById('abon_adresse2').value; var _abon_cp = document.getElementById('abon_cp').value; var _abon_ville = document.getElementById('abon_ville').value; var _abon_residence = document.getElementById('abon_residence').value; var _abon_canton_nouveau = document.getElementById('abon_canton_nouveau').value; var _abon_canton = document.getElementById('abon_canton').value; var _abon_arrondissement = document.getElementById('abon_arrondissement').value; var _abon_tel = document.getElementById('abon_tel').value; var _abon_fax = document.getElementById('abon_fax').value; var _abon_port = document.getElementById('abon_port').value; var _abon_mail = document.getElementById('abon_mail').value; var _abon_naissance = document.getElementById('abon_naissance').value; var _abon_affiliation = document.getElementById('abon_affiliation').value; var _abon_actif; if(document.getElementById('abon_actif').checked == false){ _abon_actif = 0; } else { _abon_actif = 1; } var _abon_activ1 = document.getElementById('abon_activ1').value; var _abon_activ1_precision = document.getElementById('abon_activ1_precision').value; var _abon_activ2 = document.getElementById('abon_activ2').value; var _abon_activ2_precision = document.getElementById('abon_activ2_precision').value; var _abon_activ3 = document.getElementById('abon_activ3').value; var _abon_activ3_precision = document.getElementById('abon_activ3_precision').value; var _abon_ha = document.getElementById('abon_ha').value; var _abon_fichier; if(document.getElementById('abon_fichier').checked == false){ _abon_fichier = 0; } else { _abon_fichier = 1; } var _abon_journal_mail if(document.getElementById('abon_journal_mail').checked == false){ _abon_journal_mail = 0; } else { _abon_journal_mail = 1; } var _abon_date_abonnement = document.getElementById('abon_date_abonnement').value; //ajout var _abon_vd; if(document.getElementById('abon_vd').checked == false){ _abon_vd = 0; } else { _abon_vd = 1; } var _abon_sms_pub; if(document.getElementById('abon_sms_pub').checked == false){ _abon_sms_pub = 0; } else { _abon_sms_pub = 1; } var _abon_sms_tdb; if(document.getElementById('abon_sms_tdb').checked == false){ _abon_sms_tdb = 0; } else { _abon_sms_tdb = 1; } var _abon_mail_pub; if(document.getElementById('abon_mail_pub').checked == false){ _abon_mail_pub = 0; } else { _abon_mail_pub = 1; } var _abon_mail_tdb; if(document.getElementById('abon_mail_tdb').checked == false){ _abon_mail_tdb = 0; } else { _abon_mail_tdb = 1; } var _data = "abon_id="+_abon_id+"&abon_num="+_abon_num+"&abon_raison_sociale="+_abon_raison_sociale+"&abon_nom_societe="+_abon_nom_societe+"&abon_civil="+_abon_civil+"&abon_nom="+_abon_nom+"&abon_prenom="+_abon_prenom+"&abon_adresse="+_abon_adresse+"&abon_adresse2="+_abon_adresse2+"&abon_cp="+_abon_cp+"&abon_ville="+_abon_ville+"&abon_residence="+_abon_residence+"&abon_canton_nouveau="+_abon_canton_nouveau+"&abon_canton="+_abon_canton+"&abon_arrondissement="+_abon_arrondissement+"&abon_tel="+_abon_tel+"&abon_fax="+_abon_fax+"&abon_port="+_abon_port+"&abon_mail="+_abon_mail+"&abon_naissance="+_abon_naissance+"&abon_affiliation="+_abon_affiliation+"&abon_actif="+_abon_actif+"&abon_activ1="+_abon_activ1+"&abon_activ1_precision="+_abon_activ1_precision+"&abon_activ2="+_abon_activ2+"&abon_activ2_precision="+_abon_activ2_precision+"&abon_activ3="+_abon_activ3+"&abon_activ3_precision="+_abon_activ3_precision+"&abon_ha="+_abon_ha+"&abon_fichier="+_abon_fichier+"&abon_journal_mail="+_abon_journal_mail+"&abon_date_abonnement="+_abon_date_abonnement+"&abon_vd="+_abon_vd+"&abon_sms_pub="+_abon_sms_pub+"&abon_sms_tdb="+_abon_sms_tdb+"&abon_mail_pub="+_abon_mail_pub+"&abon_mail_tdb="+_abon_mail_tdb; callScript("modules/abo/abon_maj.php", _data); } function ajouterRevue(){ var select = document.getElementById('liste_revue'); var span = document.getElementById('abon_revue'); var somme = document.getElementById('abon_somme').value; if(span.value==""){ span.value = select.value; } else { span.value = span.value +"-"+ select.value; } if(somme == 110){ somme = parseInt(somme) + parseInt('50'); } else { somme = parseInt(somme) + parseInt('100'); } document.getElementById('abon_somme').value = somme; select.selectedIndex = 0; } function repercutDuree(){ var duree = document.getElementById('abon_duree').value; var num_echeance = document.getElementById('abon_num_echeance').value; if(duree == 1){ var somme = 110; // montant pour un an num_echeance = parseInt(num_echeance) + parseInt('51'); } else if(duree == 9999){ var somme = 0; // montant gratuit num_echeance = 99999; } else { var somme = 200; // montant pour deux ans num_echeance = parseInt(num_echeance) + parseInt('102'); } document.getElementById('abon_somme').value = somme; document.getElementById('abon_num_echeance').value = num_echeance; } Array ( [0] => HY093 [1] => [2] => ) 1