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 | 50 | */ |
| 51 | 51 | aguarde: "", |
| 52 | 52 | /* |
| 53 | + * Variavel: tema | |
| 54 | + * | |
| 55 | + * Tema que será utilizado | |
| 56 | + * | |
| 57 | + * Type: {string} | |
| 58 | + */ | |
| 59 | + tema : i3GEO.temaAtivo, | |
| 60 | + /* | |
| 53 | 61 | Variavel: comboTemas |
| 54 | 62 | |
| 55 | 63 | Armazena o combo com os itens do tema |
| ... | ... | @@ -77,7 +85,7 @@ i3GEOF.filtro = { |
| 77 | 85 | */ |
| 78 | 86 | inicia: function(iddiv){ |
| 79 | 87 | i3GEO.janela.comboCabecalhoTemas("i3GEOFfiltroComboCabeca","i3GEOFfiltroComboCabecaSel","filtro","ligadosComTabela"); |
| 80 | - if(i3GEO.temaAtivo === ""){ | |
| 88 | + if(i3GEOF.filtro.tema === ""){ | |
| 81 | 89 | $i(iddiv).innerHTML = "";//'<p style="position: relative; top: 0px; font-size: 15px; text-align: left;">'+$trad("x33")+'</p>'; |
| 82 | 90 | return; |
| 83 | 91 | } |
| ... | ... | @@ -113,7 +121,7 @@ i3GEOF.filtro = { |
| 113 | 121 | // |
| 114 | 122 | i3GEO.util.comboItens( |
| 115 | 123 | "none", |
| 116 | - i3GEO.temaAtivo, | |
| 124 | + i3GEOF.filtro.tema, | |
| 117 | 125 | function(retorno){ |
| 118 | 126 | i3GEOF.filtro.comboTemas = retorno.dados; |
| 119 | 127 | i3GEOF.filtro.adicionaLinhaFiltro(); |
| ... | ... | @@ -181,13 +189,13 @@ i3GEOF.filtro = { |
| 181 | 189 | var add,xis,interrogacao,operador,conector,valor,ntb,ntr,ntad,ntd,ntd1,ntd2,ntd3,ntd4,ntd5,tabela; |
| 182 | 190 | try{ |
| 183 | 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 | 193 | add.style.cursor="pointer"; |
| 186 | 194 | add.onclick = function() |
| 187 | 195 | {i3GEOF.filtro.adicionaLinhaFiltro();}; |
| 188 | 196 | |
| 189 | 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 | 199 | xis.style.cursor="pointer"; |
| 192 | 200 | xis.onclick = function(){ |
| 193 | 201 | var p = this.parentNode.parentNode.parentNode, |
| ... | ... | @@ -197,7 +205,7 @@ i3GEOF.filtro = { |
| 197 | 205 | }; |
| 198 | 206 | |
| 199 | 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 | 209 | interrogacao.title= $trad('mostraValor',i3GEOF.filtro.dicionario); |
| 202 | 210 | interrogacao.style.cursor="pointer"; |
| 203 | 211 | interrogacao.style.marginLeft="5px"; |
| ... | ... | @@ -208,7 +216,7 @@ i3GEOF.filtro = { |
| 208 | 216 | itemTema = (this.parentNode.parentNode.getElementsByTagName("select"))[0].value; |
| 209 | 217 | i3GEO.util.comboValoresItem( |
| 210 | 218 | "i3GEOfiltrocbitens", |
| 211 | - i3GEO.temaAtivo, | |
| 219 | + i3GEOF.filtro.tema, | |
| 212 | 220 | itemTema, |
| 213 | 221 | function(retorno){ |
| 214 | 222 | $i("i3GEOfiltrovalores").innerHTML = "<br><p class=paragrafo >" + |
| ... | ... | @@ -291,7 +299,7 @@ i3GEOF.filtro = { |
| 291 | 299 | <PEGAFILTRO> |
| 292 | 300 | */ |
| 293 | 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 | 303 | cp = new cpaint(), |
| 296 | 304 | temp = function(retorno){ |
| 297 | 305 | if(retorno.data !== undefined) |
| ... | ... | @@ -314,13 +322,13 @@ i3GEOF.filtro = { |
| 314 | 322 | if(i3GEOF.filtro.aguarde.visibility === "visible") |
| 315 | 323 | {return;} |
| 316 | 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 | 326 | cp = new cpaint(), |
| 319 | 327 | temp = function(retorno){ |
| 320 | 328 | i3GEOF.filtro.aguarde.visibility = "hidden"; |
| 321 | 329 | if(i3GEO.Interface.ATUAL === "padrao") |
| 322 | 330 | {i3GEO.atualiza(retorno);} |
| 323 | - i3GEO.Interface.atualizaTema(retorno,i3GEO.temaAtivo); | |
| 331 | + i3GEO.Interface.atualizaTema(retorno,i3GEOF.filtro.tema); | |
| 324 | 332 | }; |
| 325 | 333 | cp.set_response_type("JSON"); |
| 326 | 334 | cp.call(p,"insereFiltro",temp); |
| ... | ... | @@ -348,7 +356,7 @@ i3GEOF.filtro = { |
| 348 | 356 | try{ |
| 349 | 357 | i3GEOF.filtro.aguarde.visibility = "visible"; |
| 350 | 358 | var filtro = "", |
| 351 | - re,g,ipt,i,nos,s,itemsel,valor,operador,conector,p,cp,temp; | |
| 359 | + re,p,cp,temp; | |
| 352 | 360 | if( ($i("i3GEOfiltrofiltro").value !== "") &&($i("i3GEOfiltroguia2obj").style.display === "block")){ |
| 353 | 361 | filtro = $i("i3GEOfiltrofiltro").value; |
| 354 | 362 | re = new RegExp("'","g"); |
| ... | ... | @@ -357,29 +365,9 @@ i3GEOF.filtro = { |
| 357 | 365 | filtro = filtro.replace(re,""); |
| 358 | 366 | } |
| 359 | 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 | 372 | p = i3GEO.configura.locaplic+"/ferramentas/filtro/exec.php?base64=sim&g_sid="+i3GEO.configura.sid+"&funcao=inserefiltro"; |
| 385 | 373 | cp = new cpaint(); |
| ... | ... | @@ -395,15 +383,46 @@ i3GEOF.filtro = { |
| 395 | 383 | temp = function(retorno){ |
| 396 | 384 | if(i3GEO.Interface.ATUAL === "padrao") |
| 397 | 385 | {i3GEO.atualiza(retorno);} |
| 398 | - i3GEO.Interface.atualizaTema(retorno,i3GEO.temaAtivo); | |
| 386 | + i3GEO.Interface.atualizaTema(retorno,i3GEOF.filtro.tema); | |
| 399 | 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 | 392 | catch(e){ |
| 405 | 393 | i3GEO.janela.tempoMsg("Erro: "+e); |
| 406 | 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 | 429 | \ No newline at end of file | ... | ... |