Commit d453929225ba3dfe11026aae5b70985cbe913b7d

Authored by Edmar Moretti
1 parent c0514e32

Adaptação da ferramenta de excluir camadas em lote para Bootstrap. Reativação do…

… evento atualizaarvoredecamadas
admin/admin.db
No preview for this file type
ferramentas/colourramp/index.php
@@ -126,15 +126,11 @@ Clique para escolher o modelo de cores @@ -126,15 +126,11 @@ Clique para escolher o modelo de cores
126 <p style="text-align:center;width:250px"><span id="demo_range" >0-255</span></p> 126 <p style="text-align:center;width:250px"><span id="demo_range" >0-255</span></p>
127 <div id=cores ></div> 127 <div id=cores ></div>
128 <p style="position:relative;left:6px;top:5px;text-align:left;" > 128 <p style="position:relative;left:6px;top:5px;text-align:left;" >
129 -<input id=voltar size="22" type="button" value="Aplicar cores">&nbsp; 129 +<input id=voltar size="22" type="button" onclick="aplicarCores()" value="Aplicar cores">&nbsp;
130 </p> 130 </p>
131 -<b>Para atualizar a lista de cores geradas, clique novamente sobre a barra de cor.</b> Voc&ecirc; pode tamb&eacute;m definir os limites inicial e final (use a barra deslizante) e alterar os valores obtidos editando diretamente o RGB 131 +<br>
  132 +<p>Para atualizar a lista de cores geradas, clique novamente sobre a barra de cor. Voc&ecirc; pode tamb&eacute;m definir os limites inicial e final (use a barra deslizante) e alterar os valores obtidos editando diretamente o RGB</p>
132 <script> 133 <script>
133 -new YAHOO.widget.Button(  
134 - "voltar",  
135 - {onclick:{fn: function(){aplicarCores();}}}  
136 -);  
137 -$i("voltar-button").style.width = "250px"  
138 var lista = "<?php echo $lista;?>"; 134 var lista = "<?php echo $lista;?>";
139 lista = lista.split(","); 135 lista = lista.split(",");
140 var n = lista.length; 136 var n = lista.length;
ferramentas/excluirarvore/dependencias.php 0 → 100755
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +<?php
  2 +include(dirname(__FILE__)."/../blacklist.php");
  3 +verificaBlFerramentas(basename(dirname(__FILE__)));
  4 +
  5 +
  6 +/**
  7 + * Carrega os programas javascript necessarios para a ferramenta
  8 + * Esse programa e usado na tag <script> ou com a funcao scripttag do i3Geo
  9 + * Alem de carregar os scripts, carrega tambem o template no formato MUSTACHE, definindo a variavel
  10 + * javascript i3GEOF.etiqueta.MUSTACHE
  11 + * O template e substituido pelos valores definidos em index.js no momento da inicializacao da ferramenta
  12 + */
  13 +if(extension_loaded('zlib')){
  14 + ob_start('ob_gzhandler');
  15 +}
  16 +header("Content-type: text/javascript");
  17 +include("index.js");
  18 +include("dicionario.js");
  19 +echo "\n";
  20 +
  21 +if(extension_loaded('zlib')){
  22 + ob_end_flush();
  23 +}
  24 +?>
