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 45 */
46 46 public $mapa;
47 47 /*
  48 + Variavel: $tema
  49 +
  50 + String
  51 + */
  52 + public $tema;
  53 + /*
48 54 Variavel: $arquivo
49 55  
50 56 Arquivo map file
... ... @@ -120,21 +126,24 @@ $ext - (opcional) extensão geográfica que será aplicada ao
120 126 //error_reporting(0);
121 127 include(dirname(__FILE__)."/../ms_configura.php");
122 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 135 if(file_exists($locaplic."/funcoes_gerais.php"))
128 136 include_once($locaplic."/funcoes_gerais.php");
129 137 else
130 138 include_once("funcoes_gerais.php");
131 139  
  140 + $this->tema = $tema;
132 141 $this->v = versao();
133 142 $this->vi = $this->v["inteiro"];
134 143 $this->v = $this->v["principal"];
135 144  
136 145 $this->locaplic = $locaplic;
137   - if($map_file != "")
  146 + if($map_file != "" && file_exists($map_file))
138 147 {
139 148 $this->mapa = ms_newMapObj($map_file);
140 149 substituiConObj($this->mapa,$postgis_mapa);
... ... @@ -1126,9 +1135,12 @@ function: sld
1126 1135  
1127 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 1144 $this->layer->set("status",MS_DEFAULT);
1133 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 1994 //gera um mapfile para download
1995 1995 //
1996 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 1998 return array("tema"=>$tema,"mapfile"=>"","mapfileurl"=>"","arquivos"=>implode(",",$resultado),"nreg"=>$nreg,"datas"=>$dataArquivos, "shape-zip"=>$nomeshp.".zip");
2015 1999 }
2016   -
2017 2000 /*
2018 2001 Function: verificaDBF
2019 2002  
... ...
ogc/index.js
... ... @@ -264,7 +264,7 @@ function mostraLinksDownload(tema,tipo,disabled){
264 264 tradLinks["tema"] = tema;
265 265 }
266 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 269 arqs = retorno.arquivos.split(",");
270 270 n = arqs.length;
... ...
ogc/index.php
... ... @@ -52,7 +52,6 @@ include &quot;../init/head.php&quot;;
52 52 <script id="templateLinksDownload" type="x-tmpl-mustache">
53 53 <h3>Download</h3>
54 54 <p>{{{linkpagina}}}: <a href="{{{url}}}?temaDownload={{{tema}}}">{{{url}}}?temaDownload={{{tema}}}</a>
55   -<p>{{{map}}}: <a href="{{{mapfile}}}" target="_blank" >{{{mapfile}}}</a></p>
56 55 <p>{{{sld}}}: <a href="{{{sldurl}}}" target="_blank" >{{{sldurl}}}</a>
57 56 <p><a href="{{{urli3geo}}}/fontetema.php?tema={{{tema}}}" target="_blank" >Metadata</a></p>
58 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 268 //g_traducao_ogc vem de dicionario.js
270 269 tradLinks = i3GEO.idioma.objetoIdioma(g_traducao_ogc);
271 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 273 tradLinks["urli3geo"] = window.location.href.split("/ogc")[0];
274 274 //traducao do menu nav
275 275 html = Mustache.to_html(
... ...