Commit e00db8a2bddb93993a7cd49d5cc39168ed527be7
1 parent
e2e948b6
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
54 additions
and
35 deletions
Show diff stats
ferramentas/filtro/index.js
| @@ -50,6 +50,14 @@ i3GEOF.filtro = { | @@ -50,6 +50,14 @@ i3GEOF.filtro = { | ||
| 50 | */ | 50 | */ |
| 51 | aguarde: "", | 51 | aguarde: "", |
| 52 | /* | 52 | /* |
| 53 | + * Variavel: tema | ||
| 54 | + * | ||
| 55 | + * Tema que será utilizado | ||
| 56 | + * | ||
| 57 | + * Type: {string} | ||
| 58 | + */ | ||
| 59 | + tema : i3GEO.temaAtivo, | ||
| 60 | + /* | ||
| 53 | Variavel: comboTemas | 61 | Variavel: comboTemas |
| 54 | 62 | ||
| 55 | Armazena o combo com os itens do tema | 63 | Armazena o combo com os itens do tema |
| @@ -77,7 +85,7 @@ i3GEOF.filtro = { | @@ -77,7 +85,7 @@ i3GEOF.filtro = { | ||
| 77 | */ | 85 | */ |
| 78 | inicia: function(iddiv){ | 86 | inicia: function(iddiv){ |
| 79 | i3GEO.janela.comboCabecalhoTemas("i3GEOFfiltroComboCabeca","i3GEOFfiltroComboCabecaSel","filtro","ligadosComTabela"); | 87 | i3GEO.janela.comboCabecalhoTemas("i3GEOFfiltroComboCabeca","i3GEOFfiltroComboCabecaSel","filtro","ligadosComTabela"); |
| 80 | - if(i3GEO.temaAtivo === ""){ | 88 | + if(i3GEOF.filtro.tema === ""){ |
| 81 | $i(iddiv).innerHTML = "";//'<p style="position: relative; top: 0px; font-size: 15px; text-align: left;">'+$trad("x33")+'</p>'; | 89 | $i(iddiv).innerHTML = "";//'<p style="position: relative; top: 0px; font-size: 15px; text-align: left;">'+$trad("x33")+'</p>'; |
| 82 | return; | 90 | return; |
| 83 | } | 91 | } |
| @@ -113,7 +121,7 @@ i3GEOF.filtro = { | @@ -113,7 +121,7 @@ i3GEOF.filtro = { | ||
| 113 | // | 121 | // |
| 114 | i3GEO.util.comboItens( | 122 | i3GEO.util.comboItens( |
| 115 | "none", | 123 | "none", |
| 116 | - i3GEO.temaAtivo, | 124 | + i3GEOF.filtro.tema, |
| 117 | function(retorno){ | 125 | function(retorno){ |
| 118 | i3GEOF.filtro.comboTemas = retorno.dados; | 126 | i3GEOF.filtro.comboTemas = retorno.dados; |
| 119 | i3GEOF.filtro.adicionaLinhaFiltro(); | 127 | i3GEOF.filtro.adicionaLinhaFiltro(); |
| @@ -181,13 +189,13 @@ i3GEOF.filtro = { | @@ -181,13 +189,13 @@ i3GEOF.filtro = { | ||
| 181 | var add,xis,interrogacao,operador,conector,valor,ntb,ntr,ntad,ntd,ntd1,ntd2,ntd3,ntd4,ntd5,tabela; | 189 | var add,xis,interrogacao,operador,conector,valor,ntb,ntr,ntad,ntd,ntd1,ntd2,ntd3,ntd4,ntd5,tabela; |
| 182 | try{ | 190 | try{ |
| 183 | add = document.createElement("img"); | 191 | add = document.createElement("img"); |
| 184 | - add.src = i3GEO.configura.locaplic+'/imagens/plus.gif'; | 192 | + add.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/list-add.png'; |
| 185 | add.style.cursor="pointer"; | 193 | add.style.cursor="pointer"; |
| 186 | add.onclick = function() | 194 | add.onclick = function() |
| 187 | {i3GEOF.filtro.adicionaLinhaFiltro();}; | 195 | {i3GEOF.filtro.adicionaLinhaFiltro();}; |
| 188 | 196 | ||
| 189 | xis = document.createElement("img"); | 197 | xis = document.createElement("img"); |
| 190 | - xis.src = i3GEO.configura.locaplic+'/imagens/x.gif'; | 198 | + xis.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/edit-delete.png'; |
| 191 | xis.style.cursor="pointer"; | 199 | xis.style.cursor="pointer"; |
| 192 | xis.onclick = function(){ | 200 | xis.onclick = function(){ |
| 193 | var p = this.parentNode.parentNode.parentNode, | 201 | var p = this.parentNode.parentNode.parentNode, |
| @@ -197,7 +205,7 @@ i3GEOF.filtro = { | @@ -197,7 +205,7 @@ i3GEOF.filtro = { | ||
| 197 | }; | 205 | }; |
| 198 | 206 | ||
| 199 | interrogacao = document.createElement("img"); | 207 | interrogacao = document.createElement("img"); |
| 200 | - interrogacao.src = i3GEO.configura.locaplic+'/imagens/interrogacao.gif'; | 208 | + interrogacao.src = i3GEO.configura.locaplic+'/imagens/oxygen/16x16/format-line-spacing-normal.png'; |
| 201 | interrogacao.title= $trad('mostraValor',i3GEOF.filtro.dicionario); | 209 | interrogacao.title= $trad('mostraValor',i3GEOF.filtro.dicionario); |
| 202 | interrogacao.style.cursor="pointer"; | 210 | interrogacao.style.cursor="pointer"; |
| 203 | interrogacao.style.marginLeft="5px"; | 211 | interrogacao.style.marginLeft="5px"; |
| @@ -208,7 +216,7 @@ i3GEOF.filtro = { | @@ -208,7 +216,7 @@ i3GEOF.filtro = { | ||
| 208 | itemTema = (this.parentNode.parentNode.getElementsByTagName("select"))[0].value; | 216 | itemTema = (this.parentNode.parentNode.getElementsByTagName("select"))[0].value; |
| 209 | i3GEO.util.comboValoresItem( | 217 | i3GEO.util.comboValoresItem( |
| 210 | "i3GEOfiltrocbitens", | 218 | "i3GEOfiltrocbitens", |
| 211 | - i3GEO.temaAtivo, | 219 | + i3GEOF.filtro.tema, |
| 212 | itemTema, | 220 | itemTema, |
| 213 | function(retorno){ | 221 | function(retorno){ |
| 214 | $i("i3GEOfiltrovalores").innerHTML = "<br><p class=paragrafo >" + | 222 | $i("i3GEOfiltrovalores").innerHTML = "<br><p class=paragrafo >" + |
| @@ -291,7 +299,7 @@ i3GEOF.filtro = { | @@ -291,7 +299,7 @@ i3GEOF.filtro = { | ||
| 291 | <PEGAFILTRO> | 299 | <PEGAFILTRO> |
| 292 | */ | 300 | */ |
| 293 | pegaFiltro: function(){ | 301 | pegaFiltro: function(){ |
| 294 | - var p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegafiltro&tema="+i3GEO.temaAtivo, | 302 | + var p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegafiltro&tema="+i3GEOF.filtro.tema, |
| 295 | cp = new cpaint(), | 303 | cp = new cpaint(), |
| 296 | temp = function(retorno){ | 304 | temp = function(retorno){ |
| 297 | if(retorno.data !== undefined) | 305 | if(retorno.data !== undefined) |
| @@ -314,13 +322,13 @@ i3GEOF.filtro = { | @@ -314,13 +322,13 @@ i3GEOF.filtro = { | ||
| 314 | if(i3GEOF.filtro.aguarde.visibility === "visible") | 322 | if(i3GEOF.filtro.aguarde.visibility === "visible") |
| 315 | {return;} | 323 | {return;} |
| 316 | i3GEOF.filtro.aguarde.visibility = "visible"; | 324 | i3GEOF.filtro.aguarde.visibility = "visible"; |
| 317 | - var p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro&tema="+i3GEO.temaAtivo+"&filtro=", | 325 | + var p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro&tema="+i3GEOF.filtro.tema+"&filtro=", |
| 318 | cp = new cpaint(), | 326 | cp = new cpaint(), |
| 319 | temp = function(retorno){ | 327 | temp = function(retorno){ |
| 320 | i3GEOF.filtro.aguarde.visibility = "hidden"; | 328 | i3GEOF.filtro.aguarde.visibility = "hidden"; |
| 321 | if(i3GEO.Interface.ATUAL === "padrao") | 329 | if(i3GEO.Interface.ATUAL === "padrao") |
| 322 | {i3GEO.atualiza(retorno);} | 330 | {i3GEO.atualiza(retorno);} |
| 323 | - i3GEO.Interface.atualizaTema(retorno,i3GEO.temaAtivo); | 331 | + i3GEO.Interface.atualizaTema(retorno,i3GEOF.filtro.tema); |
| 324 | }; | 332 | }; |
| 325 | cp.set_response_type("JSON"); | 333 | cp.set_response_type("JSON"); |
| 326 | cp.call(p,"insereFiltro",temp); | 334 | cp.call(p,"insereFiltro",temp); |
| @@ -348,7 +356,7 @@ i3GEOF.filtro = { | @@ -348,7 +356,7 @@ i3GEOF.filtro = { | ||
| 348 | try{ | 356 | try{ |
| 349 | i3GEOF.filtro.aguarde.visibility = "visible"; | 357 | i3GEOF.filtro.aguarde.visibility = "visible"; |
| 350 | var filtro = "", | 358 | var filtro = "", |
| 351 | - re,g,ipt,i,nos,s,itemsel,valor,operador,conector,p,cp,temp; | 359 | + re,p,cp,temp; |
| 352 | if( ($i("i3GEOfiltrofiltro").value !== "") &&($i("i3GEOfiltroguia2obj").style.display === "block")){ | 360 | if( ($i("i3GEOfiltrofiltro").value !== "") &&($i("i3GEOfiltroguia2obj").style.display === "block")){ |
| 353 | filtro = $i("i3GEOfiltrofiltro").value; | 361 | filtro = $i("i3GEOfiltrofiltro").value; |
| 354 | re = new RegExp("'","g"); | 362 | re = new RegExp("'","g"); |
| @@ -357,29 +365,9 @@ i3GEOF.filtro = { | @@ -357,29 +365,9 @@ i3GEOF.filtro = { | ||
| 357 | filtro = filtro.replace(re,""); | 365 | filtro = filtro.replace(re,""); |
| 358 | } | 366 | } |
| 359 | else{ | 367 | else{ |
| 360 | - g = $i("i3GEOfiltroparametros"); | ||
| 361 | - ipt = g.getElementsByTagName("tr"); | ||
| 362 | - if (ipt.length > 1){ | ||
| 363 | - for (i=2;i<ipt.length; i++){ | ||
| 364 | - nos = ipt[i].childNodes; | ||
| 365 | - s = nos[2].getElementsByTagName("select"); | ||
| 366 | - itemsel = s[0].value; | ||
| 367 | - s = nos[3].getElementsByTagName("select"); | ||
| 368 | - operador = s[0].value; | ||
| 369 | - s = nos[4].getElementsByTagName("input"); | ||
| 370 | - valor = s[0].value; | ||
| 371 | - s = nos[6].getElementsByTagName("select"); | ||
| 372 | - conector = s[0].value; | ||
| 373 | - if (valor*1) | ||
| 374 | - {filtro = filtro + "(["+itemsel+"] "+operador+" "+valor+")";} | ||
| 375 | - else | ||
| 376 | - {filtro = filtro + "(|["+itemsel+"]| "+operador+" |"+valor+"|)";} | ||
| 377 | - if ((i + 1) != ipt.length) //tem conector | ||
| 378 | - {filtro = filtro + conector;} | ||
| 379 | - else | ||
| 380 | - {filtro = "("+filtro+")";} | ||
| 381 | - } | ||
| 382 | - } | 368 | + filtro = i3GEOF.filtro.formataMapserver(); |
| 369 | + re = new RegExp("'","g"); | ||
| 370 | + filtro = filtro.replace(re,"|"); | ||
| 383 | } | 371 | } |
| 384 | p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?base64=sim&g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro"; | 372 | p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?base64=sim&g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro"; |
| 385 | cp = new cpaint(); | 373 | cp = new cpaint(); |
| @@ -395,15 +383,46 @@ i3GEOF.filtro = { | @@ -395,15 +383,46 @@ i3GEOF.filtro = { | ||
| 395 | temp = function(retorno){ | 383 | temp = function(retorno){ |
| 396 | if(i3GEO.Interface.ATUAL === "padrao") | 384 | if(i3GEO.Interface.ATUAL === "padrao") |
| 397 | {i3GEO.atualiza(retorno);} | 385 | {i3GEO.atualiza(retorno);} |
| 398 | - i3GEO.Interface.atualizaTema(retorno,i3GEO.temaAtivo); | 386 | + i3GEO.Interface.atualizaTema(retorno,i3GEOF.filtro.tema); |
| 399 | i3GEOF.filtro.aguarde.visibility = "hidden"; | 387 | i3GEOF.filtro.aguarde.visibility = "hidden"; |
| 400 | }; | 388 | }; |
| 401 | } | 389 | } |
| 402 | - cp.call(p,"insereFiltro",temp,"tema="+i3GEO.temaAtivo,"filtro="+i3GEO.util.base64encode(filtro),"testa="+testa); | 390 | + cp.call(p,"insereFiltro",temp,"tema="+i3GEOF.filtro.tema,"filtro="+i3GEO.util.base64encode(filtro),"testa="+testa); |
| 403 | } | 391 | } |
| 404 | catch(e){ | 392 | catch(e){ |
| 405 | i3GEO.janela.tempoMsg("Erro: "+e); | 393 | i3GEO.janela.tempoMsg("Erro: "+e); |
| 406 | i3GEOF.filtro.aguarde.visibility = "hidden"; | 394 | i3GEOF.filtro.aguarde.visibility = "hidden"; |
| 407 | } | 395 | } |
| 396 | + }, | ||
| 397 | + formataMapserver : function(){ | ||
| 398 | + var filtro = "",g,ipt,i,nos,s,itemsel,operador,valor; | ||
| 399 | + g = $i("i3GEOfiltroparametros"); | ||
| 400 | + ipt = g.getElementsByTagName("tr"); | ||
| 401 | + if (ipt.length > 1){ | ||
| 402 | + for (i=2;i<ipt.length; i++){ | ||
| 403 | + nos = ipt[i].childNodes; | ||
| 404 | + s = nos[2].getElementsByTagName("select"); | ||
| 405 | + itemsel = s[0].value; | ||
| 406 | + s = nos[3].getElementsByTagName("select"); | ||
| 407 | + operador = s[0].value; | ||
| 408 | + s = nos[4].getElementsByTagName("input"); | ||
| 409 | + valor = s[0].value; | ||
| 410 | + s = nos[6].getElementsByTagName("select"); | ||
| 411 | + conector = s[0].value; | ||
| 412 | + if (valor*1){ | ||
| 413 | + filtro = filtro + "(["+itemsel+"] "+operador+" "+valor+")"; | ||
| 414 | + } | ||
| 415 | + else{ | ||
| 416 | + filtro = filtro + "('["+itemsel+"]' "+operador+" '"+valor+"')"; | ||
| 417 | + } | ||
| 418 | + if ((i + 1) != ipt.length){ | ||
| 419 | + filtro = filtro + conector; | ||
| 420 | + } | ||
| 421 | + else{ | ||
| 422 | + filtro = "("+filtro+")"; | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + } | ||
| 426 | + return filtro; | ||
| 408 | } | 427 | } |
| 409 | }; | 428 | }; |
| 410 | \ No newline at end of file | 429 | \ No newline at end of file |