diff --git a/ferramentas/etiqueta/exec.php b/ferramentas/etiqueta/exec.php index 5358fae..ed2dc92 100755 --- a/ferramentas/etiqueta/exec.php +++ b/ferramentas/etiqueta/exec.php @@ -1,24 +1,13 @@ ativaEtiquetas> -*/ case "ATIVAETIQUETAS": - include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php"); - copiaSeguranca($map_file); - $m = new Toponimia($map_file,$tema); - $m->layer->setmetadata("IDENTIFICA",""); + $m->layer->setmetadata("cache","nao"); + $m->layer->setmetadata("IDENTIFICA",""); $m->layer->setmetadata("TIP",$_GET["tips"]); $m->layer->setmetadata("ITENS",$_GET["itens"]); $m->layer->setmetadata("ITENSDESC",$_GET["itensdesc"]); @@ -26,39 +15,19 @@ Ativa as etiquetas de um tema. $m->layer->setmetadata("UTFDATA",$_GET["utfdata"]); $m->layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]); $m->salva(); - $_SESSION["contadorsalva"]++; - $retorno = "ok"; + $retorno = true; break; -/* -Valor: REMOVEETIQUETAS - -Desativa as etiquetas de um tema. - -removeEtiquetas> -*/ case "REMOVEETIQUETAS": - include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php"); - copiaSeguranca($map_file); - $m = new Toponimia($map_file,$tema); - $retorno = $m->removeEtiquetas(); + $m->layer->setmetadata("cache","nao"); + $retorno = $m->removeEtiquetas(); $m->salva(); - $_SESSION["contadorsalva"]++; + $retorno = true; break; -/* - Valor: PEGADADOSETIQUETAS - -Obt�m os dados sobre itens, itensdesc, etc - -pegaDadosEtiquetas> -*/ case "PEGADADOSETIQUETAS": - include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php"); - $m = new Toponimia($map_file,$tema); $retorno = $m->pegaDadosEtiquetas(); break; } -if(isset($map_file) && isset($postgis_mapa) && $map_file != ""){ - restauraCon($map_file,$postgis_mapa); -} -cpjson($retorno); +ob_clean(); +header("Content-type: application/json"); +echo json_encode($retorno); ?> \ No newline at end of file diff --git a/ferramentas/etiqueta/index.js b/ferramentas/etiqueta/index.js index a4a5911..86bdf15 100755 --- a/ferramentas/etiqueta/index.js +++ b/ferramentas/etiqueta/index.js @@ -1,276 +1,194 @@ -/* -Title: Etiqueta -Ativa um determinado campo na tabela de atributos para ser utilizado na ferramenta de identificação do tipo "balão". - - - -Arquivo: - -i3geo/ferramentas/etiqueta/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.etiqueta - */ i3GEOF.etiqueta = { - tema : i3GEO.temaAtivo, - /* - Variavel: aguarde - - Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. - */ - aguarde: "", - /** - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php - */ - MUSTACHE : "", - MUSTACHELISTA : "", - /** - * Susbtitutos para o template - */ - mustacheHash : function() { - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario); - dicionario["aplica"] = $trad("p14"); - return dicionario; + renderFunction: i3GEO.janela.formModal, + _parameters: { + "tema": "", + "mustache": "", + "mustachelista": "", + "idContainer": "i3GEOetiquetaContainer", + "namespace": "etiqueta" }, - /* - Function: inicia - - Inicia a ferramenta. É chamado por criaJanelaFlutuante - - Parametro: - - iddiv {String} - id do div que receberá o conteudo HTML da ferramenta - */ - inicia: function(iddiv){ - if(i3GEOF.etiqueta.MUSTACHE == ""){ - var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html", - t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html"; - - $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) { - i3GEOF.etiqueta.MUSTACHE = r1[0]; - i3GEOF.etiqueta.MUSTACHELISTA = r2[0]; - i3GEOF.etiqueta.inicia(iddiv); + start : function(tema){ + var p = this._parameters, + i3f = this, + t1 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/template_mst.html", + t2 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/templateLista_mst.html"; + p.tema = tema; + if(p.mustache === ""){ + i3GEO.janela.abreAguarde(); + $.when( $.get(t1),$.get(t2)).done(function(r1,r2) { + p.mustache = r1[0]; + p.mustachelista = r2[0]; + i3f.html(); + i3GEO.janela.fechaAguarde(); }).fail(function() { - i3GEO.janela.closeMsg($trad("erroTpl")); + i3GEO.janela.snackBar({content: $trad("erroTpl"),style: "red"}); return; }); - return; - } - - if(i3GEOF.etiqueta.tema === ""){ - $i(iddiv).innerHTML = ""; - return; + } else { + i3f.html(); } - try{ - $i(iddiv).innerHTML = i3GEOF.etiqueta.html(); - if (!$i("i3GEOFetiquetaComboCabecaSel")) { - i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){ - var botao = evt.target; - if (botao) { - if (botao.value != "") { - i3GEO.mapa.ativaTema(botao.value); - i3GEOF.etiqueta.tema = botao.value; - $i(iddiv).innerHTML = ""; - i3GEOF.etiqueta.inicia(iddiv); - } else { - //$i(iddiv).innerHTML = ""; - } - } - }); - } - i3GEOF.etiqueta.ativaFoco(); - } - catch(erro){i3GEO.janela.tempoMsg(erro);} }, - /* - 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.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash()); - return ins; + destroy: function(){ + //nao use this aqui + //i3GEOF.legenda._parameters.mustache = ""; }, - /* - Function: iniciaJanelaFlutuante - - Cria a janela flutuante para controle da ferramenta. - */ - iniciaJanelaFlutuante: function(){ - var minimiza,cabecalho,janela,divid,temp,titulo; - if($i("i3GEOF.etiqueta")){ - i3GEOF.etiqueta.inicia("i3GEOF.etiqueta_corpo"); - return; - } - cabecalho = function(){ - i3GEOF.etiqueta.ativaFoco(); - }; - minimiza = function(){ - i3GEO.janela.minimiza("i3GEOF.etiqueta"); + html:function() { + var p = this._parameters, + i3f = this, + hash = {}; + hash = { + locaplic: i3GEO.configura.locaplic, + namespace: p.namespace, + idContainer: p.idContainer, + aplica: $trad("p14"), + ...i3GEO.idioma.objetoIdioma(i3f.dicionario) }; - //cria a janela flutuante - titulo = ""+$trad("d7at")+""; - janela = i3GEO.janela.cria( - "600px", - "400px", - "", - "", - "", - titulo, - "i3GEOF.etiqueta", - false, - "hd", - cabecalho, - minimiza, - "", - true, - "", - "", - "", - "", - "37" - ); - divid = janela[2].id; - i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style; - $i("i3GEOF.etiqueta_corpo").style.backgroundColor = "white"; - i3GEOF.etiqueta.inicia(divid); - }, - /* - Function: ativaFoco + i3f.renderFunction.call( + this, + { + texto: Mustache.render(p.mustache, hash), + onclose: i3f.destroy, + resizable: { + disabled: false, + ghost: true, + handles: "se,n" + }, + css: {'cursor': 'pointer', 'width': '100%', 'height': '50%','position': 'fixed','top': '', 'left': 0, 'right': 0, 'margin': 'auto', 'bottom': 0} + }); - Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado - */ - ativaFoco: function(){ - if(i3GEO.temaAtivo != ""){ - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEOF.etiqueta.tema); - } - }, - pegaDadosEtiquetas: function(funcao){ - var cp = new cpaint(), - p; - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaDadosEtiquetas&tema="+i3GEOF.etiqueta.tema; - cp.set_response_type("JSON"); - cp.call(p,"etiqueta",funcao); + i3GEO.php.listaItensTema( + i3GEOF.etiqueta.montaListaItens, + p.tema + ); }, - /* - Function: montaListaItens - - Monta a lista de itens que poderão ser escolhidos para compor o mapa. - - A lista é inserida no elemento html com id "i3GEOetiquetalistai" - - @TODO verificar quando um item ja esta na lista e marca-lo no checkbox - */ montaListaItens: function(retorno){ - var funcao = function(dadosItens){ - var mustache = [], ins,i,n,itensatuais,item, ck = '',lista, temp; - lista = dadosItens.data; - try{ - itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); - itensatuais = itensatuais.etiquetas.split(","); - n = retorno.data.valores.length; - for (i=0;i - */ - ativa: function(){ - try{ - if(i3GEOF.etiqueta.aguarde.visibility === "visible") - {return;} - var lista = i3GEOF.etiqueta.pegaItensMarcados(), - cp = new cpaint(), - temp, - p; - - i3GEOF.etiqueta.aguarde.visibility = "visible"; - temp = function(retorno){ - i3GEOF.etiqueta.aguarde.visibility = "hidden"; - i3GEO.atualiza(retorno); - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo); - }; - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid=" - + i3GEO.configura.sid - + "&funcao=ativaEtiquetas&tema=" - + i3GEOF.etiqueta.tema - + "&tips="+lista[0].toString(",") - + "&itens="+lista[1].toString(",") - //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(",")) - //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(",")) - + "&itensdesc="+lista[2].toString(",") - + "&itenslink="+lista[3].toString(",") - + "&itembuscarapida="+lista[4] - + "&utfdata="+lista[5]; - cp.set_response_type("JSON"); - cp.set_transfer_mode('POST'); - cp.call(p,"etiqueta",temp); - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} + ativa: function(btn){ + var lista = i3GEOF.etiqueta.pegaItensMarcados(); + var par = { + funcao: "ativaEtiquetas", + tips: lista[0].toString(","), + itens: lista[1].toString(","), + itensdesc: lista[2].toString(","), + itenslink: lista[3].toString(","), + itembuscarapida: lista[4], + utfdata: lista[5] + }; + i3GEOF.etiqueta.get({ + snackbar: false, + fn: false, + btn: btn, + par: par, + refresh: true + }); }, - /* - Function: desativa - - Desativa as etiqueta do tema ativo - - Veja: - - - */ - desativa: function(){ - try{ - if(i3GEOF.etiqueta.aguarde.visibility === "visible") - {return;} - var cp = new cpaint(), - temp, - p; - i3GEOF.etiqueta.aguarde.visibility = "visible"; - temp = function(retorno){ - i3GEOF.etiqueta.aguarde.visibility = "hidden"; - i3GEO.atualiza(retorno); - }; - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema; - cp.set_response_type("JSON"); - cp.call(p,"etiqueta",temp); - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} + desativa: function(btn){ + i3GEOF.etiqueta.get({ + snackbar: false, + fn: function(){ + i3GEO.php.listaItensTema( + i3GEOF.etiqueta.montaListaItens, + i3GEOF.etiqueta._parameters.tema + ); + }, + btn: btn, + par: {funcao: "removeEtiquetas"}, + refresh: true + }); } }; \ No newline at end of file diff --git a/ferramentas/etiqueta/templateLista_mst.html b/ferramentas/etiqueta/templateLista_mst.html index 0780db8..41a93e6 100755 --- a/ferramentas/etiqueta/templateLista_mst.html +++ b/ferramentas/etiqueta/templateLista_mst.html @@ -1,92 +1,84 @@ -
- - - - - - - - - - -{{#linhas}} - - - - - - - - - - {{/linhas}} - - - - - - - - - -
ColunaIdentificaTip (quando clicar)Tip (dinâmico)BuscaAliasLink
{{{item}}} -
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
\ No newline at end of file + + + + + + + + + + {{#linhas}} + + + + + + + + + + + {{/linhas}} + + + + + + + + + +
ColunaIdentificaTip (quando clicar)Tip (dinâmico)BuscaAliasLink
{{{item}}} +
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
diff --git a/ferramentas/etiqueta/template_mst.html b/ferramentas/etiqueta/template_mst.html index a9be54f..328e243 100755 --- a/ferramentas/etiqueta/template_mst.html +++ b/ferramentas/etiqueta/template_mst.html @@ -1,12 +1,10 @@ -
- - -
-
-
- -
- -
-
{{{selecionaItem}}}
+
+
+
+ +
+
+ +
+
{{{selecionaItem}}}
\ No newline at end of file diff --git a/js/tema.js b/js/tema.js index 5d04f13..9a9fe7b 100755 --- a/js/tema.js +++ b/js/tema.js @@ -765,7 +765,7 @@ i3GEO.tema = "etiqueta", "etiqueta", "dependencias.php", - "i3GEOF.etiqueta.start()"); + temp); }, /** * Function: funcaojstip -- libgit2 0.21.2