Commit 8558eedbd2236d3ed9990784ee3830cf07c36d07

Authored by Edmar Moretti
1 parent a9c4e1fe

--no commit message

ferramentas/upload/index.js.php
... ... @@ -83,7 +83,8 @@ i3GEOF.upload = {
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 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" >Tipo: ' +
  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: ' +
87 88 ' <select id=tipo name=tipo >' +
88 89 ' <option value="">não conhecido</option>' +
89 90 ' <option value="1">pontual</option>' +
... ... @@ -113,8 +114,8 @@ i3GEOF.upload = {
113 114 };
114 115 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>";
115 116 janela = i3GEO.janela.cria(
116   - "320px",
117   - "400px",
  117 + "350px",
  118 + "450px",
118 119 "",
119 120 "",
120 121 "",
... ...
ferramentas/upload/upload.php
1 1 <?php
  2 +//
  3 +//caso o usuário seja um administrador, ele pode enviar um nome de diretório onde os arquivos serão armazenados
  4 +//na variável $dirDestino
  5 +//
2 6 require_once("../../classesphp/pega_variaveis.php");
3 7 require_once("../../classesphp/funcoes_gerais.php");
4 8 include_once ("../../classesphp/carrega_ext.php");
5 9 error_reporting(E_ALL);
6 10 session_name("i3GeoPHP");
7   -if (isset($g_sid))
8   -{session_id($g_sid);}
9   -session_start();
10   -foreach(array_keys($_SESSION) as $k)
11   -{eval("\$".$k."='".$_SESSION[$k]."';");}
12   -$postgis_mapa = $_SESSION["postgis_mapa"];
  11 +if (isset($g_sid)){
  12 + session_id($g_sid);
  13 + session_start();
  14 + foreach(array_keys($_SESSION) as $k)
  15 + {eval("\$".$k."='".$_SESSION[$k]."';");}
  16 +}
13 17 ?>
14 18 <html>
15 19 <head>
... ... @@ -22,9 +26,18 @@ $postgis_mapa = $_SESSION[&quot;postgis_mapa&quot;];
22 26 if (isset($_FILES['i3GEOuploadshp']['name']))
23 27 {
24 28 require_once ("../../ms_configura.php");
25   - $mapa = ms_newMapObj($map_file);
26 29 echo "<p class='paragrafo' >Carregando o arquivo...</p>";
27   - $dirmap = dirname($map_file);
  30 + if(isset($map_file)){
  31 + $mapa = ms_newMapObj($map_file);
  32 + $dirmap = dirname($map_file);
  33 + }
  34 + if(isset($dirDestino)){
  35 + $dirmap = $dirDestino;
  36 + if(verificaEditores() == "nao")
  37 + {echo "<p class='paragrafo' >Você não é um editor cadastrado. Não pode gravar fora do diretório temporário";paraAguarde();exit;}
  38 + if(!file_exists($dirmap))
  39 + {echo "<p class='paragrafo' >Pasta não existe no servidor";paraAguarde();exit;}
  40 + }
28 41 //verifica nomes
29 42 verificaNome($_FILES['i3GEOuploadshp']['name']);
30 43 verificaNome($_FILES['i3GEOuploadshx']['name']);
... ... @@ -33,6 +46,8 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;]))
33 46 $nomePrefixo = str_replace(" ","_",removeAcentos(str_replace(".shp","",$_FILES['i3GEOuploadshp']['name'])));
34 47 //sobe arquivo
35 48 $Arquivo = $_FILES['i3GEOuploadshp']['tmp_name'];
  49 + if(!file_exists($dirmap."/".$nomePrefixo.".shp"))
  50 + {echo "<p class='paragrafo' >Já existe um SHP com o nome ".$dirmap."/".$nomePrefixo;paraAguarde();exit;}
