Commit 70003e875b75faa32e59046d32032bb02b49237d

Authored by Edmar Moretti
1 parent f531871c

i3geo/i3geo#104 Opção de busca por ferramenta https://trello.com/c/o9eqehw3

ferramentas/distancia/index.js
... ... @@ -103,7 +103,7 @@ i3GEOF.distancia =
103 103 divid = janela[2].id;
104 104 i3GEOF.distancia.inicia(divid);
105 105 temp = function() {
106   - i3GEO.distancia.pontos = {};
  106 + i3GEOF.distancia.pontos = {};
107 107 var janela;
108 108 i3GEO.eventos.cliquePerm.ativa();
109 109 janela = YAHOO.i3GEO.janela.manager.find("distancia");
... ...
interface/carto_ol.htm
... ... @@ -607,7 +607,8 @@
607 607 </div>
608 608 </div>
609 609 <div class="clearfix"></div>
610   - <hr>
  610 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  611 +
611 612 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
612 613 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
613 614 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/gm.phtml
... ... @@ -24,6 +24,9 @@ include (&quot;../ms_configura.php&quot;);
24 24 <script src="../pacotes/bootstrap-tour/build/js/bootstrap-tour.js"></script>
25 25 <link href="../pacotes/bootstrap-tour/build/css/bootstrap-tour.css" rel="stylesheet">
26 26 <script src="tutorial.js"></script>
  27 +<!-- para caixas de listagens dinamicas -->
  28 +<link rel="stylesheet" href="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.css">
  29 +<script src="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.js"></script>
27 30 <style>
28 31 .ol-attribution.ol-uncollapsible {
29 32 height: 2.1em;
... ... @@ -628,7 +631,8 @@ include (&quot;../ms_configura.php&quot;);
628 631 </div>
629 632 </div>
630 633 <div class="clearfix"></div>
631   - <hr>
  634 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  635 +
632 636 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
633 637 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
634 638 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/gmdebug.phtml
... ... @@ -24,6 +24,9 @@ include (&quot;../ms_configura.php&quot;);
24 24 <script src="../pacotes/bootstrap-tour/build/js/bootstrap-tour.js"></script>
25 25 <link href="../pacotes/bootstrap-tour/build/css/bootstrap-tour.css" rel="stylesheet">
26 26 <script src="tutorial.js"></script>
  27 +<!-- para caixas de listagens dinamicas -->
  28 +<link rel="stylesheet" href="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.css">
  29 +<script src="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.js"></script>
27 30 <style>
28 31 .ol-attribution.ol-uncollapsible {
29 32 height: 2.1em;
... ... @@ -628,7 +631,8 @@ include (&quot;../ms_configura.php&quot;);
628 631 </div>
629 632 </div>
630 633 <div class="clearfix"></div>
631   - <hr>
  634 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  635 +
632 636 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
633 637 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
634 638 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/googlemaps_noite.phtml
... ... @@ -624,7 +624,8 @@ include (&quot;../ms_configura.php&quot;);
624 624 </div>
625 625 </div>
626 626 <div class="clearfix"></div>
627   - <hr>
  627 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  628 +
628 629 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
629 630 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
630 631 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/ol.htm
... ... @@ -22,6 +22,9 @@
22 22 <script src="../pacotes/bootstrap-tour/build/js/bootstrap-tour.js"></script>
23 23 <link href="../pacotes/bootstrap-tour/build/css/bootstrap-tour.css" rel="stylesheet">
24 24 <script src="tutorial.js"></script>
  25 +<!-- para caixas de listagens dinamicas -->
  26 +<link rel="stylesheet" href="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.css">
  27 +<script src="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.js"></script>
25 28 <style>
26 29 .ol-attribution.ol-uncollapsible {
27 30 height: 2.1em;
... ... @@ -648,7 +651,8 @@
648 651 </div>
649 652 </div>
650 653 <div class="clearfix"></div>
651   - <hr>
  654 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  655 +
652 656 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
653 657 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
654 658 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/openlayersdebug.htm
... ... @@ -21,6 +21,9 @@
21 21 <script src="../pacotes/bootstrap-tour/build/js/bootstrap-tour.js"></script>
22 22 <link href="../pacotes/bootstrap-tour/build/css/bootstrap-tour.css" rel="stylesheet">
23 23 <script src="tutorial.js"></script>
  24 +<!-- para caixas de listagens dinamicas -->
  25 +<link rel="stylesheet" href="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.css">
  26 +<script src="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.js"></script>
24 27 <style>
25 28 .ol-attribution.ol-uncollapsible {
26 29 height: 2.1em;
... ... @@ -634,7 +637,8 @@
634 637 </div>
635 638 </div>
636 639 <div class="clearfix"></div>
637   - <hr>
  640 +
  641 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
638 642 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
639 643 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
640 644 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/osm.htm
... ... @@ -22,6 +22,9 @@
22 22 <script src="../pacotes/bootstrap-tour/build/js/bootstrap-tour.js"></script>
23 23 <link href="../pacotes/bootstrap-tour/build/css/bootstrap-tour.css" rel="stylesheet">
24 24 <script src="tutorial.js"></script>
  25 +<!-- para caixas de listagens dinamicas -->
  26 +<link rel="stylesheet" href="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.css">
  27 +<script src="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.js"></script>
25 28 <style>
26 29 .ol-attribution.ol-uncollapsible {
27 30 height: 2.1em;
... ... @@ -648,7 +651,8 @@
648 651 </div>
649 652 </div>
650 653 <div class="clearfix"></div>
651   - <hr>
  654 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  655 +
652 656 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
653 657 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
654 658 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/osmdebug.htm
... ... @@ -22,6 +22,9 @@
22 22 <script src="../pacotes/bootstrap-tour/build/js/bootstrap-tour.js"></script>
23 23 <link href="../pacotes/bootstrap-tour/build/css/bootstrap-tour.css" rel="stylesheet">
24 24 <script src="tutorial.js"></script>
  25 +<!-- para caixas de listagens dinamicas -->
  26 +<link rel="stylesheet" href="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.css">
  27 +<script src="../pacotes/jquery/jquery-typeahead-2.10.4/dist/jquery.typeahead.min.js"></script>
25 28 <style>
26 29 .ol-attribution.ol-uncollapsible {
27 30 height: 2.1em;
... ... @@ -615,7 +618,8 @@
615 618 </div>
616 619 </div>
617 620 <div class="clearfix"></div>
618   - <hr>
  621 + <div id="searchInputFerramentas" data-template="templates/searchInput.html" style='display: block;text-align: center;width: 100%;padding-left: 1rem;padding-right: 1rem;'></div>
  622 +
619 623 <div id="migalhaFerramentas" data-template="templates/ferramentasMigalha.html" style='display: block; text-align: left;'></div>
620 624 <div id="listaFerramentasLinks" data-template="templates/ferramentasLink.html" style='display: block; text-align: left'></div>
621 625 <div id="listaFerramentas" data-template="templates/ferramentasFolder.html" style='display: block; text-align: left'></div>
... ...
interface/templates/searchInput.html 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +<form class="hidden-xs" style="width: 100%;" name="{{id}}" action="#" onsubmit="return false;">
  2 + <div class="typeahead__container">
  3 + <div class="typeahead__field form-group label-fixed condensed" style="font-size: 2rem">
  4 + <span class="typeahead__query">
  5 + <input id="{{id}}" class="form-control input-lg" name="" placeholder="{{placeholder}}" autocomplete="off" type="search">
  6 + <b class='caret careti'></b>
  7 + </span>
  8 + </div>
  9 + </div>
  10 +</form>
0 11 \ No newline at end of file
... ...
js/caixaDeFerramentas.js
1 1 if (typeof (i3GEO) === 'undefined') {
2   - var i3GEO = {};
  2 + var i3GEO = {};
3 3 }
4 4 i3GEO.caixaDeFerramentas = {
5   - MIGALHA: [],
6   - config: {
7   - "idOndeFolder": "listaFerramentas",
8   - "idOndeLinks": "listaFerramentasLinks",
9   - "idOndeMigalha": "migalhaFerramentas",
10   - "templateFolder" : "templates/ferramentasFolder.html",
11   - "templateMigalha" : "templates/ferramentasMigalha.html",
12   - "templateLinks" : "templates/ferramentasLink.html"
13   - },
14   - carregaTemplates: function(){
15   - var t1 = i3GEO.caixaDeFerramentas.config.templateFolder,
16   - t2 = i3GEO.caixaDeFerramentas.config.templateLinks,
17   - t3 = i3GEO.caixaDeFerramentas.config.templateMigalha;
18   - $.when( $.get(t1),$.get(t2),$.get(t3) ).done(function(r1,r2,r3) {
19   - i3GEO.template.ferramentasFolder = r1[0];
20   - i3GEO.template.ferramentasLinks = r2[0];
21   - i3GEO.template.ferramentasMigalha = r3[0];
22   - i3GEO.caixaDeFerramentas.inicia();
23   - }).fail(function() {
24   - i3GEO.janela.closeMsg($trad("erroTpl"));
25   - return;
26   - });
27   - },
28   - aguarde: function(){
29   - //$("#" + i3GEO.caixaDeFerramentas.config.idFolder).html($trad("o1"));
30   - },
31   - inicia : function(config){
32   - if(config){
33   - $.each( config, function( i,v ) {
34   - i3GEO.caixaDeFerramentas.config[i] = v;
35   - });
36   - }
37   - i3GEO.caixaDeFerramentas.aguarde();
38   - if(!i3GEO.template.ferramentasFolder || !i3GEO.template.ferramentasLinks || !i3GEO.template.ferramentasMigalha){
39   - i3GEO.caixaDeFerramentas.carregaTemplates();
40   - return;
41   - } else {
42   - i3GEO.caixaDeFerramentas.nivel0();
43   - }
44   - },
45   - migalha: function (data){
46   - var f = i3GEO.caixaDeFerramentas.config;
47   - var t = Mustache.to_html(
48   - i3GEO.template.ferramentasMigalha,
49   - {"nome":data.nome}
50   - );
51   - $("#" + f.idOndeMigalha)
52   - .data(data)
53   - .html(t)
54   - .click(function(event){
55   - var f = i3GEO.caixaDeFerramentas.config;
56   - event.stopImmediatePropagation();
57   - $("#" + f.idOndeMigalha).off("click");
58   - var data = $(this).data();
59   - if((data.nivel - 1) == 0){
60   - f.idOndeFolder.fadeOut( "fast", function(){
61   - i3GEO.caixaDeFerramentas.nivel0();
62   - i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
63   - });
64   - }
65   - if((data.nivel - 1) == 1){
66   - f.idOndeFolder.fadeOut( "fast", function(){
67   - i3GEO.caixaDeFerramentas.nivel1(data);
68   - i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
69   - });
70   - }
71   - if((data.nivel - 1) == 2){
72   - f.idOndeFolder.fadeOut( "fast", function(){
73   - i3GEO.caixaDeFerramentas.nivel2(data);
74   - i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
75   - });
76   - }
77   - });
78   - },
79   - nivel0 : function(){
80   - var confm = i3GEO.listaDeFerramentas,
81   - subs = i3GEO.listaDeFerramentas.submenus,
82   - menu = confm.menu,
83   - n = menu.length,
84   - f = i3GEO.caixaDeFerramentas.config,
85   - i,t,data;
  5 + MIGALHA: [],
  6 + config: {
  7 + "idOndeFolder": "listaFerramentas",
  8 + "idOndeLinks": "listaFerramentasLinks",
  9 + "idOndeMigalha": "migalhaFerramentas",
  10 + "idOndeSearchInput": "searchInputFerramentas",
  11 + "templateFolder" : "templates/ferramentasFolder.html",
  12 + "templateMigalha" : "templates/ferramentasMigalha.html",
  13 + "templateLinks" : "templates/ferramentasLink.html",
  14 + "templateSearchInput" : "templates/searchInput.html"
  15 + },
  16 + carregaTemplates: function(){
  17 + var t1 = i3GEO.caixaDeFerramentas.config.templateFolder,
  18 + t2 = i3GEO.caixaDeFerramentas.config.templateLinks,
  19 + t3 = i3GEO.caixaDeFerramentas.config.templateMigalha;
  20 + $.when( $.get(t1),$.get(t2),$.get(t3) ).done(function(r1,r2,r3) {
  21 + i3GEO.template.ferramentasFolder = r1[0];
  22 + i3GEO.template.ferramentasLinks = r2[0];
  23 + i3GEO.template.ferramentasMigalha = r3[0];
  24 + i3GEO.caixaDeFerramentas.inicia();
  25 + }).fail(function() {
  26 + i3GEO.janela.closeMsg($trad("erroTpl"));
  27 + return;
  28 + });
  29 + },
  30 + aguarde: function(){
  31 + //$("#" + i3GEO.caixaDeFerramentas.config.idFolder).html($trad("o1"));
  32 + },
  33 + inicia : function(config){
  34 + if(config){
  35 + $.each( config, function( i,v ) {
  36 + i3GEO.caixaDeFerramentas.config[i] = v;
  37 + });
  38 + }
  39 + i3GEO.caixaDeFerramentas.aguarde();
  40 + if(!i3GEO.template.ferramentasFolder || !i3GEO.template.ferramentasLinks || !i3GEO.template.ferramentasMigalha){
  41 + i3GEO.caixaDeFerramentas.carregaTemplates();
  42 + return;
  43 + } else {
  44 + i3GEO.caixaDeFerramentas.searchInput();
  45 + i3GEO.caixaDeFerramentas.nivel0();
  46 + }
  47 + },
  48 + //get eh feito aqui pois o template pode nao existir na instalacao do i3Geo
  49 + searchInput: function(){
  50 + if(!i3GEO.template.searchInput){
  51 + var t4 = i3GEO.caixaDeFerramentas.config.templateSearchInput;
  52 + $.get(t4).done(function(r4){
  53 + i3GEO.template.searchInput = r4;
  54 + $("#" + i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(
  55 + Mustache.render(
  56 + i3GEO.template.searchInput,
  57 + {
  58 + id: "searchInputListaFerramentas",
  59 + placeholder: $trad("t23")
  60 + }
  61 + )
  62 + );
  63 + i3GEO.caixaDeFerramentas.searchInputStart("searchInputListaFerramentas");
  64 + });
  65 + } else {
  66 + $("#" + i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(i3GEO.template.searchInput);
  67 + }
  68 + },
  69 + searchInputStart: function(id){
  70 + $.typeahead({
  71 + input: '#' + id,
  72 + minLength: 1,
  73 + accent: true,
  74 + cancelButton: false,
  75 + maxItem: 10,
  76 + order: "asc",
  77 + hint: true,
  78 + dynamic: false,
  79 + maxItemPerGroup: null,
  80 + cache: false,
  81 + ttl: 86400000, // 1day
  82 + compression: true,
  83 + template: "<a href='{{url}}' >{{nome}}</a>",
  84 + display: ["nome"],
  85 + source: {
  86 + data: i3GEO.caixaDeFerramentas.allTools()
  87 + },
  88 + debug: false,
  89 + callback: {
  90 + onClickAfter: function(node, a, item, event){
86 91  
87   - $("#" + f.idOndeMigalha).html("");
88   - f.idOndeFolder.html("");
89   - f.idOndeLinks.html("");
90   - for (i = 0; i < n; i += 1) {
91   - if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
92   - continue;
93   - }
94   - if(subs[menu[i].id].length > 0){
95   - t = Mustache.to_html(
96   - i3GEO.template.ferramentasFolder,
97   - {"nome":menu[i].nome,"descricao":menu[i].descricao}
98   - );
99   - t = $(t);
100   - //quando clica, abre o nivel 1 e muda a migalha
101   - data = {"nivel":1,"nome":menu[i].nome,"id":i,"n0": i, "n1":"", "n2": "", "n3": ""};
102   - t.find("a")
103   - .data(data)
104   - .click(function(){
105   - $(this).find("a").off("click");
106   - var data = $(this).data();
107   - //texto da migalha e evento click
108   - i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut( "fast", function(){
109   - i3GEO.caixaDeFerramentas.nivel1(data);
110   - i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
111   - });
112   - });
113   - i3GEO.caixaDeFerramentas.config.idOndeFolder
114   - .append(t);
115   - }
116   - }
117   - },
118   - nivel1 : function(data){
119   - var confm = i3GEO.listaDeFerramentas,
120   - menu = confm.submenus[confm.menu[data.n0].id],
121   - n = menu.length,
122   - f = i3GEO.caixaDeFerramentas.config,
123   - i,t,datan;
  92 + $(node).val("");
  93 + }
  94 + }
  95 + });
  96 + },
  97 + allTools: function(){
  98 + var confm = i3GEO.listaDeFerramentas,
  99 + subs = i3GEO.listaDeFerramentas.submenus,
  100 + menu = confm.menu,
  101 + n = menu.length,
  102 + f = i3GEO.caixaDeFerramentas.config,
  103 + i,data = [];
  104 + for (i = 0; i < n; i += 1) {
  105 + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
  106 + continue;
  107 + }
  108 + $.each(subs[menu[i].id], function( index, value ) {
  109 + var no = value.submenu;
  110 + if(no && no.itemdata){
  111 + $.each(no.itemdata, function( index1, value1 ) {
  112 + $.each(value1, function( index2, value2 ) {
  113 + data.push({
  114 + nome: $('<div/>').html(value2.text).text(),
  115 + url: value2.url
  116 + });
  117 + });
  118 + });
  119 + } else {
  120 + if(value.url && !value.target){
  121 + data.push({
  122 + nome: $('<div/>').html(value.text).text(),
  123 + url: value.url
  124 + });
  125 + }
  126 + }
124 127  
125   - f.idOndeFolder.html("");
126   - f.idOndeLinks.html("");
127   - for (i = 0; i < n; i += 1) {
128   - if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
129   - continue;
130   - }
131   - datan = {"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0": data.n0, "n1":i, "n2": "", "n3": ""};
132   - if(menu[i].url){
133   - t = Mustache.to_html(
134   - i3GEO.template.ferramentasLinks,
135   - {"nome":menu[i].text,"target": menu[i].target,"url": menu[i].url,"opcional": menu[i].opcional}
136   - );
137   - t = $(t);
138   - f.idOndeLinks
139   - .append(t);
140   - } else {
141   - t = Mustache.to_html(
142   - i3GEO.template.ferramentasFolder,
143   - {"nome":menu[i].text}
144   - );
145   - t = $(t);
146   - t.find("a")
147   - .data(datan)
148   - .click(function(){
149   - $(this).find("a").off("click");
150   - var data = $(this).data();
151   - var f = i3GEO.caixaDeFerramentas.config;
152   - var t = Mustache.to_html(
153   - i3GEO.template.ferramentasMigalha,
154   - data
155   - );
156   - //texto da migalha e evento click
157   - //nivel2(data);
158   - f.idOndeFolder.fadeOut( "fast", function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show();});
159   - });
160   - f.idOndeFolder
161   - .append(t);
162   - }
163   - }
164   - data.nivel = 1;
165   - data.nome = confm.menu[data.id].nome;
166   - data.n0 = data.id;
167   - i3GEO.caixaDeFerramentas.migalha(data);
168   - },
169   - nivel2 : function(data){
170   - var confm = i3GEO.listaDeFerramentas,
171   - menu = confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],
172   - n = menu.length,
173   - f = i3GEO.caixaDeFerramentas.config,
174   - i,t,datan;
  128 + });
  129 + }
  130 + return data;
  131 + },
  132 + migalha: function (data){
  133 + var f = i3GEO.caixaDeFerramentas.config;
  134 + var t = Mustache.to_html(
  135 + i3GEO.template.ferramentasMigalha,
  136 + {"nome":data.nome}
  137 + );
  138 + $("#" + f.idOndeMigalha)
  139 + .data(data)
  140 + .html(t)
  141 + .click(function(event){
  142 + var f = i3GEO.caixaDeFerramentas.config;
  143 + event.stopImmediatePropagation();
  144 + $("#" + f.idOndeMigalha).off("click");
  145 + var data = $(this).data();
  146 + if((data.nivel - 1) == 0){
  147 + f.idOndeFolder.fadeOut( "fast", function(){
  148 + i3GEO.caixaDeFerramentas.nivel0();
  149 + i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
  150 + });
  151 + }
  152 + if((data.nivel - 1) == 1){
  153 + f.idOndeFolder.fadeOut( "fast", function(){
  154 + i3GEO.caixaDeFerramentas.nivel1(data);
  155 + i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
  156 + });
  157 + }
  158 + if((data.nivel - 1) == 2){
  159 + f.idOndeFolder.fadeOut( "fast", function(){
  160 + i3GEO.caixaDeFerramentas.nivel2(data);
  161 + i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
  162 + });
  163 + }
  164 + });
  165 + },
  166 + nivel0 : function(){
  167 + var confm = i3GEO.listaDeFerramentas,
  168 + subs = i3GEO.listaDeFerramentas.submenus,
  169 + menu = confm.menu,
  170 + n = menu.length,
  171 + f = i3GEO.caixaDeFerramentas.config,
  172 + i,t,data;
175 173  
176   - f.idOndeFolder.html("");
177   - f.idOndeLinks.html("");
178   - for (i = 0; i < n; i += 1) {
179   - if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
180   - continue;
181   - }
182   - datan = {"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0": data.n0, "n1":data.n1, "n2": i, "n3": ""};
183   - if(menu[i].url){
184   - t = Mustache.to_html(
185   - i3GEO.template.ferramentasLinks,
186   - {"nome":menu[i].text,"target": menu[i].target,"url": menu[i].url,"opcional": menu[i].opcional}
187   - );
188   - t = $(t);
189   - f.idOndeLinks
190   - .append(t);
191   - } else {
192   - t = Mustache.to_html(
193   - i3GEO.template.ferramentasFolder,
194   - {"nome":menu[i].text}
195   - );
196   - t = $(t);
197   - t.find("a")
198   - .data(datan)
199   - .click(function(){
200   - $(this).find("a").off("click");
201   - var data = $(this).data();
202   - var t = Mustache.to_html(
203   - i3GEO.caixaDeFerramentas.config.templateMigalha,
204   - data
205   - );
206   - });
207   - f.idOndeFolder
208   - .append(t);
209   - }
210   - }
211   - data.nivel = 2;
212   - data.id = data.n0;
213   - i3GEO.caixaDeFerramentas.migalha(data);
214   - }
  174 + $("#" + f.idOndeMigalha).html("");
  175 + f.idOndeFolder.html("");
  176 + f.idOndeLinks.html("");
  177 + for (i = 0; i < n; i += 1) {
  178 + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
  179 + continue;
  180 + }
  181 + if(subs[menu[i].id].length > 0){
  182 + t = Mustache.to_html(
  183 + i3GEO.template.ferramentasFolder,
  184 + {"nome":menu[i].nome,"descricao":menu[i].descricao}
  185 + );
  186 + t = $(t);
  187 + //quando clica, abre o nivel 1 e muda a migalha
  188 + data = {"nivel":1,"nome":menu[i].nome,"id":i,"n0": i, "n1":"", "n2": "", "n3": ""};
  189 + t.find("a")
  190 + .data(data)
  191 + .click(function(){
  192 + $(this).find("a").off("click");
  193 + var data = $(this).data();
  194 + //texto da migalha e evento click
  195 + i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut( "fast", function(){
  196 + i3GEO.caixaDeFerramentas.nivel1(data);
  197 + i3GEO.caixaDeFerramentas.config.idOndeFolder.show();
  198 + });
  199 + });
  200 + i3GEO.caixaDeFerramentas.config.idOndeFolder
  201 + .append(t);
  202 + }
  203 + }
  204 + },
  205 + nivel1 : function(data){
  206 + var confm = i3GEO.listaDeFerramentas,
  207 + menu = confm.submenus[confm.menu[data.n0].id],
  208 + n = menu.length,
  209 + f = i3GEO.caixaDeFerramentas.config,
  210 + i,t,datan;
  211 +
  212 + f.idOndeFolder.html("");
  213 + f.idOndeLinks.html("");
  214 + for (i = 0; i < n; i += 1) {
  215 + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
  216 + continue;
  217 + }
  218 + datan = {"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0": data.n0, "n1":i, "n2": "", "n3": ""};
  219 + if(menu[i].url){
  220 + t = Mustache.to_html(
  221 + i3GEO.template.ferramentasLinks,
  222 + {"nome":menu[i].text,"target": menu[i].target,"url": menu[i].url,"opcional": menu[i].opcional}
  223 + );
  224 + t = $(t);
  225 + f.idOndeLinks
  226 + .append(t);
  227 + } else {
  228 + t = Mustache.to_html(
  229 + i3GEO.template.ferramentasFolder,
  230 + {"nome":menu[i].text}
  231 + );
  232 + t = $(t);
  233 + t.find("a")
  234 + .data(datan)
  235 + .click(function(){
  236 + $(this).find("a").off("click");
  237 + var data = $(this).data();
  238 + var f = i3GEO.caixaDeFerramentas.config;
  239 + var t = Mustache.to_html(
  240 + i3GEO.template.ferramentasMigalha,
  241 + data
  242 + );
  243 + //texto da migalha e evento click
  244 + //nivel2(data);
  245 + f.idOndeFolder.fadeOut( "fast", function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show();});
  246 + });
  247 + f.idOndeFolder
  248 + .append(t);
  249 + }
  250 + }
  251 + data.nivel = 1;
  252 + data.nome = confm.menu[data.id].nome;
  253 + data.n0 = data.id;
  254 + i3GEO.caixaDeFerramentas.migalha(data);
  255 + },
  256 + nivel2 : function(data){
  257 + var confm = i3GEO.listaDeFerramentas,
  258 + menu = confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],
  259 + n = menu.length,
  260 + f = i3GEO.caixaDeFerramentas.config,
  261 + i,t,datan;
  262 +
  263 + f.idOndeFolder.html("");
  264 + f.idOndeLinks.html("");
  265 + for (i = 0; i < n; i += 1) {
  266 + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){
  267 + continue;
  268 + }
  269 + datan = {"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0": data.n0, "n1":data.n1, "n2": i, "n3": ""};
  270 + if(menu[i].url){
  271 + t = Mustache.to_html(
  272 + i3GEO.template.ferramentasLinks,
  273 + {"nome":menu[i].text,"target": menu[i].target,"url": menu[i].url,"opcional": menu[i].opcional}
  274 + );
  275 + t = $(t);
  276 + f.idOndeLinks
  277 + .append(t);
  278 + } else {
  279 + t = Mustache.to_html(
  280 + i3GEO.template.ferramentasFolder,
  281 + {"nome":menu[i].text}
  282 + );
  283 + t = $(t);
  284 + t.find("a")
  285 + .data(datan)
  286 + .click(function(){
  287 + $(this).find("a").off("click");
  288 + var data = $(this).data();
  289 + var t = Mustache.to_html(
  290 + i3GEO.caixaDeFerramentas.config.templateMigalha,
  291 + data
  292 + );
  293 + });
  294 + f.idOndeFolder
  295 + .append(t);
  296 + }
  297 + }
  298 + data.nivel = 2;
  299 + data.id = data.n0;
  300 + i3GEO.caixaDeFerramentas.migalha(data);
  301 + }
