Commit 262f8a1b8530c8faacf5c328b71a8cf19945cb1a

Authored by Edmar Moretti
1 parent 10d157dc

Novas opções para manipulação do menu suspenso

classesjs/classe_arvoredecamadas.js
... ... @@ -255,9 +255,14 @@ i3GEO.arvoreDeCamadas = {
255 255 */
256 256 ICONETEMA: true,
257 257 /*
258   - Propriedade: FUNCOESTEMA
  258 + Propriedade: FUNCOES
259 259  
260   - Indicação de quais funções serão incluídas em cada tema mostrado na árvore
  260 + Indicação de quais funções serão incluídas em cada tema mostrado na árvore quando o usuário aciona o item "opções"
  261 +
  262 + Além de definir o item como false ou true, algumas funções apenas são mostradas em conformidade com o tipo de camada.
  263 + No sistema de administração, pode-se também controlar algumas das funções, como por exemplo "sql", "wms" e "temporizador"
  264 +
  265 + Exemplo de como alterar um valor diretamente no javascript da interface do mapa i3GEO.arvoreDeCamadas.FUNCOES.excluir = false
261 266  
262 267 */
263 268 FUNCOES: {
... ...
classesjs/classe_configura.js
... ... @@ -100,7 +100,7 @@ i3GEO.configura = {
100 100  
101 101 { text: $trad("u1"), url: "http://www.softwarepublico.gov.br/spb/ver-comunidade?community_id=1444332" },
102 102  
103   - { text: $trad("u2"), url: "javascript:i3GEO.ajuda.abreDoc()" }
  103 + { text: $trad("u2"), url: "javascript:i3GEO.ajuda.abreDoc()", target: "_blank" }
104 104  
105 105 ]
106 106  
... ...
classesjs/classe_gadgets.js
... ... @@ -89,7 +89,7 @@ i3GEO.gadgets = {
89 89  
90 90 "mostraMenuSuspenso":
91 91  
92   - {idhtml:"menus",deslocaEsquerda:0},
  92 + {idhtml:"menus",deslocaEsquerda:0,finaliza:""},
93 93  
94 94 "mostraMenuLista":
95 95  
... ... @@ -763,6 +763,15 @@ i3GEO.gadgets = {
763 763 Mostra o menu suspenso com opções extras de análise, ajuda, etc
764 764  
765 765 O objeto YAHOO.widget.MenuBar resultante pode ser obtido na variável i3GEOoMenuBar
  766 +
  767 +
  768 + i3GEOoMenuBar pode ser manipulado com os métodos da biblioteca YUI, por exemplo,
  769 + i3GEOoMenuBar.getMenuItem("omenudataInterface1").cfg.setProperty("text", " ");
  770 +
  771 + Para executar uma operação após o menu ser montado, utilize a propriedade
  772 + i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso.finaliza, por exemplo (a string é executada por meio da função eval do javascript)
  773 +
  774 + i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso.finaliza = 'i3GEOoMenuBar.getMenuItem("omenudataInterface1").cfg.setProperty("text", " ");'
766 775  
767 776 O conteúdo do menu é baseado na variável i3GEO.configura.oMenuData
768 777  
... ... @@ -773,12 +782,12 @@ i3GEO.gadgets = {
773 782 */
774 783 mostraMenuSuspenso: function(id){
775 784 if(typeof(console) !== 'undefined'){console.info("i3GEO.gadgets.mostraMenuSuspenso()");}
776   - var objid,sobe,n,i,estilo,t,onMenuBarBeforeRender,temp,ifr,
777   - MM = YAHOO.widget.MenuManager,
  785 + var objid,sobe,n,i,estilo,t,onMenuBarBeforeRender,temp,ifr,i3GEOoMenuBarLocal,
778 786 ms = i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso,
779 787 confm = i3GEO.configura.oMenuData,
780 788 ins = "",
781 789 alinhamento = "";
  790 + i3GEOoMenuBar = YAHOO.widget.MenuManager;
782 791 if(arguments.length === 0)
783 792 {id = ms.idhtml;}
784 793 else
... ... @@ -816,7 +825,7 @@ i3GEO.gadgets = {
816 825 if($i("menu"+nomeMenu)){
817 826 nomeSub = subs[nomeMenu];
818 827 if(nomeSub !== ""){
819   - i3GEOoMenuBar.getItem(conta).cfg.setProperty(
  828 + i3GEOoMenuBarLocal.getItem(conta).cfg.setProperty(
820 829 'submenu',
821 830 {
822 831 id:nomeMenu,
... ... @@ -832,28 +841,28 @@ i3GEO.gadgets = {
832 841 {ifr = true;}
833 842 else
834 843 {ifr = false;}
835   - i3GEOoMenuBar=new YAHOO.widget.MenuBar(id,{iframe:ifr,autosubmenudisplay: true, showdelay: 100, hidedelay: 500, lazyload: false});
836   - MM.addMenu(i3GEOoMenuBar);
837   - i3GEOoMenuBar.beforeRenderEvent.subscribe(onMenuBarBeforeRender);
838   - i3GEOoMenuBar.render();
  844 + i3GEOoMenuBarLocal = new YAHOO.widget.MenuBar(id,{iframe:ifr,autosubmenudisplay: true, showdelay: 100, hidedelay: 500, lazyload: false});
  845 + i3GEOoMenuBar.addMenu(i3GEOoMenuBarLocal);
  846 + i3GEOoMenuBarLocal.beforeRenderEvent.subscribe(onMenuBarBeforeRender);
  847 + i3GEOoMenuBarLocal.render();
839 848 //
840 849 //marca o tipo de interface em uso
841 850 //
842 851 try{
843 852 if(i3GEO.Interface.ATUAL === "padrao"){
844   - MM.getMenuItem("omenudataInterface1").cfg.setProperty("checked", true);
  853 + i3GEOoMenuBar.getMenuItem("omenudataInterface1").cfg.setProperty("checked", true);
845 854 }
846 855 if(i3GEO.Interface.ATUAL === "openlayers"){
847   - MM.getMenuItem("omenudataInterface2").cfg.setProperty("checked", true);
  856 + i3GEOoMenuBar.getMenuItem("omenudataInterface2").cfg.setProperty("checked", true);
848 857 }
849 858 if(i3GEO.Interface.ATUAL === "flamingo"){
850   - MM.getMenuItem("omenudataInterface3").cfg.setProperty("checked", true);
  859 + i3GEOoMenuBar.getMenuItem("omenudataInterface3").cfg.setProperty("checked", true);
851 860 }
852 861 if(i3GEO.Interface.ATUAL === "googlemaps"){
853   - MM.getMenuItem("omenudataInterface4").cfg.setProperty("checked", true);
  862 + i3GEOoMenuBar.getMenuItem("omenudataInterface4").cfg.setProperty("checked", true);
854 863 }
855 864 if(i3GEO.Interface.ATUAL === "googleearth"){
856   - MM.getMenuItem("omenudataInterface5").cfg.setProperty("checked", true);
  865 + i3GEOoMenuBar.getMenuItem("omenudataInterface5").cfg.setProperty("checked", true);
857 866 }
858 867 }catch(e){
859 868 if(typeof(console) !== 'undefined'){console.warning("i3GEO.gadgets.mostraMenuSuspenso() "+ e);}
... ... @@ -862,13 +871,13 @@ i3GEO.gadgets = {
862 871 //desabilita opções em interfaces específicas
863 872 //
864 873 if(i3GEO.Interface.ATUAL !== "padrao" && $i("omenudataArquivos3")){
865   - MM.getMenuItem("omenudataArquivos3").cfg.setProperty("disabled", true);
  874 + i3GEOoMenuBar.getMenuItem("omenudataArquivos3").cfg.setProperty("disabled", true);
866 875 }
867 876 if(i3GEO.Interface.ATUAL === "googleearth" && $i("omenudataJanelas1")){
868   - MM.getMenuItem("omenudataJanelas1").cfg.setProperty("disabled", true);
  877 + i3GEOoMenuBar.getMenuItem("omenudataJanelas1").cfg.setProperty("disabled", true);
869 878 }
870 879 if(i3GEO.Interface.ATUAL !== "openlayers" && $i("omenudataJanelas3")){
871   - MM.getMenuItem("omenudataJanelas3").cfg.setProperty("disabled", true);
  880 + i3GEOoMenuBar.getMenuItem("omenudataJanelas3").cfg.setProperty("disabled", true);
872 881 }
873 882 //
874 883 //corrige problemas de estilo
... ... @@ -881,6 +890,9 @@ i3GEO.gadgets = {
881 890 {temp.border = "1px dotted white";}
882 891 if(navm && i3GEO.Interface.ATUAL === "googlemaps")
883 892 {temp.border = "2px dotted white";}
  893 + if(ms.finaliza && ms.finaliza != ""){
  894 + eval(ms.finaliza);
  895 + }
884 896 }
885 897 },
886 898 /*
... ...
exemplos/menus1.htm
... ... @@ -223,6 +223,14 @@ i3GEO.configura.oMenuData.submenus.testeMenu = [
223 223 ]
224 224  
225 225 //
  226 +//vc pode usar também esse exemplo
  227 +//desabilita o aplicativo default do menu suspenso
  228 +//
  229 +//i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso.finaliza = 'i3GEOoMenuBar.getMenuItem("omenudataInterface1").cfg.setProperty("text", " ");'
  230 +
  231 +
  232 +
  233 +//
226 234 //inicia o mapa
227 235 //
228 236 i3GEO.inicia();
... ...
interface/openlayers.htm
... ... @@ -206,6 +206,13 @@ i3GEO.Interface.openlayers.GADGETS = {
206 206 OverviewMap:false
207 207 };
208 208 i3GEO.Interface.openlayers.TILES = true;
  209 +
  210 +//
  211 +//desabilita o aplicativo default do menu suspenso
  212 +//
  213 +i3GEO.gadgets.PARAMETROS.mostraMenuSuspenso.finaliza = 'i3GEOoMenuBar.getMenuItem("omenudataInterface1").cfg.setProperty("text", " ");'
  214 +
  215 +
209 216 /*
210 217 Após a criação, é criado o objeto i3geoOL que corresponde ao objeto map da API do OpenLayers.
211 218 Vc pode usar i3geoOL para aplicar os métodos e verificar as propriedades da API do OpenLayers
... ... @@ -277,7 +284,6 @@ OpenLayers.ImgPath = "../pacotes/openlayers/img/";
277 284 //
278 285 //inicia o mapa
279 286 //
280   -
281 287 i3GEO.inicia();
282 288 </script>
283 289 </body>
... ...
mashups/openlayers.js.php
... ... @@ -568,8 +568,8 @@ i3GEO.editorOL = {
568 568 displayClass: "editorOLidentifica",
569 569 eventListeners: {
570 570 getfeatureinfo: function(event) {
571   - var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy);
572   - var lonlattexto = "<hr><pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>";
  571 + var lonlat = i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
  572 + lonlattexto = "<hr><pre><span style=color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(\""+lonlat.lon+","+lonlat.lat+"\")'>captura</span></pre>";
573 573 i3GEO.editorOL.mapa.addPopup(new OpenLayers.Popup.FramedCloud(
574 574 "chicken",
575 575 i3GEO.editorOL.mapa.getLonLatFromPixel(event.xy),
... ...