Commit 44af465ffb49c234acdecd25207a343e8cf02b1f

Authored by Edmar Moretti
1 parent f3ef944a

Ajustes na codificação de caracteres da legenda

admin/admin.db
No preview for this file type
aplicmap/legenda6.htm
1 <!-- 1 <!--
2 -  
3 [leg_layer_html opt_flag=1] 2 [leg_layer_html opt_flag=1]
4 -  
5 </div><div style='display:block;' id='legendaLayer_[leg_layer_name]' > 3 </div><div style='display:block;' id='legendaLayer_[leg_layer_name]' >
6 -  
7 - <table class=legendatemas cellspacing=0 width=248 >  
8 [if name=TEMA oper=neq value=NAO] 4 [if name=TEMA oper=neq value=NAO]
9 <table [if name=CLASSE oper=eq value=NAO] style=display:none; [/if] > 5 <table [if name=CLASSE oper=eq value=NAO] style=display:none; [/if] >
10 <tr><td style=text-align:left > 6 <tr><td style=text-align:left >
@@ -22,22 +18,18 @@ @@ -22,22 +18,18 @@
22 [/leg_layer_html] 18 [/leg_layer_html]
23 19
24 [leg_class_html] 20 [leg_class_html]
25 - 21 +<table style=margin-top:5px;position:relative;left:15px; >
26 [if name=CLASSE oper=neq value=NAO] 22 [if name=CLASSE oper=neq value=NAO]
27 - <table style=margin-top:5px;position:relative;left:15px; >  
28 <tr> 23 <tr>
29 <td style=width:20px;text-align:left; ><input type=checkbox CHECKED title=liga/desliga class=inputsb style='border: 0px solid red;cursor:pointer;opacity:0.3;' value=[leg_class_index] name=[leg_layer_name] id='legendack_[leg_layer_name]_[leg_class_index]' onclick='i3GEO.arvoreDeCamadas.inverteStatusClasse(this)' /> 24 <td style=width:20px;text-align:left; ><input type=checkbox CHECKED title=liga/desliga class=inputsb style='border: 0px solid red;cursor:pointer;opacity:0.3;' value=[leg_class_index] name=[leg_layer_name] id='legendack_[leg_layer_name]_[leg_class_index]' onclick='i3GEO.arvoreDeCamadas.inverteStatusClasse(this)' />
30 </td> 25 </td>
31 <td style=text-align:left > 26 <td style=text-align:left >
32 <img src=[leg_icon width=16 height=16 ] /> 27 <img src=[leg_icon width=16 height=16 ] />
33 </td> 28 </td>
34 - <td width=195 style=text-align:left; ><span style=font-size:9px;position:relative;left:2px; >[leg_class_name]</span></td> 29 + <td style="text-align:left;width:195px" ><span style="font-size:9px;position:relative;left:2px;" >[leg_class_name]</span></td>
35 </tr> 30 </tr>
36 - </table>  
37 [/if] 31 [/if]
38 - </table> 32 +</table>
39 33
40 [/leg_class_html] 34 [/leg_class_html]
41 -  
42 --->  
43 - 35 +-->
44 \ No newline at end of file 36 \ No newline at end of file
classesphp/classe_alteraclasse.php
@@ -195,7 +195,7 @@ class Alteraclasse @@ -195,7 +195,7 @@ class Alteraclasse
195 $ids = explode(";",$ids); 195 $ids = explode(";",$ids);
196 $minScales = explode(";",$minScales); 196 $minScales = explode(";",$minScales);
197 $maxScales = explode(";",$maxScales); 197 $maxScales = explode(";",$maxScales);
198 - //$nomes = mb_convert_encoding($nomes,"ISO-8859-1","UTF-8"); 198 + $nomes = $this->converteTexto($nomes);
199 $nomes = explode(";",$nomes); 199 $nomes = explode(";",$nomes);
200 //$exps = mb_convert_encoding($exps,"ISO-8859-1","UTF-8"); 200 //$exps = mb_convert_encoding($exps,"ISO-8859-1","UTF-8");
201 $exps = explode(";",$exps); 201 $exps = explode(";",$exps);
@@ -576,8 +576,8 @@ class Alteraclasse @@ -576,8 +576,8 @@ class Alteraclasse
576 { 576 {
577 $ns = $vs; 577 $ns = $vs;
578 } 578 }
579 - else  
580 - {$ns = $this->pegaValores($this->mapa,$this->layer,$itemNome,false,$ignorar); 579 + else{
  580 + $ns = $this->pegaValores($this->mapa,$this->layer,$itemNome,false,$ignorar);
581 } 581 }
582 $lista = array(); 582 $lista = array();
583 for ($i = 0; $i < count($vs); ++$i){ 583 for ($i = 0; $i < count($vs); ++$i){
@@ -1064,14 +1064,14 @@ class Alteraclasse @@ -1064,14 +1064,14 @@ class Alteraclasse
1064 {string} 1064 {string}
1065 */ 1065 */
1066 function converteTexto($texto) 1066 function converteTexto($texto)
1067 - {  
1068 - if (function_exists("mb_convert_encoding"))  
1069 - {  
1070 - if (!mb_detect_encoding($texto,"ISO-8859-1",true))  
1071 - {  
1072 - $texto = mb_convert_encoding($texto,"ISO-8859-1","UTF-8");  
1073 - }  
1074 - } 1067 + {
  1068 + if (function_exists("mb_convert_encoding"))
  1069 + {
  1070 + if (!mb_detect_encoding($texto,"UTF-8",true))
  1071 + {
  1072 + $texto = mb_convert_encoding($texto,"UTF-8","ISO-8859-1");
  1073 + }
  1074 + }
1075 return $texto; 1075 return $texto;
1076 } 1076 }
1077 } 1077 }
classesphp/classe_legenda.php
@@ -252,9 +252,13 @@ string com a legenda HTML @@ -252,9 +252,13 @@ string com a legenda HTML
252 if(!$l = @$this->mapa->processlegendtemplate($tmparray)){ 252 if(!$l = @$this->mapa->processlegendtemplate($tmparray)){
253 return ("erro"); 253 return ("erro");
254 } 254 }
255 - if (function_exists("mb_convert_encoding")){  
256 - $l = mb_convert_encoding($l,"UTF-8","ISO-8859-1"); 255 + //e necessario explodir as partes da legenda para converter os caracteres
  256 + $pedacos = explode("<tr>",$l);
  257 + $n = count($pedacos);
  258 + for($i=0;$i<$n;$i++){
  259 + $pedacos[$i] = $this->converte($pedacos[$i]);
257 } 260 }
  261 + $l = implode("<tr>",$pedacos);
