Commit 59f3254d2fb774641814541a5917ce3ce11b8acd

Authored by Edmar Moretti
1 parent 1f85152f

Inclusão de opção de login no testamapfile

admin/admin.db
No preview for this file type
admin/js/core.js
@@ -1745,7 +1745,7 @@ function core_listaDeLetras(onde,nomeFuncao,semLetras){ @@ -1745,7 +1745,7 @@ function core_listaDeLetras(onde,nomeFuncao,semLetras){
1745 */ 1745 */
1746 var jsfiles = []; 1746 var jsfiles = [];
1747 var cssfiles = []; 1747 var cssfiles = [];
1748 - if(typeof(i3GEO) !== 'undefined' && i3GEO.locaplic){ 1748 + if(typeof(i3GEO) !== 'undefined' && i3GEO.configura.locaplic){
1749 scriptLocation = ""; 1749 scriptLocation = "";
1750 jsfiles = []; 1750 jsfiles = [];
1751 // 1751 //
js/interface.js
@@ -725,18 +725,18 @@ i3GEO.Interface = @@ -725,18 +725,18 @@ i3GEO.Interface =
725 removeAoAdicionar : true, 725 removeAoAdicionar : true,
726 classeCadeado : "i3GEOiconeAberto", 726 classeCadeado : "i3GEOiconeAberto",
727 autoPan : true, 727 autoPan : true,
728 - autoPanAnimation: {  
729 - duration: 250 728 + autoPanAnimation : {
  729 + duration : 250
730 }, 730 },
731 - width: '200px',  
732 - baloes: [] 731 + width : '200px',
  732 + baloes : []
733 }, 733 },
734 balao : function(texto, completo, x, y) { 734 balao : function(texto, completo, x, y) {
735 var icone, painel, b, cabecalho, conteudo, p = i3GEO.Interface.openlayers.BALAOPROP, removeBaloes; 735 var icone, painel, b, cabecalho, conteudo, p = i3GEO.Interface.openlayers.BALAOPROP, removeBaloes;
736 736
737 - removeBaloes = function(){ 737 + removeBaloes = function() {
738 var t, n = i3GEO.Interface.openlayers.BALAOPROP.baloes.length, i; 738 var t, n = i3GEO.Interface.openlayers.BALAOPROP.baloes.length, i;
739 - for(i=0; i<n; i++){ 739 + for (i = 0; i < n; i++) {
740 t = i3GEO.Interface.openlayers.BALAOPROP.baloes[i]; 740 t = i3GEO.Interface.openlayers.BALAOPROP.baloes[i];
741 t.setPosition(undefined); 741 t.setPosition(undefined);
742 t.getElement().parentNode.innerHTML = ""; 742 t.getElement().parentNode.innerHTML = "";
@@ -744,7 +744,7 @@ i3GEO.Interface = @@ -744,7 +744,7 @@ i3GEO.Interface =
744 i3GEO.Interface.openlayers.BALAOPROP.baloes = []; 744 i3GEO.Interface.openlayers.BALAOPROP.baloes = [];
745 return false; 745 return false;
746 }; 746 };
747 - if(p.classeCadeado === "i3GEOiconeAberto"){ 747 + if (p.classeCadeado === "i3GEOiconeAberto") {
748 removeBaloes(); 748 removeBaloes();
749 } 749 }
750 painel = document.createElement("div"); 750 painel = document.createElement("div");
@@ -753,7 +753,7 @@ i3GEO.Interface = @@ -753,7 +753,7 @@ i3GEO.Interface =
753 753
754 cabecalho = document.createElement("div"); 754 cabecalho = document.createElement("div");
755 cabecalho.className = "i3GEOCabecalhoInfoWindow"; 755 cabecalho.className = "i3GEOCabecalhoInfoWindow";
756 - //icone que indica se os baloes devem ficar na tela ou nao 756 + // icone que indica se os baloes devem ficar na tela ou nao
757 icone = document.createElement("div"); 757 icone = document.createElement("div");
758 icone.className = p.classeCadeado; 758 icone.className = p.classeCadeado;
759 icone.onclick = function() { 759 icone.onclick = function() {
@@ -767,7 +767,7 @@ i3GEO.Interface = @@ -767,7 +767,7 @@ i3GEO.Interface =
767 return false; 767 return false;
768 }; 768 };
769 cabecalho.appendChild(icone); 769 cabecalho.appendChild(icone);
770 - //icone das propriedades 770 + // icone das propriedades
771 icone = document.createElement("div"); 771 icone = document.createElement("div");
772 icone.className = "i3GEOiconeFerramentas"; 772 icone.className = "i3GEOiconeFerramentas";
773 icone.style.left = "3px"; 773 icone.style.left = "3px";
@@ -778,7 +778,7 @@ i3GEO.Interface = @@ -778,7 +778,7 @@ i3GEO.Interface =
778 return false; 778 return false;
779 }; 779 };
780 cabecalho.appendChild(icone); 780 cabecalho.appendChild(icone);
781 - //icone mais info 781 + // icone mais info
782 icone = document.createElement("div"); 782 icone = document.createElement("div");
783 icone.className = "i3GEOiconeMais"; 783 icone.className = "i3GEOiconeMais";
784 icone.style.left = "9px"; 784 icone.style.left = "9px";
@@ -787,27 +787,29 @@ i3GEO.Interface = @@ -787,27 +787,29 @@ i3GEO.Interface =
787 return false; 787 return false;
788 }; 788 };
789 cabecalho.appendChild(icone); 789 cabecalho.appendChild(icone);
790 - //icone x 790 + // icone x
791 icone = document.createElement("div"); 791 icone = document.createElement("div");
792 icone.className = "ol-popup-closer"; 792 icone.className = "ol-popup-closer";
793 icone.onclick = removeBaloes; 793 icone.onclick = removeBaloes;
794 cabecalho.appendChild(icone); 794 cabecalho.appendChild(icone);
795 795
796 painel.appendChild(cabecalho); 796 painel.appendChild(cabecalho);
797 - 797 +
798 conteudo = document.createElement("div"); 798 conteudo = document.createElement("div");
799 conteudo.innerHTML = texto; 799 conteudo.innerHTML = texto;
800 painel.appendChild(conteudo); 800 painel.appendChild(conteudo);
801 - 801 +
802 b = new ol.Overlay({ 802 b = new ol.Overlay({
803 - element: painel,  
804 - stopEvent: true,  
805 - autoPan: p.autoPan,  
806 - autoPanAnimation: p.autoPanAnimation 803 + element : painel,
  804 + stopEvent : true,
  805 + autoPan : p.autoPan,
  806 + autoPanAnimation : p.autoPanAnimation
807 }); 807 });
808 p.baloes.push(b); 808 p.baloes.push(b);
809 i3geoOL.addOverlay(b); 809 i3geoOL.addOverlay(b);
810 - b.setPosition([x,y]); 810 + b.setPosition([
  811 + x, y
  812 + ]);
811 }, 813 },
812 /** 814 /**
813 * Redesenha o mapa atual 815 * Redesenha o mapa atual
@@ -861,8 +863,10 @@ i3GEO.Interface = @@ -861,8 +863,10 @@ i3GEO.Interface =
861 ol.layer.Layer.prototype.getVisibility = function(v) { 863 ol.layer.Layer.prototype.getVisibility = function(v) {
862 this.getVisible(v); 864 this.getVisible(v);
863 }; 865 };
864 - i3geoOL.panTo = function(x,y){  
865 - this.getView().setCenter([x,y]); 866 + i3geoOL.panTo = function(x, y) {
  867 + this.getView().setCenter([
  868 + x, y
  869 + ]);
866 }; 870 };
867 i3geoOL.getLayersByName = function(nome) { 871 i3geoOL.getLayersByName = function(nome) {
868 var res = [], layers = this.getLayers(), n = layers.getLength(), i; 872 var res = [], layers = this.getLayers(), n = layers.getLength(), i;
@@ -1395,17 +1399,15 @@ i3GEO.Interface = @@ -1395,17 +1399,15 @@ i3GEO.Interface =
1395 source = new ol.source.TileWMS({ 1399 source = new ol.source.TileWMS({
1396 url : urllayer, 1400 url : urllayer,
1397 params : { 1401 params : {
1398 - //'LAYERS' : camada.wmsname, 1402 + // 'LAYERS' : camada.wmsname,
1399 'VERSION' : '1.1.0' 1403 'VERSION' : '1.1.0'
1400 - //'format' : camada.wmsformat 1404 + // 'format' : camada.wmsformat
1401 }, 1405 },
1402 projection : camada.wmssrs 1406 projection : camada.wmssrs
1403 }); 1407 });
1404 source.set("tipoServico", "ImageWMS"); 1408 source.set("tipoServico", "ImageWMS");
1405 opcoes.singleTile = false; 1409 opcoes.singleTile = false;
1406 } 1410 }
1407 - source.set("name", camada.name);  
1408 - opcoes.source = source;  
1409 opcoes.title = camada.tema; 1411 opcoes.title = camada.tema;
1410 opcoes.name = camada.name; 1412 opcoes.name = camada.name;
1411 opcoes.isBaseLayer = false; 1413 opcoes.isBaseLayer = false;
@@ -1463,11 +1465,12 @@ i3GEO.Interface = @@ -1463,11 +1465,12 @@ i3GEO.Interface =
1463 }); 1465 });
1464 source.set("tipoServico", "WMTS"); 1466 source.set("tipoServico", "WMTS");
1465 } 1467 }
1466 - source.set("name", camada.name);  
1467 - opcoes.source = source;  
1468 opcoes.title = camada.tema; 1468 opcoes.title = camada.tema;
1469 opcoes.name = camada.name; 1469 opcoes.name = camada.name;
1470 } 1470 }
  1471 + source.set("name", camada.name);
  1472 + source.set("parametrosUrl", {par : ""});
  1473 + opcoes.source = source;
1471 opcoes.isBaseLayer = false; 1474 opcoes.isBaseLayer = false;
1472 opcoes.visible = true; 1475 opcoes.visible = true;
1473 if (i3GEO.arvoreDeCamadas.BARRAPROGRESSO === true) { 1476 if (i3GEO.arvoreDeCamadas.BARRAPROGRESSO === true) {
@@ -1526,14 +1529,6 @@ i3GEO.Interface = @@ -1526,14 +1529,6 @@ i3GEO.Interface =
1526 * Altera a posicao do layer de desenho de figuras, posicionando-o sobre todos os demais 1529 * Altera a posicao do layer de desenho de figuras, posicionando-o sobre todos os demais
1527 */ 1530 */
1528 sobeLayersGraficos : function() { 1531 sobeLayersGraficos : function() {
1529 - //TODO remover?  
1530 - return;  
1531 - var nlayers = i3geoOL.getNumLayers(), layers = i3geoOL.layers, i;  
1532 - for (i = 0; i < nlayers; i++) {  
1533 - if (layers[i].CLASS_NAME == "OpenLayers.Layer.Vector" && layers[i].name != "Nenhum") {  
1534 - i3geoOL.raiseLayer(i3geoOL.layers[i], nlayers);  
1535 - }  
1536 - }  
1537 }, 1532 },
1538 /** 1533 /**
1539 * Inverte o modo de desenho para uso de TILES ou nao 1534 * Inverte o modo de desenho para uso de TILES ou nao
@@ -1565,16 +1560,25 @@ i3GEO.Interface = @@ -1565,16 +1560,25 @@ i3GEO.Interface =
1565 * Modifica um parametro da URL de um layer 1560 * Modifica um parametro da URL de um layer
1566 */ 1561 */
1567 alteraParametroLayers : function(parametro, valor) { 1562 alteraParametroLayers : function(parametro, valor) {
1568 - var layers = i3geoOL.layers, nlayers = layers.length, i, url, reg; 1563 + var layer, layers = i3GEO.arvoreDeCamadas.CAMADAS, nlayers = layers.length, i, param, source, k, url = "", n, j;
1569 for (i = 0; i < nlayers; i += 1) { 1564 for (i = 0; i < nlayers; i += 1) {
1570 - if (layers[i].url) {  
1571 - url = layers[i].url;  
1572 - if (url.search("\\?") > 0) {  
1573 - reg = new RegExp(parametro + "([=])+([a-zA-Z0-9_]*)");  
1574 - layers[i].url = url.replace(reg, "");  
1575 - layers[i].url = layers[i].url + "&" + parametro + "=" + valor;  
1576 - layers[i].redraw(); 1565 + layer = i3geoOL.getLayersByName(layers[i].name)[0];
  1566 + if (layer && layer != undefined && layer.get("isBaseLayer") === false) {
  1567 + url = "";
  1568 + source = layer.getSource();
  1569 + param = source.getProperties().parametrosUrl;
  1570 + param[parametro] = valor;
  1571 + chaves = i3GEO.util.listaTodasChaves(param);
  1572 + n = chaves.length;
  1573 + for(j = 0; j < n; j++){
  1574 + k = chaves[j];
  1575 + if(param[k] != "" && k != "par"){
  1576 + url += "&" + k + "=" + param[k];
  1577 + }
1577 } 1578 }
  1579 + param.par = url;
  1580 + console.info(url);
  1581 + source.set("parametrosUrl",param);
1578 } 1582 }
1579 } 1583 }
1580 }, 1584 },
@@ -1698,7 +1702,7 @@ i3GEO.Interface = @@ -1698,7 +1702,7 @@ i3GEO.Interface =
1698 * Atualiza o mapa atual, forcando o redesenho dos layers 1702 * Atualiza o mapa atual, forcando o redesenho dos layers
1699 */ 1703 */
1700 atualizaMapa : function() { 1704 atualizaMapa : function() {
1701 - var camadas = i3GEO.arvoreDeCamadas.CAMADAS, n = camadas.lenght, i; 1705 + var camadas = i3GEO.arvoreDeCamadas.CAMADAS, n = camadas.length, i;
1702 for (i = 0; i < n; i++) { 1706 for (i = 0; i < n; i++) {
1703 i3GEO.Interface.openlayers.atualizaTema("", camadas[i].name); 1707 i3GEO.Interface.openlayers.atualizaTema("", camadas[i].name);
1704 } 1708 }
@@ -1707,28 +1711,37 @@ i3GEO.Interface = @@ -1707,28 +1711,37 @@ i3GEO.Interface =
1707 * Forca o redesenho de um layer especifico 1711 * Forca o redesenho de um layer especifico
1708 */ 1712 */
1709 atualizaTema : function(retorno, tema) { 1713 atualizaTema : function(retorno, tema) {
1710 - var layer = i3geoOL.getLayersByName(tema)[0], objtemas, funcaoLoad, servico, source; 1714 + var layer = i3geoOL.getLayersByName(tema), objtemas, funcaoLoad, servico, source;
  1715 + if(layer.length == 0){
  1716 + return "";
  1717 + }
  1718 + else{
  1719 + layer = layer[0];
  1720 + }
1711 if (layer && layer != undefined) { 1721 if (layer && layer != undefined) {
1712 source = layer.getSource(); 1722 source = layer.getSource();
1713 servico = source.getProperties().tipoServico; 1723 servico = source.getProperties().tipoServico;
1714 - if(servico === "WMTS"){  
1715 - funcaoLoad = layer.getSource().getTileUrlFunction();  
1716 - if(funcaoLoad){ 1724 + if (servico === "WMTS") {
  1725 + funcaoLoad = source.getTileUrlFunction();
  1726 + if (funcaoLoad) {
  1727 + // console.info("atualiza")
1717 layer.getSource().setTileUrlFunction(function() { 1728 layer.getSource().setTileUrlFunction(function() {
  1729 + // camada = i3GEO.arvoreDeCamadas.pegaTema(tema)
  1730 + // if(camada && camada.cache && camada.cache === "nao"){
1718 var url = funcaoLoad.apply(this, arguments); 1731 var url = funcaoLoad.apply(this, arguments);
1719 url = url.replace("&cache=sim", "&cache=nao"); 1732 url = url.replace("&cache=sim", "&cache=nao");
1720 - //console.info(layer.getSource().getProperties().tipoServico)  
1721 - return url.split('&r=')[0] + '&r=' + Math.random(); 1733 + return url.split('&r=')[0] + '&r=' + Math.random() + source.getProperties().parametrosUrl.par;
1722 }); 1734 });
  1735 +
1723 } 1736 }
1724 } 1737 }
1725 - if(servico === "ImageWMS"){  
1726 - funcaoLoad = layer.getSource().getImageLoadFunction();  
1727 - if(funcaoLoad){  
1728 - layer.getSource().setImageLoadFunction(function(image,src) { 1738 + if (servico === "ImageWMS") {
  1739 + funcaoLoad = source.getImageLoadFunction();
  1740 + if (funcaoLoad) {
  1741 + layer.getSource().setImageLoadFunction(function(image, src) {
1729 src = src.replace("&cache=sim", "&cache=nao"); 1742 src = src.replace("&cache=sim", "&cache=nao");
1730 src = src.split('&r=')[0] + '&r=' + Math.random(); 1743 src = src.split('&r=')[0] + '&r=' + Math.random();
1731 - image.getImage().src = src; 1744 + image.getImage().src = src + source.getProperties().parametrosUrl.par;
1732 }); 1745 });
1733 } 1746 }
1734 } 1747 }
@@ -1881,7 +1894,7 @@ i3GEO.Interface = @@ -1881,7 +1894,7 @@ i3GEO.Interface =
1881 y = metrica.lat; 1894 y = metrica.lat;
1882 } 1895 }
1883 } 1896 }
1884 - i3geoOL.panTo(x,y); 1897 + i3geoOL.panTo(x, y);
1885 } 1898 }
1886 }, 1899 },
1887 /** 1900 /**
testamapfile.php
@@ -81,18 +81,21 @@ if ($tipo == &quot;&quot;) @@ -81,18 +81,21 @@ if ($tipo == &quot;&quot;)
81 { 81 {
82 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'; 82 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">';
83 echo '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">'; 83 echo '<html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">';
84 - echo '<link rel="stylesheet" type="text/css" href="admin/html/admin.css">';  
85 - echo '<style>body {COLOR: #2F4632;text-align: justify;font-size: 12px;font-family: Verdana, Arial, Helvetica, sans-serif;}</style>';  
86 -  
87 - echo '</head>'; 84 + echo '<script src="classesjs/i3geo.js"></script>';
88 echo '<script>'; 85 echo '<script>';
89 echo 'function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}'; 86 echo 'function roda(){window.location.href = "?map="+document.getElementById("nomemap").value;}';
90 echo 'function rodaTabela(){window.location.href = window.location.href+"&tabela";}'; 87 echo 'function rodaTabela(){window.location.href = window.location.href+"&tabela";}';
  88 + echo 'i3GEO.configura.locaplic = i3GEO.util.protocolo() + "://" + window.location.host + "/i3geo";';
91 echo '</script>'; 89 echo '</script>';
92 - echo '<body><center><div class="bordaSuperior" >&nbsp;</div><div class="mascaraPrincipal" id="divGeral">';  
93 - echo '<form action="testamapfile.php" method="post" id=f >';  
94 - echo 'Nome do arquivo map existente no diretório i3geo/temas. Exemplo para uso manual da URL: testamapfile.php?map=biomashp (utilize "testamapfile.php?map=todos" na URL para testar todos de uma só vez)<br><br>';  
95 - //echo '<br>Mostra apenas a legenda? <input type=radio name=solegenda value=sim />sim <input type=radio name=solegenda value=nao CHECKED /> n&atilde;o<br>'; 90 + echo '<script src="admin/js/core.js"></script>';
  91 + echo '</head>';
  92 + echo '<body class=" yui-skin-sam" style="background: white;"><center>';
  93 + echo '<div class="bordaSuperior" >&nbsp;</div>';
  94 + echo '<div class="mascaraPrincipal" id="divGeral" style=display:none; >';
  95 + echo '<div id=cabecalhoPrincipal></div>';
  96 + echo '<h1 style="background-color: white; color: black;" >Administra&ccedil;&atilde;o do i3geo - teste de mapfiles </h1>';
  97 + echo '<form action="testamapfile.php" method="post" id=f >';
  98 + echo '<br><p>Nome do arquivo map existente no diretório i3geo/temas. Exemplo para uso manual da URL: testamapfile.php?map=biomashp (utilize "testamapfile.php?map=todos" na URL para testar todos de uma só vez)</p>';
96 $combo = "<br><select onchange='roda()' id=nomemap ><option value=''>Escolha o arquivo para testar</option>"; 99 $combo = "<br><select onchange='roda()' id=nomemap ><option value=''>Escolha o arquivo para testar</option>";
97 foreach ($arqs["arquivos"] as $arq){ 100 foreach ($arqs["arquivos"] as $arq){
98 $temp = explode(".",$arq); 101 $temp = explode(".",$arq);
@@ -101,7 +104,7 @@ if ($tipo == &quot;&quot;) @@ -101,7 +104,7 @@ if ($tipo == &quot;&quot;)
101 } 104 }
102 } 105 }
103 echo $combo."</select></form><br>"; 106 echo $combo."</select></form><br>";
104 - echo '<br><input type=button value="Testa tabela" onclick="rodaTabela();" />'; 107 + echo '<br><input type=button value="Testa tabela" id="rodatabela" />';
105 } 108 }
106 if (isset($map) && $map != "") 109 if (isset($map) && $map != "")
107 { 110 {
@@ -125,9 +128,30 @@ if (isset($map) &amp;&amp; $map != &quot;&quot;) @@ -125,9 +128,30 @@ if (isset($map) &amp;&amp; $map != &quot;&quot;)
125 verifica($map,$solegenda,$tabela); 128 verifica($map,$solegenda,$tabela);
126 } 129 }
127 } 130 }
128 -echo '</div>';  
129 -echo '<script>if(screen.availWidth > 700){document.getElementById("divGeral").style.width = "700px";}</script>';  
130 -echo '</body></html>'; 131 +?>
  132 +
  133 +</div>
  134 +<div id=logajax style="display: block"></div>
  135 +<script>
  136 + if(screen.availWidth > 900){
  137 + document.getElementById("divGeral").style.width = "900px";
  138 + };
  139 + cabecalhoGeral("cabecalhoPrincipal","menus","admin/html/");
  140 + inicia = function() {
  141 + $i("divGeral").style.display = "block";
  142 + };
  143 + i3GEO.login.recarrega = true;
  144 + i3GEO.login.verificaOperacao("admin/html/menus",i3GEO.configura.locaplic, inicia, "sessao", i3GEO.login.dialogo.abreLogin);
  145 + var botao = new YAHOO.widget.Button("rodatabela");
  146 + botao.addClass("abrir150");
  147 + $i("rodatabela-button").onclick = function(){
  148 + rodaTabela();
  149 + };
  150 +</script>
  151 +</body>
  152 +</html>
  153 +
  154 +<?php
131 function verifica($map,$solegenda,$tabela){ 155 function verifica($map,$solegenda,$tabela){
132 global $tipo,$locaplic,$postgis_mapa,$versao,$base,$dir_tmp,$tempo; 156 global $tipo,$locaplic,$postgis_mapa,$versao,$base,$dir_tmp,$tempo;
133 $mapUrl = $map; 157 $mapUrl = $map;
@@ -348,7 +372,7 @@ function verifica($map,$solegenda,$tabela){ @@ -348,7 +372,7 @@ function verifica($map,$solegenda,$tabela){
348 $destino = $dir_tmp."/".nomeRandomico().".map"; 372 $destino = $dir_tmp."/".nomeRandomico().".map";
349 373
350 $mapa->save($destino); 374 $mapa->save($destino);
351 - //echo $destino;exit; 375 + validaAcessoTemas($destino,true);
352 376
353 //testa a tabela de atributos 377 //testa a tabela de atributos
354 if(isset($tabela)){ 378 if(isset($tabela)){