0 \ No newline at end of file 25 \ No newline at end of file
ferramentas/excluirarvore/index.js
@@ -30,53 +30,34 @@ Voc&amp;ecirc; deve ter recebido uma c&amp;oacute;pia da Licen&amp;ccedil;a P&amp;uacute;blica G @@ -30,53 +30,34 @@ Voc&amp;ecirc; deve ter recebido uma c&amp;oacute;pia da Licen&amp;ccedil;a P&amp;uacute;blica G
30 GNU junto com este programa; se n&atilde;o, escreva para a 30 GNU junto com este programa; se n&atilde;o, escreva para a
31 Free Software Foundation, Inc., no endere&ccedil;o 31 Free Software Foundation, Inc., no endere&ccedil;o
32 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. 32 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
33 -*/ 33 + */
34 if(typeof(i3GEOF) === 'undefined'){ 34 if(typeof(i3GEOF) === 'undefined'){
35 var i3GEOF = {}; 35 var i3GEOF = {};
36 } 36 }
37 /* 37 /*
38 Classe: i3GEOF.excluirarvore 38 Classe: i3GEOF.excluirarvore
39 39
40 -*/ 40 + */
41 i3GEOF.excluirarvore = { 41 i3GEOF.excluirarvore = {
42 - /* 42 + /*
43 Variavel: aguarde 43 Variavel: aguarde
44 44
45 Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela. 45 Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
46 - */  
47 - aguarde: "",  
48 - /* 46 + */
  47 + aguarde: "",
  48 + MUSTACHE : "",
  49 + /*
49 Variavel: iddiv 50 Variavel: iddiv
50 51
51 Guarda o id do div definido na fun&ccedil;&atilde;o "inicia". 52 Guarda o id do div definido na fun&ccedil;&atilde;o "inicia".
52 - */  
53 - iddiv: "",  
54 - /*  
55 - Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio  
56 - */  
57 - criaJanelaFlutuante: function(){  
58 - i3GEOF.excluirarvore.iniciaDicionario();  
59 - },  
60 - /*  
61 - Function: iniciaDicionario  
62 -  
63 - Carrega o dicion&aacute;rio e chama a fun&ccedil;&atilde;o que inicia a ferramenta  
64 -  
65 - O Javascript &eacute; carregado com o id i3GEOF.nomedaferramenta.dicionario_script  
66 - */  
67 - iniciaDicionario: function(){  
68 - if(typeof(i3GEOF.excluirarvore.dicionario) === 'undefined'){  
69 - i3GEO.util.scriptTag(  
70 - i3GEO.configura.locaplic+"/ferramentas/excluirarvore/dicionario.js",  
71 - "i3GEOF.excluirarvore.iniciaJanelaFlutuante()",  
72 - "i3GEOF.excluirarvore.dicionario_script"  
73 - );  
74 - }  
75 - else{  
76 - i3GEOF.excluirarvore.iniciaJanelaFlutuante();  
77 - }  
78 - },  
79 - /* 53 + */
  54 + iddiv: "",
  55 + mustacheHash : function() {
  56 + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.excluirarvore.dicionario);
  57 + return dicionario;
  58 + },
  59 +
  60 + /*
80 Function: inicia 61 Function: inicia
81 62
82 Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante 63 Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
@@ -84,30 +65,38 @@ i3GEOF.excluirarvore = { @@ -84,30 +65,38 @@ i3GEOF.excluirarvore = {
84 Parametro: 65 Parametro:
85 66
86 iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta 67 iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
87 - */  
88 - inicia: function(iddiv){  
89 - var camadas = i3GEO.arvoreDeCamadas.CAMADAS,  
90 - n = camadas.length,  
91 - temp;  
92 - i3GEOF.excluirarvore.iddiv = iddiv;  
93 - try{ 68 + */
  69 + inicia: function(iddiv){
  70 + if(i3GEOF.excluirarvore.MUSTACHE == ""){
  71 + $.get(i3GEO.configura.locaplic + "/ferramentas/excluirarvore/template_mst.html", function(template) {
  72 + i3GEOF.excluirarvore.MUSTACHE = template;
  73 + i3GEOF.excluirarvore.inicia(iddiv);
  74 + });
  75 + return;
  76 + }
  77 +
  78 + i3GEOF.excluirarvore.iddiv = iddiv;
  79 +
94 $i(iddiv).innerHTML = i3GEOF.excluirarvore.html(); 80 $i(iddiv).innerHTML = i3GEOF.excluirarvore.html();
95 - new YAHOO.widget.Button(  
96 - "i3GEOexcluirbotao1",  
97 - {onclick:{fn: i3GEOF.excluirarvore.lote}}  
98 - );  
99 - }  
100 - catch(erro){  
101 - i3GEO.eventos.removeEventos("ATUALIZAARVORECAMADAS",["i3GEOF.excluirarvore.inicia(i3GEOF.excluirarvore.iddiv)"]);  
102 - }  
103 - while(n > 0){  
104 - n -= 1;  
105 - temp = $i("excluirC_"+camadas[n].name);  
106 - if(temp)  
107 - {temp.checked = false;}  
108 - }  
109 - },  
110 - /* 81 +
  82 + i3GEOF.excluirarvore.lista();
  83 + },
  84 + lista: function(){
  85 + var camadas = i3GEO.arvoreDeCamadas.CAMADAS,
  86 + n = camadas.length, ins = "";
  87 + while(n > 0){
  88 + n -= 1;
  89 + if(camadas[n].tema !== ""){
  90 + ins += '<div class="checkbox text-left"><label>'
  91 + + '<input name="' + camadas[n].name + '" type="checkbox">'
  92 + + '<span class="checkbox-material noprint"><span class="check"></span></span> '
  93 + + camadas[n].tema
  94 + + '</label></div>';
  95 + }
  96 + }
  97 + $i("i3GEOFexcluirarvoreLista").innerHTML = ins;
  98 + },
  99 + /*
111 Function: html 100 Function: html
112 101
113 Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta 102 Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
@@ -115,99 +104,90 @@ i3GEOF.excluirarvore = { @@ -115,99 +104,90 @@ i3GEOF.excluirarvore = {
115 Retorno: 104 Retorno:
116 105
117 String com o c&oacute;digo html 106 String com o c&oacute;digo html
118 - */  
119 - html:function(){  
120 - var camadas = i3GEO.arvoreDeCamadas.CAMADAS,  
121 - n = camadas.length,  
122 - ins = "";  
123 -  
124 - ins = "<p class=paragrafo ><input id=i3GEOexcluirbotao1 type='buttom' value='"+$trad('removeMapa',i3GEOF.excluirarvore.dicionario)+"' /></p>" +  
125 - "<table id='i3GEOFexcluirarvoreLista' style='width:95%' class='lista8'>";  
126 - while(n > 0){  
127 - n -= 1;  
128 - if(camadas[n].tema !== "")  
129 - {ins += "<tr><td><input id='excluirC_"+camadas[n].name+"' CHECKED class=inputsb style='cursor:pointer' type=checkbox value='"+camadas[n].name+"' /></td><td><span id='i3GEOanima"+camadas[n].name+"'>"+camadas[n].tema+"</span></td></tr>";}  
130 - }  
131 - ins += "</table><br>";  
132 - return ins;  
133 - },  
134 - /* 107 + */
  108 + html:function(){
  109 + var ins = Mustache.render(i3GEOF.excluirarvore.MUSTACHE, i3GEOF.excluirarvore.mustacheHash());
  110 + return ins;
  111 + },
  112 + /*
135 Function: iniciaJanelaFlutuante 113 Function: iniciaJanelaFlutuante
136 114
137 Cria a janela flutuante para controle da ferramenta. 115 Cria a janela flutuante para controle da ferramenta.
138 - */  
139 - iniciaJanelaFlutuante: function(){  
140 - var janela,divid,temp,titulo,cabecalho,minimiza;  
141 - if($i("i3GEOF.excluirarvore")){  
142 - return;  
143 - }  
144 - cabecalho = function(){};  
145 - minimiza = function(){  
146 - i3GEO.janela.minimiza("i3GEOF.excluirarvore",200);  
147 - };  
148 - //cria a janela flutuante  
149 - titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("t12") + "</span></div>";  
150 - janela = i3GEO.janela.cria(  
151 - "300px",  
152 - "350px",  
153 - "",  
154 - "",  
155 - "",  
156 - titulo,  
157 - "i3GEOF.excluirarvore",  
158 - false,  
159 - "hd",  
160 - cabecalho,  
161 - minimiza,  
162 - "",  
163 - true,  
164 - "",  
165 - "",  
166 - "",  
167 - "",  
168 - "110"  
169 - );  
170 - i3GEOF.excluirarvore.aguarde = $i("i3GEOF.excluirarvore_imagemCabecalho").style;  
171 - divid = janela[2].id;  
172 - $i("i3GEOF.excluirarvore_corpo").style.backgroundColor = "white";  
173 - $i("i3GEOF.excluirarvore_corpo").style.textAlign = "left";  
174 - temp = function(){  
175 - if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEOF.excluirarvore.inicia(i3GEOF.excluirarvore.iddiv)") > 0)  
176 - {i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEOF.excluirarvore.inicia(i3GEOF.excluirarvore.iddiv)");}  
177 - };  
178 - YAHOO.util.Event.addListener(janela[0].close, "click", temp);  
179 - i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEOF.excluirarvore.inicia(i3GEOF.excluirarvore.iddiv)"]);  
180 - i3GEOF.excluirarvore.inicia(divid);  
181 - },  
182 - /* 116 + */
  117 + iniciaJanelaFlutuante: function(){
  118 + var janela,divid,temp,titulo,cabecalho,minimiza;
  119 + if($i("i3GEOF.excluirarvore")){
  120 + return;
  121 + }
  122 + cabecalho = function(){};
  123 + minimiza = function(){
  124 + i3GEO.janela.minimiza("i3GEOF.excluirarvore",200);
  125 + };
  126 + //cria a janela flutuante
  127 + titulo = "<span class='i3GeoTituloJanelaBsNolink' >" + $trad("t12") + "</span></div>";
  128 + janela = i3GEO.janela.cria(
  129 + "300px",
  130 + "350px",
  131 + "",
  132 + "",
  133 + "",
  134 + titulo,
  135 + "i3GEOF.excluirarvore",
  136 + false,
  137 + "hd",
  138 + cabecalho,
  139 + minimiza,
  140 + "",
  141 + true,
  142 + "",
  143 + "",
  144 + "",
  145 + "",
  146 + "110"
  147 + );
  148 + i3GEOF.excluirarvore.aguarde = $i("i3GEOF.excluirarvore_imagemCabecalho").style;
  149 + divid = janela[2].id;
  150 + temp = function(){
  151 + if(i3GEO.eventos.ATUALIZAARVORECAMADAS.toString().search("i3GEOF.excluirarvore.lista()") >= 0){
  152 + i3GEO.eventos.ATUALIZAARVORECAMADAS.remove("i3GEOF.excluirarvore.lista()");
  153 + }
  154 + };
  155 + YAHOO.util.Event.addListener(janela[0].close, "click", temp);
  156 + i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEOF.excluirarvore.lista()"]);
  157 + i3GEOF.excluirarvore.inicia(divid);
  158 + },
  159 + /*
183 Function: lote 160 Function: lote
184 161
185 Executa uma opera&ccedil;&atilde;o em lote sobre as camadas mostradas no mapa 162 Executa uma opera&ccedil;&atilde;o em lote sobre as camadas mostradas no mapa
186 163
187 - */  
188 - lote: function(objeto){  
189 - var lista = [], 164 + */
  165 + lote: function(objeto){
  166 + var lista = [],
190 temp, 167 temp,
191 - camadas = i3GEO.arvoreDeCamadas.CAMADAS, 168 + camadas = $i("i3GEOFexcluirarvoreLista").getElementsByTagName("input"),
192 n = camadas.length; 169 n = camadas.length;
193 - if(i3GEOF.excluirarvore.aguarde.visibility === "visible")  
194 - {return;}  
195 - i3GEOF.excluirarvore.aguarde.visibility = "visible";  
196 - while(n > 0){  
197 - n -= 1;  
198 - temp = $i("excluirC_"+camadas[n].name);  
199 - if(temp && temp.checked === true)  
200 - {lista.push(temp.value);}  
201 - }  
202 - temp = function(){  
203 - i3GEOF.excluirarvore.aguarde.visibility = "hidden";  
204 - i3GEO.atualiza();  
205 - };  
206 - if(lista.length > 0)  
207 - {i3GEO.php.excluitema(temp,lista);}  
208 - else{  
209 - i3GEO.janela.tempoMsg($trad('selecionaCamada',i3GEOF.excluirarvore.dicionario));  
210 - i3GEOF.excluirarvore.aguarde.visibility = "hidden"; 170 + if(i3GEOF.excluirarvore.aguarde.visibility === "visible"){
  171 + return;
  172 + }
  173 + i3GEOF.excluirarvore.aguarde.visibility = "visible";
  174 + while(n > 0){
  175 + n -= 1;
  176 + if(camadas[n].checked === true){
  177 + lista.push(camadas[n].name);
  178 + }
  179 + }
  180 + temp = function(){
  181 + i3GEOF.excluirarvore.aguarde.visibility = "hidden";
  182 + i3GEO.atualiza();
  183 +
  184 + };
  185 + if(lista.length > 0){
  186 + i3GEO.php.excluitema(temp,lista);
  187 + }
  188 + else{
  189 + i3GEO.janela.tempoMsg($trad('selecionaCamada',i3GEOF.excluirarvore.dicionario));
  190 + i3GEOF.excluirarvore.aguarde.visibility = "hidden";
  191 + }
211 } 192 }
212 - }  
213 }; 193 };
ferramentas/excluirarvore/template_mst.html 0 → 100755
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
  1 +<div class='container-fluid'>
  2 + <div id="i3GEOFexcluirarvoreLista"></div>
  3 + <button onclick="i3GEOF.excluirarvore.lote()" class='btn btn-primary btn-sm btn-raised'>{{{removeMapa}}}</button>
  4 +</div>
0 \ No newline at end of file 5 \ No newline at end of file
js/arvoredecamadas.js
@@ -320,6 +320,7 @@ i3GEO.arvoreDeCamadas = @@ -320,6 +320,7 @@ i3GEO.arvoreDeCamadas =
320 $("#" + config.idListaFundo).html(t); 320 $("#" + config.idListaFundo).html(t);
321 } 321 }
322 } 322 }
  323 + i3GEO.eventos.executaEventos(i3GEO.eventos.ATUALIZAARVORECAMADAS);
