Commit 1609b6c72c01d3c79ae6da8e448fee044a18f2d6
1 parent
4589fa5c
Exists in
master
and in
7 other branches
Inclusão de busca no menu de temas na opção de busca rápida
Showing
2 changed files
with
62 additions
and
7 deletions
Show diff stats
classesphp/classe_menutemas.php
| ... | ... | @@ -360,10 +360,11 @@ $procurar - String que será procurada. |
| 360 | 360 | foreach($this->xml->GRUPO as $grupo) |
| 361 | 361 | { |
| 362 | 362 | $incluigrupo = TRUE; |
| 363 | - if ($grupo->PERFIL != "") | |
| 363 | + $temp = mb_convert_encoding($grupo->PERFIL,"HTML-ENTITIES","auto"); | |
| 364 | + if ($temp != "") | |
| 364 | 365 | { |
| 365 | 366 | $incluigrupo = FALSE; |
| 366 | - $perfis = explode(",",$grupo->PERFIL); | |
| 367 | + $perfis = explode(",",$temp); | |
| 367 | 368 | if (in_array($this->perfil,$perfis)) |
| 368 | 369 | {$incluigrupo = TRUE;} |
| 369 | 370 | } |
| ... | ... | @@ -374,7 +375,8 @@ $procurar - String que será procurada. |
| 374 | 375 | $incluisgrupo = TRUE; |
| 375 | 376 | if ($this->perfil != "") |
| 376 | 377 | { |
| 377 | - $perfis = explode(",",$sgrupo->PERFIL); | |
| 378 | + $temp = mb_convert_encoding($sgrupo->PERFIL,"HTML-ENTITIES","auto"); | |
| 379 | + $perfis = explode(",",$temp); | |
| 378 | 380 | if (!in_array($this->perfil,$perfis)) |
| 379 | 381 | {$incluisgrupo = FALSE;} |
| 380 | 382 | } |
| ... | ... | @@ -385,22 +387,24 @@ $procurar - String que será procurada. |
| 385 | 387 | $inclui = TRUE; |
| 386 | 388 | if ($this->perfil != "") |
| 387 | 389 | { |
| 388 | - $perfis = explode(",",$tema->PERFIL); | |
| 390 | + $temp = mb_convert_encoding($tema->PERFIL,"HTML-ENTITIES","auto"); | |
| 391 | + $perfis = explode(",",$temp); | |
| 389 | 392 | if (!in_array($this->perfil,$perfis)) |
| 390 | 393 | {$inclui = FALSE;} |
| 391 | 394 | } |
| 392 | 395 | if ($inclui == TRUE) |
| 393 | 396 | { |
| 394 | 397 | $down = "nao"; |
| 395 | - if (($tema->DOWNLOAD == "sim") || ($tema->DOWNLOAD == "SIM")) | |
| 398 | + $temp = mb_convert_encoding($tema->DOWNLOAD,"HTML-ENTITIES","auto"); | |
| 399 | + if (($temp == "sim") || ($temp == "SIM")) | |
| 396 | 400 | {$down = "sim";} |
| 397 | - $link = mb_convert_encoding($tema->TLINK,"HTML-ENTITIES","auto");; | |
| 401 | + $link = mb_convert_encoding($tema->TLINK,"HTML-ENTITIES","auto"); | |
| 398 | 402 | $tid = mb_convert_encoding($tema->TID,"HTML-ENTITIES","auto"); |
| 399 | 403 | if (function_exists("mb_convert_encoding")) |
| 400 | 404 | {$texto = array("tid"=>$tid,"nome"=>(mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto")),"link"=>$link,"download"=>$down);} |
| 401 | 405 | else |
| 402 | 406 | {$texto = array("tid"=>$tid,"nome"=>$tema->TNOME,"link"=>$link,"download"=>$down);} |
| 403 | - if (stristr((mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto")),$procurar)) | |
| 407 | + if ((stristr(mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto"),$procurar)) || (stristr(mb_convert_encoding($tema->TNOME,"HTML-ENTITIES","auto"),htmlentities($procurar)))) | |
| 404 | 408 | {$listadetemas[] = $texto;} |
| 405 | 409 | } |
| 406 | 410 | } | ... | ... |
ferramentas/buscarapida/index.js
| ... | ... | @@ -48,6 +48,13 @@ function busca() |
| 48 | 48 | ins += "</table>" |
| 49 | 49 | } |
| 50 | 50 | $i("resultado").innerHTML = ins |
| 51 | + var palavra = window.parent.document.getElementById("valorBuscaRapida").value | |
| 52 | + var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=procurartemas&procurar="+palavra+"&g_sid="+g_sid; | |
| 53 | + var cp = new cpaint(); | |
| 54 | + //cp.set_debug(2); | |
| 55 | + cp.set_response_type("json"); | |
| 56 | + cp.call(p,"procurartemas",resultadoTemas); | |
| 57 | + | |
| 51 | 58 | } |
| 52 | 59 | $i("resultado").innerHTML = "Aguarde..." |
| 53 | 60 | var palavra = window.parent.document.getElementById("valorBuscaRapida").value |
| ... | ... | @@ -58,6 +65,50 @@ function busca() |
| 58 | 65 | cp.set_response_type("json"); |
| 59 | 66 | cp.call(p,"buscaRapida",listaretorno); |
| 60 | 67 | } |
| 68 | +function resultadoTemas(retorno) | |
| 69 | +{ | |
| 70 | + var retorno = retorno.data; | |
| 71 | + if ((retorno != "erro") && (retorno != undefined)) | |
| 72 | + { | |
| 73 | + var ins = ""; | |
| 74 | + for (ig=0;ig<retorno.length;ig++) | |
| 75 | + { | |
| 76 | + var ngSgrupo = retorno[ig].subgrupos; | |
| 77 | + for (sg=0;sg<ngSgrupo.length;sg++) | |
| 78 | + { | |
| 79 | + var nomeSgrupo = ngSgrupo[sg].subgrupo; | |
| 80 | + var ngTema = ngSgrupo[sg].temas; | |
| 81 | + for (st=0;st<ngTema.length;st++) | |
| 82 | + { | |
| 83 | + if ( ngTema[st].link != " ") | |
| 84 | + {var lk = "<a href="+ngTema[st].link+" target=blank> fonte</a>";} | |
| 85 | + var tid = ngTema[st].tid; | |
| 86 | + var inp = "<input style='text-align:left;cursor:pointer;' onclick='adicionatema(this)' class=inputsb style='cursor:pointer' type=\"checkbox\" value='"+tid+"' /> ("+nomeSgrupo+")"; | |
| 87 | + var nomeTema = inp+(ngTema[st].nome)+lk+"<br>"; | |
| 88 | + ins += nomeTema; | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 92 | + if (ins != "") | |
| 93 | + { | |
| 94 | + $i("resultado").innerHTML += "<br><b>Temas:</b><br>"+ins | |
| 95 | + } | |
| 96 | + } | |
| 97 | +} | |
| 98 | +function adicionatema(obj) | |
| 99 | +{ | |
| 100 | + if (obj.checked) | |
| 101 | + { | |
| 102 | + window.parent.objaguarde.abre("ajaxredesenha","Aguarde..."); | |
| 103 | + var temp = function() | |
| 104 | + {window.parent.ajaxredesenha("");} | |
| 105 | + var p = window.parent.g_locaplic+"/classesphp/mapa_controle.php?funcao=adtema&temas="+obj.value+"&g_sid="+g_sid; | |
| 106 | + var cp = new cpaint(); | |
| 107 | + //cp.set_debug(2) | |
| 108 | + cp.set_response_type("JSON"); | |
| 109 | + cp.call(p,"adicionaTema",temp); | |
| 110 | + } | |
| 111 | +} | |
| 61 | 112 | function mostraxy(wkt) |
| 62 | 113 | { |
| 63 | 114 | var re = new RegExp("POLYGON", "g") | ... | ... |