Commit b73186b38f0adcce43d8a7345b89c041225eef37

Authored by Edmar Moretti
1 parent 8e93548d

--no commit message

admin/js/arvore.js
... ... @@ -57,7 +57,7 @@ function montaArvore(dados)
57 57 success: function(oResponse)
58 58 {
59 59 var dados = YAHOO.lang.JSON.parse(oResponse.responseText)
60   - montaNosGrupos(node.data.id_menu,node,dados,false)
  60 + montaNosGrupos(node.data.id_menu,node,dados,true)
61 61 oResponse.argument.fnLoadComplete();
62 62 },
63 63 failure: function(oResponse)
... ... @@ -156,7 +156,6 @@ function montaNosGrupos(idmenu,no,dados,redesenha)
156 156 conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:0px\" onclick=\"editar('grupo','"+dados.grupos[i].id_n1+"')\" title=editar width='10px' heigth='10px' src=\"../imagens/06.png\" />&nbsp;<span>"+dados.grupos[i].nome_grupo+"</span>"
157 157 var d = {html:conteudo,id_n1:dados.grupos[i].id_n1,tipo:"grupo"}
158 158 var tempNode = new YAHOO.widget.HTMLNode(d, no, false,true);
159   - //tempNode.isLeaf = true;
160 159 tempNode.setDynamicLoad(loadSubgruposData, temaIconMode);
161 160 }
162 161 if(redesenha){tree.draw();}
... ... @@ -289,7 +288,7 @@ function novoTemaRaiz(id)
289 288 {
290 289 core_carregando("ativa");
291 290 var mensagem = " adicionando tema...";
292   - core_carregando("mensagem");
  291 + core_carregando(mensagem);
293 292 var no = tree.getNodeByProperty("id_menu",id)
294 293 var noEtiquetaGrupo = tree.getNodeByProperty("etiquetaGrupo","menu_"+id)
295 294 var sUrl = "../php/arvore.php?funcao=adicionarTemaRaiz&id_menu="+id;
... ... @@ -313,7 +312,7 @@ function novoTemaRaizGrupo(idmenu,id)
313 312 {
314 313 core_carregando("ativa");
315 314 var mensagem = " adicionando tema...";
316   - core_carregando("mensagem");
  315 + core_carregando(mensagem);
317 316 var no = tree.getNodeByProperty("id_n1",id)
318 317 var noEtiquetaSubGrupo = tree.getNodeByProperty("etiquetaTemasSubGrupo",id)
319 318 var sUrl = "../php/arvore.php?funcao=adicionarTemaRaizGrupo&id_n1="+id+"&id_menu="+idmenu;
... ... @@ -341,7 +340,7 @@ function novoGrupo(id_menu)
341 340 {
342 341 core_carregando("ativa");
343 342 var mensagem = " adicionando grupo...";
344   - core_carregando("mensagem");
  343 + core_carregando(mensagem);
345 344 var sUrl = "../php/arvore.php?funcao=adicionarGrupo&id_menu="+id_menu;
346 345 var callback =
347 346 {
... ... @@ -365,7 +364,7 @@ function novoSubGrupo(idmenu,id_n1)
365 364 {
366 365 core_carregando("ativa");
367 366 var mensagem = " adicionando Sub-grupo...";
368   - core_carregando("mensagem");
  367 + core_carregando(mensagem);
369 368 var sUrl = "../php/arvore.php?funcao=adicionarSubGrupo&id_n1="+id_n1;
370 369 var callback =
371 370 {
... ... @@ -389,7 +388,7 @@ function novoTema(idmenu,id_n2)
389 388 {
390 389 core_carregando("ativa");
391 390 var mensagem = " adicionando tema...";
392   - core_carregando("mensagem");
  391 + core_carregando(mensagem);
393 392 var sUrl = "../php/arvore.php?funcao=adicionarTema&id_n2="+id_n2;
394 393 var callback =
395 394 {
... ... @@ -502,8 +501,7 @@ function montaDivGrupo(i)
502 501 ins += "<select id='Epublicado' >"
503 502 ins += core_combosimnao(i.publicado)
504 503 ins += "</select>"
505   - ins += "<br><br>Para criar um novo grupo clique <a href='grupos.html' >aqui</a>."
506   - ins += "<br><br>Para criar um novo perfil clique <a href='perfis.html' >aqui</a>."
  504 + ins += "<br><br><br><br>"
507 505 ins += "<input type=hidden value="+i.ordem+" id='Eordem' />"
508 506 return(ins)
509 507 }
... ... @@ -518,8 +516,7 @@ function montaDivSubGrupo(i)
518 516 ins += "<select id='Epublicado' >"
519 517 ins += core_combosimnao(i.publicado)
520 518 ins += "</select>"
521   - ins += "<br><br>Para criar um novo sub-grupo clique <a href='subgrupos.html' >aqui</a>."
522   - ins += "<br><br>Para criar um novo perfil clique <a href='perfis.html' >aqui</a>."
  519 + ins += "<br><br><br><br>"
523 520 ins += "<input type=hidden value="+i.ordem+" id='Eordem' />"
524 521 return(ins)
525 522 }
... ... @@ -612,6 +609,7 @@ function gravaDados(tipo,id)
612 609 var texto = obj.options[obj.selectedIndex].text
613 610 var no = tree.getNodeByProperty("id_n1",id)
614 611 no.getContentEl().getElementsByTagName("span")[0].innerHTML = texto
  612 + no.html = no.getContentEl().innerHTML;
615 613 }
616 614 if(tipo == "subgrupo")
617 615 {
... ... @@ -619,6 +617,7 @@ function gravaDados(tipo,id)
619 617 var texto = obj.options[obj.selectedIndex].text
620 618 var no = tree.getNodeByProperty("id_n2",id)
621 619 no.getContentEl().getElementsByTagName("span")[0].innerHTML = texto
  620 + no.html = no.getContentEl().innerHTML;
622 621 }
623 622 if(tipo == "tema")
624 623 {
... ... @@ -626,6 +625,7 @@ function gravaDados(tipo,id)
626 625 var texto = obj.options[obj.selectedIndex].text
627 626 var no = tree.getNodeByProperty("id_n3",id)
628 627 no.getContentEl().getElementsByTagName("span")[0].innerHTML = texto
  628 + no.html = no.getContentEl().innerHTML;
629 629 }
630 630 if(tipo == "raizmenu" || tipo == "raizgrupo")
631 631 {
... ... @@ -633,6 +633,7 @@ function gravaDados(tipo,id)
633 633 var texto = obj.options[obj.selectedIndex].text
634 634 var no = tree.getNodeByProperty("id_raiz",id)
635 635 no.getContentEl().getElementsByTagName("span")[0].innerHTML = texto
  636 + no.html = no.getContentEl().innerHTML;
636 637 }
637 638 core_carregando("desativa");
638 639 }
... ...
admin/js/atlas.js
... ... @@ -419,16 +419,19 @@ function gravaDados(tipo,id)
419 419 {
420 420 var no = tree.getNodeByProperty("id_atlas",id)
421 421 no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo_atlas").value
  422 + no.html = no.getContentEl().innerHTML;
422 423 }
423 424 if(tipo == "prancha")
424 425 {
425 426 var no = tree.getNodeByProperty("id_prancha",id)
426 427 no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Etitulo_prancha").value
  428 + no.html = no.getContentEl().innerHTML;
427 429 }
428 430 if(tipo == "tema")
429 431 {
430 432 var no = tree.getNodeByProperty("id_tema",id)
431 433 no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Ecodigo_tema").value
  434 + no.html = no.getContentEl().innerHTML;
432 435 }
433 436 core_carregando("desativa");
434 437 }
... ...
admin/js/core.js
... ... @@ -146,6 +146,7 @@ o - string retornada pelo ajax
146 146 function core_handleFailure(o,texto)
147 147 {
148 148 //div onde será mostrado o log
  149 + alert(texto)
149 150 if(!$i('logajax'))
150 151 {return;}
151 152 log = $i('logajax');
... ... @@ -315,7 +316,7 @@ function core_pegaPerfis(funcao)
315 316 if(funcao != "")
316 317 eval(funcao);
317 318 }
318   - catch(e){core_handleFailure(e,o.responseText);}
  319 + catch(e){core_handleFailure(o,o.responseText);}
319 320 },
320 321 failure:core_handleFailure,
321 322 argument: { foo:"foo", bar:"bar" }
... ... @@ -347,7 +348,7 @@ function core_pegaMapfiles(funcaoM)
347 348 if(funcaoM != "")
348 349 eval(funcaoM);
349 350 }
350   - catch(e){core_handleFailure(e.responseText);}
  351 + catch(e){core_handleFailure(o,o.responseText);}
351 352 },
352 353 failure:core_handleFailure,
353 354 argument: { foo:"foo", bar:"bar" }
... ... @@ -871,7 +872,12 @@ function core_pegaDados(mensagem,sUrl,funcaoRetorno)
871 872 success:function(o)
872 873 {
873 874 try
874   - {eval(funcaoRetorno+"(YAHOO.lang.JSON.parse(o.responseText))");}
  875 + {
  876 + if(funcaoRetorno != "")
  877 + eval(funcaoRetorno+"(YAHOO.lang.JSON.parse(o.responseText))");
  878 + else
  879 + core_carregando("desativa");
  880 + }
875 881 catch(e)
876 882 {
877 883 if("mensagem" != "")
... ... @@ -910,6 +916,9 @@ function core_gravaLinha(mensagem,row,sUrl)
910 916 var rec = myDataTable.getRecordSet().getRecord(row);
911 917 myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0])
912 918 core_carregando("desativa");
  919 + var linha = myDataTable.getTrEl(rec)
  920 + linha.style.color = "";
  921 +
