From f564365b2c1140ff4df278158c5350cad83c4b29 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 14 Nov 2013 15:52:13 +0000 Subject: [PATCH] --- admin/html/subirsimbolo.html | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ admin/menu.html | 10 ++++++++++ classesjs/dicionario_ajuda.js | 11 ++++++++++- ferramentas/upload/index.js | 12 +++++++++--- ferramentas/uploadsimbolo/dicionario.js | 27 +++++++++++++++++++++++++++ ferramentas/uploadsimbolo/index.js | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ferramentas/uploadsimbolo/upload.php | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 432 insertions(+), 4 deletions(-) create mode 100755 admin/html/subirsimbolo.html create mode 100755 ferramentas/uploadsimbolo/dicionario.js create mode 100755 ferramentas/uploadsimbolo/index.js create mode 100755 ferramentas/uploadsimbolo/upload.php diff --git a/admin/html/subirsimbolo.html b/admin/html/subirsimbolo.html new file mode 100755 index 0000000..2d7d835 --- /dev/null +++ b/admin/html/subirsimbolo.html @@ -0,0 +1,78 @@ + + + + +Shape file + + + + + + + + +
+
 
+
+
+ +
+






+






+






+
+ + diff --git a/admin/menu.html b/admin/menu.html index 348a13e..02e88e5 100644 --- a/admin/menu.html +++ b/admin/menu.html @@ -139,6 +139,11 @@ type: "text", href: "html/estat_editor.html", target: "principal" + },{ + label: "Upload de imagem para uso como símbolo", + type: "text", + href: "html/subirsimbolo.html", + target: "principal" } ]},{ label: "Editor de mapfiles", @@ -161,6 +166,11 @@ href: "html/arvore.html", target: "principal" },{ + label: "Upload de imagem para uso como símbolo", + type: "text", + href: "html/subirsimbolo.html", + target: "principal" + },{ label: "Ver RSS com os grupos, subgrupos e temas", type: "text", href: "rssgrupos.php", diff --git a/classesjs/dicionario_ajuda.js b/classesjs/dicionario_ajuda.js index a245b68..2b86ba6 100644 --- a/classesjs/dicionario_ajuda.js +++ b/classesjs/dicionario_ajuda.js @@ -968,7 +968,16 @@ g_traducao_ajuda = { pt:"Guarda as preferências do usuário em relação aos parâmetros que controlam a interface do mapa", complemento:"", apijs: "i3GEO.mapa.dialogo.preferencias()" - } + }, + "116": { + titulo: "Upload se símbolo", + diretorio:"i3geo/ferramentas/uploadsimbolo", + categoria:"4", + pt:"Envia para o servidor um arquivo de imagem que poderá ser utilizado como símbolo nas legendas das camadas", + complemento:"", + //tela:"ferramentas/upload/exemplo.htm", + apijs:"" + }, } }; diff --git a/ferramentas/upload/index.js b/ferramentas/upload/index.js index 7798954..fe58a0c 100644 --- a/ferramentas/upload/index.js +++ b/ferramentas/upload/index.js @@ -104,12 +104,15 @@ i3GEOF.upload = { String com o código html */ html:function(){ - var ins = '
' + + var limg = i3GEO.configura.locaplic+"/imagens/ic_zoom.png", + ins = '' + '

shp:

' + '

shx:

' + '

dbf:

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

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

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

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

'; + //ins += "

"; + } ins += '

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

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

'+$trad(1,i3GEOF.uploadsimbolo.dicionario)+':

'; + //ins += "

"; + } + ins += '

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

' + + "

"+$trad(9,i3GEOF.uploadsimbolo.dicionario)+"

" + + ''; + return ins; + }, + /* + Function: iniciaJanelaFlutuante + + Cria a janela flutuante para controle da ferramenta. + */ + iniciaJanelaFlutuante: function(){ + var janela,divid,titulo,cabecalho,minimiza; + cabecalho = function(){}; + minimiza = function(){ + i3GEO.janela.minimiza("i3GEOF.uploadsimbolo"); + }; + titulo = "PNG/JPG    "; + janela = i3GEO.janela.cria( + "355px", + "470px", + "", + "", + "", + titulo, + "i3GEOF.uploadsimbolo", + false, + "hd", + cabecalho, + minimiza + ); + divid = janela[2].id; + $i("i3GEOF.uploadsimbolo_corpo").style.backgroundColor = "white"; + i3GEOF.uploadsimbolo.aguarde = $i("i3GEOF.uploadsimbolo_imagemCabecalho").style; + i3GEOF.uploadsimbolo.inicia(divid); + }, + /* + Function: submete + + Submete o arquivo ao servidor + */ + submete: function(){ + if(i3GEOF.uploadsimbolo.aguarde.visibility==="visible") + {return;} + i3GEOF.uploadsimbolo.aguarde.visibility="visible"; + $i("i3GEOuploadsimbolof").submit(); + }, + selNavegador: function(onde){ + i3GEO.util.navegadorDir(onde,false,false,false); + } +}; + diff --git a/ferramentas/uploadsimbolo/upload.php b/ferramentas/uploadsimbolo/upload.php new file mode 100755 index 0000000..3a6bc61 --- /dev/null +++ b/ferramentas/uploadsimbolo/upload.php @@ -0,0 +1,139 @@ + + + + + + + + +

+Carregando o arquivo...

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

Pasta não existe no servidor";paraAguarde();exit;} + } + else{ + $dirmap = $locaplic."/simbolos"; + } + //verifica nomes + verificaNome($_FILES['i3GEOuploadsimboloarq']['name']); + $nomePrefixo = basename($_FILES['i3GEOuploadsimboloarq']['name']); + //sobe arquivo + $Arquivo = $_FILES['i3GEOuploadsimboloarq']['tmp_name']; + if(file_exists($dirmap."/".$nomePrefixo.".shp")) + {echo "

Já existe um SHP com o nome ".$dirmap."/".$nomePrefixo;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.";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(!file_exists($dirmap."/".$nomePrefixo.".shp")) + {echo "

Ocorreu algum problema no envio do arquivo ".$dirmap."/".$nomePrefixo;paraAguarde();exit;} + + echo "

Arquivo enviado.

"; + echo "

Nome: ".$dirmap."/".$nomePrefixo.".shp

"; + 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",$nomePrefixo.".shp"); + $novolayer->setmetadata("TEMA",$nomePrefixo.".shp"); + $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($uploadEPSG) && $uploadEPSG != "") + {$novolayer->setProjection("init=epsg:".$uploadEPSG);} + //$adiciona = ms_newLayerObj($mapa, $novolayer); + $salvo = $mapa->save($map_file); + //grava os templates de cada tema + echo "

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

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

"; +} +paraAguarde(); +function paraAguarde(){ + echo ""; +} +function verificaNome($nome) +{ + $nome = strtolower($nome); + $lista = explode(".",$nome); + $extensao = $lista[count($lista) - 1]; + if(($extensao != "dbf") && ($extensao != "shx") && ($extensao != "shp")) + { + echo "Nome de arquivo inválido."; + paraAguarde(); + exit; + } +} +?> + + -- libgit2 0.21.2