Naviguation dans :  Perl  JavaScript  Détail  - par cas d'appel / par traitements
 présentée :  par cas d'appel   par traitements 
Retour à l'accueil
  
 
 Requêtes 

 load – Admin 

 Utilitaires 

Requêtes de Ça-déménage.com
Accès professionnel
Divers utilitaires


 PreContacter  Prendre un pré-contact
Syntaxe PreContacter(To,x1,x2,nom,val)
Paramètres 
nom  type  Description 
To  IN Cas d'appel
x1  IN Message à émettre
x2  IN Désignation de l'émetteur
nom  IN Identifiant appelé
val  IN Identifiant d'appel
retourne  OUT  0 : Traitement correct
non nul : Erreur de traitement
Fonctions util. 
 client Variable indiquant si l'exécution s'opère sur le poste client
 crpEcrire Encrypter un texte
 tstEmail Teste la validité syntaxique d'une adresse e-mail
 parseMail Mise en forme standard du sujet d'un mail
 Root Désignations absolues
 Mailer Envoi d'un mail
 MailDo Construit le mail à envoyer


Code Perl 

sub PreContacter {local($To,$x1,$x2,$nom,$val) = @_; 
 local($y,$k); 
 local $From = $nomBox."contact\@ca-demenage.com"; 
 if (($k=index($x1,","))==-1) {return 1}; $y = substr($x1,0,$k); $x1 = substr($x1,$k+1);
 if (($k=index($x1,","))==-1) {return 1}; $y = substr($x1,0,$k); $x1 = substr($x1,$k+1);
 return &Mailer(&MailDo($To,$From,"",&parseMail("Ça-déménage.com - ".$x2.""),&prectcHtml($y,$x1,$nom,$val),&prectcNoHtml($y,$x1,$nom,$val)));
}

sub prectcHtml {local($mail,$msg,$nom,$val) = @_; 
 local($x1,$x2); 
 local $x = ""; 
 $x .= "<html>\n<head>\n<title></title>\n";
 $x .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
 $x .= "<meta name=\"GENERATOR\" content=\"WebSI 1.0\">\n";
 $x .= "<style>td {font-family: Arial,Verdana,sans-serif}</style>\n";
 $x .= "</head>\n<body>\n";
 $x .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"font-size:10pt\">";
 $x .= "<tr><td>";
 $x .= "Ce message vous est envoyé par <a href=\"".$nomSite."\">www.ca-demenage.com</a>, le site de mise en relation directe entre particuliers et déménageurs.<br>";
 $x .= "Il provient d\'un particulier qui s\'est enregistré sur le site et qui a souhaité entrer directement en contact avec vous. Il vous est transmis à titre gracieux et n\'engendrera aucun frais de notre part.<br>";
 $x .= "<hr size=\"1\">";
 $x .= "<img border=\"0\" src=\"../../dircad/images/CADEMENA2.gif\" height=\"37\" width=\"206\"><br>\n";
 $x .= "Retrouvez votre correspondant sur le site pour lui répondre".(($mail ne "")?" ou contactez-le par e-mail : <a href=\"mailto:".$mail."\">".$mail."</a>":"").".<br>";
 $msg =~ s/&/&amp;/g; $msg =~ s/</&lt;/g; $msg =~ s/\n/<br>/g;
 $x .= "Message : <br>".$msg."<br>";
 $x .= "</td></tr>";
 $x .= "<tr><td>";
 $x .= "<hr size=\"1\">";
 local @T = &crpEcrire("",-1); 
 $x2 = 'Obtenir le détail de la demande';
 $x1 = "Appel=".$nom."\&Cible=".$T[0]; $x1 =~ s/ /\+/gi;
 $x .= "<a href=\"".$nomSite."/cgi-bin/dircad/wsCaD_read.cgi?".$x1."\" target=\"_blank\">".$x2."</a>\n";
 $x .= "</td></tr>";
 $x .= "</table>";
 $x .= "</body>\n</html>\n";
if ($client eq "true") {
 print "Content-type: text/html\n\n<html>\n<head>\n<title></title>\n</head>\n<body>\n"; print $x; print "</body>\n</html>\n";
}
 return $x;
}

