Commit c316c980a08111cb2d9de2ca6ad3c21ef32b2617

Authored by Edmar Moretti
1 parent 8558eedb

Inclusão de opção para enviar arquivo shapefile para o servidor em uma pasta específica

admin/html/subirshapefile.html 0 → 100644
... ... @@ -0,0 +1,66 @@
  1 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2 +<html>
  3 +<head>
  4 + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  5 + <title>Shape file</title>
  6 + <style type="text/css">
  7 + /*margin and padding on body element
  8 + can introduce errors in determining
  9 + element position and are not recommended;
  10 + we turn them off as a foundation for YUI
  11 + CSS treatments. */
  12 + body {
  13 + margin:0;
  14 + padding:0;
  15 + }
  16 + </style>
  17 + <script type="text/javascript" src="../../classesjs/i3geo.js"></script>
  18 + <script type="text/javascript" src="../../ferramentas/upload/index.js.php"></script>
  19 + <script type="text/javascript" src="../js/core.js"></script>
  20 +
  21 +</head>
  22 +<body class=" yui-skin-sam" style="background:white;margin:20px">
  23 +<div id=cabecalhoPrincipal style=width:80%;text-align:left;>
  24 +</div>
  25 +<br><br>
  26 +<div id="conteudo" style="width:500px" >
  27 +</div>
  28 +<script>
  29 +/*
  30 +Title: Subir shapefile
  31 +
  32 +Envia um arquivo shape file para o servidor
  33 +
  34 +Licenca:
  35 +
  36 +GPL2
  37 +
  38 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  39 +
  40 +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
  41 +Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
  42 +
  43 +Este programa é software livre; você pode redistribuí-lo
  44 +e/ou modificá-lo sob os termos da Licença Pública Geral
  45 +GNU conforme publicada pela Free Software Foundation;
  46 +
  47 +Este programa é distribuído na expectativa de que seja útil,
  48 +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
  49 +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
  50 +Consulte a Licença Pública Geral do GNU para mais detalhes.
  51 +Você deve ter recebido uma cópia da Licença Pública Geral do
  52 +GNU junto com este programa; se não, escreva para a
  53 +Free Software Foundation, Inc., no endereço
  54 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  55 +
  56 +Arquivo:
  57 +
  58 +i3geo/admin/html/subirshapefile.html
  59 +*/
  60 +i3GEO.configura.locaplic = "../..";
  61 +i3GEO.parametros.editor = "sim";
  62 +i3GEO.configura.sid = "";
  63 +cabecalhoGeral("cabecalhoPrincipal","");
  64 +i3GEOF.upload.inicia("conteudo");
  65 +</script>
  66 +</body>
... ...
admin/index.html
... ... @@ -60,6 +60,20 @@ essa cria&amp;ccedil;&amp;atilde;o podem ser obtidos no item &quot;Outras op&amp;ccedil;ões&quot;.&lt;/p&gt;
60 60 </fieldset>
61 61 <br>
62 62 <fieldset>
  63 +<legend>Enviar arquivo para o servidor</legend>
  64 +<div style=display:none; >
  65 +<div id=b1 style=display:none;background-color:beige >
  66 + <p>Envie dados para o servidor para poder utiliz&aacute;-los na cria&ccedil;&atilde;o dos mapfiles</p>
  67 +</div>
  68 +<table class=lista1 >
  69 +<tr onclick="ajuda('b1',this)"><td><div class=ajuda ></div></td><td>Ajuda</td></tr>
  70 +<tr onclick="abre('html/subirshapefile.html')"><td><div class=aplicar ></div></td><td>Shape file</td></tr>
  71 +</table>
  72 +</div>
  73 +</fieldset>
  74 +
  75 +<br>
  76 +<fieldset>