215 302 };
216 303 \ No newline at end of file
... ...
js/compactados/caixaDeFerramentas_compacto.js
1   -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html("");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}};
2 1 \ No newline at end of file
  2 +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","idOndeSearchInput":"searchInputFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html","templateSearchInput":"templates/searchInput.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.searchInput();i3GEO.caixaDeFerramentas.nivel0()}},searchInput:function(){if(!i3GEO.template.searchInput){var t4=i3GEO.caixaDeFerramentas.config.templateSearchInput;$.get(t4).done(function(r4){i3GEO.template.searchInput=r4;$("#"+i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(Mustache.render(i3GEO.template.searchInput,{id:"searchInputListaFerramentas",placeholder:$trad("t23")}));i3GEO.caixaDeFerramentas.searchInputStart("searchInputListaFerramentas")})}else{$("#"+i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(i3GEO.template.searchInput)}},searchInputStart:function(id){$.typeahead({input:'#'+id,minLength:1,accent:true,cancelButton:false,maxItem:10,order:"asc",hint:true,dynamic:false,maxItemPerGroup:null,cache:false,ttl:86400000,compression:true,template:"<a href='{{url}}' >{{nome}}</a>",display:["nome"],source:{data:i3GEO.caixaDeFerramentas.allTools()},debug:false,callback:{onClickAfter:function(node,a,item,event){$(node).val("")}}})},allTools:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,data=[];for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}$.each(subs[menu[i].id],function(index,value){var no=value.submenu;if(no&&no.itemdata){$.each(no.itemdata,function(index1,value1){$.each(value1,function(index2,value2){data.push({nome:$('<div/>').html(value2.text).text(),url:value2.url})})})}else{if(value.url&&!value.target){data.push({nome:$('<div/>').html(value.text).text(),url:value.url})}}})}return data},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html("");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}};
