Commit fe1986fdba657b38f88c73fc7a24db3296661365
1 parent
b787ef65
Exists in
master
and in
7 other branches
v6 - inclusão de codificação base64 na ferramenta filtro (ao aplicar um filtro)
Showing
3 changed files
with
17 additions
and
33 deletions
Show diff stats
classesphp/classe_temas.php
@@ -493,16 +493,18 @@ $filtro - string com o filtro. As aspas simples devem ser substituídas po | @@ -493,16 +493,18 @@ $filtro - string com o filtro. As aspas simples devem ser substituídas po | ||
493 | 493 | ||
494 | $testa - Testa o filtro e retorna uma imagem. | 494 | $testa - Testa o filtro e retorna uma imagem. |
495 | */ | 495 | */ |
496 | - function insereFiltro($filtro,$testa="") | 496 | + function insereFiltro($filtro,$testa="",$base64="nao") |
497 | { | 497 | { |
498 | + if($base64 == "sim"){ | ||
499 | + $filtro = base64_decode($filtro); | ||
500 | + } | ||
498 | foreach($this->indices as $indice){ | 501 | foreach($this->indices as $indice){ |
499 | $layer = $this->mapa->getlayer($indice); | 502 | $layer = $this->mapa->getlayer($indice); |
500 | if(!$layer){return "erro";} | 503 | if(!$layer){return "erro";} |
501 | $layer->setmetadata("cache",""); | 504 | $layer->setmetadata("cache",""); |
502 | $fil = $layer->getFilterString(); | 505 | $fil = $layer->getFilterString(); |
503 | $filtro = str_replace("|","'",$filtro); | 506 | $filtro = str_replace("|","'",$filtro); |
504 | - if ($layer->connectiontype == MS_POSTGIS) | ||
505 | - { | 507 | + if ($layer->connectiontype == MS_POSTGIS){ |
506 | $filtro = str_replace("'[","",$filtro); | 508 | $filtro = str_replace("'[","",$filtro); |
507 | $filtro = str_replace("[","",$filtro); | 509 | $filtro = str_replace("[","",$filtro); |
508 | $filtro = str_replace("]'","",$filtro); | 510 | $filtro = str_replace("]'","",$filtro); |
@@ -510,37 +512,20 @@ $testa - Testa o filtro e retorna uma imagem. | @@ -510,37 +512,20 @@ $testa - Testa o filtro e retorna uma imagem. | ||
510 | $filtro = str_replace("("," ",$filtro); | 512 | $filtro = str_replace("("," ",$filtro); |
511 | $filtro = str_replace(")"," ",$filtro); | 513 | $filtro = str_replace(")"," ",$filtro); |
512 | } | 514 | } |
513 | - if ($filtro == "") | ||
514 | - {$layer->setfilter($filtro);} | ||
515 | - else | ||
516 | - { | 515 | + if ($filtro == ""){ |
516 | + $layer->setfilter($filtro); | ||
517 | + } | ||
518 | + else{ | ||
517 | $layer->setfilter($filtro); | 519 | $layer->setfilter($filtro); |
518 | $v = versao(); | 520 | $v = versao(); |
519 | //corrige bug do mapserver | 521 | //corrige bug do mapserver |
520 | - if (($v["completa"] == "4.10.0") && ($layer->connectiontype == MS_POSTGIS)) | ||
521 | - {$layer->setfilter("\"".$filtro."\"");} | ||
522 | - } | ||
523 | - if ($testa == "") | ||
524 | - { | ||
525 | - $layer->setMetaData("cache",""); | ||
526 | - /* | ||
527 | - $img = $this->mapa->prepareimage(); | ||
528 | - if ($this->layer->draw($img) == 0) | ||
529 | - { | ||
530 | - $this->layer->setMetaData("cache",""); | ||
531 | - return ("ok"); | 522 | + if (($v["completa"] == "4.10.0") && ($layer->connectiontype == MS_POSTGIS)){ |
523 | + $layer->setfilter("\"".$filtro."\""); | ||
532 | } | 524 | } |
533 | - else | ||
534 | - {return ("erro. Problemas com o filtro."." ".$filtro);} | ||
535 | - */ | ||
536 | } | 525 | } |
537 | - /* | ||
538 | - else | ||
539 | - { | ||
540 | - $i = gravaImagemMapa($this->mapa); | ||
541 | - return ($i["url"]); | 526 | + if ($testa == ""){ |
527 | + $layer->setMetaData("cache",""); | ||
542 | } | 528 | } |
543 | - */ | ||
544 | } | 529 | } |
545 | if ($testa != ""){ | 530 | if ($testa != ""){ |
546 | $i = gravaImagemMapa($this->mapa); | 531 | $i = gravaImagemMapa($this->mapa); |
ferramentas/filtro/exec.php
@@ -30,9 +30,8 @@ Inclui um filtro no tema. | @@ -30,9 +30,8 @@ Inclui um filtro no tema. | ||
30 | copiaSeguranca($map_file); | 30 | copiaSeguranca($map_file); |
31 | $m = new Temas($map_file,$tema); | 31 | $m = new Temas($map_file,$tema); |
32 | if(!isset($testa)){$testa="";} | 32 | if(!isset($testa)){$testa="";} |
33 | - {$retorno = $m->insereFiltro($filtro,$testa);} | ||
34 | - if(strtolower($testa) != "sim") | ||
35 | - { | 33 | + {$retorno = $m->insereFiltro($filtro,$testa,"sim");} |
34 | + if(strtolower($testa) != "sim"){ | ||
36 | $m->salva(); | 35 | $m->salva(); |
37 | $_SESSION["contadorsalva"]++; | 36 | $_SESSION["contadorsalva"]++; |
38 | redesenhaMapa(); | 37 | redesenhaMapa(); |
ferramentas/filtro/index.js
@@ -418,7 +418,7 @@ i3GEOF.filtro = { | @@ -418,7 +418,7 @@ i3GEOF.filtro = { | ||
418 | } | 418 | } |
419 | } | 419 | } |
420 | } | 420 | } |
421 | - p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro"; | 421 | + p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?base64=sim&g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro"; |
422 | cp = new cpaint(); | 422 | cp = new cpaint(); |
423 | cp.set_response_type("JSON"); | 423 | cp.set_response_type("JSON"); |
424 | cp.set_transfer_mode('POST'); | 424 | cp.set_transfer_mode('POST'); |
@@ -436,7 +436,7 @@ i3GEOF.filtro = { | @@ -436,7 +436,7 @@ i3GEOF.filtro = { | ||
436 | i3GEOF.filtro.aguarde.visibility = "hidden"; | 436 | i3GEOF.filtro.aguarde.visibility = "hidden"; |
437 | }; | 437 | }; |
438 | } | 438 | } |
439 | - cp.call(p,"insereFiltro",temp,"tema="+i3GEO.temaAtivo,"filtro="+filtro,"testa="+testa); | 439 | + cp.call(p,"insereFiltro",temp,"tema="+i3GEO.temaAtivo,"filtro="+i3GEO.util.base64encode(filtro),"testa="+testa); |
440 | } | 440 | } |
441 | catch(e){ | 441 | catch(e){ |
442 | i3GEO.janela.tempoMsg("Erro: "+e); | 442 | i3GEO.janela.tempoMsg("Erro: "+e); |