Commit 67585339bb8ecac01ddbd40a5d7af0b6e6d5a36b

Authored by Edmar Moretti
1 parent df0733cf

Inclusão de variável de configuração em ms_configura.php para controlar o acesso…

… à pasta no servidor onde arquivos são enviados via upload.
Criação do formulário para upload de arquivos shapefile para o servidor de arquivos e criação automática do respectivo arquivo de configuração mapfile.
admin/admin.db
No preview for this file type
admin1/dicionario/uploadshp.js
1 i3GEOadmin.uploadshp.dicionario = { 1 i3GEOadmin.uploadshp.dicionario = {
2 'pastaArmazenamento' : [ { 2 'pastaArmazenamento' : [ {
3 - pt : "Pasta no servidor onde os dados serão armazenados. Apenas pastas localizadas no mesmo local onde o i3Geo está instalado são permitidas. Exemplo, no caso da instalação ser /var/www e existir a pasta /var/www/data, digite apenas data.", 3 + pt : "Pasta no servidor onde os dados serão armazenados.",
4 en : "", 4 en : "",
5 es : "" 5 es : ""
6 } ], 6 } ],
admin1/index.php
@@ -43,8 +43,8 @@ $_SESSION["i3geoPermiteLoginIp"] = $i3geoPermiteLoginIp; @@ -43,8 +43,8 @@ $_SESSION["i3geoPermiteLoginIp"] = $i3geoPermiteLoginIp;
43 unset($i3geoPermiteLoginIp); 43 unset($i3geoPermiteLoginIp);
44 $_SESSION["i3geoPermiteLogin"] = $i3geoPermiteLogin; 44 $_SESSION["i3geoPermiteLogin"] = $i3geoPermiteLogin;
45 unset($i3geoPermiteLogin); 45 unset($i3geoPermiteLogin);
46 -  
47 - 46 +$_SESSION["i3geoUploadDataWL"] = $i3geoUploadDataWL;
  47 +unset($i3geoUploadDataWL);
48 include "head.php"; 48 include "head.php";
49 ?> 49 ?>
50 <div class="container-fluid migalha" > 50 <div class="container-fluid migalha" >
admin1/php/funcoesAdmin.php
@@ -814,4 +814,20 @@ function removeCabecalhoMapfile($arq,$symbolset=true){ @@ -814,4 +814,20 @@ function removeCabecalhoMapfile($arq,$symbolset=true){
814 return false; 814 return false;
815 } 815 }
816 } 816 }
  817 +function fileContemString($arq,$s){
  818 + if(!file_exists($arq)){
  819 + return false;
  820 + }
  821 + $handle = fopen($arq, 'r');
  822 + $valid = false; // init as false
  823 + while(! feof($handle)) {
  824 + $buffer = fgets($handle);
  825 + if (strpos($buffer, $s) !== false) {
  826 + $valid = TRUE;
  827 + break; // Once you find the string, you should break out the loop.
  828 + }
  829 + }
  830 + fclose($handle);
  831 + return $valid;
  832 +}
817 ?> 833 ?>
admin1/upload/arquivo/exec.php
1 <?php 1 <?php
2 -include_once (dirname ( __FILE__ ) . "/../../../admin/php/login.php");  
3 -  
4 -if (\admin\php\funcoesAdmin\verificaOperacaoSessao ( "admin/html/subirshapefile" ) == false) {  
5 - \admin\php\funcoesAdmin\retornaJSON ( "Vc nao pode realizar essa operacao." ); 2 +/****************************************************************/
  3 +//
  4 +// checa login
  5 +// valida _GET e _POST, juntando em _GET
  6 +// pega algumas variaveis de uso mais comum
  7 +// session_start
  8 +//
  9 +include ("../../php/checaLogin.php");
  10 +\admin\php\login\checaLogin ();
  11 +// funcoes de administracao
  12 +include ($_SESSION ["locaplic"] . "/admin1/php/funcoesAdmin.php");
  13 +//
  14 +// carrega outras funcoes e extensoes do PHP
  15 +//
  16 +include ($_SESSION ["locaplic"] . "/classesphp/carrega_ext.php");
  17 +//
  18 +// conexao com o banco de administracao
  19 +// cria as variaveis $dbh e $dbhw alem de conexaoadmin
  20 +//
  21 +include ($_SESSION ["locaplic"] . "/admin1/php/conexao.php");
  22 +/**
  23 + * ************************************************************
  24 + */
  25 +if (\admin\php\funcoesAdmin\verificaOperacaoSessao ( "admin/html/subirshapefile" ) === false) {
  26 + header ( "HTTP/1.1 403 Vc nao pode realizar essa operacao" );
6 exit (); 27 exit ();
7 } 28 }
  29 +if (! isset ( $idioma ) || $idioma == "") {
  30 + $idioma = "pt";
  31 +}