3 3 \ No newline at end of file
... ...
js/i3geo_tudo_compacto7.js
... ... @@ -319,7 +319,7 @@ if(typeof(i3GEO)===&#39;undefined&#39;){var i3GEO={}}i3GEO.legenda={IDS:[],CAMADAS:&quot;&quot;,ob
319 319 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.busca={PALAVRA:"",BOX:"",SERVICO:"http://mapas.mma.gov.br/webservices/geonames.php",SERVICOWMS:"http://mapas.mma.gov.br/webservices/geonameswms.php",config:{"ondeConteiner":"","inputOndePalavra":"","ondeServicosExternos":"","inputServicosExternos":"","inputTemasMapa":"","ondeTemasMapa":"","inputGoogle":"","ondeGoogle":"","templateTemasMapa":"","templateServico":"","templateGoogle":""},nget:0,carregaTemplates:function(){if(i3GEO.busca.nget==0){i3GEO.busca.nget=2;if(!i3GEO.template.buscaEmTemas){$.get(i3GEO.busca.config.templateTemasMapa,function(template){i3GEO.template.buscaEmTemas=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}if(!i3GEO.template.buscaEmServico){$.get(i3GEO.busca.config.templateServico,function(template){i3GEO.template.buscaEmServico=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}}},aguarde:function(){return'<div class="alert alert-warning" role="alert">'+$trad("o1")+'</div>'},inicia:function(obj){var palavra="",config=i3GEO.busca.config;if(obj){obj=$(obj);if(obj.attr("data-ondeConteiner")!=undefined){config.ondeConteiner=obj.attr("data-ondeConteiner")}if(obj.attr("data-ondeServicosExternos")!=undefined){config.ondeServicosExternos=obj.attr("data-ondeServicosExternos")}if(obj.attr("data-inputServicosExternos")!=undefined){config.inputServicosExternos=obj.attr("data-inputServicosExternos")}if(obj.attr("data-inputTemasMapa")!=undefined){config.inputTemasMapa=obj.attr("data-inputTemasMapa")}if(obj.attr("data-inputTemasMapa")!=undefined){config.ondeTemasMapa=obj.attr("data-ondeTemasMapa")}if(obj.attr("data-inputGoogle")!=undefined){config.inputGoogle=obj.attr("data-inputGoogle")}if(obj.attr("data-inputGoogle")!=undefined){config.ondeGoogle=obj.attr("data-ondeGoogle")}if(obj.attr("data-inputOndePalavra")!=undefined){config.inputOndePalavra=obj.attr("data-inputOndePalavra")}if(obj.attr("data-templateGoogle")!=undefined){config.templateGoogle=obj.attr("data-templateGoogle")}if(obj.attr("data-templateTemasMapa")!=undefined){config.templateTemasMapa=obj.attr("data-templateTemasMapa")}if(obj.attr("data-templateServico")!=undefined){config.templateServico=obj.attr("data-templateServico")}}if(!i3GEO.template.buscaEmTemas||!i3GEO.template.buscaEmServico){i3GEO.busca.carregaTemplates();return}else{var palavra=$(config.ondeConteiner).find(config.inputOndePalavra).val();if(palavra!=""){i3GEO.busca.PALAVRA=i3GEO.util.removeAcentos(palavra)}else{i3GEO.busca.PALAVRA="";return false}if($(config.ondeConteiner).find(config.inputServicosExternos)[0].checked==true){$(config.ondeConteiner).find(config.ondeServicosExternos).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoServico,i3GEO.configura.locaplic,i3GEO.busca.SERVICO,i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputTemasMapa)[0].checked==true){$(config.ondeConteiner).find(config.inputTemasMapa).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoTemas,i3GEO.configura.locaplic,"temas",i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputGoogle)[0].checked==true){$(config.ondeConteiner).find(config.inputGoogle).html(i3GEO.busca.aguarde());i3GEO.busca.google(i3GEO.busca.PALAVRA)}}},resultadoTemas:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeTemasMapa).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeTemasMapa).html("")}},resultadoGoogle:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeGoogle).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeGoogle).html("")}},resultadoServico:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmServico+"{{/data}}",{"data":retorno.data.geonames});$(config.ondeConteiner).find(config.ondeServicosExternos).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeServicosExternos).html("")}},google:function(palavra){var geocoder=new google.maps.Geocoder();geocoder.geocode({'address':palavra},function(results,status){if(status==google.maps.GeocoderStatus.OK){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){if(results){var b,bo,n=results.length,i=0,resultado={"data":[]};for(i=0;i<n;i++){if(results[i]&&results[i].formatted_address&&results[i].geometry&&results[i].geometry.viewport){bo=results[i].geometry.bounds;b=bo.getSouthWest().lng()+" "+bo.getSouthWest().lat()+" "+bo.getNorthEast().lng()+" "+bo.getNorthEast().lat();resultado.data.push({"valor":results[i].formatted_address,"box":b})}}i3GEO.busca.resultadoGoogle(resultado)}}}})},zoom:function(wkt,layer,gid,nm){var adicionaCamada=function(layer,gid,nm,ext){if(i3GEO.Interface.openlayers.googleLike===false){var s=i3GEO.busca.SERVICOWMS+"?gid="+gid+"&";i3GEO.php.adicionaTemaWMS(i3GEO.atualiza,s,layer,"default","EPSG:4618","image/png","1.1.0",nm+" - "+layer,"","nao","",i3GEO.configura.locaplic,i3GEO.configura.sid)}i3GEO.busca.zoomExt(ext)};var ext=i3GEO.util.wkt2ext(wkt,"polygon");if(ext==false){return}i3GEO.php.mudaext(adicionaCamada(layer,gid,nm,ext),i3GEO.configura.tipoimagem,ext,i3GEO.configura.locaplic,i3GEO.configura.sid)},mostraxy:function mostraxy(texto,tipo){var ext,b;if(tipo==="wkt"){ext=i3GEO.util.wkt2ext(texto,"polygon")}else{ext=texto}if(ext==false){return}b=ext.split(" ");if(i3GEO.Interface["ATUAL"]==="openlayers"&&typeof OpenLayers.Control=="undefined"){i3GEO.busca.BOX=false}if(i3GEO.busca.BOX===false){i3GEO.busca.BOX=i3GEO.desenho.addBox(b[0],b[1],b[2],b[3],"boxOndeBusca")}else{i3GEO.busca.BOX=i3GEO.desenho.moveBox(i3GEO.busca.BOX,b[0],b[1],b[2],b[3])}},escondexy:function(){i3GEO.desenho.removeBox("boxOndeBusca")},zoomExt:function(ext){if(i3GEO.Interface.ATUAL=="googlemaps"){i3GEO.Interface.googlemaps.zoom2extent(ext)}if(i3GEO.Interface.ATUAL=="openlayers"){i3GEO.Interface.openlayers.zoom2ext(ext)}}};
320 320 //
321 321 //compactados/caixaDeFerramentas_compacto.js
322   -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html("");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}};
  322 +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","idOndeSearchInput":"searchInputFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html","templateSearchInput":"templates/searchInput.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.searchInput();i3GEO.caixaDeFerramentas.nivel0()}},searchInput:function(){if(!i3GEO.template.searchInput){var t4=i3GEO.caixaDeFerramentas.config.templateSearchInput;$.get(t4).done(function(r4){i3GEO.template.searchInput=r4;$("#"+i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(Mustache.render(i3GEO.template.searchInput,{id:"searchInputListaFerramentas",placeholder:$trad("t23")}));i3GEO.caixaDeFerramentas.searchInputStart("searchInputListaFerramentas")})}else{$("#"+i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(i3GEO.template.searchInput)}},searchInputStart:function(id){$.typeahead({input:'#'+id,minLength:1,accent:true,cancelButton:false,maxItem:10,order:"asc",hint:true,dynamic:false,maxItemPerGroup:null,cache:false,ttl:86400000,compression:true,template:"<a href='{{url}}' >{{nome}}</a>",display:["nome"],source:{data:i3GEO.caixaDeFerramentas.allTools()},debug:false,callback:{onClickAfter:function(node,a,item,event){$(node).val("")}}})},allTools:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,data=[];for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}$.each(subs[menu[i].id],function(index,value){var no=value.submenu;if(no&&no.itemdata){$.each(no.itemdata,function(index1,value1){$.each(value1,function(index2,value2){data.push({nome:$('<div/>').html(value2.text).text(),url:value2.url})})})}else{if(value.url&&!value.target){data.push({nome:$('<div/>').html(value.text).text(),url:value.url})}}})}return data},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html("");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}};
