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 | 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 | 342 | alert("Escolha a tabela"); |
343 | 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 | 358 | success:function(o){ |
349 | 359 | try { |
350 | 360 | core_carregando("desativa"); |
... | ... | @@ -353,7 +363,7 @@ i3GEOadmin.editor = { |
353 | 363 | linhas = dados.linhas, |
354 | 364 | nlinhas = linhas.length, |
355 | 365 | tabela = [], |
356 | - i,j,l,w; | |
366 | + i,j,l; | |
357 | 367 | tabela.push("<head><body><table style='border:1px solid black'><tr>"); |
358 | 368 | for(i=0;i<ncolunas;i++){ |
359 | 369 | tabela.push("<td style='border:1px solid gray' >"+dados.nomescolunas[i]+"</td>"); |
... | ... | @@ -368,7 +378,9 @@ i3GEOadmin.editor = { |
368 | 378 | tabela.push("</tr>"); |
369 | 379 | } |
370 | 380 | tabela.push("</table></body></head>"); |
371 | - w = window.open(); | |
381 | + if (!w){ | |
382 | + w = window.open(); | |
383 | + } | |
372 | 384 | w.document.write(tabela.join("")); |
373 | 385 | w.document.close(); |
374 | 386 | } |
... | ... | @@ -376,10 +388,9 @@ i3GEOadmin.editor = { |
376 | 388 | }, |
377 | 389 | failure:core_handleFailure, |
378 | 390 | argument: { foo:"foo", bar:"bar" } |
379 | - }, | |
380 | - nomeEsquema = $i("i3GEOadminesquema").value; | |
391 | + }; | |
381 | 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 | 395 | csv: function(){ |
385 | 396 | if($i("i3GEOadmintabela").value == ""){ | ... | ... |
classesjs/classe_barradebotoes.js
ferramentas/buscainde/index.js
ferramentas/editorsql/index.js
ferramentas/navegapostgis/dicionario.js
ferramentas/navegapostgis/index.js
... | ... | @@ -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 | 129 | var conexao = function(retorno){ |
117 | 130 | var ins = "<select style='width:200px;' onchange='i3GEOF.navegapostgis.montaArvore(this.value)'><option value='' >---</option>", |
118 | 131 | n = retorno.length, |
... | ... | @@ -132,7 +145,13 @@ i3GEOF.navegapostgis = { |
132 | 145 | if(botao){ |
133 | 146 | botao.style.position = "absolute"; |
134 | 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 | 156 | cpJSON.call(p,"foo",conexao); |
138 | 157 | /* |
... | ... | @@ -167,7 +186,9 @@ i3GEOF.navegapostgis = { |
167 | 186 | "<textarea id=i3GEOFnavegapostgisSql style='width: 313px;overflow: auto;height: 104px;border: 1px solid lightgray;position: absolute;left:223px;top: 190px;'> "+ |
168 | 187 | "</textarea>"; |
169 | 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 | 193 | ins += "</div>"; |
173 | 194 | return ins; |
... | ... | @@ -395,7 +416,7 @@ i3GEOF.navegapostgis = { |
395 | 416 | if(gid === "" && i3GEOF.navegapostgis.tipo === "sql"){ |
396 | 417 | alert("Coluna com ID unico nao foi escolhida!"); |
397 | 418 | } |
398 | - if(gi3GEOF.navegapostgis.tipo === "sql"){ | |
419 | + if(i3GEOF.navegapostgis.tipo === "sql"){ | |
399 | 420 | $i("i3GEOFnavegapostgisSql").value = sql; |
400 | 421 | } |
401 | 422 | } | ... | ... |