63 77 <legend>Editor de mapfiles</legend>
64 78 <div style=display:none; >
65 79 <div id=a8 style=display:none;background-color:beige >
... ...
ferramentas/upload/index.js.php
... ... @@ -82,9 +82,10 @@ i3GEOF.upload = {
82 82 var ins = '<form id=i3GEOuploadf target="i3GEOuploadiframe" action="'+i3GEO.configura.locaplic+'/ferramentas/upload/upload.php" method="post" ENCTYPE="multipart/form-data">' +
83 83 '<p class="paragrafo" >shp: <br><input class=digitar type="file" size=42 name="i3GEOuploadshp" style="top:0px;left:0px;cursor:pointer;"></p>' +
84 84 '<p class="paragrafo" >shx: <br><input class=digitar type="file" size=42 name="i3GEOuploadshx" style="top:0px;left:0px;cursor:pointer;"></p>' +
85   - '<p class="paragrafo" >dbf: <br><input class=digitar type="file" size=42 name="i3GEOuploaddbf" style="top:0px;left:0px;cursor:pointer;"></p>' +
86   - '<p class="paragrafo" >pasta no servidor<br>onde os dados serão armazenados:<br><input class=digitar type="text" size=50 name="dirDestino" style="top:0px;left:0px;cursor:pointer;"></p>' +
87   - '<p class="paragrafo" >Tipo de geometria: ' +
  85 + '<p class="paragrafo" >dbf: <br><input class=digitar type="file" size=42 name="i3GEOuploaddbf" style="top:0px;left:0px;cursor:pointer;"></p>';
  86 + if(i3GEO.parametros.editor === "sim")
  87 + {ins += '<p class="paragrafo" >pasta no servidor onde os dados<br>serão armazenados (opcional):<br><input class=digitar type="text" size=45 name="dirDestino" style="top:0px;left:0px;cursor:pointer;"></p>';}
  88 + ins += '<p class="paragrafo" >Tipo de geometria: ' +
88 89 ' <select id=tipo name=tipo >' +
89 90 ' <option value="">não conhecido</option>' +
90 91 ' <option value="1">pontual</option>' +
... ... @@ -94,9 +95,9 @@ i3GEOF.upload = {
94 95 '</p>' +
95 96 '<p class=paragrafo >Proje&ccedil;&atilde;o:</p>' +
96 97 '<div id=i3GEOuploadListaepsg width="98%" style="text-align:left;border:1px solid gray;left:0px;overflow:auto;height:60px"></div>' +
97   - '<br><p class="paragrafo" ><input id=i3GEOuploadbotao1 type="button" value="Criar camada" size=12 name="submit">' +
  98 + '<br><p class="paragrafo" ><input id=i3GEOuploadbotao1 type="button" value="Enviar" size=12 name="submit">' +
98 99 '<input type=hidden name=g_sid value="'+i3GEO.configura.sid+'" >' +
99   - '<input type="hidden" name="MAX_FILE_SIZE" value="100000">' +
  100 + '<input type="hidden" name="MAX_FILE_SIZE" value="1000000">' +
100 101 '</form>' +
101 102 '<br><iframe name=i3GEOuploadiframe style="text-align:left;border:1px solid gray;" width="98%" height="60px"></iframe>';
102 103 return ins;
... ... @@ -114,7 +115,7 @@ i3GEOF.upload = {
114 115 };
115 116 titulo = "Upload de shapefile <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=4&idajuda=27' >&nbsp;&nbsp;&nbsp;</a>";
116 117 janela = i3GEO.janela.cria(
117   - "350px",
  118 + "355px",
118 119 "450px",
119 120 "",
120 121 "",
... ...
ferramentas/upload/upload.php
... ... @@ -8,7 +8,7 @@ require_once(&quot;../../classesphp/funcoes_gerais.php&quot;);
8 8 include_once ("../../classesphp/carrega_ext.php");
9 9 error_reporting(E_ALL);
10 10 session_name("i3GeoPHP");
11   -if (isset($g_sid)){
  11 +if(isset($g_sid) && $g_sid != ""){
12 12 session_id($g_sid);
13 13 session_start();
14 14 foreach(array_keys($_SESSION) as $k)
... ... @@ -17,6 +17,7 @@ if (isset($g_sid)){
17 17 ?>
18 18 <html>
19 19 <head>
  20 +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
20 21 <link rel="stylesheet" type="text/css" href="../../css/geral.css" />
21 22 <title></title>
22 23 </head>
... ... @@ -32,8 +33,10 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;]))
32 33 $dirmap = dirname($map_file);
33 34 }
34 35 if(isset($dirDestino)){
  36 + if(!isset($editores))
  37 + {echo "<p class='paragrafo' >Lista de editores não disponível. Não pode gravar fora do diretório temporário";paraAguarde();exit;}
35 38 $dirmap = $dirDestino;
36   - if(verificaEditores() == "nao")
  39 + if(verificaEditores($editores) == "nao")
37 40 {echo "<p class='paragrafo' >Você não é um editor cadastrado. Não pode gravar fora do diretório temporário";paraAguarde();exit;}
38 41 if(!file_exists($dirmap))
39 42 {echo "<p class='paragrafo' >Pasta não existe no servidor";paraAguarde();exit;}
... ... @@ -46,7 +49,7 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;]))
46 49 $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name'])));
47 50 //sobe arquivo
48 51 $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name'];
49   - if(!file_exists($dirmap."/".$nomePrefixo.".shp"))
  52 + if(file_exists($dirmap."/".$nomePrefixo.".shp"))
50 53 {echo "<p class='paragrafo' >Já existe um SHP com o nome ".$dirmap."/".$nomePrefixo;paraAguarde();exit;}
51 54 $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shp");
52 55 if($status != 1)
... ...