Commit 3b53f0f2d92ed07d3c9277c32522b385f0b16478
1 parent
c4489191
Exists in
master
and in
7 other branches
Modificação na forma de uso dos dicionários e inclusão de namespace
Showing
10 changed files
with
729 additions
and
1098 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin1/dicionario/core.js
admin1/dicionario/operacoes.js
| 1 | //+$trad(1,i3GEOadmin.principal.dicionario)+ | 1 | //+$trad(1,i3GEOadmin.principal.dicionario)+ |
| 2 | -i3GEOadmin.operacoes = {}; | ||
| 3 | i3GEOadmin.operacoes.dicionario = { | 2 | i3GEOadmin.operacoes.dicionario = { |
| 4 | 'operacoes' : [ { | 3 | 'operacoes' : [ { |
| 5 | pt : "Operações e quem pode executá-las (papéis)", | 4 | pt : "Operações e quem pode executá-las (papéis)", |
admin1/dicionario/usuarios.js
| 1 | //+$trad(1,i3GEOadmin.principal.dicionario)+ | 1 | //+$trad(1,i3GEOadmin.principal.dicionario)+ |
| 2 | -i3GEOadmin.usuarios = {}; | ||
| 3 | i3GEOadmin.usuarios.dicionario = { | 2 | i3GEOadmin.usuarios.dicionario = { |
| 4 | 'usuarios' : [ { | 3 | 'usuarios' : [ { |
| 5 | pt : "Administração do i3geo - Usuários e papéis operacionais", | 4 | pt : "Administração do i3geo - Usuários e papéis operacionais", |
admin1/js/core.js
| @@ -28,8 +28,7 @@ Free Software Foundation, Inc., no endereço | @@ -28,8 +28,7 @@ Free Software Foundation, Inc., no endereço | ||
| 28 | Arquivo: | 28 | Arquivo: |
| 29 | 29 | ||
| 30 | i3geo/admin/js/core.js | 30 | i3geo/admin/js/core.js |
| 31 | -*/ | ||
| 32 | - | 31 | + */ |
| 33 | /* | 32 | /* |
| 34 | Function: $i | 33 | Function: $i |
| 35 | 34 | ||
| @@ -44,93 +43,94 @@ id - id do objeto | @@ -44,93 +43,94 @@ id - id do objeto | ||
| 44 | Retorno: | 43 | Retorno: |
| 45 | 44 | ||
| 46 | object - objeto javaScript | 45 | object - objeto javaScript |
| 47 | -*/ | 46 | + */ |
| 48 | $i = function(id) | 47 | $i = function(id) |
| 49 | {return document.getElementById(id);}; | 48 | {return document.getElementById(id);}; |
| 50 | /* | 49 | /* |
| 51 | Variable: $mapfiles | 50 | Variable: $mapfiles |
| 52 | 51 | ||
| 53 | Armazena o objeto com a lista de mapfiles | 52 | Armazena o objeto com a lista de mapfiles |
| 54 | -*/ | 53 | + */ |
| 55 | $mapfiles = ""; | 54 | $mapfiles = ""; |
| 56 | /* | 55 | /* |
| 57 | Variable: $tags | 56 | Variable: $tags |
| 58 | 57 | ||
| 59 | Armazena o objeto com a lista de tags | 58 | Armazena o objeto com a lista de tags |
| 60 | -*/ | 59 | + */ |
| 61 | $tags = ""; | 60 | $tags = ""; |
| 62 | /* | 61 | /* |
| 63 | Variable: $perfis | 62 | Variable: $perfis |
| 64 | 63 | ||
| 65 | Armazena o objeto com a lista de perfis | 64 | Armazena o objeto com a lista de perfis |
| 66 | -*/ | 65 | + */ |
| 67 | $perfis = ""; | 66 | $perfis = ""; |
| 68 | 67 | ||
| 69 | //funcoes jquery + bootstrap | 68 | //funcoes jquery + bootstrap |
| 70 | -// | ||
| 71 | -function mostraErro(erro){ | ||
| 72 | - var html = '<div class="alert alert-danger alert-dismissible" role="alert">' | ||
| 73 | - + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' | ||
| 74 | - + '<strong>Erro!</strong> ' | ||
| 75 | - + erro; | ||
| 76 | - $(".navbar-fixed-bottom .container").html(html); | ||
| 77 | -} | ||
| 78 | -function fechaModal(id){ | ||
| 79 | - $("#"+id).modal("hide"); | ||
| 80 | -} | ||
| 81 | -function abreModal(id,conteudo){ | ||
| 82 | - $("#"+id+" .modal-body").html(conteudo); | ||
| 83 | - if($("#"+id).css("display") == "none"){ | ||
| 84 | - $("#"+id).modal("show"); | ||
| 85 | - $.material.init(); | ||
| 86 | - } | ||
| 87 | -} | ||
| 88 | -function fechaModalGeral(){ | ||
| 89 | - fechaModal("modalGeral"); | ||
| 90 | -} | ||
| 91 | -function abreModalGeral(conteudo){ | ||
| 92 | - abreModal("modalGeral",conteudo); | ||
| 93 | -} | ||
| 94 | -function fechaModalConfirma(){ | ||
| 95 | - fechaModal("modalGeral"); | ||
| 96 | -} | ||
| 97 | -function abreModalConfirma(hash){ | ||
| 98 | - var conteudo = Mustache.to_html( | ||
| 99 | - $("#modalConfirmaTpl").html(), | ||
| 100 | - hash | ||
| 101 | - ); | ||
| 102 | - abreModal("modalGeral",conteudo); | ||
| 103 | -} | ||
| 104 | -function modalAguarde(open){ | ||
| 105 | - if(open == true){ | ||
| 106 | - abreModalGeral($("#iconeAguardeTpl").html()); | ||
| 107 | - } | ||
| 108 | - else{ | ||
| 109 | - fechaModalGeral(); | ||
| 110 | - } | ||
| 111 | -} | ||
| 112 | -function iconeAguarde(onde){ | ||
| 113 | - if(onde.html){ | ||
| 114 | - onde.html($("#iconeAguardeTpl").html()); | ||
| 115 | - } | ||
| 116 | - else{ | ||
| 117 | - $("#"+onde).html($("#iconeAguardeTpl").html()); | ||
| 118 | - } | ||
| 119 | -} | 69 | + |
| 70 | +i3GEOadmin.core = { | ||
| 71 | + mostraErro: function(erro){ | ||
| 72 | + var html = '<div class="alert alert-danger alert-dismissible" role="alert">' | ||
| 73 | + + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' | ||
| 74 | + + '<strong>Erro!</strong> ' | ||
| 75 | + + erro; | ||
| 76 | + $(".navbar-fixed-bottom .container").html(html); | ||
| 77 | + }, | ||
| 78 | + fechaModal: function(id){ | ||
| 79 | + $("#"+id).modal("hide"); | ||
| 80 | + }, | ||
| 81 | + abreModal: function(id,conteudo){ | ||
| 82 | + $("#"+id+" .modal-body").html(conteudo); | ||
| 83 | + if($("#"+id).css("display") == "none"){ | ||
| 84 | + $("#"+id).modal("show"); | ||
| 85 | + $.material.init(); | ||
| 86 | + } | ||
| 87 | + }, | ||
| 88 | + fechaModalGeral: function(){ | ||
| 89 | + i3GEOadmin.core.fechaModal("modalGeral"); | ||
| 90 | + }, | ||
| 91 | + abreModalGeral: function(conteudo){ | ||
| 92 | + i3GEOadmin.core.abreModal("modalGeral",conteudo); | ||
| 93 | + }, | ||
| 94 | + fechaModalConfirma: function(){ | ||
| 95 | + i3GEOadmin.core.fechaModal("modalGeral"); | ||
| 96 | + }, | ||
| 97 | + abreModalConfirma: function(hash){ | ||
| 98 | + var conteudo = Mustache.to_html( | ||
| 99 | + $("#modalConfirmaTpl").html(), | ||
| 100 | + hash | ||
| 101 | + ); | ||
| 102 | + i3GEOadmin.core.abreModal("modalGeral",conteudo); | ||
| 103 | + }, | ||
| 104 | + modalAguarde: function(open){ | ||
| 105 | + if(open == true){ | ||
| 106 | + i3GEOadmin.core.abreModalGeral($("#iconeAguardeTpl").html()); | ||
| 107 | + } | ||
| 108 | + else{ | ||
| 109 | + i3GEOadmin.core.fechaModalGeral(); | ||
| 110 | + } | ||
| 111 | + }, | ||
| 112 | + iconeAguarde: function(onde){ | ||
| 113 | + if(onde.html){ | ||
| 114 | + onde.html($("#iconeAguardeTpl").html()); | ||
| 115 | + } | ||
| 116 | + else{ | ||
| 117 | + $("#"+onde).html($("#iconeAguardeTpl").html()); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | +}; | ||
| 120 | 121 | ||
| 121 | 122 | ||
| 122 | -// | ||
| 123 | function cabecalhoMetaestat(id,excluir){ | 123 | function cabecalhoMetaestat(id,excluir){ |
| 124 | var botao,i,n,temp, | 124 | var botao,i,n,temp, |
| 125 | - ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", | ||
| 126 | - u = i3GEO.util.pegaCookie("i3geousuarionome"), | ||
| 127 | - botoes = [ | ||
| 128 | - {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:"../principal.html"}, | ||
| 129 | - {id:"arvore",titulo:$trad("arvoreCompleta",i3GEOadmin.core.dicionario),link:"estat_variavel.html"}, | ||
| 130 | - {id:"conexao",titulo:$trad("conexoes",i3GEOadmin.core.dicionario),link:"estat_conexao.html"}, | ||
| 131 | - {id:"tipo_regiao",titulo:$trad("regioes",i3GEOadmin.core.dicionario),link:"estat_tipo_regiao.html"}, | ||
| 132 | - {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | ||
| 133 | - ]; | 125 | + ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", |
| 126 | + u = i3GEO.util.pegaCookie("i3geousuarionome"), | ||
| 127 | + botoes = [ | ||
| 128 | + {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:"../principal.html"}, | ||
| 129 | + {id:"arvore",titulo:$trad("arvoreCompleta",i3GEOadmin.core.dicionario),link:"estat_variavel.html"}, | ||
| 130 | + {id:"conexao",titulo:$trad("conexoes",i3GEOadmin.core.dicionario),link:"estat_conexao.html"}, | ||
| 131 | + {id:"tipo_regiao",titulo:$trad("regioes",i3GEOadmin.core.dicionario),link:"estat_tipo_regiao.html"}, | ||
| 132 | + {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | ||
| 133 | + ]; | ||
| 134 | n = botoes.length; | 134 | n = botoes.length; |
| 135 | for(i=0;i<n;i++){ | 135 | for(i=0;i<n;i++){ |
| 136 | if(botoes[i].id !== excluir){ | 136 | if(botoes[i].id !== excluir){ |
| @@ -169,15 +169,15 @@ function cabecalhoMetaestat(id,excluir){ | @@ -169,15 +169,15 @@ function cabecalhoMetaestat(id,excluir){ | ||
| 169 | 169 | ||
| 170 | function cabecalhoUsuarios(id,excluir){ | 170 | function cabecalhoUsuarios(id,excluir){ |
| 171 | var botao,i,n,temp, | 171 | var botao,i,n,temp, |
| 172 | - ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", | ||
| 173 | - u = i3GEO.util.pegaCookie("i3geousuarionome"), | ||
| 174 | - botoes = [ | ||
| 175 | - {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:"../principal.html"}, | ||
| 176 | - {id:"operacoes",titulo:$trad("operacoes",i3GEOadmin.core.dicionario),link:"operacoes.html"}, | ||
| 177 | - {id:"usuarios",titulo:$trad("usuarios",i3GEOadmin.core.dicionario),link:"usuarios.html"}, | ||
| 178 | - {id:"gruposusuarios",titulo:$trad("gruposUsuarios",i3GEOadmin.core.dicionario),link:"gruposusuarios.html"}, | ||
| 179 | - {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | ||
| 180 | - ]; | 172 | + ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", |
| 173 | + u = i3GEO.util.pegaCookie("i3geousuarionome"), | ||
| 174 | + botoes = [ | ||
| 175 | + {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:"../principal.html"}, | ||
| 176 | + {id:"operacoes",titulo:$trad("operacoes",i3GEOadmin.core.dicionario),link:"operacoes.html"}, | ||
| 177 | + {id:"usuarios",titulo:$trad("usuarios",i3GEOadmin.core.dicionario),link:"usuarios.html"}, | ||
| 178 | + {id:"gruposusuarios",titulo:$trad("gruposUsuarios",i3GEOadmin.core.dicionario),link:"gruposusuarios.html"}, | ||
| 179 | + {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | ||
| 180 | + ]; | ||
| 181 | n = botoes.length; | 181 | n = botoes.length; |
| 182 | for(i=0;i<n;i++){ | 182 | for(i=0;i<n;i++){ |
| 183 | if(botoes[i].id !== excluir){ | 183 | if(botoes[i].id !== excluir){ |
| @@ -220,15 +220,15 @@ function cabecalhoGeral(id,excluir,prefixo){ | @@ -220,15 +220,15 @@ function cabecalhoGeral(id,excluir,prefixo){ | ||
| 220 | prefixo = ""; | 220 | prefixo = ""; |
| 221 | } | 221 | } |
| 222 | var botao,i,n,temp, | 222 | var botao,i,n,temp, |
| 223 | - ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", | ||
| 224 | - u = i3GEO.util.pegaCookie("i3geousuarionome"), | ||
| 225 | - botoes = [ | ||
| 226 | - {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:prefixo+"../principal.html"}, | ||
| 227 | - {id:"menus",titulo:$trad("menus",i3GEOadmin.core.dicionario),link:prefixo+"menus.html"}, | ||
| 228 | - {id:"arvore",titulo:$trad("arvore",i3GEOadmin.core.dicionario),link:prefixo+"arvore.html"}, | ||
| 229 | - {id:"editormapfile",titulo:$trad("mapfiles",i3GEOadmin.core.dicionario),link:prefixo+"editormapfile.html"}, | ||
| 230 | - {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | ||
| 231 | - ]; | 223 | + ins = "<fieldset><legend>" + $trad("atalhos",i3GEOadmin.core.dicionario) + "</legend>", |
| 224 | + u = i3GEO.util.pegaCookie("i3geousuarionome"), | ||
| 225 | + botoes = [ | ||
| 226 | + {id:"principal",titulo:$trad("inicio",i3GEOadmin.core.dicionario),link:prefixo+"../principal.html"}, | ||
| 227 | + {id:"menus",titulo:$trad("menus",i3GEOadmin.core.dicionario),link:prefixo+"menus.html"}, | ||
| 228 | + {id:"arvore",titulo:$trad("arvore",i3GEOadmin.core.dicionario),link:prefixo+"arvore.html"}, | ||
| 229 | + {id:"editormapfile",titulo:$trad("mapfiles",i3GEOadmin.core.dicionario),link:prefixo+"editormapfile.html"}, | ||
| 230 | + {id:"login",titulo:$trad("login",i3GEOadmin.core.dicionario),js:"i3GEO.login.dialogo.abreLogin()"} | ||
| 231 | + ]; | ||
| 232 | n = botoes.length; | 232 | n = botoes.length; |
| 233 | for(i=0;i<n;i++){ | 233 | for(i=0;i<n;i++){ |
| 234 | if(botoes[i].id !== excluir){ | 234 | if(botoes[i].id !== excluir){ |
| @@ -285,7 +285,7 @@ obj - {Object} objeto contendo os parametros, exemplo | @@ -285,7 +285,7 @@ obj - {Object} objeto contendo os parametros, exemplo | ||
| 285 | 285 | ||
| 286 | ]} | 286 | ]} |
| 287 | 287 | ||
| 288 | -*/ | 288 | + */ |
| 289 | function core_arvore(titulo,onde,obj){ | 289 | function core_arvore(titulo,onde,obj){ |
| 290 | var arvore,root,tempNode,d,c,i,linha,conteudo,j,temaNode; | 290 | var arvore,root,tempNode,d,c,i,linha,conteudo,j,temaNode; |
| 291 | if(!$i(onde)){return;} | 291 | if(!$i(onde)){return;} |
| @@ -333,7 +333,7 @@ no - objeto no que ser&aacute; movimentado | @@ -333,7 +333,7 @@ no - objeto no que ser&aacute; movimentado | ||
| 333 | Return: | 333 | Return: |
| 334 | 334 | ||
| 335 | true|false - se o movimento ocorreu | 335 | true|false - se o movimento ocorreu |
| 336 | -*/ | 336 | + */ |
| 337 | function core_movimentaNo(tipo,no) | 337 | function core_movimentaNo(tipo,no) |
| 338 | { | 338 | { |
| 339 | var movimenta = false; | 339 | var movimenta = false; |
| @@ -373,7 +373,7 @@ fun&ccedil;&atilde;o gen&eacute;rica, pouco usada. | @@ -373,7 +373,7 @@ fun&ccedil;&atilde;o gen&eacute;rica, pouco usada. | ||
| 373 | Parameters: | 373 | Parameters: |
| 374 | 374 | ||
| 375 | o - string retornada pelo ajax | 375 | o - string retornada pelo ajax |
| 376 | -*/ | 376 | + */ |
| 377 | function core_handleSuccess(o) | 377 | function core_handleSuccess(o) |
| 378 | { | 378 | { |
| 379 | //div onde será mostrado o log | 379 | //div onde será mostrado o log |
| @@ -399,7 +399,7 @@ Processa o retorno da chamada em ajax quando tiver falhado. | @@ -399,7 +399,7 @@ Processa o retorno da chamada em ajax quando tiver falhado. | ||
| 399 | Parameters: | 399 | Parameters: |
| 400 | 400 | ||
| 401 | o - string retornada pelo ajax | 401 | o - string retornada pelo ajax |
| 402 | -*/ | 402 | + */ |
| 403 | function core_handleFailure(o,texto) | 403 | function core_handleFailure(o,texto) |
| 404 | { | 404 | { |
| 405 | //div onde será mostrado o log | 405 | //div onde será mostrado o log |
| @@ -440,7 +440,7 @@ callback - fun&ccedil;&atilde;o que processar&aacute; o retorno | @@ -440,7 +440,7 @@ callback - fun&ccedil;&atilde;o que processar&aacute; o retorno | ||
| 440 | tipo - GET ou POST | 440 | tipo - GET ou POST |
| 441 | 441 | ||
| 442 | postpar - parametros quando o tipo for post | 442 | postpar - parametros quando o tipo for post |
| 443 | -*/ | 443 | + */ |
| 444 | function core_makeRequest(sUrl,callback,tipo,postpar) | 444 | function core_makeRequest(sUrl,callback,tipo,postpar) |
| 445 | { | 445 | { |
| 446 | sUrl = escape(sUrl); | 446 | sUrl = escape(sUrl); |
| @@ -472,7 +472,7 @@ Mostra uma janela de aguarde | @@ -472,7 +472,7 @@ Mostra uma janela de aguarde | ||
| 472 | Parameters: | 472 | Parameters: |
| 473 | 473 | ||
| 474 | tipo - ativa|desativa|string com uma mensagem | 474 | tipo - ativa|desativa|string com uma mensagem |
| 475 | -*/ | 475 | + */ |
| 476 | function core_carregando(tipo) | 476 | function core_carregando(tipo) |
| 477 | { | 477 | { |
| 478 | } | 478 | } |
| @@ -490,7 +490,7 @@ handleNo - fun&ccedil;&atilde;o para n&atilde;o | @@ -490,7 +490,7 @@ handleNo - fun&ccedil;&atilde;o para n&atilde;o | ||
| 490 | mensagem - mensagem do diálogo | 490 | mensagem - mensagem do diálogo |
| 491 | 491 | ||
| 492 | largura - largura do diálogo em px | 492 | largura - largura do diálogo em px |
| 493 | -*/ | 493 | + */ |
| 494 | function core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho) | 494 | function core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho) |
| 495 | { | 495 | { |
| 496 | if(!cabecalho || cabecalho === ""){ | 496 | if(!cabecalho || cabecalho === ""){ |
| @@ -500,18 +500,18 @@ function core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho) | @@ -500,18 +500,18 @@ function core_dialogoContinua(handleYes,handleNo,mensagem,largura,cabecalho) | ||
| 500 | YAHOO.namespace("continua.container"); | 500 | YAHOO.namespace("continua.container"); |
| 501 | YAHOO.continua.container.simpledialog1 = | 501 | YAHOO.continua.container.simpledialog1 = |
| 502 | new YAHOO.widget.SimpleDialog("simpledialog1", | 502 | new YAHOO.widget.SimpleDialog("simpledialog1", |
| 503 | - { width: largura+"px", | ||
| 504 | - fixedcenter: true, | ||
| 505 | - visible: false, | ||
| 506 | - draggable: false, | ||
| 507 | - close: true, | ||
| 508 | - text: mensagem, | ||
| 509 | - icon: YAHOO.widget.SimpleDialog.ICON_HELP, | ||
| 510 | - modal: true, | ||
| 511 | - constraintoviewport: true, | ||
| 512 | - buttons: [ { text:"Sim", handler:handleYes, isDefault:true }, | ||
| 513 | - { text:"Não", handler:handleNo } ] | ||
| 514 | - } ); | 503 | + { width: largura+"px", |
| 504 | + fixedcenter: true, | ||
| 505 | + visible: false, | ||
| 506 | + draggable: false, | ||
| 507 | + close: true, | ||
| 508 | + text: mensagem, | ||
| 509 | + icon: YAHOO.widget.SimpleDialog.ICON_HELP, | ||
| 510 | + modal: true, | ||
| 511 | + constraintoviewport: true, | ||
| 512 | + buttons: [ { text:"Sim", handler:handleYes, isDefault:true }, | ||
| 513 | + { text:"Não", handler:handleNo } ] | ||
| 514 | + } ); | ||
| 515 | YAHOO.continua.container.simpledialog1.setHeader(cabecalho); | 515 | YAHOO.continua.container.simpledialog1.setHeader(cabecalho); |
| 516 | YAHOO.continua.container.simpledialog1.render(document.body); | 516 | YAHOO.continua.container.simpledialog1.render(document.body); |
| 517 | YAHOO.continua.container.simpledialog1.show(); | 517 | YAHOO.continua.container.simpledialog1.show(); |
| @@ -530,25 +530,25 @@ handleNo - fun&ccedil;&atilde;o para n&atilde;o | @@ -530,25 +530,25 @@ handleNo - fun&ccedil;&atilde;o para n&atilde;o | ||
| 530 | mensagem - mensagem do diálogo | 530 | mensagem - mensagem do diálogo |
| 531 | 531 | ||
| 532 | largura - largura do diálogo em px | 532 | largura - largura do diálogo em px |
| 533 | -*/ | 533 | + */ |
| 534 | function core_dialogoPergunta(handleYes,handleNo,mensagem,largura) | 534 | function core_dialogoPergunta(handleYes,handleNo,mensagem,largura) |
| 535 | { | 535 | { |
| 536 | // Instantiate the Dialog | 536 | // Instantiate the Dialog |
| 537 | YAHOO.namespace("continua.container"); | 537 | YAHOO.namespace("continua.container"); |
| 538 | YAHOO.continua.container.simpledialog1 = | 538 | YAHOO.continua.container.simpledialog1 = |
| 539 | new YAHOO.widget.SimpleDialog("simpledialog1", | 539 | new YAHOO.widget.SimpleDialog("simpledialog1", |
| 540 | - { width: largura+"px", | ||
| 541 | - fixedcenter: true, | ||
| 542 | - visible: false, | ||
| 543 | - draggable: false, | ||
| 544 | - close: true, | ||
| 545 | - text: mensagem, | ||
| 546 | - icon: "", | ||
| 547 | - modal: true, | ||
| 548 | - constraintoviewport: true, | ||
| 549 | - buttons: [ { text:"Continua", handler:handleYes, isDefault:true }, | ||
| 550 | - { text:"Cancela", handler:handleNo } ] | ||
| 551 | - } ); | 540 | + { width: largura+"px", |
| 541 | + fixedcenter: true, | ||
| 542 | + visible: false, | ||
| 543 | + draggable: false, | ||
| 544 | + close: true, | ||
| 545 | + text: mensagem, | ||
| 546 | + icon: "", | ||
| 547 | + modal: true, | ||
| 548 | + constraintoviewport: true, | ||
| 549 | + buttons: [ { text:"Continua", handler:handleYes, isDefault:true }, | ||
| 550 | + { text:"Cancela", handler:handleNo } ] | ||
| 551 | + } ); | ||
| 552 | //YAHOO.continua.container.simpledialog1.setHeader("Tem certeza?"); | 552 | //YAHOO.continua.container.simpledialog1.setHeader("Tem certeza?"); |
| 553 | YAHOO.continua.container.simpledialog1.render(document.body); | 553 | YAHOO.continua.container.simpledialog1.render(document.body); |
| 554 | YAHOO.continua.container.simpledialog1.show(); | 554 | YAHOO.continua.container.simpledialog1.show(); |
| @@ -561,7 +561,7 @@ Parameters: | @@ -561,7 +561,7 @@ Parameters: | ||
| 561 | id - id do elemento que receberá o painel | 561 | id - id do elemento que receberá o painel |
| 562 | 562 | ||
| 563 | botao - id do elemento que deverá ser lcicado para abrir o painel | 563 | botao - id do elemento que deverá ser lcicado para abrir o painel |
| 564 | -*/ | 564 | + */ |
| 565 | function core_ativaPainelAjuda(id,botao) | 565 | function core_ativaPainelAjuda(id,botao) |
| 566 | { | 566 | { |
| 567 | $i(id).style.display = "block"; | 567 | $i(id).style.display = "block"; |
| @@ -571,9 +571,9 @@ function core_ativaPainelAjuda(id,botao) | @@ -571,9 +571,9 @@ function core_ativaPainelAjuda(id,botao) | ||
| 571 | YAHOO.admin.container.panelAjuda.render(); | 571 | YAHOO.admin.container.panelAjuda.render(); |
| 572 | } | 572 | } |
| 573 | if(arguments.length == 2) | 573 | if(arguments.length == 2) |
| 574 | - YAHOO.util.Event.addListener(botao, "click", YAHOO.admin.container.panelAjuda.show, YAHOO.admin.container.panelAjuda, true); | 574 | + YAHOO.util.Event.addListener(botao, "click", YAHOO.admin.container.panelAjuda.show, YAHOO.admin.container.panelAjuda, true); |
| 575 | else | 575 | else |
| 576 | - YAHOO.admin.container.panelAjuda.show(); | 576 | + YAHOO.admin.container.panelAjuda.show(); |
| 577 | } | 577 | } |
| 578 | /* | 578 | /* |
| 579 | Function: core_ativaPainelTexto | 579 | Function: core_ativaPainelTexto |
| @@ -581,7 +581,7 @@ Function: core_ativaPainelTexto | @@ -581,7 +581,7 @@ Function: core_ativaPainelTexto | ||
| 581 | Parameters: | 581 | Parameters: |
| 582 | 582 | ||
| 583 | id - id do elemento que receberá o painel | 583 | id - id do elemento que receberá o painel |
| 584 | -*/ | 584 | + */ |
| 585 | function core_ativaPainelTexto(id) | 585 | function core_ativaPainelTexto(id) |
| 586 | { | 586 | { |
| 587 | YAHOO.admin.container.panelTexto = new YAHOO.widget.Panel(id, { width:"350px", height:"200px",overflow:"auto", visible:false,constraintoviewport:true } ); | 587 | YAHOO.admin.container.panelTexto = new YAHOO.widget.Panel(id, { width:"350px", height:"200px",overflow:"auto", visible:false,constraintoviewport:true } ); |
| @@ -604,7 +604,7 @@ Return | @@ -604,7 +604,7 @@ Return | ||
| 604 | $perfis - variável global com o objeto perfis | 604 | $perfis - variável global com o objeto perfis |
| 605 | 605 | ||
| 606 | $perfisArray - array com a lista de perfis | 606 | $perfisArray - array com a lista de perfis |
| 607 | -*/ | 607 | + */ |
| 608 | function core_pegaPerfis(funcao) | 608 | function core_pegaPerfis(funcao) |
| 609 | { | 609 | { |
| 610 | if(arguments.length == 0) | 610 | if(arguments.length == 0) |
| @@ -622,7 +622,7 @@ function core_pegaPerfis(funcao) | @@ -622,7 +622,7 @@ function core_pegaPerfis(funcao) | ||
| 622 | for (var i=0;i<$perfis.length;i++) | 622 | for (var i=0;i<$perfis.length;i++) |
| 623 | {$perfisArray.push($perfis[i].perfil);} | 623 | {$perfisArray.push($perfis[i].perfil);} |
| 624 | if(funcao != "") | 624 | if(funcao != "") |
| 625 | - eval(funcao); | 625 | + eval(funcao); |
| 626 | } | 626 | } |
| 627 | catch(e){core_handleFailure(o,o.responseText);} | 627 | catch(e){core_handleFailure(o,o.responseText);} |
| 628 | }, | 628 | }, |
| @@ -649,7 +649,7 @@ filtro - (opcional) string com o filtro, por exemplo, "'download_tema' = 'SIM'" | @@ -649,7 +649,7 @@ filtro - (opcional) string com o filtro, por exemplo, "'download_tema' = 'SIM'" | ||
| 649 | checaNomes - (0pcional) bate o nome do mapfile (tema) com o registro no banco | 649 | checaNomes - (0pcional) bate o nome do mapfile (tema) com o registro no banco |
| 650 | 650 | ||
| 651 | checaNames - (opcional) bate o nome do mapfile com o nome do layer | 651 | checaNames - (opcional) bate o nome do mapfile com o nome do layer |
| 652 | -*/ | 652 | + */ |
| 653 | function core_pegaMapfiles(funcaoM,letra,filtro,checaNomes,checaNames) | 653 | function core_pegaMapfiles(funcaoM,letra,filtro,checaNomes,checaNames) |
| 654 | { | 654 | { |
| 655 | if(!letra){ | 655 | if(!letra){ |
| @@ -679,7 +679,7 @@ function core_pegaMapfiles(funcaoM,letra,filtro,checaNomes,checaNames) | @@ -679,7 +679,7 @@ function core_pegaMapfiles(funcaoM,letra,filtro,checaNomes,checaNames) | ||
| 679 | { | 679 | { |
| 680 | $mapfiles = YAHOO.lang.JSON.parse(o.responseText); | 680 | $mapfiles = YAHOO.lang.JSON.parse(o.responseText); |
| 681 | if(funcaoM != "") | 681 | if(funcaoM != "") |
| 682 | - eval(funcaoM); | 682 | + eval(funcaoM); |
| 683 | } | 683 | } |
| 684 | catch(e){core_handleFailure(o,o.responseText);} | 684 | catch(e){core_handleFailure(o,o.responseText);} |
| 685 | }, | 685 | }, |
| @@ -704,7 +704,7 @@ marcar - valor que ser&aacute; marcado como selecionado | @@ -704,7 +704,7 @@ marcar - valor que ser&aacute; marcado como selecionado | ||
| 704 | funcao - string com o nome da função que será executada no evento onchange | 704 | funcao - string com o nome da função que será executada no evento onchange |
| 705 | 705 | ||
| 706 | recarrega {booblean} - força recarregar o combo de mapfiles | 706 | recarrega {booblean} - força recarregar o combo de mapfiles |
| 707 | -*/ | 707 | + */ |
| 708 | function core_comboMapfiles(onde,id,marcar,funcao,recarrega) | 708 | function core_comboMapfiles(onde,id,marcar,funcao,recarrega) |
| 709 | { | 709 | { |
| 710 | if(arguments.length == 3) | 710 | if(arguments.length == 3) |
| @@ -739,7 +739,7 @@ id - id do combo que ser&aacute; criado | @@ -739,7 +739,7 @@ id - id do combo que ser&aacute; criado | ||
| 739 | marcar - valor que será marcado como selecionado | 739 | marcar - valor que será marcado como selecionado |
| 740 | 740 | ||
| 741 | funcao - string com o nome da função que será executada no evento onchange | 741 | funcao - string com o nome da função que será executada no evento onchange |
| 742 | -*/ | 742 | + */ |
| 743 | function core_comboPerfis(onde,id,marcar,funcao) | 743 | function core_comboPerfis(onde,id,marcar,funcao) |
| 744 | { | 744 | { |
| 745 | if(arguments.length == 3) | 745 | if(arguments.length == 3) |
| @@ -774,7 +774,7 @@ id - id do combo que ser&aacute; criado | @@ -774,7 +774,7 @@ id - id do combo que ser&aacute; criado | ||
| 774 | marcar - valor que será marcado como selecionado | 774 | marcar - valor que será marcado como selecionado |
| 775 | 775 | ||
| 776 | funcao - string com o nome da função que será executada no evento onchange | 776 | funcao - string com o nome da função que será executada no evento onchange |
| 777 | -*/ | 777 | + */ |
| 778 | function core_comboPranchas(onde,id,marcar,funcao,id_atlas) | 778 | function core_comboPranchas(onde,id,marcar,funcao,id_atlas) |
| 779 | { | 779 | { |
| 780 | var sUrl = "../php/atlas.php?funcao=pegaPranchas&id_atlas="+id_atlas; | 780 | var sUrl = "../php/atlas.php?funcao=pegaPranchas&id_atlas="+id_atlas; |
| @@ -785,14 +785,14 @@ function core_comboPranchas(onde,id,marcar,funcao,id_atlas) | @@ -785,14 +785,14 @@ function core_comboPranchas(onde,id,marcar,funcao,id_atlas) | ||
| 785 | try | 785 | try |
| 786 | { | 786 | { |
| 787 | var valores = YAHOO.lang.JSON.parse(o.responseText); | 787 | var valores = YAHOO.lang.JSON.parse(o.responseText); |
| 788 | - if(arguments.length == 3) | ||
| 789 | - {funcao = "";} | ||
| 790 | - if (funcao != "") | ||
| 791 | - {funcao = "onchange='"+funcao+"'";} | ||
| 792 | - ins = "<div class='styled-select150'><select id='"+id+"' "+funcao+" >"; | ||
| 793 | - ins += core_comboObjeto(valores,"id_prancha","titulo_prancha",marcar); | ||
| 794 | - ins += "</select></div>"; | ||
| 795 | - $i(onde).innerHTML = ins; | 788 | + if(arguments.length == 3) |
| 789 | + {funcao = "";} | ||
| 790 | + if (funcao != "") | ||
| 791 | + {funcao = "onchange='"+funcao+"'";} | ||
| 792 | + ins = "<div class='styled-select150'><select id='"+id+"' "+funcao+" >"; | ||
| 793 | + ins += core_comboObjeto(valores,"id_prancha","titulo_prancha",marcar); | ||
| 794 | + ins += "</select></div>"; | ||
| 795 | + $i(onde).innerHTML = ins; | ||
| 796 | } | 796 | } |
| 797 | catch(e){core_handleFailure(e,o.responseText);} | 797 | catch(e){core_handleFailure(e,o.responseText);} |
| 798 | }, | 798 | }, |
| @@ -817,7 +817,7 @@ id - id do combo que ser&aacute; criado | @@ -817,7 +817,7 @@ id - id do combo que ser&aacute; criado | ||
| 817 | marcar - valor que será marcado como selecionado | 817 | marcar - valor que será marcado como selecionado |
| 818 | 818 | ||
| 819 | funcao - string com o nome da função que será executada no evento onchange | 819 | funcao - string com o nome da função que será executada no evento onchange |
| 820 | -*/ | 820 | + */ |
| 821 | function core_comboGrupos(onde,id,marcar,funcao) | 821 | function core_comboGrupos(onde,id,marcar,funcao) |
| 822 | { | 822 | { |
| 823 | var sUrl = "../php/menutemas.php?funcao=pegaGrupos"; | 823 | var sUrl = "../php/menutemas.php?funcao=pegaGrupos"; |
| @@ -828,14 +828,14 @@ function core_comboGrupos(onde,id,marcar,funcao) | @@ -828,14 +828,14 @@ function core_comboGrupos(onde,id,marcar,funcao) | ||
| 828 | try | 828 | try |
| 829 | { | 829 | { |
| 830 | var valores = YAHOO.lang.JSON.parse(o.responseText); | 830 | var valores = YAHOO.lang.JSON.parse(o.responseText); |
| 831 | - if(arguments.length == 3) | ||
| 832 | - {funcao = "";} | ||
| 833 | - if (funcao != "") | ||
| 834 | - {funcao = "onchange='"+funcao+"'";} | ||
| 835 | - ins = "<select size=6 style='width:370px;font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | ||
| 836 | - ins += core_comboObjeto(valores,"id_grupo","nome_grupo",marcar); | ||
| 837 | - ins += "</select>"; | ||
| 838 | - $i(onde).innerHTML = ins; | 831 | + if(arguments.length == 3) |
| 832 | + {funcao = "";} | ||
| 833 | + if (funcao != "") | ||
| 834 | + {funcao = "onchange='"+funcao+"'";} | ||
| 835 | + ins = "<select size=6 style='width:370px;font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | ||
| 836 | + ins += core_comboObjeto(valores,"id_grupo","nome_grupo",marcar); | ||
| 837 | + ins += "</select>"; | ||
| 838 | + $i(onde).innerHTML = ins; | ||
| 839 | } | 839 | } |
| 840 | catch(e){core_handleFailure(e,o.responseText);} | 840 | catch(e){core_handleFailure(e,o.responseText);} |
| 841 | }, | 841 | }, |
| @@ -860,7 +860,7 @@ id - id do combo que ser&aacute; criado | @@ -860,7 +860,7 @@ id - id do combo que ser&aacute; criado | ||
| 860 | marcar - valor que será marcado como selecionado | 860 | marcar - valor que será marcado como selecionado |
| 861 | 861 | ||
| 862 | funcao - string com o nome da função que será executada no evento onchange | 862 | funcao - string com o nome da função que será executada no evento onchange |
| 863 | -*/ | 863 | + */ |
| 864 | function core_comboSubGrupos(onde,id,marcar,funcao) | 864 | function core_comboSubGrupos(onde,id,marcar,funcao) |
| 865 | { | 865 | { |
| 866 | var sUrl = "../php/menutemas.php?funcao=pegaSubGrupos"; | 866 | var sUrl = "../php/menutemas.php?funcao=pegaSubGrupos"; |
| @@ -871,14 +871,14 @@ function core_comboSubGrupos(onde,id,marcar,funcao) | @@ -871,14 +871,14 @@ function core_comboSubGrupos(onde,id,marcar,funcao) | ||
| 871 | try | 871 | try |
| 872 | { | 872 | { |
| 873 | var valores = YAHOO.lang.JSON.parse(o.responseText); | 873 | var valores = YAHOO.lang.JSON.parse(o.responseText); |
| 874 | - if(arguments.length == 3) | ||
| 875 | - {funcao = "";} | ||
| 876 | - if (funcao != "") | ||
| 877 | - {funcao = "onchange='"+funcao+"'";} | ||
| 878 | - ins = "<select size=6 style='width:370px; font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | ||
| 879 | - ins += core_comboObjeto(valores,"id_subgrupo","nome_subgrupo",marcar); | ||
| 880 | - ins += "</select>"; | ||
| 881 | - $i(onde).innerHTML = ins; | 874 | + if(arguments.length == 3) |
| 875 | + {funcao = "";} | ||
| 876 | + if (funcao != "") | ||
| 877 | + {funcao = "onchange='"+funcao+"'";} | ||
| 878 | + ins = "<select size=6 style='width:370px; font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | ||
| 879 | + ins += core_comboObjeto(valores,"id_subgrupo","nome_subgrupo",marcar); | ||
| 880 | + ins += "</select>"; | ||
| 881 | + $i(onde).innerHTML = ins; | ||
| 882 | } | 882 | } |
| 883 | catch(e){core_handleFailure(e,o.responseText);} | 883 | catch(e){core_handleFailure(e,o.responseText);} |
| 884 | }, | 884 | }, |
| @@ -903,7 +903,7 @@ id - id do combo que ser&aacute; criado | @@ -903,7 +903,7 @@ id - id do combo que ser&aacute; criado | ||
| 903 | marcar - valor que será marcado como selecionado | 903 | marcar - valor que será marcado como selecionado |
| 904 | 904 | ||
| 905 | funcao - string com o nome da função que será executada no evento onchange | 905 | funcao - string com o nome da função que será executada no evento onchange |
| 906 | -*/ | 906 | + */ |
| 907 | function core_comboTemas(onde,id,marcar,funcao) | 907 | function core_comboTemas(onde,id,marcar,funcao) |
| 908 | { | 908 | { |
| 909 | var sUrl = "../php/menutemas.php?funcao=pegaTemas2"; | 909 | var sUrl = "../php/menutemas.php?funcao=pegaTemas2"; |
| @@ -914,14 +914,14 @@ function core_comboTemas(onde,id,marcar,funcao) | @@ -914,14 +914,14 @@ function core_comboTemas(onde,id,marcar,funcao) | ||
| 914 | try | 914 | try |
| 915 | { | 915 | { |
| 916 | var valores = YAHOO.lang.JSON.parse(o.responseText); | 916 | var valores = YAHOO.lang.JSON.parse(o.responseText); |
| 917 | - if(arguments.length == 3) | ||
| 918 | - {funcao = "";} | ||
| 919 | - if (funcao != "") | ||
| 920 | - {funcao = "onchange='"+funcao+"'";} | ||
| 921 | - ins = "<select size=6 style='width:355px;font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | ||
| 922 | - ins += core_comboObjeto(valores,"id_tema","nome_tema",marcar,"codigo_tema"); | ||
| 923 | - ins += "</select>"; | ||
| 924 | - $i(onde).innerHTML = ins; | 917 | + if(arguments.length == 3) |
| 918 | + {funcao = "";} | ||
| 919 | + if (funcao != "") | ||
| 920 | + {funcao = "onchange='"+funcao+"'";} | ||
| 921 | + ins = "<select size=6 style='width:355px;font-size:12px; margin: 0px;' id='"+id+"' "+funcao+" >"; | ||
| 922 | + ins += core_comboObjeto(valores,"id_tema","nome_tema",marcar,"codigo_tema"); | ||
| 923 | + ins += "</select>"; | ||
| 924 | + $i(onde).innerHTML = ins; | ||
| 925 | } | 925 | } |
| 926 | catch(e){core_handleFailure(e,o.responseText);} | 926 | catch(e){core_handleFailure(e,o.responseText);} |
| 927 | }, | 927 | }, |
| @@ -941,7 +941,7 @@ Pega a lista de tags | @@ -941,7 +941,7 @@ Pega a lista de tags | ||
| 941 | Parameters: | 941 | Parameters: |
| 942 | 942 | ||
| 943 | funcao - (opcional) nome da funcao que será executada ao terminar a busca pelos dados | 943 | funcao - (opcional) nome da funcao que será executada ao terminar a busca pelos dados |
| 944 | -*/ | 944 | + */ |
| 945 | function core_pegaTags(funcao) | 945 | function core_pegaTags(funcao) |
| 946 | { | 946 | { |
| 947 | if(arguments.length == 0) | 947 | if(arguments.length == 0) |
| @@ -956,7 +956,7 @@ function core_pegaTags(funcao) | @@ -956,7 +956,7 @@ function core_pegaTags(funcao) | ||
| 956 | $tags = YAHOO.lang.JSON.parse(o.responseText); | 956 | $tags = YAHOO.lang.JSON.parse(o.responseText); |
| 957 | if($tags == ""){$tags = " ";} | 957 | if($tags == ""){$tags = " ";} |
| 958 | if(funcao != "") | 958 | if(funcao != "") |
| 959 | - eval(funcao); | 959 | + eval(funcao); |
| 960 | } | 960 | } |
| 961 | catch(e){core_handleFailure(e,o.responseText);} | 961 | catch(e){core_handleFailure(e,o.responseText);} |
| 962 | }, | 962 | }, |
| @@ -979,7 +979,7 @@ id - id do combo que ser&aacute; criado | @@ -979,7 +979,7 @@ id - id do combo que ser&aacute; criado | ||
| 979 | marcar - valor que será marcado como selecionado | 979 | marcar - valor que será marcado como selecionado |
| 980 | 980 | ||
| 981 | change - nome da função do evento onchange | 981 | change - nome da função do evento onchange |
| 982 | -*/ | 982 | + */ |
| 983 | function core_comboTags(onde,id,change) | 983 | function core_comboTags(onde,id,change) |
| 984 | { | 984 | { |
| 985 | if($tags == "") | 985 | if($tags == "") |
| @@ -1014,7 +1014,7 @@ key - chave (nome do item) (utilize "" para escapar) | @@ -1014,7 +1014,7 @@ key - chave (nome do item) (utilize "" para escapar) | ||
| 1014 | unico - sim|nao indicando se apenas um pode ser escolhido | 1014 | unico - sim|nao indicando se apenas um pode ser escolhido |
| 1015 | 1015 | ||
| 1016 | funcaoFinal - (opcional) funcao que sera executada no final do processo | 1016 | funcaoFinal - (opcional) funcao que sera executada no final do processo |
| 1017 | -*/ | 1017 | + */ |
| 1018 | function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,funcaoFinal){ | 1018 | function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,funcaoFinal){ |
| 1019 | if(!unico){ | 1019 | if(!unico){ |
| 1020 | unico = "nao"; | 1020 | unico = "nao"; |
| @@ -1059,14 +1059,14 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,f | @@ -1059,14 +1059,14 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,f | ||
| 1059 | ndiv.style.width = "100%"; | 1059 | ndiv.style.width = "100%"; |
| 1060 | ndiv.style.overflow = "auto"; | 1060 | ndiv.style.overflow = "auto"; |
| 1061 | ndiv.innerHTML = "<div id='core_botoesCabecalho' ></div><br>" + | 1061 | ndiv.innerHTML = "<div id='core_botoesCabecalho' ></div><br>" + |
| 1062 | - "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>"; | 1062 | + "<div id='core_menuCK_bd' style='background:white;text-align:left;border:1px solid gray'></div>"; |
| 1063 | novoel.appendChild(ndiv); | 1063 | novoel.appendChild(ndiv); |
| 1064 | document.body.appendChild(novoel); | 1064 | document.body.appendChild(novoel); |
| 1065 | og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_botoesCabecalho" }); | 1065 | og_core = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name:"okcancel_checkbox_id", container:"core_botoesCabecalho" }); |
| 1066 | og_core.addButtons([ | 1066 | og_core.addButtons([ |
| 1067 | - { label: "OK", value: "OK", checked: false}, | ||
| 1068 | - { label: "Fecha", value: "CANCEL", checked: false } | ||
| 1069 | - ]); | 1067 | + { label: "OK", value: "OK", checked: false}, |
| 1068 | + { label: "Fecha", value: "CANCEL", checked: false } | ||
| 1069 | + ]); | ||
| 1070 | og_core.on("checkedButtonChange", on_menuCheckBoxChange); | 1070 | og_core.on("checkedButtonChange", on_menuCheckBoxChange); |
| 1071 | YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:false,zindex:"100",close:false,underlay:false,width:"200px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } ); | 1071 | YAHOO.admin.container.panelCK = new YAHOO.widget.Panel("core_menuCK", { draggable:false,modal:false,zindex:"100",close:false,underlay:false,width:"200px", height:"158px",overflow:"auto", visible:false,constraintoviewport:false } ); |
| 1072 | YAHOO.admin.container.panelCK.render(); | 1072 | YAHOO.admin.container.panelCK.render(); |
| @@ -1080,7 +1080,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,f | @@ -1080,7 +1080,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,f | ||
| 1080 | ck = ""; | 1080 | ck = ""; |
| 1081 | for(j=0;j<selecionados.length;j++){ | 1081 | for(j=0;j<selecionados.length;j++){ |
| 1082 | if(selecionados[j] == valores[i]) | 1082 | if(selecionados[j] == valores[i]) |
| 1083 | - ck = "CHECKED"; | 1083 | + ck = "CHECKED"; |
| 1084 | } | 1084 | } |
| 1085 | if(unico === "nao"){ | 1085 | if(unico === "nao"){ |
| 1086 | ins.push("<input style='cursor:pointer;' type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); | 1086 | ins.push("<input style='cursor:pointer;' type=checkbox id='CK_"+valores[i]+"' value='"+valores[i]+"' "+ck+" />"+textos[i]+"<br>"); |
| @@ -1103,7 +1103,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,f | @@ -1103,7 +1103,7 @@ function core_menuCheckBox(valores,textos,selecionados,target,record,key,unico,f | ||
| 1103 | Function: core_combosimnao | 1103 | Function: core_combosimnao |
| 1104 | 1104 | ||
| 1105 | Retorna os itens option de um combo sim nao | 1105 | Retorna os itens option de um combo sim nao |
| 1106 | -*/ | 1106 | + */ |
| 1107 | function core_combosimnao(marcar) | 1107 | function core_combosimnao(marcar) |
| 1108 | { | 1108 | { |
| 1109 | var ins = "<option value='' "; | 1109 | var ins = "<option value='' "; |
| @@ -1121,7 +1121,7 @@ function core_combosimnao(marcar) | @@ -1121,7 +1121,7 @@ function core_combosimnao(marcar) | ||
| 1121 | Function: core_comboObjeto | 1121 | Function: core_comboObjeto |
| 1122 | 1122 | ||
| 1123 | Retorna os itens option de um combo baseado em um objeto json | 1123 | Retorna os itens option de um combo baseado em um objeto json |
| 1124 | -*/ | 1124 | + */ |
| 1125 | function core_comboObjeto(obj,valor,texto,marcar,texto2,texto3) | 1125 | function core_comboObjeto(obj,valor,texto,marcar,texto2,texto3) |
| 1126 | { | 1126 | { |
| 1127 | var ins = "<option value='' "; | 1127 | var ins = "<option value='' "; |
| @@ -1166,7 +1166,7 @@ Gera campos de formul&aacute;rio | @@ -1166,7 +1166,7 @@ Gera campos de formul&aacute;rio | ||
| 1166 | Parameters: | 1166 | Parameters: |
| 1167 | 1167 | ||
| 1168 | dados - objeto no formato {"linhas":[{titulo:"Nome do tema:",size:"50",id:"Enome_tema",value:i.nome_tema,tipo:"text",div:""}]} | 1168 | dados - objeto no formato {"linhas":[{titulo:"Nome do tema:",size:"50",id:"Enome_tema",value:i.nome_tema,tipo:"text",div:""}]} |
| 1169 | -*/ | 1169 | + */ |
| 1170 | function core_geraLinhas(dados) | 1170 | function core_geraLinhas(dados) |
| 1171 | { | 1171 | { |
| 1172 | var nparam = dados.linhas.length; | 1172 | var nparam = dados.linhas.length; |
| @@ -1174,7 +1174,7 @@ function core_geraLinhas(dados) | @@ -1174,7 +1174,7 @@ function core_geraLinhas(dados) | ||
| 1174 | var resultado = ""; | 1174 | var resultado = ""; |
| 1175 | core_geralinhasEscondeAjuda = function(id){ | 1175 | core_geralinhasEscondeAjuda = function(id){ |
| 1176 | var a = $i(id+"_ajuda"), | 1176 | var a = $i(id+"_ajuda"), |
| 1177 | - i = $i(id+"_imgajuda"); | 1177 | + i = $i(id+"_imgajuda"); |
| 1178 | 1178 | ||
| 1179 | if(a.style.display == "block"){ | 1179 | if(a.style.display == "block"){ |
| 1180 | a.style.display = "none"; | 1180 | a.style.display = "none"; |
| @@ -1254,7 +1254,7 @@ sUrl - url com o programa que ser&aacute; executado no servidor | @@ -1254,7 +1254,7 @@ sUrl - url com o programa que ser&aacute; executado no servidor | ||
| 1254 | idBotao - id do elemento com o botão | 1254 | idBotao - id do elemento com o botão |
| 1255 | 1255 | ||
| 1256 | nomeFuncao - nome da função que será executada ao concluir a adição da linha | 1256 | nomeFuncao - nome da função que será executada ao concluir a adição da linha |
| 1257 | -*/ | 1257 | + */ |
| 1258 | function core_ativaBotaoAdicionaLinha(sUrl,idBotao,nomeFuncao) | 1258 | function core_ativaBotaoAdicionaLinha(sUrl,idBotao,nomeFuncao) |
| 1259 | { | 1259 | { |
| 1260 | if(arguments.length == 1){ | 1260 | if(arguments.length == 1){ |
| @@ -1267,32 +1267,32 @@ function core_ativaBotaoAdicionaLinha(sUrl,idBotao,nomeFuncao) | @@ -1267,32 +1267,32 @@ function core_ativaBotaoAdicionaLinha(sUrl,idBotao,nomeFuncao) | ||
| 1267 | core_carregando("ativa"); | 1267 | core_carregando("ativa"); |
| 1268 | core_carregando(" adicionando um novo registro"); | 1268 | core_carregando(" adicionando um novo registro"); |
| 1269 | var callback = { | 1269 | var callback = { |
| 1270 | - success:function(o){ | ||
| 1271 | - var texto = ""; | ||
| 1272 | - try{ | ||
| 1273 | - core_carregando("desativa"); | ||
| 1274 | - if(nomeFuncao != ""){ | ||
| 1275 | - if(YAHOO.lang.isFunction(nomeFuncao)){ | ||
| 1276 | - nomeFuncao.call(o); | 1270 | + success:function(o){ |
| 1271 | + var texto = ""; | ||
| 1272 | + try{ | ||
| 1273 | + core_carregando("desativa"); | ||
| 1274 | + if(nomeFuncao != ""){ | ||
| 1275 | + if(YAHOO.lang.isFunction(nomeFuncao)){ | ||
| 1276 | + nomeFuncao.call(o); | ||
| 1277 | + } | ||
| 1278 | + else{ | ||
| 1279 | + eval(nomeFuncao+"()"); | ||
| 1280 | + } | ||
| 1277 | } | 1281 | } |
| 1278 | else{ | 1282 | else{ |
| 1279 | - eval(nomeFuncao+"()"); | 1283 | + texto = YAHOO.lang.JSON.parse(o.responseText)[0]; |
| 1284 | + if(texto === ""){ | ||
| 1285 | + texto = "Clique para editar"; | ||
| 1286 | + } | ||
| 1287 | + myDataTable.addRow(texto,0); | ||
| 1280 | } | 1288 | } |
| 1281 | } | 1289 | } |
| 1282 | - else{ | ||
| 1283 | - texto = YAHOO.lang.JSON.parse(o.responseText)[0]; | ||
| 1284 | - if(texto === ""){ | ||
| 1285 | - texto = "Clique para editar"; | ||
| 1286 | - } | ||
| 1287 | - myDataTable.addRow(texto,0); | 1290 | + catch(e){ |
| 1291 | + core_handleFailure(e,o.responseText); | ||
| 1288 | } | 1292 | } |
| 1289 | - } | ||
| 1290 | - catch(e){ | ||
| 1291 | - core_handleFailure(e,o.responseText); | ||
| 1292 | - } | ||
| 1293 | - }, | ||
| 1294 | - failure:core_handleFailure, | ||
| 1295 | - argument: { foo:"foo", bar:"bar" } | 1293 | + }, |
| 1294 | + failure:core_handleFailure, | ||
| 1295 | + argument: { foo:"foo", bar:"bar" } | ||
| 1296 | }; | 1296 | }; |
| 1297 | core_makeRequest(sUrl,callback); | 1297 | core_makeRequest(sUrl,callback); |
| 1298 | }; | 1298 | }; |
| @@ -1312,11 +1312,11 @@ mensagem - mensagem que ser&aacute; mostrada na tela | @@ -1312,11 +1312,11 @@ mensagem - mensagem que ser&aacute; mostrada na tela | ||
| 1312 | sUrl - url do programa que será executado no servidor | 1312 | sUrl - url do programa que será executado no servidor |
| 1313 | 1313 | ||
| 1314 | funcaoRetorno - funcao que será executada ao terminar a busca pelos dados | 1314 | funcaoRetorno - funcao que será executada ao terminar a busca pelos dados |
| 1315 | -*/ | 1315 | + */ |
| 1316 | function core_pegaDados(mensagem,sUrl,funcaoRetorno) | 1316 | function core_pegaDados(mensagem,sUrl,funcaoRetorno) |
| 1317 | { | 1317 | { |
| 1318 | if("mensagem" != "") | 1318 | if("mensagem" != "") |
| 1319 | - core_carregando(mensagem); | 1319 | + core_carregando(mensagem); |
| 1320 | var callback = | 1320 | var callback = |
| 1321 | { | 1321 | { |
| 1322 | success:function(o) | 1322 | success:function(o) |
| @@ -1361,33 +1361,33 @@ row - objeto row que foi clicado pelo usu&aacute;rio. Utilizado para se obter os | @@ -1361,33 +1361,33 @@ row - objeto row que foi clicado pelo usu&aacute;rio. Utilizado para se obter os | ||
| 1361 | sUrl - url do programa que será executado | 1361 | sUrl - url do programa que será executado |
| 1362 | 1362 | ||
| 1363 | nomeFuncao - nome da funcao que sera executada apos gravar os dados (opcional) | 1363 | nomeFuncao - nome da funcao que sera executada apos gravar os dados (opcional) |
| 1364 | -*/ | 1364 | + */ |
| 1365 | function core_gravaLinha(mensagem,row,sUrl,nomeFuncao) | 1365 | function core_gravaLinha(mensagem,row,sUrl,nomeFuncao) |
| 1366 | { | 1366 | { |
| 1367 | core_carregando("ativa"); | 1367 | core_carregando("ativa"); |
| 1368 | core_carregando(mensagem); | 1368 | core_carregando(mensagem); |
| 1369 | if(arguments.length < 4) | 1369 | if(arguments.length < 4) |
| 1370 | - nomeFuncao = ""; | 1370 | + nomeFuncao = ""; |
| 1371 | var callback = | 1371 | var callback = |
| 1372 | { | 1372 | { |
| 1373 | success:function(o) | 1373 | success:function(o) |
| 1374 | { | 1374 | { |
| 1375 | - core_carregando("desativa"); | ||
| 1376 | - var rec = myDataTable.getRecordSet().getRecord(row); | ||
| 1377 | - var linha = myDataTable.getTrEl(rec); | ||
| 1378 | - if(nomeFuncao != "") | ||
| 1379 | - { | ||
| 1380 | - eval(nomeFuncao+"()"); | ||
| 1381 | - try | ||
| 1382 | - {myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]);} | ||
| 1383 | - catch(e){} | ||
| 1384 | - } | ||
| 1385 | - else | ||
| 1386 | - { | ||
| 1387 | - myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]); | 1375 | + core_carregando("desativa"); |
| 1376 | + var rec = myDataTable.getRecordSet().getRecord(row); | ||
| 1377 | + var linha = myDataTable.getTrEl(rec); | ||
| 1378 | + if(nomeFuncao != "") | ||
| 1379 | + { | ||
| 1380 | + eval(nomeFuncao+"()"); | ||
| 1381 | + try | ||
| 1382 | + {myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]);} | ||
| 1383 | + catch(e){} | ||
| 1388 | } | 1384 | } |
| 1389 | - linha.style.color = ""; | ||
| 1390 | - linha.style.textDecoration = "none"; | 1385 | + else |
| 1386 | + { | ||
| 1387 | + myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]); | ||
| 1388 | + } | ||
| 1389 | + linha.style.color = ""; | ||
| 1390 | + linha.style.textDecoration = "none"; | ||
| 1391 | }, | 1391 | }, |
| 1392 | failure:core_handleFailure, | 1392 | failure:core_handleFailure, |
| 1393 | argument: { foo:"foo", bar:"bar" } | 1393 | argument: { foo:"foo", bar:"bar" } |
| @@ -1408,7 +1408,7 @@ sUrl - url do programa que ser&aacute; executado | @@ -1408,7 +1408,7 @@ sUrl - url do programa que ser&aacute; executado | ||
| 1408 | row - objeto row de um datatable | 1408 | row - objeto row de um datatable |
| 1409 | 1409 | ||
| 1410 | mensagem - | 1410 | mensagem - |
| 1411 | -*/ | 1411 | + */ |
| 1412 | function core_excluiLinha(sUrl,row,mensagem,cabecalho,tabela) | 1412 | function core_excluiLinha(sUrl,row,mensagem,cabecalho,tabela) |
| 1413 | { | 1413 | { |
| 1414 | if(!cabecalho){ | 1414 | if(!cabecalho){ |
| @@ -1471,7 +1471,7 @@ sUrl - url do programa que ser&aacute; executado | @@ -1471,7 +1471,7 @@ sUrl - url do programa que ser&aacute; executado | ||
| 1471 | no - objeto no de um treeview | 1471 | no - objeto no de um treeview |
| 1472 | 1472 | ||
| 1473 | mensagem - | 1473 | mensagem - |
| 1474 | -*/ | 1474 | + */ |
| 1475 | function core_excluiNoTree(sUrl,no,mensagem,cabecalho) | 1475 | function core_excluiNoTree(sUrl,no,mensagem,cabecalho) |
| 1476 | { | 1476 | { |
| 1477 | if(!cabecalho){ | 1477 | if(!cabecalho){ |
| @@ -1497,11 +1497,11 @@ function core_excluiNoTree(sUrl,no,mensagem,cabecalho) | @@ -1497,11 +1497,11 @@ function core_excluiNoTree(sUrl,no,mensagem,cabecalho) | ||
| 1497 | } | 1497 | } |
| 1498 | else | 1498 | else |
| 1499 | { | 1499 | { |
| 1500 | - if(no){ | ||
| 1501 | - tree.removeNode(no); | ||
| 1502 | - tree.draw(); | 1500 | + if(no){ |
| 1501 | + tree.removeNode(no); | ||
| 1502 | + tree.draw(); | ||
| 1503 | } | 1503 | } |
| 1504 | - core_carregando("desativa"); | 1504 | + core_carregando("desativa"); |
| 1505 | } | 1505 | } |
| 1506 | } | 1506 | } |
| 1507 | catch(e){core_handleFailure(o,o.responseText);} | 1507 | catch(e){core_handleFailure(o,o.responseText);} |
| @@ -1539,7 +1539,7 @@ modal - boolean | @@ -1539,7 +1539,7 @@ modal - boolean | ||
| 1539 | bsalva - boolean botao salvar | 1539 | bsalva - boolean botao salvar |
| 1540 | 1540 | ||
| 1541 | bcancela - boolean botao cancelar | 1541 | bcancela - boolean botao cancelar |
| 1542 | -*/ | 1542 | + */ |
| 1543 | function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | 1543 | function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) |
| 1544 | { | 1544 | { |
| 1545 | if(!funcaoOK){ | 1545 | if(!funcaoOK){ |
| @@ -1569,13 +1569,13 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | @@ -1569,13 +1569,13 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | ||
| 1569 | if(!$i("janela_editor")) | 1569 | if(!$i("janela_editor")) |
| 1570 | { | 1570 | { |
| 1571 | var ins = "", temp = "", lb, | 1571 | var ins = "", temp = "", lb, |
| 1572 | - salvai = "<input id=okcancel_checkboxOK type='buttom' value='Salva' />", | ||
| 1573 | - cancelai = "<input id=okcancel_checkboxCANCEL type='buttom' value='Cancela' />", | ||
| 1574 | - novoel = document.createElement("div"); | 1572 | + salvai = "<input id=okcancel_checkboxOK type='buttom' value='Salva' />", |
| 1573 | + cancelai = "<input id=okcancel_checkboxCANCEL type='buttom' value='Cancela' />", | ||
| 1574 | + novoel = document.createElement("div"); | ||
| 1575 | novoel.id = "janela_editor"; | 1575 | novoel.id = "janela_editor"; |
| 1576 | ins = '<div class="hd"><div id="okcancel_checkbox" ></div></div>' + | 1576 | ins = '<div class="hd"><div id="okcancel_checkbox" ></div></div>' + |
| 1577 | - "<div class='bd' style='height:"+h+";overflow:auto'>" + | ||
| 1578 | - "<div id='editor_bd'></div>"; | 1577 | + "<div class='bd' style='height:"+h+";overflow:auto'>" + |
| 1578 | + "<div id='editor_bd'></div>"; | ||
| 1579 | novoel.innerHTML = ins; | 1579 | novoel.innerHTML = ins; |
| 1580 | document.body.appendChild(novoel); | 1580 | document.body.appendChild(novoel); |
| 1581 | if(funcaoOK != "") | 1581 | if(funcaoOK != "") |
| @@ -1590,15 +1590,15 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | @@ -1590,15 +1590,15 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | ||
| 1590 | lb.innerHTML = temp + '<span style="margin-left:10px;position:relative;top:-5px">'+titulo+'</span>'; | 1590 | lb.innerHTML = temp + '<span style="margin-left:10px;position:relative;top:-5px">'+titulo+'</span>'; |
| 1591 | if(bsalva === true){ | 1591 | if(bsalva === true){ |
| 1592 | new YAHOO.widget.Button( | 1592 | new YAHOO.widget.Button( |
| 1593 | - "okcancel_checkboxOK", | ||
| 1594 | - {onclick:{fn: function(){ | ||
| 1595 | - if(YAHOO.lang.isFunction(funcaoOK)){ | ||
| 1596 | - funcaoOK.call(); | ||
| 1597 | - } | ||
| 1598 | - else{ | ||
| 1599 | - eval(funcaoOK); | ||
| 1600 | - } | ||
| 1601 | - }}} | 1593 | + "okcancel_checkboxOK", |
| 1594 | + {onclick:{fn: function(){ | ||
| 1595 | + if(YAHOO.lang.isFunction(funcaoOK)){ | ||
| 1596 | + funcaoOK.call(); | ||
| 1597 | + } | ||
| 1598 | + else{ | ||
| 1599 | + eval(funcaoOK); | ||
| 1600 | + } | ||
| 1601 | + }}} | ||
| 1602 | ); | 1602 | ); |
| 1603 | var temp = $i("okcancel_checkbox"); | 1603 | var temp = $i("okcancel_checkbox"); |
| 1604 | temp.style.top = "2px"; | 1604 | temp.style.top = "2px"; |
| @@ -1608,11 +1608,11 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | @@ -1608,11 +1608,11 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | ||
| 1608 | } | 1608 | } |
| 1609 | if(bcancela === true){ | 1609 | if(bcancela === true){ |
| 1610 | new YAHOO.widget.Button( | 1610 | new YAHOO.widget.Button( |
| 1611 | - "okcancel_checkboxCANCEL", | ||
| 1612 | - {onclick:{fn: function(){ | ||
| 1613 | - YAHOO.admin.container.panelEditor.destroy(); | ||
| 1614 | - YAHOO.admin.container.panelEditor = null; | ||
| 1615 | - }}} | 1611 | + "okcancel_checkboxCANCEL", |
| 1612 | + {onclick:{fn: function(){ | ||
| 1613 | + YAHOO.admin.container.panelEditor.destroy(); | ||
| 1614 | + YAHOO.admin.container.panelEditor = null; | ||
| 1615 | + }}} | ||
| 1616 | ); | 1616 | ); |
| 1617 | } | 1617 | } |
| 1618 | } | 1618 | } |
| @@ -1653,7 +1653,7 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | @@ -1653,7 +1653,7 @@ function core_montaEditor(funcaoOK,w,h,funcaoClose,titulo,modal,bsalva,bcancela) | ||
| 1653 | Function idiomaSel | 1653 | Function idiomaSel |
| 1654 | 1654 | ||
| 1655 | Retorna o idioma selecionado pesquisando no elemento select com id = "idioma" | 1655 | Retorna o idioma selecionado pesquisando no elemento select com id = "idioma" |
| 1656 | -*/ | 1656 | + */ |
| 1657 | function idiomaSel(){ | 1657 | function idiomaSel(){ |
| 1658 | var idioma = "pt"; | 1658 | var idioma = "pt"; |
| 1659 | if($i("idioma")) | 1659 | if($i("idioma")) |
| @@ -1671,7 +1671,7 @@ function core_abreCor(janela,elemento) | @@ -1671,7 +1671,7 @@ function core_abreCor(janela,elemento) | ||
| 1671 | } | 1671 | } |
| 1672 | function core_desativaforms(lista){ | 1672 | function core_desativaforms(lista){ |
| 1673 | var n = lista.length, | 1673 | var n = lista.length, |
| 1674 | - i,t; | 1674 | + i,t; |
| 1675 | for (i=0;i<n;i++){ | 1675 | for (i=0;i<n;i++){ |
| 1676 | t = $i(lista[i]); | 1676 | t = $i(lista[i]); |
| 1677 | if(t){ | 1677 | if(t){ |
| @@ -1682,7 +1682,7 @@ function core_desativaforms(lista){ | @@ -1682,7 +1682,7 @@ function core_desativaforms(lista){ | ||
| 1682 | } | 1682 | } |
| 1683 | function core_ativaforms(lista){ | 1683 | function core_ativaforms(lista){ |
| 1684 | var n = lista.length, | 1684 | var n = lista.length, |
| 1685 | - i,t; | 1685 | + i,t; |
| 1686 | for (i=0;i<n;i++){ | 1686 | for (i=0;i<n;i++){ |
| 1687 | t = $i(lista[i]); | 1687 | t = $i(lista[i]); |
| 1688 | if(t){ | 1688 | if(t){ |
| @@ -1701,7 +1701,7 @@ function core_filtraLetrasCombo(id,letra){ | @@ -1701,7 +1701,7 @@ function core_filtraLetrasCombo(id,letra){ | ||
| 1701 | $i("iniciaisLetras").value = letra; | 1701 | $i("iniciaisLetras").value = letra; |
| 1702 | } | 1702 | } |
| 1703 | var combo = $i(id), | 1703 | var combo = $i(id), |
| 1704 | - n, i, o, v; | 1704 | + n, i, o, v; |
| 1705 | if(combo){ | 1705 | if(combo){ |
| 1706 | o = combo.options; | 1706 | o = combo.options; |
| 1707 | n = o.length; | 1707 | n = o.length; |
| @@ -1722,8 +1722,8 @@ function core_listaDeLetras(onde,nomeFuncao,semLetras,w){ | @@ -1722,8 +1722,8 @@ function core_listaDeLetras(onde,nomeFuncao,semLetras,w){ | ||
| 1722 | w = 40; | 1722 | w = 40; |
| 1723 | } | 1723 | } |
| 1724 | var o,i,ins= "<p><b>", | 1724 | var o,i,ins= "<p><b>", |
| 1725 | - letras = ["Todos","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z","_","1","2","3","4","5","6","7","8","9"], | ||
| 1726 | - nletras = letras.length; | 1725 | + letras = ["Todos","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z","_","1","2","3","4","5","6","7","8","9"], |
| 1726 | + nletras = letras.length; | ||
| 1727 | if(!i3GEO.util){ | 1727 | if(!i3GEO.util){ |
| 1728 | alert("Erro i3GEO.util ???"); | 1728 | alert("Erro i3GEO.util ???"); |
| 1729 | return; | 1729 | return; |
| @@ -1735,9 +1735,9 @@ function core_listaDeLetras(onde,nomeFuncao,semLetras,w){ | @@ -1735,9 +1735,9 @@ function core_listaDeLetras(onde,nomeFuncao,semLetras,w){ | ||
| 1735 | if(!semLetras){ | 1735 | if(!semLetras){ |
| 1736 | for (i = 0; i < nletras; i++) { | 1736 | for (i = 0; i < nletras; i++) { |
| 1737 | ins += "<span onclick='"+nomeFuncao+"(\"" | 1737 | ins += "<span onclick='"+nomeFuncao+"(\"" |
| 1738 | - + letras[i] | ||
| 1739 | - + "\")' style='color:blue;cursor:pointer;padding:1px;border: 1px solid #C8C8FA'>" | ||
| 1740 | - + letras[i] + "</span> "; | 1738 | + + letras[i] |
| 1739 | + + "\")' style='color:blue;cursor:pointer;padding:1px;border: 1px solid #C8C8FA'>" | ||
| 1740 | + + letras[i] + "</span> "; | ||
| 1741 | } | 1741 | } |
| 1742 | } | 1742 | } |
| 1743 | else{ | 1743 | else{ |
admin1/js/usuarios.js
| @@ -1,380 +0,0 @@ | @@ -1,380 +0,0 @@ | ||
| 1 | -/* | ||
| 2 | -Title: usuarios.js | ||
| 3 | - | ||
| 4 | -Funções que controlam o cadastro de usuarios | ||
| 5 | - | ||
| 6 | -Licenca: | ||
| 7 | - | ||
| 8 | -GPL2 | ||
| 9 | - | ||
| 10 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | ||
| 11 | - | ||
| 12 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | ||
| 13 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | ||
| 14 | - | ||
| 15 | -Este programa é software livre; você pode redistribuí-lo | ||
| 16 | -e/ou modificá-lo sob os termos da Licença Pública Geral | ||
| 17 | -GNU conforme publicada pela Free Software Foundation; | ||
| 18 | - | ||
| 19 | -Este programa é distribuído na expectativa de que seja útil, | ||
| 20 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | ||
| 21 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | ||
| 22 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | ||
| 23 | -Você deve ter recebido uma cópia da Licença Pública Geral do | ||
| 24 | -GNU junto com este programa; se não, escreva para a | ||
| 25 | -Free Software Foundation, Inc., no endereço | ||
| 26 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | ||
| 27 | - | ||
| 28 | -Arquivo: | ||
| 29 | - | ||
| 30 | -i3geo/admin/js/usuarios.js | ||
| 31 | -*/ | ||
| 32 | -YAHOO.namespace("admin.container"); | ||
| 33 | -/* | ||
| 34 | -Function: initMenu | ||
| 35 | - | ||
| 36 | -Inicializa o editor | ||
| 37 | -*/ | ||
| 38 | -function initMenu(){ | ||
| 39 | - ativaBotaoAdicionaUsuario("../php/usuarios.php?funcao=alterarUsuarios","adiciona"); | ||
| 40 | - core_carregando("ativa"); | ||
| 41 | - core_ativaPainelAjuda("ajuda","botaoAjuda"); | ||
| 42 | - pegaUsuarios(); | ||
| 43 | -} | ||
| 44 | -function ativaBotaoAdicionaUsuario(sUrl,idBotao){ | ||
| 45 | - var botao, adiciona = function() | ||
| 46 | - { | ||
| 47 | - core_carregando("ativa"); | ||
| 48 | - core_carregando($trad("msgNovoRegistro",i3GEOadmin.core.dicionario)); | ||
| 49 | - var callback = | ||
| 50 | - { | ||
| 51 | - success:function(o) | ||
| 52 | - { | ||
| 53 | - try | ||
| 54 | - { | ||
| 55 | - var j = YAHOO.lang.JSON.parse(o.responseText); | ||
| 56 | - adicionaNosUsuarios(j,true); | ||
| 57 | - editar("usuarios",j[j.length-1].id_usuario); | ||
| 58 | - core_carregando("desativa"); | ||
| 59 | - } | ||
| 60 | - catch(e){core_handleFailure(e,o.responseText);} | ||
| 61 | - }, | ||
| 62 | - failure:core_handleFailure, | ||
| 63 | - argument: { foo:"foo", bar:"bar" } | ||
| 64 | - }; | ||
| 65 | - core_makeRequest(sUrl,callback); | ||
| 66 | - }; | ||
| 67 | - //cria o botão de adição de um novo menu | ||
| 68 | - botao = new YAHOO.widget.Button(idBotao,{ onclick: { fn: adiciona } }); | ||
| 69 | - botao.addClass("rodar"); | ||
| 70 | -} | ||
| 71 | -/* | ||
| 72 | -Function: pegaOperacoes | ||
| 73 | - | ||
| 74 | -Obtém a lista de operacoes | ||
| 75 | - | ||
| 76 | -<PEGAOPERACOES> | ||
| 77 | -*/ | ||
| 78 | -function pegaUsuarios(){ | ||
| 79 | - core_pegaDados($trad("msgBuscaUsuario",i3GEOadmin.usuarios.dicionario),"../php/usuarios.php?funcao=pegaUsuarios","montaArvore"); | ||
| 80 | -} | ||
| 81 | -/* | ||
| 82 | -Function: montaArvore | ||
| 83 | - | ||
| 84 | -Monta a árvore de edição | ||
| 85 | - | ||
| 86 | -<PEGAPRANCHAS> | ||
| 87 | -*/ | ||
| 88 | -function montaArvore(dados){ | ||
| 89 | - YAHOO.example.treeExample = new function() | ||
| 90 | - { | ||
| 91 | - tree = ""; | ||
| 92 | - function changeIconMode() | ||
| 93 | - { | ||
| 94 | - buildTree(); | ||
| 95 | - } | ||
| 96 | - function loadNodeData(node, fnLoadComplete){ | ||
| 97 | - var sUrl = "../php/usuarios.php?funcao=pegaPapeisUsuario&id_usuario="+node.data.id_usuario; | ||
| 98 | - var callback = { | ||
| 99 | - success: function(oResponse){ | ||
| 100 | - var dados = YAHOO.lang.JSON.parse(oResponse.responseText); | ||
| 101 | - adicionaNosPapeis(node,dados,false); | ||
| 102 | - oResponse.argument.fnLoadComplete(); | ||
| 103 | - }, | ||
| 104 | - failure: function(oResponse){ | ||
| 105 | - oResponse.argument.fnLoadComplete(); | ||
| 106 | - }, | ||
| 107 | - argument:{ | ||
| 108 | - "node": node, | ||
| 109 | - "fnLoadComplete": fnLoadComplete | ||
| 110 | - }, | ||
| 111 | - timeout: 25000 | ||
| 112 | - }; | ||
| 113 | - YAHOO.util.Connect.asyncRequest('GET', sUrl, callback); | ||
| 114 | - } | ||
| 115 | - function buildTree(){ | ||
| 116 | - tree = new YAHOO.widget.TreeView("tabela"); | ||
| 117 | - tree.setDynamicLoad(loadNodeData, 1); | ||
| 118 | - var root = tree.getRoot(); | ||
| 119 | - var tempNode = new YAHOO.widget.TextNode('', root, false); | ||
| 120 | - tempNode.isLeaf = true; | ||
| 121 | - tempNode.enableHighlight = false; | ||
| 122 | - core_carregando("desativa"); | ||
| 123 | - } | ||
| 124 | - buildTree(); | ||
| 125 | - }(); | ||
| 126 | - adicionaNosUsuarios(dados); | ||
| 127 | - tree.draw(); | ||
| 128 | -} | ||
| 129 | -/* | ||
| 130 | -Function: adicionaNosPapeis | ||
| 131 | - | ||
| 132 | -Mostra os nos de uma operacao | ||
| 133 | - | ||
| 134 | -<PEGATEMAS> | ||
| 135 | -*/ | ||
| 136 | -function adicionaNosPapeis(no,dados,redesenha) | ||
| 137 | -{ | ||
| 138 | - function temaIconMode() | ||
| 139 | - { | ||
| 140 | - var newVal = parseInt(this.value); | ||
| 141 | - if (newVal != currentIconMode) | ||
| 142 | - {currentIconMode = newVal;} | ||
| 143 | - } | ||
| 144 | - if(!redesenha) | ||
| 145 | - { | ||
| 146 | - var conteudo = "<span style=\"cursor:pointer;\" onclick=\"editar('papel','"+no.data.id_usuario+"')\" ><img style=\"position:relative;top:2px\" src=\"../imagens/05.png\" /><i>"+ $trad("novoPapel",i3GEOadmin.usuarios.dicionario) +"</i></span>"; | ||
| 147 | - var d = {html:conteudo}; | ||
| 148 | - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); | ||
| 149 | - tempNode.isLeaf = true; | ||
| 150 | - tempNode.enableHighlight = false; | ||
| 151 | - } | ||
| 152 | - for (var i=0, j=dados.length; i<j; i++) | ||
| 153 | - { | ||
| 154 | - if(!tree.getNodeByProperty("id_nopapel",dados[i].id_usuario+"_"+dados[i].id_papel)){ | ||
| 155 | - var conteudo = " <img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluir('papel','"+dados[i].id_usuario+"','"+dados[i].id_papel+"')\" title="+ $trad("excluir",i3GEOadmin.core.dicionario) +" width='10px' heigth='10px' src=\"../imagens/01.png\" />"; | ||
| 156 | - if(dados[i].nome != "") | ||
| 157 | - {conteudo += " <span><b>"+dados[i].nome+"</b> - "+dados[i].descricao+"</span>";} | ||
| 158 | - else | ||
| 159 | - {conteudo += " <span style=color:red >"+ $trad("definePapel",i3GEOadmin.usuarios.dicionario) +"</span>";} | ||
| 160 | - var d = {html:conteudo,id_nopapel:dados[i].id_usuario+"_"+dados[i].id_papel,tipo:"papel"}; | ||
| 161 | - var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); | ||
| 162 | - tempNode.isLeaf = true; | ||
| 163 | - tempNode.enableHighlight = false; | ||
| 164 | - } | ||
| 165 | - } | ||
| 166 | - if(redesenha){tree.draw();} | ||
| 167 | -} | ||
| 168 | -function adicionaNosUsuarios(dados,redesenha){ | ||
| 169 | - var root = tree.getRoot(); | ||
| 170 | - for (var i=0, j=dados.length; i<j; i++){ | ||
| 171 | - var conteudo = " <img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"excluir('usuario','"+dados[i].id_usuario+"')\" title="+ $trad("excluir",i3GEOadmin.core.dicionario) +" width='10px' heigth='10px' src=\"../imagens/01.png\" />"; | ||
| 172 | - conteudo += " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editar('usuario','"+dados[i].id_usuario+"')\" title="+ $trad("editar",i3GEOadmin.core.dicionario) +"editar src=\"../imagens/06.png\" /><b>"; | ||
| 173 | - conteudo += " <img style=\"position:relative;cursor:pointer;top:0px;width:25px;\" onclick=\"emailsenha('"+dados[i].id_usuario+"')\" title='"+ $trad("enviaSenha",i3GEOadmin.usuarios.dicionario) +"' src=\"../imagens/07.png\" /><b>"; | ||
| 174 | - if(dados[i].nome_usuario && dados[i].nome_usuario != "") | ||
| 175 | - {conteudo += " <span>"+dados[i].nome_usuario+" - "+dados[i].login+" - ativo: "+dados[i].ativo+"</span>";} | ||
| 176 | - else | ||
| 177 | - {conteudo += " <span style=color:red >"+ $trad("defineUsuario",i3GEOadmin.usuarios.dicionario) +"</span>";} | ||
| 178 | - var d = {html:conteudo,id_usuario:dados[i].id_usuario,tipo:"usuario"}; | ||
| 179 | - var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true); | ||
| 180 | - tempNode.enableHighlight = false; | ||
| 181 | - } | ||
| 182 | - if(redesenha){tree.draw();} | ||
| 183 | -} | ||
| 184 | -/* | ||
| 185 | -Function: editar | ||
| 186 | - | ||
| 187 | -Abre o editor de um no | ||
| 188 | -*/ | ||
| 189 | -function editar(tipo,id) | ||
| 190 | -{ | ||
| 191 | - core_carregando("ativa"); | ||
| 192 | - core_carregando($trad("msgBuscaDados",i3GEOadmin.core.dicionario)); | ||
| 193 | - var sUrl = null; | ||
| 194 | - var callback = | ||
| 195 | - { | ||
| 196 | - success:function(o) | ||
| 197 | - { | ||
| 198 | - try | ||
| 199 | - { | ||
| 200 | - if(tipo == "usuario") | ||
| 201 | - { | ||
| 202 | - var dados = YAHOO.lang.JSON.parse(o.responseText)[0]; | ||
| 203 | - montaDivUsuario(dados); | ||
| 204 | - core_carregando("desativa"); | ||
| 205 | - } | ||
| 206 | - if(tipo == "papel") | ||
| 207 | - { | ||
| 208 | - var dados = YAHOO.lang.JSON.parse(o.responseText); | ||
| 209 | - core_montaEditor("gravaDados('papel','"+id+"')","250px","100px","","Papel",true,true,false); | ||
| 210 | - $i("editor_bd").innerHTML = montaDivPapel(dados); | ||
| 211 | - document.getElementById("Eid_papel").style.width = "200px"; | ||
| 212 | - core_carregando("desativa"); | ||
| 213 | - } | ||
| 214 | - core_carregando("desativa"); | ||
| 215 | - } | ||
| 216 | - catch(e){core_handleFailure(e,o.responseText);} | ||
| 217 | - }, | ||
| 218 | - failure:core_handleFailure, | ||
| 219 | - argument: { foo:"foo", bar:"bar" } | ||
| 220 | - }; | ||
| 221 | - if(tipo == "usuario") | ||
| 222 | - {sUrl = "../php/usuarios.php?funcao=pegaDadosUsuario&id_usuario="+id;} | ||
| 223 | - if(tipo == "papel") | ||
| 224 | - {sUrl = "../php/usuarios.php?funcao=listaPapeis";} | ||
| 225 | - if(sUrl) | ||
| 226 | - {core_makeRequest(sUrl,callback);} | ||
| 227 | -} | ||
| 228 | -function montaDivUsuario(i){ | ||
| 229 | - var temp = function(){ | ||
| 230 | - gravaDados('usuario',i.id_usuario); | ||
| 231 | - }; | ||
| 232 | - core_montaEditor(temp,"450px","380px","",$trad("usuario",i3GEOadmin.usuarios.dicionario),true,true,false); | ||
| 233 | - var param = { | ||
| 234 | - "linhas":[ | ||
| 235 | - {titulo:$trad("nome2",i3GEOadmin.core.dicionario),id:"Enome_usuario",size:"50",value:i.nome_usuario,tipo:"text",div:""}, | ||
| 236 | - {titulo:"Login:",id:"Elogin",size:"50",value:i.login,tipo:"text",div:""}, | ||
| 237 | - {ajuda:$trad("msgUsuario",i3GEOadmin.usuarios.dicionario),titulo:$trad("novaSenha",i3GEOadmin.usuarios.dicionario),id:"Esenha",size:"50",value:"",tipo:"text",div:""}, | ||
| 238 | - {titulo:"E-mail:",id:"Eemail",size:"50",value:i.email,tipo:"text",div:""}, | ||
| 239 | - {titulo:$trad("dataCadastro",i3GEOadmin.usuarios.dicionario),id:"Edata_cadastro",size:"50",value:i.data_cadastro,tipo:"text",div:""}, | ||
| 240 | - {titulo:$trad("ativo",i3GEOadmin.usuarios.dicionario),id:"",size:"50",value:i.ativo,tipo:"text",div:"<div id=cAtivo ></div>"} | ||
| 241 | - ] | ||
| 242 | - }; | ||
| 243 | - var ins = ""; | ||
| 244 | - ins += core_geraLinhas(param); | ||
| 245 | - ins += "<br><br><br>"; | ||
| 246 | - $i("editor_bd").innerHTML = ins; | ||
| 247 | - if($i("cAtivo")){ | ||
| 248 | - temp = "<div class='styled-select'><select id='Eativo' >"; | ||
| 249 | - temp += "<option value='1' >"+ $trad("sim2",i3GEOadmin.core.dicionario) +"</option>"; | ||
| 250 | - temp += "<option value='0' >"+ $trad("nao2",i3GEOadmin.core.dicionario) +"</option>"; | ||
| 251 | - temp += "</select></div>"; | ||
| 252 | - $i("cAtivo").innerHTML = temp; | ||
| 253 | - $i("Eativo").value = i.ativo; | ||
| 254 | - } | ||
| 255 | -} | ||
| 256 | -function montaDivPapel(dados){ | ||
| 257 | - var ins = "<div class='styled-select'><select id='Eid_papel' >"; | ||
| 258 | - ins += core_comboObjeto(dados,"id_papel","nome","","descricao"); | ||
| 259 | - ins += "</select></div>"; | ||
| 260 | - return(ins); | ||
| 261 | -} | ||
| 262 | -/* | ||
| 263 | -Function: excluir | ||
| 264 | - | ||
| 265 | -Exclui um elemento do atlas | ||
| 266 | - | ||
| 267 | -<EXCLUIRATLAS> | ||
| 268 | - | ||
| 269 | -<EXCLUIRPRANCHA> | ||
| 270 | - | ||
| 271 | -<EXCLUIRTEMA> | ||
| 272 | -*/ | ||
| 273 | -function excluir(tipo,id_usuario,id_papel) | ||
| 274 | -{ | ||
| 275 | - var mensagem = $trad("msgExcluiUsuario",i3GEOadmin.usuarios.dicionario)+id_usuario; | ||
| 276 | - var no = null; | ||
| 277 | - var sUrl = null; | ||
| 278 | - if(tipo == "usuario") { | ||
| 279 | - no = tree.getNodeByProperty("id_usuario",id_usuario); | ||
| 280 | - sUrl = "../php/usuarios.php?funcao=excluirUsuario&id_usuario="+id_usuario; | ||
| 281 | - } | ||
| 282 | - if(tipo == "papel") { | ||
| 283 | - no = tree.getNodeByProperty("id_nopapel",id_usuario+"_"+id_papel); | ||
| 284 | - sUrl = "../php/usuarios.php?funcao=excluirPapelUsuario&id_papel="+id_papel+"&id_usuario="+id_usuario; | ||
| 285 | - } | ||
| 286 | - if(sUrl) | ||
| 287 | - {core_excluiNoTree(sUrl,no,mensagem);} | ||
| 288 | -} | ||
| 289 | -/* | ||
| 290 | -Function: emailsenha | ||
| 291 | - | ||
| 292 | -Enviar senha por email | ||
| 293 | -*/ | ||
| 294 | -function emailsenha(id_usuario) | ||
| 295 | -{ | ||
| 296 | - var callback = { | ||
| 297 | - success:function(o){ | ||
| 298 | - try { | ||
| 299 | - if(YAHOO.lang.JSON.parse(o.responseText) == "erro") { | ||
| 300 | - core_carregando("<span style=color:red >"+ $trad("msgNaoEnvia",i3GEOadmin.usuarios.dicionario) +""); | ||
| 301 | - setTimeout("core_carregando('desativa')",3000); | ||
| 302 | - } | ||
| 303 | - else{ | ||
| 304 | - core_carregando("desativa"); | ||
| 305 | - } | ||
| 306 | - } | ||
| 307 | - catch(e){core_handleFailure(e,o.responseText);} | ||
| 308 | - }, | ||
| 309 | - failure:core_handleFailure, | ||
| 310 | - argument: { foo:"foo", bar:"bar" } | ||
| 311 | - }; | ||
| 312 | - core_carregando("ativa"); | ||
| 313 | - core_carregando($trad("msgEnvia",i3GEOadmin.usuarios.dicionario)); | ||
| 314 | - var sUrl = "../php/usuarios.php?funcao=enviarSenhaEmail&id_usuario="+id_usuario; | ||
| 315 | - core_makeRequest(sUrl,callback,'POST'); | ||
| 316 | -} | ||
| 317 | -/* | ||
| 318 | -Function: gravaDados | ||
| 319 | - | ||
| 320 | -Altera dados de um elemento do cadastro | ||
| 321 | - | ||
| 322 | -<ALTERARATLAS> | ||
| 323 | - | ||
| 324 | -<ALTERARPRANCHA> | ||
| 325 | - | ||
| 326 | -<ALTERARTEMA> | ||
| 327 | -*/ | ||
| 328 | -function gravaDados(tipo,id) | ||
| 329 | -{ | ||
| 330 | - var campos = null; | ||
| 331 | - var par = null; | ||
| 332 | - var prog = null; | ||
| 333 | - if(tipo == "usuario"){ | ||
| 334 | - campos = ["nome_usuario","login","senha","data_cadastro","email","ativo"]; | ||
| 335 | - par = "&id_usuario="+id; | ||
| 336 | - prog = "../php/usuarios.php?funcao=alterarUsuarios"; | ||
| 337 | - } | ||
| 338 | - if(tipo == "papel"){ | ||
| 339 | - campos = ["id_papel"]; | ||
| 340 | - par = "&id_usuario="+id; | ||
| 341 | - prog = "../php/usuarios.php?funcao=adicionaPapelUsuario"; | ||
| 342 | - } | ||
| 343 | - for (var i=0;i<campos.length;i++) | ||
| 344 | - {par += "&"+campos[i]+"="+($i("E"+campos[i]).value);} | ||
| 345 | - | ||
| 346 | - var callback = { | ||
| 347 | - success:function(o){ | ||
| 348 | - try { | ||
| 349 | - if(YAHOO.lang.JSON.parse(o.responseText) == "erro") { | ||
| 350 | - core_carregando("<span style=color:red >"+ $trad("msgNaoExclui",i3GEOadmin.usuarios.dicionario) +"</span>"); | ||
| 351 | - setTimeout("core_carregando('desativa')",3000); | ||
| 352 | - } | ||
| 353 | - else{ | ||
| 354 | - if(tipo == "usuario"){ | ||
| 355 | - var no = tree.getNodeByProperty("id_usuario",id); | ||
| 356 | - no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Enome_usuario").value+" "+document.getElementById("Elogin").value+" ativo: "+document.getElementById("Eativo").value; | ||
| 357 | - no.getContentEl().getElementsByTagName("span")[0].style.color = ""; | ||
| 358 | - no.html = no.getContentEl().innerHTML; | ||
| 359 | - } | ||
| 360 | - if(tipo == "papel"){ | ||
| 361 | - var no = tree.getNodeByProperty("id_usuario",id); | ||
| 362 | - adicionaNosPapeis(no,YAHOO.lang.JSON.parse(o.responseText),true); | ||
| 363 | - } | ||
| 364 | - core_carregando("desativa"); | ||
| 365 | - } | ||
| 366 | - YAHOO.admin.container.panelEditor.destroy(); | ||
| 367 | - YAHOO.admin.container.panelEditor = null; | ||
| 368 | - } | ||
| 369 | - catch(e){core_handleFailure(e,o.responseText);} | ||
| 370 | - }, | ||
| 371 | - failure:core_handleFailure, | ||
| 372 | - argument: { foo:"foo", bar:"bar" } | ||
| 373 | - }; | ||
| 374 | - if(prog && par){ | ||
| 375 | - core_carregando("ativa"); | ||
| 376 | - core_carregando($trad("gravaId",i3GEOadmin.core.dicionario)+id); | ||
| 377 | - var sUrl = prog+par; | ||
| 378 | - core_makeRequest(sUrl,callback,'POST'); | ||
| 379 | - } | ||
| 380 | -} |
admin1/usuarios/cadastro/index.js
| @@ -22,252 +22,240 @@ Free Software Foundation, Inc., no endere&ccedil;o | @@ -22,252 +22,240 @@ Free Software Foundation, Inc., no endere&ccedil;o | ||
| 22 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 22 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
| 23 | 23 | ||
| 24 | */ | 24 | */ |
| 25 | - | ||
| 26 | -function init(onde){ | ||
| 27 | - //variavel global indicando o elemento que recebera a lista de usuarios | ||
| 28 | - ondeListaUsuarios = onde; | ||
| 29 | - //conteudo html do formulario de adicao de operacao | ||
| 30 | - formAdicionaUsuario = ""; | ||
| 31 | - pegaUsuarios(); | ||
| 32 | -} | ||
| 33 | -/* | 25 | +i3GEOadmin.usuarios = { |
| 26 | + //variavel global indicando o elemento que recebera a lista de usuarios | ||
| 27 | + ondeListaUsuarios: "", | ||
| 28 | + //conteudo html do formulario de adicao de operacao | ||
| 29 | + formAdicionaUsuario: "", | ||
| 30 | + init: function(onde){ | ||
| 31 | + i3GEOadmin.usuarios.ondeListaUsuarios = onde; | ||
| 32 | + i3GEOadmin.usuarios.pegaUsuarios(); | ||
| 33 | + }, | ||
| 34 | + /* | ||
| 34 | Function: pegaUsuarios | 35 | Function: pegaUsuarios |
| 35 | 36 | ||
| 36 | Obtém a lista de usuarios | 37 | Obtém a lista de usuarios |
| 37 | - */ | ||
| 38 | -function pegaUsuarios(){ | ||
| 39 | - iconeAguarde(ondeListaUsuarios); | ||
| 40 | - $.post( | ||
| 41 | - "exec.php?funcao=pegaUsuariosEpapeis" | ||
| 42 | - ) | ||
| 43 | - .done( | ||
| 44 | - function(data, status){ | ||
| 45 | - //valor do filtro atual | ||
| 46 | - var filtro = valorFiltro(); | ||
| 47 | - //objeto json com os dados viondos do banco | ||
| 48 | - var json = jQuery.parseJSON(data); | ||
| 49 | - //template dos checkbox | ||
| 50 | - var templatePapeis = $("#templateInputPapeis").html(); | ||
| 51 | - //template do form de cada operacao | ||
| 52 | - var templateUsuarios = $("#templateUsuarios").html(); | ||
| 53 | - //lista todas as usuarios | ||
| 54 | - var html = Mustache.to_html( | ||
| 55 | - "{{#data}}" + templateUsuarios + "{{/data}}", | ||
| 56 | - { | ||
| 57 | - "data": json["usuarios"], | ||
| 58 | - "excluir": $trad("excluir",i3GEOadmin.core.dicionario), | ||
| 59 | - "onExcluir": "excluirUsuarioDialogo",//funcao | ||
| 60 | - "salvar": $trad("salva",i3GEOadmin.core.dicionario), | ||
| 61 | - "onSalvar": "salvarUsuarioDialogo",//funcao | ||
| 62 | - "enviaSenha": $trad("enviaSenha",i3GEOadmin.usuarios.dicionario), | ||
| 63 | - "onEnviarSenha": "EnviarSenha",//funcao | ||
| 64 | - "usuario": $trad("usuario",i3GEOadmin.usuarios.dicionario), | ||
| 65 | - "nome": $trad("nome",i3GEOadmin.usuarios.dicionario), | ||
| 66 | - "labelDataCadastro": $trad("dataCadastro",i3GEOadmin.usuarios.dicionario), | ||
| 67 | - "labelAtivo": $trad("ativo",i3GEOadmin.usuarios.dicionario), | ||
| 68 | - "labelNovaSenha": $trad("novaSenha",i3GEOadmin.usuarios.dicionario), | ||
| 69 | - "papeisv": $trad("papeisv",i3GEOadmin.usuarios.dicionario), | ||
| 70 | - "sim": $trad("sim",i3GEOadmin.usuarios.dicionario), | ||
| 71 | - "nao": $trad("nao",i3GEOadmin.usuarios.dicionario), | ||
| 72 | - "selAtivoSim": function(){ | ||
| 73 | - var p = this.ativo; | ||
| 74 | - if(p == "0"){ | ||
| 75 | - return ""; | ||
| 76 | - } else { | ||
| 77 | - return "selected"; | ||
| 78 | - } | ||
| 79 | - }, | ||
| 80 | - "selAtivoNao": function(){ | ||
| 81 | - var p = this.ativo; | ||
| 82 | - if(p == "0"){ | ||
| 83 | - return "selected"; | ||
| 84 | - } else { | ||
| 85 | - return ""; | ||
| 86 | - } | ||
| 87 | - }, | ||
| 88 | - "inputPapeis": function(){ | ||
| 89 | - //marca os checkbox | ||
| 90 | - var p = this.papeis; | ||
| 91 | - $(json["papeis"]).each( | ||
| 92 | - function(i,el){ | ||
| 93 | - if(p && el.id_papel && (p[el.id_papel] || el.id_papel == 1)){ | ||
| 94 | - json["papeis"][i]["checked"] = "checked"; | ||
| 95 | - } | ||
| 96 | - else{ | ||
| 97 | - json["papeis"][i]["checked"] = ""; | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - ); | ||
| 101 | - return Mustache.to_html( | ||
| 102 | - "{{#data}}" + templatePapeis + "{{/data}}", | 38 | + */ |
| 39 | + pegaUsuarios: function(){ | ||
| 40 | + i3GEOadmin.core.iconeAguarde(i3GEOadmin.usuarios.ondeListaUsuarios); | ||
| 41 | + $.post( | ||
| 42 | + "exec.php?funcao=pegaUsuariosEpapeis" | ||
| 43 | + ) | ||
| 44 | + .done( | ||
| 45 | + function(data, status){ | ||
| 46 | + //valor do filtro atual | ||
| 47 | + var filtro = i3GEOadmin.usuarios.valorFiltro(); | ||
| 48 | + //objeto json com os dados viondos do banco | ||
| 49 | + var json = jQuery.parseJSON(data); | ||
| 50 | + //template dos checkbox | ||
| 51 | + var templatePapeis = $("#templateInputPapeis").html(); | ||
| 52 | + //template do form de cada operacao | ||
| 53 | + var templateUsuarios = $("#templateUsuarios").html(); | ||
| 54 | + //lista todas as usuarios | ||
| 55 | + var html = Mustache.to_html( | ||
| 56 | + "{{#data}}" + templateUsuarios + "{{/data}}", | ||
| 57 | + $.extend( | ||
| 58 | + i3GEOadmin.usuarios.dicionario, | ||
| 103 | { | 59 | { |
| 104 | - "data":json["papeis"] | 60 | + "data": json["usuarios"], |
| 61 | + "onExcluir": "i3GEOadmin.usuarios.excluirUsuarioDialogo",//funcao | ||
| 62 | + "onSalvar": "i3GEOadmin.usuarios.salvarUsuarioDialogo",//funcao | ||
| 63 | + "labelDataCadastro": i3GEOadmin.usuarios.dicionario.dataCadastro, | ||
| 64 | + "labelAtivo": i3GEOadmin.usuarios.dicionario.ativo, | ||
| 65 | + "labelNovaSenha": i3GEOadmin.usuarios.dicionario.novaSenha, | ||
| 66 | + "selAtivoSim": function(){ | ||
| 67 | + var p = this.ativo; | ||
| 68 | + if(p == "0"){ | ||
| 69 | + return ""; | ||
| 70 | + } else { | ||
| 71 | + return "selected"; | ||
| 72 | + } | ||
| 73 | + }, | ||
| 74 | + "selAtivoNao": function(){ | ||
| 75 | + var p = this.ativo; | ||
| 76 | + if(p == "0"){ | ||
| 77 | + return "selected"; | ||
| 78 | + } else { | ||
| 79 | + return ""; | ||
| 80 | + } | ||
| 81 | + }, | ||
| 82 | + "inputPapeis": function(){ | ||
| 83 | + //marca os checkbox | ||
| 84 | + var p = this.papeis; | ||
| 85 | + $(json["papeis"]).each( | ||
| 86 | + function(i,el){ | ||
| 87 | + if(p && el.id_papel && (p[el.id_papel] || el.id_papel == 1)){ | ||
| 88 | + json["papeis"][i]["checked"] = "checked"; | ||
| 89 | + } | ||
| 90 | + else{ | ||
| 91 | + json["papeis"][i]["checked"] = ""; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + ); | ||
| 95 | + return Mustache.to_html( | ||
| 96 | + "{{#data}}" + templatePapeis + "{{/data}}", | ||
| 97 | + { | ||
| 98 | + "data":json["papeis"] | ||
| 99 | + } | ||
| 100 | + ); | ||
| 101 | + } | ||
| 105 | } | 102 | } |
| 106 | - ); | ||
| 107 | - } | 103 | + ) |
| 104 | + ); | ||
| 105 | + i3GEOadmin.usuarios.ondeListaUsuarios.html(html); | ||
| 106 | + //filtro | ||
| 107 | + html = Mustache.to_html( | ||
| 108 | + "{{#data}}" + $("#templateFiltro").html() + "{{/data}}", | ||
| 109 | + {"data":json["usuarios"]} | ||
| 110 | + ); | ||
| 111 | + $("#filtro").html("<option value='' >---</option>" + html); | ||
| 112 | + if(filtro != ""){ | ||
| 113 | + i3GEOadmin.usuarios.defineFiltro(filtro); | ||
| 114 | + i3GEOadmin.usuarios.filtra(i3GEOadmin.usuarios.pegaFiltro()); | ||
| 108 | } | 115 | } |
| 109 | - ); | ||
| 110 | - ondeListaUsuarios.html(html); | ||
| 111 | - //filtro | ||
| 112 | - html = Mustache.to_html( | ||
| 113 | - "{{#data}}" + $("#templateFiltro").html() + "{{/data}}", | ||
| 114 | - {"data":json["usuarios"]} | ||
| 115 | - ); | ||
| 116 | - $("#filtro").html("<option value='' >---</option>" + html); | ||
| 117 | - if(filtro != ""){ | ||
| 118 | - defineFiltro(filtro); | ||
| 119 | - filtra(pegaFiltro()); | ||
| 120 | - } | ||
| 121 | - //monta um template para o modal de inclusao de novo usuario | ||
| 122 | - html = Mustache.to_html( | ||
| 123 | - $("#templateUsuarios").html(), | ||
| 124 | - { | ||
| 125 | - "id_usuario": "modal", | ||
| 126 | - "enviaSenha": $trad("enviaSenha",i3GEOadmin.usuarios.dicionario), | ||
| 127 | - "excluir": $trad("cancelar",i3GEOadmin.core.dicionario), | ||
| 128 | - "onExcluir": "fechaModalGeral",//funcao | ||
| 129 | - "salvar": $trad("salva",i3GEOadmin.core.dicionario), | ||
| 130 | - "onSalvar": "adicionaUsuario",//funcao | ||
| 131 | - "usuario": $trad("usuario",i3GEOadmin.usuarios.dicionario), | ||
| 132 | - "nome": $trad("nome",i3GEOadmin.usuarios.dicionario), | ||
| 133 | - "labelDataCadastro": $trad("dataCadastro",i3GEOadmin.usuarios.dicionario), | ||
| 134 | - "labelAtivo": $trad("ativo",i3GEOadmin.usuarios.dicionario), | ||
| 135 | - "labelNovaSenha": $trad("novaSenha",i3GEOadmin.usuarios.dicionario), | ||
| 136 | - "papeisv": $trad("papeisv",i3GEOadmin.usuarios.dicionario), | ||
| 137 | - "sim": $trad("sim",i3GEOadmin.usuarios.dicionario), | ||
| 138 | - "nao": $trad("nao",i3GEOadmin.usuarios.dicionario), | ||
| 139 | - "inputPapeis": function(){ | ||
| 140 | - return Mustache.to_html( | ||
| 141 | - "{{#data}}" + $("#templateInputPapeis").html() + "{{/data}}", | 116 | + //monta um template para o modal de inclusao de novo usuario |
| 117 | + html = Mustache.to_html( | ||
| 118 | + $("#templateUsuarios").html(), | ||
| 119 | + $.extend( | ||
| 120 | + i3GEOadmin.usuarios.dicionario, | ||
| 142 | { | 121 | { |
| 143 | - "data":json["papeis"] | 122 | + "id_usuario": "modal", |
| 123 | + "excluir": i3GEOadmin.usuarios.dicionario.cancelar, | ||
| 124 | + "onExcluir": "i3GEOadmin.core.fechaModalGeral",//funcao | ||
| 125 | + "onSalvar": "i3GEOadmin.usuarios.adicionaUsuario",//funcao | ||
| 126 | + "labelDataCadastro": i3GEOadmin.usuarios.dicionario.dataCadastro, | ||
| 127 | + "labelAtivo": i3GEOadmin.usuarios.dicionario.ativo, | ||
| 128 | + "labelNovaSenha": i3GEOadmin.usuarios.dicionario.novaSenha, | ||
| 129 | + "inputPapeis": function(){ | ||
| 130 | + return Mustache.to_html( | ||
| 131 | + "{{#data}}" + $("#templateInputPapeis").html() + "{{/data}}", | ||
| 132 | + { | ||
| 133 | + "data":json["papeis"] | ||
| 134 | + } | ||
| 135 | + ); | ||
| 136 | + } | ||
| 144 | } | 137 | } |
| 145 | - ); | ||
| 146 | - } | 138 | + ) |
| 139 | + ); | ||
| 140 | + i3GEOadmin.usuarios.formAdicionaUsuario = html; | ||
| 141 | + $.material.init(); | ||
| 142 | + } | ||
| 143 | + ) | ||
| 144 | + .fail(function(data){ | ||
| 145 | + i3GEOadmin.usuarios.ondeListaUsuarios.html(""); | ||
| 146 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 147 | + }); | ||
| 148 | + }, | ||
| 149 | + adicionaUsuarioDialogo: function(){ | ||
| 150 | + i3GEOadmin.core.abreModalGeral(i3GEOadmin.usuarios.formAdicionaUsuario); | ||
| 151 | + }, | ||
| 152 | +// os parametros sao obtidos do formulario aberto do modal | ||
| 153 | + adicionaUsuario: function(){ | ||
| 154 | + var parametros = $("#form-modal form").serialize(); | ||
| 155 | + i3GEOadmin.core.fechaModalGeral(); | ||
| 156 | + i3GEOadmin.core.modalAguarde(true); | ||
| 157 | + $.post( | ||
| 158 | + "exec.php?funcao=adicionarUsuario", | ||
| 159 | + parametros | ||
| 160 | + ) | ||
| 161 | + .done( | ||
| 162 | + function(data, status){ | ||
| 163 | + i3GEOadmin.core.modalAguarde(false); | ||
| 164 | + i3GEOadmin.core.iconeAguarde(ondeListaUsuarios); | ||
| 165 | + i3GEOadmin.usuarios.pegaUsuarios(); | ||
| 166 | + } | ||
| 167 | + ) | ||
| 168 | + .fail( | ||
| 169 | + function(data){ | ||
| 170 | + i3GEOadmin.core.modalAguarde(false); | ||
| 171 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 172 | + } | ||
| 173 | + ); | ||
| 174 | + }, | ||
| 175 | + excluirUsuarioDialogo: function(id_usuario){ | ||
| 176 | + var hash = { | ||
| 177 | + "mensagem": i3GEOadmin.usuarios.dicionario.confirma, | ||
| 178 | + "onBotao1": "i3GEOadmin.usuarios.excluirUsuario('"+id_usuario+"')", | ||
| 179 | + "botao1": i3GEOadmin.usuarios.dicionario.sim, | ||
| 180 | + "onBotao2": "i3GEOadmin.core.fechaModalConfirma();", | ||
| 181 | + "botao2": i3GEOadmin.usuarios.dicionario.nao | ||
| 182 | + }; | ||
| 183 | + i3GEOadmin.core.abreModalConfirma(hash); | ||
| 184 | + }, | ||
| 185 | + excluirUsuario: function(id_usuario){ | ||
| 186 | + i3GEOadmin.core.modalAguarde(true); | ||
| 187 | + $.post( | ||
| 188 | + "exec.php?funcao=excluirUsuario", | ||
| 189 | + "id_usuario="+id_usuario | ||
| 190 | + ) | ||
| 191 | + .done( | ||
| 192 | + function(data, status){ | ||
| 193 | + i3GEOadmin.core.modalAguarde(false); | ||
| 194 | + var json = jQuery.parseJSON(data)*1; | ||
| 195 | + $("#form-" + json).remove(); | ||
| 196 | + } | ||
| 197 | + ) | ||
| 198 | + .fail( | ||
| 199 | + function(data){ | ||
| 200 | + i3GEOadmin.core.modalAguarde(false); | ||
| 201 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 202 | + } | ||
| 203 | + ); | ||
| 204 | + }, | ||
| 205 | + salvarUsuarioDialogo: function(id_usuario){ | ||
| 206 | + var hash = { | ||
| 207 | + "mensagem": i3GEOadmin.usuarios.dicionario.confirma, | ||
| 208 | + "onBotao1": "i3GEOadmin.usuarios.salvarUsuario('"+id_usuario+"')", | ||
| 209 | + "botao1": i3GEOadmin.usuarios.dicionario.sim, | ||
| 210 | + "onBotao2": "i3GEOadmin.core.fechaModalConfirma();", | ||
| 211 | + "botao2": i3GEOadmin.usuarios.dicionario.nao | ||
| 212 | + }; | ||
| 213 | + i3GEOadmin.core.abreModalConfirma(hash); | ||
| 214 | + }, | ||
| 215 | + salvarUsuario: function(id_usuario){ | ||
| 216 | + var parametros = $("#form-" + id_usuario + " form").serialize(); | ||
| 217 | + i3GEOadmin.core.fechaModalGeral(); | ||
| 218 | + i3GEOadmin.core.modalAguarde(true); | ||
| 219 | + $.post( | ||
| 220 | + "exec.php?funcao=alterarUsuario", | ||
| 221 | + "id_usuario="+ id_usuario+"&"+parametros | ||
| 222 | + ) | ||
| 223 | + .done( | ||
| 224 | + function(data, status){ | ||
| 225 | + i3GEOadmin.core.modalAguarde(false); | ||
| 226 | + i3GEOadmin.core.iconeAguarde(ondeListaUsuarios); | ||
| 227 | + i3GEOadmin.usuarios.pegaUsuarios(); | ||
| 228 | + } | ||
| 229 | + ) | ||
| 230 | + .fail( | ||
| 231 | + function(data){ | ||
| 232 | + i3GEOadmin.core.modalAguarde(false); | ||
| 233 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 234 | + } | ||
| 235 | + ); | ||
| 236 | + }, | ||
| 237 | + pegaFiltro: function(){ | ||
| 238 | + return $i("filtro"); | ||
| 239 | + }, | ||
| 240 | + valorFiltro: function(){ | ||
| 241 | + return i3GEOadmin.usuarios.pegaFiltro().value; | ||
| 242 | + }, | ||
| 243 | + defineFiltro: function(valor){ | ||
| 244 | + i3GEOadmin.usuarios.pegaFiltro().value = valor; | ||
| 245 | + }, | ||
| 246 | + filtra: function(obj){ | ||
| 247 | + $("#corpo .panel").each( | ||
| 248 | + function(i,el){ | ||
| 249 | + if(obj.value == ""){ | ||
| 250 | + $(el).show(); | ||
| 147 | } | 251 | } |
| 148 | - ); | ||
| 149 | - formAdicionaUsuario = html; | ||
| 150 | - $.material.init(); | ||
| 151 | - } | ||
| 152 | - ) | ||
| 153 | - .fail(function(data){ | ||
| 154 | - ondeListaUsuarios.html(""); | ||
| 155 | - mostraErro(data.status + " " +data.statusText); | ||
| 156 | - }); | ||
| 157 | -} | ||
| 158 | -function adicionaUsuarioDialogo(){ | ||
| 159 | - abreModalGeral(formAdicionaUsuario); | ||
| 160 | -} | ||
| 161 | - | ||
| 162 | -//os parametros sao obtidos do formulario aberto do modal | ||
| 163 | - | ||
| 164 | -function adicionaUsuario(){ | ||
| 165 | - var parametros = $("#form-modal form").serialize(); | ||
| 166 | - fechaModalGeral(); | ||
| 167 | - modalAguarde(true); | ||
| 168 | - $.post( | ||
| 169 | - "exec.php?funcao=adicionarUsuario", | ||
| 170 | - parametros | ||
| 171 | - ) | ||
| 172 | - .done( | ||
| 173 | - function(data, status){ | ||
| 174 | - modalAguarde(false); | ||
| 175 | - iconeAguarde(ondeListaUsuarios); | ||
| 176 | - pegaUsuarios(); | ||
| 177 | - } | ||
| 178 | - ) | ||
| 179 | - .fail( | ||
| 180 | - function(data){ | ||
| 181 | - modalAguarde(false); | ||
| 182 | - mostraErro(data.status + " " +data.statusText); | ||
| 183 | - } | ||
| 184 | - ); | ||
| 185 | -} | ||
| 186 | -function excluirUsuarioDialogo(id_usuario){ | ||
| 187 | - var hash = { | ||
| 188 | - "mensagem": $trad("confirma",i3GEOadmin.core.dicionario), | ||
| 189 | - "onBotao1": "excluirUsuario('"+id_usuario+"')", | ||
| 190 | - "botao1": $trad("sim",i3GEOadmin.core.dicionario), | ||
| 191 | - "onBotao2": "fechaModalConfirma();", | ||
| 192 | - "botao2": $trad("nao",i3GEOadmin.core.dicionario) | ||
| 193 | - }; | ||
| 194 | - abreModalConfirma(hash); | ||
| 195 | -} | ||
| 196 | -function excluirUsuario(id_usuario){ | ||
| 197 | - modalAguarde(true); | ||
| 198 | - $.post( | ||
| 199 | - "exec.php?funcao=excluirUsuario", | ||
| 200 | - "id_usuario="+id_usuario | ||
| 201 | - ) | ||
| 202 | - .done( | ||
| 203 | - function(data, status){ | ||
| 204 | - modalAguarde(false); | ||
| 205 | - var json = jQuery.parseJSON(data)*1; | ||
| 206 | - $("#form-" + json).remove(); | ||
| 207 | - } | ||
| 208 | - ) | ||
| 209 | - .fail( | ||
| 210 | - function(data){ | ||
| 211 | - modalAguarde(false); | ||
| 212 | - mostraErro(data.status + " " +data.statusText); | ||
| 213 | - } | ||
| 214 | - ); | ||
| 215 | -} | ||
| 216 | -function salvarUsuarioDialogo(id_usuario){ | ||
| 217 | - var hash = { | ||
| 218 | - "mensagem": $trad("confirma",i3GEOadmin.core.dicionario), | ||
| 219 | - "onBotao1": "salvarUsuario('"+id_usuario+"')", | ||
| 220 | - "botao1": $trad("sim",i3GEOadmin.core.dicionario), | ||
| 221 | - "onBotao2": "fechaModalConfirma();", | ||
| 222 | - "botao2": $trad("nao",i3GEOadmin.core.dicionario) | ||
| 223 | - }; | ||
| 224 | - abreModalConfirma(hash); | ||
| 225 | -} | ||
| 226 | -function salvarUsuario(id_usuario){ | ||
| 227 | - var parametros = $("#form-" + id_usuario + " form").serialize(); | ||
| 228 | - fechaModalGeral(); | ||
| 229 | - modalAguarde(true); | ||
| 230 | - $.post( | ||
| 231 | - "exec.php?funcao=alterarUsuario", | ||
| 232 | - "id_usuario="+ id_usuario+"&"+parametros | ||
| 233 | - ) | ||
| 234 | - .done( | ||
| 235 | - function(data, status){ | ||
| 236 | - modalAguarde(false); | ||
| 237 | - iconeAguarde(ondeListaUsuarios); | ||
| 238 | - pegaUsuarios(); | ||
| 239 | - } | ||
| 240 | - ) | ||
| 241 | - .fail( | ||
| 242 | - function(data){ | ||
| 243 | - modalAguarde(false); | ||
| 244 | - mostraErro(data.status + " " +data.statusText); | ||
| 245 | - } | ||
| 246 | - ); | ||
| 247 | -} | ||
| 248 | -function pegaFiltro(){ | ||
| 249 | - return $i("filtro"); | ||
| 250 | -} | ||
| 251 | -function valorFiltro(){ | ||
| 252 | - return pegaFiltro().value; | ||
| 253 | -} | ||
| 254 | -function defineFiltro(valor){ | ||
| 255 | - pegaFiltro().value = valor; | ||
| 256 | -} | ||
| 257 | -function filtra(obj){ | ||
| 258 | - | ||
| 259 | - $("#corpo .panel").each( | ||
| 260 | - function(i,el){ | ||
| 261 | - if(obj.value == ""){ | ||
| 262 | - $(el).show(); | ||
| 263 | - } | ||
| 264 | - else { | ||
| 265 | - $(el).hide(); | ||
| 266 | - } | 252 | + else { |
| 253 | + $(el).hide(); | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + ); | ||
| 257 | + if(obj.value != ""){ | ||
| 258 | + $("#"+obj.value).show(); | ||
| 267 | } | 259 | } |
| 268 | - ); | ||
| 269 | - if(obj.value != ""){ | ||
| 270 | - $("#"+obj.value).show(); | ||
| 271 | - } | ||
| 272 | -} | ||
| 273 | - | 260 | + } |
| 261 | +}; | ||
| 274 | \ No newline at end of file | 262 | \ No newline at end of file |
admin1/usuarios/cadastro/index.php
| @@ -27,11 +27,11 @@ include "../../head.php"; | @@ -27,11 +27,11 @@ include "../../head.php"; | ||
| 27 | <!-- aqui entra o filtro --> | 27 | <!-- aqui entra o filtro --> |
| 28 | <div class="form-group"> | 28 | <div class="form-group"> |
| 29 | <label class="control-label">{{{filtro}}}</label> | 29 | <label class="control-label">{{{filtro}}}</label> |
| 30 | - <select onchange="filtra(this)" id="filtro" class="form-control input-lg"> | 30 | + <select onchange="i3GEOadmin.usuarios.filtra(this)" id="filtro" class="form-control input-lg"> |
| 31 | </select> | 31 | </select> |
| 32 | </div> | 32 | </div> |
| 33 | <div class="row pull-right"> | 33 | <div class="row pull-right"> |
| 34 | - <a onclick="adicionaUsuarioDialogo();" href="javascript:void(0)" class="btn btn-primary" role="button">{{{adicionar}}}</a> | 34 | + <a onclick="i3GEOadmin.usuarios.adicionaUsuarioDialogo();" href="javascript:void(0)" class="btn btn-primary" role="button">{{{adicionar}}}</a> |
| 35 | </div> | 35 | </div> |
| 36 | <div class="clearfix"></div> | 36 | <div class="clearfix"></div> |
| 37 | <!--Modal ajuda--> | 37 | <!--Modal ajuda--> |
| @@ -130,8 +130,8 @@ include "../../head.php"; | @@ -130,8 +130,8 @@ include "../../head.php"; | ||
| 130 | </label> | 130 | </label> |
| 131 | </div> | 131 | </div> |
| 132 | </script> | 132 | </script> |
| 133 | -<script type="text/javascript" src="../../dicionario/usuarios.js"></script> | ||
| 134 | <script type="text/javascript" src="index.js"></script> | 133 | <script type="text/javascript" src="index.js"></script> |
| 134 | +<script type="text/javascript" src="../../dicionario/usuarios.js"></script> | ||
| 135 | <script> | 135 | <script> |
| 136 | $(document).ready(function(){ | 136 | $(document).ready(function(){ |
| 137 | //vem de admin1/index.js | 137 | //vem de admin1/index.js |
| @@ -147,16 +147,32 @@ include "../../head.php"; | @@ -147,16 +147,32 @@ include "../../head.php"; | ||
| 147 | //complementa dicionario | 147 | //complementa dicionario |
| 148 | i3GEOadmin.usuarios.dicionario.adicionar = i3GEOadmin.core.dicionario.adicionar; | 148 | i3GEOadmin.usuarios.dicionario.adicionar = i3GEOadmin.core.dicionario.adicionar; |
| 149 | i3GEOadmin.usuarios.dicionario.filtro = i3GEOadmin.core.dicionario.filtro; | 149 | i3GEOadmin.usuarios.dicionario.filtro = i3GEOadmin.core.dicionario.filtro; |
| 150 | + i3GEOadmin.usuarios.dicionario.excluir = i3GEOadmin.core.dicionario.excluir; | ||
| 151 | + i3GEOadmin.usuarios.dicionario.salvar = i3GEOadmin.core.dicionario.salva; | ||
| 152 | + i3GEOadmin.usuarios.dicionario.enviaSenha = i3GEOadmin.usuarios.dicionario.enviaSenha; | ||
| 153 | + i3GEOadmin.usuarios.dicionario.usuario = i3GEOadmin.usuarios.dicionario.usuario; | ||
| 154 | + i3GEOadmin.usuarios.dicionario.nome = i3GEOadmin.usuarios.dicionario.nome; | ||
| 155 | + i3GEOadmin.usuarios.dicionario.papeisv = i3GEOadmin.usuarios.dicionario.papeisv; | ||
| 156 | + i3GEOadmin.usuarios.dicionario.sim = i3GEOadmin.core.dicionario.sim; | ||
| 157 | + i3GEOadmin.usuarios.dicionario.nao = i3GEOadmin.core.dicionario.nao; | ||
| 158 | + i3GEOadmin.usuarios.dicionario.cancelar = i3GEOadmin.core.dicionario.cancelar; | ||
| 159 | + i3GEOadmin.usuarios.dicionario.dataCadastro = i3GEOadmin.usuarios.dicionario.dataCadastro; | ||
| 160 | + i3GEOadmin.usuarios.dicionario.confirma = i3GEOadmin.core.dicionario.confirma; | ||
| 161 | + | ||
| 162 | + i3GEOadmin.core.dicionario = null; | ||
| 163 | + | ||
| 164 | + i3GEOadmin.usuarios.dicionario = i3GEO.idioma.objetoIdioma(i3GEOadmin.usuarios.dicionario); | ||
| 165 | + | ||
| 150 | t.html( | 166 | t.html( |
| 151 | Mustache.to_html( | 167 | Mustache.to_html( |
| 152 | t.html(), | 168 | t.html(), |
| 153 | - i3GEO.idioma.objetoIdioma(i3GEOadmin.usuarios.dicionario) | 169 | + i3GEOadmin.usuarios.dicionario |
| 154 | ) | 170 | ) |
| 155 | ); | 171 | ); |
| 156 | $.material.init(); | 172 | $.material.init(); |
| 157 | var inicia = function() { | 173 | var inicia = function() { |
| 158 | $(".hidden").removeClass('hidden'); | 174 | $(".hidden").removeClass('hidden'); |
| 159 | - init($("#corpo")); | 175 | + i3GEOadmin.usuarios.init($("#corpo")); |
| 160 | }; | 176 | }; |
| 161 | i3GEO.login.verificaOperacao("admin/html/usuarios",i3GEO.configura.locaplic, inicia, "sessao"); | 177 | i3GEO.login.verificaOperacao("admin/html/usuarios",i3GEO.configura.locaplic, inicia, "sessao"); |
| 162 | }); | 178 | }); |
admin1/usuarios/operacoes/index.js
| @@ -22,231 +22,230 @@ Free Software Foundation, Inc., no endere&ccedil;o | @@ -22,231 +22,230 @@ Free Software Foundation, Inc., no endere&ccedil;o | ||
| 22 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | 22 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
| 23 | 23 | ||
| 24 | */ | 24 | */ |
| 25 | -/* | 25 | + |
| 26 | +i3GEOadmin.operacoes = { | ||
| 27 | + //variavel global indicando o elemento que recebera a lista de operacoes | ||
| 28 | + ondeListaOperacoes: "", | ||
| 29 | + //conteudo html do formulario de adicao de operacao | ||
| 30 | + formAdicionaOperacao: "", | ||
| 31 | + /* | ||
| 26 | Function: initMenu | 32 | Function: initMenu |
| 27 | 33 | ||
| 28 | Inicializa o editor | 34 | Inicializa o editor |
| 29 | - */ | ||
| 30 | -function init(onde){ | ||
| 31 | - //variavel global indicando o elemento que recebera a lista de operacoes | ||
| 32 | - ondeListaOperacoes = onde; | ||
| 33 | - //conteudo html do formulario de adicao de operacao | ||
| 34 | - formAdicionaOperacao = ""; | ||
| 35 | - pegaOperacoes(); | ||
| 36 | -} | ||
| 37 | -/* | 35 | + */ |
| 36 | + init: function(onde){ | ||
| 37 | + i3GEOadmin.operacoes.ondeListaOperacoes = onde; | ||
| 38 | + i3GEOadmin.operacoes.pegaOperacoes(); | ||
| 39 | + }, | ||
| 40 | + /* | ||
| 38 | Function: pegaOperacoes | 41 | Function: pegaOperacoes |
| 39 | 42 | ||
| 40 | Obtém a lista de operacoes | 43 | Obtém a lista de operacoes |
| 41 | - */ | ||
| 42 | -function pegaOperacoes(){ | ||
| 43 | - iconeAguarde(ondeListaOperacoes); | ||
| 44 | - $.post( | ||
| 45 | - "exec.php?funcao=pegaOperacoesEpapeis" | ||
| 46 | - ) | ||
| 47 | - .done( | ||
| 48 | - function(data, status){ | ||
| 49 | - //valor do filtro atual | ||
| 50 | - var filtro = valorFiltro(); | ||
| 51 | - //objeto json com os dados viondos do banco | ||
| 52 | - var json = jQuery.parseJSON(data); | ||
| 53 | - //template dos checkbox | ||
| 54 | - var templatePapeis = $("#templateInputPapeis").html(); | ||
| 55 | - //template do form de cada operacao | ||
| 56 | - var templateOperacoes = $("#templateOperacoes").html(); | ||
| 57 | - //lista todas as operacoes | ||
| 58 | - var html = Mustache.to_html( | ||
| 59 | - "{{#data}}" + templateOperacoes + "{{/data}}", | ||
| 60 | - { | ||
| 61 | - "data":json["operacoes"], | ||
| 62 | - "excluir": $trad("excluir",i3GEOadmin.core.dicionario), | ||
| 63 | - "onExcluir": "excluirOperacaoDialogo",//funcao | ||
| 64 | - "salvar": $trad("salva",i3GEOadmin.core.dicionario), | ||
| 65 | - "onSalvar": "salvarOperacaoDialogo",//funcao | ||
| 66 | - "labelCodigo": $trad("codigo",i3GEOadmin.operacoes.dicionario), | ||
| 67 | - "labelDescricao": $trad("descricao",i3GEOadmin.operacoes.dicionario), | ||
| 68 | - "operacao": $trad("operacao",i3GEOadmin.operacoes.dicionario), | ||
| 69 | - "papeisv": $trad("papeisv",i3GEOadmin.operacoes.dicionario), | ||
| 70 | - "inputPapeis": function(){ | ||
| 71 | - //marca os checkbox | ||
| 72 | - var p = this.papeis; | ||
| 73 | - $(json["papeis"]).each( | ||
| 74 | - function(i,el){ | ||
| 75 | - if(p && el.id_papel && (p[el.id_papel] || el.id_papel == 1)){ | ||
| 76 | - json["papeis"][i]["checked"] = "checked"; | ||
| 77 | - } | ||
| 78 | - else{ | ||
| 79 | - json["papeis"][i]["checked"] = ""; | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | - ); | ||
| 83 | - return Mustache.to_html( | ||
| 84 | - "{{#data}}" + templatePapeis + "{{/data}}", | 44 | + */ |
| 45 | + pegaOperacoes: function(){ | ||
| 46 | + i3GEOadmin.core.iconeAguarde(i3GEOadmin.operacoes.ondeListaOperacoes); | ||
| 47 | + $.post( | ||
| 48 | + "exec.php?funcao=pegaOperacoesEpapeis" | ||
| 49 | + ) | ||
| 50 | + .done( | ||
| 51 | + function(data, status){ | ||
| 52 | + //valor do filtro atual | ||
| 53 | + var filtro = i3GEOadmin.operacoes.valorFiltro(); | ||
| 54 | + //objeto json com os dados viondos do banco | ||
| 55 | + var json = jQuery.parseJSON(data); | ||
| 56 | + //template dos checkbox | ||
| 57 | + var templatePapeis = $("#templateInputPapeis").html(); | ||
| 58 | + //template do form de cada operacao | ||
| 59 | + var templateOperacoes = $("#templateOperacoes").html(); | ||
| 60 | + //lista todas as operacoes | ||
| 61 | + var html = Mustache.to_html( | ||
| 62 | + "{{#data}}" + templateOperacoes + "{{/data}}", | ||
| 63 | + $.extend( | ||
| 64 | + i3GEOadmin.operacoes.dicionario, | ||
| 85 | { | 65 | { |
| 86 | - "data":json["papeis"] | 66 | + "data":json["operacoes"], |
| 67 | + "onExcluir": "i3GEOadmin.operacoes.excluirOperacaoDialogo",//funcao | ||
| 68 | + "onSalvar": "i3GEOadmin.operacoes.salvarOperacaoDialogo",//funcao | ||
| 69 | + "labelCodigo": i3GEOadmin.operacoes.dicionario.codigo, | ||
| 70 | + "labelDescricao": i3GEOadmin.operacoes.dicionario.descricao, | ||
| 71 | + "inputPapeis": function(){ | ||
| 72 | + //marca os checkbox | ||
| 73 | + var p = this.papeis; | ||
| 74 | + $(json["papeis"]).each( | ||
| 75 | + function(i,el){ | ||
| 76 | + if(p && el.id_papel && (p[el.id_papel] || el.id_papel == 1)){ | ||
| 77 | + json["papeis"][i]["checked"] = "checked"; | ||
| 78 | + } | ||
| 79 | + else{ | ||
| 80 | + json["papeis"][i]["checked"] = ""; | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + ); | ||
| 84 | + return Mustache.to_html( | ||
| 85 | + "{{#data}}" + templatePapeis + "{{/data}}", | ||
| 86 | + { | ||
| 87 | + "data":json["papeis"] | ||
| 88 | + } | ||
| 89 | + ); | ||
| 90 | + } | ||
| 87 | } | 91 | } |
| 88 | - ); | ||
| 89 | - } | 92 | + ) |
| 93 | + ); | ||
| 94 | + i3GEOadmin.operacoes.ondeListaOperacoes.html(html); | ||
| 95 | + //filtro | ||
| 96 | + html = Mustache.to_html( | ||
| 97 | + "{{#data}}" + $("#templateFiltro").html() + "{{/data}}", | ||
| 98 | + {"data":json["operacoes"]} | ||
| 99 | + ); | ||
| 100 | + $("#filtro").html("<option value='' >---</option>" + html); | ||
| 101 | + if(filtro != ""){ | ||
| 102 | + i3GEOadmin.operacoes.defineFiltro(filtro); | ||
| 103 | + i3GEOadmin.operacoes.filtra(pegaFiltro()); | ||
| 90 | } | 104 | } |
| 91 | - ); | ||
| 92 | - ondeListaOperacoes.html(html); | ||
| 93 | - //filtro | ||
| 94 | - html = Mustache.to_html( | ||
| 95 | - "{{#data}}" + $("#templateFiltro").html() + "{{/data}}", | ||
| 96 | - {"data":json["operacoes"]} | ||
| 97 | - ); | ||
| 98 | - $("#filtro").html("<option value='' >---</option>" + html); | ||
| 99 | - if(filtro != ""){ | ||
| 100 | - defineFiltro(filtro); | ||
| 101 | - filtra(pegaFiltro()); | ||
| 102 | - } | ||
| 103 | - //monta um template para o modal de inclusao de nova operacao | ||
| 104 | - html = Mustache.to_html( | ||
| 105 | - $("#templateOperacoes").html(), | ||
| 106 | - { | ||
| 107 | - "labelCodigo": $trad("codigo",i3GEOadmin.operacoes.dicionario), | ||
| 108 | - "labelDescricao": $trad("descricao",i3GEOadmin.operacoes.dicionario), | ||
| 109 | - "operacao": $trad("operacao",i3GEOadmin.operacoes.dicionario), | ||
| 110 | - "papeisv": $trad("papeisv",i3GEOadmin.operacoes.dicionario), | ||
| 111 | - "excluir": $trad("cancelar",i3GEOadmin.core.dicionario), | ||
| 112 | - "onExcluir": "fechaModalGeral",//funcao | ||
| 113 | - "salvar": $trad("salva",i3GEOadmin.core.dicionario), | ||
| 114 | - "onSalvar": "adicionaOperacao",//funcao | ||
| 115 | - "codigo": "", | ||
| 116 | - "id_operacao": "modal", | ||
| 117 | - "descricao": "", | ||
| 118 | - "inputPapeis": function(){ | ||
| 119 | - return Mustache.to_html( | ||
| 120 | - "{{#data}}" + $("#templateInputPapeis").html() + "{{/data}}", | 105 | + //monta um template para o modal de inclusao de nova operacao |
| 106 | + html = Mustache.to_html( | ||
| 107 | + $("#templateOperacoes").html(), | ||
| 108 | + $.extend( | ||
| 109 | + i3GEOadmin.operacoes.dicionario, | ||
| 121 | { | 110 | { |
| 122 | - "data":json["papeis"] | 111 | + "labelCodigo": $trad("codigo",i3GEOadmin.operacoes.dicionario), |
| 112 | + "labelDescricao": $trad("descricao",i3GEOadmin.operacoes.dicionario), | ||
| 113 | + "onExcluir": "i3GEOadmin.core.fechaModalGeral",//funcao | ||
| 114 | + "onSalvar": "i3GEOadmin.operacoes.adicionaOperacao",//funcao | ||
| 115 | + "codigo": "", | ||
| 116 | + "id_operacao": "modal", | ||
| 117 | + "descricao": "", | ||
| 118 | + "inputPapeis": function(){ | ||
| 119 | + return Mustache.to_html( | ||
| 120 | + "{{#data}}" + $("#templateInputPapeis").html() + "{{/data}}", | ||
| 121 | + { | ||
| 122 | + "data":json["papeis"] | ||
| 123 | + } | ||
| 124 | + ); | ||
| 125 | + } | ||
| 123 | } | 126 | } |
| 124 | - ); | ||
| 125 | - } | 127 | + ) |
| 128 | + ); | ||
| 129 | + i3GEOadmin.operacoes.formAdicionaOperacao = html; | ||
| 130 | + $.material.init(); | ||
| 131 | + } | ||
| 132 | + ) | ||
| 133 | + .fail(function(data){ | ||
| 134 | + i3GEOadmin.operacoes.ondeListaOperacoes.html(""); | ||
| 135 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 136 | + }); | ||
| 137 | + }, | ||
| 138 | + adicionaOperacaoDialogo: function(){ | ||
| 139 | + i3GEOadmin.core.abreModalGeral(i3GEOadmin.operacoes.formAdicionaOperacao); | ||
| 140 | + }, | ||
| 141 | +// os parametros sao obtidos do formulario aberto do modal | ||
| 142 | + adicionaOperacao: function(){ | ||
| 143 | + var parametros = $("#form-modal form").serialize(); | ||
| 144 | + i3GEOadmin.core.fechaModalGeral(); | ||
| 145 | + i3GEOadmin.core.modalAguarde(true); | ||
| 146 | + $.post( | ||
| 147 | + "exec.php?funcao=adicionarOperacao", | ||
| 148 | + parametros | ||
| 149 | + ) | ||
| 150 | + .done( | ||
| 151 | + function(data, status){ | ||
| 152 | + i3GEOadmin.core.modalAguarde(false); | ||
| 153 | + i3GEOadmin.core.iconeAguarde(i3GEOadmin.operacoes.ondeListaOperacoes); | ||
| 154 | + i3GEOadmin.operacoes.pegaOperacoes(); | ||
| 155 | + } | ||
| 156 | + ) | ||
| 157 | + .fail( | ||
| 158 | + function(data){ | ||
| 159 | + i3GEOadmin.core.modalAguarde(false); | ||
| 160 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 161 | + } | ||
| 162 | + ); | ||
| 163 | + }, | ||
| 164 | + excluirOperacaoDialogo: function(id_operacao){ | ||
| 165 | + var hash = { | ||
| 166 | + "mensagem": i3GEOadmin.operacoes.dicionario.confirma, | ||
| 167 | + "onBotao1": "i3GEOadmin.operacoes.excluirOperacao('"+id_operacao+"')", | ||
| 168 | + "botao1": i3GEOadmin.operacoes.dicionario.sim, | ||
| 169 | + "onBotao2": "i3GEOadmin.core.fechaModalConfirma();", | ||
| 170 | + "botao2": i3GEOadmin.operacoes.dicionario.nao | ||
| 171 | + }; | ||
| 172 | + i3GEOadmin.core.abreModalConfirma(hash); | ||
| 173 | + }, | ||
| 174 | + excluirOperacao: function(id_operacao){ | ||
| 175 | + i3GEOadmin.core.modalAguarde(true); | ||
| 176 | + $.post( | ||
| 177 | + "exec.php?funcao=excluirOperacao", | ||
| 178 | + "id_operacao="+id_operacao | ||
| 179 | + ) | ||
| 180 | + .done( | ||
| 181 | + function(data, status){ | ||
| 182 | + i3GEOadmin.core.modalAguarde(false); | ||
| 183 | + var json = jQuery.parseJSON(data)*1; | ||
| 184 | + $("#form-" + json).remove(); | ||
| 185 | + $("#link-" + json).remove(); | ||
| 186 | + } | ||
| 187 | + ) | ||
| 188 | + .fail( | ||
| 189 | + function(data){ | ||
| 190 | + i3GEOadmin.core.modalAguarde(false); | ||
| 191 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 192 | + } | ||
| 193 | + ); | ||
| 194 | + }, | ||
| 195 | + salvarOperacaoDialogo: function(id_operacao){ | ||
| 196 | + var hash = { | ||
| 197 | + "mensagem": i3GEOadmin.operacoes.dicionario.confirma, | ||
| 198 | + "onBotao1": "i3GEOadmin.operacoes.salvarOperacao('"+id_operacao+"')", | ||
| 199 | + "botao1": i3GEOadmin.operacoes.dicionario.sim, | ||
| 200 | + "onBotao2": "i3GEOadmin.core.fechaModalConfirma();", | ||
| 201 | + "botao2": i3GEOadmin.operacoes.dicionario.nao | ||
| 202 | + }; | ||
| 203 | + i3GEOadmin.core.abreModalConfirma(hash); | ||
| 204 | + }, | ||
| 205 | + salvarOperacao: function(id_operacao){ | ||
| 206 | + var parametros = $("#form-" + id_operacao + " form").serialize(); | ||
| 207 | + i3GEOadmin.core.fechaModalGeral(); | ||
| 208 | + i3GEOadmin.core.modalAguarde(true); | ||
| 209 | + $.post( | ||
| 210 | + "exec.php?funcao=alterarOperacao", | ||
| 211 | + "id_operacao="+ id_operacao +"&"+parametros | ||
| 212 | + ) | ||
| 213 | + .done( | ||
| 214 | + function(data, status){ | ||
| 215 | + i3GEOadmin.core.modalAguarde(false); | ||
| 216 | + i3GEOadmin.core.iconeAguarde(i3GEOadmin.operacoes.ondeListaOperacoes); | ||
| 217 | + i3GEOadmin.operacoes.pegaOperacoes(); | ||
| 218 | + } | ||
| 219 | + ) | ||
| 220 | + .fail( | ||
| 221 | + function(data){ | ||
| 222 | + i3GEOadmin.core.modalAguarde(false); | ||
| 223 | + i3GEOadmin.core.mostraErro(data.status + " " +data.statusText); | ||
| 224 | + } | ||
| 225 | + ); | ||
| 226 | + }, | ||
| 227 | + pegaFiltro: function(){ | ||
| 228 | + return $i("filtro"); | ||
| 229 | + }, | ||
| 230 | + valorFiltro: function(){ | ||
| 231 | + return i3GEOadmin.operacoes.pegaFiltro().value; | ||
| 232 | + }, | ||
| 233 | + defineFiltro: function(valor){ | ||
| 234 | + i3GEOadmin.operacoes.pegaFiltro().value = valor; | ||
| 235 | + }, | ||
| 236 | + filtra: function(obj){ | ||
| 237 | + $("#corpo .panel").each( | ||
| 238 | + function(i,el){ | ||
| 239 | + if(obj.value == ""){ | ||
| 240 | + $(el).show(); | ||
| 126 | } | 241 | } |
| 127 | - ); | ||
| 128 | - formAdicionaOperacao = html; | ||
| 129 | - $.material.init(); | ||
| 130 | - } | ||
| 131 | - ) | ||
| 132 | - .fail(function(data){ | ||
| 133 | - ondeListaOperacoes.html(""); | ||
| 134 | - mostraErro(data.status + " " +data.statusText); | ||
| 135 | - }); | ||
| 136 | -} | ||
| 137 | -function adicionaOperacaoDialogo(){ | ||
| 138 | - abreModalGeral(formAdicionaOperacao); | ||
| 139 | -} | ||
| 140 | - | ||
| 141 | -//os parametros sao obtidos do formulario aberto do modal | ||
| 142 | - | ||
| 143 | -function adicionaOperacao(){ | ||
| 144 | - var parametros = $("#form-modal form").serialize(); | ||
| 145 | - fechaModalGeral(); | ||
| 146 | - modalAguarde(true); | ||
| 147 | - $.post( | ||
| 148 | - "exec.php?funcao=adicionarOperacao", | ||
| 149 | - parametros | ||
| 150 | - ) | ||
| 151 | - .done( | ||
| 152 | - function(data, status){ | ||
| 153 | - modalAguarde(false); | ||
| 154 | - iconeAguarde(ondeListaOperacoes); | ||
| 155 | - pegaOperacoes(); | ||
| 156 | - } | ||
| 157 | - ) | ||
| 158 | - .fail( | ||
| 159 | - function(data){ | ||
| 160 | - modalAguarde(false); | ||
| 161 | - mostraErro(data.status + " " +data.statusText); | ||
| 162 | - } | ||
| 163 | - ); | ||
| 164 | -} | ||
| 165 | -function excluirOperacaoDialogo(id_operacao){ | ||
| 166 | - var hash = { | ||
| 167 | - "mensagem": $trad("confirma",i3GEOadmin.core.dicionario), | ||
| 168 | - "onBotao1": "excluirOperacao('"+id_operacao+"')", | ||
| 169 | - "botao1": $trad("sim",i3GEOadmin.core.dicionario), | ||
| 170 | - "onBotao2": "fechaModalConfirma();", | ||
| 171 | - "botao2": $trad("nao",i3GEOadmin.core.dicionario) | ||
| 172 | - }; | ||
| 173 | - abreModalConfirma(hash); | ||
| 174 | -} | ||
| 175 | -function excluirOperacao(id_operacao){ | ||
| 176 | - modalAguarde(true); | ||
| 177 | - $.post( | ||
| 178 | - "exec.php?funcao=excluirOperacao", | ||
| 179 | - "id_operacao="+id_operacao | ||
| 180 | - ) | ||
| 181 | - .done( | ||
| 182 | - function(data, status){ | ||
| 183 | - modalAguarde(false); | ||
| 184 | - var json = jQuery.parseJSON(data)*1; | ||
| 185 | - $("#form-" + json).remove(); | ||
| 186 | - $("#link-" + json).remove(); | ||
| 187 | - } | ||
| 188 | - ) | ||
| 189 | - .fail( | ||
| 190 | - function(data){ | ||
| 191 | - modalAguarde(false); | ||
| 192 | - mostraErro(data.status + " " +data.statusText); | ||
| 193 | - } | ||
| 194 | - ); | ||
| 195 | -} | ||
| 196 | -function salvarOperacaoDialogo(id_operacao){ | ||
| 197 | - var hash = { | ||
| 198 | - "mensagem": $trad("confirma",i3GEOadmin.core.dicionario), | ||
| 199 | - "onBotao1": "salvarOperacao('"+id_operacao+"')", | ||
| 200 | - "botao1": $trad("sim",i3GEOadmin.core.dicionario), | ||
| 201 | - "onBotao2": "fechaModalConfirma();", | ||
| 202 | - "botao2": $trad("nao",i3GEOadmin.core.dicionario) | ||
| 203 | - }; | ||
| 204 | - abreModalConfirma(hash); | ||
| 205 | -} | ||
| 206 | -function salvarOperacao(id_operacao){ | ||
| 207 | - var parametros = $("#form-" + id_operacao + " form").serialize(); | ||
| 208 | - fechaModalGeral(); | ||
| 209 | - modalAguarde(true); | ||
| 210 | - $.post( | ||
| 211 | - "exec.php?funcao=alterarOperacao", | ||
| 212 | - "id_operacao="+ id_operacao +"&"+parametros | ||
| 213 | - ) | ||
| 214 | - .done( | ||
| 215 | - function(data, status){ | ||
| 216 | - modalAguarde(false); | ||
| 217 | - iconeAguarde(ondeListaOperacoes); | ||
| 218 | - pegaOperacoes(); | ||
| 219 | - } | ||
| 220 | - ) | ||
| 221 | - .fail( | ||
| 222 | - function(data){ | ||
| 223 | - modalAguarde(false); | ||
| 224 | - mostraErro(data.status + " " +data.statusText); | ||
| 225 | - } | ||
| 226 | - ); | ||
| 227 | -} | ||
| 228 | -function pegaFiltro(){ | ||
| 229 | - return $i("filtro"); | ||
| 230 | -} | ||
| 231 | -function valorFiltro(){ | ||
| 232 | - return pegaFiltro().value; | ||
| 233 | -} | ||
| 234 | -function defineFiltro(valor){ | ||
| 235 | - pegaFiltro().value = valor; | ||
| 236 | -} | ||
| 237 | -function filtra(obj){ | ||
| 238 | - | ||
| 239 | - $("#corpo .panel").each( | ||
| 240 | - function(i,el){ | ||
| 241 | - if(obj.value == ""){ | ||
| 242 | - $(el).show(); | ||
| 243 | - } | ||
| 244 | - else { | ||
| 245 | - $(el).hide(); | ||
| 246 | - } | 242 | + else { |
| 243 | + $(el).hide(); | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + ); | ||
| 247 | + if(obj.value != ""){ | ||
| 248 | + $("#"+obj.value).show(); | ||
| 247 | } | 249 | } |
| 248 | - ); | ||
| 249 | - if(obj.value != ""){ | ||
| 250 | - $("#"+obj.value).show(); | ||
| 251 | - } | ||
| 252 | -} | 250 | + } |
| 251 | +}; |
admin1/usuarios/operacoes/index.php
| @@ -27,11 +27,11 @@ include "../../head.php"; | @@ -27,11 +27,11 @@ include "../../head.php"; | ||
| 27 | <!-- aqui entra o filtro --> | 27 | <!-- aqui entra o filtro --> |
| 28 | <div class="form-group"> | 28 | <div class="form-group"> |
| 29 | <label class="control-label">{{{filtro}}}</label> | 29 | <label class="control-label">{{{filtro}}}</label> |
| 30 | - <select onchange="filtra(this)" id="filtro" class="form-control input-lg"> | 30 | + <select onchange="i3GEOadmin.operacoes.filtra(this)" id="filtro" class="form-control input-lg"> |
| 31 | </select> | 31 | </select> |
| 32 | </div> | 32 | </div> |
| 33 | <div class="row pull-right"> | 33 | <div class="row pull-right"> |
| 34 | - <a onclick="adicionaOperacaoDialogo();" href="javascript:void(0)" class="btn btn-primary" role="button">{{{adicionar}}}</a> | 34 | + <a onclick="i3GEOadmin.operacoes.adicionaOperacaoDialogo();" href="javascript:void(0)" class="btn btn-primary" role="button">{{{adicionar}}}</a> |
| 35 | </div> | 35 | </div> |
| 36 | <div class="clearfix"></div> | 36 | <div class="clearfix"></div> |
| 37 | <!--Modal ajuda--> | 37 | <!--Modal ajuda--> |
| @@ -96,8 +96,8 @@ include "../../head.php"; | @@ -96,8 +96,8 @@ include "../../head.php"; | ||
| 96 | </label> | 96 | </label> |
| 97 | </div> | 97 | </div> |
| 98 | </script> | 98 | </script> |
| 99 | -<script type="text/javascript" src="../../dicionario/operacoes.js"></script> | ||
| 100 | <script type="text/javascript" src="index.js"></script> | 99 | <script type="text/javascript" src="index.js"></script> |
| 100 | +<script type="text/javascript" src="../../dicionario/operacoes.js"></script> | ||
| 101 | <script> | 101 | <script> |
| 102 | $(document).ready(function(){ | 102 | $(document).ready(function(){ |
| 103 | //vem de admin1/index.js | 103 | //vem de admin1/index.js |
| @@ -110,19 +110,30 @@ include "../../head.php"; | @@ -110,19 +110,30 @@ include "../../head.php"; | ||
| 110 | }); | 110 | }); |
| 111 | //traducao | 111 | //traducao |
| 112 | var t = $("#titulo"); | 112 | var t = $("#titulo"); |
| 113 | + // | ||
| 113 | //complementa dicionario | 114 | //complementa dicionario |
| 115 | + // | ||
| 114 | i3GEOadmin.operacoes.dicionario.adicionar = i3GEOadmin.core.dicionario.adicionar; | 116 | i3GEOadmin.operacoes.dicionario.adicionar = i3GEOadmin.core.dicionario.adicionar; |
| 115 | i3GEOadmin.operacoes.dicionario.filtro = i3GEOadmin.core.dicionario.filtro; | 117 | i3GEOadmin.operacoes.dicionario.filtro = i3GEOadmin.core.dicionario.filtro; |
| 118 | + i3GEOadmin.operacoes.dicionario.excluir = i3GEOadmin.core.dicionario.excluir; | ||
| 119 | + i3GEOadmin.operacoes.dicionario.salvar = i3GEOadmin.core.dicionario.salva; | ||
| 120 | + i3GEOadmin.operacoes.dicionario.sim = i3GEOadmin.core.dicionario.sim; | ||
| 121 | + i3GEOadmin.operacoes.dicionario.nao = i3GEOadmin.core.dicionario.nao; | ||
| 122 | + i3GEOadmin.operacoes.dicionario.confirma = i3GEOadmin.core.dicionario.confirma; | ||
| 123 | + | ||
| 124 | + i3GEOadmin.core.dicionario = null; | ||
| 125 | + | ||
| 126 | + i3GEOadmin.operacoes.dicionario = i3GEO.idioma.objetoIdioma(i3GEOadmin.operacoes.dicionario); | ||
| 116 | t.html( | 127 | t.html( |
| 117 | Mustache.to_html( | 128 | Mustache.to_html( |
| 118 | t.html(), | 129 | t.html(), |
| 119 | - i3GEO.idioma.objetoIdioma(i3GEOadmin.operacoes.dicionario) | 130 | + i3GEOadmin.operacoes.dicionario |
| 120 | ) | 131 | ) |
| 121 | ); | 132 | ); |
| 122 | $.material.init(); | 133 | $.material.init(); |
| 123 | var inicia = function() { | 134 | var inicia = function() { |
| 124 | $(".hidden").removeClass('hidden'); | 135 | $(".hidden").removeClass('hidden'); |
| 125 | - init($("#corpo")); | 136 | + i3GEOadmin.operacoes.init($("#corpo")); |
| 126 | }; | 137 | }; |
| 127 | i3GEO.login.verificaOperacao("admin/html/operacoes",i3GEO.configura.locaplic, inicia, "sessao"); | 138 | i3GEO.login.verificaOperacao("admin/html/operacoes",i3GEO.configura.locaplic, inicia, "sessao"); |
| 128 | }); | 139 | }); |