258 return (array("legenda"=>$l,"desativar"=>$desligar)); 262 return (array("legenda"=>$l,"desativar"=>$desligar));
259 } 263 }
260 /* 264 /*
@@ -355,11 +359,14 @@ array @@ -355,11 +359,14 @@ array
355 $imgi->saveImage($nomer); 359 $imgi->saveImage($nomer);
356 $i = ($imgi->imageurl).basename($nomer); 360 $i = ($imgi->imageurl).basename($nomer);
357 $nomeclasse = $classe->name; 361 $nomeclasse = $classe->name;
358 - if (function_exists("mb_convert_encoding"))  
359 - {$nomeclasse = mb_convert_encoding($nomeclasse,"UTF-8","ISO-8859-1");} 362 +
  363 + //if (function_exists("mb_convert_encoding"))
  364 + //{$nomeclasse = mb_convert_encoding($nomeclasse,"UTF-8","ISO-8859-1");}
  365 + $nomeclasse = $this->converte($nomeclasse);
360 $nomeexp = $classe->getExpressionString(); 366 $nomeexp = $classe->getExpressionString();
361 if (function_exists("mb_convert_encoding")) 367 if (function_exists("mb_convert_encoding"))
362 {$nomeexp = mb_convert_encoding($nomeexp,"UTF-8","ISO-8859-1");} 368 {$nomeexp = mb_convert_encoding($nomeexp,"UTF-8","ISO-8859-1");}
  369 +
363 $linhas[] = array("tema"=>$l,"idclasse"=>$c,"nomeclasse"=>$nomeclasse,"expressao"=>$nomeexp,"imagem"=>$i,"proc"=>"","minScale"=>$classe->minscaledenom,"maxScale"=>$classe->maxscaledenom); 370 $linhas[] = array("tema"=>$l,"idclasse"=>$c,"nomeclasse"=>$nomeclasse,"expressao"=>$nomeexp,"imagem"=>$i,"proc"=>"","minScale"=>$classe->minscaledenom,"maxScale"=>$classe->maxscaledenom);
364 } 371 }
365 if (($totaliza=="sim") && ($nc > 1)){ 372 if (($totaliza=="sim") && ($nc > 1)){
@@ -918,6 +925,16 @@ $width @@ -918,6 +925,16 @@ $width
918 $this->layer->setMetaData("cache",""); 925 $this->layer->setMetaData("cache","");
919 return "ok"; 926 return "ok";
920 } 927 }
921 - 928 + function converte($texto)
  929 + {
  930 + if (function_exists("mb_convert_encoding"))
  931 + {
  932 + if (!mb_detect_encoding($texto,"UTF-8",true))
  933 + {
  934 + $texto = mb_convert_encoding($texto,"UTF-8","ISO-8859-1");
  935 + }
  936 + }
  937 + return $texto;
  938 + }
922 } 939 }
923 ?> 940 ?>
924 \ No newline at end of file 941 \ No newline at end of file