Commit 149997e38188743aad015bebfe324f699b66ba7f
1 parent
e3cf0eb3
Exists in
master
and in
7 other branches
Correção na aplicação de filtros
Showing
3 changed files
with
34 additions
and
21 deletions
Show diff stats
classesphp/classe_temas.php
@@ -529,6 +529,7 @@ $testa - Testa o filtro e retorna uma imagem. | @@ -529,6 +529,7 @@ $testa - Testa o filtro e retorna uma imagem. | ||
529 | $layer->set("template","none.htm"); | 529 | $layer->set("template","none.htm"); |
530 | $fil = $layer->getFilterString(); | 530 | $fil = $layer->getFilterString(); |
531 | $filtro = str_replace("|","'",$filtro); | 531 | $filtro = str_replace("|","'",$filtro); |
532 | + /* | ||
532 | if ($layer->connectiontype == MS_POSTGIS){ | 533 | if ($layer->connectiontype == MS_POSTGIS){ |
533 | $filtro = str_replace("'[","",$filtro); | 534 | $filtro = str_replace("'[","",$filtro); |
534 | $filtro = str_replace("[","",$filtro); | 535 | $filtro = str_replace("[","",$filtro); |
@@ -537,30 +538,37 @@ $testa - Testa o filtro e retorna uma imagem. | @@ -537,30 +538,37 @@ $testa - Testa o filtro e retorna uma imagem. | ||
537 | $filtro = str_replace("("," ",$filtro); | 538 | $filtro = str_replace("("," ",$filtro); |
538 | $filtro = str_replace(")"," ",$filtro); | 539 | $filtro = str_replace(")"," ",$filtro); |
539 | } | 540 | } |
540 | - if ($filtro == ""){ | ||
541 | - $layer->setfilter($filtro); | ||
542 | - } | ||
543 | - else{ | ||
544 | - //testa o filtro | 541 | + */ |
542 | + if ($filtro != ""){ | ||
543 | + //testa o filtro para resolver problemas de acentuacao | ||
545 | if(mb_convert_encoding($filtro,"UTF-8","ISO-8859-1") != mb_convert_encoding($filtro,"ISO-8859-1","UTF-8")){ | 544 | if(mb_convert_encoding($filtro,"UTF-8","ISO-8859-1") != mb_convert_encoding($filtro,"ISO-8859-1","UTF-8")){ |
546 | - $teste = $layer->querybyattributes($items[0],$filtro,1); | ||
547 | - if($teste != MS_SUCCESS){ | 545 | + $filtro = str_replace("*","'",$filtro); |
546 | + $teste = $layer->querybyattributes($items[0],$filtro,1); | ||
547 | + if($teste != MS_SUCCESS){ | ||
548 | $teste = $this->layer->queryByAttributes($items[0], mb_convert_encoding($filtro,"ISO-8859-1","UTF-8"), 1); | 548 | $teste = $this->layer->queryByAttributes($items[0], mb_convert_encoding($filtro,"ISO-8859-1","UTF-8"), 1); |
549 | if($teste != MS_SUCCESS){ | 549 | if($teste != MS_SUCCESS){ |
550 | - $teste = $this->layer->queryByAttributes($items[0], mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"), 1); | ||
551 | $filtro = mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"); | 550 | $filtro = mb_convert_encoding($filtro,"UTF-8","ISO-8859-1"); |
551 | + } else { | ||
552 | + $filtro = mb_convert_encoding($filtro,"ISO-8859-1","UTF-8"); | ||
553 | + $teste = $layer->querybyattributes($items[0],$filtro,1); | ||
554 | + if($teste != MS_SUCCESS){ | ||
555 | + $filtro = ""; | ||
556 | + } | ||
552 | } | 557 | } |
553 | - else{ | ||
554 | - $filtro = mb_convert_encoding($filtro,"ISO-8859-1","UTF-8"); | ||
555 | - } | ||
556 | - } | ||
557 | - if($teste == MS_SUCCESS){ | ||
558 | - $layer->setfilter($filtro); | ||
559 | } | 558 | } |
560 | } else { | 559 | } else { |
561 | - $layer->setfilter($filtro); | 560 | + //testa a questao de ser string ou numero |
561 | + //$layer->setfilter($filtro); | ||
562 | + $teste = $layer->querybyattributes($items[0],str_replace("*","'",$filtro),1); | ||
563 | + if($teste != MS_SUCCESS){ | ||
564 | + $filtro = str_replace("*","",$filtro); | ||
565 | + } | ||
566 | + if($teste == MS_SUCCESS){ | ||
567 | + $filtro = str_replace("*","'",$filtro); | ||
568 | + } | ||
562 | } | 569 | } |
563 | } | 570 | } |
571 | + $layer->setfilter($filtro); | ||
564 | if ($testa == ""){ | 572 | if ($testa == ""){ |
565 | $layer->setMetaData("cache",""); | 573 | $layer->setMetaData("cache",""); |
566 | } else { | 574 | } else { |
ferramentas/filtro/exec.php
@@ -34,6 +34,8 @@ Inclui um filtro no tema. | @@ -34,6 +34,8 @@ Inclui um filtro no tema. | ||
34 | $_GET["testa"]=""; | 34 | $_GET["testa"]=""; |
35 | } | 35 | } |
36 | $m->insereFiltro(""); | 36 | $m->insereFiltro(""); |
37 | + $m->salva(); | ||
38 | + $m = new Temas($map_file,$tema); | ||
37 | $retorno = $m->insereFiltro(base64_decode($_GET["filtro"]),$_GET["testa"],$_GET["base64"]); | 39 | $retorno = $m->insereFiltro(base64_decode($_GET["filtro"]),$_GET["testa"],$_GET["base64"]); |
38 | if(strtolower($_GET["testa"]) != "sim"){ | 40 | if(strtolower($_GET["testa"]) != "sim"){ |
39 | $m->salva(); | 41 | $m->salva(); |
ferramentas/identifica/index.js
@@ -957,12 +957,15 @@ i3GEOF.identifica = | @@ -957,12 +957,15 @@ i3GEOF.identifica = | ||
957 | return; | 957 | return; |
958 | } | 958 | } |
959 | i3GEOF.identifica.propJanelas[idjanela].aguarde.visibility = "visible"; | 959 | i3GEOF.identifica.propJanelas[idjanela].aguarde.visibility = "visible"; |
960 | - var filtro = "('[" + item + "]' = '" + valor + "')", temp = function(retorno) { | ||
961 | - i3GEOF.identifica.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
962 | - i3GEO.Interface.atualizaTema(retorno, tema); | ||
963 | - }, p = | ||
964 | - i3GEO.configura.locaplic + "/ferramentas/filtro/exec.php?base64=sim&g_sid=" + i3GEO.configura.sid + "&funcao=inserefiltro", cp = | ||
965 | - new cpaint(); | 960 | + var filtro = "", |
961 | + temp = function(retorno) { | ||
962 | + i3GEOF.identifica.propJanelas[idjanela].aguarde.visibility = "hidden"; | ||
963 | + i3GEO.Interface.atualizaTema(retorno, tema); | ||
964 | + }, | ||
965 | + p = i3GEO.configura.locaplic + "/ferramentas/filtro/exec.php?base64=sim&g_sid=" + i3GEO.configura.sid + "&funcao=inserefiltro", | ||
966 | + cp = new cpaint(); | ||
967 | + | ||
968 | + filtro = "(*[" + item + "]* = *" + valor + "*)"; | ||
966 | cp.set_response_type("JSON"); | 969 | cp.set_response_type("JSON"); |
967 | cp.set_transfer_mode('POST'); | 970 | cp.set_transfer_mode('POST'); |
968 | cp.call(p, "insereFiltro", temp, "tema=" + tema + "&filtro=" + i3GEO.util.base64encode(filtro)); | 971 | cp.call(p, "insereFiltro", temp, "tema=" + tema + "&filtro=" + i3GEO.util.base64encode(filtro)); |