913 922 },
914 923 failure:core_handleFailure,
915 924 argument: { foo:"foo", bar:"bar" }
... ... @@ -1090,6 +1099,11 @@ function core_montaEditor(funcaoOK,w,h)
1090 1099 YAHOO.example.container.panelEditor = new YAHOO.widget.Panel("janela_editor", { fixedcenter:true,close:true,width:w, overflow:"auto",modal: true,visible:false,constraintoviewport:true } );
1091 1100 YAHOO.example.container.panelEditor.render();
1092 1101 }
  1102 + else
  1103 + {
  1104 + if($i("editor_bd"))
  1105 + $i("editor_bd").innerHTML == ""
  1106 + }
1093 1107 YAHOO.example.container.panelEditor.show();
1094 1108 }
1095 1109  
... ...
admin/js/editormapfile.js
... ... @@ -180,7 +180,6 @@ function montaNosRaiz(redesenha)
180 180 conteudo = "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"excluirMapfile('"+$mapfiles[i]+"')\" title=excluir src=\"../imagens/01.png\" />"
181 181 conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"editorTemaMapfile('"+$mapfiles[i]+"')\" title='editar tema associado' src=\"../imagens/06.png\" />"
182 182 conteudo += "&nbsp;<img style=\"position:relative;cursor:pointer;top:2px\" onclick=\"testarMapfile('"+$mapfiles[i]+"')\" title='testar!' src=\"../imagens/41.png\" /><b>&nbsp;<span>"+$mapfiles[i]+"</span>"
183   -
184 183 var d = {html:conteudo,id:$mapfiles[i],codigoMap:$mapfiles[i]};
185 184 var tempNode = new YAHOO.widget.HTMLNode(d, root, false,true);
186 185 nos.push(tempNode)
... ...
admin/js/grupos.js
... ... @@ -99,6 +99,12 @@ function montaTabela_G(dados)
99 99 {
100 100 this.cancelCellEditor();
101 101 });
  102 + myDataTable.subscribe("editorSaveEvent", function(oArgs)
  103 + {
  104 + if(oArgs.newData != oArgs.oldData)
  105 + var linha = myDataTable.getTrEl(oArgs.editor.record)
  106 + linha.style.color = "blue";
  107 + });
102 108 };
103 109 core_carregando("desativa");
104 110 }
... ...
admin/js/listatemas.js
... ... @@ -9,7 +9,7 @@ function montaEditorTema(dados)
9 9 var ins = "";
10 10 if(p_oEvent.newValue.get("value") == "OK")
11 11 {
12   - gravaDadosTema(dados.id_tema);
  12 + gravaDadosTema(dados[0].id_tema);
13 13 }
14 14 else
15 15 {
... ... @@ -57,7 +57,7 @@ function montaDivTemas(i)
57 57 {
58 58 var param = {
59 59 "linhas":[
60   - {titulo:"Nome do tema que será mostrado na árvore de menus:",id:"nome_tema",size:"50",value:i.nome_tema,tipo:"text",div:""}
  60 + {titulo:"Nome que será mostrado na árvore de menus:",id:"nome_tema",size:"50",value:i.nome_tema,tipo:"text",div:""}
61 61 ]
62 62 }
63 63 var ins = ""
... ... @@ -100,7 +100,7 @@ function montaDivTemas(i)
100 100 }
101 101 function gravaDadosTema(id)
102 102 {
103   - var campos = new Array("nome","codigo","desc","link","tags","tipo","ogc","download","kml")
  103 + var campos = new Array("nome","desc","link","tags","tipo","ogc","download","kml")
104 104 var par = ""
105 105 for (i=0;i<campos.length;i++)
106 106 {par += "&"+campos[i]+"="+($i(campos[i]+"_tema").value)}
... ... @@ -133,5 +133,5 @@ function gravaDadosTema(id)
133 133 failure:core_handleFailure,
134 134 argument: { foo:"foo", bar:"bar" }
135 135 };
136   - core_makeRequest(sUrl,callback)
  136 + core_makeRequest(sUrl,callback,"POST")
137 137 }
138 138 \ No newline at end of file
... ...
admin/js/mapfiles.js
... ... @@ -80,7 +80,10 @@ Salva o novo valor de uma variável
80 80 */
81 81 function salva(variavel)
82 82 {
83   - core_pegaDados("gravando...","../php/mapfiles.php?funcao=salvaConfigura&variavel="+variavel+"&valor="+$i(variavel).value)
  83 + var original = $i(variavel).value;
  84 + $i(variavel).value = "gravando..."
  85 + core_pegaDados("gravando...","../php/mapfiles.php?funcao=salvaConfigura&variavel="+variavel+"&valor="+$i(variavel).value,"")
84 86 $i(variavel).style.color = ""
  87 + $i(variavel).value = original
85 88 }
86 89 YAHOO.util.Event.addListener(window, "load", initMenu);
87 90 \ No newline at end of file
... ...
admin/js/menu.js
... ... @@ -106,6 +106,13 @@ function montaTabela_M(dados)
106 106 {
107 107 this.cancelCellEditor();
108 108 });
  109 + myDataTable.subscribe("editorSaveEvent", function(oArgs)
  110 + {
  111 + if(oArgs.newData != oArgs.oldData)
  112 + var linha = myDataTable.getTrEl(oArgs.editor.record)
  113 + linha.style.color = "blue";
  114 + });
  115 +
109 116 };
110 117 core_carregando("desativa");
111 118 }
... ...
admin/js/ms_configura.js
... ... @@ -96,8 +96,11 @@ function salva(variavel)
96 96 {alert("erro")}
97 97 else
98 98 {
99   - core_pegaDados("gravando...","../php/ms_configura.php?funcao=salvaConfigura&variavel="+variavel+"&valor="+$i(variavel).value,function(){core_carregando("desativa");})
  99 + var original = $i(variavel).value;
  100 + $i(variavel).value = "gravando...";
  101 + core_pegaDados("gravando...","../php/ms_configura.php?funcao=salvaConfigura&variavel="+variavel+"&valor="+$i(variavel).value,"")
100 102 $i(variavel).style.color = ""
  103 + $i(variavel).value = original;
101 104 }
102 105 }
103 106 YAHOO.util.Event.addListener(window, "load", initMenu);
104 107 \ No newline at end of file
... ...
admin/js/perfis.js
... ... @@ -80,17 +80,25 @@ function montaTabela(dados)
80 80 excluiLinha(record.getData('id_perfil'),target);
81 81 }
82 82 else
83   - {this.onEventShowCellEditor(ev);}
  83 + {
  84 + this.onEventShowCellEditor(ev);
  85 + }
84 86 });
85 87 // Hook into custom event to customize save-flow of "radio" editor
86 88 myDataTable.subscribe("editorUpdateEvent", function(oArgs)
87 89 {
88 90 if(oArgs.editor.column.key === "active")
89 91 {
90   - this.saveCellEditor();
91   -
  92 + this.saveCellEditor();
92 93 }
93 94 });
  95 + myDataTable.subscribe("editorSaveEvent", function(oArgs)
  96 + {
  97 + if(oArgs.newData != oArgs.oldData)
  98 + var linha = myDataTable.getTrEl(oArgs.editor.record)
  99 + linha.style.color = "blue";
  100 + });
  101 +