36 51 $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".shp");
37 52 if($status != 1)
38 53 {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHP";paraAguarde();exit;}
... ... @@ -44,52 +59,55 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;]))
44 59 $status = move_uploaded_file($Arquivo,$dirmap."/".$nomePrefixo.".dbf");
45 60 if($status != 1)
46 61 {echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo DBF";paraAguarde();exit;}
47   - echo "<p class='paragrafo' >Arquivo enviado. Adicionando tema...</p>";
48   - $novolayer = ms_newLayerObj($mapa);
49   - $novolayer->set("data",$dirmap."/".$nomePrefixo.".shp");
50   - $novolayer->set("name",$nomePrefixo.".shp");
51   - $novolayer->setmetadata("TEMA",$nomePrefixo.".shp");
52   - $novolayer->setmetadata("DOWNLOAD","SIM");
53   - $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1);
54   - if(!isset($tipo) || $tipo == "")
55   - {$tipo = $sfileObj->type;}
56   - if ($tipo == 1){$novolayer->set("type",MS_LAYER_POINT);} // ponto
57   - if ($tipo == 3){$novolayer->set("type",MS_LAYER_LINE);}
58   - if ($tipo == 5){$novolayer->set("type",MS_LAYER_POLYGON);}
59   - $novolayer->setmetadata("TEMALOCAL","SIM");
60   - $novolayer->setmetadata("CLASSE","SIM");
61   - $novolayer->setmetadata("TEXTO","NAO");
62   - //if (($tipo != 3) and ($tipo != 8 )){$novolayer->set("type",0);}
63   - $novolayer->setfilter("");
64   - $classe = ms_newClassObj($novolayer);
65   - $classe->set("name","");
66   - $estilo = ms_newStyleObj($classe);
67   - if ($tipo == 1)
68   - {
69   - $estilo->set("symbolname","ponto");
70   - $estilo->set("size",6);
71   - }
72   - $estilo->color->setrgb(200,50,0);
73   - $estilo->outlinecolor->setrgb(0,0,0);
74   - // le os itens
75   - $novolayer->set("status",MS_DEFAULT);
76   - $abriu = $novolayer->open();
77   - $items = $novolayer->getItems();
78   - $fechou = $novolayer->close();
79   - if ($items != "")
80   - {
81   - $its = implode(",",$items);
82   - $novolayer->setmetadata("ITENS",$its);
83   - $novolayer->setmetadata("ITENSDESC",$its);
84   - $novolayer->set("template","none.htm");
  62 + echo "<p class='paragrafo' >Arquivo enviado.</p>";
  63 + if(isset($map_file)){
  64 + echo "<p class='paragrafo' >Adicionando tema...</p>";
  65 + $novolayer = ms_newLayerObj($mapa);
  66 + $novolayer->set("data",$dirmap."/".$nomePrefixo.".shp");
  67 + $novolayer->set("name",$nomePrefixo.".shp");
  68 + $novolayer->setmetadata("TEMA",$nomePrefixo.".shp");
  69 + $novolayer->setmetadata("DOWNLOAD","SIM");
  70 + $sfileObj = ms_newShapefileObj($dirmap."/".$nomePrefixo.".shp", -1);
  71 + if(!isset($tipo) || $tipo == "")
  72 + {$tipo = $sfileObj->type;}
  73 + if ($tipo == 1){$novolayer->set("type",MS_LAYER_POINT);} // ponto
  74 + if ($tipo == 3){$novolayer->set("type",MS_LAYER_LINE);}
  75 + if ($tipo == 5){$novolayer->set("type",MS_LAYER_POLYGON);}
  76 + $novolayer->setmetadata("TEMALOCAL","SIM");
  77 + $novolayer->setmetadata("CLASSE","SIM");
  78 + $novolayer->setmetadata("TEXTO","NAO");
  79 + //if (($tipo != 3) and ($tipo != 8 )){$novolayer->set("type",0);}
  80 + $novolayer->setfilter("");
  81 + $classe = ms_newClassObj($novolayer);
  82 + $classe->set("name","");
  83 + $estilo = ms_newStyleObj($classe);
  84 + if ($tipo == 1)
  85 + {
  86 + $estilo->set("symbolname","ponto");
  87 + $estilo->set("size",6);
  88 + }
  89 + $estilo->color->setrgb(200,50,0);
  90 + $estilo->outlinecolor->setrgb(0,0,0);
  91 + // le os itens
  92 + $novolayer->set("status",MS_DEFAULT);
  93 + $abriu = $novolayer->open();
  94 + $items = $novolayer->getItems();
  95 + $fechou = $novolayer->close();
  96 + if ($items != "")
  97 + {
  98 + $its = implode(",",$items);
  99 + $novolayer->setmetadata("ITENS",$its);
  100 + $novolayer->setmetadata("ITENSDESC",$its);
  101 + $novolayer->set("template","none.htm");
  102 + }
  103 + if(isset($uploadEPSG) && $uploadEPSG != "")
  104 + {$novolayer->setProjection("init=epsg:".$uploadEPSG);}
  105 + //$adiciona = ms_newLayerObj($mapa, $novolayer);
  106 + $salvo = $mapa->save($map_file);
  107 + //grava os templates de cada tema
  108 + echo "<p class='paragrafo' >Tema criado!!! Redesenhando o mapa.";
  109 + echo "<script>window.parent.i3GEO.atualiza()</script>";
85 110 }
86   - if(isset($uploadEPSG) && $uploadEPSG != "")
87   - {$novolayer->setProjection("init=epsg:".$uploadEPSG);}
88   - //$adiciona = ms_newLayerObj($mapa, $novolayer);
89   - $salvo = $mapa->save($map_file);
90   - //grava os templates de cada tema
91   - echo "<p class='paragrafo' >Tema criado!!! Redesenhando o mapa.";
92   - echo "<script>window.parent.i3GEO.atualiza()</script>";
93 111 }
94 112 else
95 113 {
... ... @@ -97,7 +115,7 @@ else
97 115 }
98 116 paraAguarde();
99 117 function paraAguarde(){
100   - echo "<script>window.parent.i3GEOF.upload.aguarde.visibility='hidden';</script>";
  118 + echo "<script>try{window.parent.i3GEOF.upload.aguarde.visibility='hidden';}catch(e){};</script>";
101 119 }
102 120 function verificaNome($nome)
103 121 {
... ...
interface/openlayers.htm
... ... @@ -100,7 +100,7 @@
100 100 </div>
101 101 </div>
102 102 </div>
103   -<script src="../classesjs/i3geo.js"></script>
  103 +<script src="../classesjs/i3geonaocompacto.js"></script>
104 104 <script src="../pacotes/openlayers/OpenLayers211.js.php"></script>
105 105 <!-- estilo necessário para a ferramenta de edição -->
106 106 <style>
... ...