Commit 8b546b2177b2ac8d3885fe64f2d094658b017de0

Authored by Edmar Moretti
1 parent c81ddb3f

Corrigido as funções de busca no menutemas.xml. A acentuação não estava funcionando corretamente

classesphp/classe_menutemas.php
... ... @@ -404,7 +404,14 @@ $procurar - String que será procurada.
404 404 {$texto = array("tid"=>$tid,"nome"=>(mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto")),"link"=>$link,"download"=>$down);}
405 405 else
406 406 {$texto = array("tid"=>$tid,"nome"=>$tema->TNOME,"link"=>$link,"download"=>$down);}
407   - if ((stristr(mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto"),$procurar)) || (stristr(mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto"),htmlentities($procurar))))
  407 + $p1 = $this->removeAcentos($procurar);
  408 + $p1 = $this->removeAcentos(htmlentities($p1));
  409 +
  410 + $pp1 = $this->removeAcentos(mb_convert_encoding($tema->TNOME,"auto","auto"));
  411 + $pp1 = $this->removeAcentos(mb_convert_encoding($tema->TNOME,"auto","auto"));
  412 + $pp1 = $this->removeAcentos(htmlentities($pp1));
  413 + //$listadetemas[] = array("tid"=>"","nome"=>$pp1);
  414 + if (stristr($pp1,$p1))
408 415 {$listadetemas[] = $texto;}
409 416 }
410 417 }
... ... @@ -431,5 +438,22 @@ $procurar - String que será procurada.
431 438 }
432 439 return ($resultado);
433 440 }
  441 + function removeAcentos($s)
  442 + {
  443 + $s = ereg_replace("[áàâã]","a",$s);
  444 + $s = ereg_replace("[ÁÀÂÃ]","A",$s);
  445 + $s = ereg_replace("[éèê]","e",$s);
  446 + $s = ereg_replace("[í]","i",$s);
  447 + $s = ereg_replace("[Í]","I",$s);
  448 + $s = ereg_replace("[ÉÈÊ]","E",$s);
  449 + $s = ereg_replace("[óòôõ]","o",$s);
  450 + $s = ereg_replace("[ÓÒÔÕ]","O",$s);
  451 + $s = ereg_replace("[úùû]","u",$s);
  452 + $s = ereg_replace("[ÚÙÛ]","U",$s);
  453 + $s = str_replace("ç","c",$s);
  454 + $s = str_replace("Ç","C",$s);
  455 + //$s = ereg_replace(" ","",$s);
  456 + return $s;
  457 + }
434 458 }
435 459 ?>
436 460 \ No newline at end of file
... ...
ferramentas/buscarapida/index.js
... ... @@ -28,27 +28,30 @@ function busca()
28 28 var listaretorno = function(retorno)
29 29 {
30 30 var ins = "Nada encontrado";
31   - if (retorno.data.geonames)
  31 + if (retorno.data)
32 32 {
33   - for (i=0;i<retorno.data.geonames.length; i++)
  33 + if (retorno.data.geonames)
34 34 {
35   - if (i == 0){var ins = "<table>";}
36   - ins += "<tr><td style='width:30%;text-align:left;background-color:rgb(220,220,220)' colspan=2 ><b>"+retorno.data.geonames[i].tema+"</b></td></tr>";
37   - var layer = retorno.data.geonames[i].layer
38   - for (j=0;j<retorno.data.geonames[i].lugares.length; j++)
  35 + for (i=0;i<retorno.data.geonames.length; i++)
39 36 {
40   - ins += "<tr><td style='text-align:left'>"
41   - var nm = retorno.data.geonames[i].lugares[j].nome;
42   - ins += nm;
43   - var wkt = retorno.data.geonames[i].lugares[j].limite
44   - var gid = retorno.data.geonames[i].lugares[j].gid
45   - ins += "</td><td onclick=\"zoom('"+wkt+"','"+layer+"','"+gid+"','"+nm+"')\" onmouseover=\"mostraxy('"+wkt+"')\" onmouseout='escondexy()' style='color:blue;cursor:pointer'>zoom</td></tr>"
  37 + if (i == 0){var ins = "<table>";}
  38 + ins += "<tr><td style='width:30%;text-align:left;background-color:rgb(220,220,220)' colspan=2 ><b>"+retorno.data.geonames[i].tema+"</b></td></tr>";
  39 + var layer = retorno.data.geonames[i].layer
  40 + for (j=0;j<retorno.data.geonames[i].lugares.length; j++)
  41 + {
  42 + ins += "<tr><td style='text-align:left'>"
  43 + var nm = retorno.data.geonames[i].lugares[j].nome;
  44 + ins += nm;
  45 + var wkt = retorno.data.geonames[i].lugares[j].limite
  46 + var gid = retorno.data.geonames[i].lugares[j].gid
  47 + ins += "</td><td onclick=\"zoom('"+wkt+"','"+layer+"','"+gid+"','"+nm+"')\" onmouseover=\"mostraxy('"+wkt+"')\" onmouseout='escondexy()' style='color:blue;cursor:pointer'>zoom</td></tr>"
  48 + }
46 49 }
47 50 }
48 51 ins += "</table>"
49 52 }
50 53 $i("resultado").innerHTML = ins
51   - var palavra = window.parent.document.getElementById("valorBuscaRapida").value
  54 + //var palavra = window.parent.document.getElementById("valorBuscaRapida").value
52 55 var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=procurartemas&procurar="+palavra+"&g_sid="+g_sid;
53 56 var cp = new cpaint();
54 57 //cp.set_debug(2);
... ... @@ -80,7 +83,7 @@ function resultadoTemas(retorno)
80 83 var ngTema = ngSgrupo[sg].temas;
81 84 for (st=0;st<ngTema.length;st++)
82 85 {
83   - if ( ngTema[st].link != " ")
  86 + if (ngTema[st].link != " ")
84 87 {var lk = "<a href="+ngTema[st].link+" target=blank>&nbsp;fonte</a>";}
85 88 var tid = ngTema[st].tid;
86 89 var inp = "<input style='text-align:left;cursor:pointer;' onclick='adicionatema(this)' class=inputsb style='cursor:pointer' type=\"checkbox\" value='"+tid+"' /> ("+nomeSgrupo+")";
... ...