Commit 16536148a3c4b086e11bd6bb2c38e18b5e99f986

Authored by Edmar Moretti
1 parent 88f3d8dc

Inclusão de função em core.js para filtrar listas pela letra inicial

Showing 2 changed files with 36 additions and 11 deletions   Show diff stats
admin/html/editormapfile.html
@@ -134,11 +134,12 @@ body { @@ -134,11 +134,12 @@ body {
134 if (screen.availWidth > 700) { 134 if (screen.availWidth > 700) {
135 document.getElementById("divGeral").style.width = "700px"; 135 document.getElementById("divGeral").style.width = "700px";
136 } 136 }
137 - var letras = "Todos A B C D E F G H I J K L M N O P Q R S T U V X Y Z _ 1 2 3 4 5 6 7 8 9"  
138 - .split(" "), nletras = letras.length, letraAtual = "", i, ins = "";  
139 - if (i3GEO.util.pegaCookie("I3GEOletraAdmin")) { 137 + if(i3GEO.util.pegaCookie("I3GEOletraAdmin")) {
140 letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin"); 138 letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin");
141 } 139 }
  140 + else{
  141 + letraAtual = "";
  142 + }
142 function filtraLetra(letra) { 143 function filtraLetra(letra) {
143 letraAtual = letra; 144 letraAtual = letra;
144 document.getElementById("tabela").innerHTML = "<span style=color:red >Aguarde...</span>"; 145 document.getElementById("tabela").innerHTML = "<span style=color:red >Aguarde...</span>";
@@ -156,7 +157,7 @@ body { @@ -156,7 +157,7 @@ body {
156 // 157 //
157 cabecalhoGeral("cabecalhoPrincipal", "editormapfile"); 158 cabecalhoGeral("cabecalhoPrincipal", "editormapfile");
158 temp = function() { 159 temp = function() {
159 - ins += "<p>Filtrar: " 160 + var ins = "<p>Filtrar: "
160 + "<select id='selFiltro' onchange='filtraLetra(\"" 161 + "<select id='selFiltro' onchange='filtraLetra(\""
161 + letraAtual 162 + letraAtual
162 + "\")' >" 163 + "\")' >"
@@ -175,14 +176,9 @@ body { @@ -175,14 +176,9 @@ body {
175 + letraAtual 176 + letraAtual
176 + "\")' type=checkbox id=mostraMini style=position:relative;top:2px; />Mostra a miniatura se houver"; 177 + "\")' type=checkbox id=mostraMini style=position:relative;top:2px; />Mostra a miniatura se houver";
177 178
178 - ins += "<p>";  
179 - for (var i = 0; i < nletras; i++) {  
180 - ins += "<span onclick='filtraLetra(\""  
181 - + letras[i]  
182 - + "\")' style='color:blue;cursor:pointer;padding:1px;border: 1px solid #C8C8FA'>"  
183 - + letras[i] + "</span>&nbsp;";  
184 - } 179 + ins += "<p><div id=filtroDeLetras ></div>";
185 document.getElementById("letras").innerHTML = ins; 180 document.getElementById("letras").innerHTML = ins;
  181 + core_listaDeLetras("filtroDeLetras","filtraLetra");
186 document.getElementById("formulario").style.display = "block"; 182 document.getElementById("formulario").style.display = "block";
187 initMenu(); 183 initMenu();
188 } 184 }
admin/js/core.js
@@ -1460,6 +1460,35 @@ function core_ativaforms(lista){ @@ -1460,6 +1460,35 @@ function core_ativaforms(lista){
1460 $i(lista[i]).style.background = "white"; 1460 $i(lista[i]).style.background = "white";
1461 } 1461 }
1462 } 1462 }
  1463 +function core_listaDeLetras(onde,nomeFuncao){
  1464 + //letraAtual guarda a última letra clicada
  1465 + var o,i,ins= "",
  1466 + letras = ["Todos","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z","_","1","2","3","4","5","6","7","8","9"],
  1467 + nletras = letras.length;
  1468 + if(!i3GEO.util){
  1469 + alert("Erro i3GEO.util ???");
  1470 + return;
  1471 + }
  1472 + letraAtual = "";
  1473 + if(i3GEO.util.pegaCookie("I3GEOletraAdmin")) {
  1474 + letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin");
  1475 + }
  1476 + for (i = 0; i < nletras; i++) {
  1477 + ins += "<span onclick='"+nomeFuncao+"(\""
  1478 + + letras[i]
  1479 + + "\")' style='color:blue;cursor:pointer;padding:1px;border: 1px solid #C8C8FA'>"
  1480 + + letras[i] + "</span>&nbsp;";
  1481 + }
  1482 + if(onde != ""){
  1483 + o = document.getElementById(onde);
  1484 + if(o){
  1485 + o.innerHTML = ins;
  1486 + }
  1487 + }
  1488 + else{
  1489 + return ins;
  1490 + }
  1491 +}
1463 // 1492 //
1464 //carregador de javascript 1493 //carregador de javascript
1465 // 1494 //