Commit d5eb227667a38d5c1bb3683e38f966cab9d03063
1 parent
6dc875fc
Exists in
master
formulario para a ferramenta animagif
Showing
7 changed files
with
739 additions
and
10 deletions
Show diff stats
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * Carrega os programas javascript necessarios para a ferramenta | ||
4 | + * Esse programa e usado na tag <script> ou com a funcao scripttag do i3Geo | ||
5 | + * Alem de carregar os scripts, carrega tambem o template no formato MUSTACHE, definindo a variavel | ||
6 | + * javascript i3GEOF.animagif.MUSTACHE | ||
7 | + * O template e substituido pelos valores definidos em index.js no momento da inicializacao da ferramenta | ||
8 | + */ | ||
9 | +if(extension_loaded('zlib')){ | ||
10 | + ob_start('ob_gzhandler'); | ||
11 | +} | ||
12 | +header("Content-type: text/javascript"); | ||
13 | +include("index.js"); | ||
14 | +include("dicionario.js"); | ||
15 | +echo "\n"; | ||
16 | +/** | ||
17 | + * Inclui o template mustache do HTML usado para criar o conteudo da janela | ||
18 | + */ | ||
19 | +echo 'i3GEOF.animagif.MUSTACHE = "'; | ||
20 | +$texto = file_get_contents("template_mst.html"); | ||
21 | +$texto = str_replace("\n", "", $texto); | ||
22 | +$texto = str_replace("\r", "", $texto); | ||
23 | +$texto = str_replace("\t", "", $texto); | ||
24 | +$texto = str_replace('"', "'", $texto); | ||
25 | +echo $texto; | ||
26 | +echo '";'; | ||
27 | +if(extension_loaded('zlib')){ | ||
28 | + ob_end_flush(); | ||
29 | +} | ||
30 | +?> | ||
0 | \ No newline at end of file | 31 | \ No newline at end of file |
@@ -0,0 +1,93 @@ | @@ -0,0 +1,93 @@ | ||
1 | +//+$trad(1,i3GEOF.animagif.dicionario)+ | ||
2 | +i3GEOF.animagif.dicionario = { | ||
3 | + 'ativaAoAdic' : [ { | ||
4 | + pt : "Abre a ferramenta quando a camada é adicionada ao mapa, permitindo que o usuário escolha os parâmetros", | ||
5 | + en : "", | ||
6 | + es : "" | ||
7 | + } ], | ||
8 | + 'execAoAdic' : [ { | ||
9 | + pt : "Gera a animação quando o usuário adiciona a camada ao mapa", | ||
10 | + en : "", | ||
11 | + es : "" | ||
12 | + } ], | ||
13 | + 'colunat' : [ { | ||
14 | + pt : "Coluna que será utilizada para obter a lista de datas e que receberá o filtro de data para cada quadro da animação", | ||
15 | + en : "", | ||
16 | + es : "" | ||
17 | + } ], | ||
18 | + 'tempo' : [ { | ||
19 | + pt : "Tempo em milisegundos entre cada quadro", | ||
20 | + en : "", | ||
21 | + es : "" | ||
22 | + } ], | ||
23 | + 'w' : [ { | ||
24 | + pt : "Largura da imagem gif que será gerada", | ||
25 | + en : "", | ||
26 | + es : "" | ||
27 | + } ], | ||
28 | + 'cache' : [ { | ||
29 | + pt : "Reaproveita o arquivo gif em cache", | ||
30 | + en : "", | ||
31 | + es : "" | ||
32 | + } ], | ||
33 | + 'extensao' : [ { | ||
34 | + pt : "Extensão geográfica (xmin, ymin, xmax, ymax)", | ||
35 | + en : "", | ||
36 | + es : "" | ||
37 | + } ], | ||
38 | + 'legenda' : [ { | ||
39 | + pt : "Mostra a legenda", | ||
40 | + en : "", | ||
41 | + es : "" | ||
42 | + } ], | ||
43 | + 'transparencia' : [ { | ||
44 | + pt : "Cada quadro será transparente", | ||
45 | + en : "", | ||
46 | + es : "" | ||
47 | + } ], | ||
48 | + 'tipocolunat' : [ { | ||
49 | + pt : "Tipo da coluna com os valores", | ||
50 | + en : "", | ||
51 | + es : "" | ||
52 | + } ], | ||
53 | + 'nulos' : [ { | ||
54 | + pt : "Lista de valores, separados por vírgula, que serão excluídos no processo de obtenção da lista de datas", | ||
55 | + en : "", | ||
56 | + es : "" | ||
57 | + } ], | ||
58 | + 'operador' : [ { | ||
59 | + pt : "Operador de ligação entre a coluna e o valor da data, por default utiliza-se '=', mas pode ser definido também 'lt' (menor que) ou gt (maior que)", | ||
60 | + en : "", | ||
61 | + es : "" | ||
62 | + } ], | ||
63 | + 'geragif' : [{ | ||
64 | + pt : "Cria o gif animado", | ||
65 | + en : "", | ||
66 | + es : "" | ||
67 | + }], | ||
68 | + 'numerico' : [{ | ||
69 | + pt : "Numérico", | ||
70 | + en : "", | ||
71 | + es : "" | ||
72 | + }], | ||
73 | + 'texto' : [{ | ||
74 | + pt : "Texto", | ||
75 | + en : "", | ||
76 | + es : "" | ||
77 | + }], | ||
78 | + 'sim' : [{ | ||
79 | + pt : "Sim", | ||
80 | + en : "", | ||
81 | + es : "" | ||
82 | + }], | ||
83 | + 'nao' : [{ | ||
84 | + pt : "Não", | ||
85 | + en : "", | ||
86 | + es : "" | ||
87 | + }], | ||
88 | + 'selecionaCol' : [{ | ||
89 | + pt : "Selecione uma coluna", | ||
90 | + en : "", | ||
91 | + es : "" | ||
92 | + }] | ||
93 | +}; |
ferramentas/animagif/exec.php
@@ -38,6 +38,12 @@ if($cache == "nao"){ | @@ -38,6 +38,12 @@ if($cache == "nao"){ | ||
38 | if(empty($tempo)){ | 38 | if(empty($tempo)){ |
39 | $tempo = 40; | 39 | $tempo = 40; |
40 | } | 40 | } |
41 | +if(empty($w)){ | ||
42 | + $w = 500; | ||
43 | +} | ||
44 | +if(empty($h)){ | ||
45 | + $h = 500; | ||
46 | +} | ||
41 | if(empty($nulos)){ | 47 | if(empty($nulos)){ |
42 | $nulos = ""; | 48 | $nulos = ""; |
43 | } | 49 | } |
@@ -106,6 +112,7 @@ else{ | @@ -106,6 +112,7 @@ else{ | ||
106 | $base = $locaplic."/aplicmap/".$base; | 112 | $base = $locaplic."/aplicmap/".$base; |
107 | } | 113 | } |
108 | } | 114 | } |
115 | + | ||
109 | //desenv /var/www/html/i3geo/i3geo/sage/camadas/base_linux.map | 116 | //desenv /var/www/html/i3geo/i3geo/sage/camadas/base_linux.map |
110 | $mapa = ms_newMapObj($base); | 117 | $mapa = ms_newMapObj($base); |
111 | 118 | ||
@@ -192,9 +199,12 @@ if($legenda == "sim"){ | @@ -192,9 +199,12 @@ if($legenda == "sim"){ | ||
192 | $leg->set("status",MS_EMBED); | 199 | $leg->set("status",MS_EMBED); |
193 | $cor = $leg->imagecolor; | 200 | $cor = $leg->imagecolor; |
194 | $cor->setrgb(250,250,250); | 201 | $cor->setrgb(250,250,250); |
202 | + | ||
195 | $labelleg = $leg->label; | 203 | $labelleg = $leg->label; |
196 | - $labelleg->set("type",MS_TRUETYPE); | 204 | + |
205 | + $labelleg->updatefromstring("LABEL TYPE TRUETYPE END"); | ||
197 | $labelleg->set("font","arial"); | 206 | $labelleg->set("font","arial"); |
207 | + | ||
198 | $labelleg->set("size",12); | 208 | $labelleg->set("size",12); |
199 | $leg->set("keyspacingy",0); | 209 | $leg->set("keyspacingy",0); |
200 | $leg->set("keysizey",20); | 210 | $leg->set("keysizey",20); |
@@ -219,6 +229,7 @@ if($transparente == "sim"){ | @@ -219,6 +229,7 @@ if($transparente == "sim"){ | ||
219 | 229 | ||
220 | $mapa->save($arqtemp.".map"); | 230 | $mapa->save($arqtemp.".map"); |
221 | $mapa = ms_newMapObj($arqtemp.".map"); | 231 | $mapa = ms_newMapObj($arqtemp.".map"); |
232 | + | ||
222 | /* | 233 | /* |
223 | if(validaAcessoTemas($arqtemp.".map",false) == true){ | 234 | if(validaAcessoTemas($arqtemp.".map",false) == true){ |
224 | echo "Existem temas restritos";exit; | 235 | echo "Existem temas restritos";exit; |
@@ -243,11 +254,11 @@ foreach($lista as $l){ | @@ -243,11 +254,11 @@ foreach($lista as $l){ | ||
243 | $layer = $mapa->getlayerbyname($tema); | 254 | $layer = $mapa->getlayerbyname($tema); |
244 | 255 | ||
245 | $copyright = $mapa->getlayerbyname("copyright"); | 256 | $copyright = $mapa->getlayerbyname("copyright"); |
246 | -$classe = ms_newClassObj($copyright); | ||
247 | - | ||
248 | -$classet = ms_newClassObj($copyright); | ||
249 | -$classet->title = " "; | ||
250 | - | 257 | +if($copyright != ""){ |
258 | + $classe = ms_newClassObj($copyright); | ||
259 | + $classet = ms_newClassObj($copyright); | ||
260 | + $classet->title = " "; | ||
261 | +} | ||
251 | $mapa->moveLayerdown(0); | 262 | $mapa->moveLayerdown(0); |
252 | 263 | ||
253 | if($copyright != ""){ | 264 | if($copyright != ""){ |
@@ -265,7 +276,6 @@ if($copyright != ""){ | @@ -265,7 +276,6 @@ if($copyright != ""){ | ||
265 | $imagens = array(); | 276 | $imagens = array(); |
266 | $duracao = array(); | 277 | $duracao = array(); |
267 | $objImagem = ""; | 278 | $objImagem = ""; |
268 | - | ||
269 | foreach($listaunica as $d){ | 279 | foreach($listaunica as $d){ |
270 | if(strtoupper($colunat) == $colunat){ | 280 | if(strtoupper($colunat) == $colunat){ |
271 | $filtro = "(('[$colunat]' $operador '$d'))"; | 281 | $filtro = "(('[$colunat]' $operador '$d'))"; |
@@ -280,6 +290,7 @@ foreach($listaunica as $d){ | @@ -280,6 +290,7 @@ foreach($listaunica as $d){ | ||
280 | } | 290 | } |
281 | } | 291 | } |
282 | $layer->setfilter($filtro); | 292 | $layer->setfilter($filtro); |
293 | + | ||
283 | $nomec = $arqtemp.$d.".png"; | 294 | $nomec = $arqtemp.$d.".png"; |
284 | 295 | ||
285 | if($copyright != "" && $vi >= 60300){ | 296 | if($copyright != "" && $vi >= 60300){ |
@@ -289,12 +300,17 @@ foreach($listaunica as $d){ | @@ -289,12 +300,17 @@ foreach($listaunica as $d){ | ||
289 | else{ | 300 | else{ |
290 | $classe->title = $d; | 301 | $classe->title = $d; |
291 | } | 302 | } |
303 | + //$mapa->save($arqtemp."teste.map"); | ||
292 | if(!file_exists($nomec)){ | 304 | if(!file_exists($nomec)){ |
293 | if($objImagem == ""){ | 305 | if($objImagem == ""){ |
306 | + //$mapa->save($arqtemp.".map"); | ||
307 | + //echo $arqtemp.".map"; | ||
294 | $objImagem = $mapa->draw(); | 308 | $objImagem = $mapa->draw(); |
295 | $objImagem->saveImage($nomec); | 309 | $objImagem->saveImage($nomec); |
296 | } | 310 | } |
297 | else{ | 311 | else{ |
312 | + //$mapa->save($arqtemp.".map"); | ||
313 | + //echo $arqtemp.".map"; | ||
298 | $i = $mapa->draw(); | 314 | $i = $mapa->draw(); |
299 | $objImagem->pasteImage($i,-1); | 315 | $objImagem->pasteImage($i,-1); |
300 | $objImagem->saveImage($nomec); | 316 | $objImagem->saveImage($nomec); |
@@ -303,6 +319,7 @@ foreach($listaunica as $d){ | @@ -303,6 +319,7 @@ foreach($listaunica as $d){ | ||
303 | $imagens[] = $nomec; | 319 | $imagens[] = $nomec; |
304 | $duracao[] = $tempo; | 320 | $duracao[] = $tempo; |
305 | } | 321 | } |
322 | + | ||
306 | //junta as imagens no gif | 323 | //junta as imagens no gif |
307 | 324 | ||
308 | include("../../pacotes/gifcreator/GifCreator.php"); | 325 | include("../../pacotes/gifcreator/GifCreator.php"); |
@@ -312,6 +329,7 @@ $gc->create($imagens, $duracao, 0); | @@ -312,6 +329,7 @@ $gc->create($imagens, $duracao, 0); | ||
312 | $gifBinary = $gc->getGif(); | 329 | $gifBinary = $gc->getGif(); |
313 | file_put_contents($arqtemp.".gif", $gifBinary); | 330 | file_put_contents($arqtemp.".gif", $gifBinary); |
314 | //retorna o gif para o navegador | 331 | //retorna o gif para o navegador |
332 | +ob_clean(); | ||
315 | header('Content-type: image/gif'); | 333 | header('Content-type: image/gif'); |
316 | header('Content-Disposition: filename="'.$tema.'.gif"'); | 334 | header('Content-Disposition: filename="'.$tema.'.gif"'); |
317 | echo $gifBinary; | 335 | echo $gifBinary; |
@@ -0,0 +1,389 @@ | @@ -0,0 +1,389 @@ | ||
1 | +/* | ||
2 | +Title: animagif | ||
3 | + | ||
4 | +Cria um arquivo gif que mostra superposição de imagens do mapa atual | ||
5 | + | ||
6 | +<i3GEO.tema.dialogo.animagif> | ||
7 | + | ||
8 | +Arquivo: | ||
9 | + | ||
10 | +i3geo/ferramentas/animagif/index.js.php | ||
11 | + | ||
12 | +Licenca: | ||
13 | + | ||
14 | +GPL2 | ||
15 | + | ||
16 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
17 | + | ||
18 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
19 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
20 | + | ||
21 | +Este programa é software livre; você pode redistribuí-lo | ||
22 | +e/ou modificá-lo sob os termos da Licença Pública Geral | ||
23 | +GNU conforme publicada pela Free Software Foundation; | ||
24 | + | ||
25 | +Este programa é distribuído na expectativa de que seja útil, | ||
26 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
27 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
28 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
29 | +Você deve ter recebido uma cópia da Licença Pública Geral do | ||
30 | +GNU junto com este programa; se não, escreva para a | ||
31 | +Free Software Foundation, Inc., no endereço | ||
32 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
33 | + */ | ||
34 | +if (typeof (i3GEOF) === 'undefined') { | ||
35 | + var i3GEOF = {}; | ||
36 | +} | ||
37 | + | ||
38 | +/* | ||
39 | + * Classe: i3GEOF.animagif | ||
40 | + * | ||
41 | + * Camadas podem ter as definicoes default de parametros armazenadas no metadata animagif Esse metadata e mantido no objeto | ||
42 | + * i3GEO.arvoreDeCamadas.CAMADAS | ||
43 | + * | ||
44 | + * Os campos definidos pelo usuario podem ser salvos no mapfile caso o usuario esteja logado | ||
45 | + * | ||
46 | + * Veja tambem i3geo/ferramentas/atalhosedicao | ||
47 | + */ | ||
48 | +i3GEOF.animagif = | ||
49 | +{ | ||
50 | + /* | ||
51 | + * Variavel: tema | ||
52 | + * | ||
53 | + * Tema que será utilizado | ||
54 | + * | ||
55 | + * Type: {string} | ||
56 | + */ | ||
57 | + tema : i3GEO.temaAtivo, | ||
58 | + /* | ||
59 | + * Variavel: aguarde | ||
60 | + * | ||
61 | + * Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. | ||
62 | + */ | ||
63 | + aguarde : "", | ||
64 | + /* | ||
65 | + * Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário | ||
66 | + */ | ||
67 | + criaJanelaFlutuante : function() { | ||
68 | + i3GEOF.animagif.iniciaDicionario(); | ||
69 | + }, | ||
70 | + /** | ||
71 | + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php | ||
72 | + */ | ||
73 | + MUSTACHE : "", | ||
74 | + /** | ||
75 | + * Susbtitutos para o template | ||
76 | + */ | ||
77 | + mustacheHash : function() { | ||
78 | + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.animagif.dicionario); | ||
79 | + return dicionario; | ||
80 | + }, | ||
81 | + /* | ||
82 | + * Function: iniciaDicionario | ||
83 | + * | ||
84 | + * Carrega o dicionário e chama a função que inicia a ferramenta | ||
85 | + * | ||
86 | + * O Javascript é carregado com o id i3GEOF.nomedaferramenta.dicionario_script | ||
87 | + */ | ||
88 | + iniciaDicionario : function() { | ||
89 | + if (typeof (i3GEOF.animagif.dicionario) === 'undefined') { | ||
90 | + i3GEO.util.scriptTag( | ||
91 | + i3GEO.configura.locaplic + "/ferramentas/animagif/dicionario.js", | ||
92 | + "i3GEOF.animagif.iniciaJanelaFlutuante()", | ||
93 | + "i3GEOF.animagif.dicionario_script"); | ||
94 | + } else { | ||
95 | + i3GEOF.animagif.iniciaJanelaFlutuante(); | ||
96 | + } | ||
97 | + }, | ||
98 | + /* | ||
99 | + * Function: inicia | ||
100 | + * | ||
101 | + * Inicia a ferramenta. É chamado por criaJanelaFlutuante | ||
102 | + * | ||
103 | + * Parametro: | ||
104 | + * | ||
105 | + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | ||
106 | + */ | ||
107 | + inicia : function(iddiv) { | ||
108 | + var camada = "", temp; | ||
109 | + i3GEO.janela.comboCabecalhoTemas("i3GEOFanimagifComboCabeca", "i3GEOFanimagifComboCabecaSel", "animagif", "ligadosComTabela"); | ||
110 | + if(i3GEOF.animagif.tema === ""){ | ||
111 | + return; | ||
112 | + } | ||
113 | + $i(iddiv).innerHTML = i3GEOF.animagif.html(); | ||
114 | + i3GEOF.animagif.rodape(); | ||
115 | + // | ||
116 | + // verifica se a camada possui definicao dos parametros | ||
117 | + // | ||
118 | + if (i3GEO.arvoreDeCamadas) { | ||
119 | + camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.animagif.tema); | ||
120 | + if (camada != "" && camada.ferramentas.animagif) { | ||
121 | + if(camada.ferramentas.animagif.auto === "sim"){ | ||
122 | + $i("ativaAoAdic").checked = true; | ||
123 | + } | ||
124 | + if(camada.ferramentas.animagif.exec === "sim"){ | ||
125 | + $i("execAoAdic").checked = true; | ||
126 | + } | ||
127 | + temp = $i("i3GEOANIMAGIFtipocolunat").getElementsByTagName("select")[0]; | ||
128 | + temp.value = camada.ferramentas.animagif.tipocolunat; | ||
129 | + temp = $i("i3GEOANIMAGIFtempo"); | ||
130 | + temp.value = camada.ferramentas.animagif.tempo; | ||
131 | + temp = $i("i3GEOANIMAGIFw"); | ||
132 | + temp.value = camada.ferramentas.animagif.w; | ||
133 | + temp = $i("i3GEOANIMAGIFh"); | ||
134 | + temp.value = camada.ferramentas.animagif.h; | ||
135 | + temp = $i("i3GEOANIMAGIFcache").getElementsByTagName("select")[0]; | ||
136 | + temp.value = camada.ferramentas.animagif.cache; | ||
137 | + temp = $i("i3GEOANIMAGIFextensao"); | ||
138 | + temp.value = camada.ferramentas.animagif.extensao; | ||
139 | + temp = $i("i3GEOANIMAGIFlegenda").getElementsByTagName("select")[0]; | ||
140 | + temp.value = camada.ferramentas.animagif.legenda; | ||
141 | + temp = $i("i3GEOANIMAGIFtransparencia").getElementsByTagName("select")[0]; | ||
142 | + temp.value = camada.ferramentas.animagif.transparencia; | ||
143 | + temp = $i("i3GEOANIMAGIFoperador").getElementsByTagName("select")[0]; | ||
144 | + temp.value = camada.ferramentas.animagif.operador; | ||
145 | + temp = $i("i3GEOANIMAGIFnulos"); | ||
146 | + temp.value = camada.ferramentas.animagif.nulos; | ||
147 | + // combo para escolher a coluna com as datas | ||
148 | + i3GEO.util.comboItens("i3GEOanimagifcolunat", i3GEOF.animagif.tema, function(retorno) { | ||
149 | + $i("i3GEOANIMAGIFcolunatSel").innerHTML = retorno.dados; | ||
150 | + temp = $i("i3GEOANIMAGIFcolunat").getElementsByTagName("select")[0]; | ||
151 | + temp.value = camada.ferramentas.animagif.colunat; | ||
152 | + }, "i3GEOanimagifcolunatSel"); | ||
153 | + } else if (camada != "") { | ||
154 | + i3GEO.util.comboItens("i3GEOanimagifcolunat", i3GEOF.animagif.tema, function(retorno) { | ||
155 | + $i("i3GEOANIMAGIFcolunatSel").innerHTML = retorno.dados; | ||
156 | + }, "i3GEOanimagifcolunatSel"); | ||
157 | + $i("i3GEOANIMAGIFextensao").value = i3GEO.parametros.mapexten; | ||
158 | + } | ||
159 | + } else{ | ||
160 | + i3GEO.util.comboItens("i3GEOanimagifcolunat", i3GEOF.animagif.tema, function(retorno) { | ||
161 | + $i("i3GEOANIMAGIFcolunatSel").innerHTML = retorno.dados; | ||
162 | + }, "i3GEOanimagifcolunatSel"); | ||
163 | + $i("i3GEOANIMAGIFextensao").value = i3GEO.parametros.mapexten; | ||
164 | + } | ||
165 | + i3GEOF.animagif.ativaFoco(); | ||
166 | + }, | ||
167 | + rodape : function() { | ||
168 | + var ins = | ||
169 | + '<input class="paragrafo" id="i3GEOanimagifbotao1" type="button" value="' + $trad('geragif', i3GEOF.animagif.dicionario) | ||
170 | + + '" style="cursor:pointer;color:blue"/>'; | ||
171 | + if (i3GEO.login.verificaCookieLogin() === true) { | ||
172 | + ins += | ||
173 | + '<input class="paragrafo" style="margin-top:3px;" id="i3GEOanimagifbotaoSalva" type="button" value="' + $trad( | ||
174 | + 'salvaParametros', | ||
175 | + i3GEOF.animagif.dicionario) | ||
176 | + + '" style="cursor:pointer;color:blue"/>'; | ||
177 | + ins += | ||
178 | + '<input class="paragrafo" style="margin-top:3px;" id="i3GEOanimagifbotaoRemove" type="button" value="' + $trad( | ||
179 | + 'removeParametros', | ||
180 | + i3GEOF.animagif.dicionario) | ||
181 | + + '" style="cursor:pointer;color:blue"/>'; | ||
182 | + } | ||
183 | + YAHOO.i3GEO.janela.manager.find("i3GEOF.animagif").setFooter(ins); | ||
184 | + | ||
185 | + var b = new YAHOO.widget.Button("i3GEOanimagifbotao1", { | ||
186 | + onclick : { | ||
187 | + fn : i3GEOF.animagif.ativa | ||
188 | + } | ||
189 | + }); | ||
190 | + b.addClass("rodar"); | ||
191 | + $i("i3GEOanimagifbotao1-button").style.width = "350px"; | ||
192 | + if (i3GEO.login.verificaCookieLogin() === true && i3GEO.parametros.editor === "sim") { | ||
193 | + $i("parametrosComLogin").style.display = 'block'; | ||
194 | + b = new YAHOO.widget.Button("i3GEOanimagifbotaoSalva", { | ||
195 | + onclick : { | ||
196 | + fn : i3GEOF.animagif.salvaParametros | ||
197 | + } | ||
198 | + }); | ||
199 | + b.addClass("rodar"); | ||
200 | + $i("i3GEOanimagifbotaoSalva-button").style.width = "350px"; | ||
201 | + | ||
202 | + b = new YAHOO.widget.Button("i3GEOanimagifbotaoRemove", { | ||
203 | + onclick : { | ||
204 | + fn : i3GEOF.animagif.removeParametros | ||
205 | + } | ||
206 | + }); | ||
207 | + b.addClass("rodar"); | ||
208 | + $i("i3GEOanimagifbotaoRemove-button").style.width = "350px"; | ||
209 | + } | ||
210 | + }, | ||
211 | + /* | ||
212 | + * Function: html | ||
213 | + * | ||
214 | + * Gera o código html para apresentação das opções da ferramenta | ||
215 | + * | ||
216 | + * Retorno: | ||
217 | + * | ||
218 | + * String com o código html | ||
219 | + */ | ||
220 | + html : function() { | ||
221 | + var ins = Mustache.render(i3GEOF.animagif.MUSTACHE, i3GEOF.animagif.mustacheHash()); | ||
222 | + return ins; | ||
223 | + }, | ||
224 | + /* | ||
225 | + * Function: iniciaJanelaFlutuante | ||
226 | + * | ||
227 | + * Cria a janela flutuante para controle da ferramenta. | ||
228 | + */ | ||
229 | + iniciaJanelaFlutuante : function(tema) { | ||
230 | + i3GEOF.animagif.tema = tema; | ||
231 | + var minimiza, cabecalho, janela, divid, temp, titulo; | ||
232 | + if ($i("i3GEOF.animagif")) { | ||
233 | + i3GEOF.animagif.inicia("i3GEOF.animagif_corpo"); | ||
234 | + return; | ||
235 | + } | ||
236 | + cabecalho = function() { | ||
237 | + i3GEOF.animagif.ativaFoco(); | ||
238 | + }; | ||
239 | + minimiza = function() { | ||
240 | + i3GEO.janela.minimiza("i3GEOF.animagif"); | ||
241 | + }; | ||
242 | + // cria a janela flutuante | ||
243 | + titulo = | ||
244 | + "<span class='i3GEOiconeFerramenta i3GEOiconeanimagif'></span>" + "<div id='i3GEOFanimagifComboCabeca' class='comboTemasCabecalho'> ------</div>" | ||
245 | + + "<div class='i3GeoTituloJanela'>animagif </span><a class=ajuda_usuario target=_blank href='" | ||
246 | + + i3GEO.configura.locaplic | ||
247 | + + "/ajuda_usuario.php?idcategoria=5&idajuda=108' ><b> </b></a></div>"; | ||
248 | + janela = i3GEO.janela.cria("380px", "320px", "", "", "", titulo, "i3GEOF.animagif", false, "hd", cabecalho, minimiza, "", true); | ||
249 | + divid = janela[2].id; | ||
250 | + i3GEOF.animagif.aguarde = $i("i3GEOF.animagif_imagemCabecalho").style; | ||
251 | + $i("i3GEOF.animagif_corpo").style.backgroundColor = "white"; | ||
252 | + i3GEOF.animagif.inicia(divid); | ||
253 | + temp = function() { | ||
254 | + i3GEO.eventos.removeEventos( | ||
255 | + "ATUALIZAARVORECAMADAS", | ||
256 | + [ | ||
257 | + 'i3GEO.janela.comboCabecalhoTemas("i3GEOFanimagifComboCabeca","i3GEOFanimagifComboCabecaSel","animagif","ligadosComTabela")' | ||
258 | + ] | ||
259 | + ); | ||
260 | + }; | ||
261 | + YAHOO.util.Event.addListener(janela[0].close, "click", temp); | ||
262 | + }, | ||
263 | + /* | ||
264 | + * Function: ativaFoco | ||
265 | + * | ||
266 | + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado | ||
267 | + */ | ||
268 | + ativaFoco : function() { | ||
269 | + var i = $i("i3GEOF.animagif_c").style; | ||
270 | + i3GEO.janela.ULTIMOZINDEX++; | ||
271 | + i.zIndex = 21000 + i3GEO.janela.ULTIMOZINDEX; | ||
272 | + }, | ||
273 | + salvaParametros: function(){ | ||
274 | + //monta a string JSON que sera enviada para gravacao | ||
275 | + //'{"titulo":"População","colnome":"CNTRY_NAME","colsdata":["POP_CNTRY"],"lmax":"100000","amax":"2000000","auto":"sim","exec":"sim"}' | ||
276 | + var j, colsdata = i3GEOF.animagif.pegaItensMarcados(), auto = "nao", exec = "nao"; | ||
277 | + if($i("ativaAoAdic").checked === true){ | ||
278 | + auto = "sim"; | ||
279 | + } | ||
280 | + if($i("execAoAdic").checked === true){ | ||
281 | + exec = "sim"; | ||
282 | + } | ||
283 | + | ||
284 | + j = '{"titulo":"' | ||
285 | + + $i("i3GEOanimagiftitulo").value | ||
286 | + + '","colnome":"' | ||
287 | + + $i("i3GEOanimagifregioes").value | ||
288 | + + '","colsdata":[' | ||
289 | + + '"' + colsdata.join('","') + '"' | ||
290 | + + '],"lmax":"' | ||
291 | + + $i("i3GEOanimagifmaxHeight").value | ||
292 | + + '","amax":"' | ||
293 | + + $i("i3GEOanimagifbarSize").value | ||
294 | + + '","outlinecolor":"' | ||
295 | + + $i("i3GEOanimagifoutlinecolor").value | ||
296 | + + '","numvertices":"' | ||
297 | + + $i("i3GEOanimagifnumvertices").value | ||
298 | + + '","auto":"' | ||
299 | + + auto | ||
300 | + + '","exec":"' | ||
301 | + + exec | ||
302 | + + '"}'; | ||
303 | + | ||
304 | + i3GEO.janela.confirma($trad("incluiPar", i3GEOF.animagif.dicionario), 300, $trad("x14"), | ||
305 | + "", function() { | ||
306 | + p = i3GEO.configura.locaplic + "/ferramentas/animagif/manutencao.php"; | ||
307 | + par = "&g_sid=" + i3GEO.configura.sid | ||
308 | + + "&tema=" + i3GEOF.animagif.tema | ||
309 | + + "&animagif=" + i3GEO.util.base64encode(j) | ||
310 | + + "&funcao=incluianimagif"; | ||
311 | + | ||
312 | + retorno = | ||
313 | + function(retorno) { | ||
314 | + i3GEO.janela.fechaAguarde("animagif"); | ||
315 | + }; | ||
316 | + i3GEO.janela.abreAguarde("animagif", $trad("o1")); | ||
317 | + cpJSON.call(p, "foo", retorno, par); | ||
318 | + }); | ||
319 | + | ||
320 | + }, | ||
321 | + removeParametros: function(){ | ||
322 | + i3GEO.janela.confirma($trad("removePar", i3GEOF.animagif.dicionario), 300, $trad("x14"), | ||
323 | + "", function() { | ||
324 | + p = i3GEO.configura.locaplic + "/ferramentas/animagif/manutencao.php"; | ||
325 | + par = "&g_sid=" + i3GEO.configura.sid | ||
326 | + + "&tema=" + i3GEOF.animagif.tema | ||
327 | + + "&funcao=removeanimagif"; | ||
328 | + | ||
329 | + retorno = | ||
330 | + function(retorno) { | ||
331 | + i3GEO.janela.fechaAguarde("animagif"); | ||
332 | + }; | ||
333 | + i3GEO.janela.abreAguarde("animagif", $trad("o1")); | ||
334 | + cpJSON.call(p, "foo", retorno, par); | ||
335 | + }); | ||
336 | + }, | ||
337 | + /* | ||
338 | + * Function: ativa | ||
339 | + * | ||
340 | + * Cria o arquivo gif com os itens marcados | ||
341 | + * | ||
342 | + */ | ||
343 | + ativa : function() { | ||
344 | + var par = "", temp; | ||
345 | + temp = $i("i3GEOANIMAGIFcolunatSel").getElementsByTagName("select")[0]; | ||
346 | + if (temp.value === "") { | ||
347 | + i3GEO.janela.tempoMsg($trad('selecionaCol', i3GEOF.animagif.dicionario)); | ||
348 | + return; | ||
349 | + } | ||
350 | + par = "colunat=" + temp.value; | ||
351 | + temp = $i("i3GEOANIMAGIFtipocolunat"); | ||
352 | + par += "&tipocolunat=" + temp.value; | ||
353 | + temp = $i("i3GEOANIMAGIFtempo"); | ||
354 | + par += "&tempo=" + temp.value; | ||
355 | + temp = $i("i3GEOANIMAGIFw"); | ||
356 | + par += "&w=" + temp.value; | ||
357 | + temp = $i("i3GEOANIMAGIFh"); | ||
358 | + par += "&h=" + temp.value; | ||
359 | + temp = $i("i3GEOANIMAGIFcache").getElementsByTagName("select")[0]; | ||
360 | + par += "&cache=" + temp.value; | ||
361 | + temp = $i("i3GEOANIMAGIFextensao"); | ||
362 | + par += "&extensao=" + temp.value; | ||
363 | + temp = $i("i3GEOANIMAGIFlegenda").getElementsByTagName("select")[0]; | ||
364 | + par += "&legenda=" + temp.value; | ||
365 | + temp = $i("i3GEOANIMAGIFtransparencia").getElementsByTagName("select")[0]; | ||
366 | + par += "&transparencia=" + temp.value; | ||
367 | + temp = $i("i3GEOANIMAGIFoperador").getElementsByTagName("select")[0]; | ||
368 | + par += "&operador=" + temp.value; | ||
369 | + temp = $i("i3GEOANIMAGIFnulos"); | ||
370 | + par += "&nulos=" + temp.value; | ||
371 | + | ||
372 | + i3GEO.janela.cria( | ||
373 | + (parseInt($i("i3GEOANIMAGIFw").value,10) + 50) + "px", | ||
374 | + (parseInt($i("i3GEOANIMAGIFh").value,10) + 50) + "px", | ||
375 | + i3GEO.configura.locaplic+"/ferramentas/animagif/index.php?" + par + "&tema=" + i3GEOF.animagif.tema, | ||
376 | + "", | ||
377 | + "", | ||
378 | + "GIF", | ||
379 | + "i3GEOF.animagifGif", | ||
380 | + false, | ||
381 | + "hd", | ||
382 | + "", | ||
383 | + "", | ||
384 | + "", | ||
385 | + true | ||
386 | + ); | ||
387 | + $i("i3GEOF.animagif_corpo").style.backgroundColor = "white"; | ||
388 | + } | ||
389 | +}; |
ferramentas/animagif/index.php
@@ -3,18 +3,16 @@ $url = strip_tags("./exec.php?".$_SERVER["QUERY_STRING"]); | @@ -3,18 +3,16 @@ $url = strip_tags("./exec.php?".$_SERVER["QUERY_STRING"]); | ||
3 | ?> | 3 | ?> |
4 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 4 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | 5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
6 | - | ||
7 | <head> | 6 | <head> |
8 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
9 | <script type="text/javascript" src="../../pacotes/libgifjs/libgif.js"></script> | 8 | <script type="text/javascript" src="../../pacotes/libgifjs/libgif.js"></script> |
10 | - <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | 9 | + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" /> |
11 | <style> | 10 | <style> |
12 | body { | 11 | body { |
13 | font-family: Verdana, Arial, Helvetica, sans-serif; | 12 | font-family: Verdana, Arial, Helvetica, sans-serif; |
14 | } | 13 | } |
15 | </style> | 14 | </style> |
16 | </head> | 15 | </head> |
17 | - | ||
18 | <body> | 16 | <body> |
19 | <center> | 17 | <center> |
20 | <img id="anima" src="<?php echo $url; ?>" rel:animated_src="<?php echo $url; ?>" rel:auto_play="1" width="<?php echo $_GET["w"]?>" height="<?php echo $_GET["h"]?>" /> | 18 | <img id="anima" src="<?php echo $url; ?>" rel:animated_src="<?php echo $url; ?>" rel:auto_play="1" width="<?php echo $_GET["w"]?>" height="<?php echo $_GET["h"]?>" /> |
@@ -0,0 +1,125 @@ | @@ -0,0 +1,125 @@ | ||
1 | +<?php | ||
2 | +include_once(dirname(__FILE__)."/../inicia.php"); | ||
3 | +include_once(dirname(__FILE__)."/../../admin/php/login.php"); | ||
4 | +$funcoesEdicao = array( | ||
5 | + "REMOVE", | ||
6 | + "INCLUI" | ||
7 | +); | ||
8 | +if(in_array(strtoupper($funcao),$funcoesEdicao)){ | ||
9 | + if(verificaOperacaoSessao("admin/html/editormapfile") == false){ | ||
10 | + retornaJSON("Vc nao pode realizar essa operacao. Tente fazer login novamente.");exit; | ||
11 | + } | ||
12 | +} | ||
13 | +error_reporting(0); | ||
14 | +// | ||
15 | +//faz a busca da função que deve ser executada | ||
16 | +// | ||
17 | +$retorno = ""; //string que será retornada ao browser via JSON | ||
18 | +switch (strtoupper($funcao)) | ||
19 | +{ | ||
20 | + case "REMOVE": | ||
21 | + $mapa = ms_newMapObj($map_file); | ||
22 | + $l = $mapa->getlayerbyname($tema); | ||
23 | + if($l != ""){ | ||
24 | + $l->setmetadata("tme",""); | ||
25 | + $mapa->save($map_file); | ||
26 | + } | ||
27 | + $arq = $locaplic."/temas/".$tema.".map"; | ||
28 | + if(file_exists($arq)){ | ||
29 | + $mapa = ms_newMapObj($arq); | ||
30 | + $l = $mapa->getlayerbyname($tema); | ||
31 | + if($l != ""){ | ||
32 | + $l->setmetadata("animagif",""); | ||
33 | + $mapa->save($arq); | ||
34 | + removeCabecalho($arq); | ||
35 | + } | ||
36 | + } | ||
37 | + $retorno = "ok"; | ||
38 | + break; | ||
39 | + case "INCLUI": | ||
40 | + $mapa = ms_newMapObj($map_file); | ||
41 | + $l = $mapa->getlayerbyname($tema); | ||
42 | + if($l != ""){ | ||
43 | + $l->setmetadata("animagif",base64_decode($animagif)); | ||
44 | + $mapa->save($map_file); | ||
45 | + } | ||
46 | + $arq = $locaplic."/temas/".$tema.".map"; | ||
47 | + if(file_exists($arq)){ | ||
48 | + $mapa = ms_newMapObj($arq); | ||
49 | + $l = $mapa->getlayerbyname($tema); | ||
50 | + if($l != ""){ | ||
51 | + $l->setmetadata("animagif",base64_decode($animagif)); | ||
52 | + $mapa->save($arq); | ||
53 | + removeCabecalho($arq); | ||
54 | + } | ||
55 | + } | ||
56 | + $retorno = "ok"; | ||
57 | + break; | ||
58 | +} | ||
59 | +cpjson($retorno); | ||
60 | +//TODO colocar essa funcao em algum lugar que permita reaproveitamento | ||
61 | +function removeCabecalho($arq,$symbolset=true) | ||
62 | +{ | ||
63 | + $handle = fopen($arq, "r"); | ||
64 | + if ($handle) | ||
65 | + { | ||
66 | + $cabeca = array(); | ||
67 | + if($symbolset) | ||
68 | + { | ||
69 | + $cabeca[] = "MAP\n"; | ||
70 | + } | ||
71 | + $grava = false; | ||
72 | + while (!feof($handle)) | ||
73 | + { | ||
74 | + $linha = fgets($handle); | ||
75 | + if($symbolset) | ||
76 | + { | ||
77 | + if(strpos(strtoupper($linha),"SYMBOLSET") !== false) | ||
78 | + { | ||
79 | + $cabeca[] = $linha; | ||
80 | + } | ||
81 | + if(strpos(strtoupper($linha),"FONTSET") !== false) | ||
82 | + { | ||
83 | + $cabeca[] = $linha; | ||
84 | + } | ||
85 | + } | ||
86 | + if(strtoupper(trim($linha)) == "LAYER") | ||
87 | + { | ||
88 | + $grava = true; | ||
89 | + } | ||
90 | + if($grava) | ||
91 | + { | ||
92 | + $final[] = rtrim($linha, "\r\n") . PHP_EOL; | ||
93 | + } | ||
94 | + } | ||
95 | + fclose($handle); | ||
96 | + } | ||
97 | + $final = array_merge($cabeca,$final); | ||
98 | + $handle = fopen($arq, "w+"); | ||
99 | + foreach ($final as $f) | ||
100 | + { | ||
101 | + // | ||
102 | + //remove resultados em branco | ||
103 | + //e grava a linha | ||
104 | + // | ||
105 | + $teste = strtoupper($f); | ||
106 | + $teste = trim($teste); | ||
107 | + $teste = str_replace(" ","",$teste); | ||
108 | + $teste = str_replace("'","",$teste); | ||
109 | + $teste = str_replace('"',"",$teste); | ||
110 | + $teste = preg_replace('/[\n\r\t ]*/', '', $teste); | ||
111 | + $testar = array("KEYIMAGE","TILEINDEX","TILEITEM","SYMBOL","LABELITEM","FILTERITEM","GROUP","ENCODING","TIP","CLASSE","ITENSDESC","CLASSESNOME","ITENSLINK","ESCALA","CLASSESSIMBOLO","MENSAGEM","EXTENSAO","CLASSESITEM","ESCONDIDO","CLASSESCOR","DOWNLOAD","CLASSESTAMANHO","ITENS","TEMA","APLICAEXTENSAO","IDENTIFICA"); | ||
112 | + $passou = true; | ||
113 | + foreach ($testar as $t) | ||
114 | + { | ||
115 | + if($teste == $t){ | ||
116 | + $passou = false; | ||
117 | + } | ||
118 | + } | ||
119 | + if($passou) | ||
120 | + fwrite($handle,$f); | ||
121 | + } | ||
122 | + fclose($handle); | ||
123 | + chmod($arq, 0666); | ||
124 | +} | ||
125 | +?> | ||
0 | \ No newline at end of file | 126 | \ No newline at end of file |
@@ -0,0 +1,76 @@ | @@ -0,0 +1,76 @@ | ||
1 | +<div style='text-align: left; background: yellow;' | ||
2 | + id='i3GEOANIMAGIFresultado'></div> | ||
3 | +<div style='display: none;' id='parametrosComLogin'> | ||
4 | + <p class='paragrafo'> | ||
5 | + <input type='checkbox' id='ativaAoAdic' /><label>{{{ativaAoAdic}}}</label> | ||
6 | + <p class='paragrafo'> | ||
7 | + <input type='checkbox' id='execAoAdic' /><label>{{{execAoAdic}}}</label> | ||
8 | +</div> | ||
9 | +<p class='paragrafo'>{{{colunat}}} | ||
10 | +<div id='i3GEOANIMAGIFcolunatSel' class='styled-select'></div> | ||
11 | +<br> | ||
12 | +<p class='paragrafo'>{{{tipocolunat}}} | ||
13 | +<div id='i3GEOANIMAGIFtipocolunat' class='styled-select'> | ||
14 | + <select> | ||
15 | + <option value='numero'>{{{numerico}}}</option> | ||
16 | + <option value='string'>{{{texto}}}</option> | ||
17 | + </select> | ||
18 | +</div> | ||
19 | +<br> | ||
20 | +<p class='paragrafo'>{{{tempo}}} | ||
21 | +<div class='i3geoForm i3geoFormIconeNumero'> | ||
22 | + <input type='number' value='40' id='i3GEOANIMAGIFtempo' /> | ||
23 | +</div> | ||
24 | +<br> | ||
25 | +<p class='paragrafo'>{{{w}}} | ||
26 | +<div class='i3geoForm i3geoFormIconeNumero'> | ||
27 | + <input type='number' value='500' id='i3GEOANIMAGIFw' /> | ||
28 | +</div> | ||
29 | +<br> | ||
30 | +<p class='paragrafo'>{{{h}}} | ||
31 | +<div class='i3geoForm i3geoFormIconeNumero'> | ||
32 | + <input type='number' value='500' id='i3GEOANIMAGIFh' /> | ||
33 | +</div> | ||
34 | +<br> | ||
35 | +<p class='paragrafo'>{{{cache}}} | ||
36 | +<div id='i3GEOANIMAGIFcache' class='styled-select'> | ||
37 | + <select> | ||
38 | + <option value='sim'>{{{sim}}}</option> | ||
39 | + <option value='nao'>{{{nao}}}</option> | ||
40 | + </select> | ||
41 | +</div> | ||
42 | +<br> | ||
43 | +<p class='paragrafo'>{{{extensao}}} | ||
44 | +<div class='i3geoForm i3geoFormIconeEdita'> | ||
45 | + <input type='text' value='' id='i3GEOANIMAGIFextensao' /> | ||
46 | +</div> | ||
47 | +<br> | ||
48 | +<p class='paragrafo'>{{{legenda}}} | ||
49 | +<div id='i3GEOANIMAGIFlegenda' class='styled-select'> | ||
50 | + <select> | ||
51 | + <option value='sim'>{{{sim}}}</option> | ||
52 | + <option value='nao'>{{{nao}}}</option> | ||
53 | + </select> | ||
54 | +</div> | ||
55 | +<br> | ||
56 | +<p class='paragrafo'>{{{transparencia}}} | ||
57 | +<div id='i3GEOANIMAGIFtransparencia' class='styled-select'> | ||
58 | + <select> | ||
59 | + <option value='sim'>{{{sim}}}</option> | ||
60 | + <option value='nao'>{{{nao}}}</option> | ||
61 | + </select> | ||
62 | +</div> | ||
63 | +<br> | ||
64 | +<p class='paragrafo'>{{{operador}}} | ||
65 | +<div class='styled-select' id='i3GEOANIMAGIFoperador'> | ||
66 | + <select > | ||
67 | + <option value=''>=</option> | ||
68 | + <option value='lt'>lt</option> | ||
69 | + <option value='gt'>gt</option> | ||
70 | + </select> | ||
71 | +</div> | ||
72 | +<br> | ||
73 | +<p class='paragrafo'>{{{nulos}}} | ||
74 | +<div class='i3geoForm i3geoFormIconeEdita'> | ||
75 | + <input type='text' value='' id='i3GEOANIMAGIFnulos' /> | ||
76 | +</div> |