Commit 5a64383b6a32b6bd76713637909ea9a4e8705698

Authored by Edmar Moretti
1 parent f8a8deb1
Exists in master

Reformulação da ferramenta Etiquetas

ferramentas/etiqueta/exec.php
1 <?php 1 <?php
2 -include_once(dirname(__FILE__)."/../safe.php");  
3 -verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false);  
4 -//  
5 -//faz a busca da fun&ccedil;&atilde;o que deve ser executada  
6 -//  
7 -$retorno = ""; //string que ser&aacute; retornada ao browser via JSON  
8 -switch (strtoupper($funcao)) 2 +include (dirname(__FILE__) . "/../safe2.php");
  3 +verificaBlFerramentas(basename(dirname(__FILE__)), $_SESSION["i3geoBlFerramentas"], false);
  4 +include (dirname(__FILE__) . "/../../classesphp/classe_toponimia.php");
  5 +$m = new Toponimia($_SESSION["map_file"], $_GET["tema"]);
  6 +switch (strtoupper($_GET["funcao"]))
9 { 7 {
10 -/*  
11 -Valor: ATIVAETIQUETAS  
12 -  
13 -Ativa as etiquetas de um tema.  
14 -  
15 -<Toponimia->ativaEtiquetas>  
16 -*/  
17 case "ATIVAETIQUETAS": 8 case "ATIVAETIQUETAS":
18 - include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php");  
19 - copiaSeguranca($map_file);  
20 - $m = new Toponimia($map_file,$tema);  
21 - $m->layer->setmetadata("IDENTIFICA",""); 9 + $m->layer->setmetadata("cache","nao");
  10 + $m->layer->setmetadata("IDENTIFICA","");
22 $m->layer->setmetadata("TIP",$_GET["tips"]); 11 $m->layer->setmetadata("TIP",$_GET["tips"]);
23 $m->layer->setmetadata("ITENS",$_GET["itens"]); 12 $m->layer->setmetadata("ITENS",$_GET["itens"]);
24 $m->layer->setmetadata("ITENSDESC",$_GET["itensdesc"]); 13 $m->layer->setmetadata("ITENSDESC",$_GET["itensdesc"]);
@@ -26,39 +15,19 @@ Ativa as etiquetas de um tema. @@ -26,39 +15,19 @@ Ativa as etiquetas de um tema.
26 $m->layer->setmetadata("UTFDATA",$_GET["utfdata"]); 15 $m->layer->setmetadata("UTFDATA",$_GET["utfdata"]);
27 $m->layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]); 16 $m->layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]);
28 $m->salva(); 17 $m->salva();
29 - $_SESSION["contadorsalva"]++;  
30 - $retorno = "ok"; 18 + $retorno = true;
31 break; 19 break;
32 -/*  
33 -Valor: REMOVEETIQUETAS  
34 -  
35 -Desativa as etiquetas de um tema.  
36 -  
37 -<Toponimia->removeEtiquetas>  
38 -*/  
39 case "REMOVEETIQUETAS": 20 case "REMOVEETIQUETAS":
40 - include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php");  
41 - copiaSeguranca($map_file);  
42 - $m = new Toponimia($map_file,$tema);  
43 - $retorno = $m->removeEtiquetas(); 21 + $m->layer->setmetadata("cache","nao");
  22 + $retorno = $m->removeEtiquetas();
44 $m->salva(); 23 $m->salva();
45 - $_SESSION["contadorsalva"]++; 24 + $retorno = true;
46 break; 25 break;
47 -/*  
48 - Valor: PEGADADOSETIQUETAS  
49 -  
50 -Obt�m os dados sobre itens, itensdesc, etc  
51 -  
52 -<Toponimia->pegaDadosEtiquetas>  
53 -*/  
54 case "PEGADADOSETIQUETAS": 26 case "PEGADADOSETIQUETAS":
55 - include_once(dirname(__FILE__)."/../../classesphp/classe_toponimia.php");  
56 - $m = new Toponimia($map_file,$tema);  
57 $retorno = $m->pegaDadosEtiquetas(); 27 $retorno = $m->pegaDadosEtiquetas();
58 break; 28 break;
59 } 29 }
60 -if(isset($map_file) && isset($postgis_mapa) && $map_file != ""){  
61 - restauraCon($map_file,$postgis_mapa);  
62 -}  
63 -cpjson($retorno); 30 +ob_clean();
  31 +header("Content-type: application/json");
  32 +echo json_encode($retorno);
