Commit 01e42cc1a6902f78773e361a58b157f15f608705
1 parent
c337ad75
Exists in
master
and in
7 other branches
Inclusão de botão, que abre a tela de configuração do plugin layerkml, no editor…
… gráfico de mapfiles. Correção no uso de proxy para obtenção do KML. Um novo proxy foi criado para acesso específico ao kml, com validações de segurança para impedir o uso indevido.
Showing
8 changed files
with
76 additions
and
16 deletions
Show diff stats
classesjs/classe_arvoredecamadas.js
| ... | ... | @@ -2149,9 +2149,6 @@ i3GEO.arvoreDeCamadas = |
| 2149 | 2149 | * Return: {Array} - lista de camadas |
| 2150 | 2150 | */ |
| 2151 | 2151 | filtraCamadas : function(propriedade, valor, operador, camadas) { |
| 2152 | - if (typeof (console) !== 'undefined') | |
| 2153 | - console.info("i3GEO.arvoreDeCamadas.filtraCamadas()"); | |
| 2154 | - | |
| 2155 | 2152 | if(!camadas){ |
| 2156 | 2153 | camadas = i3GEO.arvoreDeCamadas.CAMADAS; |
| 2157 | 2154 | } | ... | ... |
classesjs/classe_plugini3geo.js
| ... | ... | @@ -829,8 +829,8 @@ i3GEO.pluginI3geo = |
| 829 | 829 | } |
| 830 | 830 | parametros = config.parametros; |
| 831 | 831 | ins += |
| 832 | - "<p>Url do arquivo Kml:<br><input name='url' type='text' value='" + parametros.url | |
| 833 | - + "'/></p>" | |
| 832 | + "<p>Url do arquivo Kml:<br><div class='i3geoForm i3geoFormIconeEdita'><input name='url' type='text' value='" + parametros.url | |
| 833 | + + "'/></div></p>" | |
| 834 | 834 | + "<p>Veja o exemplo utilizado no tema _lmapakml.map</p>"; |
| 835 | 835 | return ins; |
| 836 | 836 | }, |
| ... | ... | @@ -906,7 +906,9 @@ i3GEO.pluginI3geo = |
| 906 | 906 | }, |
| 907 | 907 | inicia : function(camada, objMapa) { |
| 908 | 908 | var layerkml; |
| 909 | - url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + camada.plugini3geo.parametros.url; | |
| 909 | + //console.info(camada) | |
| 910 | + //url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + camada.plugini3geo.parametros.url; | |
| 911 | + var url = i3GEO.configura.locaplic + "/ferramentas/layerkml/getkml.php?tema=" + camada.nomeoriginal; | |
| 910 | 912 | layerkml = new OpenLayers.Layer.Vector(camada.name, { |
| 911 | 913 | displayOutsideMaxExtent : true, |
| 912 | 914 | displayInLayerSwitcher : false, | ... | ... |
classesphp/proxy.php
| ... | ... | @@ -50,7 +50,6 @@ if($_GET["tipoRetornoProxy"] == "gml2wkt"){ |
| 50 | 50 | |
| 51 | 51 | echo $resultado; |
| 52 | 52 | |
| 53 | - | |
| 54 | 53 | function gml2wkt($gml){ |
| 55 | 54 | // Parse GML file |
| 56 | 55 | include("funcoes_gerais.php"); |
| ... | ... | @@ -84,6 +83,5 @@ function gml2wkt($gml){ |
| 84 | 83 | $shape = $layer->getShape($layer->getResult(0)); |
| 85 | 84 | $wkt = $shape->towkt(); |
| 86 | 85 | return json_encode(array($wkt)); |
| 87 | -} | |
| 88 | - | |
| 86 | +} | |
| 89 | 87 | ?> |
| 90 | 88 | \ No newline at end of file | ... | ... |
ferramentas/atalhosedicao/index.js
| ... | ... | @@ -185,6 +185,37 @@ i3GEOF.atalhosedicao = |
| 185 | 185 | }); |
| 186 | 186 | $i("i3GEOFatalhosedicaoParametrossql-button").style.width = "200px"; |
| 187 | 187 | |
| 188 | + new YAHOO.widget.Button("i3GEOFatalhosedicaoLayerkml", { | |
| 189 | + onclick : { | |
| 190 | + fn : function() { | |
| 191 | + i3GEO.temaAtivo = i3GEOF.atalhosedicao.tema; | |
| 192 | + YAHOO.namespace("admin"); | |
| 193 | + YAHOO.namespace("admin.container"); | |
| 194 | + core_montaEditor("","450px","500px","","Plugin",true,false,false); | |
| 195 | + var sUrl = i3GEO.configura.locaplic + "/admin1/catalogo/mapfile/exec.php?funcao=pegaPlugin&codigoMap="+i3GEO.temaAtivo+"&codigoLayer="+i3GEO.temaAtivo+"&g_sid="+i3GEO.configura.sid; | |
| 196 | + var montaEditorPlugin = function(retorno){ | |
| 197 | + var plugin = "layerkml"; | |
| 198 | + var ins = "<input type=button title='"+ $trad("salva",i3GEOadmin.core.dicionario) +"' value='"+ $trad("salva",i3GEOadmin.core.dicionario) +"' id=salvarPlugin />" | |
| 199 | + + "<input type=button title='"+ $trad("remove",i3GEOadmin.core.dicionario) +"' value='"+ $trad("remove",i3GEOadmin.core.dicionario) +"' id=removerPlugin />"; | |
| 200 | + //pega os campos do formulario | |
| 201 | + ins += i3GEO.pluginI3geo.formAdmin(plugin,retorno); | |
| 202 | + var ajuda = "<p>Mais informações:<br><a href='"+i3GEO.pluginI3geo.linkAjuda(plugin)+"' target=_blank >" + i3GEO.pluginI3geo.linkAjuda(plugin) + "</a></p>"; | |
| 203 | + $i("editor_bd").innerHTML = ins + ajuda; | |
| 204 | + | |
| 205 | + new YAHOO.widget.Button("salvarPlugin",{ onclick: { fn: function(){ | |
| 206 | + i3GEOF.atalhosedicao.salvarDadosEditorPlugin($i("editor_bd"),plugin,i3GEOF.atalhosedicao.tema,i3GEOF.atalhosedicao.tema); | |
| 207 | + } }}); | |
| 208 | + | |
| 209 | + new YAHOO.widget.Button("removerPlugin",{ onclick: { fn: function(){ | |
| 210 | + i3GEOF.atalhosedicao.salvarDadosEditorPlugin($i("editor_bd"),"",i3GEOF.atalhosedicao.tema,i3GEOF.atalhosedicao.tema); | |
| 211 | + } }}); | |
| 212 | + }; | |
| 213 | + core_pegaDados("",sUrl,montaEditorPlugin); | |
| 214 | + } | |
| 215 | + } | |
| 216 | + }); | |
| 217 | + $i("i3GEOFatalhosedicaoLayerkml-button").style.width = "200px"; | |
| 218 | + | |
| 188 | 219 | new YAHOO.widget.Button("i3GEOFatalhosedicaoTemaComGrafico", { |
| 189 | 220 | onclick : { |
| 190 | 221 | fn : function() { |
| ... | ... | @@ -204,7 +235,7 @@ i3GEOF.atalhosedicao = |
| 204 | 235 | $i("i3GEOFatalhosedicaoCache").checked = true; |
| 205 | 236 | } |
| 206 | 237 | if(tema.classe.toLowerCase() === "nao"){ |
| 207 | - $i("i3GEOFatalhosedicaoClasses").checked = false; | |
| 238 | + $i("i3GEOFatalhosedicaoClasse").checked = false; | |
| 208 | 239 | } |
| 209 | 240 | if(tema.identifica.toLowerCase() === "nao"){ |
| 210 | 241 | $i("i3GEOFatalhosedicaoIdentifica").checked = false; | ... | ... |
ferramentas/atalhosedicao/template_mst.html
| ... | ... | @@ -91,4 +91,7 @@ |
| 91 | 91 | <p class='paragrafo'> |
| 92 | 92 | <input id='i3GEOFatalhosedicaoParametrossql' type='button' value='Parâmetros SQL' /> |
| 93 | 93 | </p> |
| 94 | + <p class='paragrafo'> | |
| 95 | + <input id='i3GEOFatalhosedicaoLayerkml' type='button' value='KML layer' /> | |
| 96 | + </p> | |
| 94 | 97 | </div> |
| 95 | 98 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +<?php | |
| 2 | +include_once(dirname(__FILE__)."/../safe.php"); | |
| 3 | +verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false); | |
| 4 | + | |
| 5 | +$arq = $locaplic."/temas/" . $_GET["tema"] . ".map"; | |
| 6 | +if(!file_exists($arq)){ | |
| 7 | + exit; | |
| 8 | +} | |
| 9 | +$map = ms_newMapObj($arq); | |
| 10 | +$layer = $map->getlayerbyname($_GET["tema"]); | |
| 11 | +if($layer == ""){ | |
| 12 | + exit; | |
| 13 | +} | |
| 14 | +$plugin = $layer->getmetadata("PLUGINI3GEO"); | |
| 15 | +$a = json_decode($plugin); | |
| 16 | +$url = $a->parametros->url; | |
| 17 | + | |
| 18 | +$ch = curl_init(); | |
| 19 | +if(!$ch){ | |
| 20 | + echo "erro curl_init"; | |
| 21 | + exit; | |
| 22 | +} | |
| 23 | +curl_setopt($ch, CURLOPT_URL, $url); | |
| 24 | +curl_setopt($ch, CURLOPT_HEADER, 0); | |
| 25 | +curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| 26 | +if(isset($i3geo_proxy_server) && $i3geo_proxy_server != ""){ | |
| 27 | + curl_setopt($ch, CURLOPT_PROXY, $i3geo_proxy_server); | |
| 28 | +} | |
| 29 | +$resultado = curl_exec($ch); | |
| 30 | +echo $resultado; | |
| 31 | +?> | |
| 0 | 32 | \ No newline at end of file | ... | ... |
js/arvoredecamadas.js
| ... | ... | @@ -2295,9 +2295,6 @@ i3GEO.arvoreDeCamadas = |
| 2295 | 2295 | * Return: {Array} - lista de camadas |
| 2296 | 2296 | */ |
| 2297 | 2297 | filtraCamadas : function(propriedade, valor, operador, camadas) { |
| 2298 | - if (typeof (console) !== 'undefined') | |
| 2299 | - console.info("i3GEO.arvoreDeCamadas.filtraCamadas()"); | |
| 2300 | - | |
| 2301 | 2298 | if(!camadas){ |
| 2302 | 2299 | camadas = i3GEO.arvoreDeCamadas.CAMADAS; |
| 2303 | 2300 | } | ... | ... |
js/plugini3geo.js
| ... | ... | @@ -834,8 +834,8 @@ i3GEO.pluginI3geo = |
| 834 | 834 | } |
| 835 | 835 | parametros = config.parametros; |
| 836 | 836 | ins += |
| 837 | - "<p>Url do arquivo Kml:<br><input name='url' type='text' value='" + parametros.url | |
| 838 | - + "'/></p>" | |
| 837 | + "<p>Url do arquivo Kml:<br><div class='i3geoForm i3geoFormIconeEdita'><input name='url' type='text' value='" + parametros.url | |
| 838 | + + "'/><div></p>" | |
| 839 | 839 | + "<p>Veja o exemplo utilizado no tema _lmapakml.map</p>"; |
| 840 | 840 | return ins; |
| 841 | 841 | }, |
| ... | ... | @@ -914,7 +914,8 @@ i3GEO.pluginI3geo = |
| 914 | 914 | }, |
| 915 | 915 | inicia : function(camada, objMapa) { |
| 916 | 916 | var layerkml, url, temp; |
| 917 | - url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + camada.plugini3geo.parametros.url; | |
| 917 | + //url = i3GEO.configura.locaplic + "/classesphp/proxy.php?url=" + camada.plugini3geo.parametros.url; | |
| 918 | + url = i3GEO.configura.locaplic + "/ferramentas/layerkml/getkml.php?tema=" + camada.nomeoriginal; | |
| 918 | 919 | layerkml = new ol.layer.Vector({ |
| 919 | 920 | name : camada.name, |
| 920 | 921 | isBaseLayer : false, | ... | ... |