From 246213ee4dc695379342a168161bd49a6ae66fc5 Mon Sep 17 00:00:00 2001 From: edmarmoretti Date: Mon, 15 Aug 2016 19:50:59 -0300 Subject: [PATCH] Separacao do codigo utilizado no upload de shp do sistema de administracao e das ferramentas --- admin/admin.db | Bin 340992 -> 0 bytes admin/html/subirshapefile.html | 2 +- admin/html/subirsimbolo_.html | 80 -------------------------------------------------------------------------------- admin/js/subirshapefile.js | 203 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ admin/php/gruposusuarios.php | 8 +++++++- admin/php/subirshapefile.php | 248 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ classesphp/mapa_controle.php | 2 +- ferramentas/upload/index.js | 8 -------- ferramentas/upload/upload.php | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------- 9 files changed, 524 insertions(+), 186 deletions(-) delete mode 100755 admin/html/subirsimbolo_.html create mode 100755 admin/js/subirshapefile.js create mode 100755 admin/php/subirshapefile.php diff --git a/admin/admin.db b/admin/admin.db index 7b8fd93..cdc67b4 100755 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/admin/html/subirshapefile.html b/admin/html/subirshapefile.html index fc6739e..81a825c 100755 --- a/admin/html/subirshapefile.html +++ b/admin/html/subirshapefile.html @@ -16,7 +16,7 @@ body { - + diff --git a/admin/html/subirsimbolo_.html b/admin/html/subirsimbolo_.html deleted file mode 100755 index 72a11a3..0000000 --- a/admin/html/subirsimbolo_.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - -Shape file - - - - - - - - - - -
-
- -
-






-






-






-
- - diff --git a/admin/js/subirshapefile.js b/admin/js/subirshapefile.js new file mode 100755 index 0000000..445d845 --- /dev/null +++ b/admin/js/subirshapefile.js @@ -0,0 +1,203 @@ +//Esse programa e um clone de i3geo/ferramentas/upload/index.js +// + +/* + + +Title: Upload de arquivo shapefile + +Envia para o servidor um arquivo shapefile local e insere como uma camada no mapa. + +Veja: + + + +Arquivo: i3geo/ferramentas/upload/index.js.php + +About: Licença + +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet + +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com + +Este programa é software livre; você pode redistribuí-lo +e/ou modificá-lo sob os termos da Licença Pública Geral +GNU conforme publicada pela Free Software Foundation; + +Este programa é distribuído na expectativa de que seja útil, +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. +Consulte a Licença Pública Geral do GNU para mais detalhes. +Você deve ter recebido uma cópia da Licença Pública Geral do +GNU junto com este programa; se não, escreva para a +Free Software Foundation, Inc., no endereço +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. +*/ +if(typeof(i3GEOF) === 'undefined'){ + var i3GEOF = {}; +} +/* +Classe: i3GEOF.upload +*/ +i3GEOF.upload = { + /* + Variavel: aguarde + + Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. + */ + aguarde: "", + /* + Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário + */ + criaJanelaFlutuante: function(){ + i3GEOF.upload.iniciaDicionario(); + }, + /* + Function: iniciaDicionario + + Carrega o dicionário e chama a função que inicia a ferramenta + + O Javascript é carregado com o id i3GEOF.nomedaferramenta.dicionario_script + */ + iniciaDicionario: function(){ + if(typeof(i3GEOF.upload.dicionario) === 'undefined'){ + i3GEO.util.scriptTag( + i3GEO.configura.locaplic+"/ferramentas/upload/dicionario.js", + "i3GEOF.upload.iniciaJanelaFlutuante()", + "i3GEOF.upload.dicionario_script" + ); + } + else{ + i3GEOF.upload.iniciaJanelaFlutuante(); + } + }, + /* + Function: inicia + + Inicia a ferramenta. É chamado por criaJanelaFlutuante + + Parametro: + + iddiv {String} - id do div que receberá o conteudo HTML da ferramenta + */ + inicia: function(iddiv){ + try{ + $i(iddiv).innerHTML += i3GEOF.upload.html(); + var b = new YAHOO.widget.Button( + "i3GEOuploadbotao1", + {onclick:{fn: i3GEOF.upload.submete}} + ); + b.addClass("rodar"); + i3GEO.util.radioEpsg( + function(retorno){ + $i("i3GEOuploadListaepsg").innerHTML = retorno.dados; + }, + "i3GEOuploadListaepsg", + "upload", + "nao" + ); + } + catch(erro){i3GEO.janela.tempoMsg(erro);} + }, + /* + Function: html + + Gera o código html para apresentação das opções da ferramenta + + Retorno: + + String com o código html + */ + html:function(){ + var ins = '
' + + '
' + + '

shp:

' + + '

shx:

' + + '

dbf:

' + + '

prj (opcional):

' + + '
'; + if(i3GEO.parametros.editor === "sim"){ + ins += '
' + + '

'+$trad('pastaArmazenamento',i3GEOF.upload.dicionario)+':

' + + '
' + + " 

" + + '

 '+$trad('criaMapfile',i3GEOF.upload.dicionario) + + '

'; + } + ins += '
' + + '

'+$trad('tipoGeom',i3GEOF.upload.dicionario)+':

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

'+$trad('projecao',i3GEOF.upload.dicionario)+':

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

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

' + + + "

"+$trad('ajudaCaracter',i3GEOF.upload.dicionario)+"

" + + '' + + '
'; + return ins; + }, + /* + Function: iniciaJanelaFlutuante + + Cria a janela flutuante para controle da ferramenta. + */ + iniciaJanelaFlutuante: function(){ + var janela,divid,titulo,cabecalho,minimiza; + if ($i("i3GEOF.upload")) { + return; + } + cabecalho = function(){}; + minimiza = function(){ + i3GEO.janela.minimiza("i3GEOF.upload"); + }; + titulo = "" + + "
" + $trad("a2")+"
"; + janela = i3GEO.janela.cria( + "400px", + "480px", + "", + "", + "", + titulo, + "i3GEOF.upload", + false, + "hd", + cabecalho, + minimiza, + "", + true + ); + divid = janela[2].id; + $i("i3GEOF.upload_corpo").style.backgroundColor = "white"; + i3GEOF.upload.aguarde = $i("i3GEOF.upload_imagemCabecalho").style; + i3GEOF.upload.inicia(divid); + }, + /* + Function: submete + + Submete o arquivo ao servidor + */ + submete: function(){ + if(i3GEOF.upload.aguarde.visibility==="visible") + {return;} + i3GEOF.upload.aguarde.visibility="visible"; + $i("i3GEOuploadf").submit(); + }, + selNavegador: function(onde){ + i3GEO.util.navegadorDir(onde,false,false,false); + } +}; + diff --git a/admin/php/gruposusuarios.php b/admin/php/gruposusuarios.php index 8142d88..aafb60e 100755 --- a/admin/php/gruposusuarios.php +++ b/admin/php/gruposusuarios.php @@ -72,6 +72,10 @@ if(in_array(strtoupper($funcao),$funcoesEdicao)){ retornaJSON("Vc nao pode realizar essa operacao.");exit; } } + +$id_usuario = $_GET["id_usuario"]; +testaSafeNumerico([$id_usuario]); + switch (strtoupper($funcao)) { case "ALTERARGRUPOS": @@ -127,9 +131,11 @@ switch (strtoupper($funcao)) cpjson($retorno); function alterarGrupos() { - global $id_grupo,$nome,$descricao; + global $id_grupo; try { + $nome = $_GET["nome"]; + $descricao = $_GET["descricao"]; include(dirname(__FILE__)."/conexao.php"); if($convUTF){ $nome = utf8_encode($nome); diff --git a/admin/php/subirshapefile.php b/admin/php/subirshapefile.php new file mode 100755 index 0000000..849e0d7 --- /dev/null +++ b/admin/php/subirshapefile.php @@ -0,0 +1,248 @@ + + + + + + + + + + +

+Carregando o arquivo...

"; + ob_flush(); + flush(); + sleep(1); + if(isset($map_file) && $map_file != ""){ + $mapa = ms_newMapObj($map_file); + $dirmap = dirname($map_file); + } + if(isset($dirDestino) && $dirDestino != ""){ + $dirmap = $dirDestino; + include_once(dirname(__FILE__)."/../../admin/php/login.php"); + if(verificaOperacaoSessao("admin/php/editortexto") == false){ + echo "Vc nao pode salvar os dados no servidor em uma pasta específica";exit; + } + if(!file_exists($dirmap)) + {echo "

Pasta não existe no servidor";paraAguarde();exit;} + } + //verifica nomes + verificaNome($_FILES['i3GEOuploadshp']['name']); + verificaNome($_FILES['i3GEOuploadshx']['name']); + verificaNome($_FILES['i3GEOuploaddbf']['name']); + + if($_FILES['i3GEOuploadprj']['name'] != ""){ + verificaNome($_FILES['i3GEOuploadprj']['name']); + } + + //remove acentos + $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name']))); + + $nomePrefixo = str_replace(".","",$nomePrefixo); + $nomePrefixo = strip_tags($nomePrefixo); + $nomePrefixo = htmlspecialchars($nomePrefixo, ENT_QUOTES); + $nomePrefixo = $nomePrefixo . md5(uniqid(rand(), true)); + + //sobe arquivo + $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name']; + if(file_exists($dirmap."/".$nomePrefixo.".shp")) + {echo "

Já existe um SHP com o nome ";paraAguarde();exit;} + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shp"); + if($status != 1) + {echo "

Ocorreu um erro no envio do arquivo SHP. Pode ser uma limitação quanto ao tamanho do arquivo ou permissão de escrita na pasta indicada.";paraAguarde();exit;} + + $Arquivo = $_FILES['i3GEOuploadshx']['tmp_name']; + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shx"); + if($status != 1) + {echo "

Ocorreu um erro no envio do arquivo SHX";paraAguarde();exit;} + + $Arquivo = $_FILES['i3GEOuploaddbf']['tmp_name']; + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".dbf"); + if($status != 1) + {echo "

Ocorreu um erro no envio do arquivo DBF";paraAguarde();exit;} + + if($_FILES['i3GEOuploadprj']['name'] != ""){ + $Arquivo = $_FILES['i3GEOuploadprj']['tmp_name']; + $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".prj"); + if($status != 1){ + echo "

Ocorreu um erro no envio do arquivo PRJ";paraAguarde();exit; + } + } + + if(!file_exists($dirmap."/".$nomePrefixo.".shp")) + {echo "

Ocorreu algum problema no envio do arquivo ";paraAguarde();exit;} + + + $checkphp = fileContemString($dirmap."/".$nomePrefixo.".prj","Arquivo enviado.

"; + echo "

"; + //nesse caso o formulario de upload esta sendo executado de dentro de um mapa interativo, por isso o mapfile ja existe + if(isset($map_file)){ + echo "

Adicionando tema...

"; + ob_flush(); + flush(); + sleep(1); + $novolayer = ms_newLayerObj($mapa); + $novolayer->set("data",$dirmap."/".$nomePrefixo.".shp"); + $novolayer->set("name",$_FILES['i3GEOuploadshp']['name']); + $novolayer->setmetadata("TEMA",$_FILES['i3GEOuploadshp']['name']); + $novolayer->setmetadata("DOWNLOAD","SIM"); + $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1); + if(!isset($tipo) || $tipo == "") + {$tipo = $sfileObj->type;} + if ($tipo == 1){$novolayer->set("type",MS_LAYER_POINT);} // ponto + if ($tipo == 3){$novolayer->set("type",MS_LAYER_LINE);} + if ($tipo == 5){$novolayer->set("type",MS_LAYER_POLYGON);} + $novolayer->setmetadata("TEMALOCAL","SIM"); + $novolayer->setmetadata("CLASSE","SIM"); + $novolayer->setmetadata("TEXTO","NAO"); + //if (($tipo != 3) and ($tipo != 8 )){$novolayer->set("type",0);} + $novolayer->setfilter(""); + $classe = ms_newClassObj($novolayer); + $classe->set("name",""); + $estilo = ms_newStyleObj($classe); + if ($tipo == 1) + { + $estilo->set("symbolname","ponto"); + $estilo->set("size",6); + } + $estilo->color->setrgb(200,50,0); + $estilo->outlinecolor->setrgb(0,0,0); + // le os itens + $novolayer->set("status",MS_DEFAULT); + $abriu = $novolayer->open(); + $items = $novolayer->getItems(); + $fechou = $novolayer->close(); + if ($items != "") + { + $its = implode(",",$items); + $novolayer->setmetadata("ITENS",$its); + $novolayer->setmetadata("ITENSDESC",$its); + $novolayer->set("template","none.htm"); + } + if(isset($_GET["uploadEPSG"]) && $_GET["uploadEPSG"] != ""){ + $novolayer->setProjection("init=epsg:".$_GET["uploadEPSG"]); + } + if(file_exists($dirmap."/".$nomePrefixo.".prj")){ + $novolayer->setProjection("AUTO"); + } + //$adiciona = ms_newLayerObj($mapa, $novolayer); + $salvo = $mapa->save($map_file); + //grava os templates de cada tema + echo "

Tema criado!!! Redesenhando o mapa."; + echo ""; + } + elseif($i3GEOuploadCriaMapfile == "on"){ + //verifica se o usuario marcou a opcao de cria mapfile + //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera + //ser criado e registrado no sistema + $nome = $nomePrefixo; + $codigo = $nomePrefixo; + $it = $nomePrefixo; + $en = $nomePrefixo; + $es = $nomePrefixo; + $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1); + if(!isset($tipo) || $tipo == ""){ + $tipo = $sfileObj->type; + } + if ($tipo == 1){ + $tipoLayer = "point"; + } + if ($tipo == 3){ + $tipoLayer = "line"; + } + if ($tipo == 5){ + $tipoLayer = "polygon"; + } + $funcao = "CRIARNOVOMAP"; + $output = "retorno"; + $data = $dirmap."/".$nomePrefixo.".shp"; + include_once($locaplic."/admin/php/editormapfile.php"); + echo "

Criado!!!
"; + echo "Para editar clique: editar"; + echo ""; + } +} +else +{ + echo "

Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.

"; +} +restauraCon($map_file,$postgis_mapa); +paraAguarde(); +function paraAguarde(){ + echo ""; +} +function verificaNome($nome){ + if(strlen(basename($nome)) > 200){ + exit; + } + $nome = strtolower($nome); + $lista = explode(".",$nome); + $extensao = $lista[count($lista) - 1]; + if(($extensao != "dbf") && ($extensao != "shx") && ($extensao != "shp") && ($extensao != "prj")) + { + echo "Nome de arquivo inválido. $nome"; + paraAguarde(); + exit; + } +} +?> + + diff --git a/classesphp/mapa_controle.php b/classesphp/mapa_controle.php index 2dbb03f..8683c1f 100755 --- a/classesphp/mapa_controle.php +++ b/classesphp/mapa_controle.php @@ -122,7 +122,7 @@ $interfaceTemp = $interface; //TEMA2SLD e usado por datadownload.htm //PEGAMAPAS e utilizado em varias funcoes // -if ($funcao != "pegaTodosTemas" && $funcao != "download3" && $funcao != "listainterfaces" && $funcao != "pegalistadetemas" && $funcao != "pegalistadeSubgrupos" && $funcao != "procurartemasestrela" && $funcao != "pegalistadegrupos" && $funcao != "pegalistademenus" && $funcao != "criaMapa" && strtoupper($funcao) != "TEMA2SLD" && strtoupper($funcao) != "PEGAMAPAS"){ +if ($funcao != "listaEpsg" && $funcao != "pegaTodosTemas" && $funcao != "download3" && $funcao != "listainterfaces" && $funcao != "pegalistadetemas" && $funcao != "pegalistadeSubgrupos" && $funcao != "procurartemasestrela" && $funcao != "pegalistadegrupos" && $funcao != "pegalistademenus" && $funcao != "criaMapa" && strtoupper($funcao) != "TEMA2SLD" && strtoupper($funcao) != "PEGAMAPAS"){ session_name("i3GeoPHP"); if (isset($g_sid) && $g_sid != ""){ session_id($g_sid); diff --git a/ferramentas/upload/index.js b/ferramentas/upload/index.js index 8a02ed7..2959d4e 100755 --- a/ferramentas/upload/index.js +++ b/ferramentas/upload/index.js @@ -112,14 +112,6 @@ i3GEOF.upload = { '

dbf:

' + '

prj (opcional):

' + ''; - if(i3GEO.parametros.editor === "sim"){ - ins += '
' + - '

'+$trad('pastaArmazenamento',i3GEOF.upload.dicionario)+':

' + - '
' + - " 

" + - '

 '+$trad('criaMapfile',i3GEOF.upload.dicionario) + - '

'; - } ins += '
' + '

'+$trad('tipoGeom',i3GEOF.upload.dicionario)+':

' + '
' + diff --git a/ferramentas/upload/upload.php b/ferramentas/upload/upload.php index 14f9baf..303daa6 100755 --- a/ferramentas/upload/upload.php +++ b/ferramentas/upload/upload.php @@ -17,6 +17,12 @@ if(isset($_GET["g_sid"]) && $_GET["g_sid"] != ""){ session_start(); $map_file = $_SESSION["map_file"]; } +else{ + exit; +} +if(!file_exists($map_file)){ + exit; +} if (ob_get_level() == 0) ob_start(); ?> @@ -42,18 +48,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])) ob_flush(); flush(); sleep(1); - if(isset($map_file)){ - $mapa = ms_newMapObj($map_file); - $dirmap = dirname($map_file); - } - if(isset($dirDestino) && $dirDestino != ""){ - $dirmap = $dirDestino; - include_once(dirname(__FILE__)."/../../admin/php/login.php"); - if(verificaOperacaoSessao("admin/php/editortexto") == false){ - echo "Vc nao pode salvar os dados no servidor em uma pasta específica";exit; - } - if(!file_exists($dirmap)) - {echo "

Pasta não existe no servidor";paraAguarde();exit;} + $mapa = ms_newMapObj($map_file); + $dirmap = dirname($map_file); + if(!file_exists($dirmap)){ + exit; } //verifica nomes verificaNome($_FILES['i3GEOuploadshp']['name']); @@ -104,6 +102,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])) $checkphp = fileContemString($dirmap."/".$nomePrefixo.".prj","Arquivo enviado.

"; echo "

"; //nesse caso o formulario de upload esta sendo executado de dentro de um mapa interativo, por isso o mapfile ja existe - if(isset($map_file)){ - echo "

Adicionando tema...

"; - ob_flush(); - flush(); - sleep(1); - $novolayer = ms_newLayerObj($mapa); - $novolayer->set("data",$dirmap."/".$nomePrefixo.".shp"); - $novolayer->set("name",$_FILES['i3GEOuploadshp']['name']); - $novolayer->setmetadata("TEMA",$_FILES['i3GEOuploadshp']['name']); - $novolayer->setmetadata("DOWNLOAD","SIM"); - $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1); - if(!isset($tipo) || $tipo == "") - {$tipo = $sfileObj->type;} - if ($tipo == 1){$novolayer->set("type",MS_LAYER_POINT);} // ponto - if ($tipo == 3){$novolayer->set("type",MS_LAYER_LINE);} - if ($tipo == 5){$novolayer->set("type",MS_LAYER_POLYGON);} - $novolayer->setmetadata("TEMALOCAL","SIM"); - $novolayer->setmetadata("CLASSE","SIM"); - $novolayer->setmetadata("TEXTO","NAO"); - //if (($tipo != 3) and ($tipo != 8 )){$novolayer->set("type",0);} - $novolayer->setfilter(""); - $classe = ms_newClassObj($novolayer); - $classe->set("name",""); - $estilo = ms_newStyleObj($classe); - if ($tipo == 1) - { - $estilo->set("symbolname","ponto"); - $estilo->set("size",6); - } - $estilo->color->setrgb(200,50,0); - $estilo->outlinecolor->setrgb(0,0,0); - // le os itens - $novolayer->set("status",MS_DEFAULT); - $abriu = $novolayer->open(); - $items = $novolayer->getItems(); - $fechou = $novolayer->close(); - if ($items != "") - { - $its = implode(",",$items); - $novolayer->setmetadata("ITENS",$its); - $novolayer->setmetadata("ITENSDESC",$its); - $novolayer->set("template","none.htm"); - } - if(isset($_GET["uploadEPSG"]) && $_GET["uploadEPSG"] != ""){ - $novolayer->setProjection("init=epsg:".$_GET["uploadEPSG"]); - } - if(file_exists($dirmap."/".$nomePrefixo.".prj")){ - $novolayer->setProjection("AUTO"); - } - //$adiciona = ms_newLayerObj($mapa, $novolayer); - $salvo = $mapa->save($map_file); - //grava os templates de cada tema - echo "

Tema criado!!! Redesenhando o mapa."; - echo ""; + echo "

Adicionando tema...

"; + ob_flush(); + flush(); + sleep(1); + $novolayer = ms_newLayerObj($mapa); + $novolayer->set("data",$dirmap."/".$nomePrefixo.".shp"); + $novolayer->set("name",$_FILES['i3GEOuploadshp']['name']); + $novolayer->setmetadata("TEMA",$_FILES['i3GEOuploadshp']['name']); + $novolayer->setmetadata("DOWNLOAD","SIM"); + $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1); + if(!isset($tipo) || $tipo == "") + {$tipo = $sfileObj->type;} + if ($tipo == 1){$novolayer->set("type",MS_LAYER_POINT);} // ponto + if ($tipo == 3){$novolayer->set("type",MS_LAYER_LINE);} + if ($tipo == 5){$novolayer->set("type",MS_LAYER_POLYGON);} + $novolayer->setmetadata("TEMALOCAL","SIM"); + $novolayer->setmetadata("CLASSE","SIM"); + $novolayer->setmetadata("TEXTO","NAO"); + //if (($tipo != 3) and ($tipo != 8 )){$novolayer->set("type",0);} + $novolayer->setfilter(""); + $classe = ms_newClassObj($novolayer); + $classe->set("name",""); + $estilo = ms_newStyleObj($classe); + if ($tipo == 1) + { + $estilo->set("symbolname","ponto"); + $estilo->set("size",6); } - elseif($i3GEOuploadCriaMapfile == "on"){ - //verifica se o usuario marcou a opcao de cria mapfile - //nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera - //ser criado e registrado no sistema - $nome = $nomePrefixo; - $codigo = $nomePrefixo; - $it = $nomePrefixo; - $en = $nomePrefixo; - $es = $nomePrefixo; - $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1); - if(!isset($tipo) || $tipo == ""){ - $tipo = $sfileObj->type; - } - if ($tipo == 1){ - $tipoLayer = "point"; - } - if ($tipo == 3){ - $tipoLayer = "line"; - } - if ($tipo == 5){ - $tipoLayer = "polygon"; - } - $funcao = "CRIARNOVOMAP"; - $output = "retorno"; - $data = $dirmap."/".$nomePrefixo.".shp"; - include_once($locaplic."/admin/php/editormapfile.php"); - echo "

Criado!!!
"; - echo "Para editar clique: editar"; - echo ""; + $estilo->color->setrgb(200,50,0); + $estilo->outlinecolor->setrgb(0,0,0); + // le os itens + $novolayer->set("status",MS_DEFAULT); + $abriu = $novolayer->open(); + $items = $novolayer->getItems(); + $fechou = $novolayer->close(); + if ($items != "") + { + $its = implode(",",$items); + $novolayer->setmetadata("ITENS",$its); + $novolayer->setmetadata("ITENSDESC",$its); + $novolayer->set("template","none.htm"); + } + if(isset($_GET["uploadEPSG"]) && $_GET["uploadEPSG"] != ""){ + $novolayer->setProjection("init=epsg:".$_GET["uploadEPSG"]); + } + if(file_exists($dirmap."/".$nomePrefixo.".prj")){ + $novolayer->setProjection("AUTO"); } + //$adiciona = ms_newLayerObj($mapa, $novolayer); + $salvo = $mapa->save($map_file); + //grava os templates de cada tema + echo "

Tema criado!!! Redesenhando o mapa."; + echo ""; } else { -- libgit2 0.21.2