Commit fd2557e18ce97b4ba656c836bda16f36d48b0c83

Authored by Edmar Moretti
1 parent 05041b06

Correção na lista de links da ferramenta de download de arquivos. Remoção do lin…

…k para mapfile e correção no link para geração de sld
classesphp/classe_temas.php
@@ -45,6 +45,12 @@ class Temas @@ -45,6 +45,12 @@ class Temas
45 */ 45 */
46 public $mapa; 46 public $mapa;
47 /* 47 /*
  48 + Variavel: $tema
  49 +
  50 + String
  51 + */
  52 + public $tema;
  53 + /*
48 Variavel: $arquivo 54 Variavel: $arquivo
49 55
50 Arquivo map file 56 Arquivo map file
@@ -120,21 +126,24 @@ $ext - (opcional) extensão geográfica que será aplicada ao @@ -120,21 +126,24 @@ $ext - (opcional) extensão geográfica que será aplicada ao
120 //error_reporting(0); 126 //error_reporting(0);
121 include(dirname(__FILE__)."/../ms_configura.php"); 127 include(dirname(__FILE__)."/../ms_configura.php");
122 $this->postgis_mapa = $postgis_mapa; 128 $this->postgis_mapa = $postgis_mapa;
  129 + if($map_file != ""){
  130 + $map_file = str_replace(".map","",$map_file).".map";
  131 + $this->qyfile = str_replace(".map",".qy",$map_file);
  132 + $this->arquivo = $map_file;
  133 + }
123 134
124 - $map_file = str_replace(".map","",$map_file).".map";  
125 - $this->qyfile = str_replace(".map",".qy",$map_file);  
126 - $this->arquivo = $map_file;  
127 if(file_exists($locaplic."/funcoes_gerais.php")) 135 if(file_exists($locaplic."/funcoes_gerais.php"))
128 include_once($locaplic."/funcoes_gerais.php"); 136 include_once($locaplic."/funcoes_gerais.php");
129 else 137 else
130 include_once("funcoes_gerais.php"); 138 include_once("funcoes_gerais.php");
131 139
  140 + $this->tema = $tema;
132 $this->v = versao(); 141 $this->v = versao();
133 $this->vi = $this->v["inteiro"]; 142 $this->vi = $this->v["inteiro"];
134 $this->v = $this->v["principal"]; 143 $this->v = $this->v["principal"];
135 144
136 $this->locaplic = $locaplic; 145 $this->locaplic = $locaplic;
137 - if($map_file != "") 146 + if($map_file != "" && file_exists($map_file))
138 { 147 {
139 $this->mapa = ms_newMapObj($map_file); 148 $this->mapa = ms_newMapObj($map_file);
140 substituiConObj($this->mapa,$postgis_mapa); 149 substituiConObj($this->mapa,$postgis_mapa);
@@ -1126,9 +1135,12 @@ function: sld @@ -1126,9 +1135,12 @@ function: sld
1126 1135
1127 Retorna o SLD correspondente a legenda do tema. 1136 Retorna o SLD correspondente a legenda do tema.
1128 */ 1137 */
1129 - function sld()  
1130 - {  
1131 - if(!$this->layer){return "erro";} 1138 + function sld(){
  1139 + if(!$this->layer){
  1140 + //pega o arquivo na pasta temas pois pode ser que esteja tentando gerar o sld diretamente desse arquivo ja que layer nao foi definido
  1141 + $mapa = ms_newMapObj($this->locaplic."/temas/".$this->tema.".map");
  1142 + $this->layer = $mapa->getlayerbyname($this->tema);
  1143 + }
1132 $this->layer->set("status",MS_DEFAULT); 1144 $this->layer->set("status",MS_DEFAULT);
1133 return $this->layer->generateSLD(); 1145 return $this->layer->generateSLD();
1134 } 1146 }
classesphp/funcoes_gerais.php
@@ -1994,26 +1994,9 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) @@ -1994,26 +1994,9 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa)
1994 //gera um mapfile para download 1994 //gera um mapfile para download
1995 // 1995 //
1996 $nomemapfileurl = ""; 1996 $nomemapfileurl = "";
1997 - /*  
1998 - if(file_exists($temasdir."/".$tema.".map")){  
1999 - $maptemp = ms_newMapObj($temasdir."/".$tema.".map");  
2000 - $numlayers = $maptemp->numlayers;  
2001 - for ($i=0;$i < $numlayers;++$i){  
2002 - $gl = $maptemp->getlayer($i);  
2003 - $gl->set("data","");  
2004 - $gl->set("connection","");  
2005 - }  
2006 - $nomemapfile = $dir_tmp."/".nomerandomico(20)."download.map";  
2007 -  
2008 - $ext = $maptemp->extent;  
2009 - $ext->setextent($rectextent->minx,$rectextent->miny,$rectextent->maxx,$rectextent->maxy);  
2010 - $maptemp->save($nomemapfile);  
2011 - $nomemapfileurl = str_replace($radtmp."/","",$nomemapfile);  
2012 - }  
2013 - */ 1997 +
2014 return array("tema"=>$tema,"mapfile"=>"","mapfileurl"=>"","arquivos"=>implode(",",$resultado),"nreg"=>$nreg,"datas"=>$dataArquivos, "shape-zip"=>$nomeshp.".zip"); 1998 return array("tema"=>$tema,"mapfile"=>"","mapfileurl"=>"","arquivos"=>implode(",",$resultado),"nreg"=>$nreg,"datas"=>$dataArquivos, "shape-zip"=>$nomeshp.".zip");
2015 } 1999 }
2016 -  
2017 /* 2000 /*
2018 Function: verificaDBF 2001 Function: verificaDBF
2019 2002
@@ -264,7 +264,7 @@ function mostraLinksDownload(tema,tipo,disabled){ @@ -264,7 +264,7 @@ function mostraLinksDownload(tema,tipo,disabled){
264 tradLinks["tema"] = tema; 264 tradLinks["tema"] = tema;
265 } 265 }
266 tradLinks["mapfile"] = window.location.protocol + "//" + window.location.host + "/" + retorno.mapfileurl; 266 tradLinks["mapfile"] = window.location.protocol + "//" + window.location.host + "/" + retorno.mapfileurl;
267 - tradLinks["sldurl"] = tradLinks["url"] + "classesphp/mapa_controle.php?funcao=TEMA2SLD&tema=" + retorno.tema + "&map_file=" + retorno.mapfile; 267 + tradLinks["sldurl"] = tradLinks["urli3geo"] + "/ferramentas/legenda/exec.php?funcao=TEMA2SLD&tema=" + retorno.tema + "&map_file=" + retorno.mapfile;
268 268
269 arqs = retorno.arquivos.split(","); 269 arqs = retorno.arquivos.split(",");
270 n = arqs.length; 270 n = arqs.length;
@@ -52,7 +52,6 @@ include &quot;../init/head.php&quot;; @@ -52,7 +52,6 @@ include &quot;../init/head.php&quot;;
52 <script id="templateLinksDownload" type="x-tmpl-mustache"> 52 <script id="templateLinksDownload" type="x-tmpl-mustache">
53 <h3>Download</h3> 53 <h3>Download</h3>
54 <p>{{{linkpagina}}}: <a href="{{{url}}}?temaDownload={{{tema}}}">{{{url}}}?temaDownload={{{tema}}}</a> 54 <p>{{{linkpagina}}}: <a href="{{{url}}}?temaDownload={{{tema}}}">{{{url}}}?temaDownload={{{tema}}}</a>
55 -<p>{{{map}}}: <a href="{{{mapfile}}}" target="_blank" >{{{mapfile}}}</a></p>  
56 <p>{{{sld}}}: <a href="{{{sldurl}}}" target="_blank" >{{{sldurl}}}</a> 55 <p>{{{sld}}}: <a href="{{{sldurl}}}" target="_blank" >{{{sldurl}}}</a>
57 <p><a href="{{{urli3geo}}}/fontetema.php?tema={{{tema}}}" target="_blank" >Metadata</a></p> 56 <p><a href="{{{urli3geo}}}/fontetema.php?tema={{{tema}}}" target="_blank" >Metadata</a></p>
58 <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=shape-zip&bbox=<?php echo $mapext;?>&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}{{{id_medida_variavel}}}" >{{{downwfs}}}</a> 57 <p><a target=blank href="{{{servico}}}OUTPUTFORMAT=shape-zip&bbox=<?php echo $mapext;?>&service=wfs&version=1.1.0&request=getfeature&layers={{{tema}}}&typeName={{{tema}}}{{{id_medida_variavel}}}" >{{{downwfs}}}</a>
@@ -269,7 +268,8 @@ include &quot;../init/head.php&quot;; @@ -269,7 +268,8 @@ include &quot;../init/head.php&quot;;
269 //g_traducao_ogc vem de dicionario.js 268 //g_traducao_ogc vem de dicionario.js
270 tradLinks = i3GEO.idioma.objetoIdioma(g_traducao_ogc); 269 tradLinks = i3GEO.idioma.objetoIdioma(g_traducao_ogc);
271 tradLinks["servico"] = servico; 270 tradLinks["servico"] = servico;
272 - tradLinks["url"] = window.location.href.split("?")[0]; 271 + tradLinks["url"] = window.location.href.split("#")[0];
  272 + tradLinks["url"] = tradLinks["url"].split("?")[0];
273 tradLinks["urli3geo"] = window.location.href.split("/ogc")[0]; 273 tradLinks["urli3geo"] = window.location.href.split("/ogc")[0];
274 //traducao do menu nav 274 //traducao do menu nav
275 html = Mustache.to_html( 275 html = Mustache.to_html(