From fd2557e18ce97b4ba656c836bda16f36d48b0c83 Mon Sep 17 00:00:00 2001 From: edmarmoretti Date: Wed, 2 Nov 2016 00:19:58 -0200 Subject: [PATCH] Correção na lista de links da ferramenta de download de arquivos. Remoção do link para mapfile e correção no link para geração de sld --- classesphp/classe_temas.php | 26 +++++++++++++++++++------- classesphp/funcoes_gerais.php | 19 +------------------ ogc/index.js | 2 +- ogc/index.php | 4 ++-- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/classesphp/classe_temas.php b/classesphp/classe_temas.php index a86dfe4..2e6be07 100755 --- a/classesphp/classe_temas.php +++ b/classesphp/classe_temas.php @@ -45,6 +45,12 @@ class Temas */ public $mapa; /* + Variavel: $tema + + String + */ + public $tema; + /* Variavel: $arquivo Arquivo map file @@ -120,21 +126,24 @@ $ext - (opcional) extensão geográfica que será aplicada ao //error_reporting(0); include(dirname(__FILE__)."/../ms_configura.php"); $this->postgis_mapa = $postgis_mapa; + if($map_file != ""){ + $map_file = str_replace(".map","",$map_file).".map"; + $this->qyfile = str_replace(".map",".qy",$map_file); + $this->arquivo = $map_file; + } - $map_file = str_replace(".map","",$map_file).".map"; - $this->qyfile = str_replace(".map",".qy",$map_file); - $this->arquivo = $map_file; if(file_exists($locaplic."/funcoes_gerais.php")) include_once($locaplic."/funcoes_gerais.php"); else include_once("funcoes_gerais.php"); + $this->tema = $tema; $this->v = versao(); $this->vi = $this->v["inteiro"]; $this->v = $this->v["principal"]; $this->locaplic = $locaplic; - if($map_file != "") + if($map_file != "" && file_exists($map_file)) { $this->mapa = ms_newMapObj($map_file); substituiConObj($this->mapa,$postgis_mapa); @@ -1126,9 +1135,12 @@ function: sld Retorna o SLD correspondente a legenda do tema. */ - function sld() - { - if(!$this->layer){return "erro";} + function sld(){ + if(!$this->layer){ + //pega o arquivo na pasta temas pois pode ser que esteja tentando gerar o sld diretamente desse arquivo ja que layer nao foi definido + $mapa = ms_newMapObj($this->locaplic."/temas/".$this->tema.".map"); + $this->layer = $mapa->getlayerbyname($this->tema); + } $this->layer->set("status",MS_DEFAULT); return $this->layer->generateSLD(); } diff --git a/classesphp/funcoes_gerais.php b/classesphp/funcoes_gerais.php index 9a31835..2270706 100755 --- a/classesphp/funcoes_gerais.php +++ b/classesphp/funcoes_gerais.php @@ -1994,26 +1994,9 @@ function downloadTema2($map_file,$tema,$locaplic,$dir_tmp,$postgis_mapa) //gera um mapfile para download // $nomemapfileurl = ""; - /* - if(file_exists($temasdir."/".$tema.".map")){ - $maptemp = ms_newMapObj($temasdir."/".$tema.".map"); - $numlayers = $maptemp->numlayers; - for ($i=0;$i < $numlayers;++$i){ - $gl = $maptemp->getlayer($i); - $gl->set("data",""); - $gl->set("connection",""); - } - $nomemapfile = $dir_tmp."/".nomerandomico(20)."download.map"; - - $ext = $maptemp->extent; - $ext->setextent($rectextent->minx,$rectextent->miny,$rectextent->maxx,$rectextent->maxy); - $maptemp->save($nomemapfile); - $nomemapfileurl = str_replace($radtmp."/","",$nomemapfile); - } - */ + return array("tema"=>$tema,"mapfile"=>"","mapfileurl"=>"","arquivos"=>implode(",",$resultado),"nreg"=>$nreg,"datas"=>$dataArquivos, "shape-zip"=>$nomeshp.".zip"); } - /* Function: verificaDBF diff --git a/ogc/index.js b/ogc/index.js index f52509a..6de5e30 100755 --- a/ogc/index.js +++ b/ogc/index.js @@ -264,7 +264,7 @@ function mostraLinksDownload(tema,tipo,disabled){ tradLinks["tema"] = tema; } tradLinks["mapfile"] = window.location.protocol + "//" + window.location.host + "/" + retorno.mapfileurl; - tradLinks["sldurl"] = tradLinks["url"] + "classesphp/mapa_controle.php?funcao=TEMA2SLD&tema=" + retorno.tema + "&map_file=" + retorno.mapfile; + tradLinks["sldurl"] = tradLinks["urli3geo"] + "/ferramentas/legenda/exec.php?funcao=TEMA2SLD&tema=" + retorno.tema + "&map_file=" + retorno.mapfile; arqs = retorno.arquivos.split(","); n = arqs.length; diff --git a/ogc/index.php b/ogc/index.php index 8cd7303..ac6822a 100755 --- a/ogc/index.php +++ b/ogc/index.php @@ -52,7 +52,6 @@ include "../init/head.php";