94 102 myDataTable.subscribe("editorBlurEvent", function(oArgs)
95 103 {
96 104 this.cancelCellEditor();
... ...
admin/js/sistemas.js
... ... @@ -270,6 +270,7 @@ function gravaDadosFuncao(id)
270 270 {
271 271 var no = tree.getNodeByProperty("id_funcao",id)
272 272 no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Enome_funcao").value
  273 + no.html = no.getContentEl().innerHTML;
273 274 core_carregando("desativa");
274 275 }
275 276 YAHOO.example.container.panelEditor.destroy();
... ... @@ -307,6 +308,7 @@ function gravaDadosSistema(id)
307 308 {
308 309 var no = tree.getNodeByProperty("id_sistema",id)
309 310 no.getContentEl().getElementsByTagName("span")[0].innerHTML = document.getElementById("Enome_sistema").value
  311 + no.html = no.getContentEl().innerHTML;
310 312 core_carregando("desativa");
311 313 }
312 314 YAHOO.example.container.panelEditor.destroy();
... ...
admin/js/subgrupos.js
... ... @@ -98,6 +98,13 @@ function montaTabela_S(dados)
98 98 {
99 99 this.cancelCellEditor();
100 100 });
  101 + myDataTable.subscribe("editorSaveEvent", function(oArgs)
  102 + {
  103 + if(oArgs.newData != oArgs.oldData)
  104 + var linha = myDataTable.getTrEl(oArgs.editor.record)
  105 + linha.style.color = "blue";
  106 + });
  107 +
101 108 };
102 109 core_carregando("desativa");
103 110 }
... ...
admin/js/tags.js
... ... @@ -95,6 +95,13 @@ function montaTabela(dados)
95 95 {
96 96 this.cancelCellEditor();
97 97 });
  98 + myDataTable.subscribe("editorSaveEvent", function(oArgs)
  99 + {
  100 + if(oArgs.newData != oArgs.oldData)
  101 + var linha = myDataTable.getTrEl(oArgs.editor.record)
  102 + linha.style.color = "blue";
  103 + });
  104 +