8 32
9 if (isset ( $_GET ["tipo"] )) { 33 if (isset ( $_GET ["tipo"] )) {
10 $tipo = $_GET ["tipo"]; 34 $tipo = $_GET ["tipo"];
11 } 35 }
12 -// locaplic e usado para definir a pasta de destino  
13 -if (empty ( $_SESSION["locaplic"] )) {  
14 - exit (); 36 +if (! isset ( $_FILES ['i3GEOuploadshp'] ['name'] )) {
  37 + return;
15 } 38 }
16 -  
17 ?> 39 ?>
18 -<html> 40 +<!DOCTYPE html>
  41 +<html lang="pt-br">
19 <head> 42 <head>
20 -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">  
21 -<link rel="stylesheet" type="text/css" href="../../../css/input.css" />  
22 -<link rel="stylesheet" type="text/css" href="../../../css/geral.css" /> 43 +<META HTTP-EQUIV="Content-Type">
  44 +<meta charset='utf-8'>
  45 +<meta http-equiv='X-UA-Compatible' content='IE=edge'>
  46 +<meta name='viewport' content='width=device-width, initial-scale=1'>
  47 +<link rel='stylesheet' type='text/css' href='../../../pacotes/jquery/jquery-ui/jquery-ui.min.css'>
  48 +<link rel='stylesheet' type='text/css' href='//fonts.googleapis.com/css?family=Roboto:300,400,500,700'>
  49 +<link rel='stylesheet' type='text/css' href='//fonts.googleapis.com/icon?family=Material+Icons'>
  50 +<!-- Bootstrap core CSS -->
  51 +<link href='../../../pacotes/bootstrap/css/bootstrap.min.css' rel='stylesheet'>
  52 +<!-- Bootstrap Material Design -->
  53 +<link rel='stylesheet' type='text/css' href='../../../pacotes/bootstrap-material-design/dist/css/bootstrap-material-design.min.css'>
  54 +<link rel='stylesheet' type='text/css' href='../../../pacotes/bootstrap-material-design/dist/css/ripples.min.css'>
  55 +<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  56 +<link href='../../../pacotes/bootstrap/css/ie10-viewport-bug-workaround.css' rel='stylesheet'>
  57 +<!-- Custom styles for this template -->
  58 +<link href='../../../pacotes/font-awesome/css/font-awesome.min.css' rel='stylesheet'>
  59 +
  60 +<link href='../../../pacotes/bootstrap-accessibility-plugin/plugins/css/bootstrap-accessibility.css' rel='stylesheet'>
  61 +<script src='../../../admin1/headjs.php'></script>
