Commit 3b88c3692690c8a440b21ac642d12235f05ddf01

Authored by Edmar Moretti
1 parent 4e090de9

Inclusão de opção para selecionar todas as colunas (*) no navegador postgis

Showing 1 changed file with 12 additions and 1 deletions   Show diff stats
ferramentas/navegapostgis/index.js
... ... @@ -313,6 +313,9 @@ i3GEOF.navegapostgis = {
313 313 }
314 314 else{
315 315 ins = "<table class=lista4 ><tr><td title='"+$trad('selecionaID',i3GEOF.navegapostgis.dicionario)+"'>"+gid+"</td><td title='"+$trad('selecionaGeom',i3GEOF.navegapostgis.dicionario)+"'>"+the_geom+"</td><td title='"+$trad('mostraColuna',i3GEOF.navegapostgis.dicionario)+"'>"+mostra+"</td><td>"+nome+"</td></tr>";
  316 + mostra = "<input onclick='i3GEOF.navegapostgis.geraSql()' style=cursor:pointer type=checkbox name='i3GEOFnavegapostgisMostra' value='*' />";
  317 + ins += "<tr><td></td><td></td><td>"+mostra+"</td><td title='' >Todas</td></tr>";
  318 +
316 319 for(i=0;i<n;i++){
317 320 gid = "<input onclick='i3GEOF.navegapostgis.geraSql()' style=cursor:pointer type=radio name='i3GEOFnavegapostgisGid' value='"+retorno[i].field+"' />";
318 321 if(retorno[i].type == "line" || retorno[i].type == "polygon" || retorno[i].type == "point" || retorno[i].type == "geometry"){
... ... @@ -359,7 +362,15 @@ i3GEOF.navegapostgis = {
359 362 if(the_geom != ""){
360 363 colunas.push(the_geom);
361 364 }
362   - sql = the_geom+" from (select "+colunas.join(",")+" from "+i3GEOF.navegapostgis.esquema+"."+i3GEOF.navegapostgis.tabela+") as foo using unique "+gid+" using srid=4326";
  365 + if(colunas[0] === "*"){
  366 + colunas = ["*"];
  367 + }
  368 + if(colunas.length === 1){
  369 + i = colunas[0];
  370 + }else{
  371 + i = colunas.join(",");
  372 + }
  373 + sql = the_geom+" from (select "+i+" from "+i3GEOF.navegapostgis.esquema+"."+i3GEOF.navegapostgis.tabela+") as foo using unique "+gid+" using srid=4326";
363 374 sql = sql.replace(",,",",");
364 375 $i("i3GEOFnavegapostgisSql").value = sql;
365 376 }
... ...