98 105 };
99 106 core_carregando("desativa");
100 107 }
... ...
admin/js/temasold.js
... ... @@ -1,244 +0,0 @@
1   -/*
2   -Title: Arvore
3   -
4   -Funções javascript utilizadas no sistema de administração do menu de mapas
5   -
6   -File: i3geo/admin/mapas.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   -$i = function(i)
30   -{return document.getElementById(i);};
31   -
32   -YAHOO.namespace("example.container");
33   -
34   -function pegaClasses(codigoMap,codigoLayer)
35   -{
36   - var ins = "<br><fieldset style='background-color:beige'><legend>+- Classes</legend><div style=display:none >"
37   - ins += "<p><input onclick=adicionarClasse('"+codigoLayer+"',this) type=button value='Adicionar classe' /></p>"
38   - ins += "<br><fieldset><legend>+- Legenda (amostra)</legend><div style=display:none >"
39   - ins += "<img id='legenda_"+codigoLayer+"' src='../ogc.php?tema=bioma&service=wms&request=getlegendgraphic&layer="+codigoLayer+"&format=image/png' />"
40   - ins += "</div></fieldset>"
41   - var retorna = function(retorna)
42   - {
43   - var nc = retorna.data.length
44   - for(c=0;c<nc;c++)
45   - {
46   - d = retorna.data[c]
47   -
48   - ins += (geraLinhas2(d.dados,param,"salvarClasse"));
49   -
50   - var param = {
51   - "linhas":[
52   - ]
53   - }
54   -
55   - ins += "<br><fieldset style=background-color:#f0e68c ><legend style=color:brown >+- Mais...</legend><div style=display:none >"
56   - ins += (geraLinhas2(d.dados,param,"salvarClasse"));
57   - ins += "</fieldset>"
58   - //labels
59   - ins += "<br><fieldset><legend style=color:brown >+- Label (para ativar, defina LABELITEM em caract. gerais)</legend><div style=display:none >"
60   - var param = {
61   - "linhas":[
62   - ]
63   - }
64   -
65   -
66   - ins += (geraLinhas2(d.dados,param,"salvarClasseLabel"));
67   - var param = {
68   - "linhas":[
69   - ]
70   - }
71   - ins += "<br><fieldset style=background-color:#f0e68c ><legend style=color:brown >+- Mais...</legend><div style=display:none >"
72   - ins += (geraLinhas2(d.dados,param,"salvarClasseLabel"));
73   - ins += "</fieldset>"
74   -
75   - ins += "</div></fieldset>"
76   -
77   - ins += "<br><fieldset><legend style=color:brown >+- Estilos</legend><div style=display:none >"
78   - ins += "<p><input onclick=adicionarEstilo('"+codigoLayer+"','"+d.id+"',this) type=button value='Adicionar estilo' /></p>"
79   - ins += "<div id='estilos_"+codigoLayer+"_"+d.id+"' ></div>"
80   - ins += "</div></fieldset>"
81   - ins += "</div></fieldset>"
82   - }
83   - ins += "</div></fieldset>"
84   - $i("classes_"+codigoLayer+"_"+codigoMap).innerHTML = ins
85   - pegaEstilos(codigoMap,codigoLayer)
86   - }
87   - var p = "../php/temas.php?funcao=pegaClasses&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
88   - cPaint.call(p,"",retorna);
89   -
90   -}
91   -function pegaEstilos(codigoMap,codigoLayer)
92   -{
93   -
94   - }
95   - var p = "../php/temas.php?funcao=pegaEstilos&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
96   - cPaint.call(p,"",retorna);
97   -}
98   -
99   -function testarMap()
100   -{
101   - var codigo = $i("temaAtivo").value
102   - window.open("../testamapfile.php?map="+codigo+".map")
103   -}
104   -function salvarLayer(layer,parametro,icone)
105   -{
106   - icone.src="../imagens/aguarde.gif"
107   - var retorna = function(retorno)
108   - {icone.src="../imagens/02.png";}
109   - var valor = $i(parametro+"_"+layer).value
110   - $i(parametro+"_"+layer).style.color="black"
111   - var p = "../php/temas.php?funcao=alteraLayer&codigoMap="+$i("temaAtivo").value+"&codigoLayer="+layer+"&parametro="+parametro+"&valor="+valor;
112   - cPaint.call(p,"",retorna);
113   -}
114   -function salvarMetadados(layer,parametro,icone)
115   -{
116   - icone.src="../imagens/aguarde.gif"
117   - var retorna = function(retorno)
118   - {icone.src="../imagens/02.png";}
119   - var valor = $i(parametro+"_"+layer).value
120   - $i(parametro+"_"+layer).style.color="black"
121   - var p = "../php/temas.php?funcao=alteraMetadados&codigoMap="+$i("temaAtivo").value+"&codigoLayer="+layer+"&parametro="+parametro+"&valor="+valor;
122   - cPaint.call(p,"",retorna);
123   -}
124   -function salvarClasse(layer,parametro,icone)
125   -{
126   - icone.src="../imagens/aguarde.gif"
127   - var temp = layer.split("_")
128   - var layer = temp[0]
129   - var classe = temp[1]
130   - var retorna = function(retorno)
131   - {
132   - icone.src="../imagens/02.png";
133   - contaN++
134   - $i('legenda_'+layer).src='../ogc.php?tema='+layer+'&service=wms&request=getlegendgraphic&layer='+layer+'&format=image/png&'+contaN
135   - }
136   - var valor = $i(parametro+"_"+layer+"_"+classe).value
137   - $i(parametro+"_"+layer+"_"+classe).style.color="black"
138   - var p = "../php/temas.php?funcao=alteraClasse&codigoMap="+$i("temaAtivo").value+"&codigoLayer="+layer+"&classe="+classe+"&parametro="+parametro+"&valor="+valor;
139   - cPaint.call(p,"",retorna);
140   -}
141   -function salvarClasseLabel(layer,parametro,icone)
142   -{
143   - icone.src="../imagens/aguarde.gif"
144   - var temp = layer.split("_")
145   - var layer = temp[0]
146   - var classe = temp[1]
147   - var parametro = parametro.split(".");
148   - var parametro = parametro[1]
149   - var retorna = function(retorno)
150   - {icone.src="../imagens/02.png";}
151   - var valor = $i("label_"+parametro+"_"+layer+"_"+classe).value
152   - $i("label_"+parametro+"_"+layer+"_"+classe).style.color="black"
153   - var p = "../php/temas.php?funcao=alteraClasseLabel&codigoMap="+$i("temaAtivo").value+"&codigoLayer="+layer+"&classe="+classe+"&parametro="+parametro+"&valor="+valor;
154   - cPaint.call(p,"",retorna);
155   -}
156   -function salvarEstilo(estilo,parametro,icone)
157   -{
158   - icone.src="../imagens/aguarde.gif"
159   - var temp = estilo.split("_")
160   - var layer = temp[1]
161   - var classe = temp[2]
162   - var estilo = temp[3]
163   - var retorna = function(retorno)
164   - {
165   - icone.src="../imagens/02.png";
166   - contaN++
167   - $i('legenda_'+layer).src='../ogc.php?tema='+layer+'&service=wms&request=getlegendgraphic&layer='+layer+'&format=image/png&'+contaN
168   - }
169   - var valor = $i(parametro+"_"+layer+"_"+classe+"_"+estilo).value
170   - $i(parametro+"_"+layer+"_"+classe+"_"+estilo).style.color="black"
171   - var p = "../php/temas.php?funcao=alteraEstilo&codigoMap="+$i("temaAtivo").value+"&codigoLayer="+layer+"&classe="+classe+"&estilo="+estilo+"&parametro="+parametro+"&valor="+valor;
172   - cPaint.call(p,"",retorna);
173   -}
174   -function adicionarClasse(codigoLayer,botao)
175   -{
176   - botao.style.color="red"
177   - var o = botao.value
178   - botao.value = "Aguarde..."
179   - var codigoMap = $i("temaAtivo").value
180   - if(codigoMap != "")
181   - {
182   - var retorna = function(retorno)
183   - {
184   - pegaClasses(codigoMap,codigoLayer)
185   - }
186   - var p = "../php/temas.php?funcao=adicionarClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
187   - cPaint.call(p,"",retorna);
188   - }
189   -}
190   -function adicionarEstilo(codigoLayer,codigoClasse,botao)
191   -{
192   - botao.style.color="red"
193   - var o = botao.value
194   - botao.value = "Aguarde..."
195   - var codigoMap = $i("temaAtivo").value
196   - if(codigoMap != "")
197   - {
198   - var retorna = function(retorno)
199   - {
200   - pegaEstilos(codigoMap,codigoLayer)
201   - }
202   - var p = "../php/temas.php?funcao=adicionarClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&codigoClasse="+codigoClasse;
203   - cPaint.call(p,"",retorna);
204   - }
205   -}
206   -function excluirClasse(codigoLayer,codigoClasse,botao)
207   -{
208   - if(confirm("Você realmente quer fazer isso?"))
209   - {
210   - botao.style.color="red"
211   - var o = botao.value
212   - botao.value = "Aguarde..."
213   - var codigoMap = $i("temaAtivo").value
214   - if(codigoMap != "")
215   - {
216   - var retorna = function(retorno)
217   - {
218   - pegaClasses(codigoMap,codigoLayer)
219   - }
220   - var p = "../php/temas.php?funcao=excluirClasse&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer+"&codigoClasse="+codigoClasse;
221   - cPaint.call(p,"",retorna);
222   - }
223   - }
224   -}
225   -function excluirLayer(codigoLayer,botao)
226   -{
227   - if(confirm("Você realmente quer fazer isso?"))
228   - {
229   - botao.style.color="red"
230   - var o = botao.value
231   - botao.value = "Aguarde..."
232   - var codigoMap = $i("temaAtivo").value
233   - if(codigoMap != "")
234   - {
235   - var retorna = function(retorno)
236   - {
237   - ativaTema(codigoMap)
238   - }
239   - var p = "../php/temas.php?funcao=excluirLayer&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer;
240   - cPaint.call(p,"",retorna);
241   - }
242   - }
243   -}
244   -YAHOO.util.Event.addListener(window, "load", initMenu);
245 0 \ No newline at end of file
admin/js/webservices.js
... ... @@ -150,16 +150,16 @@ function montaDiv(i)
150 150 ins += ">---</option>"
151 151 ins += "<option value='WMS' "
152 152 if (i.tipo_ws == "WMS"){ins += "selected";}
153   - ins += " >WMS<option>"
  153 + ins += " >WMS</option>"
154 154 ins += "<option value='GEORSS' "
155 155 if (i.tipo_ws == "GEORSS"){ins += "selected";}
156   - ins += " >GEORSS<option>"
  156 + ins += " >GEORSS</option>"
157 157 ins += "<option value='WS' "
158 158 if (i.tipo_ws == "WS"){ins += "selected";}
159   - ins += " >WS<option>"
  159 + ins += " >WS</option>"
160 160 ins += "<option value='DOWNLOAD' "
161 161 if (i.tipo_ws == "DOWNLOAD"){ins += "selected";}
162   - ins += " >DOWNLOAD<option>"
  162 + ins += " >DOWNLOAD</option>"
163 163 ins += "</select></p>"
164 164 return(ins)
165 165 }
... ...
admin/php/admin.php
... ... @@ -88,12 +88,18 @@ function retornaJSON($obj)
88 88 {
89 89 include_once($locaplic."/pacotes/cpaint/JSON/json2.php");
90 90 $j = new Services_JSON();
91   - echo $j->encode($obj);
  91 + $texto = $j->encode($obj);
  92 + if (!mb_detect_encoding($texto,"UTF-8",true))
  93 + $texto = utf8_encode($texto);
  94 + echo $texto;
92 95 }
93 96 else
94 97 {
95 98 if(extension_loaded('zlib')){ob_start('ob_gzhandler');}
96   - echo json_encode($obj);
  99 + $texto = json_encode($obj);
  100 + if (!mb_detect_encoding($texto,"UTF-8",true))
  101 + $texto = utf8_encode($texto);
  102 + echo $texto;
97 103 if(extension_loaded('zlib')){ob_end_flush();}
98 104 }
99 105 exit;
... ... @@ -122,6 +128,7 @@ string - sim|nao
122 128 function verificaEditores($editores)
123 129 {
124 130 $editor = "nao";
  131 + if($editores == ""){return $editor;}
125 132 foreach ($editores as $e)
126 133 {
127 134 $e = gethostbyname($e);
... ... @@ -271,5 +278,20 @@ function verificaFilhos()
271 278 return "Error!: " . $e->getMessage();
272 279 }
273 280 }
274   -
  281 +function resolveAcentos($palavra,$tipo)
  282 +{
  283 + if($tipo == "ISO")
  284 + {
  285 + $palavra = mb_convert_encoding($palavra,"AUTO","ISO-8859-1");
  286 + }
  287 + if($tipo == "UTF")
  288 + {
  289 + $palavra = mb_convert_encoding($palavra,"AUTO","UTF-8");
  290 + }
  291 + if($tipo == "html")
  292 + $palavra = htmlentities($palavra);
  293 + if($tipo == "palno")
  294 + $palavra = urldecode($palavra);
  295 + return $palavra;
  296 +}
275 297 ?>
276 298 \ No newline at end of file
... ...
admin/php/arvore.php
... ... @@ -28,6 +28,7 @@ File: i3geo/admin/arvore.php
28 28  
29 29 */
30 30 require_once("admin.php");
  31 +error_reporting(0);
