Commit 1ff56fce0da835e62a2a1f293fb6f0175d70aee3
1 parent
70fbe409
Exists in
master
and in
7 other branches
Opção para listar valores de uma tabela no editor de sql do sistema de administração
Showing
6 changed files
with
50 additions
and
16 deletions
Show diff stats
admin/js/estat_editor.js
@@ -337,14 +337,24 @@ i3GEOadmin.editor = { | @@ -337,14 +337,24 @@ i3GEOadmin.editor = { | ||
337 | } | 337 | } |
338 | } | 338 | } |
339 | }, | 339 | }, |
340 | - mostrar: function(){ | ||
341 | - if($i("i3GEOadmintabela").value == ""){ | 340 | + mostrar: function(nreg, nome_tabela, nomeEsquema, codigo_estat_conexao, w){ |
341 | + if(!nome_tabela && $i("i3GEOadmintabela").value == ""){ | ||
342 | alert("Escolha a tabela"); | 342 | alert("Escolha a tabela"); |
343 | return; | 343 | return; |
344 | } | 344 | } |
345 | - | ||
346 | - var nreg = window.prompt("Numero maximo de registros"), | ||
347 | - callback = { | 345 | + if(!nome_tabela){ |
346 | + nome_tabela = $i("i3GEOadmintabela").value; | ||
347 | + } | ||
348 | + if(!nomeEsquema){ | ||
349 | + nomeEsquema = $i("i3GEOadminesquema").value; | ||
350 | + } | ||
351 | + if(!codigo_estat_conexao){ | ||
352 | + codigo_estat_conexao = $i("i3GEOadmincodigo_estat_conexao").value; | ||
353 | + } | ||
354 | + if(!nreg){ | ||
355 | + nreg = window.prompt("Numero maximo de registros"); | ||
356 | + } | ||
357 | + var callback = { | ||
348 | success:function(o){ | 358 | success:function(o){ |
349 | try { | 359 | try { |
350 | core_carregando("desativa"); | 360 | core_carregando("desativa"); |
@@ -353,7 +363,7 @@ i3GEOadmin.editor = { | @@ -353,7 +363,7 @@ i3GEOadmin.editor = { | ||
353 | linhas = dados.linhas, | 363 | linhas = dados.linhas, |
354 | nlinhas = linhas.length, | 364 | nlinhas = linhas.length, |
355 | tabela = [], | 365 | tabela = [], |
356 | - i,j,l,w; | 366 | + i,j,l; |
357 | tabela.push("<head><body><table style='border:1px solid black'><tr>"); | 367 | tabela.push("<head><body><table style='border:1px solid black'><tr>"); |
358 | for(i=0;i<ncolunas;i++){ | 368 | for(i=0;i<ncolunas;i++){ |
359 | tabela.push("<td style='border:1px solid gray' >"+dados.nomescolunas[i]+"</td>"); | 369 | tabela.push("<td style='border:1px solid gray' >"+dados.nomescolunas[i]+"</td>"); |
@@ -368,7 +378,9 @@ i3GEOadmin.editor = { | @@ -368,7 +378,9 @@ i3GEOadmin.editor = { | ||
368 | tabela.push("</tr>"); | 378 | tabela.push("</tr>"); |
369 | } | 379 | } |
370 | tabela.push("</table></body></head>"); | 380 | tabela.push("</table></body></head>"); |
371 | - w = window.open(); | 381 | + if (!w){ |
382 | + w = window.open(); | ||
383 | + } | ||
372 | w.document.write(tabela.join("")); | 384 | w.document.write(tabela.join("")); |
373 | w.document.close(); | 385 | w.document.close(); |
374 | } | 386 | } |
@@ -376,10 +388,9 @@ i3GEOadmin.editor = { | @@ -376,10 +388,9 @@ i3GEOadmin.editor = { | ||
376 | }, | 388 | }, |
377 | failure:core_handleFailure, | 389 | failure:core_handleFailure, |
378 | argument: { foo:"foo", bar:"bar" } | 390 | argument: { foo:"foo", bar:"bar" } |
379 | - }, | ||
380 | - nomeEsquema = $i("i3GEOadminesquema").value; | 391 | + }; |
381 | core_carregando("obtendo dados..."); | 392 | core_carregando("obtendo dados..."); |
382 | - core_makeRequest("../php/metaestat.php?funcao=obtemDadosTabelaDB&nreg="+nreg+"&geo=nao&formato=json&nome_tabela="+$i("i3GEOadmintabela").value+"&nome_esquema="+nomeEsquema+"&codigo_estat_conexao="+$i("i3GEOadmincodigo_estat_conexao").value,callback); | 393 | + core_makeRequest("../php/metaestat.php?funcao=obtemDadosTabelaDB&nreg="+nreg+"&geo=nao&formato=json&nome_tabela="+nome_tabela+"&nome_esquema="+nomeEsquema+"&codigo_estat_conexao="+codigo_estat_conexao,callback); |
383 | }, | 394 | }, |
384 | csv: function(){ | 395 | csv: function(){ |
385 | if($i("i3GEOadmintabela").value == ""){ | 396 | if($i("i3GEOadmintabela").value == ""){ |
classesjs/classe_barradebotoes.js
@@ -822,7 +822,6 @@ i3GEO.barraDeBotoes = | @@ -822,7 +822,6 @@ i3GEO.barraDeBotoes = | ||
822 | l[b].funcaoonclick(); | 822 | l[b].funcaoonclick(); |
823 | } | 823 | } |
824 | } | 824 | } |
825 | - // TODO remover eval | ||
826 | if (l[b] && l[b].constroiconteudo) { | 825 | if (l[b] && l[b].constroiconteudo) { |
827 | eval(l[b].constroiconteudo); | 826 | eval(l[b].constroiconteudo); |
828 | } | 827 | } |
ferramentas/buscainde/index.js
@@ -40,7 +40,6 @@ if(typeof(i3GEOF) === 'undefined'){ | @@ -40,7 +40,6 @@ if(typeof(i3GEOF) === 'undefined'){ | ||
40 | Classe: i3GEOF.buscainde | 40 | Classe: i3GEOF.buscainde |
41 | 41 | ||
42 | */ | 42 | */ |
43 | -//TODO quando o layer estiver definido no endereco do servico, abrir direto a camada no mapa | ||
44 | i3GEOF.buscainde = { | 43 | i3GEOF.buscainde = { |
45 | /* | 44 | /* |
46 | Variavel: aguarde | 45 | Variavel: aguarde |
ferramentas/editorsql/index.js
@@ -41,7 +41,6 @@ if(typeof(i3GEOF) === 'undefined'){ | @@ -41,7 +41,6 @@ if(typeof(i3GEOF) === 'undefined'){ | ||
41 | /* | 41 | /* |
42 | Classe: i3GEOF.editorsql | 42 | Classe: i3GEOF.editorsql |
43 | */ | 43 | */ |
44 | -//TODO incluir opcao para listar uma amostra dos valores de uma coluna | ||
45 | //TODO incluir editor de filtro | 44 | //TODO incluir editor de filtro |
46 | i3GEOF.editorsql = { | 45 | i3GEOF.editorsql = { |
47 | /* | 46 | /* |
ferramentas/navegapostgis/dicionario.js
@@ -54,5 +54,10 @@ i3GEOF.navegapostgis.dicionario = { | @@ -54,5 +54,10 @@ i3GEOF.navegapostgis.dicionario = { | ||
54 | pt : "Escolha a coluna", | 54 | pt : "Escolha a coluna", |
55 | en : "", | 55 | en : "", |
56 | es : "" | 56 | es : "" |
57 | + } ], | ||
58 | + 'lista' : [ { | ||
59 | + pt : "Amostra de dados", | ||
60 | + en : "", | ||
61 | + es : "" | ||
57 | } ] | 62 | } ] |
58 | }; | 63 | }; |
ferramentas/navegapostgis/index.js
@@ -113,6 +113,19 @@ i3GEOF.navegapostgis = { | @@ -113,6 +113,19 @@ i3GEOF.navegapostgis = { | ||
113 | }}} | 113 | }}} |
114 | ); | 114 | ); |
115 | } | 115 | } |
116 | + if($i("i3GEOFnavegapostgisLista")){ | ||
117 | + new YAHOO.widget.Button( | ||
118 | + "i3GEOFnavegapostgisLista", | ||
119 | + {onclick:{fn: function(){ | ||
120 | + window.open( | ||
121 | + i3GEO.configura.locaplic+"/admin/php/listadadostabela.php?nreg=50&nome_tabela=" + i3GEOF.navegapostgis.tabela | ||
122 | + +"&nomeEsquema=" + i3GEOF.navegapostgis.esquema | ||
123 | + +"&codigo_estat_conexao=" + i3GEOF.navegapostgis.conexao | ||
124 | + ); | ||
125 | + }}} | ||
126 | + ); | ||
127 | + } | ||
128 | + | ||
116 | var conexao = function(retorno){ | 129 | var conexao = function(retorno){ |
117 | var ins = "<select style='width:200px;' onchange='i3GEOF.navegapostgis.montaArvore(this.value)'><option value='' >---</option>", | 130 | var ins = "<select style='width:200px;' onchange='i3GEOF.navegapostgis.montaArvore(this.value)'><option value='' >---</option>", |
118 | n = retorno.length, | 131 | n = retorno.length, |
@@ -132,7 +145,13 @@ i3GEOF.navegapostgis = { | @@ -132,7 +145,13 @@ i3GEOF.navegapostgis = { | ||
132 | if(botao){ | 145 | if(botao){ |
133 | botao.style.position = "absolute"; | 146 | botao.style.position = "absolute"; |
134 | botao.style.top = "230px"; | 147 | botao.style.top = "230px"; |
135 | - botao.style.left = "70px"; | 148 | + botao.style.left = "5px"; |
149 | + } | ||
150 | + botao = $i("i3GEOFnavegapostgisLista"); | ||
151 | + if(botao){ | ||
152 | + botao.style.position = "absolute"; | ||
153 | + botao.style.top = "230px"; | ||
154 | + botao.style.left = "80px"; | ||
136 | } | 155 | } |
137 | cpJSON.call(p,"foo",conexao); | 156 | cpJSON.call(p,"foo",conexao); |
138 | /* | 157 | /* |
@@ -167,7 +186,9 @@ i3GEOF.navegapostgis = { | @@ -167,7 +186,9 @@ i3GEOF.navegapostgis = { | ||
167 | "<textarea id=i3GEOFnavegapostgisSql style='width: 313px;overflow: auto;height: 104px;border: 1px solid lightgray;position: absolute;left:223px;top: 190px;'> "+ | 186 | "<textarea id=i3GEOFnavegapostgisSql style='width: 313px;overflow: auto;height: 104px;border: 1px solid lightgray;position: absolute;left:223px;top: 190px;'> "+ |
168 | "</textarea>"; | 187 | "</textarea>"; |
169 | if(i3GEOF.navegapostgis.tipo == "sql"){ | 188 | if(i3GEOF.navegapostgis.tipo == "sql"){ |
170 | - ins += "<input style='position:absolute;top:235px;left:70px;' id=i3GEOFnavegapostgisAplicar type='button' value='"+$trad('aplica',i3GEOF.navegapostgis.dicionario)+"' />"; | 189 | + ins += "<input id=i3GEOFnavegapostgisAplicar type='button' value='"+$trad('aplica',i3GEOF.navegapostgis.dicionario)+"' />"; |
190 | + ins += "<input id=i3GEOFnavegapostgisLista type='button' value='"+$trad('lista',i3GEOF.navegapostgis.dicionario)+"' />"; | ||
191 | + | ||
171 | } | 192 | } |
172 | ins += "</div>"; | 193 | ins += "</div>"; |
173 | return ins; | 194 | return ins; |
@@ -395,7 +416,7 @@ i3GEOF.navegapostgis = { | @@ -395,7 +416,7 @@ i3GEOF.navegapostgis = { | ||
395 | if(gid === "" && i3GEOF.navegapostgis.tipo === "sql"){ | 416 | if(gid === "" && i3GEOF.navegapostgis.tipo === "sql"){ |
396 | alert("Coluna com ID unico nao foi escolhida!"); | 417 | alert("Coluna com ID unico nao foi escolhida!"); |
397 | } | 418 | } |
398 | - if(gi3GEOF.navegapostgis.tipo === "sql"){ | 419 | + if(i3GEOF.navegapostgis.tipo === "sql"){ |
399 | $i("i3GEOFnavegapostgisSql").value = sql; | 420 | $i("i3GEOFnavegapostgisSql").value = sql; |
400 | } | 421 | } |
401 | } | 422 | } |