sub prectcNoHtml {local($mail,$msg,$nom,$val) = @_; 
 local($x1,$x2); 
 local $x = ""; 
 $x .= "\n";
 $x .= "Ce message vous est envoyé par ".$nomSite.", le site de mise en relation directe entre particuliers et déménageurs.\n";
 $x .= "Il provient d\'un particulier qui s\'est enregistré sur le site et qui a souhaité entrer directement en contact avec vous. Il vous est transmis à titre gracieux et n\'engendrera aucun frais de notre part.\n";
 $x .= "\n";
 $x .= "Retrouvez votre correspondant sur le site pour lui répondre".(($mail ne "")?" ou contactez-le par e-mail : ".$mail."":"").".\n";
 $x .= "Message : \n".$msg."\n";
 $x .= "\n";
 local @T = &crpEcrire("",-1); 
 $x2 = 'Obtenir le détail de la demande';
 $x1 = "Appel=".$nom."\&Cible=".$T[0]; $x1 =~ s/ /\+/gi;
 $x .= "".$x2." :\n".$nomSite."/cgi-bin/dircad/wsCaD_read.cgi?".$x1."\"\n";
 return $x;
}
Code JavaScript 

function PreContacter(To,x1,x2,nom,val) { 
 var y,k; 
 var From = nomBox+"contact\@ca-demenage.com"; 
 if ((k=x1.indexOf(","))==-1) {return 1}; y = x1.substr(0,k); x1 = x1.substr(k+1);
 if ((k=x1.indexOf(","))==-1) {return 1}; y = x1.substr(0,k); x1 = x1.substr(k+1);
 return Mailer(MailDo(To,From,"",parseMail("Ça-déménage.com - "+x2+""),prectcHtml(y,x1,nom,val),prectcNoHtml(y,x1,nom,val)));
}

function prectcHtml(mail,msg,nom,val) { 
 var x1,x2; 
 var x = ""; 
 x += "<html>\n<head>\n<title></title>\n";
 x += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n";
 x += "<meta name=\"GENERATOR\" content=\"WebSI 1.0\">\n";
 x += "<style>td {font-family: Arial,Verdana,sans-serif}</style>\n";
 x += "</head>\n<body>\n";
 x += "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" style=\"font-size:10pt\">";
 x += "<tr><td>";
 x += "Ce message vous est envoyé par <a href=\""+nomSite+"\">www.ca-demenage.com</a>, le site de mise en relation directe entre particuliers et déménageurs.<br>";
 x += "Il provient d\'un particulier qui s\'est enregistré sur le site et qui a souhaité entrer directement en contact avec vous. Il vous est transmis à titre gracieux et n\'engendrera aucun frais de notre part.<br>";
 x += "<hr size=\"1\">";
 x += "<img border=\"0\" src=\"../../dircad/images/CADEMENA2.gif\" height=\"37\" width=\"206\"><br>\n";
 x += "Retrouvez votre correspondant sur le site pour lui répondre"+((mail!="")?" ou contactez-le par e-mail : <a href=\"mailto:"+mail+"\">"+mail+"</a>":"")+".<br>";
 msg = msg.replace(/&/g,"&amp;"); msg = msg.replace(/</g,"&lt;"); msg = msg.replace(/\n/g,"<br>");
 x += "Message : <br>"+msg+"<br>";
 x += "</td></tr>";
 x += "<tr><td>";
 x += "<hr size=\"1\">";
 var T = crpEcrire("",-1); 
 x2 = 'Obtenir le détail de la demande';
 x1 = "Appel="+nom+"\&Cible="+T[0]; x1 = x1.replace(/ /gi,"\+");
 x += "<a href=\""+nomSite+"/cgi-bin/dircad/wsCaD_read.cgi?"+x1+"\" target=\"_blank\">"+x2+"</a>\n";
 x += "</td></tr>";
 x += "</table>";
 x += "</body>\n</html>\n";
if (client=="true") {
with(window.open().document) {
 open(); write(x); close();
}
}
 return x;
}

function prectcNoHtml(mail,msg,nom,val) { 
 var x1,x2; 
 var x = ""; 
 x += "\n";
 x += "Ce message vous est envoyé par "+nomSite+", le site de mise en relation directe entre particuliers et déménageurs.\n";
 x += "Il provient d\'un particulier qui s\'est enregistré sur le site et qui a souhaité entrer directement en contact avec vous. Il vous est transmis à titre gracieux et n\'engendrera aucun frais de notre part.\n";
 x += "\n";
 x += "Retrouvez votre correspondant sur le site pour lui répondre"+((mail!="")?" ou contactez-le par e-mail : "+mail+"":"")+".\n";
 x += "Message : \n"+msg+"\n";
 x += "\n";
 var T = crpEcrire("",-1); 
 x2 = 'Obtenir le détail de la demande';
 x1 = "Appel="+nom+"\&Cible="+T[0]; x1 = x1.replace(/ /gi,"\+");
 x += ""+x2+" :\n"+nomSite+"/cgi-bin/dircad/wsCaD_read.cgi?"+x1+"\"\n";
 return x;
}