From acf8a3e0840b187f70228013cc5540c8305a93ce Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Wed, 25 May 2016 20:29:22 -0300 Subject: [PATCH] Nova página do gerador de links em Bootstrap --- init/imagens/insert-link.png | Bin 8618 -> 0 bytes init/index.js | 2 +- permlinks/dicionario.js | 11 +++-------- permlinks/index.js | 362 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ permlinks/index.php | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------- 5 files changed, 330 insertions(+), 336 deletions(-) diff --git a/init/imagens/insert-link.png b/init/imagens/insert-link.png index d66cb2a..991db7e 100755 Binary files a/init/imagens/insert-link.png and b/init/imagens/insert-link.png differ diff --git a/init/index.js b/init/index.js index 8b41397..9a55ac4 100755 --- a/init/index.js +++ b/init/index.js @@ -78,7 +78,7 @@ botoesIni = [ "target": "_self" },{ "img":"insert-link.png", - "href": location.href.replace("index.php","") + "../geradordelinks.htm", + "href": location.href.replace("index.php","") + "../permlinks/index.php", "titulo":$trad(13,g_traducao_init), "subtitulo": $trad("13a",g_traducao_init), "fa": "map-o", diff --git a/permlinks/dicionario.js b/permlinks/dicionario.js index 194d93c..50e1363 100755 --- a/permlinks/dicionario.js +++ b/permlinks/dicionario.js @@ -1,13 +1,8 @@ //veja em index.js o objeto que utiliza essa traducao -g_traducao_mapas = +g_traducao_permlinks = { - "mapas" : [{ - pt : "Mapas de usuários", - en : "", - es : "" - }], - "copiado" : [{ - pt : "Copiado", + "migalha" : [{ + pt : "Links permanentes", en : "", es : "" }] diff --git a/permlinks/index.js b/permlinks/index.js index f2175c0..ba57377 100755 --- a/permlinks/index.js +++ b/permlinks/index.js @@ -46,37 +46,11 @@ Veja -*/ -// + */ + //carrega as dependências -// - -//TODO aplicar o padrao de css nos inputs (ver HTML) -(function(){ - var scriptLocation = ""; - var scripts = document.getElementsByTagName('script'); - for (var i = 0; i < scripts.length; i++) { - var src = scripts[i].getAttribute('src'); - if (src) { - var index = src.lastIndexOf("index.js"); - // is it found, at the end of the URL? - if ((index > -1) && (index + "index.js".length == src.length)) { - scriptLocation = src.slice(0, -"index.js".length); - break; - } - } - } - var allScriptTags = ""; - var jsfiles = []; - //jsfiles[0] = "i3geo_tudo_compacto.js.php" - jsfiles[0] = "../pacotes/openlayers/OpenLayers2131.js.php"; - for (var i = 0; i < jsfiles.length; i++) - { - var currentScriptTag = ""; - allScriptTags += currentScriptTag; - } - document.write(allScriptTags); -})(); + + /* Classe i3geo_gl_configura @@ -105,7 +79,7 @@ tema - Id do elemento HTML que receberá o combo com a lista de temas buscageo - Id do elemento HTML onde será incluída a opção de busca de coordenadas geográficas menu - id do elemento HTML onde será incluido a lista de menus -*/ + */ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tema,buscageo,menu) { /* @@ -118,31 +92,31 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem this.link = link; /* Guarda o valor do parametro seltema - */ + */ this.nomeseltema = nomeseltema; /* Guarda o valor do parametro loc_i3geo - */ + */ this.loc_i3geo = loc_i3geo; /* Guarda o valor do parametro menu - */ + */ this.menu = menu; /* Guarda o valor do parametro grupo - */ + */ this.grupo = grupo; /* Guarda o valor do parametro subgrupo - */ + */ this.subgrupo = subgrupo; /* Guarda o valor do parametro tema - */ + */ this.tema = tema; /* Guarda o valor do parametro buscageo - */ + */ this.buscageo = buscageo; /* Function seltema @@ -155,65 +129,28 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem idtema = identificador do tema conforme definido em menutemas/menutemas.xml */ - this.seltema = function(idtema) - { - var novodiv = document.createElement("div"); - novodiv.style.textAlign="left"; - novodiv.id = idtema; - $i($i3geo_gl.temasa).appendChild(novodiv); - var novoel = document.createElement("img"); - novoel.title = "excluir"; - //novoel.onclick = excluir - eval("novoel.onclick = $i3geo_gl.excluir"); - novoel.src = "imagens/x.png"; - novodiv.appendChild(novoel); - var novoel = document.createElement("img"); - novoel.title = "subir"; - novoel.src = "imagens/sobe.gif"; - //novoel.onclick = subir - eval("novoel.onclick = $i3geo_gl.subir"); - novodiv.appendChild(novoel); - var novoel = document.createElement("img"); - novoel.title = "descer"; - novoel.src = "imagens/desce.gif"; - //novoel.onclick = descer - eval("novoel.onclick = $i3geo_gl.descer;"); - novodiv.appendChild(novoel); - var novoel = document.createElement("input"); - eval("novoel.onclick = function(){$i3geo_gl.crialink()}"); - novoel.title = "visível/não visível"; - novoel.type = "checkbox"; - novoel.style.cursor="pointer"; - novoel.style.top="3px"; - novoel.style.position="relative"; - novoel.style.border="0px"; - novoel.value=idtema; - novodiv.appendChild(novoel); - var novoel = document.createElement("span"); - novoel.style.cursor="pointer"; - novoel.title="preview"; - novoel.style.textDecoration = "underline"; - novoel.innerHTML = idtema; - eval("novoel.onclick = $i3geo_gl.preview"); - novodiv.appendChild(novoel); - novodiv.appendChild(document.createElement("br")); + this.seltema = function(idtema){ + var html = Mustache.to_html( + $("#templateCamada").html(), + {"idtema": idtema} + ); + //console.info(html) + $("#"+$i3geo_gl.temasa).append(html); this.crialink(); }; /* Function crialink Pega os parametros especificados pelo usuário e monta o link para mostrar na tela. - */ + */ this.crialink = function() { var ins = $i3geo_gl.loc_i3geo+"/ms_criamapa.php?"; var iguias = $i($i3geo_gl.temasa).getElementsByTagName("input"); var tsl = []; //temas ligados var tsd = []; //temas - for (var i=0;i 0) {ins += "&layers="+tsl.join(" ");} - if($i("pontos").value != "") - { + if($i("pontos").value != ""){ ins += "&pontos="+$i("pontos").value; ins += "&nometemapontos="+$i("nometemapontos").value; } - if($i("perfili") && $i("perfili").value != "") - { + if($i("perfili") && $i("perfili").value != ""){ ins += "&perfil="+$i("perfili").value; } - if($i("interface").value != "") - { + if($i("interface").value != ""){ ins += "&interface="+$i("interface").value; } - if($i($i3geo_gl.buscageo)) - { - if($i("i3geo_gl_xmin").value != "") - { - ins += "&mapext="+$i("i3geo_gl_xmin").value+" "; - ins += $i("i3geo_gl_ymin").value+" "; - ins += $i("i3geo_gl_xmax").value+" "; - ins += $i("i3geo_gl_ymax").value; - } + + if($i("i3geo_gl_xmin").value != "") { + ins += "&mapext="+$i("i3geo_gl_xmin").value+" "; + ins += $i("i3geo_gl_ymin").value+" "; + ins += $i("i3geo_gl_xmax").value+" "; + ins += $i("i3geo_gl_ymax").value; } + $i($i3geo_gl.link).href = ins; $i($i3geo_gl.link).innerHTML = ins; }; @@ -257,11 +189,34 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Parameters idMenu - id do menu que será pesquisado - */ - this.combogrupos = function(idMenu) - { - $i($i3geo_gl.grupo).innerHTML = "Aguarde..."; - i3GEO.arvoreDeTemas.comboGruposMenu($i3geo_gl.loc_i3geo,"$i3geo_gl.combosubgrupos",$i3geo_gl.grupo,"","530","1",idMenu); + */ + this.combogrupos = function(idMenu){ + $("#temas").html(""); + var grupos = function(retorno){ + if(retorno.data){ + var data = retorno.data, + grupos = data.grupos, + raiz = grupos[grupos.length-3].temasraiz, + temas = []; + + //temas na raiz do menu + temas.push(""); + $(raiz).each(function(i){ + temas.push(""); + }); + $("#temas").html(temas.join("")); + temas = []; + temas.push(""); + //grupos + $(grupos).each(function(i){ + if(grupos[i].id_n1){ + temas.push(""); + } + }); + $("#grupos").html(temas.join("")); + } + }; + i3GEO.php.pegalistadegrupos(grupos, idMenu, "sim"); }; /* Function combosubgrupos @@ -271,15 +226,35 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Parameters idGrupo - id do grupo que será pesquisado - */ - this.combosubgrupos = function(idGrupo,dados) + */ + this.combosubgrupos = function(idGrupo) { - //alert($i3geo_gl.subgrupo); - $i3geo_gl.combotemas(idGrupo,"",i3GEO.arvoreDeTemas.temasRaizGrupos[idGrupo]); - //if(dados != undefined) - //{$i3geo_gl.combotemas(idGrupo,$i3geo_gl.subgrupo,dados.temasgrupo);} - $i($i3geo_gl.subgrupo).innerHTML = "Aguarde..."; - i3GEO.arvoreDeTemas.comboSubGruposMenu($i3geo_gl.loc_i3geo,"$i3geo_gl.combotemas",$i3geo_gl.subgrupo,"",idGrupo,"530","1"); + $("#temas").html(""); + var sgrupos = function(retorno){ + if(retorno.data){ + var data = retorno.data, + sgrupos = data.subgrupo, + raiz = data.temasgrupo, + temas = []; + + //temas na raiz do menu + temas.push(""); + $(raiz).each(function(i){ + temas.push(""); + }); + $("#temas").html(temas.join("")); + temas = []; + temas.push(""); + //subgrupos + $(sgrupos).each(function(i){ + temas.push(""); + }); + $("#subgrupos").html(temas.join("")); + } + }; + i3GEO.php.pegalistadeSubgrupos(sgrupos, "",idGrupo); + + //i3GEO.arvoreDeTemas.comboSubGruposMenu($i3geo_gl.loc_i3geo,"$i3geo_gl.combotemas",$i3geo_gl.subgrupo,"",idGrupo,"",""); }; /* Function combotemas @@ -293,20 +268,20 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem idGrupo - id que identifica o grupo escolhido. idSubGrupo - id do sibgrupo - */ + */ this.combotemas = function (idGrupo,idSubGrupo,temas) { if(temas == undefined) {temas = "";} $i($i3geo_gl.tema).innerHTML = "Aguarde..."; - i3GEO.arvoreDeTemas.comboTemasMenu($i3geo_gl.loc_i3geo,"$i3geo_gl.preseltema",$i3geo_gl.tema,"",idGrupo,idSubGrupo,"530","5","",temas); + i3GEO.arvoreDeTemas.comboTemasMenu($i3geo_gl.loc_i3geo,"$i3geo_gl.preseltema",$i3geo_gl.tema,"",idGrupo,idSubGrupo,"","","",temas); }; this.combointerfaces = function(){ var temp = function(retorno){ - var ins = "", + d = retorno.data, + n = d.length, + i; for(i=0; i"+d[i]+""; } @@ -319,7 +294,7 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Function preseltema Compatibiliza a chamada da função i3geo_combotemasMenu com a função this.seltema em termos de número de parametros - */ + */ this.preseltema = function(idgrupo,idsubgrupo,idtema) { $i3geo_gl.seltema(idtema); @@ -332,7 +307,7 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Parameters e - elemento do DOM do objeto clicado. - */ + */ this.preview = function(e) { var id = i3GEO.util.pegaElementoPai(e).id; @@ -346,14 +321,16 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Parameters e - elemento do DOM do objeto clicado. - */ + */ this.descer = function(e) { - var pai = i3GEO.util.pegaElementoPai(e); - divpai = pai.parentNode; - if(pai.nextSibling) - divpai.insertBefore(pai,pai.nextSibling.nextSibling); + var el = $("#"+e); + var p = el.next("ul"); + if(p){ + p.after(el); + } $i3geo_gl.crialink(); + return false; }; /* Function subir @@ -363,13 +340,16 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Parameters e - elemento do DOM. - */ + */ this.subir = function(e) { - var pai = i3GEO.util.pegaElementoPai(e); - divpai = pai.parentNode; - divpai.insertBefore(pai,pai.previousSibling); + var el = $("#"+e); + var p = el.prev("ul"); + if(p){ + p.before(el); + } $i3geo_gl.crialink(); + return false; }; /* Function excluir @@ -379,101 +359,42 @@ function i3geo_gl_configura(loc_i3geo,nomeseltema,temasa,link,grupo,subgrupo,tem Parameters e - elemento do DOM. - */ - this.excluir = function(e) - { - var pai = i3GEO.util.pegaElementoPai(e); - pai.parentNode.removeChild(pai); + */ + this.excluir = function(e){ + $("#"+e).remove(); $i3geo_gl.crialink(); }; /* Function buscageo_init Inicializa o OpenLayers para permitir ao usuário escolher a abrangência espacial do link. - */ - this.buscageo_init = function() - { - var ins = "
"; - ins += "

Utilize o navegador abaixo para definir as coordenadas geográficas do seu mapa, ou digite os valores desejados (opcional):

"; - ins += ""; - ins += "
"; - ins += "Coordenadas geográficas:

"; - ins += ""; - ins += ""; - ins += ""; - ins += ""; - ins += ""; - ins += ""; - ins += ""; - ins += ""; - ins += "
Longitude mínima:
"; - ins += ""; - ins += "
Longitude máxima:
"; - ins += ""; - ins += "
Latitude mínima:
"; - ins += ""; - ins += "
Latitude máxima:
"; - ins += ""; - ins += "
"; - ins += ""; - ins += "
"; - document.getElementById(this.buscageo).innerHTML = ins; - $i("i3geo_gl_mapa1").style.display = "block"; - $i3geo_gl.OL = new OpenLayers.Map('i3geo_gl_mapa1',{controls:[],numZoomLevels: 13}); - // - //layers - // - var wsm = new OpenLayers.Layer.ArcGIS93Rest( - "ESRI World Street Map", - "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export", - { - format : "jpeg" - }, { - isBaseLayer : true, - visibility : true - }); - $i3geo_gl.OL.addLayer(wsm); - - var bra = new OpenLayers.Layer.WMS( - "Base carto MMA", - "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map", - { - layers : "baseraster", - srs : "EPSG:4618", - format : "image/png", - isBaseLayer : false - }, { - isBaseLayer : true, - visibility : false - }); - $i3geo_gl.OL.addLayer(bra); - - // - //zoom e controle de layers - // - var ls = new OpenLayers.Control.LayerSwitcher(); - $i3geo_gl.OL.addControl(ls); - $i(ls.id).style.zIndex=2000; - $i3geo_gl.OL.setCenter(new OpenLayers.LonLat(-55,-14), 3); - var panel = new OpenLayers.Control.NavToolbar(); - $i3geo_gl.OL.addControl(panel); - panel.div.style.left="-4px"; - panel.div.style.top="-298px"; - var zb = new OpenLayers.Control.PanZoomBar(); - $i3geo_gl.OL.addControl(zb); - zb.div.style.left="0px"; + */ + this.buscageo_init = function(){ + $i3geo_gl.OL = new ol.Map({ + layers: [ + new ol.layer.Tile({ + source: new ol.source.OSM() + }) + ], + target: 'i3geo_gl_mapa1', + view: new ol.View({ + center: [0, 0], + zoom: 2 + }) + }); $i3geo_gl.OL.capturageo = function() { - var b = $i3geo_gl.OL.getExtent(); - $i("i3geo_gl_xmin").value = b.left; - $i("i3geo_gl_xmax").value = b.right; - $i("i3geo_gl_ymin").value = b.bottom; - $i("i3geo_gl_ymax").value = b.top; + var e = $i3geo_gl.OL.getView().calculateExtent($i3geo_gl.OL.getSize()); + e = ol.proj.transformExtent(e,"EPSG:900913","EPSG:4326"); + $i("i3geo_gl_xmin").value = e[0]; + $i("i3geo_gl_xmax").value = e[2]; + $i("i3geo_gl_ymin").value = e[1]; + $i("i3geo_gl_ymax").value = e[3]; + $(".coord").addClass("is-focused"); $i3geo_gl.crialink(); }; }; } - /* Function i3geo_gl_inicia @@ -482,23 +403,20 @@ Inicia a interface do gerador de links. Parameters objeto_i3geo_gl_configura - objeto com os paramentros de configuração criado pela função i3geo_gl_configura -*/ + */ function i3geo_gl_inicia(objeto_i3geo_gl_configura) { /* Propriedade $i3geo_gl Contém o objeto $i3geo_gl com todas as propriedades e funções de controle da interface - */ + */ i3GEO.configura.sid = ""; $i3geo_gl = objeto_i3geo_gl_configura; - if(document.getElementById($i3geo_gl.buscageo)) - $i3geo_gl.buscageo_init(); + if(document.getElementById($i3geo_gl.buscageo)){ + $i3geo_gl.buscageo_init(); + } $i3geo_gl.combointerfaces(); + //pega a lista de menus e as i3GEO.arvoreDeTemas.comboMenus($i3geo_gl.loc_i3geo,"$i3geo_gl.combogrupos",$i3geo_gl.menu,"","530","1",""); - /* - $inputText("paiPontos","","pontos","","","") - $inputText("paiNometemapontos","","nometemapontos","","","") - $inputText("paiPerfil","","perfil","","","") - */ } \ No newline at end of file diff --git a/permlinks/index.php b/permlinks/index.php index 1c36d02..3c45e2d 100755 --- a/permlinks/index.php +++ b/permlinks/index.php @@ -20,9 +20,39 @@ if (file_exists ( $dir_tmp )) { } error_reporting ( 0 ); include "../init/head.php"; + ?> - + + + + + - - +
-
- -
-

- Para ver todos os parâmetros de inicialização que podem ser utilizados: ms_criamapa.php?ajuda +

+

Construtor de links

+

Aqui você pode gerar links para abrir o i3Geo de forma personalizada. Os links podem + ser incluídos em qualquer página WEB, sendo possível definir quais os temas + serão mostrados e qual a extensão geográfica do mapa.

+

+ Para ver todos os parâmetros de inicialização que podem ser utilizados + acesse esse link: ms_criamapa.php?ajuda

+
+
+
+
+ Escolha das camadas +

Escolha as camadas que serão incluídas no mapa. As camadas são + organizadas em uma hierarquia começando em menu.

-

- Aqui você pode gerar links para abrir o i3Geo de forma personalizada. Os links podem ser - incluídos em qualquer página WEB, sendo possível definir quais os temas - serão mostrados e qual a extensão geográfica do mapa.

-

-
-
-

- Este é o link para abrir o mapa. Copie e cole em sua página na internet ou clique - para testar: - -

-
-
-

- Escolha os temas que serão incluídos no mapa (opcional): -

-

Menu: - - -

-
-

Grupo: - - -

 
-
-

Sub-grupo: +

+ +
+
+ +
+
+ +
+
+ Na lista abaixo você pode remover temas já + escolhidos. Clique em vários temas para escolher mais de um +
+
+ +
+
+
+
+
+
+
+
+ Coordenadas +

Se vc quiser, o mapa poderá ser aberto mostrando pontos, digite abaixo as + coordenadas dos pontos em décimos de grau (exemplo: -54 -12 -54 1 -51 -15)

+
+ +
+
+ +
+
+
+
+
+
+
+ Perfis +

Caso existam perfis definidos na configuração do menu de temas, vc pode + restringir a lista de temas do menu de adição de temas do i3Geo

+
+ +
+
+
+
+
+
+
+ Mapa +
+ +
+ +
+
+
+
+
+
+
+ Extensão geográfica +
+
+ +
+
+
+
+
+ +
+
+
+
+ -
 
-
-

Tema: +

+ +
+
+ +
+
+ +
+
+ +
+
+
-
 
-
-
- Temas já escolhidos. Os que estiverem marcados, ficarão ligados logo ao abrir o - mapa: -
-
-
+
+ +
- -
-
-

- Se vc quiser, o mapa poderá ser aberto mostrando pontos, digite abaixo as coordenadas - dos pontos em décimos de grau (exemplo: -54 -12 -54 1 -51 -15) (opcional): -

-

Coordenadas dos pontos:

-
- -
-

Nome do tema para aparecer na legenda:

-
-   -
-
-
-
-
-

- Caso existam perfis definidos na configuração do menu de temas, vc pode - restringir a lista de temas do menu de adição de temas do I3Geo (opcional) -

-

Perfil:

- -
-
-
-
-

- Escolha a interface para o mapa (opcional) -

-
- -
-
-
-
- -- libgit2 0.21.2