Naviguation dans :  Perl  JavaScript  Détail  - load.cgi?Appel=saveUser
 présentée :  par cas d'appel   par traitements 
Retour à l'accueil
  
   
 Requêtes 

 load – User 

 Execer 

Requêtes de Ça-déménage.com
Accès particulier
Exécution de la requête
 
 
 Bibliothèque CaD 

 Base 

 Compta 

Bibliothèque de Ça-déménage.com
Accès aux bases
Gestion des messages échangés
 


 cptLireTout  Lit tous les messages échangés
Syntaxe cptLireTout(To,noms)
Paramètres 
nom  type  Description 
To  IN Cas d'appel
noms  IN Identifiants d'appel
Au format : "<ident>" ou "<ident1>-<ident2>"
retourne  OUT Liste des messages échangés dans la plage d'identifiants spécifiée
Liste de la forme : "/<émetteur>,<destinataire>,<état>,<date>/..."
Fonctions util. 
 getFile Retourne le nom du fichier


Code Perl 

sub cptLireTout {local($To,$noms) = @_; 
 local($nom1,$nom2); if ($noms=~/(.*)\-(.*)/) {$nom1 = $1; $nom2 = $2} else {$nom1 = $nom2 = $noms}; 
local $nomFic = &getFile($To,$nom1,"Cpta"); 
 if ($nomFic eq "") {return ""};
 local $x = ""; 
 srand $$; until(open(F1,"<".$nomFic)) {select(undef,undef,undef,rand)}; $x .= join("",<F1>); close(F1);
 local($k,$x0,$y,$x2); 
 local %T0 = (); local %T1 = (); 
while(true) {
 if ($x ne "") {$x =~ s/^\s*//};
 if ($x eq '') {last}; $k = index($x,"/#T)");
 if ($k==-1) {return ""}; $k = $k+4; $x0 = substr($x,0,$k); $x = substr($x,$k);
 if ($x0!~/\(#T\((\w+)\)new:\/\/(\w+)\/#T\(.{3}Owner\):(\w+)\/#T\(.{3}Error\):(\w+)\/#T/) {next};
 $y = $1;
if ($y eq "Cloture") {
 if ($x0!~/\(#T\(Cloture\)new:\/\/\w+\/#T\(cloOwner\):(\w+)\/#T\(cloError\):(\w+)\/#T\(cloUser\):(\w+)\/#T\(cloEtat\):(.*)\/#T\)/) {next};
 if (($To eq "Admin")&&($1 le $nom1)&&($nom2 le $1)) {
  $x2 = $To.$1.","."User".$3;
  if ($2 eq "1") {if (defined $T1{$x2}) {$T1{$x2} = ""}; next};
  $T1{$x2} = $4."!";
 }
} elsif ($y eq "Compta") {
 if ($x0!~/\(#T\(Compta\)new:\/\/\w+\/#T\(cptOwner\):(\w+)\/#T\(cptError\):(\w+)\/#T\(cptUser\):(\w+)\/#T\(cptEtat\):(.*)\/#T\(cptMsg\):(\w+),/) {next};
 if (($To.$nom1 le $1)&&($1 le $To.$nom2)) {
  $x2 = $1.",".$3;
  if ($2 eq "1") {if (defined $T0{$x2}) {$T0{$x2} = ""}; next}; $T0{$x2} = $5;
  if (defined $T1{$x2}) {if (substr($T1{$x2},1) eq "!") {next}}; $T1{$x2} = $4.".";
 } elsif (($To.$nom1 le $3)&&($3 le $To.$nom2)) {
  $x2 = $3.",".$1;
  if ($2 eq "1") {if (defined $T0{$x2}) {$T0{$x2} = ""}; next}; $T0{$x2} = $5;
  if (defined $T1{$x2}) {if (substr($T1{$x2},1) eq "!") {next}}; $T1{$x2} = $4.".";
 }
}
}
 $x = ""; foreach $y (keys %T0) {if (($T0{$y} ne "")&&($T1{$y} ne "")) {$x .= "/".$y.",".substr($T1{$y},0,1).",".$T0{$y}}};
 return $x;
}
Code JavaScript 

function cptLireTout(To,noms) { 
 var nom1,nom2; if (noms.match(/(.*)\-(.*)/)) {nom1 = RegExp.$1; nom2 = RegExp.$2} else {nom1 = nom2 = noms}; 
var nomFic = getFile(To,nom1,"Cpta"); 
 if (nomFic=="") {return ""};
 var x = ""; 
 x += eval(nomFic); 
 var k,x0,y,x2; 
 var T0 = []; var T1 = []; 
while(true) {
 if (x!="") {x = x.replace(/^\s*/,"")};
 if (x=='') {break}; k = x.indexOf("/#T)");
 if (k==-1) {return ""}; k = k+4; x0 = x.substr(0,k); x = x.substr(k);
 if (!x0.match(/\(#T\((\w+)\)new:\/\/(\w+)\/#T\(.{3}Owner\):(\w+)\/#T\(.{3}Error\):(\w+)\/#T/)) {continue};
 y = RegExp.$1;
if (y=="Cloture") {
 if (!x0.match(/\(#T\(Cloture\)new:\/\/\w+\/#T\(cloOwner\):(\w+)\/#T\(cloError\):(\w+)\/#T\(cloUser\):(\w+)\/#T\(cloEtat\):(.*)\/#T\)/)) {continue};
 if ((To=="Admin")&&(RegExp.$1<=nom1)&&(nom2<=RegExp.$1)) {
  x2 = To+RegExp.$1+","+"User"+RegExp.$3;
  if (RegExp.$2=="1") {if (typeof(T1[x2])!="undefined") {T1[x2] = ""}; continue};
  T1[x2] = RegExp.$4+"!";
 }
} else if (y=="Compta") {
 if (!x0.match(/\(#T\(Compta\)new:\/\/\w+\/#T\(cptOwner\):(\w+)\/#T\(cptError\):(\w+)\/#T\(cptUser\):(\w+)\/#T\(cptEtat\):(.*)\/#T\(cptMsg\):(\w+),/)) {continue};
 if ((To+nom1<=RegExp.$1)&&(RegExp.$1<=To+nom2)) {
  x2 = RegExp.$1+","+RegExp.$3;
  if (RegExp.$2=="1") {if (typeof(T0[x2])!="undefined") {T0[x2] = ""}; continue}; T0[x2] = RegExp.$5;
  if (typeof(T1[x2])!="undefined") {if (T1[x2].substr(1)=="!") {continue}}; T1[x2] = RegExp.$4+".";
 } else if ((To+nom1<=RegExp.$3)&&(RegExp.$3<=To+nom2)) {
  x2 = RegExp.$3+","+RegExp.$1;
  if (RegExp.$2=="1") {if (typeof(T0[x2])!="undefined") {T0[x2] = ""}; continue}; T0[x2] = RegExp.$5;
  if (typeof(T1[x2])!="undefined") {if (T1[x2].substr(1)=="!") {continue}}; T1[x2] = RegExp.$4+".";
 }
}
}
 x = ""; for(y in T0) {if ((T0[y]!="")&&(T1[y]!="")) {x += "/"+y+","+T1[y].substr(0,1)+","+T0[y]}};
 return x;
}