64 ?> 33 ?>
65 \ No newline at end of file 34 \ No newline at end of file
ferramentas/etiqueta/index.js
1 -/*  
2 -Title: Etiqueta  
3 1
4 -Ativa um determinado campo na tabela de atributos para ser utilizado na ferramenta de identifica&ccedil;&atilde;o do tipo "bal&atilde;o".  
5 -  
6 -<i3GEO.tema.dialogo.etiquetas>  
7 -  
8 -Arquivo:  
9 -  
10 -i3geo/ferramentas/etiqueta/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&eacute;rio do Meio Ambiente Brasil  
19 -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com  
20 -  
21 -Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo  
22 -e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral  
23 -GNU conforme publicada pela Free Software Foundation;  
24 -  
25 -Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,  
26 -por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita  
27 -de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.  
28 -Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.  
29 -Voc&ecirc; deve ter recebido uma c&oacute;pia da Licen&ccedil;a P&uacute;blica Geral do  
30 -GNU junto com este programa; se n&atilde;o, escreva para a  
31 -Free Software Foundation, Inc., no endere&ccedil;o  
32 -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.  
33 - */  
34 if(typeof(i3GEOF) === 'undefined'){ 2 if(typeof(i3GEOF) === 'undefined'){
35 var i3GEOF = {}; 3 var i3GEOF = {};
36 } 4 }
37 -  
38 -/*  
39 -Classe: i3GEOF.etiqueta  
40 - */  
41 i3GEOF.etiqueta = { 5 i3GEOF.etiqueta = {
42 - tema : i3GEO.temaAtivo,  
43 - /*  
44 - Variavel: aguarde  
45 -  
46 - Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.  
47 - */  
48 - aguarde: "",  
49 - /**  
50 - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php  
51 - */  
52 - MUSTACHE : "",  
53 - MUSTACHELISTA : "",  
54 - /**  
55 - * Susbtitutos para o template  
56 - */  
57 - mustacheHash : function() {  
58 - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario);  
59 - dicionario["aplica"] = $trad("p14");  
60 - return dicionario; 6 + renderFunction: i3GEO.janela.formModal,
  7 + _parameters: {
  8 + "tema": "",
  9 + "mustache": "",
  10 + "mustachelista": "",
  11 + "idContainer": "i3GEOetiquetaContainer",
  12 + "namespace": "etiqueta"
61 }, 13 },
62 - /*  
63 - Function: inicia  
64 -  
65 - Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante  
66 -  
67 - Parametro:  
68 -  
69 - iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta  
70 - */  
71 - inicia: function(iddiv){  
72 - if(i3GEOF.etiqueta.MUSTACHE == ""){  
73 - var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html",  
74 - t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html";  
75 -  
76 - $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) {  
77 - i3GEOF.etiqueta.MUSTACHE = r1[0];  
78 - i3GEOF.etiqueta.MUSTACHELISTA = r2[0];  
79 - i3GEOF.etiqueta.inicia(iddiv); 14 + start : function(tema){
  15 + var p = this._parameters,
  16 + i3f = this,
  17 + t1 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/template_mst.html",
  18 + t2 = i3GEO.configura.locaplic + "/ferramentas/"+p.namespace+"/templateLista_mst.html";
  19 + p.tema = tema;
  20 + if(p.mustache === ""){
  21 + i3GEO.janela.abreAguarde();
  22 + $.when( $.get(t1),$.get(t2)).done(function(r1,r2) {
  23 + p.mustache = r1[0];
  24 + p.mustachelista = r2[0];
  25 + i3f.html();
  26 + i3GEO.janela.fechaAguarde();
80 }).fail(function() { 27 }).fail(function() {
81 - i3GEO.janela.closeMsg($trad("erroTpl")); 28 + i3GEO.janela.snackBar({content: $trad("erroTpl"),style: "red"});
82 return; 29 return;
83 }); 30 });
84 - return;  
85 - }  
86 -  
87 - if(i3GEOF.etiqueta.tema === ""){  
88 - $i(iddiv).innerHTML = "";  
89 - return; 31 + } else {
  32 + i3f.html();
90 } 33 }
91 - try{  
92 - $i(iddiv).innerHTML = i3GEOF.etiqueta.html();  
93 34
94 - if (!$i("i3GEOFetiquetaComboCabecaSel")) {  
95 - i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){  
96 - var botao = evt.target;  
97 - if (botao) {  
98 - if (botao.value != "") {  
99 - i3GEO.mapa.ativaTema(botao.value);  
100 - i3GEOF.etiqueta.tema = botao.value;  
101 - $i(iddiv).innerHTML = "";  
102 - i3GEOF.etiqueta.inicia(iddiv);  
103 - } else {  
104 - //$i(iddiv).innerHTML = "";  
105 - }  
106 - }  
107 - });  
108 - }  
109 - i3GEOF.etiqueta.ativaFoco();  
110 - }  
111 - catch(erro){i3GEO.janela.tempoMsg(erro);}  
112 }, 35 },
113 - /*  
114 - Function: html  
115 -  
116 - Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta  
117 -  
118 - Retorno:  
119 -  
120 - String com o c&oacute;digo html  
121 - */  
122 - html:function() {  
123 - var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash());  
124 - return ins; 36 + destroy: function(){
  37 + //nao use this aqui
  38 + //i3GEOF.legenda._parameters.mustache = "";
125 }, 39 },
126 - /*  
127 - Function: iniciaJanelaFlutuante  
128 -  
129 - Cria a janela flutuante para controle da ferramenta.  
130 - */  
131 - iniciaJanelaFlutuante: function(){  
132 - var minimiza,cabecalho,janela,divid,temp,titulo;  
133 - if($i("i3GEOF.etiqueta")){  
134 - i3GEOF.etiqueta.inicia("i3GEOF.etiqueta_corpo");  
135 - return;  
136 - }  
137 - cabecalho = function(){  
138 - i3GEOF.etiqueta.ativaFoco();  
139 - };  
140 - minimiza = function(){  
141 - i3GEO.janela.minimiza("i3GEOF.etiqueta"); 40 + html:function() {
  41 + var p = this._parameters,
  42 + i3f = this,
  43 + hash = {};
  44 + hash = {
  45 + locaplic: i3GEO.configura.locaplic,
  46 + namespace: p.namespace,
  47 + idContainer: p.idContainer,
  48 + aplica: $trad("p14"),
  49 + ...i3GEO.idioma.objetoIdioma(i3f.dicionario)
142 }; 50 };
143 - //cria a janela flutuante  
144 - titulo = "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("d7at")+"</span></div>";  
145 - janela = i3GEO.janela.cria(  
146 - "600px",  
147 - "400px",  
148 - "",  
149 - "",  
150 - "",  
151 - titulo,  
152 - "i3GEOF.etiqueta",  
153 - false,  
154 - "hd",  
155 - cabecalho,  
156 - minimiza,  
157 - "",  
158 - true,  
159 - "",  
160 - "",  
161 - "",  
162 - "",  
163 - "37"  
164 - );  
165 - divid = janela[2].id;  
166 - i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style;  
167 - $i("i3GEOF.etiqueta_corpo").style.backgroundColor = "white";  
168 - i3GEOF.etiqueta.inicia(divid);  
169 - },  
170 - /*  
171 - Function: ativaFoco 51 + i3f.renderFunction.call(
  52 + this,
  53 + {
  54 + texto: Mustache.render(p.mustache, hash),
  55 + onclose: i3f.destroy,
  56 + resizable: {
  57 + disabled: false,
  58 + ghost: true,
  59 + handles: "se,n"
  60 + },
  61 + css: {'cursor': 'pointer', 'width': '100%', 'height': '50%','position': 'fixed','top': '', 'left': 0, 'right': 0, 'margin': 'auto', 'bottom': 0}
  62 + });
172 63
173 - Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado  
174 - */  
175 - ativaFoco: function(){  
176 - if(i3GEO.temaAtivo != ""){  
177 - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEOF.etiqueta.tema);  
178 - }  
179 - },  
180 - pegaDadosEtiquetas: function(funcao){  
181 - var cp = new cpaint(),  
182 - p;  
183 - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaDadosEtiquetas&tema="+i3GEOF.etiqueta.tema;  
184 - cp.set_response_type("JSON");  
185 - cp.call(p,"etiqueta",funcao); 64 + i3GEO.php.listaItensTema(
  65 + i3GEOF.etiqueta.montaListaItens,
  66 + p.tema
  67 + );
186 }, 68 },
187 - /*  
188 - Function: montaListaItens  
189 -  
190 - Monta a lista de itens que poder&atilde;o ser escolhidos para compor o mapa.  
191 -  
192 - A lista &eacute; inserida no elemento html com id "i3GEOetiquetalistai"  
193 -  
194 - @TODO verificar quando um item ja esta na lista e marca-lo no checkbox  
195 - */  
196 montaListaItens: function(retorno){ 69 montaListaItens: function(retorno){
197 - var funcao = function(dadosItens){  
198 - var mustache = [], ins,i,n,itensatuais,item, ck = '',lista, temp;  
199 - lista = dadosItens.data;  
200 - try{  
201 - itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo);  
202 - itensatuais = itensatuais.etiquetas.split(",");  
203 - n = retorno.data.valores.length;  
204 - for (i=0;i<n; i++){  
205 - temp = {};  
206 - item = retorno.data.valores[i].item;  
207 - temp.item = item;  
208 - if(i3GEO.util.in_array(item,lista.itens) || i3GEO.util.in_array(item,itensatuais) || lista.itembuscarapida[item]){  
209 - temp.ckIdentifica = "checked";  
210 - }  
211 - else{  
212 - temp.ckIdentifica = "";  
213 - }  
214 - if(i3GEO.util.in_array(item,itensatuais)){  
215 - temp.ckEtiquetaTip = "checked";  
216 - }  
217 - else{  
218 - temp.ckEtiquetaTip = "";  
219 - }  
220 - //utfdata  
221 - if(lista.utfdata === item){  
222 - temp.ckUtfdata = "checked";  
223 - }  
224 - else{  
225 - temp.ckUtfdata = "";  
226 - }  
227 - //buscarapida  
228 - if(lista.itembuscarapida === item){  
229 - temp.ckBuscaRapida = "checked";  
230 - }  
231 - else{  
232 - temp.ckBuscaRapida = "";  
233 - }  
234 - if(lista.itensdesc[item]){  
235 - temp.ckitensdesc = lista.itensdesc[item]; 70 + var data = retorno.data;
  71 + var funcao = function(lista){
  72 + var mustache = [], ins,i,n,itensatuais,item, ck = '',temp;
  73 + itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEOF.etiqueta._parameters.tema);
  74 + itensatuais = itensatuais.etiquetas.split(",");
  75 + n = data.valores.length;
  76 + for (i=0;i<n; i++){
  77 + temp = {};
  78 + item = data.valores[i].item;
  79 + temp.item = item;
  80 + if(i3GEO.util.in_array(item,lista.itens) || i3GEO.util.in_array(item,itensatuais) || lista.itembuscarapida[item]){
  81 + temp.ckIdentifica = "checked";
  82 + }
  83 + else{
  84 + temp.ckIdentifica = "";
  85 + }
  86 + if(i3GEO.util.in_array(item,itensatuais)){
  87 + temp.ckEtiquetaTip = "checked";
  88 + }
  89 + else{
  90 + temp.ckEtiquetaTip = "";
  91 + }
  92 + //utfdata
  93 + if(lista.utfdata === item){
  94 + temp.ckUtfdata = "checked";
  95 + }
  96 + else{
  97 + temp.ckUtfdata = "";
  98 + }
  99 + //buscarapida
  100 + if(lista.itembuscarapida === item){
  101 + temp.ckBuscaRapida = "checked";
  102 + }
  103 + else{
  104 + temp.ckBuscaRapida = "";
  105 + }
  106 + if(lista.itensdesc[item]){
  107 + temp.ckitensdesc = lista.itensdesc[item];
  108 + }
  109 + else{
  110 + temp.ckitensdesc = item;
  111 + }
  112 + //links
  113 + if(lista.itenslink[item]){
  114 + temp.ckitem = lista.itenslink[item];
  115 + }
  116 + else{
  117 + temp.ckitem = "";
  118 + }
  119 + mustache.push(temp);
  120 + }
  121 + ins = Mustache.render(
  122 + i3GEOF.etiqueta._parameters.mustachelista,
  123 + $.extend(
  124 + {},
  125 + {
  126 + "linhas" : mustache,
  127 + },
  128 + i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario)
  129 + )
  130 + );
  131 + $i("i3GEOetiquetalistai").innerHTML = ins;
  132 + //enable
  133 + lista = $i("i3GEOetiquetalistai").getElementsByTagName("input");
  134 + n = lista.length;
  135 + for (i=0;i<n; i++){
  136 + if(lista[i].name === "identifica"){
  137 + i3GEOF.etiqueta.ativaLinha(lista[i]);
  138 + }
  139 + }
  140 + };
  141 + i3GEOF.etiqueta.get({
  142 + snackbar: false,
  143 + fn: funcao,
  144 + btn: false,
  145 + par: {funcao: "pegaDadosEtiquetas"},
  146 + refresh: false
  147 + });
  148 + },
  149 + get: function({snackbar = true, btn = false, par = {}, refresh = false, fn = false} = {}){
  150 + var p = this._parameters,
  151 + i3f = this;
  152 + i3GEO.janela.abreAguarde();
  153 + if(btn){
  154 + btn = $(btn);
  155 + btn.prop("disabled",true).find("span .glyphicon").removeClass("hidden");
  156 + }
  157 + i3GEO.janela._formModal.block();
  158 + par.g_sid = i3GEO.configura.sid;
  159 + par.tema = p.tema;
  160 + $.get(
  161 + i3GEO.configura.locaplic+"/ferramentas/" + p.namespace + "/exec.php",
  162 + par
  163 + )
  164 + .done(
  165 + function(data, status){
  166 + i3GEO.janela._formModal.unblock();
  167 + i3GEO.janela.fechaAguarde();
  168 + if(btn){
  169 + btn.prop("disabled",false).find("span .glyphicon").addClass("hidden");
236 } 170 }
237 - else{  
238 - temp.ckitensdesc = item; 171 + if(snackbar){
  172 + i3GEO.janela.snackBar({content: $trad('feito')});
239 } 173 }
240 - //links  
241 - if(lista.itenslink[item]){  
242 - temp.ckitem = lista.itenslink[item]; 174 + if(refresh){
  175 + i3GEO.Interface.atualizaTema("", i3GEOF.etiqueta._parameters.tema);
243 } 176 }
244 - else{  
245 - temp.ckitem = ""; 177 + if(fn){
  178 + fn(data);
246 } 179 }
247 - mustache.push(temp);  
248 } 180 }
249 - ins = Mustache.render(  
250 - i3GEOF.etiqueta.MUSTACHELISTA,  
251 - $.extend(  
252 - {},  
253 - {  
254 - "linhas" : mustache,  
255 - },  
256 - i3GEOF.etiqueta.DICIONARIO  
257 - )  
258 - );  
259 - $i("i3GEOetiquetalistai").innerHTML = ins;  
260 -  
261 - //enable  
262 - lista = $i("i3GEOetiquetalistai").getElementsByTagName("input");  
263 - n = lista.length;  
264 - for (i=0;i<n; i++){  
265 - if(lista[i].name === "identifica"){  
266 - i3GEOF.etiqueta.ativaLinha(lista[i]); 181 + )
  182 + .fail(
  183 + function(data){
  184 + i3GEO.janela._formModal.unblock();
  185 + i3GEO.janela.fechaAguarde();
  186 + if(btn){
  187 + btn.prop("disabled",false).find("span .glyphicon").addClass("hidden");
267 } 188 }
  189 + i3GEO.janela.snackBar({content: data.statusText, style:'red'});
268 } 190 }
269 - }  
270 - catch(e)  
271 - {$i("i3GEOetiquetalistai").innerHTML = "<p style=color:red >Erro<br>"+e;}  
272 - };  
273 - i3GEOF.etiqueta.pegaDadosEtiquetas(funcao); 191 + );
274 }, 192 },
275 ativaLinha: function(obj){ 193 ativaLinha: function(obj){
276 var linha = obj.parentNode.parentNode, 194 var linha = obj.parentNode.parentNode,
@@ -283,11 +201,6 @@ i3GEOF.etiqueta = { @@ -283,11 +201,6 @@ i3GEOF.etiqueta = {
283 } 201 }
284 } 202 }
285 }, 203 },
286 - /*  
287 - Function: pegaItensMarcados  
288 -  
289 - Recupera os itens que foram marcados e monta uma lista para enviar como par&acirc;metro para a fun&ccedil;&atilde;o de gera&ccedil;&atilde;o dos gr&aacute;ficos  
290 - */  
291 pegaItensMarcados: function(){ 204 pegaItensMarcados: function(){
292 var tips = [], 205 var tips = [],
293 itens = [], 206 itens = [],
@@ -326,77 +239,40 @@ i3GEOF.etiqueta = { @@ -326,77 +239,40 @@ i3GEOF.etiqueta = {
326 if (el.checked === true && el.name == "utfdata"){ 239 if (el.checked === true && el.name == "utfdata"){
327 utfdata = el.value; 240 utfdata = el.value;
328 } 241 }
329 -  
330 -  
331 } 242 }
332 -  
333 return([tips,itens,itensdesc,itenslink,itembuscarapida,utfdata]); 243 return([tips,itens,itensdesc,itenslink,itembuscarapida,utfdata]);
334 }, 244 },
335 - /*  
336 - Function: ativa  
337 -  
338 - Ativa a etiqueta com os itens marcados  
339 -  
340 - Veja:  
341 -  
342 - <ATIVAETIQUETAS>  
343 - */  
344 - ativa: function(){  
345 - try{  
346 - if(i3GEOF.etiqueta.aguarde.visibility === "visible")  
347 - {return;}  
348 - var lista = i3GEOF.etiqueta.pegaItensMarcados(),  
349 - cp = new cpaint(),  
350 - temp,  
351 - p;  
352 -  
353 - i3GEOF.etiqueta.aguarde.visibility = "visible";  
354 - temp = function(retorno){  
355 - i3GEOF.etiqueta.aguarde.visibility = "hidden";  
356 - i3GEO.atualiza(retorno);  
357 - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo);  
358 - };  
359 - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="  
360 - + i3GEO.configura.sid  
361 - + "&funcao=ativaEtiquetas&tema="  
362 - + i3GEOF.etiqueta.tema  
363 - + "&tips="+lista[0].toString(",")  
364 - + "&itens="+lista[1].toString(",")  
365 - //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(","))  
366 - //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(","))  
367 - + "&itensdesc="+lista[2].toString(",")  
368 - + "&itenslink="+lista[3].toString(",")  
369 - + "&itembuscarapida="+lista[4]  
370 - + "&utfdata="+lista[5];  
371 - cp.set_response_type("JSON");  
372 - cp.set_transfer_mode('POST');  
373 - cp.call(p,"etiqueta",temp);  
374 - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} 245 + ativa: function(btn){
  246 + var lista = i3GEOF.etiqueta.pegaItensMarcados();
  247 + var par = {
  248 + funcao: "ativaEtiquetas",
  249 + tips: lista[0].toString(","),
  250 + itens: lista[1].toString(","),
  251 + itensdesc: lista[2].toString(","),
  252 + itenslink: lista[3].toString(","),
  253 + itembuscarapida: lista[4],
  254 + utfdata: lista[5]
  255 + };
  256 + i3GEOF.etiqueta.get({
  257 + snackbar: false,
  258 + fn: false,
  259 + btn: btn,
  260 + par: par,
  261 + refresh: true
  262 + });
375 }, 263 },
376 - /*  
377 - Function: desativa  
378 -  
379 - Desativa as etiqueta do tema ativo  
380 -  
381 - Veja:  
382 -  
383 - <REMOVEETIQUETAS>  
384 - */  
385 - desativa: function(){  
386 - try{  
387 - if(i3GEOF.etiqueta.aguarde.visibility === "visible")  
388 - {return;}  
389 - var cp = new cpaint(),  
390 - temp,  
391 - p;  
392 - i3GEOF.etiqueta.aguarde.visibility = "visible";  
393 - temp = function(retorno){  
394 - i3GEOF.etiqueta.aguarde.visibility = "hidden";  
395 - i3GEO.atualiza(retorno);  
396 - };  
397 - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema;  
398 - cp.set_response_type("JSON");  
399 - cp.call(p,"etiqueta",temp);  
400 - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} 264 + desativa: function(btn){
  265 + i3GEOF.etiqueta.get({
  266 + snackbar: false,
  267 + fn: function(){
  268 + i3GEO.php.listaItensTema(
  269 + i3GEOF.etiqueta.montaListaItens,
  270 + i3GEOF.etiqueta._parameters.tema
  271 + );
  272 + },
  273 + btn: btn,
  274 + par: {funcao: "removeEtiquetas"},
  275 + refresh: true
  276 + });
401 } 277 }
402 }; 278 };
403 \ No newline at end of file 279 \ No newline at end of file
ferramentas/etiqueta/templateLista_mst.html
1 -<div>  
2 - <table>  
3 - <tr>  
4 - <td>Coluna</td>  
5 - <td style="text-align:center;padding: 10px;">Identifica</td>  
6 - <td style="text-align:center;padding: 10px;">Tip (quando clicar)</td>  
7 - <td style="text-align:center;padding: 10px;">Tip (din&acirc;mico)</td>  
8 - <td style="text-align:center;padding: 10px;">Busca</td>  
9 - <td style="text-align:center;padding: 10px;">Alias</td>  
10 - <td style="text-align:center;padding: 10px;;">Link</td>  
11 - <tr>  
12 -{{#linhas}}  
13 - <tr>  
14 - <td>{{{item}}}</td>  
15 - <td>  
16 - <div class="checkbox condensed text-center" style="text-align:center;">  
17 - <label>  
18 - <input {{{ckIdentifica}}} data-col="{{{item}}}" value="{{{item}}}" type="checkbox" name="identifica" />  
19 - <span class="checkbox-material noprint">  
20 - <span class="check"></span>  
21 - </span>  
22 - </label>  
23 - </div>  
24 - </td>  
25 - <td>  
26 - <div class="checkbox condensed" style="text-align:center;">  
27 - <label>  
28 - <input {{{ckEtiquetaTip}}} data-col="{{{item}}}" type='checkbox' value="{{{item}}}" name='etiquetaTip' />  
29 - <span class="checkbox-material noprint">  
30 - <span class="check"></span>  
31 - </span>  
32 - </label>  
33 - </div>  
34 - </td>  
35 - <td>  
36 - <div class="radio radio-primary condensed" style="text-align:center;">  
37 - <label>  
38 - <input {{{ckUtfdata}}} data-col="{{{item}}}" type='radio' value="{{{item}}}" name='utfdata' />  
39 - <span class="circle"></span>  
40 - <span class="check"></span>  
41 - </label>  
42 - </div>  
43 - </td>  
44 - <td>  
45 - <div class="radio radio-primary condensed" style="text-align:center;">  
46 - <label>  
47 - <input {{{ckBuscaRapida}}} data-col="{{{item}}}" type='radio' value="{{{item}}}" name='itembuscarapida' />  
48 - <span class="circle"></span>  
49 - <span class="check"></span>  
50 - </label>  
51 - </div>  
52 - </td>  
53 - <td>  
54 - <div class='form-group condensed'>  
55 - <input class="form-control input" data-col="{{{item}}}" style="width: 150px;" type='text' name='itensdesc' value='{{{ckitensdesc}}}' />  
56 - </div>  
57 - </td>  
58 - <td>  
59 - <div class='form-group condensed'>  
60 - <input data-col="{{{item}}}" style="margin-left:10px;width: 100px;" class="form-control input" type='text' name='itenslink' value='{{{ckitem}}}' />  
61 - </div>  
62 - </td>  
63 1
64 - </tr>  
65 - {{/linhas}}  
66 - <tr>  
67 - <td></td>  
68 - <td style="text-align:center;padding: 10px;"></td>  
69 - <td style="text-align:center;padding: 10px;"></td>  
70 - <td style="text-align:center;padding: 10px;">  
71 - <div class="radio radio-primary condensed" style="text-align:center;">  
72 - <label>  
73 - <input type='radio' value="" name='utfdata' />  
74 - <span class="circle"></span>  
75 - <span class="check"></span>  
76 - </label>  
77 - </div>  
78 - </td>  
79 - <td style="text-align:center;padding: 10px;">  
80 - <div class="radio radio-primary condensed" style="text-align:center;">  
81 - <label>  
82 - <input type='radio' value="" name='itembuscarapida' />  
83 - <span class="circle"></span>  
84 - <span class="check"></span>  
85 - </label>  
86 - </div>  
87 - </td>  
88 - <td style="text-align:center;padding: 10px;"></td>  
89 - <td style="text-align:center;padding: 10px;;"></td>  
90 - <tr>  
91 - </table>  
92 -</div>  
93 \ No newline at end of file 2 \ No newline at end of file
  3 +<table class="table-striped table-condensed">
  4 + <tr>
  5 + <td>Coluna</td>
  6 + <td style="text-align: center; padding: 10px;">Identifica</td>
  7 + <td style="text-align: center; padding: 10px;">Tip (quando clicar)</td>
  8 + <td style="text-align: center; padding: 10px;">Tip (din&acirc;mico)</td>
  9 + <td style="text-align: center; padding: 10px;">Busca</td>
  10 + <td style="text-align: center; padding: 10px;">Alias</td>
  11 + <td style="text-align: center; padding: 10px;">Link</td>
  12 + <tr>{{#linhas}}
  13 + <tr>
  14 + <td>{{{item}}}</td>
  15 + <td>
  16 + <div class="checkbox condensed text-center" style="text-align: center;">
  17 + <label>
  18 + <input {{{ckIdentifica}}} data-col="{{{item}}}" value="{{{item}}}" type="checkbox" name="identifica" />
  19 + <span class="checkbox-material noprint"> <span class="check"></span>
  20 + </span>
  21 + </label>
  22 + </div>
  23 + </td>
  24 + <td>
  25 + <div class="checkbox condensed" style="text-align: center;">
  26 + <label>
  27 + <input {{{ckEtiquetaTip}}} data-col="{{{item}}}" type='checkbox' value="{{{item}}}" name='etiquetaTip' />
  28 + <span class="checkbox-material noprint"> <span class="check"></span>
  29 + </span>
  30 + </label>
  31 + </div>
  32 + </td>
  33 + <td>
  34 + <div class="radio radio-primary condensed" style="text-align: center;">
  35 + <label>
  36 + <input {{{ckUtfdata}}} data-col="{{{item}}}" type='radio' value="{{{item}}}" name='utfdata' />
  37 + <span class="circle"></span> <span class="check"></span>
  38 + </label>
  39 + </div>
  40 + </td>
  41 + <td>
  42 + <div class="radio radio-primary condensed" style="text-align: center;">
  43 + <label>
  44 + <input {{{ckBuscaRapida}}} data-col="{{{item}}}" type='radio' value="{{{item}}}" name='itembuscarapida' />
  45 + <span class="circle"></span> <span class="check"></span>
  46 + </label>
  47 + </div>
  48 + </td>
  49 + <td>
  50 + <div class='form-group condensed'>
  51 + <input class="form-control input" data-col="{{{item}}}" style="width: 150px;" type='text' name='itensdesc' value='{{{ckitensdesc}}}' />
  52 + </div>
  53 + </td>
  54 + <td>
  55 + <div class='form-group condensed'>
  56 + <input data-col="{{{item}}}" style="margin-left: 10px; width: 100px;" class="form-control input" type='text' name='itenslink' value='{{{ckitem}}}' />
  57 + </div>
  58 + </td>
  59 +
  60 + </tr>
  61 + {{/linhas}}
  62 + <tr>
  63 + <td></td>
  64 + <td style="text-align: center; padding: 10px;"></td>
  65 + <td style="text-align: center; padding: 10px;"></td>
  66 + <td style="text-align: center; padding: 10px;">
  67 + <div class="radio radio-primary condensed" style="text-align: center;">
  68 + <label>
  69 + <input type='radio' value="" name='utfdata' />
  70 + <span class="circle"></span> <span class="check"></span>
  71 + </label>
  72 + </div>
  73 + </td>
  74 + <td style="text-align: center; padding: 10px;">
  75 + <div class="radio radio-primary condensed" style="text-align: center;">
  76 + <label>
  77 + <input type='radio' value="" name='itembuscarapida' />
  78 + <span class="circle"></span> <span class="check"></span>
  79 + </label>
  80 + </div>
  81 + </td>
  82 + <td style="text-align: center; padding: 10px;"></td>
  83 + <td style="text-align: center; padding: 10px;"></td>
  84 + <tr>
  85 +</table>
ferramentas/etiqueta/template_mst.html
1 -<div class='container-fluid' >  
2 - <button onclick="i3GEOF.etiqueta.ativa()" class='btn btn-primary btn-sm btn-raised'>{{{aplica}}}</button>  
3 - <button onclick="i3GEOF.etiqueta.desativa()" class='btn btn-primary btn-sm btn-raised'>{{{desativaEtiquetas}}}</button>  
4 -</div>  
5 -<div class='container-fluid customScrollBarXY' style="height: calc(100% - 55px);">  
6 - <div id='i3GEOFetiquetaComboCabeca' class='form-group condensed' style='width:100%'>  
7 -  
8 - </div>  
9 - <!-- ver templateLista_mst.html -->  
10 - <div id='i3GEOetiquetalistai'></div>  
11 - <h5 class="alert alert-info">{{{selecionaItem}}}</h5> 1 +<div id='{{idContainer}}' class='container-fluid' style='text-align: left; display: block; overflow: auto; height: calc(100% - 85px);'>
  2 + <div class='container-fluid'>
  3 + <div class="form-group condensed">
  4 + <button onclick="i3GEOF.etiqueta.ativa(this)" class='btn btn-primary btn-sm btn-raised'><span class="glyphicon glyphicon-repeat normal-right-spinner hidden"></span> {{{aplica}}}</button>
  5 + </div>
  6 + </div>
  7 + <!-- ver templateLista_mst.html -->
  8 + <div id='i3GEOetiquetalistai' class='container-fluid ' style='margin-top: 20px;'></div>
  9 + <h5 class="alert alert-info">{{{selecionaItem}}}</h5>
12 </div> 10 </div>
13 \ No newline at end of file 11 \ No newline at end of file
@@ -765,7 +765,7 @@ i3GEO.tema = @@ -765,7 +765,7 @@ i3GEO.tema =
765 "etiqueta", 765 "etiqueta",
766 "etiqueta", 766 "etiqueta",
767 "dependencias.php", 767 "dependencias.php",
768 - "i3GEOF.etiqueta.start()"); 768 + temp);
769 }, 769 },
770 /** 770 /**
771 * Function: funcaojstip 771 * Function: funcaojstip