31 32 //faz a busca da função que deve ser executada
32 33 switch ($funcao)
33 34 {
... ... @@ -160,13 +161,13 @@ Altera o registro de um nível 3 (temas)
160 161 */
161 162 function alteraN3()
162 163 {
163   - global $publicado,$n3_perfil,$id,$id_n2,$id_tema,$ordem;
  164 + global $publicado,$n3_perfil,$id,$id_n2,$id_tema;
164 165 try
165 166 {
166 167 require_once("conexao.php");
167 168 if($id != "")
168 169 {
169   - $dbhw->query("UPDATE i3geoadmin_n3 SET publicado = '$publicado',ordem = '$ordem',id_tema = '$id_tema', n3_perfil = '$perfil' WHERE id_n3 = $id");
  170 + $dbhw->query("UPDATE i3geoadmin_n3 SET publicado = '$publicado',id_tema = '$id_tema', n3_perfil = '$n3_perfil' WHERE id_n3 = $id");
170 171 $retorna = $id;
171 172 }
172 173 else
... ... @@ -194,18 +195,18 @@ Altera o registro de um nível 2
194 195 */
195 196 function alteraN2()
196 197 {
197   - global $publicado,$n2_perfil,$id,$id_subgrupo,$id_n1,$ordem;
  198 + global $publicado,$n2_perfil,$id,$id_subgrupo,$id_n1;
198 199 try
199 200 {
200 201 require_once("conexao.php");
201 202 if($id != "")
202 203 {
203   - $dbhw->query("UPDATE i3geoadmin_n2 SET publicado='$publicado', ordem = '$ordem',id_subgrupo = '$id_subgrupo', n2_perfil = '$n2_perfil' WHERE id_n2 = $id");
  204 + $dbhw->query("UPDATE i3geoadmin_n2 SET publicado='$publicado', id_subgrupo = '$id_subgrupo', n2_perfil = '$n2_perfil' WHERE id_n2 = $id");
204 205 $retorna = $id;
205 206 }
206 207 else
207 208 {
208   - $o = $dbhw->query("SELECT MAX(ordem) as o FROM i3geoadmin_n2 where id_n1 = '$id_1'");
  209 + $o = $dbhw->query("SELECT MAX(ordem) as o FROM i3geoadmin_n2 where id_n1 = '$id_n1'");
209 210 $o = $o->fetchAll();
210 211 $o = $o[0]['o'] + 1;
211 212 $dbhw->query("INSERT INTO i3geoadmin_n2 (id_n1,id_subgrupo,n2_perfil,ordem) VALUES ($id_n1,'', '',$o)");
... ... @@ -230,13 +231,13 @@ Altera o registro de um nível 1 (grupos)
230 231 */
231 232 function alteraN1()
232 233 {
233   - global $publicado,$n1_perfil,$id_grupo,$id,$id_menu,$ordem;
  234 + global $publicado,$n1_perfil,$id_grupo,$id,$id_menu;
234 235 try
235 236 {
236 237 require_once("conexao.php");
237 238 if($id != "")
238 239 {
239   - $dbhw->query("UPDATE i3geoadmin_n1 SET publicado = '$publicado', ordem = '$ordem', id_grupo = '$id_grupo', n1_perfil = '$n1_perfil' WHERE id_n1 = $id");
  240 + $dbhw->query("UPDATE i3geoadmin_n1 SET publicado = '$publicado', id_grupo = '$id_grupo', n1_perfil = '$n1_perfil' WHERE id_n1 = $id");
240 241 $retorna = $id;
241 242 }
242 243 else
... ... @@ -266,13 +267,13 @@ Altera o registro na raiz de um nível
266 267 */
267 268 function alterarRaiz()
268 269 {
269   - global $id_nivel,$nivel,$id,$id_menu,$perfil,$id_tema,$ordem;
  270 + global $id_nivel,$nivel,$id,$id_menu,$perfil,$id_tema;
270 271 try
271 272 {
272 273 include("conexao.php");
273 274 if($id != "")
274 275 {
275   - $dbhw->query("UPDATE i3geoadmin_raiz SET ordem = '$ordem', perfil = '$perfil', id_tema = '$id_tema' WHERE id_raiz = $id");
  276 + $dbhw->query("UPDATE i3geoadmin_raiz SET perfil = '$perfil', id_tema = '$id_tema' WHERE id_raiz = $id");
276 277 $retorna = $id;
277 278 }
278 279 else
... ...
admin/php/atlas.php
... ... @@ -185,9 +185,12 @@ function alterarAtlas()
185 185 global $publicado_atlas,$id_atlas,$basemapfile_atlas,$desc_atlas,$h_atlas,$w_atlas,$icone_atlas,$link_atlas,$pranchadefault_atlas,$template_atlas,$tipoguias_atlas,$titulo_atlas,$ordem_atlas;
186 186 try
187 187 {
188   - //$desc_atlas = mb_convert_encoding($desc_atlas,"UTF-8","ISO-8859-1");
189   - //$titulo_atlas = mb_convert_encoding($titulo_atlas,"UTF-8","ISO-8859-1");
190 188 include("conexao.php");
  189 + if($convUTF)
  190 + {
  191 + $desc_atlas = utf8_encode($desc_atlas);
  192 + $titulo_atlas = utf8_encode($titulo_atlas);
  193 + }
191 194 if($id_atlas != "")
192 195 {
193 196 $dbhw->query("UPDATE i3geoadmin_atlas SET publicado_atlas='$publicado_atlas',ordem_atlas='$ordem_atlas',basemapfile_atlas='$basemapfile_atlas',desc_atlas='$desc_atlas',h_atlas='$h_atlas',w_atlas='$w_atlas',icone_atlas='$icone_atlas',link_atlas='$link_atlas',pranchadefault_atlas='$pranchadefault_atlas',template_atlas='$template_atlas',tipoguias_atlas='$tipoguias_atlas',titulo_atlas='$titulo_atlas' WHERE id_atlas = $id_atlas");
... ... @@ -218,9 +221,12 @@ function alterarPrancha()
218 221 global $mapext_prancha,$id_atlas,$id_prancha,$desc_prancha,$h_prancha,$w_prancha,$icone_prancha,$link_prancha,$titulo_prancha,$ordem_prancha;
219 222 try
220 223 {
221   - //$desc_prancha = mb_convert_encoding($desc_prancha,"UTF-8","ISO-8859-1");
222   - //$titulo_prancha = mb_convert_encoding($titulo_prancha,"UTF-8","ISO-8859-1");
223 224 include("conexao.php");
  225 + if($convUTF)
  226 + {
  227 + $desc_prancha = utf8_encode($desc_prancha);
  228 + $titulo_prancha = utf8_encode($titulo_prancha);
  229 + }
224 230 if($id_prancha != "")
225 231 {
226 232 $dbhw->query("UPDATE i3geoadmin_atlasp SET ordem_prancha='$ordem_prancha', mapext_prancha='$mapext_prancha',desc_prancha='$desc_prancha',h_prancha='$h_prancha',w_prancha='$w_prancha',icone_prancha='$icone_prancha',link_prancha='$link_prancha',titulo_prancha='$titulo_prancha' WHERE id_prancha = '$id_prancha'");
... ... @@ -330,6 +336,7 @@ function excluirAtlas()
330 336 function importarXmlAtlas()
331 337 {
332 338 global $xml,$tipo;
  339 + set_time_limit(180);
333 340 if(!file_exists($xml))
334 341 {return "<br><b>Arquivo $xml n&atilde;o encontrado";}
335 342 include_once("../../classesphp/funcoes_gerais.php");
... ... @@ -348,6 +355,11 @@ function importarXmlAtlas()
348 355 {
349 356 $titulo = html_entity_decode(ixml($atlas,"TITULO"));
350 357 $desc = html_entity_decode(ixml($atlas,"DESCRICAO"));
  358 + if($convUTF)
  359 + {
  360 + $titulo = utf8_encode($titulo);
  361 + $desc = utf8_encode($desc);
  362 + }
351 363 $icone = ixml($atlas,"ICONE");
352 364 $link = ixml($atlas,"LINKMAISINFO");
353 365 $template = ixml($atlas,"TEMPLATEHTML");
... ... @@ -369,6 +381,11 @@ function importarXmlAtlas()
369 381 {
370 382 $titulo = html_entity_decode(ixml($prancha,"TITULO"));
371 383 $desc = html_entity_decode(ixml($prancha,"DESCRICAO"));
  384 + if($convUTF)
  385 + {
  386 + $titulo = utf8_encode($titulo);
  387 + $desc = utf8_encode($desc);
  388 + }
372 389 $icone = ixml($prancha,"ICONE");
373 390 $link = ixml($prancha,"LINKMAISINFO");
374 391 $w = ixml($prancha,"WABERUTRA");
... ...
admin/php/conexao.php
... ... @@ -56,6 +56,11 @@ else
56 56 if(!isset($conexaoadmin))
57 57 {$conexaoadmin = "";}
58 58  
  59 +//
  60 +//indica se deve ser feita a conversão para UTF8 ao gravar os dados
  61 +//
  62 +$convUTF = true;
  63 +
59 64 if($conexaoadmin == "")
60 65 {
61 66 $arquivosqlite = $locaplic."/menutemas/admin.db";
... ...
admin/php/conexaomma.php
1 1 <?php
2 2 $dbh = new PDO('pgsql:dbname=geodados;user=geodados;password=geodados;host=dsvmapas.mma.gov.br');
3 3 $dbhw = new PDO('pgsql:dbname=geodados;user=pgsql;password=pgsql;host=dsvmapas.mma.gov.br');
  4 +$convUTF = false;
4 5 ?>
5 6 \ No newline at end of file
... ...
admin/php/editormapfile.php
... ... @@ -362,7 +362,10 @@ function pegaConexao()
362 362 $dados["tileindex"] = $layer->tileindex;
363 363 $dados["tileitem"] = $layer->tileitem;
364 364 if($dados["tileindex"] == ""){$dados["tileitem"] = "";}
  365 + if(is_array($postgis_mapa))
365 366 $dados["postgis_mapa"] = array_keys($postgis_mapa);
  367 + else
  368 + $dados["postgis_mapa"] = $postgis_mapa;
366 369 $dados["codigoMap"] = $codigoMap;
367 370 $dados["codigoLayer"] = $codigoLayer;
368 371 return $dados;
... ...
admin/php/identifica.php
... ... @@ -28,6 +28,7 @@ File: i3geo/admin/identifica.php
28 28  
29 29 */
30 30 include_once("admin.php");
  31 +error_reporting(0);
31 32 //faz a busca da função que deve ser executada
32 33 switch ($funcao)
33 34 {
... ... @@ -72,6 +73,10 @@ function alterarFuncoes()
72 73 {
73 74 //$nome_i = mb_convert_encoding($nome_i,"UTF-8","ISO-8859-1");
74 75 require_once("conexao.php");
  76 + if($convUTF)
  77 + {
  78 + $nome_i = utf8_encode($nome_i);
  79 + }
75 80 if($id_i != "")
76 81 {
77 82 $dbhw->query("UPDATE i3geoadmin_identifica SET publicado_i = '$publicado_i',nome_i = '$nome_i',abrir_i = '$abrir_i', target_i = '$target_i' WHERE id_i = $id_i");
... ... @@ -129,6 +134,10 @@ function importarXmlI()
129 134 foreach($xml->FUNCAO as $item)
130 135 {
131 136 $nome_i = html_entity_decode(ixml($item,"NOMESIS"));
  137 + if($convUTF)
  138 + {
  139 + $nome_i = utf8_encode($nome_i);
  140 + }
132 141 $target_i = ixml($item,"TARGET");
133 142 $abrir_i = ixml($item,"ABRIR");
134 143 if(!isset($iExistentes[$nome_i]))
... ...
admin/php/mapas.php
... ... @@ -28,6 +28,7 @@ File: i3geo/admin/mapas.php
28 28  
29 29 */
30 30 include_once("admin.php");
  31 +error_reporting(0);
31 32 //faz a busca da função que deve ser executada
32 33 switch ($funcao)
33 34 {
... ... @@ -69,9 +70,12 @@ function alterarMapa()
69 70 global $publicado_mapa,$ordem_mapa,$id_mapa,$desc_mapa,$ext_mapa,$imagem_mapa,$outros_mapa,$nome_mapa,$linkdireto_mapa,$temas_mapa,$ligados_mapa,$perfil_mapa;
70 71 try
71 72 {
72   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
73   - //$desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
74 73 require_once("conexao.php");
  74 + if($convUTF)
  75 + {
  76 + $nome_mapa = utf8_encode($nome_mapa);
  77 + $desc_mapa = utf8_encode($desc_mapa);
  78 + }
75 79 $retorna = "";
76 80 if($id_mapa != "")
77 81 {
... ... @@ -131,9 +135,12 @@ function importarXmlMapas()
131 135 {
132 136 $perfil = ixml($mapa,"PERFIL");
133 137 $descricao = html_entity_decode(ixml($mapa,"DESCRICAO"));
134   - //$descricao = mb_convert_encoding($descricao,"UTF-8","ISO-8859-1");
135 138 $nome = html_entity_decode(ixml($mapa,"NOME"));
136   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
  139 + if($convUTF)
  140 + {
  141 + $nome = utf8_encode($nome);
  142 + $descricao = utf8_encode($descricao);
  143 + }
137 144 $imagem = ixml($mapa,"IMAGEM");
138 145 $temas = ixml($mapa,"TEMAS");
139 146 $ligados = ixml($mapa,"LIGADOS");
... ...
admin/php/menutemas.php
... ... @@ -433,10 +433,13 @@ function alteraMenus()
433 433 global $nome,$desc,$id,$aberto,$perfil,$publicado_menu;
434 434 try
435 435 {
436   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
437   - //$desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
438 436 $retorna = "";
439 437 include("conexao.php");
  438 + if($convUTF)
  439 + {
  440 + $nome = utf8_encode($nome);
  441 + $desc = utf8_encode($desc);
  442 + }
440 443 if($id != "")
441 444 {
442 445 $dbhw->query("UPDATE i3geoadmin_menus SET publicado_menu = '$publicado_menu',aberto = '$aberto', nome_menu = '$nome', desc_menu = '$desc', perfil_menu = '$perfil' WHERE id_menu = $id");
... ... @@ -462,10 +465,13 @@ function alteraMenus()
462 465 function alteraPerfis()
463 466 {
464 467 global $perfil,$id;
  468 + //$perfil = resolveAcentos($perfil,"html");
  469 +
465 470 try
466 471 {
467 472 $dbh = "";
468 473 include("conexao.php");
  474 + if($convUTF) $perfil = utf8_encode($perfil);
469 475 $retorna = "";
470 476 if($id != "")
471 477 {
... ... @@ -496,29 +502,29 @@ function alteraPerfis()
496 502 $q = $dbh->query("select * from i3geoadmin_n1");
497 503 foreach($q as $row)
498 504 {
499   - $t = $row['perfil_n1'];
  505 + $t = $row['n1_perfil'];
500 506 $i = $row['id_n1'];
501 507 $ts = str_replace($original,$perfil,$t);
502 508 if($t != $ts)
503   - $dbhw->query("UPDATE i3geoadmin_n1 SET perfil_n1 = '$ts' WHERE id_n1 = $i");
  509 + $dbhw->query("UPDATE i3geoadmin_n1 SET n1_perfil = '$ts' WHERE id_n1 = $i");
504 510 }
505 511 $q = $dbh->query("select * from i3geoadmin_n2");
506 512 foreach($q as $row)
507 513 {
508   - $t = $row['perfil_n2'];
  514 + $t = $row['n2_perfil'];
509 515 $i = $row['id_n2'];
510 516 $ts = str_replace($original,$perfil,$t);
511 517 if($t != $ts)
512   - $dbhw->query("UPDATE i3geoadmin_n2 SET perfil_n2 = '$ts' WHERE id_n2 = $i");
  518 + $dbhw->query("UPDATE i3geoadmin_n2 SET n2_perfil = '$ts' WHERE id_n2 = $i");
513 519 }
514 520 $q = $dbh->query("select * from i3geoadmin_n3");
515 521 foreach($q as $row)
516 522 {
517   - $t = $row['perfil_n3'];
  523 + $t = $row['n3_perfil'];
518 524 $i = $row['id_n3'];
519 525 $ts = str_replace($original,$perfil,$t);
520 526 if($t != $ts)
521   - $dbhw->query("UPDATE i3geoadmin_n3 SET perfil_n3 = '$ts' WHERE id_n3 = $i");
  527 + $dbhw->query("UPDATE i3geoadmin_n3 SET n3_perfil = '$ts' WHERE id_n3 = $i");
522 528 }
523 529 $q = $dbh->query("select * from i3geoadmin_raiz");
524 530 foreach($q as $row)
... ... @@ -572,9 +578,11 @@ function alteraTags()
572 578 global $nome,$id;
573 579 try
574 580 {
  581 +
575 582 $dbh = "";
576 583 //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
577 584 include("conexao.php");
  585 + if($convUTF) $nome = utf8_encode($nome);
578 586 $retorna = "";
579 587 if($id != "")
580 588 {
... ... @@ -586,6 +594,7 @@ function alteraTags()
586 594 {$original = $row["nome"];}
587 595 $dbhw->query("UPDATE i3geoadmin_tags SET nome = '$nome' WHERE id_tag = $id");
588 596 //exclui os registros do tag alterado nos temas
  597 + /*
589 598 if($original != "")
590 599 {
591 600 $q = $dbh->query("select tags_tema,id_tema from i3geoadmin_temas");
... ... @@ -596,7 +605,8 @@ function alteraTags()
596 605 $ts = str_replace($original,$nome,$ts);
597 606 $dbhw->query("UPDATE i3geoadmin_temas SET tags_tema = '$ts' WHERE id_tema = $i");
598 607 }
599   - }
  608 + }
  609 + */
600 610 }
601 611 $retorna = $id;
602 612 }
... ... @@ -627,9 +637,12 @@ function alteraGrupos()
627 637 global $nome,$desc,$id;
628 638 try
629 639 {
630   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
631   - //$desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
632 640 include("conexao.php");
  641 + if($convUTF)
  642 + {
  643 + $nome = utf8_encode($nome);
  644 + $desc = utf8_encode($desc);
  645 + }
633 646 $retorna = "";
634 647 if($id != "")
635 648 {
... ... @@ -663,9 +676,12 @@ function alteraSubGrupos()
663 676 global $nome,$desc,$id;
664 677 try
665 678 {
666   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
667   - //$desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
668 679 require_once("conexao.php");
  680 + if($convUTF)
  681 + {
  682 + $nome = utf8_encode($nome);
  683 + $desc = utf8_encode($desc);
  684 + }
669 685 $retorna = "";
670 686 if($id != "")
671 687 {
... ... @@ -700,10 +716,13 @@ function alteraTemas()
700 716 try
701 717 {
702 718 $retorna = "ok";
703   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
704   - //$desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
705   - //$tags = mb_convert_encoding($tags,"UTF-8","ISO-8859-1");
706 719 include("conexao.php");
  720 + if($convUTF)
  721 + {
  722 + $nome = utf8_encode($nome);
  723 + $desc = utf8_encode($desc);
  724 + $tags = utf8_encode($tags);
  725 + }
707 726 if($id != "")
708 727 {
709 728 $dbhw->query("UPDATE i3geoadmin_temas SET tags_tema='$tags', link_tema='$link', nome_tema ='$nome',desc_tema='$desc',codigo_tema='$codigo',tipoa_tema='$tipoa',download_tema='$download',ogc_tema='$ogc',kml_tema='$kml' WHERE id_tema = $id");
... ... @@ -778,16 +797,17 @@ Importa um arquivo xml do tipo &quot;menutemas&quot; para o banco de dados
778 797 function importarXmlMenu()
779 798 {
780 799 global $nomemenu,$xml;
  800 + set_time_limit(180);
781 801 $listaDeTags = array();
782 802 if(!file_exists($xml))
783 803 {return "<br><b>Arquivo $xml n&atilde;o encontrado";}
784 804 include_once("../../classesphp/funcoes_gerais.php");
785 805 include("conexao.php");
  806 + if($convUTF) $nomemenu = utf8_encode($nomemenu);
786 807 $dbhw->query("INSERT INTO i3geoadmin_menus (desc_menu,nome_menu) VALUES ('','$nomemenu')");
787 808 $id_menu = $dbhw->query("SELECT id_menu FROM i3geoadmin_menus");
788 809 $id_menu = $id_menu->fetchAll();
789 810 $id_menu = intval($id_menu[count($id_menu)-1]['id_menu']);
790   -
791 811 $xml = simplexml_load_file($xml);
792 812 //
793 813 //importa os grupos
... ... @@ -801,8 +821,17 @@ function importarXmlMenu()
801 821 {
802 822 $nome = html_entity_decode(ixml($grupo,"GTIPO"));
803 823 $descricao = html_entity_decode(ixml($grupo,"DTIPO"));
  824 + if($convUTF)
  825 + {
  826 + $nome = utf8_encode($nome);
  827 + $descricao = utf8_encode($descricao);
  828 + }
804 829 if(!isset($gruposExistentes[$nome]))
805   - $dbhw->query("INSERT INTO i3geoadmin_grupos (desc_grupo,nome_grupo) VALUES ('$descricao','$nome')");
  830 + {
  831 + $nome = str_replace("'","",$nome);
  832 + $descricao = str_replace("'","",$descricao);
  833 + $dbhw->query("INSERT INTO i3geoadmin_grupos (desc_grupo,nome_grupo) VALUES ('$descricao','$nome')");
  834 + }
806 835 $gruposExistentes[$nome] = 0;
807 836 }
808 837 //
... ... @@ -818,10 +847,18 @@ function importarXmlMenu()
818 847 foreach($grupo->SGRUPO as $sgrupo)
819 848 {
820 849 $nome = html_entity_decode(ixml($sgrupo,"SDTIPO"));
  850 + if($convUTF)
  851 + {
  852 + $nome = utf8_encode($nome);
  853 + }
821 854 $descricao = "";
822 855 if(!isset($subgruposExistentes[$nome]))
823   - $dbhw->query("INSERT INTO i3geoadmin_subgrupos (desc_subgrupo,nome_subgrupo) VALUES ('$descricao','$nome')");
824   - $subgruposExistentes[$nome] = 0;
  856 + {
  857 + $nome = str_replace("'","",$nome);
  858 + $descricao = str_replace("'","",$descricao);
  859 + $dbhw->query("INSERT INTO i3geoadmin_subgrupos (desc_subgrupo,nome_subgrupo) VALUES ('$descricao','$nome')");
  860 + $subgruposExistentes[$nome] = 0;
  861 + }
825 862 }
826 863 }
827 864 //
... ... @@ -839,16 +876,26 @@ function importarXmlMenu()
839 876 {
840 877 $nome = html_entity_decode(ixml($tema,"TNOME"));
841 878 $descricao = html_entity_decode(ixml($tema,"TDESC"));
  879 + if($convUTF)
  880 + {
  881 + $nome = utf8_encode($nome);
  882 + $descricao = utf8_encode($descricao);
  883 + }
842 884 $codigo = ixml($tema,"TID");
843 885 $link = ixml($tema,"TLINK");
844 886 $tipo = ixml($tema,"TIPOA");
845 887 $tags = ixml($tema,"TAGS");
  888 + if($convUTF) $tags = utf8_encode($tags);
846 889 $down = ixml($tema,"DOWNLOAD");
847 890 $kml = ixml($tema,"KML");
848 891 $ogc = ixml($tema,"OGC");
849 892 $listaDeTags = array_merge($listaDeTags,explode(" ",$tags));
850 893 if(!isset($temasExistentes[$codigo]))
851   - $dbhw->query("INSERT INTO i3geoadmin_temas (kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES ('$kml','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");
  894 + {
  895 + $nome = str_replace("'","",$nome);
  896 + $descricao = str_replace("'","",$descricao);
  897 + $dbhw->query("INSERT INTO i3geoadmin_temas (kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES ('$kml','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");
  898 + }
852 899 $temasExistentes[$codigo] = 0;
853 900 }
854 901 foreach($xml->GRUPO as $grupo)
... ... @@ -857,16 +904,26 @@ function importarXmlMenu()
857 904 {
858 905 $nome = html_entity_decode(ixml($tema,"TNOME"));
859 906 $descricao = html_entity_decode(ixml($tema,"TDESC"));
  907 + if($convUTF)
  908 + {
  909 + $nome = utf8_encode($nome);
  910 + $descricao = utf8_encode($descricao);
  911 + }
860 912 $codigo = ixml($tema,"TID");
861 913 $link = ixml($tema,"TLINK");
862 914 $tipo = ixml($tema,"TIPOA");
863 915 $tags = ixml($tema,"TAGS");
  916 + if($convUTF) $tags = utf8_encode($tags);
864 917 $down = ixml($tema,"DOWNLOAD");
865 918 $kml = ixml($tema,"KML");
866 919 $ogc = ixml($tema,"OGC");
867 920 $listaDeTags = array_merge($listaDeTags,explode(" ",$tags));
868 921 if(!isset($temasExistentes[$codigo]))
869   - $dbhw->query("INSERT INTO i3geoadmin_temas (kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES ('$kml','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");
  922 + {
  923 + $nome = str_replace("'","",$nome);
  924 + $descricao = str_replace("'","",$descricao);
  925 + $dbhw->query("INSERT INTO i3geoadmin_temas (kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES ('$kml','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");
  926 + }
870 927 $temasExistentes[$codigo] = 0;
871 928 }
872 929 foreach($grupo->SGRUPO as $sgrupo)
... ... @@ -875,16 +932,26 @@ function importarXmlMenu()
875 932 {
876 933 $nome = html_entity_decode(ixml($tema,"TNOME"));
877 934 $descricao = html_entity_decode(ixml($tema,"TDESC"));
  935 + if($convUTF)
  936 + {
  937 + $nome = utf8_encode($nome);
  938 + $descricao = utf8_encode($descricao);
  939 + }
878 940 $codigo = ixml($tema,"TID");
879 941 $link = ixml($tema,"TLINK");
880 942 $tipo = ixml($tema,"TIPOA");
881   - $tags = ixml($tema,"TAGS");
  943 + $tags = html_entity_decode(ixml($tema,"TAGS"));
  944 + if($convUTF) $tags = utf8_encode($tags);
882 945 $down = ixml($tema,"DOWNLOAD");
883 946 $kml = ixml($tema,"KML");
884 947 $ogc = ixml($tema,"OGC");
885 948 $listaDeTags = array_merge($listaDeTags,explode(" ",$tags));
886 949 if(!isset($temasExistentes[$codigo]))
887   - $dbhw->query("INSERT INTO i3geoadmin_temas (kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES ('$kml','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");
  950 + {
  951 + $nome = str_replace("'","",$nome);
  952 + $descricao = str_replace("'","",$descricao);
  953 + $dbhw->query("INSERT INTO i3geoadmin_temas (kml_tema,ogc_tema,download_tema,tags_tema,tipoa_tema,link_tema,desc_tema,nome_tema,codigo_tema) VALUES ('$kml','$ogc','$down','$tags','$tipo','$link','$descricao','$nome','$codigo')");
  954 + }
888 955 $temasExistentes[$codigo] = 0;
889 956 }
890 957 }
... ... @@ -908,7 +975,8 @@ function importarXmlMenu()
908 975 //
909 976 foreach($xml->GRUPO as $grupo)
910 977 {
911   - $gtipo = ixml($grupo,"GTIPO");
  978 + $gtipo = html_entity_decode(ixml($grupo,"GTIPO"));
  979 + if($convUTF) $gtipo = utf8_encode($gtipo);
912 980 $n1_perfil = ixml($grupo,"PERFIL");
913 981 $r = $dbhw->query("select id_grupo from i3geoadmin_grupos where nome_grupo = '$gtipo'");
914 982 $id_grupo = $r->fetchColumn();
... ... @@ -916,7 +984,6 @@ function importarXmlMenu()
916 984 $id_n1 = $dbhw->query("SELECT id_n1 FROM i3geoadmin_n1");
917 985 $id_n1 = $id_n1->fetchAll();
918 986 $id_n1 = intval($id_n1[count($id_n1)-1]['id_n1']);
919   -
920 987 foreach($grupo->TEMA as $tema)
921 988 {
922 989 $codigo = ixml($tema,"TID");
... ... @@ -927,7 +994,8 @@ function importarXmlMenu()
927 994 }
928 995 foreach($grupo->SGRUPO as $subgrupo)
929 996 {
930   - $sdtipo = ixml($subgrupo,"SDTIPO");
  997 + $sdtipo = html_entity_decode(ixml($subgrupo,"SDTIPO"));
  998 + if($convUTF) $sdtipo = utf8_encode($sdtipo);
931 999 $n2_perfil = ixml($subgrupo,"PERFIL");
932 1000 $r = $dbhw->query("select id_subgrupo from i3geoadmin_subgrupos where nome_subgrupo = '$sdtipo'");
933 1001 $id_subgrupo = $r->fetchColumn();
... ...
admin/php/ms_configura.php
... ... @@ -65,7 +65,7 @@ switch ($funcao)
65 65 $par[$v] = $s;
66 66 }
67 67 else
68   - $par[$v] = $s;
  68 + $par[$v] = utf8_encode($s);
69 69 }
70 70 retornaJSON($par);
71 71 exit;
... ... @@ -90,6 +90,7 @@ valor - novo valor
90 90 */
91 91 function salvaConfigura($variavel,$valor)
92 92 {
  93 + //$valor = resolveAcentos($valor,"html");
93 94 $handle = fopen ("../../ms_configura.php", "r");
94 95 $linhas = array();
95 96 while (!feof ($handle)) {
... ...
admin/php/sistemas.php
... ... @@ -28,6 +28,7 @@ File: i3geo/admin/sistemas.php
28 28  
29 29 */
30 30 include_once("admin.php");
  31 +error_reporting(0);
31 32 //faz a busca da função que deve ser executada
32 33 switch ($funcao)
33 34 {
... ... @@ -102,7 +103,10 @@ function alterarSistemas()
102 103 try
103 104 {
104 105 require_once("conexao.php");
105   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
  106 + if($convUTF)
  107 + {
  108 + $nome_sistema = utf8_encode($nome_sistema);
  109 + }
106 110 if($id_sistema != "")
107 111 {
108 112 $dbhw->query("UPDATE i3geoadmin_sistemas SET publicado_sistema='$publicado_sistema',nome_sistema = '$nome_sistema',perfil_sistema = '$perfil_sistema' WHERE id_sistema = $id_sistema");
... ... @@ -131,7 +135,10 @@ function alterarFuncoes()
131 135 try
132 136 {
133 137 require_once("conexao.php");
134   - //$nomefuncao = mb_convert_encoding($nomefuncao,"UTF-8","ISO-8859-1");
  138 + if($convUTF)
  139 + {
  140 + $nome_funcao = utf8_encode($nome_funcao);
  141 + }
135 142 if($id_funcao != "")
136 143 {
137 144 $dbhw->query("UPDATE i3geoadmin_sistemasf SET nome_funcao = '$nome_funcao',perfil_funcao = '$perfil_funcao', w_funcao = '$w_funcao',h_funcao = '$h_funcao', abrir_funcao = '$abrir_funcao' WHERE id_funcao = $id_funcao");
... ... @@ -205,6 +212,10 @@ function importarXmlSistemas()
205 212 foreach($xml->SISTEMA as $item)
206 213 {
207 214 $nome = html_entity_decode(ixml($item,"NOMESIS"));
  215 + if($convUTF)
  216 + {
  217 + $nome = utf8_encode($nome);
  218 + }
208 219 $perfil = ixml($item,"PERFIL");
209 220 if(!isset($sistemasExistentes[$nome]))
210 221 $dbhw->query("INSERT INTO i3geoadmin_sistemas (publicado_sistema,nome_sistema,perfil_sistema) VALUES ('','$nome','$perfil')");
... ... @@ -216,6 +227,10 @@ function importarXmlSistemas()
216 227 {
217 228 $abrir_funcao = ixml($funcao,"ABRIR");
218 229 $nome_funcao = html_entity_decode(ixml($funcao,"NOMEFUNCAO"));
  230 + if($convUTF)
  231 + {
  232 + $nome_funcao = utf8_encode($nome_funcao);
  233 + }
219 234 $w_funcao = ixml($funcao,"JANELAW");
220 235 $h_funcao = ixml($funcao,"JANELAH");
221 236 $perfil_funcao = ixml($funcao,"PERFIL");
... ...
admin/php/webservices.php
... ... @@ -70,9 +70,12 @@ function alterarWS()
70 70 try
71 71 {
72 72 require_once("conexao.php");
73   - //$nome = mb_convert_encoding($nome,"UTF-8","ISO-8859-1");
74   - //$desc = mb_convert_encoding($desc,"UTF-8","ISO-8859-1");
75   - //$autor = mb_convert_encoding($autor,"UTF-8","ISO-8859-1");
  73 + if($convUTF)
  74 + {
  75 + $nome_ws = utf8_encode($nome_ws);
  76 + $desc_ws = utf8_encode($desc_ws);
  77 + $autor_ws = utf8_encode($autor_ws);
  78 + }
76 79 if($id_ws != "")
77 80 {
78 81 $dbhw->query("UPDATE i3geoadmin_ws SET desc_ws = '$desc_ws',nome_ws = '$nome_ws', link_ws = '$link_ws', autor_ws = '$autor_ws', tipo_ws = '$tipo_ws' WHERE id_ws = $id_ws");
... ... @@ -114,6 +117,7 @@ function excluirWS()
114 117 function importarXmlWS()
115 118 {
116 119 global $xml,$tipo;
  120 + set_time_limit(180);
117 121 if(!file_exists($xml))
118 122 {return "<br><b>Arquivo $xml n&atilde;o encontrado";}
119 123 include_once("../../classesphp/funcoes_gerais.php");
... ... @@ -131,10 +135,16 @@ function importarXmlWS()
131 135 {
132 136 foreach($c->item as $item)
133 137 {
134   - $descricao = html_entity_decode(ixml($item,"description"));
  138 + $desc = html_entity_decode(ixml($item,"description"));
135 139 $nome = html_entity_decode(ixml($item,"title"));
136   - $autor = ixml($item,"author");
  140 + $autor = html_entity_decode(ixml($item,"author"));
137 141 $link = ixml($item,"link");
  142 + if($convUTF)
  143 + {
  144 + $nome = utf8_encode($nome);
  145 + $desc = utf8_encode($desc);
  146 + $autor = utf8_encode($autor);
  147 + }
138 148 if(!isset($wsExistentes[$nome]))
139 149 $dbhw->query("INSERT INTO i3geoadmin_ws (nome_ws,desc_ws,autor_ws,link_ws,tipo_ws) VALUES ('$nome','$desc','$autor','$link','$tipo')");
140 150 $wsExistentes[$nome] = 0;
... ...