23 <script src="../../../classesjs/classe_util.js"></script> 62 <script src="../../../classesjs/classe_util.js"></script>
24 -<title></title>  
25 </head> 63 </head>
26 <body bgcolor="white" style="background-color: white; text-align: left;"> 64 <body bgcolor="white" style="background-color: white; text-align: left;">
27 <p> 65 <p>
28 <?php 66 <?php
29 if (isset ( $_FILES ['i3GEOuploadshp'] ['name'] )) { 67 if (isset ( $_FILES ['i3GEOuploadshp'] ['name'] )) {
30 - $dirDestino = $_POST ["dirDestino"];  
31 - $dirDestino = str_replace(".","",$dirDestino); 68 + $i3GEOuploadCriaMapfile = $_POST ["i3GEOuploadCriaMapfile"];
  69 + $dirDestino = $_SESSION ["i3geoUploadDataWL"] [$_POST ["dirDestino"]];
  70 + $dirDestino = str_replace ( ".", "", $dirDestino );
32 if (empty ( $dirDestino )) { 71 if (empty ( $dirDestino )) {
33 - echo "Pasta n&atilde;o encontrada"; 72 + echo "<div class='alert alert-danger' role='alert'>Pasta n&atilde;o encontrada</div>";
34 exit (); 73 exit ();
35 } 74 }
36 - $checaDestino = dirname ( $_SESSION["locaplic"] );  
37 - $dirDestino = str_replace ( $checaDestino, "", $dirDestino );  
38 - $dirDestino = $checaDestino . "/" . $dirDestino; 75 + // $checaDestino = dirname ( $_SESSION["locaplic"] );
  76 + // $dirDestino = str_replace ( $checaDestino, "", $dirDestino );
  77 + // $dirDestino = $checaDestino . "/" . $dirDestino;
39 78
40 if (isset ( $logExec ) && $logExec ["upload"] == true) { 79 if (isset ( $logExec ) && $logExec ["upload"] == true) {
41 i3GeoLog ( "prog: upload filename:" . $_FILES ['i3GEOuploadshp'] ['name'], $dir_tmp ); 80 i3GeoLog ( "prog: upload filename:" . $_FILES ['i3GEOuploadshp'] ['name'], $dir_tmp );
42 } 81 }
43 82
44 - echo "<p class='paragrafo' >Carregando o arquivo...</p>"; 83 + echo "<div class='alert alert-success' role='alert'>Carregando o arquivo...</div>";
45 ob_flush (); 84 ob_flush ();
46 flush (); 85 flush ();
47 sleep ( 1 ); 86 sleep ( 1 );
48 $dirmap = $dirDestino; 87 $dirmap = $dirDestino;
49 - if (! file_exists ( $dirmap ) || $dirmap == dirname ( $_SESSION["locaplic"] ) || $dirmap == dirname ( $_SESSION["locaplic"] )."/") {  
50 - echo "<p class='paragrafo' >Pasta n&atilde;o existe no servidor ou o local n&atilde;o &eacute; permitido"; 88 + if (! file_exists ( $dirmap ) || $dirmap == dirname ( $_SESSION ["locaplic"] ) || $dirmap == dirname ( $_SESSION ["locaplic"] ) . "/") {
  89 + echo "<div class='alert alert-danger' role='alert'>Pasta n&atilde;o existe no servidor ou o local n&atilde;o &eacute; permitido</div>";
51 exit (); 90 exit ();
52 } 91 }
53 // verifica nomes 92 // verifica nomes
@@ -69,30 +108,26 @@ if (isset ( $_FILES [&#39;i3GEOuploadshp&#39;] [&#39;name&#39;] )) { @@ -69,30 +108,26 @@ if (isset ( $_FILES [&#39;i3GEOuploadshp&#39;] [&#39;name&#39;] )) {
69 // sobe arquivo 108 // sobe arquivo
70 $Arquivo = $_FILES ['i3GEOuploadshp'] ['tmp_name']; 109 $Arquivo = $_FILES ['i3GEOuploadshp'] ['tmp_name'];
71 if (file_exists ( $dirmap . "/" . $nomePrefixo . ".shp" )) { 110 if (file_exists ( $dirmap . "/" . $nomePrefixo . ".shp" )) {
72 - echo "<p class='paragrafo' >J&aacute; existe um SHP com o nome ";  
73 - paraAguarde (); 111 + echo "<div class='alert alert-danger' role='alert'>J&aacute; existe um SHP com o nome!</div>";
74 exit (); 112 exit ();
75 } 113 }
76 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".shp" ); 114 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".shp" );
77 if ($status != 1) { 115 if ($status != 1) {
78 - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHP. Pode ser uma limita&ccedil;&atilde;o quanto ao tamanho do arquivo ou permiss&atilde;o de escrita na pasta indicada.";  
79 - paraAguarde (); 116 + echo "<div class='alert alert-danger' role='alert'>Ocorreu um erro no envio do arquivo SHP. Pode ser uma limita&ccedil;&atilde;o quanto ao tamanho do arquivo ou permiss&atilde;o de escrita na pasta indicada.</div>";
80 exit (); 117 exit ();
81 } 118 }
82 119
83 $Arquivo = $_FILES ['i3GEOuploadshx'] ['tmp_name']; 120 $Arquivo = $_FILES ['i3GEOuploadshx'] ['tmp_name'];
84 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".shx" ); 121 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".shx" );
85 if ($status != 1) { 122 if ($status != 1) {
86 - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo SHX";  
87 - paraAguarde (); 123 + echo "<div class='alert alert-danger' role='alert'>Ocorreu um erro no envio do arquivo SHX</div>";
88 exit (); 124 exit ();
89 } 125 }
90 126
91 $Arquivo = $_FILES ['i3GEOuploaddbf'] ['tmp_name']; 127 $Arquivo = $_FILES ['i3GEOuploaddbf'] ['tmp_name'];
92 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".dbf" ); 128 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".dbf" );
93 if ($status != 1) { 129 if ($status != 1) {
94 - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo DBF";  
95 - paraAguarde (); 130 + echo "<div class='alert alert-danger' role='alert'>Ocorreu um erro no envio do arquivo DBF</div>";
96 exit (); 131 exit ();
97 } 132 }
98 133
@@ -100,47 +135,48 @@ if (isset ( $_FILES [&#39;i3GEOuploadshp&#39;] [&#39;name&#39;] )) { @@ -100,47 +135,48 @@ if (isset ( $_FILES [&#39;i3GEOuploadshp&#39;] [&#39;name&#39;] )) {
100 $Arquivo = $_FILES ['i3GEOuploadprj'] ['tmp_name']; 135 $Arquivo = $_FILES ['i3GEOuploadprj'] ['tmp_name'];
101 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".prj" ); 136 $status = move_uploaded_file ( $Arquivo, $dirmap . "/" . $nomePrefixo . ".prj" );
102 if ($status != 1) { 137 if ($status != 1) {
103 - echo "<p class='paragrafo' >Ocorreu um erro no envio do arquivo PRJ";  
104 - paraAguarde (); 138 + echo "<div class='alert alert-danger' role='alert'>Ocorreu um erro no envio do arquivo PRJ</div>";
105 exit (); 139 exit ();
106 } 140 }
107 } 141 }
108 142
109 if (! file_exists ( $dirmap . "/" . $nomePrefixo . ".shp" )) { 143 if (! file_exists ( $dirmap . "/" . $nomePrefixo . ".shp" )) {
110 - echo "<p class='paragrafo' >Ocorreu algum problema no envio do arquivo ";  
111 - paraAguarde (); 144 + echo "<div class='alert alert-danger' role='alert'>Ocorreu algum problema no envio do arquivo</div>";
112 exit (); 145 exit ();
113 } 146 }
114 147
115 - $checkphp = fileContemString ( $dirmap . "/" . $nomePrefixo . ".prj", "<?" ); 148 + $checkphp = \admin\php\funcoesAdmin\fileContemString ( $dirmap . "/" . $nomePrefixo . ".prj", "<?" );
116 if ($checkphp == true) { 149 if ($checkphp == true) {
117 - echo "Arquivo prj invalido"; 150 + echo "<div class='alert alert-danger' role='alert'>Arquivo prj invalido</div>";
118 unlink ( $dirmap . "/" . $nomePrefixo . ".shp" ); 151 unlink ( $dirmap . "/" . $nomePrefixo . ".shp" );
119 unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" ); 152 unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" );
120 unlink ( $dirmap . "/" . $nomePrefixo . ".shx" ); 153 unlink ( $dirmap . "/" . $nomePrefixo . ".shx" );
121 unlink ( $dirmap . "/" . $nomePrefixo . ".prj" ); 154 unlink ( $dirmap . "/" . $nomePrefixo . ".prj" );
122 exit (); 155 exit ();
123 } 156 }
124 - $checkphp = fileContemString ( $dirmap . "/" . $nomePrefixo . ".shx", "<?" ); 157 + $checkphp = \admin\php\funcoesAdmin\fileContemString ( $dirmap . "/" . $nomePrefixo . ".shx", "<?" );
125 if ($checkphp == true) { 158 if ($checkphp == true) {
126 - echo "Arquivo shx invalido"; 159 + echo "<div class='alert alert-danger' role='alert'>Arquivo shx invalido</div>";
127 unlink ( $dirmap . "/" . $nomePrefixo . ".shp" ); 160 unlink ( $dirmap . "/" . $nomePrefixo . ".shp" );
128 unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" ); 161 unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" );
129 unlink ( $dirmap . "/" . $nomePrefixo . ".shx" ); 162 unlink ( $dirmap . "/" . $nomePrefixo . ".shx" );
130 unlink ( $dirmap . "/" . $nomePrefixo . ".prj" ); 163 unlink ( $dirmap . "/" . $nomePrefixo . ".prj" );
131 exit (); 164 exit ();
132 } 165 }
133 - $checkphp = fileContemString ( $dirmap . "/" . $nomePrefixo . ".dbf", "<?" ); 166 + $checkphp = \admin\php\funcoesAdmin\fileContemString ( $dirmap . "/" . $nomePrefixo . ".dbf", "<?" );
134 if ($checkphp == true) { 167 if ($checkphp == true) {
135 - echo "Arquivo dbf invalido"; 168 + echo "<div class='alert alert-danger' role='alert'>Arquivo dbf invalido</div>";
136 unlink ( $dirmap . "/" . $nomePrefixo . ".shp" ); 169 unlink ( $dirmap . "/" . $nomePrefixo . ".shp" );
137 unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" ); 170 unlink ( $dirmap . "/" . $nomePrefixo . ".dbf" );
138 unlink ( $dirmap . "/" . $nomePrefixo . ".shx" ); 171 unlink ( $dirmap . "/" . $nomePrefixo . ".shx" );
139 unlink ( $dirmap . "/" . $nomePrefixo . ".prj" ); 172 unlink ( $dirmap . "/" . $nomePrefixo . ".prj" );
140 exit (); 173 exit ();
141 } 174 }
142 - echo "<p class='paragrafo' >Arquivo enviado.</p>";  
143 - echo "<p class='paragrafo'></p>"; 175 + echo "<div class='alert alert-success' role='alert'>Arquivo enviado.</div>";
  176 + if ($i3GEOuploadCriaMapfile == "on" && file_exists ( $_SESSION ["locaplic"] . "/temas/" . $nomePrefixo . ".map" )) {
  177 + echo "<div class='alert alert-danger' role='alert'>Arquivo mapfile com esse nome j&aacute; existe.</div>";
  178 + $i3GEOuploadCriaMapfile = "";
  179 + }