323 323 //
324 324 //template.js
325 325 if (typeof (i3GEO) === 'undefined') {
... ... @@ -366,5 +366,7 @@ catalogoMigalha: false,
366 366 //formatacao da legenda (guia principal do mapa)
367 367 legenda: false,
368 368 //formatacao da lista de marcadores salvos pelo usuario
369   -marcador: false
  369 +marcador: false,
  370 +//campo do tipo input para a busca usando typeahead
  371 +searchInput: false
370 372 };
... ...
js/i3geo_tudo_compacto7.js.php
... ... @@ -319,7 +319,7 @@ if(typeof(i3GEO)===&#39;undefined&#39;){var i3GEO={}}i3GEO.legenda={IDS:[],CAMADAS:&quot;&quot;,ob
319 319 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.busca={PALAVRA:"",BOX:"",SERVICO:"http://mapas.mma.gov.br/webservices/geonames.php",SERVICOWMS:"http://mapas.mma.gov.br/webservices/geonameswms.php",config:{"ondeConteiner":"","inputOndePalavra":"","ondeServicosExternos":"","inputServicosExternos":"","inputTemasMapa":"","ondeTemasMapa":"","inputGoogle":"","ondeGoogle":"","templateTemasMapa":"","templateServico":"","templateGoogle":""},nget:0,carregaTemplates:function(){if(i3GEO.busca.nget==0){i3GEO.busca.nget=2;if(!i3GEO.template.buscaEmTemas){$.get(i3GEO.busca.config.templateTemasMapa,function(template){i3GEO.template.buscaEmTemas=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}if(!i3GEO.template.buscaEmServico){$.get(i3GEO.busca.config.templateServico,function(template){i3GEO.template.buscaEmServico=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}}},aguarde:function(){return'<div class="alert alert-warning" role="alert">'+$trad("o1")+'</div>'},inicia:function(obj){var palavra="",config=i3GEO.busca.config;if(obj){obj=$(obj);if(obj.attr("data-ondeConteiner")!=undefined){config.ondeConteiner=obj.attr("data-ondeConteiner")}if(obj.attr("data-ondeServicosExternos")!=undefined){config.ondeServicosExternos=obj.attr("data-ondeServicosExternos")}if(obj.attr("data-inputServicosExternos")!=undefined){config.inputServicosExternos=obj.attr("data-inputServicosExternos")}if(obj.attr("data-inputTemasMapa")!=undefined){config.inputTemasMapa=obj.attr("data-inputTemasMapa")}if(obj.attr("data-inputTemasMapa")!=undefined){config.ondeTemasMapa=obj.attr("data-ondeTemasMapa")}if(obj.attr("data-inputGoogle")!=undefined){config.inputGoogle=obj.attr("data-inputGoogle")}if(obj.attr("data-inputGoogle")!=undefined){config.ondeGoogle=obj.attr("data-ondeGoogle")}if(obj.attr("data-inputOndePalavra")!=undefined){config.inputOndePalavra=obj.attr("data-inputOndePalavra")}if(obj.attr("data-templateGoogle")!=undefined){config.templateGoogle=obj.attr("data-templateGoogle")}if(obj.attr("data-templateTemasMapa")!=undefined){config.templateTemasMapa=obj.attr("data-templateTemasMapa")}if(obj.attr("data-templateServico")!=undefined){config.templateServico=obj.attr("data-templateServico")}}if(!i3GEO.template.buscaEmTemas||!i3GEO.template.buscaEmServico){i3GEO.busca.carregaTemplates();return}else{var palavra=$(config.ondeConteiner).find(config.inputOndePalavra).val();if(palavra!=""){i3GEO.busca.PALAVRA=i3GEO.util.removeAcentos(palavra)}else{i3GEO.busca.PALAVRA="";return false}if($(config.ondeConteiner).find(config.inputServicosExternos)[0].checked==true){$(config.ondeConteiner).find(config.ondeServicosExternos).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoServico,i3GEO.configura.locaplic,i3GEO.busca.SERVICO,i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputTemasMapa)[0].checked==true){$(config.ondeConteiner).find(config.inputTemasMapa).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoTemas,i3GEO.configura.locaplic,"temas",i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputGoogle)[0].checked==true){$(config.ondeConteiner).find(config.inputGoogle).html(i3GEO.busca.aguarde());i3GEO.busca.google(i3GEO.busca.PALAVRA)}}},resultadoTemas:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeTemasMapa).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeTemasMapa).html("")}},resultadoGoogle:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeGoogle).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeGoogle).html("")}},resultadoServico:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmServico+"{{/data}}",{"data":retorno.data.geonames});$(config.ondeConteiner).find(config.ondeServicosExternos).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeServicosExternos).html("")}},google:function(palavra){var geocoder=new google.maps.Geocoder();geocoder.geocode({'address':palavra},function(results,status){if(status==google.maps.GeocoderStatus.OK){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){if(results){var b,bo,n=results.length,i=0,resultado={"data":[]};for(i=0;i<n;i++){if(results[i]&&results[i].formatted_address&&results[i].geometry&&results[i].geometry.viewport){bo=results[i].geometry.bounds;b=bo.getSouthWest().lng()+" "+bo.getSouthWest().lat()+" "+bo.getNorthEast().lng()+" "+bo.getNorthEast().lat();resultado.data.push({"valor":results[i].formatted_address,"box":b})}}i3GEO.busca.resultadoGoogle(resultado)}}}})},zoom:function(wkt,layer,gid,nm){var adicionaCamada=function(layer,gid,nm,ext){if(i3GEO.Interface.openlayers.googleLike===false){var s=i3GEO.busca.SERVICOWMS+"?gid="+gid+"&";i3GEO.php.adicionaTemaWMS(i3GEO.atualiza,s,layer,"default","EPSG:4618","image/png","1.1.0",nm+" - "+layer,"","nao","",i3GEO.configura.locaplic,i3GEO.configura.sid)}i3GEO.busca.zoomExt(ext)};var ext=i3GEO.util.wkt2ext(wkt,"polygon");if(ext==false){return}i3GEO.php.mudaext(adicionaCamada(layer,gid,nm,ext),i3GEO.configura.tipoimagem,ext,i3GEO.configura.locaplic,i3GEO.configura.sid)},mostraxy:function mostraxy(texto,tipo){var ext,b;if(tipo==="wkt"){ext=i3GEO.util.wkt2ext(texto,"polygon")}else{ext=texto}if(ext==false){return}b=ext.split(" ");if(i3GEO.Interface["ATUAL"]==="openlayers"&&typeof OpenLayers.Control=="undefined"){i3GEO.busca.BOX=false}if(i3GEO.busca.BOX===false){i3GEO.busca.BOX=i3GEO.desenho.addBox(b[0],b[1],b[2],b[3],"boxOndeBusca")}else{i3GEO.busca.BOX=i3GEO.desenho.moveBox(i3GEO.busca.BOX,b[0],b[1],b[2],b[3])}},escondexy:function(){i3GEO.desenho.removeBox("boxOndeBusca")},zoomExt:function(ext){if(i3GEO.Interface.ATUAL=="googlemaps"){i3GEO.Interface.googlemaps.zoom2extent(ext)}if(i3GEO.Interface.ATUAL=="openlayers"){i3GEO.Interface.openlayers.zoom2ext(ext)}}};
320 320 //
321 321 //compactados/caixaDeFerramentas_compacto.js
322   -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html("");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}};
  322 +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","idOndeSearchInput":"searchInputFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html","templateSearchInput":"templates/searchInput.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.searchInput();i3GEO.caixaDeFerramentas.nivel0()}},searchInput:function(){if(!i3GEO.template.searchInput){var t4=i3GEO.caixaDeFerramentas.config.templateSearchInput;$.get(t4).done(function(r4){i3GEO.template.searchInput=r4;$("#"+i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(Mustache.render(i3GEO.template.searchInput,{id:"searchInputListaFerramentas",placeholder:$trad("t23")}));i3GEO.caixaDeFerramentas.searchInputStart("searchInputListaFerramentas")})}else{$("#"+i3GEO.caixaDeFerramentas.config.idOndeSearchInput).html(i3GEO.template.searchInput)}},searchInputStart:function(id){$.typeahead({input:'#'+id,minLength:1,accent:true,cancelButton:false,maxItem:10,order:"asc",hint:true,dynamic:false,maxItemPerGroup:null,cache:false,ttl:86400000,compression:true,template:"<a href='{{url}}' >{{nome}}</a>",display:["nome"],source:{data:i3GEO.caixaDeFerramentas.allTools()},debug:false,callback:{onClickAfter:function(node,a,item,event){$(node).val("")}}})},allTools:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,data=[];for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}$.each(subs[menu[i].id],function(index,value){var no=value.submenu;if(no&&no.itemdata){$.each(no.itemdata,function(index1,value1){$.each(value1,function(index2,value2){data.push({nome:$('<div/>').html(value2.text).text(),url:value2.url})})})}else{if(value.url&&!value.target){data.push({nome:$('<div/>').html(value.text).text(),url:value.url})}}})}return data},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html("");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}};
323 323 //
324 324 //template.js
325 325 if (typeof (i3GEO) === 'undefined') {
... ... @@ -366,7 +366,9 @@ catalogoMigalha: false,
366 366 //formatacao da legenda (guia principal do mapa)
367 367 legenda: false,
368 368 //formatacao da lista de marcadores salvos pelo usuario
369   -marcador: false
  369 +marcador: false,
  370 +//campo do tipo input para a busca usando typeahead
  371 +searchInput: false
370 372 };
371 373  
372 374 <?php if(extension_loaded('zlib')){ob_end_flush();}?>
373 375 \ No newline at end of file
... ...
js/template.js
... ... @@ -42,5 +42,7 @@ i3GEO.template = {
42 42 //formatacao da legenda (guia principal do mapa)
43 43 legenda: false,
44 44 //formatacao da lista de marcadores salvos pelo usuario
45   - marcador: false
  45 + marcador: false,
  46 + //campo do tipo input para a busca usando typeahead
  47 + searchInput: false
46 48 };
... ...