Commit 076ffe45cc8d72fe8f8b6d5c8d86a211e84b1761
1 parent
55345c10
Exists in
master
and in
7 other branches
--no commit message
Showing
6 changed files
with
196 additions
and
295 deletions
Show diff stats
admin/js/core.js
| ... | ... | @@ -778,6 +778,52 @@ function core_excluiNoTree(sUrl,no,mensagem) |
| 778 | 778 | var largura = "300" |
| 779 | 779 | core_dialogoContinua(handleYes,handleNo,mensagem,largura) |
| 780 | 780 | } |
| 781 | +/** | |
| 782 | +Function: core_montaEditor | |
| 783 | + | |
| 784 | +Monta uma janela flutuante com um formulário. | |
| 785 | + | |
| 786 | +O editor possui um div com id=editor_bd que deve ser usado para incluir o formulário. | |
| 787 | + | |
| 788 | +Parameters: | |
| 789 | + | |
| 790 | +funcaoOK - string com o nome da função que será executada quando o botão OK for pressionado. | |
| 791 | +*/ | |
| 792 | +function core_montaEditor(funcaoOK) | |
| 793 | +{ | |
| 794 | + function on_editorCheckBoxChange(p_oEvent) | |
| 795 | + { | |
| 796 | + var ins = ""; | |
| 797 | + if(p_oEvent.newValue.get("value") == "OK") | |
| 798 | + { | |
| 799 | + eval(funcaoOK); | |
| 800 | + } | |
| 801 | + else | |
| 802 | + { | |
| 803 | + YAHOO.example.container.panelEditor.destroy(); | |
| 804 | + YAHOO.example.container.panelEditor = null; | |
| 805 | + } | |
| 806 | + }; | |
| 807 | + if(!YAHOO.example.container.panelEditor) | |
| 808 | + { | |
| 809 | + var novoel = document.createElement("div"); | |
| 810 | + novoel.id = "janela_editor"; | |
| 811 | + var ins = '<div class="hd">Editor</div>'; | |
| 812 | + ins += "<div class='bd' style='height:354px;overflow:auto'>"; | |
| 813 | + ins += "<div id='okcancel_checkbox'></div><div id='editor_bd'></div>"; | |
| 814 | + novoel.innerHTML = ins; | |
| 815 | + document.body.appendChild(novoel); | |
| 816 | + var editorBotoes = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name: "okcancel_checkbox_id", container: "okcancel_checkbox" }); | |
| 817 | + editorBotoes.addButtons([ | |
| 818 | + { label: "Salva", value: "OK", checked: false}, | |
| 819 | + { label: "Cancela", value: "CANCEL", checked: false } | |
| 820 | + ]); | |
| 821 | + editorBotoes.on("checkedButtonChange", on_editorCheckBoxChange); | |
| 822 | + YAHOO.example.container.panelEditor = new YAHOO.widget.Panel("janela_editor", { fixedcenter:true,close:false,width:"400px", height:"400px",overflow:"auto", visible:false,constraintoviewport:true } ); | |
| 823 | + YAHOO.example.container.panelEditor.render(); | |
| 824 | + } | |
| 825 | + YAHOO.example.container.panelEditor.show(); | |
| 826 | +} | |
| 781 | 827 | |
| 782 | 828 | // |
| 783 | 829 | //carregador de javascript | ... | ... |
admin/js/sistemas.js
| ... | ... | @@ -76,15 +76,15 @@ function montaArvore(dados) |
| 76 | 76 | { |
| 77 | 77 | tree = new YAHOO.widget.TreeView("tabela"); |
| 78 | 78 | tree.setDynamicLoad(loadNodeData, currentIconMode); |
| 79 | - adicionaNosRaiz(dados) | |
| 80 | 79 | var root = tree.getRoot(); |
| 81 | 80 | var tempNode = new YAHOO.widget.TextNode('', root, false); |
| 82 | 81 | tempNode.isLeaf = true; |
| 83 | - tree.draw(); | |
| 84 | 82 | core_carregando("desativa"); |
| 85 | 83 | } |
| 86 | 84 | buildTree(); |
| 87 | 85 | }(); |
| 86 | + adicionaNosRaiz(dados) | |
| 87 | + tree.draw(); | |
| 88 | 88 | } |
| 89 | 89 | function adicionaNos(no,dados,redesenha) |
| 90 | 90 | { |
| ... | ... | @@ -105,7 +105,7 @@ function adicionaNosRaiz(dados,redesenha) |
| 105 | 105 | { |
| 106 | 106 | var conteudo = " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluir('sistema','"+dados[i].id_sistema+"')\" title=excluir src=\"../imagens/01.png\" />" |
| 107 | 107 | conteudo += " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"adicionarFuncao('"+dados[i].id_sistema+"')\" title='adiciona função' src=\"../imagens/05.png\" />" |
| 108 | - conteudo += " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editar('sistema','"+dados[i].id_sistema+"')\" title=editar src=\"../imagens/06.png\" /><b> "+dados[i].nome_sistema | |
| 108 | + conteudo += " <img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editar('sistema','"+dados[i].id_sistema+"')\" title=editar src=\"../imagens/06.png\" /><b> <span>"+dados[i].nome_sistema+"</span>" | |
| 109 | 109 | var d = {html:conteudo,id_sistema:dados[i].id_sistema,tipo:"sistema"}; |
| 110 | 110 | var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true); |
| 111 | 111 | } |
| ... | ... | @@ -134,62 +134,68 @@ function editar(tipo,id) |
| 134 | 134 | var sUrl = "../php/sistemas.php?funcao=pegaFuncao&id_funcao="+id; |
| 135 | 135 | core_makeRequest(sUrl,callback) |
| 136 | 136 | } |
| 137 | -} | |
| 138 | -function montaEditorFuncoes(dados,id) | |
| 139 | -{ | |
| 140 | - function on_editorCheckBoxChange(p_oEvent) | |
| 137 | + if(tipo == "sistema") | |
| 141 | 138 | { |
| 142 | - var ins = ""; | |
| 143 | - if(p_oEvent.newValue.get("value") == "OK") | |
| 144 | - { | |
| 145 | - gravaDadosFuncao(id); | |
| 146 | - } | |
| 147 | - else | |
| 139 | + core_carregando("ativa"); | |
| 140 | + core_carregando(" buscando dados"); | |
| 141 | + var callback = | |
| 148 | 142 | { |
| 149 | - YAHOO.example.container.panelEditorFuncao.destroy(); | |
| 150 | - YAHOO.example.container.panelEditorFuncao = null; | |
| 151 | - } | |
| 152 | - }; | |
| 153 | - if(!YAHOO.example.container.panelEditorFuncao) | |
| 154 | - { | |
| 155 | - var novoel = document.createElement("div"); | |
| 156 | - novoel.id = "janela_editor"; | |
| 157 | - var ins = '<div class="hd">Editor</div>'; | |
| 158 | - ins += "<div class='bd' style='height:354px;overflow:auto'>"; | |
| 159 | - ins += "<div id='okcancel_checkbox'></div><div id='editor_bd'></div>"; | |
| 160 | - novoel.innerHTML = ins; | |
| 161 | - document.body.appendChild(novoel); | |
| 162 | - var editorBotoes = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name: "okcancel_checkbox_id", container: "okcancel_checkbox" }); | |
| 163 | - editorBotoes.addButtons([ | |
| 164 | - { label: "Salva", value: "OK", checked: false}, | |
| 165 | - { label: "Cancela", value: "CANCEL", checked: false } | |
| 166 | - ]); | |
| 167 | - editorBotoes.on("checkedButtonChange", on_editorCheckBoxChange); | |
| 168 | - YAHOO.example.container.panelEditorFuncao = new YAHOO.widget.Panel("janela_editor", { fixedcenter:true,close:false,width:"400px", height:"400px",overflow:"auto", visible:false,constraintoviewport:true } ); | |
| 169 | - YAHOO.example.container.panelEditorFuncao.render(); | |
| 143 | + success:function(o) | |
| 144 | + { | |
| 145 | + try | |
| 146 | + { | |
| 147 | + montaEditorSistemas(YAHOO.lang.JSON.parse(o.responseText)[0],id); | |
| 148 | + core_carregando("desativa"); | |
| 149 | + } | |
| 150 | + catch(e){core_handleFailure(e,o.responseText);} | |
| 151 | + }, | |
| 152 | + failure:core_handleFailure, | |
| 153 | + argument: { foo:"foo", bar:"bar" } | |
| 154 | + }; | |
| 155 | + var sUrl = "../php/sistemas.php?funcao=pegaSistema&id_sistema="+id; | |
| 156 | + core_makeRequest(sUrl,callback) | |
| 170 | 157 | } |
| 171 | - YAHOO.example.container.panelEditorFuncao.show(); | |
| 172 | - //carrega os dados na janela | |
| 158 | +} | |
| 159 | +function montaEditorSistemas(dados,id) | |
| 160 | +{ | |
| 161 | + core_montaEditor("gravaDadosSistema('"+id+"')") | |
| 162 | + $i("editor_bd").innerHTML = montaDivSistemas(dados) | |
| 163 | + core_carregando("desativa"); | |
| 164 | + core_comboPerfis("comboPerfis","selPerfil","","registraPerfil(this.value,\"Eperfil_sistema\")") | |
| 165 | +} | |
| 166 | +function montaEditorFuncoes(dados,id) | |
| 167 | +{ | |
| 168 | + core_montaEditor("gravaDadosFuncao('"+id+"')") | |
| 173 | 169 | $i("editor_bd").innerHTML = montaDivFuncoes(dados) |
| 174 | 170 | core_carregando("desativa"); |
| 175 | - // | |
| 176 | - //preenche a div com a lista de tags | |
| 177 | - // | |
| 178 | - //core_comboTags("comboTags","Etags_tema","registraTag"); | |
| 179 | - // | |
| 180 | - //preenche a div com a lista de mapfiles | |
| 181 | - // | |
| 182 | - //core_comboMapfiles("comboMapfiles","Ecodigo_tema",dados[0].codigo_tema); | |
| 171 | + core_comboPerfis("comboPerfis","selPerfil","","registraPerfil(this.value,\"Eperfil_funcao\")") | |
| 183 | 172 | } |
| 184 | -function registraTag(valor) | |
| 173 | +function registraPerfil(valor,id) | |
| 185 | 174 | { |
| 186 | - var inp = $i("Etags_tema") | |
| 175 | + var inp = $i(id) | |
| 187 | 176 | var tags = inp.value |
| 188 | 177 | if(tags == "") |
| 189 | 178 | inp.value = valor |
| 190 | 179 | else |
| 191 | 180 | inp.value = tags+" "+valor |
| 192 | 181 | } |
| 182 | +function montaDivSistemas(i) | |
| 183 | +{ | |
| 184 | + var param = | |
| 185 | + { | |
| 186 | + "linhas":[ | |
| 187 | + {titulo:"Nome:",id:"Enome_sistema",size:"50",value:i.nome_sistema,tipo:"text",div:""}, | |
| 188 | + {titulo:"Perfis - escolha da lista abaixo:",id:"Eperfil_sistema",size:"50",value:i.perfil_sistema,tipo:"text",div:"<div id=comboPerfis >Buscando...</div>"} | |
| 189 | + ] | |
| 190 | + } | |
| 191 | + var ins = "" | |
| 192 | + ins += core_geraLinhas(param) | |
| 193 | + ins += "<br>Publicado?<br>" | |
| 194 | + ins += "<select id='Epublicado_sistema' >" | |
| 195 | + ins += core_combosimnao(i.publicado_sistema) | |
| 196 | + ins += "</select>" | |
| 197 | + return(ins) | |
| 198 | +} | |
| 193 | 199 | function montaDivFuncoes(i) |
| 194 | 200 | { |
| 195 | 201 | var param = |
| ... | ... | @@ -199,7 +205,7 @@ function montaDivFuncoes(i) |
| 199 | 205 | {titulo:"Programa que será executado:",id:"Eabrir_funcao",size:"50",value:i.abrir_funcao,tipo:"text",div:""}, |
| 200 | 206 | {titulo:"Largura da janela onde o programa será aberto:",id:"Ew_funcao",size:"5",value:i.w_funcao,tipo:"text",div:""}, |
| 201 | 207 | {titulo:"Altura da janela:",id:"Eh_funcao",size:"5",value:i.h_funcao,tipo:"text",div:""}, |
| 202 | - {titulo:"Perfis:",id:"Eperfil_funcao",size:"50",value:i.perfil_funcao,tipo:"text",div:""} | |
| 208 | + {titulo:"Perfis - escolha da lista abaixo:",id:"Eperfil_funcao",size:"50",value:i.perfil_funcao,tipo:"text",div:"<div id=comboPerfis >Buscando...</div>"} | |
| 203 | 209 | ] |
| 204 | 210 | } |
| 205 | 211 | var ins = "" |
| ... | ... | @@ -262,14 +268,49 @@ function gravaDadosFuncao(id) |
| 262 | 268 | } |
| 263 | 269 | else |
| 264 | 270 | { |
| 265 | - //var rec = myDataTable.getRecordSet().getRecord(recordid); | |
| 266 | - //myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]) | |
| 267 | 271 | var no = tree.getNodeByProperty("id_funcao",id) |
| 268 | 272 | no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Enome_funcao").value |
| 269 | 273 | core_carregando("desativa"); |
| 270 | 274 | } |
| 271 | - YAHOO.example.container.panelEditorFuncao.destroy(); | |
| 272 | - YAHOO.example.container.panelEditorFuncao = null; | |
| 275 | + YAHOO.example.container.panelEditor.destroy(); | |
| 276 | + YAHOO.example.container.panelEditor = null; | |
| 277 | + } | |
| 278 | + catch(e){core_handleFailure(e,o.responseText);} | |
| 279 | + }, | |
| 280 | + failure:core_handleFailure, | |
| 281 | + argument: { foo:"foo", bar:"bar" } | |
| 282 | + }; | |
| 283 | + core_makeRequest(sUrl,callback) | |
| 284 | +} | |
| 285 | +function gravaDadosSistema(id) | |
| 286 | +{ | |
| 287 | + var campos = new Array("perfil","nome","publicado") | |
| 288 | + var par = "" | |
| 289 | + for (i=0;i<campos.length;i++) | |
| 290 | + {par += "&"+campos[i]+"_sistema="+($i("E"+campos[i]+"_sistema").value)} | |
| 291 | + par += "&id_sistema="+id | |
| 292 | + core_carregando("ativa"); | |
| 293 | + core_carregando(" gravando o registro do id= "+id); | |
| 294 | + var sUrl = "../php/sistemas.php?funcao=alterarSistemas"+par; | |
| 295 | + var callback = | |
| 296 | + { | |
| 297 | + success:function(o) | |
| 298 | + { | |
| 299 | + try | |
| 300 | + { | |
| 301 | + if(YAHOO.lang.JSON.parse(o.responseText) == "erro") | |
| 302 | + { | |
| 303 | + core_carregando("<span style=color:red >Não foi possível excluir. Verifique se não existem menus vinculados a este tema</span>"); | |
| 304 | + setTimeout("core_carregando('desativa')",3000) | |
| 305 | + } | |
| 306 | + else | |
| 307 | + { | |
| 308 | + var no = tree.getNodeByProperty("id_sistema",id) | |
| 309 | + no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Enome_sistema").value | |
| 310 | + core_carregando("desativa"); | |
| 311 | + } | |
| 312 | + YAHOO.example.container.panelEditor.destroy(); | |
| 313 | + YAHOO.example.container.panelEditor = null; | |
| 273 | 314 | } |
| 274 | 315 | catch(e){core_handleFailure(e,o.responseText);} |
| 275 | 316 | }, | ... | ... |
admin/js/sistemasold.js
| ... | ... | @@ -1,237 +0,0 @@ |
| 1 | -/* | |
| 2 | -Title: Sistemas | |
| 3 | - | |
| 4 | -Funções javascript utilizadas no sistema de administração do cadastro de web services | |
| 5 | - | |
| 6 | -File: i3geo/admin/webservices.js | |
| 7 | - | |
| 8 | -About: Licença | |
| 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@mma.gov.br | |
| 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 | -tanto a versão 2 da Licença. | |
| 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 | -/* | |
| 29 | -Function: iniciaAdmin | |
| 30 | - | |
| 31 | -Inicializa as variáveis globais e checa o cadastro do editor do sistema de administração | |
| 32 | - | |
| 33 | -Ao retornar, por default, executa a função montaParametros() | |
| 34 | -*/ | |
| 35 | -function iniciaAdmin() | |
| 36 | -{ | |
| 37 | - verificaEditores() | |
| 38 | -} | |
| 39 | -function montaParametros() | |
| 40 | -{ | |
| 41 | - if(!$i("resultado")) | |
| 42 | - {document.body.innerHTML += "<div id=resultado ></div>"} | |
| 43 | - $i("resultado").innerHTML = $mensagemAguarde | |
| 44 | - var p = "../php/sistemas.php?funcao=pegaSistemas"; | |
| 45 | - cPaint.call(p,"",listaSistemas); | |
| 46 | -} | |
| 47 | -/* | |
| 48 | -Function: listaSistemas | |
| 49 | - | |
| 50 | -Monta o html com os parametros e os divs que receberão os dados dos formulários. | |
| 51 | -*/ | |
| 52 | -function listaSistemas(retorno) | |
| 53 | -{ | |
| 54 | - ins = "<p><input style=font-size:10px onclick='alterarSistemas(\"\",\"resultado\")' type=button value='Adicionar um novo sistema' /></p>" | |
| 55 | - montaSistemas(retorno,"resultado") | |
| 56 | -} | |
| 57 | -function montaSistemas(retorno,onde) | |
| 58 | -{ | |
| 59 | - var d = retorno.data; | |
| 60 | - var nm = retorno.data.length | |
| 61 | - for (i=0;i<nm;i++) | |
| 62 | - { | |
| 63 | - if(!$i(d[i].id_sistema)) | |
| 64 | - {ins += "<div id="+d[i].id_sistema+" >"} | |
| 65 | - ins += "<fieldset><legend style='background-color:white;'><b>+- "+d[i].nome_sistema+"</b></legend>" | |
| 66 | - ins += "<div style=display:none ><table class=lista ><tr><td></td><td></td><td></td></tr>"; | |
| 67 | - var param = { | |
| 68 | - "linhas":[ | |
| 69 | - {titulo:"Nome",prefixoid:"nome_",id:"id_sistema",valor:"nome_sistema"}, | |
| 70 | - ] | |
| 71 | - } | |
| 72 | - ins += (geraLinhas(d[i],param,3)); | |
| 73 | - ins += "<tr>" | |
| 74 | - ins += "<td>Perfis: </td>" | |
| 75 | - ins += "<td><input size=30 onchange='this.style.color=\"blue\"' type=text id='perfil_"+d[i].id_sistema+"' value='"+d[i].perfil_sistema+"' /></td>" | |
| 76 | - | |
| 77 | - var idtemp = "perfil_"+d[i].id_sistema | |
| 78 | - ins += "<td><select onchange=\"registraPerfil('"+idtemp+"',this.value);this.style.color='blue'\" >" | |
| 79 | - ins += comboObjeto($perfis,"perfil","perfil","") | |
| 80 | - ins += "</select></td></tr>" | |
| 81 | - | |
| 82 | - ins += "<tr>" | |
| 83 | - ins += "<td>Publicado: </td>" | |
| 84 | - ins += "<td><select onchange=this.style.color='blue' id='publicado_"+d[i].id_sistema+"' >" | |
| 85 | - ins += combosimnao(d[i].publicado_sistema) | |
| 86 | - ins += "</td><td></td></tr>" | |
| 87 | - | |
| 88 | - ins += "</table>" | |
| 89 | - | |
| 90 | - ins += "<table><tr><td><div class=excluir title='Excluir' onclick='excluir(\""+d[i].id_sistema+"\")'/></td>" | |
| 91 | - ins += "<td><div class=aplicar title='Aplicar alterações' onclick='alterarSistemas(\""+d[i].id_sistema+"\",\""+d[i].id_sistema+"\")'/></td>" | |
| 92 | - ins += "<td></td></tr></table>" | |
| 93 | - | |
| 94 | - | |
| 95 | - | |
| 96 | - ins += "<fieldset><legend>+- Funções</legend>" | |
| 97 | - ins += "<div style=display:none ><p><input style=font-size:10px onclick='alterarFuncoes(\"\",\""+d[i].id_sistema+"\")' type=button value='Adicionar uma nova função' /></p>" | |
| 98 | - var nf = d[i].funcoes.length | |
| 99 | - for (j=0;j<nf;j++) | |
| 100 | - { | |
| 101 | - ins += "<fieldset><legend>+- "+d[i].funcoes[j].nome_funcao+"</legend>" | |
| 102 | - var func = d[i].funcoes[j] | |
| 103 | - ins += "<div style=display:none ><table class=lista ><tr><td></td><td></td><td></td></tr>"; | |
| 104 | - var param = { | |
| 105 | - "linhas":[ | |
| 106 | - {titulo:"Nome da função",prefixoid:"nomefuncao_",id:"id_funcao",valor:"nome_funcao"}, | |
| 107 | - {titulo:"Abrir programa",prefixoid:"abrir_",id:"id_funcao",valor:"abrir_funcao"}, | |
| 108 | - {titulo:"Largura da janela",prefixoid:"w_",id:"id_funcao",valor:"w_funcao"}, | |
| 109 | - {titulo:"Altura",prefixoid:"h_",id:"id_funcao",valor:"h_funcao"} | |
| 110 | - ] | |
| 111 | - } | |
| 112 | - ins += (geraLinhas(func,param,3)); | |
| 113 | - | |
| 114 | - ins += "<tr>" | |
| 115 | - ins += "<td>Perfis: </td>" | |
| 116 | - ins += "<td><input size=30 onchange='this.style.color=\"blue\"' type=text id='perfilfuncao_"+d[i].funcoes[j].id_funcao+"' value='"+d[i].funcoes[j].perfil_funcao+"' /></td>" | |
| 117 | - var idtemp = "perfilfuncao_"+d[i].funcoes[j].id_funcao | |
| 118 | - ins += "<td><select onchange=\"registraPerfil('"+idtemp+"',this.value);this.style.color='blue'\" >" | |
| 119 | - ins += comboObjeto($perfis,"perfil","perfil","") | |
| 120 | - ins += "</select></td></tr>" | |
| 121 | - | |
| 122 | - | |
| 123 | - ins += "</table>" | |
| 124 | - ins += "<table><tr><td><div class=excluir title='Excluir' onclick='excluirFuncoes(\""+d[i].funcoes[j].id_funcao+"\")'/></td>" | |
| 125 | - ins += "<td><div class=aplicar title='Aplicar alterações' onclick='alterarFuncoes(\""+d[i].funcoes[j].id_funcao+"\",\""+d[i].id_sistema+"\")'/></td>" | |
| 126 | - ins += "</tr></table>" | |
| 127 | - ins += "</div></fieldset><br>" | |
| 128 | - ins += "</div></fieldset>" | |
| 129 | - } | |
| 130 | - ins += "</div></fieldset>" | |
| 131 | - ins += "</fieldset><br>" | |
| 132 | - if(!$i(d[i].id_sistema)) | |
| 133 | - ins += "</div>" | |
| 134 | - } | |
| 135 | - $i(onde).innerHTML = ins | |
| 136 | - ativaLegenda() | |
| 137 | -} | |
| 138 | -function alterarFuncoes(id_funcao,id_sistema) | |
| 139 | -{ | |
| 140 | - //if(confirm("Você realmente quer fazer isso?")) | |
| 141 | - //{ | |
| 142 | - var retorna = function(retorno) | |
| 143 | - { | |
| 144 | - if(id_funcao == "") | |
| 145 | - listaSistemas(retorno); | |
| 146 | - else | |
| 147 | - {ins = "";montaSistemas(retorno,id_sistema)} | |
| 148 | - } | |
| 149 | - if (id_funcao != "") | |
| 150 | - { | |
| 151 | - var nomefuncao = $i("nomefuncao_"+id_funcao).value | |
| 152 | - var perfil = $i("perfilfuncao_"+id_funcao).value | |
| 153 | - var abrir = $i("abrir_"+id_funcao).value | |
| 154 | - var w = $i("w_"+id_funcao).value | |
| 155 | - var h = $i("h_"+id_funcao).value | |
| 156 | - } | |
| 157 | - else | |
| 158 | - { | |
| 159 | - //var id_sistema = ""; | |
| 160 | - var id_funcao = "" | |
| 161 | - var nomefuncao = "" | |
| 162 | - var perfil = "" | |
| 163 | - var abrir = "" | |
| 164 | - var w = 200 | |
| 165 | - var h = 200 | |
| 166 | - } | |
| 167 | - var p = "../php/sistemas.php?funcao=alterarFuncoes&h="+h+"&w="+w+"&abrir="+abrir+"&perfil="+perfil+"&nomefuncao="+nomefuncao+"&id_funcao="+id_funcao+"&id_sistema="+id_sistema | |
| 168 | - cPaint.call(p,"",retorna); | |
| 169 | - //} | |
| 170 | -} | |
| 171 | -function alterarSistemas(id_sistema,onde) | |
| 172 | -{ | |
| 173 | - //if(confirm("Você realmente quer fazer isso?")) | |
| 174 | - //{ | |
| 175 | - var retorna = function(retorno) | |
| 176 | - { | |
| 177 | - if(id_sistema == "") | |
| 178 | - listaSistemas(retorno); | |
| 179 | - else | |
| 180 | - {ins = "";montaSistemas(retorno,onde)} | |
| 181 | - } | |
| 182 | - if (id_sistema != "") | |
| 183 | - { | |
| 184 | - var nome = $i("nome_"+id_sistema).value; | |
| 185 | - var perfil = $i("perfil_"+id_sistema).value; | |
| 186 | - var publicado = $i("publicado_"+id_sistema).value; | |
| 187 | - } | |
| 188 | - else | |
| 189 | - { | |
| 190 | - var id_sistema = ""; | |
| 191 | - var nome = ""; | |
| 192 | - var perfil = ""; | |
| 193 | - var publicado = ""; | |
| 194 | - } | |
| 195 | - var p = "../php/sistemas.php?funcao=alterarSistemas&publicado_sistema="+publicado+"&id_sistema="+id_sistema+"&nome="+nome+"&perfil="+perfil | |
| 196 | - cPaint.call(p,"",retorna); | |
| 197 | - //} | |
| 198 | -} | |
| 199 | -function excluir(id) | |
| 200 | -{ | |
| 201 | - if(confirm("Você realmente quer fazer isso?")) | |
| 202 | - { | |
| 203 | - var retorna = function(retorno) | |
| 204 | - { | |
| 205 | - if(retorno.data=="erro") | |
| 206 | - {alert("Não foi possivel excluir. Exclua as funcoes primeiro");} | |
| 207 | - else | |
| 208 | - { | |
| 209 | - $i("resultado").innerHTML = $mensagemAguarde; | |
| 210 | - montaParametros() | |
| 211 | - } | |
| 212 | - } | |
| 213 | - var p = "../php/sistemas.php?funcao=excluir&id="+id; | |
| 214 | - cPaint.call(p,"",retorna); | |
| 215 | - } | |
| 216 | -} | |
| 217 | -function excluirFuncoes(id) | |
| 218 | -{ | |
| 219 | - if(confirm("Você realmente quer fazer isso?")) | |
| 220 | - { | |
| 221 | - $i("resultado").innerHTML = $mensagemAguarde; | |
| 222 | - var retorna = function() | |
| 223 | - { | |
| 224 | - montaParametros() | |
| 225 | - } | |
| 226 | - var p = "../php/sistemas.php?funcao=excluirFuncoes&id="+id; | |
| 227 | - cPaint.call(p,"",retorna); | |
| 228 | - } | |
| 229 | -} | |
| 230 | -function importarXmlSistemas() | |
| 231 | -{ | |
| 232 | - $i("resultado").innerHTML = $mensagemAguarde | |
| 233 | - var retorna = function(retorno) | |
| 234 | - {$i("resultado").innerHTML = retorno.data} | |
| 235 | - var p = "../php/sistemas.php?funcao=importarXmlSistemas&xml="+$i("arquivo").value; | |
| 236 | - cPaint.call(p,"",retorna); | |
| 237 | -} | |
| 238 | 0 | \ No newline at end of file |
admin/php/parsemapfile.php
| ... | ... | @@ -138,6 +138,23 @@ function mapfile() |
| 138 | 138 | $xml .= "\n<parsemapfile>\n"; |
| 139 | 139 | $xml .= "<tiposconexao>".implode(",",$objcontype)."</tiposconexao>\n"; |
| 140 | 140 | $xml .= "<tiposlayer>".implode(",",$objlayertypes)."</tiposlayer>\n"; |
| 141 | + //verifica se tem grupos | |
| 142 | + $nlayers = array(); | |
| 143 | + foreach ($layers as $layer) | |
| 144 | + { | |
| 145 | + if($objcontype[$layer->connectiontype] != "MS_WMS") | |
| 146 | + { | |
| 147 | + $layer = $mapa->getlayerbyname($layer); | |
| 148 | + if($layer->group == "") | |
| 149 | + {$nlayers[] = $layer->name;} | |
| 150 | + else | |
| 151 | + { | |
| 152 | + if($layer->group == $layer->name) | |
| 153 | + {$nlayers[] = $layer->name;} | |
| 154 | + } | |
| 155 | + $layers = $nlayers; | |
| 156 | + } | |
| 157 | + } | |
| 141 | 158 | foreach ($layers as $layer) |
| 142 | 159 | { |
| 143 | 160 | $xml .= "\n<layer>\n"; |
| ... | ... | @@ -145,19 +162,48 @@ function mapfile() |
| 145 | 162 | $xml .= "<titulo>".$layer->getmetadata('tema')."</titulo>\n"; |
| 146 | 163 | $d = $layer->data; |
| 147 | 164 | $ct = $objcontype[$layer->connectiontype]; |
| 148 | - if ($ct == "MS_SHAPEFILE" || $ct == "" || $ct == "MS_RASTER") | |
| 165 | + $tagLegenda = "parsemapfile.php?id=".$codigoLayer."&layername=".$layer->name."&tipoparse=legenda"; | |
| 166 | + $nomeLayer = $layer->name; | |
| 167 | + if ($ct == "MS_SHAPEFILE" || $ct == "" || $ct == "MS_RASTER" && $ct != "MS_WMS") | |
| 149 | 168 | { |
| 150 | 169 | $ct = "MS_WMS"; |
| 151 | - $d = "HTTP://mapas.mma.gov.br/i3geo/ogc.php?tema=".$codigoLayer; | |
| 170 | + $d = "http://".$_SERVER['HTTP_HOST'].str_replace("/admin/php/parsemapfile.php","",$_SERVER['PHP_SELF'])."/ogc.php?tema=".$codigoLayer; | |
| 152 | 171 | $xml .= "<version>1.1.1</version>"; |
| 153 | 172 | $xml .= "<srs>EPSG:4291</srs>"; |
| 154 | 173 | $xml .= "<format>image/png</format>"; |
| 174 | + $xml .= "<style>default</style>"; | |
| 175 | + $tagLegenda = ""; | |
| 155 | 176 | } |
| 156 | - else | |
| 157 | - {$xml .= "<geraxmllegenda>parsemapfile.php?id=".$codigoLayer."&layername=".$layer->name."&tipoparse=legenda</geraxmllegenda>";} | |
| 177 | + else if($ct == "MS_WMS") | |
| 178 | + { | |
| 179 | + $d = $layer->connection; | |
| 180 | + $v = $layer->getmetadata("wms_server_version"); | |
| 181 | + $e = $layer->getmetadata("wms_srs"); | |
| 182 | + $i = $layer->getmetadata("wms_format"); | |
| 183 | + $s = $layer->getmetadata("wms_style"); | |
| 184 | + $nomeLayer = $layer->getmetadata("wms_name"); | |
| 185 | + if($nomeLayer == "") | |
| 186 | + $nomeLayer = $layer->getmetadata("ows_name"); | |
| 187 | + if($v == "") | |
| 188 | + $v = $layer->getmetadata("ows_server_version"); | |
| 189 | + if($e == "") | |
| 190 | + $e = $layer->getmetadata("ows_srs"); | |
| 191 | + if($i == "") | |
| 192 | + $i = $layer->getmetadata("ows_format"); | |
| 193 | + if($s == "") | |
| 194 | + $s = $layer->getmetadata("ows_style"); | |
| 195 | + if($s == "") | |
| 196 | + {$s = "default";} | |
| 197 | + $xml .= "<version>$v</version>"; | |
| 198 | + $xml .= "<srs>$e</srs>"; | |
| 199 | + $xml .= "<format>$i</format>"; | |
| 200 | + $xml .= "<style>$s</style>"; | |
| 201 | + $tagLegenda = ""; | |
| 202 | + } | |
| 203 | + $xml .= "<geraxmllegenda>$tagLegenda</geraxmllegenda>"; | |
| 158 | 204 | $xml .= "<connectiontype>".$ct."</connectiontype>\n"; |
| 159 | 205 | $xml .= "<data>$d</data>\n"; |
| 160 | - $xml .= "<name>$layer->name</name>\n"; | |
| 206 | + $xml .= "<name>$nomeLayer</name>\n"; | |
| 161 | 207 | if($ct != "MS_WMS") |
| 162 | 208 | { |
| 163 | 209 | $xml .= "<connection>\n"; | ... | ... |
admin/php/sistemas.php
| ... | ... | @@ -43,6 +43,11 @@ switch ($funcao) |
| 43 | 43 | exit; |
| 44 | 44 | break; |
| 45 | 45 | |
| 46 | + case "pegaSistema": | |
| 47 | + retornaJSON(pegaDados("SELECT * from i3geoadmin_sistemas where id_sistema='$id_sistema'")); | |
| 48 | + exit; | |
| 49 | + break; | |
| 50 | + | |
| 46 | 51 | case "pegaFuncoes": |
| 47 | 52 | retornaJSON(pegaDados("SELECT * from i3geoadmin_sistemasf where id_sistema ='$id_sistema'")); |
| 48 | 53 | exit; |
| ... | ... | @@ -100,14 +105,14 @@ Altera o registro de um WS |
| 100 | 105 | */ |
| 101 | 106 | function alterarSistemas() |
| 102 | 107 | { |
| 103 | - global $id_sistema,$perfil,$nome,$publicado_sistema; | |
| 108 | + global $id_sistema,$perfil_sistema,$nome_sistema,$publicado_sistema; | |
| 104 | 109 | try |
| 105 | 110 | { |
| 106 | 111 | require_once("conexao.php"); |
| 107 | 112 | //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1"); |
| 108 | 113 | if($id_sistema != "") |
| 109 | 114 | { |
| 110 | - $dbhw->query("UPDATE i3geoadmin_sistemas SET publicado_sistema='$publicado_sistema',nome_sistema = '$nome',perfil_sistema = '$perfil' WHERE id_sistema = $id_sistema"); | |
| 115 | + $dbhw->query("UPDATE i3geoadmin_sistemas SET publicado_sistema='$publicado_sistema',nome_sistema = '$nome_sistema',perfil_sistema = '$perfil_sistema' WHERE id_sistema = $id_sistema"); | |
| 111 | 116 | $retorna = $id_sistema; |
| 112 | 117 | } |
| 113 | 118 | else | ... | ... |
menutemas/admin.db
No preview for this file type