144 if ($i3GEOuploadCriaMapfile == "on") { 180 if ($i3GEOuploadCriaMapfile == "on") {
145 // verifica se o usuario marcou a opcao de cria mapfile 181 // verifica se o usuario marcou a opcao de cria mapfile
146 // nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera 182 // nesse caso o aplicativo de upload esta sendo executado de dentro do sistema de administracao, e o mapfile devera
@@ -155,27 +191,35 @@ if (isset ( $_FILES [&#39;i3GEOuploadshp&#39;] [&#39;name&#39;] )) { @@ -155,27 +191,35 @@ if (isset ( $_FILES [&#39;i3GEOuploadshp&#39;] [&#39;name&#39;] )) {
155 $tipo = $sfileObj->type; 191 $tipo = $sfileObj->type;
156 } 192 }
157 if ($tipo == 1) { 193 if ($tipo == 1) {
158 - $tipoLayer = "point"; 194 + $tipoLayer = MS_LAYER_POINT;
159 } 195 }
160 if ($tipo == 3) { 196 if ($tipo == 3) {
161 - $tipoLayer = "line"; 197 + $tipoLayer = MS_LAYER_LINE;
162 } 198 }
163 if ($tipo == 5) { 199 if ($tipo == 5) {
164 - $tipoLayer = "polygon"; 200 + $tipoLayer = MS_LAYER_POLYGON;
165 } 201 }
166 - $funcao = "CRIARNOVOMAP";  
167 - $output = "retorno";  
168 $data = $dirmap . "/" . $nomePrefixo . ".shp"; 202 $data = $dirmap . "/" . $nomePrefixo . ".shp";
169 - include_once ($_SESSION["locaplic"] . "/admin/php/editormapfile.php");  
170 - echo "<b><p class='paragrafo' >Criado!!!<br>";  
171 - echo "Para editar clique: <a href='../../admin/html/editormapfile.html' target=_blank >editar</a>";  
172 - echo "<script>window.scrollTo(0,10000);i3GEO.util.insereCookie('I3GEOletraAdmin','" . $nomePrefixo . "');</script>"; 203 + include ($_SESSION ["locaplic"] . "/admin1/catalogo/mapfile/funcoes.php");
  204 + $cria = \admin\catalogo\mapfile\adicionar ( $_SESSION ["locaplic"], $nomePrefixo, "", $codigo, "", "", $nomePrefixo, "", $nomePrefixo, $nomePrefixo, true, $dbhw );
  205 + if ($cria == true && file_exists ( $_SESSION ["locaplic"] . "/temas/" . $codigo . ".map" )) {
  206 + $mapa = ms_newMapObj ( $_SESSION ["locaplic"] . "/temas/" . $codigo . ".map" );
  207 + $layer = $mapa->getLayerByName ( $codigo );
  208 + $layer->set ( "data", $data );
  209 + $layer->set ( "type", $tipoLayer );
  210 + $mapa->save ( $_SESSION ["locaplic"] . "/temas/" . $codigo . ".map" );
  211 + echo "<div class='alert alert-success' role='alert'>Mapfile $nomePrefixo criado!!!</div>";
  212 + } else {
  213 + echo "<div class='alert alert-danger' role='alert'>Mapfile n&atilde;o pode ser criado criado!!!</div>";
  214 + }
173 } 215 }
174 - echo "<p class='paragrafo'>Pode fechar essa janela.</p>"; 216 + echo "<div class='alert alert-success' role='alert'>Pode fechar essa janela.</div>";
175 } else { 217 } else {
176 - echo "<p class='paragrafo' >Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</p>"; 218 + echo "<div class='alert alert-danger' role='alert'>Erro ao enviar o arquivo. Talvez o tamanho do arquivo seja maior do que o permitido.</div>";
  219 +}
  220 +if (file_exists ( $_SESSION ["locaplic"] . "/temas/" . $nomePrefixo . ".map" )) {
  221 + echo "<div class='alert alert-info' role='alert'><a href='#' onclick=\"abreEditor('$nomePrefixo')\" class='alert-link'>Editar mapfile</a></div>";
177 } 222 }
178 -  
179 function verificaNome($nome) { 223 function verificaNome($nome) {
180 if (strlen ( basename ( $nome ) ) > 200) { 224 if (strlen ( basename ( $nome ) ) > 200) {
181 exit (); 225 exit ();
@@ -190,7 +234,10 @@ function verificaNome($nome) { @@ -190,7 +234,10 @@ function verificaNome($nome) {
190 } 234 }
191 } 235 }
192 ?> 236 ?>
193 -  
194 - 237 +<script>
  238 +function abreEditor (codigo){
  239 + window.parent.location.href = "../../catalogo/mapfile/opcoes/index.php?codigo=" + codigo + "&id_tema";
  240 +}
  241 +</script>
195 </body> 242 </body>
196 </html> 243 </html>
admin1/upload/arquivo/index.php
1 <?php 1 <?php
2 -// TODO incluir icone para abrir o navegador de arquivos para encontrar a pasta no servidor  
3 define ( "ONDEI3GEO", "../../.." ); 2 define ( "ONDEI3GEO", "../../.." );
4 include ("exec.php"); 3 include ("exec.php");
5 -  
6 include "../../head.php"; 4 include "../../head.php";
  5 +// monta o combo com a lista de pastas para armazenar os arquivos
  6 +$chaves = array_keys ( $_SESSION ["i3geoUploadDataWL"] );
  7 +$comboPastas = '<select name="dirDestino" class="form-control" required><option value=""></option>';
  8 +foreach ( $chaves as $c ) {
  9 + $comboPastas .= "<option value='$c'>$c</option>";
  10 +}
  11 +$comboPastas .= "</select>";
7 ?> 12 ?>
8 - <div class="container-fluid migalha" >  
9 - <div class="row">  
10 - <div class="btn-group btn-breadcrumb">  
11 - <a class="btn btn-default" href="../../../init/index.php"><span>i3Geo</span></a>  
12 - <a class="btn btn-default" href="../../index.php"><span>Admin</span></a>  
13 - <a class="btn btn-default" style="pointer-events: none"><span>Upload</span></a>  
14 - <a class="btn btn-default" style="pointer-events: none"><span>Arquivo shapefile</span></a>  
15 - </div> 13 +<div class="container-fluid migalha">
  14 + <div class="row">
  15 + <div class="btn-group btn-breadcrumb">
  16 + <a class="btn btn-default" href="../../../init/index.php">
  17 + <span>i3Geo</span>
  18 + </a>
  19 + <a class="btn btn-default" href="../../index.php">
  20 + <span>Admin</span>
  21 + </a>
  22 + <a class="btn btn-default" style="pointer-events: none">
  23 + <span>Upload</span>
  24 + </a>
  25 + <a class="btn btn-default" style="pointer-events: none">
  26 + <span>Arquivo shapefile</span>
  27 + </a>
16 </div> 28 </div>
17 </div> 29 </div>
  30 +</div>
18 <div class="container"> 31 <div class="container">
19 <div class="row center-block"> 32 <div class="row center-block">
20 <div class="col-md-12"> 33 <div class="col-md-12">
21 <div class="well hidden" id="titulo"> 34 <div class="well hidden" id="titulo">
22 - <button data-toggle="modal" data-target="#ajudaPrincipal"  
23 - class="btn btn-primary btn-fab btn-fab-mini pull-right"> 35 + <button data-toggle="modal" data-target="#ajudaPrincipal" class="btn btn-primary btn-fab btn-fab-mini pull-right">
24 <i class="material-icons">help</i> 36 <i class="material-icons">help</i>
25 </button> 37 </button>
26 <h2> 38 <h2>
@@ -42,28 +54,40 @@ include &quot;../../head.php&quot;; @@ -42,28 +54,40 @@ include &quot;../../head.php&quot;;
42 </div> 54 </div>
43 </div> 55 </div>
44 <div class="container hidden" id="corpo"> 56 <div class="container hidden" id="corpo">
45 - <form style="" target="i3GEOuploadiframe"  
46 - action="exec.php" method="post"  
47 - ENCTYPE="multipart/form-data" onsubmit="javascript:$('#modalUpload').modal('show');" class="form-horizontal" role="form" method="post"> 57 + <form style="" target="i3GEOuploadiframe" action="exec.php" method="post" ENCTYPE="multipart/form-data" onsubmit="javascript:$('#modalUpload').modal('show');" class="form-horizontal" role="form"
  58 + method="post">
48 <div class="row center-block well"> 59 <div class="row center-block well">
49 <div class="col-md-12"> 60 <div class="col-md-12">
50 <h4>{{{txtArquivos}}}</h4> 61 <h4>{{{txtArquivos}}}</h4>
51 <div class="form-group form-group-lg col-md-6"> 62 <div class="form-group form-group-lg col-md-6">
52 - <input name="i3GEOuploadshp" type="file"> <input class="form-control"  
53 - placeholder="SHP" type="text"> 63 + <div class="input-group-btn">
  64 + <button type="button" class="btn btn-primary pull-left" onclick="$(this).parent().find('input[type=file]').click();">SHP</button>
  65 + <input name="i3GEOuploadshp" onchange="$(this).parent().parent().find('.form-control').html($(this).val().split(/[\\|/]/).pop());" style="display: none;" type="file">
  66 + <span class="form-control"></span>
  67 + </div>
54 </div> 68 </div>
55 <div class="form-group form-group-lg col-md-6"> 69 <div class="form-group form-group-lg col-md-6">
56 - <input name="i3GEOuploadshx" type="file"> <input class="form-control"  
57 - placeholder="SHX" type="text"> 70 + <div class="input-group-btn">
  71 + <button type="button" class="btn btn-primary pull-left" onclick="$(this).parent().find('input[type=file]').click();">SHX</button>
  72 + <input name="i3GEOuploadshx" onchange="$(this).parent().parent().find('.form-control').html($(this).val().split(/[\\|/]/).pop());" style="display: none;" type="file">
  73 + <span class="form-control"></span>
  74 + </div>
58 </div> 75 </div>
59 <div class="form-group form-group-lg col-md-6"> 76 <div class="form-group form-group-lg col-md-6">
60 - <input name="i3GEOuploaddbf" type="file"> <input class="form-control"  
61 - placeholder="DBF" type="text"> 77 + <div class="input-group-btn">
  78 + <button type="button" class="btn btn-primary pull-left" onclick="$(this).parent().find('input[type=file]').click();">DBF</button>
  79 + <input name="i3GEOuploaddbf" onchange="$(this).parent().parent().find('.form-control').html($(this).val().split(/[\\|/]/).pop());" style="display: none;" type="file">
  80 + <span class="form-control"></span>
  81 + </div>
62 </div> 82 </div>
63 <div class="form-group form-group-lg col-md-6"> 83 <div class="form-group form-group-lg col-md-6">
64 - <input name="i3GEOuploadprj" type="file"> <input class="form-control"  
65 - placeholder="PRJ (opcional)" type="text"> 84 + <div class="input-group-btn">
  85 + <button type="button" class="btn btn-primary pull-left" onclick="$(this).parent().find('input[type=file]').click();">PRJ</button>
  86 + <input name="i3GEOuploadprj" onchange="$(this).parent().parent().find('.form-control').html($(this).val().split(/[\\|/]/).pop());" style="display: none;" type="file">
  87 + <span class="form-control"></span>
  88 + </div>
66 </div> 89 </div>
  90 +
67 </div> 91 </div>
68 </div> 92 </div>
69 <div class="row center-block well"> 93 <div class="row center-block well">
@@ -71,8 +95,7 @@ include &quot;../../head.php&quot;; @@ -71,8 +95,7 @@ include &quot;../../head.php&quot;;
71 <div class="form-group form-group-lg"> 95 <div class="form-group form-group-lg">
72 <label class="col-md-5 control-label" for="dirDestino">{{{pastaArmazenamento}}}</label> 96 <label class="col-md-5 control-label" for="dirDestino">{{{pastaArmazenamento}}}</label>
73 <div class="col-md-7"> 97 <div class="col-md-7">
74 - <input title="{{{pastaArmazenamento}}}" type="text" value="" class="form-control"  
75 - name="dirDestino" required> 98 + <?php echo $comboPastas; ?>
76 </div> 99 </div>
77 </div> 100 </div>
78 <div class="form-group form-group-lg"> 101 <div class="form-group form-group-lg">
@@ -117,10 +140,14 @@ include &quot;../../head.php&quot;; @@ -117,10 +140,14 @@ include &quot;../../head.php&quot;;
117 </div> 140 </div>
118 <div id="modalUpload" class="modal fade" tabindex="-1"> 141 <div id="modalUpload" class="modal fade" tabindex="-1">
119 <div class="modal-dialog modal-lg"> 142 <div class="modal-dialog modal-lg">
  143 + <div class="modal-header">
  144 + <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  145 + <span aria-hidden="true">&times;</span>
  146 + </button>
  147 + </div>
120 <div class="modal-content"> 148 <div class="modal-content">
121 <div class="modal-body modal-lg"> 149 <div class="modal-body modal-lg">
122 - <iframe name=i3GEOuploadiframe style="text-align: left; border: 0px solid gray;" width="100%"  
123 - height="100%"></iframe> 150 + <iframe name=i3GEOuploadiframe style="text-align: left; border: 0px solid gray;" width="100%" height="500px"></iframe>
124 </div> 151 </div>
125 </div> 152 </div>
126 </div> 153 </div>
ms_configura.php
@@ -132,7 +132,22 @@ $logTransacoes = false; @@ -132,7 +132,22 @@ $logTransacoes = false;
132 Tipo: 132 Tipo:
133 {array} 133 {array}
134 */ 134 */
135 -$i3geoEsquemasWL = array(); 135 +$i3geoEsquemasWL = array("publicy");
  136 +/*
  137 + Variale: $i3geoUploadDataWL
  138 +
  139 + Lista com as pastas (caminho completo) que podem ser utilizadas para o upload de arquivos shapefile.
  140 + O upload e uma funcao disponivel no sistema de administracao do i3Geo.
  141 + Para nao expor o endereco das pastas nos formularios, cada pasta recebe um nome.
  142 +
  143 + Exemplo:
  144 +
  145 + $i3geoUploadDataWL = array( "Pasta 1"=>"/tmp/ms_tmp", "Pasta 2"=>"/var/www/data");
  146 +
  147 + Tipo:
  148 + {array}
  149 + */
  150 +$i3geoUploadDataWL = array( "Pasta 1"=>"/tmp/ms_tmp", "Pasta 2"=>"/var/www/data");
136 151
137 //TODO documentar moodle 152 //TODO documentar moodle
138 /* 153 /*
temas/bacia_ipojuca.map 0 → 100644
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
  1 +MAP
  2 + FONTSET "../symbols/fontes.txt"
  3 + IMAGETYPE "png"
  4 + NAME "MS"
  5 + SIZE -1 -1
  6 + STATUS ON
  7 + SYMBOLSET "../symbols/simbolosv6.sym"
  8 + UNITS METERS
  9 +
  10 + OUTPUTFORMAT
  11 + NAME "png"
  12 + MIMETYPE "image/png"
  13 + DRIVER "AGG/PNG"
  14 + EXTENSION "png"
  15 + IMAGEMODE RGB
  16 + TRANSPARENT FALSE
  17 + END # OUTPUTFORMAT
  18 +
  19 + LEGEND
  20 + KEYSIZE 20 10
  21 + KEYSPACING 5 5
  22 + LABEL
  23 + SIZE MEDIUM
  24 + OFFSET 0 0
  25 + SHADOWSIZE 1 1
  26 + TYPE BITMAP
  27 + END # LABEL
  28 + STATUS OFF
  29 + END # LEGEND
  30 +
  31 + QUERYMAP
  32 + SIZE -1 -1
  33 + STATUS OFF
  34 + STYLE HILITE
  35 + END # QUERYMAP
  36 +
  37 + SCALEBAR
  38 + INTERVALS 4
  39 + LABEL
  40 + SIZE MEDIUM
  41 + OFFSET 0 0
  42 + SHADOWSIZE 1 1
  43 + TYPE BITMAP
  44 + END # LABEL
  45 + SIZE 200 3
  46 + STATUS OFF
  47 + UNITS MILES
  48 + END # SCALEBAR
  49 +
  50 + WEB
  51 + END # WEB
  52 +
  53 + LAYER
  54 + CONNECTION ""
  55 + DATA "/tmp/ms_tmp/bacia_ipojuca.shp"
  56 + METADATA
  57 + "CLASSE" "SIM"
  58 + "permitekmz" "SIM"
  59 + "permitedownload" "SIM"
  60 + "permitekml" "SIM"
  61 + "permiteogc" "SIM"
  62 + "TEMA" "bacia_ipojuca"
  63 + END # METADATA
  64 + NAME "bacia_ipojuca"
  65 + STATUS DEFAULT
  66 + TEMPLATE "none.htm"
  67 + TILEITEM "location"
  68 + TYPE POLYGON
  69 + UNITS METERS
  70 + CLASS
  71 + NAME ""
  72 + STYLE
  73 + COLOR 0 0 0
  74 + SIZE 12
  75 + END # STYLE
  76 + END # CLASS
  77 + END # LAYER
  78 +
  79 +END # MAP