323 /* 324 /*
324 325
325 // 326 //
@@ -993,11 +994,12 @@ i3GEO.arvoreDeCamadas = @@ -993,11 +994,12 @@ i3GEO.arvoreDeCamadas =
993 */ 994 */
994 filtro : function() { 995 filtro : function() {
995 i3GEO.util.dialogoFerramenta( 996 i3GEO.util.dialogoFerramenta(
996 - "i3GEO.arvoreDeCamadas.dialogo.filtro()",  
997 - "filtroarvore",  
998 - "filtroarvore",  
999 - "dependencias.php",  
1000 - "i3GEOF.filtroarvore.iniciaJanelaFlutuante()"); 997 + "i3GEO.arvoreDeCamadas.dialogo.filtro()",
  998 + "filtroarvore",
  999 + "filtroarvore",
  1000 + "dependencias.php",
  1001 + "i3GEOF.filtroarvore.iniciaJanelaFlutuante()"
  1002 + );
1001 }, 1003 },
1002 /** 1004 /**
1003 * Function: excluir 1005 * Function: excluir
@@ -1005,7 +1007,13 @@ i3GEO.arvoreDeCamadas = @@ -1005,7 +1007,13 @@ i3GEO.arvoreDeCamadas =
1005 * Abre a janela de di&aacute;logo para o usu&aacute;rio escolher os temas que ser&atilde;o exclu&iacute;dos da &aacute;rvore 1007 * Abre a janela de di&aacute;logo para o usu&aacute;rio escolher os temas que ser&atilde;o exclu&iacute;dos da &aacute;rvore
1006 */ 1008 */
1007 excluir : function() { 1009 excluir : function() {
1008 - i3GEO.util.dialogoFerramenta("i3GEO.arvoreDeCamadas.dialogo.excluir()", "excluirarvore", "excluirarvore"); 1010 + i3GEO.util.dialogoFerramenta(
  1011 + "i3GEO.arvoreDeCamadas.dialogo.excluir()",
  1012 + "excluirarvore",
  1013 + "excluirarvore",
  1014 + "dependencias.php",
  1015 + "i3GEOF.excluirarvore.iniciaJanelaFlutuante()"
  1016 + );
1009 } 1017 }
1010 } 1018 }
1011 }; 1019 };