Commit e968a521f8d7ae54507a727c12ccd56244f9ff9a
1 parent
8904ff82
Exists in
master
Correção na ferramenta de definição dos parâmetros da ferramenta etiqueta
Showing
3 changed files
with
324 additions
and
313 deletions
Show diff stats
ferramentas/etiqueta/index.js
| @@ -39,27 +39,27 @@ if(typeof(i3GEOF) === 'undefined'){ | @@ -39,27 +39,27 @@ if(typeof(i3GEOF) === 'undefined'){ | ||
| 39 | Classe: i3GEOF.etiqueta | 39 | Classe: i3GEOF.etiqueta |
| 40 | */ | 40 | */ |
| 41 | i3GEOF.etiqueta = { | 41 | i3GEOF.etiqueta = { |
| 42 | - tema : i3GEO.temaAtivo, | ||
| 43 | - /* | 42 | + tema : i3GEO.temaAtivo, |
| 43 | + /* | ||
| 44 | Variavel: aguarde | 44 | Variavel: aguarde |
| 45 | 45 | ||
| 46 | Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. | 46 | Estilo do objeto DOM com a imagem de aguarde existente no cabeç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; | ||
| 61 | - }, | ||
| 62 | - /* | 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; | ||
| 61 | + }, | ||
| 62 | + /* | ||
| 63 | Function: inicia | 63 | Function: inicia |
| 64 | 64 | ||
| 65 | Inicia a ferramenta. É chamado por criaJanelaFlutuante | 65 | Inicia a ferramenta. É chamado por criaJanelaFlutuante |
| @@ -67,50 +67,50 @@ i3GEOF.etiqueta = { | @@ -67,50 +67,50 @@ i3GEOF.etiqueta = { | ||
| 67 | Parametro: | 67 | Parametro: |
| 68 | 68 | ||
| 69 | iddiv {String} - id do div que receberá o conteudo HTML da ferramenta | 69 | iddiv {String} - id do div que receberá 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); | ||
| 80 | - }).fail(function() { | ||
| 81 | - i3GEO.janela.closeMsg($trad("erroTpl")); | ||
| 82 | - return; | ||
| 83 | - }); | ||
| 84 | - return; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - if(i3GEOF.etiqueta.tema === ""){ | ||
| 88 | - $i(iddiv).innerHTML = ""; | ||
| 89 | - return; | ||
| 90 | - } | ||
| 91 | - try{ | ||
| 92 | - $i(iddiv).innerHTML = i3GEOF.etiqueta.html(); | ||
| 93 | - | ||
| 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 | - }, | ||
| 113 | - /* | 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); | ||
| 80 | + }).fail(function() { | ||
| 81 | + i3GEO.janela.closeMsg($trad("erroTpl")); | ||
| 82 | + return; | ||
| 83 | + }); | ||
| 84 | + return; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + if(i3GEOF.etiqueta.tema === ""){ | ||
| 88 | + $i(iddiv).innerHTML = ""; | ||
| 89 | + return; | ||
| 90 | + } | ||
| 91 | + try{ | ||
| 92 | + $i(iddiv).innerHTML = i3GEOF.etiqueta.html(); | ||
| 93 | + | ||
| 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 | + }, | ||
| 113 | + /* | ||
| 114 | Function: html | 114 | Function: html |
| 115 | 115 | ||
| 116 | Gera o código html para apresentação das opções da ferramenta | 116 | Gera o código html para apresentação das opções da ferramenta |
| @@ -118,73 +118,73 @@ i3GEOF.etiqueta = { | @@ -118,73 +118,73 @@ i3GEOF.etiqueta = { | ||
| 118 | Retorno: | 118 | Retorno: |
| 119 | 119 | ||
| 120 | String com o código html | 120 | String com o código html |
| 121 | - */ | ||
| 122 | - html:function() { | ||
| 123 | - var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash()); | ||
| 124 | - return ins; | ||
| 125 | - }, | ||
| 126 | - /* | 121 | + */ |
| 122 | + html:function() { | ||
| 123 | + var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash()); | ||
| 124 | + return ins; | ||
| 125 | + }, | ||
| 126 | + /* | ||
| 127 | Function: iniciaJanelaFlutuante | 127 | Function: iniciaJanelaFlutuante |
| 128 | 128 | ||
| 129 | Cria a janela flutuante para controle da ferramenta. | 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"); | ||
| 142 | - }; | ||
| 143 | - //cria a janela flutuante | ||
| 144 | - titulo = "<span class='i3GeoTituloJanelaBsNolink' >"+$trad("d7at")+"</span></div>"; | ||
| 145 | - janela = i3GEO.janela.cria( | ||
| 146 | - "600px", | ||
| 147 | - "380px", | ||
| 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 | - /* | 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"); | ||
| 142 | + }; | ||
| 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 | 171 | Function: ativaFoco |
| 172 | 172 | ||
| 173 | Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado | 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); | ||
| 186 | - }, | ||
| 187 | - /* | 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); | ||
| 186 | + }, | ||
| 187 | + /* | ||
| 188 | Function: montaListaItens | 188 | Function: montaListaItens |
| 189 | 189 | ||
| 190 | Monta a lista de itens que poderão ser escolhidos para compor o mapa. | 190 | Monta a lista de itens que poderão ser escolhidos para compor o mapa. |
| @@ -192,134 +192,147 @@ i3GEOF.etiqueta = { | @@ -192,134 +192,147 @@ i3GEOF.etiqueta = { | ||
| 192 | A lista é inserida no elemento html com id "i3GEOetiquetalistai" | 192 | A lista é inserida no elemento html com id "i3GEOetiquetalistai" |
| 193 | 193 | ||
| 194 | @TODO verificar quando um item ja esta na lista e marca-lo no checkbox | 194 | @TODO verificar quando um item ja esta na lista e marca-lo no checkbox |
| 195 | - */ | ||
| 196 | - 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]; | ||
| 236 | - } | ||
| 237 | - else{ | ||
| 238 | - temp.ckitensdesc = item; | ||
| 239 | - } | ||
| 240 | - //links | ||
| 241 | - if(lista.itenslink[item]){ | ||
| 242 | - temp.ckitem = lista.itenslink[item]; | ||
| 243 | - } | ||
| 244 | - else{ | ||
| 245 | - temp.ckitem = ""; | ||
| 246 | - } | ||
| 247 | - mustache.push(temp); | ||
| 248 | - } | ||
| 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]); | ||
| 267 | - } | ||
| 268 | - } | ||
| 269 | - } | ||
| 270 | - catch(e) | ||
| 271 | - {$i("i3GEOetiquetalistai").innerHTML = "<p style=color:red >Erro<br>"+e;} | ||
| 272 | - }; | ||
| 273 | - i3GEOF.etiqueta.pegaDadosEtiquetas(funcao); | ||
| 274 | - }, | ||
| 275 | - ativaLinha: function(obj){ | ||
| 276 | - var linha = obj.parentNode.parentNode, | ||
| 277 | - objs = linha.getElementsByTagName("input"), | ||
| 278 | - n = objs.length, | ||
| 279 | - i; | ||
| 280 | - for(i=0;i<n;i++){ | ||
| 281 | - if(objs[i].name != "identifica"){ | ||
| 282 | - objs[i].disabled = !obj.checked; | ||
| 283 | - } | ||
| 284 | - } | ||
| 285 | - }, | ||
| 286 | - /* | 195 | + */ |
| 196 | + 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]; | ||
| 236 | + } | ||
| 237 | + else{ | ||
| 238 | + temp.ckitensdesc = item; | ||
| 239 | + } | ||
| 240 | + //links | ||
| 241 | + if(lista.itenslink[item]){ | ||
| 242 | + temp.ckitem = lista.itenslink[item]; | ||
| 243 | + } | ||
| 244 | + else{ | ||
| 245 | + temp.ckitem = ""; | ||
| 246 | + } | ||
| 247 | + mustache.push(temp); | ||
| 248 | + } | ||
| 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]); | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + catch(e) | ||
| 271 | + {$i("i3GEOetiquetalistai").innerHTML = "<p style=color:red >Erro<br>"+e;} | ||
| 272 | + }; | ||
| 273 | + i3GEOF.etiqueta.pegaDadosEtiquetas(funcao); | ||
| 274 | + }, | ||
| 275 | + ativaLinha: function(obj){ | ||
| 276 | + var linha = obj.parentNode.parentNode, | ||
| 277 | + objs = linha.getElementsByTagName("input"), | ||
| 278 | + n = objs.length, | ||
| 279 | + i; | ||
| 280 | + for(i=0;i<n;i++){ | ||
| 281 | + if(objs[i].name != "identifica"){ | ||
| 282 | + objs[i].disabled = !obj.checked; | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + }, | ||
| 286 | + /* | ||
| 287 | Function: pegaItensMarcados | 287 | Function: pegaItensMarcados |
| 288 | 288 | ||
| 289 | Recupera os itens que foram marcados e monta uma lista para enviar como parâmetro para a função de geração dos gráficos | 289 | Recupera os itens que foram marcados e monta uma lista para enviar como parâmetro para a função de geração dos gráficos |
| 290 | - */ | ||
| 291 | - pegaItensMarcados: function(){ | ||
| 292 | - var tips = [], | ||
| 293 | - itens = [], | ||
| 294 | - itensdesc = [], | ||
| 295 | - itenslink = [], | ||
| 296 | - itembuscarapida = "", | ||
| 297 | - utfdata = "", | ||
| 298 | - inputs = $i("i3GEOetiquetalistai").getElementsByTagName("input"), | ||
| 299 | - i, | ||
| 300 | - it, | ||
| 301 | - n = inputs.length; | ||
| 302 | - for (i=0;i<n; i=i+5){ | ||
| 303 | - if (inputs[i].checked === true){ | ||
| 304 | - itens.push(inputs[i].value); | ||
| 305 | - if (inputs[i+1].checked === true){ | ||
| 306 | - tips.push(inputs[i+1].value); | ||
| 307 | - } | ||
| 308 | - | ||
| 309 | - if (inputs[i+2].checked){ | ||
| 310 | - utfdata = inputs[i+2].value; | ||
| 311 | - } | ||
| 312 | - if (inputs[i+3].checked){ | ||
| 313 | - itembuscarapida = inputs[i+3].value; | ||
| 314 | - } | ||
| 315 | - itensdesc.push(inputs[i+4].value); | ||
| 316 | - itenslink.push(inputs[i+5].value); | ||
| 317 | - } | ||
| 318 | - | ||
| 319 | - } | ||
| 320 | - return([tips,itens,itensdesc,itenslink,itembuscarapida,utfdata]); | ||
| 321 | - }, | ||
| 322 | - /* | 290 | + */ |
| 291 | + pegaItensMarcados: function(){ | ||
| 292 | + var tips = [], | ||
| 293 | + itens = [], | ||
| 294 | + itensdesc = [], | ||
| 295 | + itenslink = [], | ||
| 296 | + itembuscarapida = "", | ||
| 297 | + utfdata = "", | ||
| 298 | + inputs = $i("i3GEOetiquetalistai").getElementsByTagName("input"), | ||
| 299 | + i, | ||
| 300 | + el, | ||
| 301 | + it, | ||
| 302 | + n = inputs.length; | ||
| 303 | + for (i=0;i<n; i++){ | ||
| 304 | + el = inputs[i]; | ||
| 305 | + if (el.checked === true && el.name == "identifica"){ | ||
| 306 | + itens.push(el.value); | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + for (i=0;i<n; i++){ | ||
| 310 | + el = inputs[i]; | ||
| 311 | + if($.inArray( $(el).attr('data-col'), itens ) < 0 ){ | ||
| 312 | + continue; | ||
| 313 | + } | ||
| 314 | + if (el.checked === true && el.name == "etiquetaTip"){ | ||
| 315 | + tips.push(el.value); | ||
| 316 | + } | ||
| 317 | + if (el.name == "itensdesc"){ | ||
| 318 | + itensdesc.push(el.value); | ||
| 319 | + } | ||
| 320 | + if (el.name == "itenslink"){ | ||
| 321 | + itenslink.push(el.value); | ||
| 322 | + } | ||
| 323 | + if (el.checked === true && el.name == "itembuscarapida"){ | ||
| 324 | + itembuscarapida = el.value; | ||
| 325 | + } | ||
| 326 | + if (el.checked === true && el.name == "utfdata"){ | ||
| 327 | + utfdata = el.value; | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + | ||
| 331 | + } | ||
| 332 | + | ||
| 333 | + return([tips,itens,itensdesc,itenslink,itembuscarapida,utfdata]); | ||
| 334 | + }, | ||
| 335 | + /* | ||
| 323 | Function: ativa | 336 | Function: ativa |
| 324 | 337 | ||
| 325 | Ativa a etiqueta com os itens marcados | 338 | Ativa a etiqueta com os itens marcados |
| @@ -327,40 +340,40 @@ i3GEOF.etiqueta = { | @@ -327,40 +340,40 @@ i3GEOF.etiqueta = { | ||
| 327 | Veja: | 340 | Veja: |
| 328 | 341 | ||
| 329 | <ATIVAETIQUETAS> | 342 | <ATIVAETIQUETAS> |
| 330 | - */ | ||
| 331 | - ativa: function(){ | ||
| 332 | - try{ | ||
| 333 | - if(i3GEOF.etiqueta.aguarde.visibility === "visible") | ||
| 334 | - {return;} | ||
| 335 | - var lista = i3GEOF.etiqueta.pegaItensMarcados(), | ||
| 336 | - cp = new cpaint(), | ||
| 337 | - temp, | ||
| 338 | - p; | ||
| 339 | - | ||
| 340 | - i3GEOF.etiqueta.aguarde.visibility = "visible"; | ||
| 341 | - temp = function(retorno){ | ||
| 342 | - i3GEOF.etiqueta.aguarde.visibility = "hidden"; | ||
| 343 | - i3GEO.atualiza(retorno); | ||
| 344 | - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo); | ||
| 345 | - }; | ||
| 346 | - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid=" | ||
| 347 | - + i3GEO.configura.sid | ||
| 348 | - + "&funcao=ativaEtiquetas&tema=" | ||
| 349 | - + i3GEOF.etiqueta.tema | ||
| 350 | - + "&tips="+lista[0].toString(",") | ||
| 351 | - + "&itens="+lista[1].toString(",") | ||
| 352 | - //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(",")) | ||
| 353 | - //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(",")) | ||
| 354 | - + "&itensdesc="+lista[2].toString(",") | ||
| 355 | - + "&itenslink="+lista[3].toString(",") | ||
| 356 | - + "&itembuscarapida="+lista[4] | ||
| 357 | - + "&utfdata="+lista[5]; | ||
| 358 | - cp.set_response_type("JSON"); | ||
| 359 | - cp.set_transfer_mode('POST'); | ||
| 360 | - cp.call(p,"etiqueta",temp); | ||
| 361 | - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} | ||
| 362 | - }, | ||
| 363 | - /* | 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";} | ||
| 375 | + }, | ||
| 376 | + /* | ||
| 364 | Function: desativa | 377 | Function: desativa |
| 365 | 378 | ||
| 366 | Desativa as etiqueta do tema ativo | 379 | Desativa as etiqueta do tema ativo |
| @@ -368,22 +381,22 @@ i3GEOF.etiqueta = { | @@ -368,22 +381,22 @@ i3GEOF.etiqueta = { | ||
| 368 | Veja: | 381 | Veja: |
| 369 | 382 | ||
| 370 | <REMOVEETIQUETAS> | 383 | <REMOVEETIQUETAS> |
| 371 | - */ | ||
| 372 | - desativa: function(){ | ||
| 373 | - try{ | ||
| 374 | - if(i3GEOF.etiqueta.aguarde.visibility === "visible") | ||
| 375 | - {return;} | ||
| 376 | - var cp = new cpaint(), | ||
| 377 | - temp, | ||
| 378 | - p; | ||
| 379 | - i3GEOF.etiqueta.aguarde.visibility = "visible"; | ||
| 380 | - temp = function(retorno){ | ||
| 381 | - i3GEOF.etiqueta.aguarde.visibility = "hidden"; | ||
| 382 | - i3GEO.atualiza(retorno); | ||
| 383 | - }; | ||
| 384 | - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema; | ||
| 385 | - cp.set_response_type("JSON"); | ||
| 386 | - cp.call(p,"etiqueta",temp); | ||
| 387 | - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} | ||
| 388 | - } | 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";} | ||
| 401 | + } | ||
| 389 | }; | 402 | }; |
| 390 | \ No newline at end of file | 403 | \ No newline at end of file |
ferramentas/etiqueta/templateLista_mst.html
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | <td> | 15 | <td> |
| 16 | <div class="checkbox condensed text-center" style="text-align:center;"> | 16 | <div class="checkbox condensed text-center" style="text-align:center;"> |
| 17 | <label> | 17 | <label> |
| 18 | - <input {{{ckIdentifica}}} value="{{{item}}}" type="checkbox" name="identifica" /> | 18 | + <input {{{ckIdentifica}}} data-col="{{{item}}}" value="{{{item}}}" type="checkbox" name="identifica" /> |
| 19 | <span class="checkbox-material noprint"> | 19 | <span class="checkbox-material noprint"> |
| 20 | <span class="check"></span> | 20 | <span class="check"></span> |
| 21 | </span> | 21 | </span> |
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | <td> | 25 | <td> |
| 26 | <div class="checkbox condensed" style="text-align:center;"> | 26 | <div class="checkbox condensed" style="text-align:center;"> |
| 27 | <label> | 27 | <label> |
| 28 | - <input {{{ckEtiquetaTip}}} type='checkbox' value="{{{item}}}" name='etiquetaTip' /> | 28 | + <input {{{ckEtiquetaTip}}} data-col="{{{item}}}" type='checkbox' value="{{{item}}}" name='etiquetaTip' /> |
| 29 | <span class="checkbox-material noprint"> | 29 | <span class="checkbox-material noprint"> |
| 30 | <span class="check"></span> | 30 | <span class="check"></span> |
| 31 | </span> | 31 | </span> |
| @@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
| 35 | <td> | 35 | <td> |
| 36 | <div class="radio radio-primary condensed" style="text-align:center;"> | 36 | <div class="radio radio-primary condensed" style="text-align:center;"> |
| 37 | <label> | 37 | <label> |
| 38 | - <input {{{ckUtfdata}}} type='radio' value="{{{item}}}" name='utfdata' /> | 38 | + <input {{{ckUtfdata}}} data-col="{{{item}}}" type='radio' value="{{{item}}}" name='utfdata' /> |
| 39 | <span class="circle"></span> | 39 | <span class="circle"></span> |
| 40 | <span class="check"></span> | 40 | <span class="check"></span> |
| 41 | </label> | 41 | </label> |
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | <td> | 44 | <td> |
| 45 | <div class="radio radio-primary condensed" style="text-align:center;"> | 45 | <div class="radio radio-primary condensed" style="text-align:center;"> |
| 46 | <label> | 46 | <label> |
| 47 | - <input {{{ckBuscaRapida}}} type='radio' value="{{{item}}}" name='itembuscarapida' /> | 47 | + <input {{{ckBuscaRapida}}} data-col="{{{item}}}" type='radio' value="{{{item}}}" name='itembuscarapida' /> |
| 48 | <span class="circle"></span> | 48 | <span class="circle"></span> |
| 49 | <span class="check"></span> | 49 | <span class="check"></span> |
| 50 | </label> | 50 | </label> |
| @@ -52,12 +52,12 @@ | @@ -52,12 +52,12 @@ | ||
| 52 | </td> | 52 | </td> |
| 53 | <td> | 53 | <td> |
| 54 | <div class='form-group condensed'> | 54 | <div class='form-group condensed'> |
| 55 | - <input class="form-control input" style="width: 150px;" type='text' name='itensdesc' value='{{{ckitensdesc}}}' /> | 55 | + <input class="form-control input" data-col="{{{item}}}" style="width: 150px;" type='text' name='itensdesc' value='{{{ckitensdesc}}}' /> |
| 56 | </div> | 56 | </div> |
| 57 | </td> | 57 | </td> |
| 58 | <td> | 58 | <td> |
| 59 | <div class='form-group condensed'> | 59 | <div class='form-group condensed'> |
| 60 | - <input style="margin-left:10px;width: 100px;" class="form-control input" type='text' name='itenslink' value='{{{ckitem}}}' /> | 60 | + <input data-col="{{{item}}}" style="margin-left:10px;width: 100px;" class="form-control input" type='text' name='itenslink' value='{{{ckitem}}}' /> |
| 61 | </div> | 61 | </div> |
| 62 | </td> | 62 | </td> |
| 63 | 63 |
ferramentas/etiqueta/template_mst.html
| 1 | -<div class='container-fluid customScrollBarXY' > | 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% - 50px);"> | ||
| 2 | <div id='i3GEOFetiquetaComboCabeca' class='form-group condensed' style='width:100%'> | 6 | <div id='i3GEOFetiquetaComboCabeca' class='form-group condensed' style='width:100%'> |
| 3 | 7 | ||
| 4 | </div> | 8 | </div> |
| 5 | - | ||
| 6 | <!-- ver templateLista_mst.html --> | 9 | <!-- ver templateLista_mst.html --> |
| 7 | <div id='i3GEOetiquetalistai'></div> | 10 | <div id='i3GEOetiquetalistai'></div> |
| 8 | - | ||
| 9 | - <button onclick="i3GEOF.etiqueta.ativa()" class='btn btn-primary btn-sm btn-raised'>{{{aplica}}}</button> | ||
| 10 | - <button onclick="i3GEOF.etiqueta.desativa()" class='btn btn-primary btn-sm btn-raised'>{{{desativaEtiquetas}}}</button> | ||
| 11 | - | ||
| 12 | <h5 class="alert alert-info">{{{selecionaItem}}}</h5> | 11 | <h5 class="alert alert-info">{{{selecionaItem}}}</h5> |
| 13 | - | ||
| 14 | </div> | 12 | </div> |
| 15 | \ No newline at end of file | 13 | \ No newline at end of file |