From 112cad2deabd6db4df32bbf547dbaa2017a260cf Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Wed, 25 Sep 2013 13:52:48 +0000 Subject: [PATCH] $1 --- admin/js/estat_editor.js | 3 ++- admin/menu.html | 12 ++++++------ admin/php/metaestat_uploadshp_submit.php | 9 ++++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/admin/js/estat_editor.js b/admin/js/estat_editor.js index a44303a..95d96f6 100644 --- a/admin/js/estat_editor.js +++ b/admin/js/estat_editor.js @@ -527,12 +527,13 @@ i3GEOadmin.editor = { i3GEOadmin.editor.tabela.optionsTabela + '

' + '

Tipo de operação:

' + - '

' + '' + '' + '' + '

' + '

Código da projeção (SRID) Assegure-se que o shapefile esteja na projeção geográfica se você for usar com o sistema de metadados estatísticos :

' + + '

 Inclui uma coluna gid do tipo serial e chave primária com código único

' + '

' + '' + '' + diff --git a/admin/menu.html b/admin/menu.html index 8628b93..bebe866 100644 --- a/admin/menu.html +++ b/admin/menu.html @@ -106,12 +106,7 @@ href: "html/estat_fonteinfo.html", target: "principal" },{ - label: "Upload de dados para uma variável (para upload de shapefile, utilize o gerenciador de tabelas)", - type: "text", - href: "html/estat_uploaddados.html", - target: "principal" - },{ - label: "Gerenciador de tabelas de dados estatísticos", + label: "Gerenciador de tabelas de dados estatísticos (upload de SHP e CSV)", type: "text", href: "html/estat_editor.html", target: "principal" @@ -126,6 +121,11 @@ type: "text", href: "html/subirshapefile.html", target: "principal" + },{ + label: "Gerenciador de tabelas de dados estatísticos (upload de SHP e CSV)", + type: "text", + href: "html/estat_editor.html", + target: "principal" } ]},{ label: "Editor de mapfiles", diff --git a/admin/php/metaestat_uploadshp_submit.php b/admin/php/metaestat_uploadshp_submit.php index f8af07c..de6eaa8 100755 --- a/admin/php/metaestat_uploadshp_submit.php +++ b/admin/php/metaestat_uploadshp_submit.php @@ -147,7 +147,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ //a tabela nao existe e e do tipo create $sqltabela = array(); if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ - $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(gid integer, the_geom geometry"; + $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry"; foreach($colunas as $coluna){ $sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna]; } @@ -176,7 +176,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ } //gera o script para inserir os dados $linhas = array(); - $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."( gid,".strtolower(implode(",",$colunas)).",the_geom)"; + $insert = "INSERT INTO ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." (".strtolower(implode(",",$colunas)).",the_geom)"; echo "
Preparando inclusão de dados"; ob_flush(); flush(); @@ -184,7 +184,6 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ for ($i=0; $i<$numshapes;$i++){ $s = $layer->getShape(new resultObj($i)); $vs = array(); - $vs[] = $i; foreach($colunas as $coluna){ if($tipoColuna[$coluna] == "varchar"){ $texto = $s->getValue($layer,$coluna); @@ -204,6 +203,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ ob_flush(); flush(); sleep(1); + if($_POST["incluiserialshp"] == "on"){ + $linhas[] = "alter table ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]." add gid serial CONSTRAINT gid_pkey PRIMARY KEY"; + } + foreach($sqltabela as $linha){ try { $dbh->query($linha); -- libgit2 0.21.2