From d5eb227667a38d5c1bb3683e38f966cab9d03063 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 5 Apr 2016 16:03:58 -0300 Subject: [PATCH] formulario para a ferramenta animagif --- ferramentas/animagif/dependencias.php | 30 ++++++++++++++++++++++++++++++ ferramentas/animagif/dicionario.js | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ferramentas/animagif/exec.php | 32 +++++++++++++++++++++++++------- ferramentas/animagif/index.js | 389 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ferramentas/animagif/index.php | 4 +--- ferramentas/animagif/manutencao.php | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ferramentas/animagif/template_mst.html | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 739 insertions(+), 10 deletions(-) create mode 100755 ferramentas/animagif/dependencias.php create mode 100755 ferramentas/animagif/dicionario.js create mode 100755 ferramentas/animagif/index.js create mode 100755 ferramentas/animagif/manutencao.php create mode 100755 ferramentas/animagif/template_mst.html diff --git a/ferramentas/animagif/dependencias.php b/ferramentas/animagif/dependencias.php new file mode 100755 index 0000000..cab2dbd --- /dev/null +++ b/ferramentas/animagif/dependencias.php @@ -0,0 +1,30 @@ + ou com a funcao scripttag do i3Geo + * Alem de carregar os scripts, carrega tambem o template no formato MUSTACHE, definindo a variavel + * javascript i3GEOF.animagif.MUSTACHE + * O template e substituido pelos valores definidos em index.js no momento da inicializacao da ferramenta + */ +if(extension_loaded('zlib')){ + ob_start('ob_gzhandler'); +} +header("Content-type: text/javascript"); +include("index.js"); +include("dicionario.js"); +echo "\n"; +/** + * Inclui o template mustache do HTML usado para criar o conteudo da janela + */ +echo 'i3GEOF.animagif.MUSTACHE = "'; +$texto = file_get_contents("template_mst.html"); +$texto = str_replace("\n", "", $texto); +$texto = str_replace("\r", "", $texto); +$texto = str_replace("\t", "", $texto); +$texto = str_replace('"', "'", $texto); +echo $texto; +echo '";'; +if(extension_loaded('zlib')){ + ob_end_flush(); +} +?> \ No newline at end of file diff --git a/ferramentas/animagif/dicionario.js b/ferramentas/animagif/dicionario.js new file mode 100755 index 0000000..2b973c8 --- /dev/null +++ b/ferramentas/animagif/dicionario.js @@ -0,0 +1,93 @@ +//+$trad(1,i3GEOF.animagif.dicionario)+ +i3GEOF.animagif.dicionario = { + 'ativaAoAdic' : [ { + pt : "Abre a ferramenta quando a camada é adicionada ao mapa, permitindo que o usuário escolha os parâmetros", + en : "", + es : "" + } ], + 'execAoAdic' : [ { + pt : "Gera a animação quando o usuário adiciona a camada ao mapa", + en : "", + es : "" + } ], + 'colunat' : [ { + pt : "Coluna que será utilizada para obter a lista de datas e que receberá o filtro de data para cada quadro da animação", + en : "", + es : "" + } ], + 'tempo' : [ { + pt : "Tempo em milisegundos entre cada quadro", + en : "", + es : "" + } ], + 'w' : [ { + pt : "Largura da imagem gif que será gerada", + en : "", + es : "" + } ], + 'cache' : [ { + pt : "Reaproveita o arquivo gif em cache", + en : "", + es : "" + } ], + 'extensao' : [ { + pt : "Extensão geográfica (xmin, ymin, xmax, ymax)", + en : "", + es : "" + } ], + 'legenda' : [ { + pt : "Mostra a legenda", + en : "", + es : "" + } ], + 'transparencia' : [ { + pt : "Cada quadro será transparente", + en : "", + es : "" + } ], + 'tipocolunat' : [ { + pt : "Tipo da coluna com os valores", + en : "", + es : "" + } ], + 'nulos' : [ { + pt : "Lista de valores, separados por vírgula, que serão excluídos no processo de obtenção da lista de datas", + en : "", + es : "" + } ], + 'operador' : [ { + 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)", + en : "", + es : "" + } ], + 'geragif' : [{ + pt : "Cria o gif animado", + en : "", + es : "" + }], + 'numerico' : [{ + pt : "Numérico", + en : "", + es : "" + }], + 'texto' : [{ + pt : "Texto", + en : "", + es : "" + }], + 'sim' : [{ + pt : "Sim", + en : "", + es : "" + }], + 'nao' : [{ + pt : "Não", + en : "", + es : "" + }], + 'selecionaCol' : [{ + pt : "Selecione uma coluna", + en : "", + es : "" + }] +}; diff --git a/ferramentas/animagif/exec.php b/ferramentas/animagif/exec.php index 53a9ae6..e7c8cbd 100755 --- a/ferramentas/animagif/exec.php +++ b/ferramentas/animagif/exec.php @@ -38,6 +38,12 @@ if($cache == "nao"){ if(empty($tempo)){ $tempo = 40; } +if(empty($w)){ + $w = 500; +} +if(empty($h)){ + $h = 500; +} if(empty($nulos)){ $nulos = ""; } @@ -106,6 +112,7 @@ else{ $base = $locaplic."/aplicmap/".$base; } } + //desenv /var/www/html/i3geo/i3geo/sage/camadas/base_linux.map $mapa = ms_newMapObj($base); @@ -192,9 +199,12 @@ if($legenda == "sim"){ $leg->set("status",MS_EMBED); $cor = $leg->imagecolor; $cor->setrgb(250,250,250); + $labelleg = $leg->label; - $labelleg->set("type",MS_TRUETYPE); + + $labelleg->updatefromstring("LABEL TYPE TRUETYPE END"); $labelleg->set("font","arial"); + $labelleg->set("size",12); $leg->set("keyspacingy",0); $leg->set("keysizey",20); @@ -219,6 +229,7 @@ if($transparente == "sim"){ $mapa->save($arqtemp.".map"); $mapa = ms_newMapObj($arqtemp.".map"); + /* if(validaAcessoTemas($arqtemp.".map",false) == true){ echo "Existem temas restritos";exit; @@ -243,11 +254,11 @@ foreach($lista as $l){ $layer = $mapa->getlayerbyname($tema); $copyright = $mapa->getlayerbyname("copyright"); -$classe = ms_newClassObj($copyright); - -$classet = ms_newClassObj($copyright); -$classet->title = " "; - +if($copyright != ""){ + $classe = ms_newClassObj($copyright); + $classet = ms_newClassObj($copyright); + $classet->title = " "; +} $mapa->moveLayerdown(0); if($copyright != ""){ @@ -265,7 +276,6 @@ if($copyright != ""){ $imagens = array(); $duracao = array(); $objImagem = ""; - foreach($listaunica as $d){ if(strtoupper($colunat) == $colunat){ $filtro = "(('[$colunat]' $operador '$d'))"; @@ -280,6 +290,7 @@ foreach($listaunica as $d){ } } $layer->setfilter($filtro); + $nomec = $arqtemp.$d.".png"; if($copyright != "" && $vi >= 60300){ @@ -289,12 +300,17 @@ foreach($listaunica as $d){ else{ $classe->title = $d; } + //$mapa->save($arqtemp."teste.map"); if(!file_exists($nomec)){ if($objImagem == ""){ + //$mapa->save($arqtemp.".map"); + //echo $arqtemp.".map"; $objImagem = $mapa->draw(); $objImagem->saveImage($nomec); } else{ + //$mapa->save($arqtemp.".map"); + //echo $arqtemp.".map"; $i = $mapa->draw(); $objImagem->pasteImage($i,-1); $objImagem->saveImage($nomec); @@ -303,6 +319,7 @@ foreach($listaunica as $d){ $imagens[] = $nomec; $duracao[] = $tempo; } + //junta as imagens no gif include("../../pacotes/gifcreator/GifCreator.php"); @@ -312,6 +329,7 @@ $gc->create($imagens, $duracao, 0); $gifBinary = $gc->getGif(); file_put_contents($arqtemp.".gif", $gifBinary); //retorna o gif para o navegador +ob_clean(); header('Content-type: image/gif'); header('Content-Disposition: filename="'.$tema.'.gif"'); echo $gifBinary; diff --git a/ferramentas/animagif/index.js b/ferramentas/animagif/index.js new file mode 100755 index 0000000..9b1f382 --- /dev/null +++ b/ferramentas/animagif/index.js @@ -0,0 +1,389 @@ +/* +Title: animagif + +Cria um arquivo gif que mostra superposição de imagens do mapa atual + + + +Arquivo: + +i3geo/ferramentas/animagif/index.js.php + +Licenca: + +GPL2 + +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet + +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com + +Este programa é software livre; você pode redistribuí-lo +e/ou modificá-lo sob os termos da Licença Pública Geral +GNU conforme publicada pela Free Software Foundation; + +Este programa é distribuído na expectativa de que seja útil, +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. +Consulte a Licença Pública Geral do GNU para mais detalhes. +Você deve ter recebido uma cópia da Licença Pública Geral do +GNU junto com este programa; se não, escreva para a +Free Software Foundation, Inc., no endereço +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. + */ +if (typeof (i3GEOF) === 'undefined') { + var i3GEOF = {}; +} + +/* + * Classe: i3GEOF.animagif + * + * Camadas podem ter as definicoes default de parametros armazenadas no metadata animagif Esse metadata e mantido no objeto + * i3GEO.arvoreDeCamadas.CAMADAS + * + * Os campos definidos pelo usuario podem ser salvos no mapfile caso o usuario esteja logado + * + * Veja tambem i3geo/ferramentas/atalhosedicao + */ +i3GEOF.animagif = +{ + /* + * Variavel: tema + * + * Tema que será utilizado + * + * Type: {string} + */ + tema : i3GEO.temaAtivo, + /* + * Variavel: aguarde + * + * Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. + */ + aguarde : "", + /* + * Para efeitos de compatibilidade antes da versão 4.7 que não tinha dicionário + */ + criaJanelaFlutuante : function() { + i3GEOF.animagif.iniciaDicionario(); + }, + /** + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php + */ + MUSTACHE : "", + /** + * Susbtitutos para o template + */ + mustacheHash : function() { + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.animagif.dicionario); + return dicionario; + }, + /* + * Function: iniciaDicionario + * + * Carrega o dicionário e chama a função que inicia a ferramenta + * + * O Javascript é carregado com o id i3GEOF.nomedaferramenta.dicionario_script + */ + iniciaDicionario : function() { + if (typeof (i3GEOF.animagif.dicionario) === 'undefined') { + i3GEO.util.scriptTag( + i3GEO.configura.locaplic + "/ferramentas/animagif/dicionario.js", + "i3GEOF.animagif.iniciaJanelaFlutuante()", + "i3GEOF.animagif.dicionario_script"); + } else { + i3GEOF.animagif.iniciaJanelaFlutuante(); + } + }, + /* + * Function: inicia + * + * Inicia a ferramenta. É chamado por criaJanelaFlutuante + * + * Parametro: + * + * iddiv {String} - id do div que receberá o conteudo HTML da ferramenta + */ + inicia : function(iddiv) { + var camada = "", temp; + i3GEO.janela.comboCabecalhoTemas("i3GEOFanimagifComboCabeca", "i3GEOFanimagifComboCabecaSel", "animagif", "ligadosComTabela"); + if(i3GEOF.animagif.tema === ""){ + return; + } + $i(iddiv).innerHTML = i3GEOF.animagif.html(); + i3GEOF.animagif.rodape(); + // + // verifica se a camada possui definicao dos parametros + // + if (i3GEO.arvoreDeCamadas) { + camada = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.animagif.tema); + if (camada != "" && camada.ferramentas.animagif) { + if(camada.ferramentas.animagif.auto === "sim"){ + $i("ativaAoAdic").checked = true; + } + if(camada.ferramentas.animagif.exec === "sim"){ + $i("execAoAdic").checked = true; + } + temp = $i("i3GEOANIMAGIFtipocolunat").getElementsByTagName("select")[0]; + temp.value = camada.ferramentas.animagif.tipocolunat; + temp = $i("i3GEOANIMAGIFtempo"); + temp.value = camada.ferramentas.animagif.tempo; + temp = $i("i3GEOANIMAGIFw"); + temp.value = camada.ferramentas.animagif.w; + temp = $i("i3GEOANIMAGIFh"); + temp.value = camada.ferramentas.animagif.h; + temp = $i("i3GEOANIMAGIFcache").getElementsByTagName("select")[0]; + temp.value = camada.ferramentas.animagif.cache; + temp = $i("i3GEOANIMAGIFextensao"); + temp.value = camada.ferramentas.animagif.extensao; + temp = $i("i3GEOANIMAGIFlegenda").getElementsByTagName("select")[0]; + temp.value = camada.ferramentas.animagif.legenda; + temp = $i("i3GEOANIMAGIFtransparencia").getElementsByTagName("select")[0]; + temp.value = camada.ferramentas.animagif.transparencia; + temp = $i("i3GEOANIMAGIFoperador").getElementsByTagName("select")[0]; + temp.value = camada.ferramentas.animagif.operador; + temp = $i("i3GEOANIMAGIFnulos"); + temp.value = camada.ferramentas.animagif.nulos; + // combo para escolher a coluna com as datas + i3GEO.util.comboItens("i3GEOanimagifcolunat", i3GEOF.animagif.tema, function(retorno) { + $i("i3GEOANIMAGIFcolunatSel").innerHTML = retorno.dados; + temp = $i("i3GEOANIMAGIFcolunat").getElementsByTagName("select")[0]; + temp.value = camada.ferramentas.animagif.colunat; + }, "i3GEOanimagifcolunatSel"); + } else if (camada != "") { + i3GEO.util.comboItens("i3GEOanimagifcolunat", i3GEOF.animagif.tema, function(retorno) { + $i("i3GEOANIMAGIFcolunatSel").innerHTML = retorno.dados; + }, "i3GEOanimagifcolunatSel"); + $i("i3GEOANIMAGIFextensao").value = i3GEO.parametros.mapexten; + } + } else{ + i3GEO.util.comboItens("i3GEOanimagifcolunat", i3GEOF.animagif.tema, function(retorno) { + $i("i3GEOANIMAGIFcolunatSel").innerHTML = retorno.dados; + }, "i3GEOanimagifcolunatSel"); + $i("i3GEOANIMAGIFextensao").value = i3GEO.parametros.mapexten; + } + i3GEOF.animagif.ativaFoco(); + }, + rodape : function() { + var ins = + ''; + if (i3GEO.login.verificaCookieLogin() === true) { + ins += + ''; + ins += + ''; + } + YAHOO.i3GEO.janela.manager.find("i3GEOF.animagif").setFooter(ins); + + var b = new YAHOO.widget.Button("i3GEOanimagifbotao1", { + onclick : { + fn : i3GEOF.animagif.ativa + } + }); + b.addClass("rodar"); + $i("i3GEOanimagifbotao1-button").style.width = "350px"; + if (i3GEO.login.verificaCookieLogin() === true && i3GEO.parametros.editor === "sim") { + $i("parametrosComLogin").style.display = 'block'; + b = new YAHOO.widget.Button("i3GEOanimagifbotaoSalva", { + onclick : { + fn : i3GEOF.animagif.salvaParametros + } + }); + b.addClass("rodar"); + $i("i3GEOanimagifbotaoSalva-button").style.width = "350px"; + + b = new YAHOO.widget.Button("i3GEOanimagifbotaoRemove", { + onclick : { + fn : i3GEOF.animagif.removeParametros + } + }); + b.addClass("rodar"); + $i("i3GEOanimagifbotaoRemove-button").style.width = "350px"; + } + }, + /* + * Function: html + * + * Gera o código html para apresentação das opções da ferramenta + * + * Retorno: + * + * String com o código html + */ + html : function() { + var ins = Mustache.render(i3GEOF.animagif.MUSTACHE, i3GEOF.animagif.mustacheHash()); + return ins; + }, + /* + * Function: iniciaJanelaFlutuante + * + * Cria a janela flutuante para controle da ferramenta. + */ + iniciaJanelaFlutuante : function(tema) { + i3GEOF.animagif.tema = tema; + var minimiza, cabecalho, janela, divid, temp, titulo; + if ($i("i3GEOF.animagif")) { + i3GEOF.animagif.inicia("i3GEOF.animagif_corpo"); + return; + } + cabecalho = function() { + i3GEOF.animagif.ativaFoco(); + }; + minimiza = function() { + i3GEO.janela.minimiza("i3GEOF.animagif"); + }; + // cria a janela flutuante + titulo = + "" + "
------
" + + "
animagif
"; + janela = i3GEO.janela.cria("380px", "320px", "", "", "", titulo, "i3GEOF.animagif", false, "hd", cabecalho, minimiza, "", true); + divid = janela[2].id; + i3GEOF.animagif.aguarde = $i("i3GEOF.animagif_imagemCabecalho").style; + $i("i3GEOF.animagif_corpo").style.backgroundColor = "white"; + i3GEOF.animagif.inicia(divid); + temp = function() { + i3GEO.eventos.removeEventos( + "ATUALIZAARVORECAMADAS", + [ + 'i3GEO.janela.comboCabecalhoTemas("i3GEOFanimagifComboCabeca","i3GEOFanimagifComboCabecaSel","animagif","ligadosComTabela")' + ] + ); + }; + YAHOO.util.Event.addListener(janela[0].close, "click", temp); + }, + /* + * Function: ativaFoco + * + * Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado + */ + ativaFoco : function() { + var i = $i("i3GEOF.animagif_c").style; + i3GEO.janela.ULTIMOZINDEX++; + i.zIndex = 21000 + i3GEO.janela.ULTIMOZINDEX; + }, + salvaParametros: function(){ + //monta a string JSON que sera enviada para gravacao + //'{"titulo":"População","colnome":"CNTRY_NAME","colsdata":["POP_CNTRY"],"lmax":"100000","amax":"2000000","auto":"sim","exec":"sim"}' + var j, colsdata = i3GEOF.animagif.pegaItensMarcados(), auto = "nao", exec = "nao"; + if($i("ativaAoAdic").checked === true){ + auto = "sim"; + } + if($i("execAoAdic").checked === true){ + exec = "sim"; + } + + j = '{"titulo":"' + + $i("i3GEOanimagiftitulo").value + + '","colnome":"' + + $i("i3GEOanimagifregioes").value + + '","colsdata":[' + + '"' + colsdata.join('","') + '"' + + '],"lmax":"' + + $i("i3GEOanimagifmaxHeight").value + + '","amax":"' + + $i("i3GEOanimagifbarSize").value + + '","outlinecolor":"' + + $i("i3GEOanimagifoutlinecolor").value + + '","numvertices":"' + + $i("i3GEOanimagifnumvertices").value + + '","auto":"' + + auto + + '","exec":"' + + exec + + '"}'; + + i3GEO.janela.confirma($trad("incluiPar", i3GEOF.animagif.dicionario), 300, $trad("x14"), + "", function() { + p = i3GEO.configura.locaplic + "/ferramentas/animagif/manutencao.php"; + par = "&g_sid=" + i3GEO.configura.sid + + "&tema=" + i3GEOF.animagif.tema + + "&animagif=" + i3GEO.util.base64encode(j) + + "&funcao=incluianimagif"; + + retorno = + function(retorno) { + i3GEO.janela.fechaAguarde("animagif"); + }; + i3GEO.janela.abreAguarde("animagif", $trad("o1")); + cpJSON.call(p, "foo", retorno, par); + }); + + }, + removeParametros: function(){ + i3GEO.janela.confirma($trad("removePar", i3GEOF.animagif.dicionario), 300, $trad("x14"), + "", function() { + p = i3GEO.configura.locaplic + "/ferramentas/animagif/manutencao.php"; + par = "&g_sid=" + i3GEO.configura.sid + + "&tema=" + i3GEOF.animagif.tema + + "&funcao=removeanimagif"; + + retorno = + function(retorno) { + i3GEO.janela.fechaAguarde("animagif"); + }; + i3GEO.janela.abreAguarde("animagif", $trad("o1")); + cpJSON.call(p, "foo", retorno, par); + }); + }, + /* + * Function: ativa + * + * Cria o arquivo gif com os itens marcados + * + */ + ativa : function() { + var par = "", temp; + temp = $i("i3GEOANIMAGIFcolunatSel").getElementsByTagName("select")[0]; + if (temp.value === "") { + i3GEO.janela.tempoMsg($trad('selecionaCol', i3GEOF.animagif.dicionario)); + return; + } + par = "colunat=" + temp.value; + temp = $i("i3GEOANIMAGIFtipocolunat"); + par += "&tipocolunat=" + temp.value; + temp = $i("i3GEOANIMAGIFtempo"); + par += "&tempo=" + temp.value; + temp = $i("i3GEOANIMAGIFw"); + par += "&w=" + temp.value; + temp = $i("i3GEOANIMAGIFh"); + par += "&h=" + temp.value; + temp = $i("i3GEOANIMAGIFcache").getElementsByTagName("select")[0]; + par += "&cache=" + temp.value; + temp = $i("i3GEOANIMAGIFextensao"); + par += "&extensao=" + temp.value; + temp = $i("i3GEOANIMAGIFlegenda").getElementsByTagName("select")[0]; + par += "&legenda=" + temp.value; + temp = $i("i3GEOANIMAGIFtransparencia").getElementsByTagName("select")[0]; + par += "&transparencia=" + temp.value; + temp = $i("i3GEOANIMAGIFoperador").getElementsByTagName("select")[0]; + par += "&operador=" + temp.value; + temp = $i("i3GEOANIMAGIFnulos"); + par += "&nulos=" + temp.value; + + i3GEO.janela.cria( + (parseInt($i("i3GEOANIMAGIFw").value,10) + 50) + "px", + (parseInt($i("i3GEOANIMAGIFh").value,10) + 50) + "px", + i3GEO.configura.locaplic+"/ferramentas/animagif/index.php?" + par + "&tema=" + i3GEOF.animagif.tema, + "", + "", + "GIF", + "i3GEOF.animagifGif", + false, + "hd", + "", + "", + "", + true + ); + $i("i3GEOF.animagif_corpo").style.backgroundColor = "white"; + } +}; diff --git a/ferramentas/animagif/index.php b/ferramentas/animagif/index.php index 1069ced..8d13da8 100755 --- a/ferramentas/animagif/index.php +++ b/ferramentas/animagif/index.php @@ -3,18 +3,16 @@ $url = strip_tags("./exec.php?".$_SERVER["QUERY_STRING"]); ?> - - + -
" height="" /> diff --git a/ferramentas/animagif/manutencao.php b/ferramentas/animagif/manutencao.php new file mode 100755 index 0000000..cdfcc51 --- /dev/null +++ b/ferramentas/animagif/manutencao.php @@ -0,0 +1,125 @@ +getlayerbyname($tema); + if($l != ""){ + $l->setmetadata("tme",""); + $mapa->save($map_file); + } + $arq = $locaplic."/temas/".$tema.".map"; + if(file_exists($arq)){ + $mapa = ms_newMapObj($arq); + $l = $mapa->getlayerbyname($tema); + if($l != ""){ + $l->setmetadata("animagif",""); + $mapa->save($arq); + removeCabecalho($arq); + } + } + $retorno = "ok"; + break; + case "INCLUI": + $mapa = ms_newMapObj($map_file); + $l = $mapa->getlayerbyname($tema); + if($l != ""){ + $l->setmetadata("animagif",base64_decode($animagif)); + $mapa->save($map_file); + } + $arq = $locaplic."/temas/".$tema.".map"; + if(file_exists($arq)){ + $mapa = ms_newMapObj($arq); + $l = $mapa->getlayerbyname($tema); + if($l != ""){ + $l->setmetadata("animagif",base64_decode($animagif)); + $mapa->save($arq); + removeCabecalho($arq); + } + } + $retorno = "ok"; + break; +} +cpjson($retorno); +//TODO colocar essa funcao em algum lugar que permita reaproveitamento +function removeCabecalho($arq,$symbolset=true) +{ + $handle = fopen($arq, "r"); + if ($handle) + { + $cabeca = array(); + if($symbolset) + { + $cabeca[] = "MAP\n"; + } + $grava = false; + while (!feof($handle)) + { + $linha = fgets($handle); + if($symbolset) + { + if(strpos(strtoupper($linha),"SYMBOLSET") !== false) + { + $cabeca[] = $linha; + } + if(strpos(strtoupper($linha),"FONTSET") !== false) + { + $cabeca[] = $linha; + } + } + if(strtoupper(trim($linha)) == "LAYER") + { + $grava = true; + } + if($grava) + { + $final[] = rtrim($linha, "\r\n") . PHP_EOL; + } + } + fclose($handle); + } + $final = array_merge($cabeca,$final); + $handle = fopen($arq, "w+"); + foreach ($final as $f) + { + // + //remove resultados em branco + //e grava a linha + // + $teste = strtoupper($f); + $teste = trim($teste); + $teste = str_replace(" ","",$teste); + $teste = str_replace("'","",$teste); + $teste = str_replace('"',"",$teste); + $teste = preg_replace('/[\n\r\t ]*/', '', $teste); + $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"); + $passou = true; + foreach ($testar as $t) + { + if($teste == $t){ + $passou = false; + } + } + if($passou) + fwrite($handle,$f); + } + fclose($handle); + chmod($arq, 0666); +} +?> \ No newline at end of file diff --git a/ferramentas/animagif/template_mst.html b/ferramentas/animagif/template_mst.html new file mode 100755 index 0000000..fb6f99a --- /dev/null +++ b/ferramentas/animagif/template_mst.html @@ -0,0 +1,76 @@ +
+ +

{{{colunat}}} +

+
+

{{{tipocolunat}}} +

+ +
+
+

{{{tempo}}} +

+ +
+
+

{{{w}}} +

+ +
+
+

{{{h}}} +

+ +
+
+

{{{cache}}} +

+ +
+
+

{{{extensao}}} +

+ +
+
+

{{{legenda}}} +

+ +
+
+

{{{transparencia}}} +

+ +
+
+

{{{operador}}} +

+ +
+
+

{{{nulos}}} +

+ +
-- libgit2 0.21.2