Commit 71870840b02c7f5e2f3044ac8960cbe367782d3d

Authored by Edmar Moretti
1 parent 5d53c782

Remoção do php admin/php/editormapfile.php

Showing 64 changed files with 2959 additions and 2836 deletions   Show diff stats
admin/php/editormapfile.php
@@ -1,2598 +0,0 @@ @@ -1,2598 +0,0 @@
1 -<?php  
2 -/*  
3 -Title: editormapfile.php  
4 -  
5 -Fun&ccedil;&otilde;es utilizadas pelo editor de arquivos mapfile.  
6 -  
7 -&Eacute; utilizado nas fun&ccedil;&otilde;es em AJAX da interface de edi&ccedil;&atilde;o de mapfiles  
8 -  
9 -Licenca:  
10 -  
11 -GPL2  
12 -  
13 -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet  
14 -  
15 -Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil  
16 -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com  
17 -  
18 -Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo  
19 -e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral  
20 -GNU conforme publicada pela Free Software Foundation;  
21 -  
22 -Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,  
23 -por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita  
24 -de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.  
25 -Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.  
26 -Voc&ecirc; deve ter recebido uma copia da Licen&ccedil;a P&uacute;blica Geral do  
27 - GNU junto com este programa; se n&atilde;o, escreva para a  
28 -Free Software Foundation, Inc., no endere&ccedil;o  
29 -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.  
30 -  
31 -Arquivo:  
32 -  
33 -i3geo/admin/php/editormapfile.php  
34 -  
35 -Parametros:  
36 -  
37 -O par&acirc;metro principal &eacute; "funcao", que define qual opera&ccedil;&atilde;o ser&aacute; executada, por exemplo, editormapfile.php?funcao=pegaMapfiles  
38 -  
39 -Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.  
40 -  
41 -*/  
42 -include_once(dirname(__FILE__)."/login.php");  
43 -  
44 -$id = $_GET["id"];  
45 -  
46 -testaSafeNumerico([$id]);  
47 -  
48 -$codigoMap = $_GET["codigoMap"];  
49 -$codigomap = $_GET["codigomap"];  
50 -$codigoLayer = $_GET["codigoLayer"];  
51 -$nomelayer = $_GET["nomelayer"];  
52 -$movimento = $_GET["movimento"];  
53 -  
54 -$funcoesEdicao = array(  
55 - "CRIARNOVOMAP",  
56 - "EDITASIMBOLO",  
57 - "LIMPARCACHEMAPFILE",  
58 - "EXCLUIRMAPFILE",  
59 - "REFAZERLAYER",  
60 - "CLONARMAPFILE",  
61 - "CRIARNOVOLAYER",  
62 - "EXCLUIRLAYER",  
63 - "AUTOCLASSESLAYER",  
64 - "CRIARNOVACLASSE",  
65 - "EXCLUIRCLASSE",  
66 - "CRIARNOVOESTILO",  
67 - "EXCLUIRESTILO",  
68 - "ALTERARESTILO",  
69 - "ALTERARCONEXAO",  
70 - "ALTERARTITULO",  
71 - "ALTERARNOMETEMA",  
72 - "ALTERARDISPO",  
73 - "ALTERARCOMPORT",  
74 - "ALTERARMETADADOS",  
75 - "ALTERARGERAL",  
76 - "ALTERARCLASSEGERAL",  
77 - "ALTERARCLASSELABEL",  
78 - "DOWNLOADGVP",  
79 - "ALTERAREDITAVEL",  
80 - "PEGAPLUGIN",  
81 - "GRAVAPLUGIN",  
82 - "REMOVEPLUGIN",  
83 - "DOWNLOADGVP"  
84 -);  
85 -if(in_array(strtoupper($funcao),$funcoesEdicao)){  
86 - if(verificaOperacaoSessao("admin/html/editormapfile") == false){  
87 - retornaJSON("Vc nao pode realizar essa operacao.");exit;  
88 - }  
89 -}  
90 -if(in_array(strtoupper($funcao),$funcoesEdicao)){  
91 - $f = @fopen("$locaplic/temas/teste.txt",w);  
92 - @fclose($f);  
93 - if (!file_exists("$locaplic/temas/teste.txt")){  
94 - retornaJSON("sem direito de escrita na pasta temas");exit;  
95 - }  
96 - if(verificaOperacaoSessao("admin/html/editormapfile") == false){  
97 - retornaJSON("Vc nao pode realizar essa operacao.");exit;  
98 - }  
99 - unlink("$locaplic/temas/teste.txt");  
100 -}  
101 -//error_reporting(0);  
102 -//define o parametro de output do resultado da funcao  
103 -//algumas funcoes podem ser inseridas com include em outros programas  
104 -//nesse caso, defina output como "retorno"  
105 -//caso contrario sera definido como json  
106 -if(empty($_GET["output"])){  
107 - $output = "json";  
108 -} else {  
109 - $output = $_GET["output"];  
110 -}  
111 -//faz a busca da fun&ccedil;&atilde;o que deve ser executada  
112 -switch (strtoupper($funcao))  
113 -{  
114 - /*  
115 - Note:  
116 -  
117 - Valores que o par&acirc;metro &funcao pode receber. Os par&acirc;metros devem ser enviados na requisi&ccedil;&atilde;o em AJAX.  
118 - */  
119 - /*  
120 - Valor: CRIARNOVOMAP  
121 -  
122 - Cria um novo mapfile  
123 -  
124 - Parametros:  
125 -  
126 - nome - t&iacute;tulo do novo tema  
127 -  
128 - codigo - texto que ser&aacute; usado como nome do arquivo mapfile  
129 -  
130 - it - {opcional} t&iacute;tulo em italiano  
131 -  
132 - en - {opcional} t&iacute;tulo em ingl&ecirc;s  
133 -  
134 - es - {opcional} t&iacute;tulo em espanhol  
135 -  
136 - Retorno:  
137 -  
138 - {JSON}  
139 - */  
140 - case "CRIARNOVOMAP":  
141 - $resultado = criarNovoMap();  
142 - if($output == "retorno"){  
143 - return $resultado;  
144 - }else{  
145 - retornaJSON($resultado);  
146 - exit;  
147 - }  
148 - break;  
149 - case "PEGAPLUGIN":  
150 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
151 - $mapa = ms_newMapObj($mapfile);  
152 - $layer = $mapa->getlayerbyname($codigoLayer);  
153 - retornaJSON($layer->getmetadata("PLUGINI3GEO"));  
154 - break;  
155 - case "GRAVAPLUGIN":  
156 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
157 - $mapa = ms_newMapObj($mapfile);  
158 - $layer = $mapa->getlayerbyname($codigoLayer);  
159 - $layer->setmetadata("PLUGINI3GEO",$_GET["plugin"]);  
160 - $mapa->save($mapfile);  
161 - removeCabecalho($mapfile);  
162 - retornaJSON("ok");  
163 - break;  
164 - case "REMOVEPLUGIN":  
165 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
166 - $mapa = ms_newMapObj($mapfile);  
167 - $layer = $mapa->getlayerbyname($codigoLayer);  
168 - $layer->setmetadata("PLUGINI3GEO","");  
169 - $mapa->save($mapfile);  
170 - removeCabecalho($mapfile);  
171 - retornaJSON("ok");  
172 - break;  
173 - case "DOWNLOADGVP":  
174 - if(file_exists($locaplic."/temas/".$codigoMap.".gvp")){  
175 - ob_end_clean();  
176 - header('Content-type: application/octet-stream');  
177 - header('Content-Disposition: attachment; filename='.$codigoMap.'.gvp');  
178 - echo file_get_contents($locaplic."/temas/".$codigoMap.".gvp");  
179 - }  
180 - else{  
181 - echo "Arquivo nao encontrado";  
182 - }  
183 - exit;  
184 - break;  
185 - /*  
186 - Valor: EDITASIMBOLO  
187 -  
188 - Lista os s&iacute;mbolos de um determinado tipo  
189 -  
190 - Parametros:  
191 -  
192 - tipo {string} - tipo de layer  
193 -  
194 - onclick {string} - fun&ccedil;&atilde;o javascript que ser&aacute; executada ao se clicar no s&iacute;mbilo  
195 -  
196 - Retorno:  
197 -  
198 - {JSON}  
199 - */  
200 - case "EDITASIMBOLO":  
201 - include_once(dirname(__FILE__)."/../../classesphp/classe_legenda.php");  
202 - $versao = versao();  
203 - $versao = $versao["principal"];  
204 - if($base == "" || !isset($base)){  
205 - $base = "";  
206 - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))  
207 - {  
208 - $base = $locaplic."/aplicmap/geral1windowsv".$versao.".map";  
209 - }  
210 - else  
211 - {  
212 - if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){  
213 - $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map";  
214 - }  
215 - if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){  
216 - $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map";  
217 - }  
218 - if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){  
219 - $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map";  
220 - }  
221 - if($base == "")  
222 - {  
223 - $base = $locaplic."/aplicmap/geral1v".$versao.".map";  
224 - }  
225 - }  
226 - }  
227 - else{  
228 - if(!file_exists($base))  
229 - {  
230 - $base = $locaplic."/aplicmap/".$base;  
231 - }  
232 - }  
233 - $base = str_replace(".map","",$base).".map";  
234 - $m = new Legenda($base,$locaplic);  
235 - retornaJSON($m->listaSimbolos($tipo,$dir_tmp,"",$_GET["onclick"],8,1,true));  
236 - exit;  
237 - break;  
238 - /*  
239 - Valor: PEGALAYERS  
240 -  
241 - Lista os layers existentes em um mapfile  
242 -  
243 - Parametros:  
244 -  
245 - codigoMap {string} - nome do mapfile (sem .map)  
246 -  
247 - Retorno:  
248 -  
249 - {JSON}  
250 - */  
251 - case "PEGALAYERS":  
252 - retornaJSON(pegaLayers());  
253 - exit;  
254 - break;  
255 - /*  
256 - Valor: PEGAITENSLAYER  
257 -  
258 - Lista os itens da tabela de atributos de um layer  
259 -  
260 - Parametros:  
261 -  
262 - codigoMap {string} - nome do mapfile (sem .map)  
263 -  
264 - codigoLayer {string} - 'name' do layer existente no mapfile  
265 -  
266 - Retorno:  
267 -  
268 - {JSON}  
269 - */  
270 - case "PEGAITENSLAYER":  
271 - retornaJSON(pegaItensLayer());  
272 - exit;  
273 - break;  
274 - /*  
275 - Valor: LIMPARCACHEMAPFILE  
276 -  
277 - Apaga o diretorio contendo o cache de um tema (mapfile)  
278 -  
279 - Parametros:  
280 -  
281 - codigoMap {string} - nome do mapfile (sem .map)  
282 -  
283 - Retorno:  
284 -  
285 - {JSON}  
286 - */  
287 - case "LIMPARCACHEMAPFILE":  
288 - //error_reporting(0);  
289 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
290 - $mapa = ms_newMapObj($mapfile);  
291 - $nomes = $mapa->getalllayernames();  
292 - if($cachedir != ""){  
293 - $d = $cachedir;  
294 - }  
295 - else{  
296 - $d = $dir_tmp."/cache";  
297 - }  
298 - foreach($nomes as $nome)  
299 - {  
300 - $dirs[] = $d."/".$nome;  
301 - $dirs[] = $d."/googlemaps/".$nome;  
302 - foreach($dirs as $dir){  
303 - rename($dir,$dir."_removido");  
304 - }  
305 - }  
306 - retornaJSON("ok");  
307 - exit;  
308 - break;  
309 - /*  
310 - Valor: EXCLUIRMAPFILE  
311 -  
312 - Exclui um mapfile.  
313 -  
314 - So &eacute; poss&iacute;vel excluir se o mapfile n&atilde;o estiver vinculado a nenhum tema ou no da &aacute;rvore de temas  
315 -  
316 - Parametros:  
317 -  
318 - codigoMap {string} - nome do mapfile (sem .map)  
319 -  
320 - Retorno:  
321 -  
322 - {JSON}  
323 - */  
324 - case "EXCLUIRMAPFILE":  
325 - //pega oid do tema  
326 - $dados = pegaDados("SELECT id_tema from ".$esquemaadmin."i3geoadmin_temas WHERE codigo_tema = '".$codigoMap."'");  
327 - if(count($dados) > 0){  
328 - $id = $dados[0]["id_tema"];  
329 - }  
330 - else{  
331 - $id = "";  
332 - $f = "";  
333 - }  
334 - $tabela = "mapfiles";  
335 - $coluna = "id_tema";  
336 - if($id != ""){  
337 - $f = verificaFilhos();  
338 - }  
339 - if($f && $f != ""){  
340 - retornaJSON("erro");  
341 - exit;  
342 - }  
343 - else{  
344 - if(file_exists("$locaplic/temas/".$codigoMap.".map")){  
345 - unlink("$locaplic/temas/".$codigoMap.".map");  
346 - }  
347 - else{  
348 - if(file_exists("$locaplic/temas/".$codigoMap.".gvp")){  
349 - unlink("$locaplic/temas/".$codigoMap.".gvp");  
350 - }  
351 - if(file_exists("$locaplic/temas/".$codigoMap.".php")){  
352 - unlink("$locaplic/temas/".$codigoMap.".php");  
353 - }  
354 - }  
355 - $tabela = "i3geoadmin_temas";  
356 - if($id && $id != ""){  
357 - exclui($esquemaadmin.$tabela,$coluna,$id);  
358 - }  
359 - retornaJSON("ok");  
360 - exit;  
361 - }  
362 - break;  
363 - /*  
364 - Valor: REFAZERLAYER  
365 -  
366 - Altera um layer existente em um mapfile com base em um layer existente em outro mapfile  
367 -  
368 - Parametros:  
369 -  
370 - codigomap {string} - nome do mapfile existente em i3geo/temas que ser&aacute; atualizado (sem .map)  
371 -  
372 - maporigem {string} - nome completo do arquivo mapfile que contem o layer que ser&aacute; utilizado para alterar o original  
373 -  
374 - nomelayer {string} - codigo do layer em mapfile que ser&aacute; utilizado para atualizar codigoMap  
375 -  
376 - Retorno:  
377 -  
378 - {JSON}  
379 - */  
380 - case "REFAZERLAYER":  
381 - retornaJSON(refazerLayer());  
382 - exit;  
383 - break;  
384 - /*  
385 - Valor: CLONARMAPFILE  
386 -  
387 - Copia um mapfile existente  
388 -  
389 - Parametros:  
390 -  
391 - codigomap {string} - nome do mapfile existente em i3geo/temas que ser&aacute; clonado (sem .map)  
392 -  
393 - novomap {string} - nome do mapfile que ser&aacute; criado  
394 -  
395 - Retorno:  
396 -  
397 - {JSON}  
398 - */  
399 - case "CLONARMAPFILE":  
400 - retornaJSON(clonarMapfile());  
401 - exit;  
402 - break;  
403 - /*  
404 - Valor: CRIARNOVOLAYER  
405 -  
406 - Cria um novo layer em um mapfile  
407 -  
408 - O novo layer receber&aacute; um nome aleat�rio, que pode ser modificado posteriormente. Por default, esse novo layer ser&aacute; do tipo linear  
409 -  
410 - Parametros:  
411 -  
412 - codigoMap {string} - nome do mapfile (sem .map)  
413 -  
414 - Retorno:  
415 -  
416 - {JSON}  
417 - */  
418 - case "CRIARNOVOLAYER":  
419 - retornaJSON(criarNovoLayer());  
420 - exit;  
421 - break;  
422 - /*  
423 - Valor: EXCLUIRLAYER  
424 -  
425 - Exclui um layer de um mapfile  
426 -  
427 - Parametros:  
428 -  
429 - codigoMap {string} - nome do mapfile (sem .map)  
430 -  
431 - codigoLayer {string} - 'name' do layer existente no mapfile  
432 -  
433 - Retorno:  
434 -  
435 - {JSON}  
436 - */  
437 - case "EXCLUIRLAYER":  
438 - retornaJSON(excluirLayer());  
439 - exit;  
440 - break;  
441 -  
442 - /*  
443 - Valor: LISTACLASSES  
444 -  
445 - Lista as classes da legenda de um layer em um mapfile  
446 -  
447 - Parametros:  
448 -  
449 - codigoMap {string} - nome do mapfile (sem .map)  
450 -  
451 - codigoLayer {string} - 'name' do layer existente no mapfile  
452 -  
453 - Retorno:  
454 -  
455 - {JSON}  
456 - */  
457 - case "LISTACLASSES":  
458 - retornaJSON(listaClasses());  
459 - exit;  
460 - break;  
461 - /*  
462 - Valor: AUTOCLASSESLAYER  
463 -  
464 - Cria classes em um layer com base na tabela de atributos  
465 -  
466 - Parametros:  
467 -  
468 - codigoMap {string} - nome do mapfile (sem .map)  
469 -  
470 - codigoLayer {string} - 'name' do layer existente no mapfile  
471 -  
472 - itemExpressao - item da tabela de atributos que cont&eacute;m os valores &uacute;nicos para as classes  
473 -  
474 - itemNome - item da tabela de atributos que cont&eacute;m os nomes de cada classe  
475 -  
476 - Retorno:  
477 -  
478 - {JSON}  
479 - */  
480 - case "AUTOCLASSESLAYER":  
481 - autoClassesLayer();  
482 - retornaJSON(listaClasses());  
483 - exit;  
484 - break;  
485 - /*  
486 - Valor: CRIARNOVACLASSE  
487 -  
488 - Cria uma nova classe em um layer  
489 -  
490 - Parametros:  
491 -  
492 - codigoMap {string} - nome do mapfile (sem .map)  
493 -  
494 - codigoLayer {string} - 'name' do layer existente no mapfile  
495 -  
496 - Retorno:  
497 -  
498 - {JSON}  
499 - */  
500 - case "CRIARNOVACLASSE":  
501 - retornaJSON(criarNovaClasse());  
502 - exit;  
503 - break;  
504 - /*  
505 - Valor: EXCLUIRCLASSE  
506 -  
507 - Cria uma nova classe em um layer  
508 -  
509 - Parametros:  
510 -  
511 - codigoMap {string} - nome do mapfile (sem .map)  
512 -  
513 - codigoLayer {string} - 'name' do layer existente no mapfile  
514 -  
515 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
516 -  
517 - Retorno:  
518 -  
519 - {JSON}  
520 - */  
521 - case "EXCLUIRCLASSE":  
522 - excluirClasse();  
523 - retornaJSON(listaClasses());  
524 - exit;  
525 - break;  
526 - /*  
527 - Valor: LISTAESTILOS  
528 -  
529 - Lista de estilos existentes em uma classe de um layer  
530 -  
531 - Parametros:  
532 -  
533 - codigoMap {string} - nome do mapfile (sem .map)  
534 -  
535 - codigoLayer {string} - 'name' do layer existente no mapfile  
536 -  
537 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
538 -  
539 - Retorno:  
540 -  
541 - {JSON}  
542 - */  
543 - case "LISTAESTILOS":  
544 - retornaJSON(listaEstilos());  
545 - exit;  
546 - break;  
547 - /*  
548 - Valor: CRIARNOVOESTILO  
549 -  
550 - Adiciona um novo estilo em uma classe  
551 -  
552 - Parametros:  
553 -  
554 - codigoMap {string} - nome do mapfile (sem .map)  
555 -  
556 - codigoLayer {string} - 'name' do layer existente no mapfile  
557 -  
558 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
559 -  
560 - Retorno:  
561 -  
562 - {JSON}  
563 - */  
564 - case "CRIARNOVOESTILO":  
565 - retornaJSON(criarNovoEstilo());  
566 - exit;  
567 - break;  
568 - /*  
569 - Valor: EXCLUIRESTILO  
570 -  
571 - Exclui um estilo de uma classe  
572 -  
573 - Parametros:  
574 -  
575 - codigoMap {string} - nome do mapfile (sem .map)  
576 -  
577 - codigoLayer {string} - 'name' do layer existente no mapfile  
578 -  
579 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
580 -  
581 - indiceEstilo {numerico} - &iacute;ndice do estilo (de 0 at&eacute; n&uacute;mero de estilos-1)  
582 -  
583 - Retorno:  
584 -  
585 - {JSON}  
586 - */  
587 - case "EXCLUIRESTILO":  
588 - excluirEstilo();  
589 - retornaJSON(listaEstilos());  
590 - exit;  
591 - break;  
592 - /*  
593 - Valor: PEGAESTILO  
594 -  
595 - Obt&eacute;m os dados de um estilo de uma classe  
596 -  
597 - Parametros:  
598 -  
599 - codigoMap {string} - nome do mapfile (sem .map)  
600 -  
601 - codigoLayer {string} - 'name' do layer existente no mapfile  
602 -  
603 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
604 -  
605 - indiceEstilo {numerico} - &iacute;ndice do estilo (de 0 at&eacute; n&uacute;mero de estilos-1)  
606 -  
607 - Retorno:  
608 -  
609 - {JSON}  
610 - */  
611 - case "PEGAESTILO":  
612 - retornaJSON(pegaEstilo());  
613 - exit;  
614 - break;  
615 - /*  
616 - Valor: ALTERARESTILO  
617 -  
618 - Altera um estilo de uma classe  
619 -  
620 - Parametros:  
621 -  
622 - codigoMap {string} - nome do mapfile (sem .map)  
623 -  
624 - codigoLayer {string} - 'name' do layer existente no mapfile  
625 -  
626 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
627 -  
628 - indiceEstilo {numerico} - &iacute;ndice do estilo (de 0 at&eacute; n&uacute;mero de estilos-1)  
629 -  
630 - angle  
631 -  
632 - maxwidth  
633 -  
634 - minwidth  
635 -  
636 - width  
637 -  
638 - outlinecolor  
639 -  
640 - backgroundcolor  
641 -  
642 - antialias  
643 -  
644 - offsety  
645 -  
646 - offsetx  
647 -  
648 - maxsize  
649 -  
650 - minsize  
651 -  
652 - size  
653 -  
654 - color  
655 -  
656 - symbolname  
657 -  
658 - Retorno:  
659 -  
660 - {JSON}  
661 - */  
662 - case "ALTERARESTILO":  
663 - alterarEstilo();  
664 - retornaJSON(pegaEstilo());  
665 - exit;  
666 - break;  
667 - /*  
668 - Valor: PEGACONEXAO  
669 -  
670 - Obt&eacute;m os valores dos elementos de conex&atilde;o com uma base de dados de um layer  
671 -  
672 - Parametros:  
673 -  
674 - codigoMap {string} - nome do mapfile (sem .map)  
675 -  
676 - codigoLayer {string} - 'name' do layer existente no mapfile  
677 -  
678 - Retorno:  
679 -  
680 - {JSON}  
681 - */  
682 - case "PEGACONEXAO":  
683 - retornaJSON(pegaConexao());  
684 - exit;  
685 - break;  
686 - /*  
687 - Valor: ALTERARCONEXAO  
688 -  
689 - Altera os valores dos elementos de conex&atilde;o com uma base de dados de um layer  
690 -  
691 - Parametros:  
692 -  
693 - codigoMap {string} - nome do mapfile (sem .map)  
694 -  
695 - codigoLayer {string} - 'name' do layer existente no mapfile  
696 -  
697 - connection  
698 -  
699 - connectiontype  
700 -  
701 - data  
702 -  
703 - tileitem  
704 -  
705 - tileindex  
706 -  
707 - type  
708 -  
709 - Retorno:  
710 -  
711 - {JSON}  
712 - */  
713 - case "ALTERARCONEXAO":  
714 - $retorno = alterarConexao();  
715 - if($testar == "false")  
716 - retornaJSON(pegaConexao());  
717 - else  
718 - retornaJSON(array("url"=>$retorno));  
719 - exit;  
720 - break;  
721 - /*  
722 - Valor: PEGAMETADADOS  
723 -  
724 - Obt&eacute;m os valores dos elementos de metadados de um layer  
725 -  
726 - Parametros:  
727 -  
728 - codigoMap {string} - nome do mapfile (sem .map)  
729 -  
730 - codigoLayer {string} - 'name' do layer existente no mapfile  
731 -  
732 - Retorno:  
733 -  
734 - {JSON}  
735 - */  
736 - case "PEGAMETADADOS":  
737 - retornaJSON(pegaMetadados());  
738 - exit;  
739 - break;  
740 - /*  
741 - Valor: PEGATITULO  
742 -  
743 - Obt&eacute;m os valores de titulo, descricao, etc  
744 -  
745 - Parametros:  
746 -  
747 - codigoMap {string} - nome do mapfile (sem .map)  
748 -  
749 - codigoLayer {string} - 'name' do layer existente no mapfile  
750 -  
751 - Retorno:  
752 -  
753 - {JSON}  
754 - */  
755 - case "PEGATITULO":  
756 - retornaJSON(pegaTitulo());  
757 - exit;  
758 - break;  
759 - case "ALTERARTITULO":  
760 - alterarTitulo();  
761 - retornaJSON(pegaTitulo());  
762 - exit;  
763 - break;  
764 - case "ALTERARNOMETEMA":  
765 - alterarNomeTema();  
766 - $codigoLayer = $codigoMap;  
767 - retornaJSON(pegaTitulo());  
768 - exit;  
769 - break;  
770 - case "PEGADISPO":  
771 - retornaJSON(pegaDispo());  
772 - exit;  
773 - break;  
774 - case "ALTERARDISPO":  
775 - alterarDispo();  
776 - alteraTemas();  
777 - retornaJSON(pegaDispo());  
778 - exit;  
779 - break;  
780 - case "PEGACOMPORT":  
781 - retornaJSON(pegaComport());  
782 - exit;  
783 - break;  
784 - case "ALTERARCOMPORT":  
785 - alterarComport();  
786 - retornaJSON(pegaComport());  
787 - exit;  
788 - break;  
789 - case "PEGAEDITAVEL":  
790 - retornaJSON(pegaEditavel());  
791 - exit;  
792 - break;  
793 - case "ALTERAREDITAVEL":  
794 - alterarEditavel();  
795 - retornaJSON(pegaEditavel());  
796 - exit;  
797 - break;  
798 -  
799 - /*  
800 - Valor: ALTERARMETADADOS  
801 -  
802 - Altera os valores dos elementos de metadados de um layer  
803 -  
804 - Parametros:  
805 -  
806 - codigoMap {string} - nome do mapfile (sem .map)  
807 -  
808 - codigoLayer {string} - 'name' do layer existente no mapfile  
809 -  
810 - iconetema  
811 -  
812 - ltempoformatodata  
813 -  
814 - ltempoiteminicio  
815 -  
816 - ltempoitemfim  
817 -  
818 - ltempoitemtitulo  
819 -  
820 - ltempoitemdescricao  
821 -  
822 - ltempoitemtip  
823 -  
824 - ltempoitemimagem  
825 -  
826 - ltempoitemicone  
827 -  
828 - ltempoitemlink  
829 -  
830 - description_template  
831 -  
832 - palletestep  
833 -  
834 - palletefile  
835 -  
836 - arquivodownload  
837 -  
838 - aplicaextensao  
839 -  
840 - classestamanho  
841 -  
842 - classessimbolo  
843 -  
844 - classescor  
845 -  
846 - classesnome  
847 -  
848 - classesitem  
849 -  
850 - mensagem  
851 -  
852 - identifica  
853 -  
854 - transitioneffect  
855 -  
856 - extensao  
857 -  
858 - escondido  
859 -  
860 - download  
861 -  
862 - escala  
863 -  
864 - tema  
865 -  
866 - classe  
867 -  
868 - tip  
869 -  
870 - itenslink  
871 -  
872 - itens  
873 -  
874 - itensdesc  
875 -  
876 - editorsql  
877 -  
878 - cache  
879 -  
880 - permitecomentario  
881 -  
882 - itembuscarapida  
883 -  
884 - Retorno:  
885 -  
886 - {JSON}  
887 - */  
888 - case "ALTERARMETADADOS":  
889 - alterarMetadados();  
890 - retornaJSON(pegaMetadados());  
891 - exit;  
892 - break;  
893 - /*  
894 - Valor: PEGAGERAL  
895 -  
896 - Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o geral de um layer  
897 -  
898 - Parametros:  
899 -  
900 - codigoMap {string} - nome do mapfile (sem .map)  
901 -  
902 - codigoLayer {string} - 'name' do layer existente no mapfile  
903 -  
904 - Retorno:  
905 -  
906 - {JSON}  
907 - */  
908 - case "PEGAGERAL":  
909 - retornaJSON(pegaGeral());  
910 - exit;  
911 - break;  
912 - /*  
913 - Valor: ALTERARGERAL  
914 -  
915 - Modifica os valores dos elementos de configura&ccedil;&atilde;o geral de um layer  
916 -  
917 - Parametros:  
918 -  
919 - codigoMap {string} - nome do mapfile (sem .map)  
920 -  
921 - codigoLayer {string} - 'name' do layer existente no mapfile  
922 -  
923 - testar  
924 -  
925 - name  
926 -  
927 - projection  
928 -  
929 - sizeunits  
930 -  
931 - status  
932 -  
933 - toleranceunits  
934 -  
935 - tolerance  
936 -  
937 - symbolscale  
938 -  
939 - opacity  
940 -  
941 - offsite  
942 -  
943 - minscale  
944 -  
945 - maxscale  
946 -  
947 - labelsizeitem  
948 -  
949 - labelminscale  
950 -  
951 - labelmaxscale  
952 -  
953 - labelitem  
954 -  
955 - group  
956 -  
957 - filteritem  
958 -  
959 - type  
960 -  
961 - filter  
962 -  
963 - Retorno:  
964 -  
965 - {JSON}  
966 - */  
967 - case "ALTERARGERAL":  
968 - $retorno = alterarGeral();  
969 - if($testar == "false")  
970 - {  
971 - $codigoLayer = $name;  
972 - retornaJSON(pegaGeral());  
973 - }  
974 - else  
975 - retornaJSON(array("url"=>$retorno));  
976 - exit;  
977 - break;  
978 - /*  
979 - Valor: PEGACLASSEGERAL  
980 -  
981 - Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o geral de uma classe  
982 -  
983 - Parametros:  
984 -  
985 - codigoMap {string} - nome do mapfile (sem .map)  
986 -  
987 - codigoLayer {string} - 'name' do layer existente no mapfile  
988 -  
989 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
990 -  
991 - Retorno:  
992 -  
993 - {JSON}  
994 - */  
995 - case "PEGACLASSEGERAL":  
996 - retornaJSON(pegaClasseGeral());  
997 - exit;  
998 - break;  
999 - /*  
1000 - Valor: ALTERARCLASSEGERAL  
1001 -  
1002 - Altera os valores dos elementos de configura&ccedil;&atilde;o geral de uma classe  
1003 -  
1004 - Parametros:  
1005 -  
1006 - codigoMap {string} - nome do mapfile (sem .map)  
1007 -  
1008 - codigoLayer {string} - 'name' do layer existente no mapfile  
1009 -  
1010 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
1011 -  
1012 - status  
1013 -  
1014 - minscale  
1015 -  
1016 - maxscale  
1017 -  
1018 - name  
1019 -  
1020 - expression  
1021 -  
1022 - keyimage  
1023 -  
1024 - title  
1025 -  
1026 - Retorno:  
1027 -  
1028 - {JSON}  
1029 - */  
1030 - case "ALTERARCLASSEGERAL":  
1031 - alterarClasseGeral();  
1032 - retornaJSON(pegaClasseGeral());  
1033 - exit;  
1034 - break;  
1035 - /*  
1036 - Valor: PEGACLASSELABEL  
1037 -  
1038 - Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o da topon&iacute;mia de uma classe  
1039 -  
1040 - Parametros:  
1041 -  
1042 - codigoMap {string} - nome do mapfile (sem .map)  
1043 -  
1044 - codigoLayer {string} - 'name' do layer existente no mapfile  
1045 -  
1046 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
1047 -  
1048 - Retorno:  
1049 -  
1050 - {JSON}  
1051 - */  
1052 - case "PEGACLASSELABEL":  
1053 - retornaJSON(pegaClasseLabel());  
1054 - exit;  
1055 - break;  
1056 - /*  
1057 - Valor: ALTERARCLASSELABEL  
1058 -  
1059 - Altera os valores dos elementos de configura&ccedil;&atilde;o da topon&iacute;mia de uma classe  
1060 -  
1061 - Parametros:  
1062 -  
1063 - codigoMap {string} - nome do mapfile (sem .map)  
1064 -  
1065 - codigoLayer {string} - 'name' do layer existente no mapfile  
1066 -  
1067 - indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)  
1068 -  
1069 - autoangle  
1070 -  
1071 - encoding  
1072 -  
1073 - force  
1074 -  
1075 - partials  
1076 -  
1077 - mindistance  
1078 -  
1079 - minfeaturesize  
1080 -  
1081 - wrap  
1082 -  
1083 - antialias  
1084 -  
1085 - buffer  
1086 -  
1087 - angle  
1088 -  
1089 - offsety  
1090 -  
1091 - offsetx  
1092 -  
1093 - position  
1094 -  
1095 - maxsize  
1096 -  
1097 - minsize  
1098 -  
1099 - size  
1100 -  
1101 - backgroundshadowsizey  
1102 -  
1103 - backgroundshadowsizex  
1104 -  
1105 - shadowsizey  
1106 -  
1107 - shadowsizex  
1108 -  
1109 - shadowcolor  
1110 -  
1111 - outlinecolor  
1112 -  
1113 - color  
1114 -  
1115 - backgroundshadowcolor  
1116 -  
1117 - backgroundcolor  
1118 -  
1119 - type  
1120 -  
1121 - font  
1122 -  
1123 - Retorno:  
1124 -  
1125 - {JSON}  
1126 - */  
1127 - case "ALTERARCLASSELABEL":  
1128 - alterarClasseLabel();  
1129 - retornaJSON(pegaClasseLabel());  
1130 - exit;  
1131 - break;  
1132 - case "MOVIMENTANO":  
1133 - $res = sobeDesce();  
1134 - retornaJSON($res);  
1135 - exit;  
1136 - break;  
1137 - case "ADICIONAGRUPOUSRTEMA":  
1138 - retornaJSON(adicionaGrupoUsrTema());  
1139 - exit;  
1140 - break;  
1141 - case "EXCLUIRGRUPOUSRTEMA":  
1142 - retornaJSON(excluirGrupoUsrTema());  
1143 - exit;  
1144 - break;  
1145 -}  
1146 -function clonarMapfile()  
1147 -{  
1148 - global $codigomap, $locaplic;  
1149 - //error_reporting(0);  
1150 - $arqtema = $locaplic."/temas/".$codigomap.".map";  
1151 - $novotema = $locaplic."/temas/".$_GET["novomap"].".map";  
1152 - copy($arqtema,$novotema);  
1153 - $mapa = ms_newMapObj($novotema);  
1154 - $layer = @$mapa->getlayerbyname($codigomap);  
1155 - $layer->set("name",$novomap);  
1156 - $mapa->save($novotema);  
1157 - removeCabecalho($novotema);  
1158 - return array("data"=>"ok");  
1159 -}  
1160 -function refazerLayer()  
1161 -{  
1162 - global $nomelayer, $codigomap, $locaplic, $dir_tmp, $cachedir;  
1163 -  
1164 - $maporigem = $_GET["maporigem"];  
1165 -  
1166 - //error_reporting(0);  
1167 - $cache = $_GET["cache"];  
1168 - if(empty($cache)){  
1169 - $cache = "";  
1170 - }  
1171 - $classe = $_GET["classe"];  
1172 - if(empty($classe)){  
1173 - $classe = "";  
1174 - }  
1175 - $identifica = $_GET["identifica"];  
1176 - if(empty($identifica)){  
1177 - $identifica = "sim";  
1178 - }  
1179 - $mapa = ms_newMapObj($maporigem);  
1180 - $arqtema = $locaplic."/temas/".$codigomap.".map";  
1181 - $mapatema = ms_newMapObj($arqtema);  
1182 - $layeroriginal = @$mapatema->getlayerbyname($codigomap);  
1183 - $layernovo = @$mapa->getlayerbyname($nomelayer);  
1184 - if($layeroriginal != "" && $layernovo != "")  
1185 - {  
1186 - //$plugin = $layeroriginal->getmetadata("PLUGINI3GEO");  
1187 - $layeroriginal->set("status",MS_DELETE);  
1188 - $nl = ms_newLayerObj($mapatema,$layernovo);  
1189 - $nl->set("name",$codigomap);  
1190 - //$nl->setmetadata("PLUGINI3GEO",$plugin);  
1191 - $nl->setmetadata("nomeoriginal","");  
1192 - $nl->setmetadata("arquivotemaoriginal","");  
1193 - $nl->setmetadata("olopacity","");  
1194 - $nl->setmetadata("olstatus","");  
1195 - $nl->setmetadata("gmopacity","");  
1196 - $nl->setmetadata("gmstatus","");  
1197 - $nl->setmetadata("FILTROORIGINAL","");  
1198 - $nl->setmetadata("DATAORIGINAL","");  
1199 - $nl->setmetadata("cache",$cache);  
1200 - $nl->setmetadata("classe",$classe);  
1201 - $nl->setmetadata("identifica",$identifica);  
1202 - $numclasses = $nl->numclasses;  
1203 - if ($numclasses > 0)  
1204 - {  
1205 - for ($i=0; $i < $numclasses; $i++)  
1206 - {  
1207 - $classe = $nl->getClass($i);  
1208 - $classe->set("title","");  
1209 - }  
1210 - }  
1211 - $mapatema->save($arqtema);  
1212 - removeCabecalho($arqtema);  
1213 - //apaga o cache  
1214 - include($locaplic."/admin1/php/funcoesAdmin.php");  
1215 - \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigomap, $cachedir, $dir_tmp);  
1216 -  
1217 -  
1218 - return array("data"=>"ok");  
1219 - }  
1220 - return "erro";  
1221 -}  
1222 -function sobeDesce()  
1223 -{  
1224 - global $movimento,$tipo,$codigoMap,$codigoLayer,$locaplic;  
1225 -  
1226 - $indiceClasse = $_GET["indiceClasse"];  
1227 - $indiceEstilo = $_GET["indiceEstilo"];  
1228 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1229 - $mapa = ms_newMapObj($mapfile);  
1230 - $layer = $mapa->getlayerbyname($codigoLayer);  
1231 - if($movimento == "sobe")  
1232 - {  
1233 - if($tipo == "layer")  
1234 - {  
1235 - $indice = $layer->index;  
1236 - $mapa->moveLayerUp($indice);  
1237 - }  
1238 - if($tipo == "classe")  
1239 - {  
1240 - $layer->moveclassup($indiceClasse);  
1241 - }  
1242 - if($tipo == "estilo")  
1243 - {  
1244 - $classe = $layer->getclass($indiceClasse);  
1245 - $classe->movestyleup($indiceEstilo);  
1246 - }  
1247 -  
1248 - }  
1249 - if($movimento == "desce")  
1250 - {  
1251 - if($tipo == "layer")  
1252 - {  
1253 - $indice = $layer->index;  
1254 - $mapa->moveLayerDown($indice);  
1255 - }  
1256 - if($tipo == "classe")  
1257 - {  
1258 - $layer->moveclassdown($indiceClasse);  
1259 - }  
1260 - if($tipo == "estilo")  
1261 - {  
1262 - $classe = $layer->getclass($indiceClasse);  
1263 - $classe->movestyledown($indiceEstilo);  
1264 - }  
1265 - }  
1266 - $mapa->save($mapfile);  
1267 - removeCabecalho($mapfile);  
1268 - return "ok";  
1269 -}  
1270 -//essa funcao e usada tambem por i3geo/ferramentas/upload/upload.php  
1271 -function criarNovoMap(){  
1272 - global $locaplic,$esquemaadmin;  
1273 -  
1274 - $arq = $locaplic."/temas/".$_GET["codigo"].".map";  
1275 - if(empty($_GET["acessopublico"])){  
1276 - $_GET["acessopublico"] = "SIM";  
1277 - }  
1278 - if(!file_exists($arq)){  
1279 - if(empty($_GET["tipoLayer"])){  
1280 - $_GET["tipoLayer"] = "line";  
1281 - }  
1282 - $dados[] = "MAP";  
1283 - $dados[] = "SYMBOLSET ../symbols/simbolosv6.sym";  
1284 - $dados[] = 'FONTSET "../symbols/fontes.txt"';  
1285 - $dados[] = "LAYER";  
1286 - $dados[] = ' NAME "'.$_GET["codigo"].'"';  
1287 - $dados[] = ' TEMPLATE "none.htm"';  
1288 - if(!empty($_GET["metaestat"]) && $_GET["metaestat"] == "SIM"){  
1289 - $dados[] = ' CONNECTIONTYPE POSTGIS';  
1290 - $tipoLayer = "polygon";  
1291 - }  
1292 - elseif(!empty($conexao)){  
1293 - $dados[] = ' CONNECTIONTYPE POSTGIS';  
1294 - $dados[] = ' CONNECTION "'.$_GET["conexao"].'"';  
1295 - }  
1296 - $dados[] = " TYPE ".$_GET["tipoLayer"];  
1297 - if(empty($_GET["data"])){  
1298 - $dados[] = ' DATA ""';  
1299 - $dados[] = ' CONNECTION ""';  
1300 - }  
1301 - else{  
1302 - $dados[] = ' DATA "'.$_GET["data"].'"';  
1303 - }  
1304 - $dados[] = ' STATUS DEFAULT';  
1305 - $dados[] = ' METADATA';  
1306 - $dados[] = ' TEMA "'.$_GET["nome"].'"';  
1307 - $dados[] = ' CLASSE "SIM"';  
1308 - $tipoa_tema = "";  
1309 - if(!empty($_GET["metaestat"]) && $_GET["metaestat"] == "SIM"){  
1310 - $dados[] = ' METAESTAT "SIM"';  
1311 - //para marcar no banco de dados de administracao  
1312 - $tipoa_tema = "META";  
1313 - //METAESTAT_CODIGO_TIPO_REGIAO  
1314 - //ID_MEDIDA_VARIAVEL  
1315 - }  
1316 - $acessopublico = $_GET["acessopublico"];  
1317 - $dados[] = ' permiteogc "'.$acessopublico.'"';  
1318 - $dados[] = ' permitedownload "'.$acessopublico.'"';  
1319 - $dados[] = ' permitekml "'.$acessopublico.'"';  
1320 - $dados[] = ' permitekmz "'.$acessopublico.'"';  
1321 -  
1322 - $dados[] = ' END';  
1323 - $dados[] = ' CLASS';  
1324 - $dados[] = ' NAME ""';  
1325 - $dados[] = ' STYLE';  
1326 - $dados[] = ' COLOR 0 0 0';  
1327 - $dados[] = ' SIZE 12';  
1328 - if($tipoLayer == "point"){  
1329 - $dados[] = " SYMBOL 'ponto'";  
1330 - }  
1331 - $dados[] = ' END';  
1332 - $dados[] = ' END';  
1333 - $dados[] = "END";  
1334 - $dados[] = "END";  
1335 - $fp = fopen($arq,"w");  
1336 - foreach ($dados as $dado)  
1337 - {  
1338 - fwrite($fp,$dado."\n");  
1339 - }  
1340 -  
1341 - include("conexao.php");  
1342 - if($convUTF){  
1343 - $_GET["nome"] = utf8_encode($_GET["nome"]);  
1344 - $_GET["desc"] = utf8_encode($_GET["desc"]);  
1345 - }  
1346 - $dataCol = array(  
1347 - "link_tema" => '',  
1348 - "kml_tema" => $acessopublico,  
1349 - "kmz_tema" => $acessopublico,  
1350 - "ogc_tema" => $acessopublico,  
1351 - "download_tema" => $acessopublico,  
1352 - "desc_tema" => '',  
1353 - "tipoa_tema" => $tipoa_tema,  
1354 - "tags_tema" => '',  
1355 - "nome_tema" => $_GET["nome"],  
1356 - "codigo_tema" => $_GET["codigo"],  
1357 - "it" => $_GET["it"],  
1358 - "es" => $_GET["es"],  
1359 - "en" => $_GET["en"]  
1360 - );  
1361 - i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);  
1362 - $dbh = null;  
1363 - $dbhw = null;  
1364 - return "ok";  
1365 - }  
1366 - return "erro";  
1367 -}  
1368 -function criarNovoLayer()  
1369 -{  
1370 - global $locaplic,$codigoMap;  
1371 -  
1372 - include_once("$locaplic/classesphp/funcoes_gerais.php");  
1373 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1374 - $mapa = ms_newMapObj($mapfile);  
1375 - $nl = ms_newLayerObj($mapa);  
1376 - $nl->set("name",nomeRandomico());  
1377 - $nl->set("type",MS_LAYER_LINE);  
1378 - $mapa->save($mapfile);  
1379 - removeCabecalho($mapfile);  
1380 - return array("layers"=>(array($nl->name)));  
1381 -}  
1382 -function autoClassesLayer()  
1383 -{  
1384 - global $codigoMap,$codigoLayer,$locaplic,$dir_tmp,$postgis_mapa;  
1385 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1386 - include_once("$locaplic/classesphp/classe_alteraclasse.php");  
1387 - //error_reporting(0);  
1388 - $nometemp = $dir_tmp."/".nomerandomico().".map";  
1389 -  
1390 - $versao = versao();  
1391 - $versao = $versao["principal"];  
1392 - if($base == "" || !isset($base)){  
1393 - $base = "";  
1394 - if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))  
1395 - {  
1396 - $base = $locaplic."/aplicmap/geral1windowsv".$versao.".map";  
1397 - }  
1398 - else  
1399 - {  
1400 - if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){  
1401 - $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map";  
1402 - }  
1403 - if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){  
1404 - $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map";  
1405 - }  
1406 - if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){  
1407 - $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map";  
1408 - }  
1409 - if($base == "")  
1410 - {  
1411 - $base = $locaplic."/aplicmap/geral1v".$versao.".map";  
1412 - }  
1413 - }  
1414 - }  
1415 - else{  
1416 - if(!file_exists($base))  
1417 - {  
1418 - $base = $locaplic."/aplicmap/".$base;  
1419 - }  
1420 - }  
1421 -  
1422 - $mapageral = ms_newMapObj($base);  
1423 -  
1424 - $numlayers = $mapageral->numlayers;  
1425 - for ($i=0;$i < $numlayers;$i++)  
1426 - {  
1427 - $layertemp = $mapageral->getlayer($i);  
1428 - $layertemp->set("status",MS_DELETE);  
1429 - }  
1430 -  
1431 - $mapatemp = ms_newMapObj($mapfile);  
1432 - $numlayers = $mapatemp->numlayers;  
1433 - for ($i=0;$i < $numlayers;$i++){  
1434 - $layertemp = $mapatemp->getlayer($i);  
1435 - //troca string de conexao com alias  
1436 - $lcon = $layertemp->connection;  
1437 - if ($layertemp->connectiontype == MS_POSTGIS){  
1438 - if (in_array($lcon,array_keys($postgis_mapa))){  
1439 - $layertemp->set("connection",$postgis_mapa[$lcon]);  
1440 - }  
1441 - }  
1442 - ms_newLayerObj($mapageral, $layertemp);  
1443 - }  
1444 - $mapageral->save($nometemp);  
1445 - $m = new Alteraclasse($nometemp,$codigoLayer);  
1446 - $m->valorunico($_GET["itemExpressao"],"",$_GET["itemNome"]);  
1447 - $m->salva();  
1448 - $mapatemp = ms_newMapObj($nometemp);  
1449 -  
1450 - $numlayers = $mapatemp->numlayers;  
1451 - for ($i=0;$i < $numlayers;$i++){  
1452 - $layertemp = $mapatemp->getlayer($i);  
1453 - //troca string de conexao com alias  
1454 - if ($layertemp->connectiontype == MS_POSTGIS){  
1455 - $layertemp->set("connection",$lcon);  
1456 - }  
1457 - }  
1458 -  
1459 - $mapatemp->save($mapfile);  
1460 - removeCabecalho($mapfile);  
1461 -}  
1462 -function criarNovaClasse()  
1463 -{  
1464 - global $codigoMap,$codigoLayer,$locaplic;  
1465 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1466 - $mapa = ms_newMapObj($mapfile);  
1467 - $nl = $mapa->getlayerbyname($codigoLayer);  
1468 - $dados = array();  
1469 - if(strtoupper($nl->getmetadata("metaestat")) === "SIM"){  
1470 - return "erro";  
1471 - }  
1472 - $nclasses = $nl->numclasses;  
1473 - $classe = ms_newClassObj($nl);  
1474 - $mapa->save($mapfile);  
1475 - removeCabecalho($mapfile);  
1476 - $dados[] = array("indice"=>($nclasses),"nome"=>(""));  
1477 - return $dados;  
1478 -}  
1479 -function criarNovoEstilo()  
1480 -{  
1481 - global $codigoMap,$codigoLayer,$locaplic;  
1482 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1483 - $mapa = ms_newMapObj($mapfile);  
1484 - $nl = $mapa->getlayerbyname($codigoLayer);  
1485 - $classObj = $nl->getclass($_GET["indiceClasse"]);  
1486 - $numestilos = $classObj->numstyles;  
1487 - $nestilo = ms_newStyleObj($classObj);  
1488 - $mapa->save($mapfile);  
1489 - removeCabecalho($mapfile);  
1490 - $dados[] = array("estilo"=>$numestilos);  
1491 - return $dados;  
1492 -}  
1493 -function pegaItensLayer()  
1494 -{  
1495 - global $codigoMap,$locaplic,$codigoLayer,$postgis_mapa;  
1496 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1497 - $mapa = ms_newMapObj($mapfile);  
1498 - $layer = $mapa->getlayerbyname($codigoLayer);  
1499 - $lcon = $layer->connection;  
1500 - if ($layer->connectiontype == MS_POSTGIS){  
1501 - if (in_array($lcon,array_keys($postgis_mapa))){  
1502 - $layer->set("connection",$postgis_mapa[$lcon]);  
1503 - }  
1504 - }  
1505 - $layer->open();  
1506 - $itens = $layer->getitems();  
1507 - $layer->close();  
1508 - $dados["itens"] = $itens;  
1509 - return $dados;  
1510 -}  
1511 -function adicionaGrupoUsrTema(){  
1512 - global $id_tema,$id_grupo,$locaplic,$esquemaadmin;  
1513 - include($locaplic."/admin/php/conexao.php");  
1514 - $sql = "select * from ".$esquemaadmin."i3geousr_grupotema where id_tema = $id_tema and id_grupo = $id_grupo";  
1515 - $q = $dbh->query($sql,PDO::FETCH_ASSOC);  
1516 - if($q){  
1517 - $teste = $q->fetchAll();  
1518 - if(count($teste) == 0){  
1519 - $dataCol = array(  
1520 - "id_tema" => $id_tema,  
1521 - "id_grupo" => $id_grupo  
1522 - );  
1523 - i3GeoAdminInsert($dbhw,"i3geousr_grupotema",$dataCol);  
1524 - }  
1525 - }  
1526 - return "ok";  
1527 -}  
1528 -function excluirGrupoUsrTema(){  
1529 - global $id_tema,$id_grupo,$locaplic,$esquemaadmin;  
1530 - include($locaplic."/admin/php/conexao.php");  
1531 - $sql = "DELETE from ".$esquemaadmin."i3geousr_grupotema where id_tema = ? and id_grupo = ? ";  
1532 - $prep = $dbhw->prepare($sql);  
1533 - $prep->execute(array($id_tema,$id_grupo));  
1534 - i3GeoAdminInsertLog($dbhw,$sql,array($id_tema,$id_grupo));  
1535 - return "ok";  
1536 -}  
1537 -function pegaLayers()  
1538 -{  
1539 - global $codigoMap,$locaplic,$esquemaadmin;  
1540 - $dados = array();  
1541 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1542 - //echo $mapfile;exit;  
1543 - $mapa = ms_newMapObj($mapfile);  
1544 - $layers = $mapa->getalllayernames();  
1545 - $dados["layers"] = $layers;  
1546 - //lista de grupo de usuarios  
1547 - $gruposusr = array();  
1548 - include($locaplic."/admin/php/conexao.php");  
1549 - $sql = "  
1550 - select ".$esquemaadmin."i3geoadmin_temas.codigo_tema, ".$esquemaadmin."i3geousr_grupos.id_grupo,  
1551 - ".$esquemaadmin."i3geousr_grupos.nome, ".$esquemaadmin."i3geousr_grupos.descricao,  
1552 - ".$esquemaadmin."i3geousr_grupotema.id_tema  
1553 - from  
1554 - ".$esquemaadmin."i3geoadmin_temas  
1555 - join ".$esquemaadmin."i3geousr_grupotema  
1556 - on ".$esquemaadmin."i3geousr_grupotema.id_grupo = ".$esquemaadmin."i3geousr_grupos.id_grupo  
1557 - join ".$esquemaadmin."i3geousr_grupos  
1558 - on ".$esquemaadmin."i3geoadmin_temas.id_tema = ".$esquemaadmin."i3geousr_grupotema.id_tema  
1559 - where codigo_tema = '".$codigoMap."'  
1560 - ";  
1561 - $q = $dbh->query($sql,PDO::FETCH_ASSOC);  
1562 - if($q){  
1563 - $gruposusr = $q->fetchAll();  
1564 - }  
1565 - $dados["gruposusr"] = $gruposusr;  
1566 - return $dados;  
1567 -}  
1568 -function listaClasses()  
1569 -{  
1570 - global $codigoMap,$codigoLayer,$locaplic;  
1571 - $dados = array();  
1572 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1573 - $mapa = ms_newMapObj($mapfile);  
1574 - $layer = $mapa->getlayerbyname($codigoLayer);  
1575 - if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){  
1576 - return $dados;  
1577 - }  
1578 - $nclasses = $layer->numclasses;  
1579 - for($i=0;$i<$nclasses;++$i)  
1580 - {  
1581 - $classe = $layer->getclass($i);  
1582 - $texto = $classe->name;  
1583 - $dados[] = array("indice"=>$i,"nome"=>base64_encode($texto));  
1584 - }  
1585 - return $dados;  
1586 -}  
1587 -function listaEstilos()  
1588 -{  
1589 - global $codigoMap,$codigoLayer,$locaplic;  
1590 - $dados = array();  
1591 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1592 - $mapa = ms_newMapObj($mapfile);  
1593 - $layer = $mapa->getlayerbyname($codigoLayer);  
1594 - if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){  
1595 - return $dados;  
1596 - }  
1597 - $classe = $layer->getclass($_GET["indiceClasse"]);  
1598 - $numestilos = $classe->numstyles;  
1599 - for($i=0;$i<$numestilos;++$i)  
1600 - {  
1601 - $dados[] = array("estilo"=>$i);  
1602 - }  
1603 - return $dados;  
1604 -}  
1605 -  
1606 -function excluirLayer()  
1607 -{  
1608 - global $codigoMap,$codigoLayer,$locaplic;  
1609 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1610 - $mapa = ms_newMapObj($mapfile);  
1611 - $nl = $mapa->getlayerbyname($codigoLayer);  
1612 - $nl->set("status",MS_DELETE);  
1613 - $mapa->save($mapfile);  
1614 - removeCabecalho($mapfile);  
1615 - return "ok";  
1616 -}  
1617 -function excluirClasse()  
1618 -{  
1619 - global $codigoMap,$codigoLayer,$locaplic;  
1620 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1621 - $mapa = ms_newMapObj($mapfile);  
1622 - $nl = $mapa->getlayerbyname($codigoLayer);  
1623 - $classObj = $nl->getclass($_GET["indiceClasse"]);  
1624 - $classObj->set("status",MS_DELETE);  
1625 - $mapa->save($mapfile);  
1626 - removeCabecalho($mapfile);  
1627 - return "ok";  
1628 -}  
1629 -function excluirEstilo()  
1630 -{  
1631 - global $codigoMap,$codigoLayer,$locaplic;  
1632 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1633 - $mapa = ms_newMapObj($mapfile);  
1634 - $nl = $mapa->getlayerbyname($codigoLayer);  
1635 - $classObj = $nl->getclass($_GET["indiceClasse"]);  
1636 - $classObj->deletestyle($_GET["indiceEstilo"]);  
1637 - $mapa->save($mapfile);  
1638 - removeCabecalho($mapfile);  
1639 - return "ok";  
1640 -}  
1641 -function pegaComport()  
1642 -{  
1643 - global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;  
1644 - $dados = array();  
1645 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1646 - $mapa = ms_newMapObj($mapfile);  
1647 - $layer = $mapa->getlayerbyname($codigoLayer);  
1648 - $v = versao();  
1649 - $dados["aplicaextensao"] = $layer->getmetadata("aplicaextensao");  
1650 - $dados["permitecomentario"] = $layer->getmetadata("permitecomentario");  
1651 - $dados["temporizador"] = $layer->getmetadata("temporizador");  
1652 - $dados["classe"] = $layer->getmetadata("classe");  
1653 - $dados["legendaimg"] = $layer->getmetadata("legendaimg");  
1654 - $dados["escondido"] = $layer->getmetadata("escondido");  
1655 - $dados["identifica"] = $layer->getmetadata("identifica");  
1656 - $dados["transitioneffect"] = $layer->getmetadata("transitioneffect");  
1657 - $dados["status"] = $layer->status;  
1658 - $dados["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;  
1659 - $v["principal"] == "4" ? $dados["opacity"] = $layer->transparency : $dados["opacity"] = $layer->opacity;  
1660 - $dados["maxscale"] = $layer->maxscaledenom;  
1661 - $dados["minscale"] = $layer->minscaledenom;  
1662 - $dados["labelitem"] = $layer->labelitem;  
1663 - $dados["labelmaxscale"] = $layer->labelmaxscaledenom;  
1664 - $dados["labelminscale"] = $layer->labelminscaledenom;  
1665 - $dados["symbolscale"] = $layer->symbolscaledenom;  
1666 - $dados["tolerance"] = $layer->tolerance;  
1667 - $dados["toleranceunits"] = $layer->toleranceunits;  
1668 - $dados["sizeunits"] = $layer->sizeunits;  
1669 -  
1670 - $dados["codigoMap"] = $codigoMap;  
1671 - $dados["codigoLayer"] = $codigoLayer;  
1672 - return $dados;  
1673 -}  
1674 -function alterarComport()  
1675 -{  
1676 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;  
1677 - $v = versao();  
1678 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1679 - $mapa = ms_newMapObj($mapfile);  
1680 - $layer = $mapa->getlayerbyname($codigoLayer);  
1681 - $layer->setmetadata("aplicaextensao",$_GET["aplicaextensao"]);  
1682 - $layer->setmetadata("permitecomentario",$_GET["permitecomentario"]);  
1683 - $layer->setmetadata("temporizador",$_GET["temporizador"]);  
1684 - $layer->setmetadata("classe",$_GET["classe"]);  
1685 - $layer->setmetadata("legendaimg",$_GET["legendaimg"]);  
1686 - $layer->setmetadata("escondido",$_GET["escondido"]);  
1687 - $layer->setmetadata("identifica",$_GET["identifica"]);  
1688 - $layer->setmetadata("transitioneffect",$_GET["transitioneffect"]);  
1689 - $layer->set("status",$_GET["status"]);  
1690 - if($_GET["offsite"] == -1 || $_GET["offsite"] == "null")  
1691 - {  
1692 - $_GET["offsite"] = "-1,-1,-1";  
1693 - }  
1694 - $cor = $layer->offsite;  
1695 - $c = explode(",",$_GET["offsite"]);  
1696 - if(count($c) < 3)  
1697 - $c = explode(" ",$_GET["offsite"]);  
1698 - $cor->setrgb($c[0],$c[1],$c[2]);  
1699 - $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;  
1700 - $v["principal"] == "4" ? $layer->set("transparency",$_GET["opacity"]) : $layer->set("opacity",$_GET["opacity"]);  
1701 - $layer->set("maxscaledenom",$_GET["maxscale"]);  
1702 - $layer->set("minscaledenom",$_GET["minscale"]);  
1703 - $layer->set("labelitem",$_GET["labelitem"]);  
1704 - $layer->set("labelmaxscaledenom",$_GET["labelmaxscale"]);  
1705 - $layer->set("labelminscaledenom",$_GET["labelminscale"]);  
1706 - $layer->set("symbolscaledenom",$_GET["symbolscale"]);  
1707 - $layer->set("tolerance",$_GET["tolerance"]);  
1708 - $layer->set("toleranceunits",$_GET["toleranceunits"]);  
1709 - $layer->set("sizeunits",$_GET["sizeunits"]);  
1710 -  
1711 - $mapa->save($mapfile);  
1712 - removeCabecalho($mapfile);  
1713 - return "ok";  
1714 -}  
1715 -function pegaTitulo()  
1716 -{  
1717 - global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;  
1718 - $dados = array();  
1719 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1720 - $mapa = ms_newMapObj($mapfile);  
1721 - $layer = $mapa->getlayerbyname($codigoLayer);  
1722 - $dados["name"] = $layer->name;  
1723 - $dados["tema"] = mb_convert_encoding($layer->getmetadata("tema"),"UTF-8","ISO-8859-1");  
1724 - $dados["iconetema"] = $layer->getmetadata("iconetema");  
1725 - $dados["mensagem"] = mb_convert_encoding($layer->getmetadata("mensagem"),"UTF-8","ISO-8859-1");  
1726 - $dados["escala"] = $layer->getmetadata("escala");  
1727 - $dados["extensao"] = $layer->getmetadata("extensao");  
1728 - $dados["group"] = $layer->group;  
1729 - $dados["codigoMap"] = $codigoMap;  
1730 - $dados["codigoLayer"] = $codigoLayer;  
1731 - return $dados;  
1732 -}  
1733 -function alterarNomeTema(){  
1734 - global $locaplic,$codigoMap, $esquemaadmin;  
1735 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1736 - $mapa = ms_newMapObj($mapfile);  
1737 - $layer = $mapa->getlayerbyname($codigoMap);  
1738 - if($layer){  
1739 - $layer->setmetadata("tema",$_GET["novoNome"]);  
1740 - $mapa->save($mapfile);  
1741 - removeCabecalho($mapfile);  
1742 - include("conexao.php");  
1743 - if($convUTF){  
1744 - $_GET["novoNome"] = utf8_encode($_GET["novoNome"]);  
1745 - }  
1746 - $dataCol = array(  
1747 - "nome_tema" => $_GET["novoNome"]  
1748 - );  
1749 - i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol," WHERE codigo_tema='$codigoMap'");  
1750 - $dbhw = null;  
1751 - $dbh = null;  
1752 - }  
1753 - return "ok";  
1754 -}  
1755 -function alterarTitulo()  
1756 -{  
1757 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;  
1758 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1759 - $mapa = ms_newMapObj($mapfile);  
1760 - $layer = $mapa->getlayerbyname($codigoLayer);  
1761 -  
1762 - $layer->set("name",$_GET["name"]);  
1763 - $layer->setmetadata("tema",$_GET["tema"]);  
1764 - $layer->setmetadata("iconetema",$_GET["iconetema"]);  
1765 - $layer->setmetadata("mensagem",$_GET["mensagem"]);  
1766 - $layer->setmetadata("escala",$_GET["escala"]);  
1767 - $layer->setmetadata("extensao",$_GET["extensao"]);  
1768 - $layer->set("group",$_GET["group"]);  
1769 -  
1770 - $mapa->save($mapfile);  
1771 - removeCabecalho($mapfile);  
1772 - $codigoLayer = $_GET["name"];  
1773 - return "ok";  
1774 -}  
1775 -function pegaDispo()  
1776 -{  
1777 - global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;  
1778 - $dados = array();  
1779 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1780 - $mapa = ms_newMapObj($mapfile);  
1781 - $layer = $mapa->getlayerbyname($codigoLayer);  
1782 - $dados["download"] = $layer->getmetadata("download");  
1783 - $dados["arquivodownload"] = $layer->getmetadata("arquivodownload");  
1784 - $dados["arquivokmz"] = $layer->getmetadata("arquivokmz");  
1785 - $dados["ogc_tema"] = $layer->getmetadata("permiteogc");  
1786 - $dados["download_tema"] = $layer->getmetadata("permitedownload");  
1787 - $dados["kml_tema"] = $layer->getmetadata("permitekml");  
1788 - $dados["kmz_tema"] = $layer->getmetadata("permitekmz");  
1789 - $dados["codigoMap"] = $codigoMap;  
1790 - $dados["codigoLayer"] = $codigoLayer;  
1791 - return $dados;  
1792 -}  
1793 -function pegaEditavel()  
1794 -{  
1795 - global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;  
1796 - $dados = array();  
1797 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1798 - $mapa = ms_newMapObj($mapfile);  
1799 - $layer = $mapa->getlayerbyname($codigoLayer);  
1800 - $dados["editavel"] = $layer->getmetadata("EDITAVEL"); //SIM ou NAO  
1801 - $dados["colunaidunico"] = $layer->getmetadata("COLUNAIDUNICO");  
1802 - $dados["tabelaeditavel"] = $layer->getmetadata("TABELAEDITAVEL");  
1803 - $dados["esquematabelaeditavel"] = $layer->getmetadata("ESQUEMATABELAEDITAVEL");  
1804 - $dados["colunageometria"] = $layer->getmetadata("COLUNAGEOMETRIA");  
1805 - $dados["codigoMap"] = $codigoMap;  
1806 - $dados["codigoLayer"] = $codigoLayer;  
1807 - return $dados;  
1808 -}  
1809 -function alterarEditavel()  
1810 -{  
1811 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;  
1812 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1813 - $mapa = ms_newMapObj($mapfile);  
1814 - $layer = $mapa->getlayerbyname($codigoLayer);  
1815 - $layer->setmetadata("EDITAVEL",$_GET["editavel"]);  
1816 - $layer->setmetadata("COLUNAIDUNICO",$_GET["colunaidunico"]);  
1817 - $layer->setmetadata("TABELAEDITAVEL",$_GET["tabelaeditavel"]);  
1818 - $layer->setmetadata("ESQUEMATABELAEDITAVEL",$_GET["esquematabelaeditavel"]);  
1819 - $layer->setmetadata("COLUNAGEOMETRIA",$_GET["colunageometria"]);  
1820 - $layer->setmetadata("cache","");  
1821 - $mapa->save($mapfile);  
1822 - removeCabecalho($mapfile);  
1823 - return "ok";  
1824 -}  
1825 -function alterarDispo()  
1826 -{  
1827 - global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;  
1828 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1829 - $mapa = ms_newMapObj($mapfile);  
1830 - $layer = $mapa->getlayerbyname($codigoLayer);  
1831 - $layer->setmetadata("download",$_GET["download"]);  
1832 - $layer->setmetadata("arquivodownload",$_GET["arquivodownload"]);  
1833 - $layer->setmetadata("arquivokmz",$_GET["arquivokmz"]);  
1834 - $layer->setmetadata("permiteogc",$_GET["ogc_tema"]);  
1835 - $layer->setmetadata("permitekml",$_GET["kml_tema"]);  
1836 - $layer->setmetadata("permitekmz",$_GET["kmz_tema"]);  
1837 - $layer->setmetadata("permitedownload",$_GET["download_tema"]);  
1838 - $mapa->save($mapfile);  
1839 - removeCabecalho($mapfile);  
1840 - return "ok";  
1841 -}  
1842 -//essa funcao existe tambem em menutemas.php  
1843 -function alteraTemas(){  
1844 - global $esquemaadmin,$codigoLayer,$locaplic;  
1845 - include("conexao.php");  
1846 - $dataCol = array(  
1847 - "download_tema" => $_GET["download_tema"],  
1848 - "ogc_tema" => $_GET["ogc_tema"],  
1849 - "kml_tema" => $_GET["kml_tema"],  
1850 - "kmz_tema" => $_GET["kmz_tema"]  
1851 - );  
1852 - i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoLayer'");  
1853 - $dbhw = null;  
1854 - $dbh = null;  
1855 -}  
1856 -  
1857 -function pegaConexao()  
1858 -{  
1859 - global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;  
1860 - $dados = array();  
1861 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1862 - $mapa = ms_newMapObj($mapfile);  
1863 - $layer = $mapa->getlayerbyname($codigoLayer);  
1864 - $dados["connection"] = $layer->connection;  
1865 - $dados["connectiontype"] = $layer->connectiontype;  
1866 - $dados["data"] = $layer->data;  
1867 - $dados["tileindex"] = $layer->tileindex;  
1868 - $dados["tileitem"] = $layer->tileitem;  
1869 - $dados["cache"] = $layer->getmetadata("cache");  
1870 - $dados["tiles"] = $layer->getmetadata("tiles");  
1871 - $dados["cortepixels"] = $layer->getmetadata("cortepixels");  
1872 - if($dados["cortepixels"] == ""){  
1873 - $dados["cortepixels"] = 0;  
1874 - }  
1875 - if($dados["tileindex"] == ""){  
1876 - $dados["tileitem"] = "";  
1877 - }  
1878 - if(is_array($postgis_mapa))  
1879 - $dados["postgis_mapa"] = array_keys($postgis_mapa);  
1880 - else  
1881 - $dados["postgis_mapa"] = $postgis_mapa;  
1882 - $dados["codigoMap"] = $codigoMap;  
1883 - $dados["codigoLayer"] = $codigoLayer;  
1884 - $dados["type"] = $layer->type;  
1885 - $dados["filter"] = $layer->getfilterstring();  
1886 - if($dados["filter"]== ""){  
1887 - $dados["filter"] = "";  
1888 - }  
1889 - $dados["filteritem"] = $layer->filteritem;  
1890 - $dados["projection"] = $layer->getProjection();  
1891 - if($dados["projection"] == "null")  
1892 - {  
1893 - $dados["projection"] = "";  
1894 - }  
1895 - $dados["projection"] = str_replace("+i","i",$dados["projection"]);  
1896 - $dados["convcaracter"] = $layer->getmetadata("convcaracter");  
1897 - //informacoes sobre a integracao com o sistema de metadados estatisticos  
1898 - $dados["metaestat"] = $layer->getmetadata("metaestat");  
1899 - if($dados["metaestat"] == ""){  
1900 - $dados["metaestat"] = "NAO";  
1901 - }  
1902 - $dados["metaestat_id_medida_variavel"] = $layer->getmetadata("metaestat_id_medida_variavel");  
1903 -  
1904 - $dados["colunas"] = implode(",",pegaItens($layer));  
1905 -  
1906 - if($layer->connectiontype == 7 || $layer->connectiontype == 9){  
1907 - $dados["tipooriginal"] = $layer->getmetadata("tipooriginal");  
1908 - }  
1909 - return $dados;  
1910 -}  
1911 -function alterarConexao()  
1912 -{  
1913 - global $esquemaadmin,$dir_tmp,$codigoMap,$codigoLayer,$locaplic;  
1914 - if($_GET["data"] != ""){  
1915 - $_GET["data"] = base64_decode($_GET["data"]);  
1916 - }  
1917 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
1918 - $mapa = ms_newMapObj($mapfile);  
1919 - $layer = $mapa->getlayerbyname($codigoLayer);  
1920 - //quando o layer estiver conectado com o METAESTAT, alguns parametros sao default  
1921 - include("conexao.php");  
1922 - //e necessario atualizar o banco de dados de administracao, por isso e feito a verificacao do registro ou nao do mapfile no banco  
1923 - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigoMap'";  
1924 - $dados = pegaDados($sql);  
1925 - if(count($dados) == 0){  
1926 - $dataCol = array(  
1927 - "tipoa_tema" => "META",  
1928 - "nome_tema" => $codigoMap,  
1929 - "codigo_tema" => $codigoMap,  
1930 - "kml_tema" => "SIM",  
1931 - "kmz_tema" => "NAO",  
1932 - "ogc_tema" => "SIM",  
1933 - "download_tema" => "SIM",  
1934 - "tags_tema" => "",  
1935 - "link_tema" => "",  
1936 - "desc_tema" => ""  
1937 - );  
1938 - i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);  
1939 - }  
1940 - if(strtoupper($metaestat) == "SIM"){  
1941 - $_GET["connectiontype"] = 6;  
1942 - $_GET["filteritem"] = "";  
1943 - $_GET["filter"] = "";  
1944 - $_GET["data"] = "";  
1945 - $_GET["connection"] = "";  
1946 - $dataCol = array(  
1947 - "tipoa_tema" => "META"  
1948 - );  
1949 - i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");  
1950 - $layer->setmetadata("metaestat","SIM");  
1951 - $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",$_GET["metaestat_id_medida_variavel"]);  
1952 - }  
1953 - else{  
1954 - $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO","");  
1955 - $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL","");  
1956 - $layer->setmetadata("metaestat","");  
1957 - $dataCol = array(  
1958 - "tipoa_tema" => ""  
1959 - );  
1960 - i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");  
1961 - }  
1962 - $layer->set("connection",$_GET["connection"]);  
1963 - if(ms_GetVersionInt() > 50201){  
1964 - $layer->setconnectiontype($_GET["connectiontype"]);  
1965 - }  
1966 - else{  
1967 - $layer->set("connectiontype",$_GET["connectiontype"]);  
1968 - }  
1969 - $layer->set("data",$_GET["data"]);  
1970 - $layer->set("tileitem",$_GET["tileitem"]);  
1971 - $layer->set("tileindex",$_GET["tileindex"]);  
1972 - $layer->set("type",$_GET["type"]);  
1973 - if($_GET["type"] == 0){  
1974 - $c = $layer->getClass(0);  
1975 - $e = $c->getStyle(0);  
1976 - if($e->symbolname == ""){  
1977 - $e->set("symbolname","ponto");  
1978 - }  
1979 - }  
1980 - if($_GET["type"] == 1){  
1981 - $c = $layer->getClass(0);  
1982 - $e = $c->getStyle(0);  
1983 - if($e->symbolname == "" || $e->symbolname == "ponto"){  
1984 - $e->set("symbolname","linha");  
1985 - }  
1986 - }  
1987 - if($_GET["type"] == 2){  
1988 - $c = $layer->getClass(0);  
1989 - $e = $c->getStyle(0);  
1990 - if($e->symbolname == "linha" || $e->symbolname == "ponto"){  
1991 - $e->set("symbolname"," ");  
1992 - }  
1993 - }  
1994 - $layer->setfilter($_GET["filter"]);  
1995 - $layer->set("filteritem",$_GET["filteritem"]);  
1996 - if($layer->getprojection() == MS_TRUE)  
1997 - $layer->setprojection($_GET["projection"]);  
1998 - if($layer->getprojection() == MS_FALSE && $_GET["projection"] != "")  
1999 - $layer->setprojection($_GET["projection"]);  
2000 - if($layer->connectiontype == 7 || $layer->connectiontype== 9){  
2001 - $layer->setmetadata("tipooriginal",$_GET["tipooriginal"]);  
2002 - }  
2003 - $layer->setmetadata("cache",$_GET["cache"]);  
2004 - $layer->setmetadata("tiles",$_GET["tiles"]);  
2005 - if($_GET["cortepixels"] == ""){  
2006 - $_GET["cortepixels"] = 0;  
2007 - }  
2008 - $layer->setmetadata("cortepixels",$_GET["cortepixels"]);  
2009 -  
2010 - $layer->setmetadata("convcaracter",$_GET["convcaracter"]);  
2011 - if($_GET["testar"] == "true")  
2012 - {  
2013 - $nome = $dir_tmp."/".$codigoMap.".map";  
2014 - $mapa->save($nome);  
2015 - removeCabecalho($nome,true);  
2016 - return $nome;  
2017 - }  
2018 - else  
2019 - {  
2020 - $mapa->save($mapfile);  
2021 - removeCabecalho($mapfile);  
2022 - return "ok";  
2023 - }  
2024 -}  
2025 -function pegaMetadados()  
2026 -{  
2027 - global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;  
2028 - //error_reporting(0);  
2029 - $dados = array();  
2030 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2031 - $mapa = ms_newMapObj($mapfile);  
2032 - $layer = $mapa->getlayerbyname($codigoLayer);  
2033 - $dados["type"] = $layer->type;  
2034 - $dados["connectiontype"] = $layer->connectiontype;  
2035 - $dados["itens"] = $layer->getmetadata("itens");  
2036 - $dados["itensdesc"] = mb_convert_encoding($layer->getmetadata("itensdesc"),"UTF-8","ISO-8859-1"); //$layer->getmetadata("itensdesc");  
2037 - $dados["itenslink"] = $layer->getmetadata("itenslink");  
2038 - $dados["tip"] = $layer->getmetadata("tip");  
2039 - $dados["classesitem"] = $layer->getmetadata("classesitem");  
2040 - $dados["classesnome"] = $layer->getmetadata("classesnome");  
2041 - $dados["classescor"] = $layer->getmetadata("classescor");  
2042 - $dados["classessimbolo"] = $layer->getmetadata("classessimbolo");  
2043 - $dados["classestamanho"] = $layer->getmetadata("classestamanho");  
2044 - $dados["palletefile"] = $layer->getmetadata("palletefile");  
2045 - $dados["palletestep"] = $layer->getmetadata("palletestep");  
2046 - $dados["description_template"] = $layer->getmetadata("description_template");  
2047 - $dados["editorsql"] = $layer->getmetadata("editorsql");  
2048 - $dados["codigoMap"] = $codigoMap;  
2049 - $dados["codigoLayer"] = $codigoLayer;  
2050 - $lcon = $layer->connection;  
2051 - if ($layer->connectiontype == MS_POSTGIS){  
2052 - if (in_array($lcon,array_keys($postgis_mapa)))  
2053 - {  
2054 - //echo $postgis_mapa[$lcon];exit;  
2055 - $layer->set("connection",$postgis_mapa[$lcon]);  
2056 - }  
2057 - }  
2058 - $dados["colunas"] = implode(" ,",pegaItens($layer));  
2059 - $layer->set("connection",$lcon);  
2060 -  
2061 - $dados["ltempoformatodata"] = $layer->getmetadata("ltempoformatodata");  
2062 - $dados["ltempoiteminicio"] = $layer->getmetadata("ltempoiteminicio");  
2063 - $dados["ltempoitemfim"] = $layer->getmetadata("ltempoitemfim");  
2064 - $dados["ltempoitemtitulo"] = $layer->getmetadata("ltempoitemtitulo");  
2065 - $dados["ltempoitemdescricao"] = $layer->getmetadata("ltempoitemdescricao");  
2066 - $dados["ltempoconvencode"] = $layer->getmetadata("ltempoconvencode");  
2067 - $dados["ltempoitemtip"] = $layer->getmetadata("ltempoitemtip");  
2068 - $dados["ltempoitemimagem"] = $layer->getmetadata("ltempoitemimagem");  
2069 - $dados["ltempoitemicone"] = $layer->getmetadata("ltempoitemicone");  
2070 - $dados["ltempoitemlink"] = $layer->getmetadata("ltempoitemlink");  
2071 -  
2072 - $dados["itembuscarapida"] = $layer->getmetadata("itembuscarapida");  
2073 - if($layer->connectiontype == 7 || $layer->connectiontype == 9){  
2074 - $dados["wms_srs"] = $layer->getmetadata("wms_srs");  
2075 - $dados["wms_name"] = $layer->getmetadata("wms_name");  
2076 - $dados["wms_server_version"] = $layer->getmetadata("wms_server_version");  
2077 - $dados["wms_format"] = $layer->getmetadata("wms_format");  
2078 - $dados["wms_auth_username"] = $layer->getmetadata("wms_auth_username");  
2079 - $dados["wms_auth_password"] = $layer->getmetadata("wms_auth_password");  
2080 - $dados["wms_auth_type"] = $layer->getmetadata("wms_auth_type");  
2081 - $dados["wms_connectiontimeout"] = $layer->getmetadata("wms_connectiontimeout");  
2082 - $dados["wms_latlonboundingbox"] = $layer->getmetadata("wms_latlonboundingbox");  
2083 - $dados["wms_proxy_auth_type"] = $layer->getmetadata("wms_proxy_auth_type");  
2084 -  
2085 - $dados["wms_proxy_host"] = $layer->getmetadata("wms_proxy_host");  
2086 - $dados["wms_proxy_port"] = $layer->getmetadata("wms_proxy_port");  
2087 - $dados["wms_proxy_type"] = $layer->getmetadata("wms_proxy_type");  
2088 - $dados["wms_proxy_username"] = $layer->getmetadata("wms_proxy_username");  
2089 - $dados["wms_proxy_password"] = $layer->getmetadata("wms_proxy_password");  
2090 - $dados["wms_sld_body"] = $layer->getmetadata("wms_sld_body");  
2091 - $dados["wms_sld_url"] = $layer->getmetadata("wms_sld_url");  
2092 - $dados["wms_style"] = $layer->getmetadata("wms_style");  
2093 - $dados["wms_bgcolor"] = $layer->getmetadata("wms_bgcolor");  
2094 - $dados["wms_transparent"] = $layer->getmetadata("wms_transparent");  
2095 - $dados["wms_time"] = $layer->getmetadata("wms_time");  
2096 - $dados["wms_tile"] = $layer->getmetadata("wms_tile");  
2097 - }  
2098 - return $dados;  
2099 -}  
2100 -function alterarMetadados()  
2101 -{  
2102 - global $codigoMap,$codigoLayer,$locaplic;  
2103 - $dados = array();  
2104 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2105 - $mapa = ms_newMapObj($mapfile);  
2106 - $layer = $mapa->getlayerbyname($codigoLayer);  
2107 - if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){  
2108 - return "erro. Layer METAESTAT";  
2109 - }  
2110 - $_GET["itens"] = str_replace(", ",",",$_GET["itens"]);  
2111 - $_GET["itens"] = str_replace(" ,",",",$_GET["itens"]);  
2112 - $layer->setmetadata("itens",$_GET["itens"]);  
2113 - $_GET["itensdesc"] = str_replace(", ",",",$_GET["itensdesc"]);  
2114 - $_GET["itensdesc"] = str_replace(" ,",",",$_GET["itensdesc"]);  
2115 - $layer->setmetadata("itensdesc",$_GET["itensdesc"]);  
2116 - $layer->setmetadata("itenslink",$_GET["itenslink"]);  
2117 - $_GET["tip"] = str_replace(", ",",",$_GET["tip"]);  
2118 - $_GET["tip"] = str_replace(" ,",",",$_GET["tip"]);  
2119 - $layer->setmetadata("tip",$_GET["tip"]);  
2120 - $layer->setmetadata("classesitem",$_GET["classesitem"]);  
2121 - $layer->setmetadata("classesnome",$_GET["classesnome"]);  
2122 - $layer->setmetadata("classescor",$_GET["classescor"]);  
2123 - $layer->setmetadata("classessimbolo",$_GET["classessimbolo"]);  
2124 - $layer->setmetadata("classestamanho",$_GET["classestamanho"]);  
2125 - $layer->setmetadata("palletefile",$_GET["palletefile"]);  
2126 - $layer->setmetadata("palletestep",$_GET["palletestep"]);  
2127 - $layer->setmetadata("description_template",$_GET["description_template"]);  
2128 - $layer->setmetadata("editorsql",$_GET["editorsql"]);  
2129 - $layer->setmetadata("ltempoformatodata",$_GET["ltempoformatodata"]);  
2130 - $layer->setmetadata("ltempoiteminicio",$_GET["ltempoiteminicio"]);  
2131 - $layer->setmetadata("ltempoitemfim",$_GET["ltempoitemfim"]);  
2132 - $layer->setmetadata("ltempoitemtitulo",$_GET["ltempoitemtitulo"]);  
2133 - $layer->setmetadata("ltempoconvencode",$_GET["ltempoconvencode"]);  
2134 - $layer->setmetadata("ltempoitemdescricao",$_GET["ltempoitemdescricao"]);  
2135 - $layer->setmetadata("ltempoitemtip",$_GET["ltempoitemtip"]);  
2136 - $layer->setmetadata("ltempoitemimagem",$_GET["ltempoitemimagem"]);  
2137 - $layer->setmetadata("ltempoitemicone",$_GET["ltempoitemicone"]);  
2138 - $layer->setmetadata("ltempoitemlink",$_GET["ltempoitemlink"]);  
2139 -  
2140 - $layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]);  
2141 - if($layer->connectiontype == 7 || $layer->connectiontype== 9){  
2142 - $layer->setmetadata("wms_srs",$_GET["wms_srs"]);  
2143 - $layer->setmetadata("wms_name",$_GET["wms_name"]);  
2144 - $layer->setmetadata("wms_server_version",$_GET["wms_server_version"]);  
2145 - $layer->setmetadata("wms_format",$_GET["wms_format"]);  
2146 - if($_GET["wms_auth_username"] != ""){  
2147 - $layer->setmetadata("wms_auth_username",$_GET["wms_auth_username"]);  
2148 - $layer->setmetadata("wms_auth_password",$_GET["wms_auth_password"]);  
2149 - $layer->setmetadata("wms_auth_type",$_GET["wms_auth_type"]);  
2150 - }  
2151 - $layer->setmetadata("wms_connectiontimeout",$_GET["wms_connectiontimeout"]);  
2152 - if($_GET["wms_latlonboundingbox"] != "")  
2153 - {  
2154 - $layer->setmetadata("wms_latlonboundingbox",$_GET["wms_latlonboundingbox"]);  
2155 - }  
2156 - if($_GET["wms_proxy_host"] != ""){  
2157 - $layer->setmetadata("wms_proxy_auth_type",$_GET["wms_proxy_auth_type"]);  
2158 - $layer->setmetadata("wms_proxy_host",$_GET["wms_proxy_host"]);  
2159 - $layer->setmetadata("wms_proxy_port",$_GET["wms_proxy_port"]);  
2160 - $layer->setmetadata("wms_proxy_type",$_GET["wms_proxy_type"]);  
2161 - $layer->setmetadata("wms_proxy_username",$_GET["wms_proxy_username"]);  
2162 - $layer->setmetadata("wms_proxy_password",$_GET["wms_proxy_password"]);  
2163 - }  
2164 - if($_GET["wms_sld_body"] != "")  
2165 - {  
2166 - $layer->setmetadata("wms_sld_body",$_GET["wms_sld_body"]);  
2167 - }  
2168 - if($_GET["wms_sld_url"] != "")  
2169 - {  
2170 - $layer->setmetadata("wms_sld_url",$_GET["wms_sld_url"]);  
2171 - }  
2172 - $layer->setmetadata("wms_style",$_GET["wms_style"]);  
2173 - if($_GET["wms_bgcolor"] != "")  
2174 - $layer->setmetadata("wms_bgcolor",$_GET["wms_bgcolor"]);  
2175 - if($_GET["wms_transparent"] != "")  
2176 - $layer->setmetadata("wms_transparent",$_GET["wms_transparent"]);  
2177 - if($_GET["wms_time"] != "")  
2178 - $layer->setmetadata("wms_time",$_GET["wms_time"]);  
2179 - if($_GET["wms_tile"] != "")  
2180 - $layer->setmetadata("wms_tile",$_GET["wms_tile"]);  
2181 - $layer->setmetadata("tipooriginal",$_GET["tipooriginal"]);  
2182 - }  
2183 - $mapa->save($mapfile);  
2184 - removeCabecalho($mapfile);  
2185 - return "ok";  
2186 -}  
2187 -function pegaClasseGeral()  
2188 -{  
2189 - global $codigoMap,$codigoLayer,$locaplic;  
2190 -  
2191 - //error_reporting(0);  
2192 - $dados = array();  
2193 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2194 - $mapa = ms_newMapObj($mapfile);  
2195 - $layer = $mapa->getlayerbyname($codigoLayer);  
2196 - $classe = $layer->getclass($_GET["indiceClasse"]);  
2197 - $dados["name"] = base64_encode($classe->name);  
2198 - $dados["title"] = base64_encode($classe->title);  
2199 - $temp = $classe->getExpressionString();  
2200 - //$temp = str_replace("[","_C",$temp);  
2201 - //$temp = str_replace("]","C_",$temp);  
2202 - //$temp = str_replace("'","_A_",$temp);  
2203 - //substitui caracteres que d&atilde;o problemas  
2204 - $dados["expression"] = base64_encode($temp);  
2205 - $dados["keyimage"] = $classe->keyimage;  
2206 - $dados["maxscale"] = $classe->maxscaledenom;  
2207 - $dados["minscale"] = $classe->minscaledenom;  
2208 - $dados["status"] = $classe->status;  
2209 - //$dados["text"] = $classe->getTextString();  
2210 - $dados["codigoMap"] = $codigoMap;  
2211 - $dados["codigoLayer"] = $codigoLayer;  
2212 - $dados["indiceClasse"] = $_GET["indiceClasse"];  
2213 - $dados["colunas"] = implode(" ,",pegaItens($layer));  
2214 - return $dados;  
2215 -}  
2216 -function alterarClasseGeral()  
2217 -{  
2218 - global $codigoMap,$codigoLayer,$locaplic;  
2219 - $dados = array();  
2220 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2221 - $mapa = ms_newMapObj($mapfile);  
2222 - $layer = $mapa->getlayerbyname($codigoLayer);  
2223 - if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){  
2224 - return "erro. Layer METAESTAT";  
2225 - }  
2226 - $classe = $layer->getclass($_GET["indiceClasse"]);  
2227 - $classe->set("name",base64_decode($_GET["name"]));  
2228 - $classe->set("title",base64_decode($_GET["title"]));  
2229 - $classe->setexpression(base64_decode($_GET["expression"]));  
2230 - $classe->set("keyimage",$_GET["keyimage"]);  
2231 - $classe->set("maxscaledenom",$_GET["maxscale"]);  
2232 - $classe->set("minscaledenom",$_GET["minscale"]);  
2233 - $classe->set("status",$_GET["status"]);  
2234 - $mapa->save($mapfile);  
2235 - removeCabecalho($mapfile);  
2236 - return "ok";  
2237 -}  
2238 -function pegaClasseLabel()  
2239 -{  
2240 - global $codigoMap,$codigoLayer,$locaplic;  
2241 - $dados = array();  
2242 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2243 - $mapa = ms_newMapObj($mapfile);  
2244 - $layer = $mapa->getlayerbyname($codigoLayer);  
2245 - $classe = $layer->getclass($_GET["indiceClasse"]);  
2246 -  
2247 - $v = versao();  
2248 - $vi = $v["inteiro"];  
2249 - if($vi >= 60200){  
2250 - $nlabels = $classe->numlabels;  
2251 - if($nlabels > 0){  
2252 - $label = $classe->getLabel(0);  
2253 - }  
2254 - else{  
2255 - $label = "";  
2256 - }  
2257 - }  
2258 - else{  
2259 - $label = $classe->label;  
2260 - }  
2261 - if ($label != "")  
2262 - {  
2263 - $dados["font"] = $label->font;  
2264 - $dados["type"] = $label->type;  
2265 - //$dados["backgroundcolor"] = $label->backgroundcolor->red.",".$label->backgroundcolor->green.",".$label->backgroundcolor->blue;  
2266 - //$dados["backgroundshadowcolor"] = $label->backgroundshadowcolor->red.",".$label->backgroundshadowcolor->green.",".$label->backgroundshadowcolor->blue;  
2267 - $dados["color"] = $label->color->red.",".$label->color->green.",".$label->color->blue;  
2268 - $dados["outlinecolor"] = $label->outlinecolor->red.",".$label->outlinecolor->green.",".$label->outlinecolor->blue;  
2269 - $dados["shadowcolor"] = $label->shadowcolor->red.",".$label->shadowcolor->green.",".$label->shadowcolor->blue;  
2270 - $dados["shadowsizex"] = $label->shadowsizex;  
2271 - $dados["shadowsizey"] = $label->shadowsizey;  
2272 - //$dados["backgroundshadowsizex"] = $label->backgroundshadowsizex;  
2273 - //$dados["backgroundshadowsizey"] = $label->backgroundshadowsizey;  
2274 - $dados["size"] = $label->size;  
2275 -  
2276 - $dados["minsize"] = $label->minsize;  
2277 - $dados["maxsize"] = $label->maxsize;  
2278 - $dados["position"] = $label->position;  
2279 - $dados["offsetx"] = $label->offsetx;  
2280 - $dados["offsety"] = $label->offsety;  
2281 - $dados["angle"] = $label->angle;  
2282 - //$dados["autoangle"] = $label->autoangle;  
2283 - $dados["buffer"] = $label->buffer;  
2284 - //$dados["antialias"] = $label->antialias;  
2285 - $dados["wrap"] = $label->wrap;  
2286 - $dados["minfeaturesize"] = $label->minfeaturesize;  
2287 - $dados["autominfeaturesize"] = $label->autominfeaturesize;  
2288 - $dados["mindistance"] = $label->mindistance;  
2289 - $dados["partials"] = $label->partials;  
2290 - $dados["force"] = $label->force;  
2291 - $dados["encoding"] = $label->encoding;  
2292 - }  
2293 - $dados["codigoMap"] = $codigoMap;  
2294 - $dados["codigoLayer"] = $codigoLayer;  
2295 - $dados["indiceClasse"] = $indiceClasse;  
2296 - $dados["colunas"] = implode(" ,",pegaItens($layer));  
2297 - $arq = $locaplic."/symbols/fontes.txt";  
2298 - $h = fopen ($arq,"r");  
2299 - while ($i = fscanf ($h, "%s\t%s\t"))  
2300 - {  
2301 - list ($f,$g) = $i;  
2302 - $nome[] = $f;  
2303 - }  
2304 - $dados["fontes"] = $nome;  
2305 - return $dados;  
2306 -}  
2307 -function alterarClasseLabel()  
2308 -{  
2309 - global $codigoMap,$codigoLayer,$locaplic;  
2310 - if(!isset($_GET["text"])){  
2311 - $_GET["text"] = "";  
2312 - }  
2313 - else{  
2314 - $_GET["text"] = "[".$_GET["text"]."]";  
2315 - }  
2316 - $dados = array();  
2317 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2318 - $mapa = ms_newMapObj($mapfile);  
2319 - $layer = $mapa->getlayerbyname($codigoLayer);  
2320 - if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){  
2321 - return "erro. Layer METAESTAT";  
2322 - }  
2323 - $classe = $layer->getclass($_GET["indiceClasse"]);  
2324 - $v = versao();  
2325 - $vi = $v["inteiro"];  
2326 - if($vi >= 60300){  
2327 - while($classe->numlabels > 0){  
2328 - $classe->removeLabel(0);  
2329 - }  
2330 - }  
2331 - if($text == ""){  
2332 - if($vi >= 60300){  
2333 - $indiceLabel = $classe->addLabel(new labelObj());  
2334 - $label = $classe->getLabel($indiceLabel);  
2335 - }  
2336 - else{  
2337 - $label = $classe->label;  
2338 - }  
2339 - }  
2340 - elseif ($vi >= 60300 && $classe->numlabels == 0){  
2341 - if($wrap != ""){  
2342 - $s = "CLASS LABEL WRAP '$wrap' TEXT '".$_GET["text"]."' END END";  
2343 - $classe->updateFromString($s);  
2344 - }  
2345 - else{  
2346 - $s = "CLASS LABEL TEXT '".$_GET["text"]."' END END";  
2347 - $classe->updateFromString($s);  
2348 - }  
2349 - }  
2350 -  
2351 - if($vi >= 60300){  
2352 - $label = $classe->getLabel(0);  
2353 - }  
2354 - else{  
2355 - $label = $classe->label;  
2356 - }  
2357 -  
2358 - if($wrap != ""){  
2359 - $label->set("maxlength",1);  
2360 - }  
2361 - if($_GET["fonte"] != "bitmap"){  
2362 - //para funcionar na versao 7 do mapserver  
2363 - $label->updateFromString("LABEL type truetype END");  
2364 - $label->set("font",$_GET["fonte"]);  
2365 - $label->set("size",$_GET["tamanho"]);  
2366 - }  
2367 - else{  
2368 - //para funcionar na versao 7 do mapserver  
2369 - $label->updateFromString("LABEL type bitmap END");  
2370 - $t = MS_TINY;  
2371 - if ($_GET["tamanho"] > 5 ){  
2372 - $t = MS_TINY;  
2373 - }  
2374 - if ($_GET["tamanho"] >= 7 ){  
2375 - $t = MS_SMALL;  
2376 - }  
2377 - if ($_GET["tamanho"] >= 10 ){  
2378 - $t = MS_MEDIUM;  
2379 - }  
2380 - if ($_GET["tamanho"] >= 12 ){  
2381 - $t = MS_LARGE;  
2382 - }  
2383 - if ($_GET["tamanho"] >= 14 ){  
2384 - $t = MS_GIANT;  
2385 - }  
2386 - $label->set("size",$t);  
2387 - }  
2388 - if ($label != ""){  
2389 - //$label->set("type",$type);  
2390 - corE($label,$_GET["backgroundcolor"],"backgroundcolor");  
2391 - corE($label,$_GET["backgroundshadowcolor"],"backgroundshadowcolor");  
2392 - corE($label,$_GET["color"],"color");  
2393 - corE($label,$_GET["outlinecolor"],"outlinecolor");  
2394 - if(!empty($_GET["sombra"]) && !empty($_GET["backgroundshadowsizex"])){  
2395 - corE($label,$_GET["sombra"],"backgroundshadowcolor",$_GET["backgroundshadowsizex"],$_GET["backgroundshadowsizey"]);  
2396 - }  
2397 - $label->set("shadowsizex",$_GET["shadowsizex"]);  
2398 - $label->set("shadowsizey",$_GET["shadowsizey"]);  
2399 - //$label->set("backgroundshadowsizex",$backgroundshadowsizex);  
2400 - //$label->set("backgroundshadowsizey",$backgroundshadowsizey);  
2401 -  
2402 - $label->set("minsize",$_GET["minsize"]);  
2403 - $label->set("maxsize",$_GET["maxsize"]);  
2404 - //$label->set("position",$position);  
2405 -  
2406 - $label->set("offsetx",$_GET["offsetx"]);  
2407 - $label->set("offsety",$_GET["offsety"]);  
2408 - $label->set("angle",$_GET["angle"]);  
2409 -  
2410 - //$label->set("autoangle",$autoangle);  
2411 - //$label->set("buffer",$buffer);  
2412 - //$label->set("antialias",$antialias);  
2413 - $label->set("wrap",$_GET["wrap"]);  
2414 - $label->set("minfeaturesize",$_GET["minfeaturesize"]);  
2415 - $label->set("mindistance",$_GET["mindistance"]);  
2416 - $label->set("partials",$_GET["partials"]);  
2417 - $label->set("force",$_GET["force"]);  
2418 - $label->set("encoding",$_GET["encoding"]);  
2419 -  
2420 - $p = array("MS_AUTO"=>MS_AUTO,"MS_UL"=>MS_UL,"MS_LR"=>MS_LR,"MS_UR"=>MS_UR,"MS_LL"=>MS_LL,"MS_CR"=>MS_CR,"MS_CL"=>MS_CL,"MS_UC"=>MS_UC,"MS_LC"=>MS_LC,"MS_CC"=>MS_CC);  
2421 - $label->set("position",$p[$_GET["position"]]);  
2422 - }  
2423 - $mapa->save($mapfile);  
2424 - removeCabecalho($mapfile);  
2425 - return "ok";  
2426 -}  
2427 -function pegaEstilo()  
2428 -{  
2429 - global $codigoMap,$codigoLayer,$locaplic;  
2430 - $dados = array();  
2431 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2432 - $mapa = ms_newMapObj($mapfile);  
2433 - $layer = $mapa->getlayerbyname($codigoLayer);  
2434 - $nclasses = $layer->numclasses;  
2435 - $classe = $layer->getclass($_GET["indiceClasse"]);  
2436 - $estilo = $classe->getstyle($_GET["indiceEstilo"]);  
2437 - $dados["symbolname"] = $estilo->symbolname;  
2438 -  
2439 - $dados["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue;  
2440 - $dados["size"] = $estilo->size;  
2441 - $dados["minsize"] = $estilo->minsize;  
2442 - $dados["maxsize"] = $estilo->maxsize;  
2443 - $dados["offsetx"] = $estilo->offsetx;  
2444 - $dados["offsety"] = $estilo->offsety;  
2445 -  
2446 - //$dados["antialias"] = $estilo->antialias;  
2447 -  
2448 - $dados["backgroundcolor"] = $estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue;  
2449 - $dados["outlinecolor"] = $estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue;  
2450 - $dados["width"] = $estilo->width;  
2451 -  
2452 - $dados["minwidth"] = $estilo->minwidth;  
2453 - $dados["maxwidth"] = $estilo->maxwidth;  
2454 - $dados["angle"] = $estilo->angle;  
2455 - $dados["codigoMap"] = $codigoMap;  
2456 -  
2457 - $dados["codigoLayer"] = $codigoLayer;  
2458 - $dados["indiceClasse"] = $indiceClasse;  
2459 - $dados["indiceEstilo"] = $indiceEstilo;  
2460 - $dados["type"] = $layer->type;  
2461 - return $dados;  
2462 -}  
2463 -function alterarEstilo()  
2464 -{  
2465 - global $codigoMap,$codigoLayer,$locaplic;  
2466 - $dados = array();  
2467 - $mapfile = $locaplic."/temas/".$codigoMap.".map";  
2468 - $mapa = ms_newMapObj($mapfile);  
2469 - $layer = $mapa->getlayerbyname($codigoLayer);  
2470 - if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){  
2471 - return "erro. Layer METAESTAT";  
2472 - }  
2473 - $nclasses = $layer->numclasses;  
2474 - $classe = $layer->getclass($_GET["indiceClasse"]);  
2475 - $estilo = $classe->getstyle($_GET["indiceEstilo"]);  
2476 - if(!empty($_GET["symbolname"])){  
2477 - $estilo->set("symbolname",$_GET["symbolname"]);  
2478 - }  
2479 - if(empty($_GET["symbolname"])){  
2480 - $estilo->set("symbolname"," ");  
2481 - }  
2482 - corE($estilo,$color,"color");  
2483 -  
2484 - $estilo->set("size",$_GET["size"]);  
2485 - $estilo->set("minsize",$_GET["minsize"]);  
2486 - $estilo->set("maxsize",$_GET["maxsize"]);  
2487 - $estilo->set("offsetx",$_GET["offsetx"]);  
2488 - $estilo->set("offsety",$_GET["offsety"]);  
2489 - $estilo->set("antialias",$_GET["antialias"]);  
2490 - corE($estilo,$_GET["backgroundcolor"],"backgroundcolor");  
2491 - corE($estilo,$_GET["outlinecolor"],"outlinecolor");  
2492 - $estilo->set("width",$_GET["width"]);  
2493 - $estilo->set("minwidth",$_GET["minwidth"]);  
2494 - $estilo->set("maxwidth",$_GET["maxwidth"]);  
2495 - $estilo->set("angle",$_GET["angle"]);  
2496 - //$estilo->set("opacity",$opacity);  
2497 - $mapa->save($mapfile);  
2498 - removeCabecalho($mapfile);  
2499 - return "ok";  
2500 -}  
2501 -  
2502 -function removeCabecalho($arq,$symbolset=true)  
2503 -{  
2504 - global $dir_tmp;  
2505 - //remove o cache OGC  
2506 - $nomeMapfileTmp = $dir_tmp."/ogc_".md5($arq).".map";  
2507 - $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp);  
2508 - $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp);  
2509 - if(file_exists($nomeMapfileTmp)){  
2510 - chmod($nomeMapfileTmp,0777);  
2511 - unlink($nomeMapfileTmp);  
2512 - }  
2513 - //echo $nomeMapfileTmp;exit;  
2514 - //remove o cache OGC  
2515 - $handle = fopen($arq, "r");  
2516 - if ($handle)  
2517 - {  
2518 - $cabeca = array();  
2519 - if($symbolset)  
2520 - {  
2521 - $cabeca[] = "MAP\n";  
2522 - //$final[] = "SYMBOLSET ../symbols/simbolos.sym\n";  
2523 - //$final[] = "FONTSET ".'"'."../symbols/fontes.txt".'"'."\n";  
2524 - }  
2525 - $grava = false;  
2526 - while (!feof($handle))  
2527 - {  
2528 - $linha = fgets($handle);  
2529 - if($symbolset)  
2530 - {  
2531 - if(strpos(strtoupper($linha),"SYMBOLSET") !== false)  
2532 - {  
2533 - $cabeca[] = $linha;  
2534 - }  
2535 - if(strpos(strtoupper($linha),"FONTSET") !== false)  
2536 - {  
2537 - $cabeca[] = $linha;  
2538 - }  
2539 - }  
2540 - if(strtoupper(trim($linha)) == "LAYER")  
2541 - {  
2542 - $grava = true;  
2543 - }  
2544 - if($grava)  
2545 - {  
2546 - $final[] = rtrim($linha, "\r\n") . PHP_EOL;  
2547 - }  
2548 - }  
2549 - fclose($handle);  
2550 - }  
2551 - $final = array_merge($cabeca,$final);  
2552 - $handle = fopen($arq, "w+");  
2553 - $testar = array("LEGENDAWMS","LEGENDAIMG","KEYIMAGE","TILEINDEX","TILEITEM","SYMBOL","LABELITEM","FILTERITEM","GROUP","ENCODING","TIP","CLASSE","ITENSDESC","CLASSESNOME","ITENSLINK","ESCALA","CLASSESSIMBOLO","MENSAGEM","EXTENSAO","CLASSESITEM","ESCONDIDO","CLASSESCOR","DOWNLOAD","CLASSESTAMANHO","ITENS","TEMA","APLICAEXTENSAO","IDENTIFICA","TRANSITIONEFFECT");  
2554 - foreach ($final as $f)  
2555 - {  
2556 - //  
2557 - //remove resultados em branco  
2558 - //e grava a linha  
2559 - //  
2560 - $teste = strtoupper($f);  
2561 - $teste = trim($teste);  
2562 - $teste = str_replace(array(" ","'",'"'),"",$teste);  
2563 - //$teste = str_replace("'","",$teste);  
2564 - //$teste = str_replace('"',"",$teste);  
2565 - $teste = preg_replace('/[\n\r\t ]*/', '', $teste);  
2566 - $passou = true;  
2567 - foreach ($testar as $t)  
2568 - {  
2569 - if($teste == $t){  
2570 - $passou = false;  
2571 - }  
2572 - }  
2573 - if($passou == true){  
2574 - fwrite($handle,$f);  
2575 - }  
2576 - }  
2577 - fclose($handle);  
2578 - //chmod($arq, 0666);  
2579 -}  
2580 -function rrmdir($dir) {  
2581 - if (is_dir($dir)) {  
2582 - //chmod($dir,0777);  
2583 - $objects = scandir($dir);  
2584 - foreach ($objects as $object) {  
2585 - if ($object != "." && $object != "..") {  
2586 - //chmod($dir."/".$object,0777);  
2587 - if (filetype($dir."/".$object) == "dir"){  
2588 - rrmdir($dir."/".$object);  
2589 - } else {  
2590 - rename($dir."/".$object,$dir."/".$object."_removido");  
2591 - }  
2592 - }  
2593 - }  
2594 - reset($objects);  
2595 - rmdir($dir);  
2596 - }  
2597 -}  
2598 -?>  
2599 \ No newline at end of file 0 \ No newline at end of file
admin/php/xxxeditormapfile.php 0 → 100755
@@ -0,0 +1,2599 @@ @@ -0,0 +1,2599 @@
  1 +<?php
  2 +exit;
  3 +/*
  4 +Title: editormapfile.php
  5 +
  6 +Fun&ccedil;&otilde;es utilizadas pelo editor de arquivos mapfile.
  7 +
  8 +&Eacute; utilizado nas fun&ccedil;&otilde;es em AJAX da interface de edi&ccedil;&atilde;o de mapfiles
  9 +
  10 +Licenca:
  11 +
  12 +GPL2
  13 +
  14 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  15 +
  16 +Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  17 +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  18 +
  19 +Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  20 +e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  21 +GNU conforme publicada pela Free Software Foundation;
  22 +
  23 +Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  24 +por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  25 +de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  26 +Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  27 +Voc&ecirc; deve ter recebido uma copia da Licen&ccedil;a P&uacute;blica Geral do
  28 + GNU junto com este programa; se n&atilde;o, escreva para a
  29 +Free Software Foundation, Inc., no endere&ccedil;o
  30 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  31 +
  32 +Arquivo:
  33 +
  34 +i3geo/admin/php/editormapfile.php
  35 +
  36 +Parametros:
  37 +
  38 +O par&acirc;metro principal &eacute; "funcao", que define qual opera&ccedil;&atilde;o ser&aacute; executada, por exemplo, editormapfile.php?funcao=pegaMapfiles
  39 +
  40 +Cada opera&ccedil;&atilde;o possu&iacute; seus proprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.
  41 +
  42 +*/
  43 +include_once(dirname(__FILE__)."/login.php");
  44 +
  45 +$id = $_GET["id"];
  46 +
  47 +testaSafeNumerico([$id]);
  48 +
  49 +$codigoMap = $_GET["codigoMap"];
  50 +$codigomap = $_GET["codigomap"];
  51 +$codigoLayer = $_GET["codigoLayer"];
  52 +$nomelayer = $_GET["nomelayer"];
  53 +$movimento = $_GET["movimento"];
  54 +
  55 +$funcoesEdicao = array(
  56 + "CRIARNOVOMAP",
  57 + "EDITASIMBOLO",
  58 + "LIMPARCACHEMAPFILE",
  59 + "EXCLUIRMAPFILE",
  60 + "REFAZERLAYER",
  61 + "CLONARMAPFILE",
  62 + "CRIARNOVOLAYER",
  63 + "EXCLUIRLAYER",
  64 + "AUTOCLASSESLAYER",
  65 + "CRIARNOVACLASSE",
  66 + "EXCLUIRCLASSE",
  67 + "CRIARNOVOESTILO",
  68 + "EXCLUIRESTILO",
  69 + "ALTERARESTILO",
  70 + "ALTERARCONEXAO",
  71 + "ALTERARTITULO",
  72 + "ALTERARNOMETEMA",
  73 + "ALTERARDISPO",
  74 + "ALTERARCOMPORT",
  75 + "ALTERARMETADADOS",
  76 + "ALTERARGERAL",
  77 + "ALTERARCLASSEGERAL",
  78 + "ALTERARCLASSELABEL",
  79 + "DOWNLOADGVP",
  80 + "ALTERAREDITAVEL",
  81 + "PEGAPLUGIN",
  82 + "GRAVAPLUGIN",
  83 + "REMOVEPLUGIN",
  84 + "DOWNLOADGVP"
  85 +);
  86 +if(in_array(strtoupper($funcao),$funcoesEdicao)){
  87 + if(verificaOperacaoSessao("admin/html/editormapfile") == false){
  88 + retornaJSON("Vc nao pode realizar essa operacao.");exit;
  89 + }
  90 +}
  91 +if(in_array(strtoupper($funcao),$funcoesEdicao)){
  92 + $f = @fopen("$locaplic/temas/teste.txt",w);
  93 + @fclose($f);
  94 + if (!file_exists("$locaplic/temas/teste.txt")){
  95 + retornaJSON("sem direito de escrita na pasta temas");exit;
  96 + }
  97 + if(verificaOperacaoSessao("admin/html/editormapfile") == false){
  98 + retornaJSON("Vc nao pode realizar essa operacao.");exit;
  99 + }
  100 + unlink("$locaplic/temas/teste.txt");
  101 +}
  102 +//error_reporting(0);
  103 +//define o parametro de output do resultado da funcao
  104 +//algumas funcoes podem ser inseridas com include em outros programas
  105 +//nesse caso, defina output como "retorno"
  106 +//caso contrario sera definido como json
  107 +if(empty($_GET["output"])){
  108 + $output = "json";
  109 +} else {
  110 + $output = $_GET["output"];
  111 +}
  112 +//faz a busca da fun&ccedil;&atilde;o que deve ser executada
  113 +switch (strtoupper($funcao))
  114 +{
  115 + /*
  116 + Note:
  117 +
  118 + Valores que o par&acirc;metro &funcao pode receber. Os par&acirc;metros devem ser enviados na requisi&ccedil;&atilde;o em AJAX.
  119 + */
  120 + /*
  121 + Valor: CRIARNOVOMAP
  122 +
  123 + Cria um novo mapfile
  124 +
  125 + Parametros:
  126 +
  127 + nome - t&iacute;tulo do novo tema
  128 +
  129 + codigo - texto que ser&aacute; usado como nome do arquivo mapfile
  130 +
  131 + it - {opcional} t&iacute;tulo em italiano
  132 +
  133 + en - {opcional} t&iacute;tulo em ingl&ecirc;s
  134 +
  135 + es - {opcional} t&iacute;tulo em espanhol
  136 +
  137 + Retorno:
  138 +
  139 + {JSON}
  140 + */
  141 + case "CRIARNOVOMAP":
  142 + $resultado = criarNovoMap();
  143 + if($output == "retorno"){
  144 + return $resultado;
  145 + }else{
  146 + retornaJSON($resultado);
  147 + exit;
  148 + }
  149 + break;
  150 + case "PEGAPLUGIN":
  151 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  152 + $mapa = ms_newMapObj($mapfile);
  153 + $layer = $mapa->getlayerbyname($codigoLayer);
  154 + retornaJSON($layer->getmetadata("PLUGINI3GEO"));
  155 + break;
  156 + case "GRAVAPLUGIN":
  157 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  158 + $mapa = ms_newMapObj($mapfile);
  159 + $layer = $mapa->getlayerbyname($codigoLayer);
  160 + $layer->setmetadata("PLUGINI3GEO",$_GET["plugin"]);
  161 + $mapa->save($mapfile);
  162 + removeCabecalho($mapfile);
  163 + retornaJSON("ok");
  164 + break;
  165 + case "REMOVEPLUGIN":
  166 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  167 + $mapa = ms_newMapObj($mapfile);
  168 + $layer = $mapa->getlayerbyname($codigoLayer);
  169 + $layer->setmetadata("PLUGINI3GEO","");
  170 + $mapa->save($mapfile);
  171 + removeCabecalho($mapfile);
  172 + retornaJSON("ok");
  173 + break;
  174 + case "DOWNLOADGVP":
  175 + if(file_exists($locaplic."/temas/".$codigoMap.".gvp")){
  176 + ob_end_clean();
  177 + header('Content-type: application/octet-stream');
  178 + header('Content-Disposition: attachment; filename='.$codigoMap.'.gvp');
  179 + echo file_get_contents($locaplic."/temas/".$codigoMap.".gvp");
  180 + }
  181 + else{
  182 + echo "Arquivo nao encontrado";
  183 + }
  184 + exit;
  185 + break;
  186 + /*
  187 + Valor: EDITASIMBOLO
  188 +
  189 + Lista os s&iacute;mbolos de um determinado tipo
  190 +
  191 + Parametros:
  192 +
  193 + tipo {string} - tipo de layer
  194 +
  195 + onclick {string} - fun&ccedil;&atilde;o javascript que ser&aacute; executada ao se clicar no s&iacute;mbilo
  196 +
  197 + Retorno:
  198 +
  199 + {JSON}
  200 + */
  201 + case "EDITASIMBOLO":
  202 + include_once(dirname(__FILE__)."/../../classesphp/classe_legenda.php");
  203 + $versao = versao();
  204 + $versao = $versao["principal"];
  205 + if($base == "" || !isset($base)){
  206 + $base = "";
  207 + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
  208 + {
  209 + $base = $locaplic."/aplicmap/geral1windowsv".$versao.".map";
  210 + }
  211 + else
  212 + {
  213 + if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){
  214 + $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map";
  215 + }
  216 + if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
  217 + $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map";
  218 + }
  219 + if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
  220 + $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map";
  221 + }
  222 + if($base == "")
  223 + {
  224 + $base = $locaplic."/aplicmap/geral1v".$versao.".map";
  225 + }
  226 + }
  227 + }
  228 + else{
  229 + if(!file_exists($base))
  230 + {
  231 + $base = $locaplic."/aplicmap/".$base;
  232 + }
  233 + }
  234 + $base = str_replace(".map","",$base).".map";
  235 + $m = new Legenda($base,$locaplic);
  236 + retornaJSON($m->listaSimbolos($tipo,$dir_tmp,"",$_GET["onclick"],8,1,true));
  237 + exit;
  238 + break;
  239 + /*
  240 + Valor: PEGALAYERS
  241 +
  242 + Lista os layers existentes em um mapfile
  243 +
  244 + Parametros:
  245 +
  246 + codigoMap {string} - nome do mapfile (sem .map)
  247 +
  248 + Retorno:
  249 +
  250 + {JSON}
  251 + */
  252 + case "PEGALAYERS":
  253 + retornaJSON(pegaLayers());
  254 + exit;
  255 + break;
  256 + /*
  257 + Valor: PEGAITENSLAYER
  258 +
  259 + Lista os itens da tabela de atributos de um layer
  260 +
  261 + Parametros:
  262 +
  263 + codigoMap {string} - nome do mapfile (sem .map)
  264 +
  265 + codigoLayer {string} - 'name' do layer existente no mapfile
  266 +
  267 + Retorno:
  268 +
  269 + {JSON}
  270 + */
  271 + case "PEGAITENSLAYER":
  272 + retornaJSON(pegaItensLayer());
  273 + exit;
  274 + break;
  275 + /*
  276 + Valor: LIMPARCACHEMAPFILE
  277 +
  278 + Apaga o diretorio contendo o cache de um tema (mapfile)
  279 +
  280 + Parametros:
  281 +
  282 + codigoMap {string} - nome do mapfile (sem .map)
  283 +
  284 + Retorno:
  285 +
  286 + {JSON}
  287 + */
  288 + case "LIMPARCACHEMAPFILE":
  289 + //error_reporting(0);
  290 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  291 + $mapa = ms_newMapObj($mapfile);
  292 + $nomes = $mapa->getalllayernames();
  293 + if($cachedir != ""){
  294 + $d = $cachedir;
  295 + }
  296 + else{
  297 + $d = $dir_tmp."/cache";
  298 + }
  299 + foreach($nomes as $nome)
  300 + {
  301 + $dirs[] = $d."/".$nome;
  302 + $dirs[] = $d."/googlemaps/".$nome;
  303 + foreach($dirs as $dir){
  304 + rename($dir,$dir."_removido");
  305 + }
  306 + }
  307 + retornaJSON("ok");
  308 + exit;
  309 + break;
  310 + /*
  311 + Valor: EXCLUIRMAPFILE
  312 +
  313 + Exclui um mapfile.
  314 +
  315 + So &eacute; poss&iacute;vel excluir se o mapfile n&atilde;o estiver vinculado a nenhum tema ou no da &aacute;rvore de temas
  316 +
  317 + Parametros:
  318 +
  319 + codigoMap {string} - nome do mapfile (sem .map)
  320 +
  321 + Retorno:
  322 +
  323 + {JSON}
  324 + */
  325 + case "EXCLUIRMAPFILE":
  326 + //pega oid do tema
  327 + $dados = pegaDados("SELECT id_tema from ".$esquemaadmin."i3geoadmin_temas WHERE codigo_tema = '".$codigoMap."'");
  328 + if(count($dados) > 0){
  329 + $id = $dados[0]["id_tema"];
  330 + }
  331 + else{
  332 + $id = "";
  333 + $f = "";
  334 + }
  335 + $tabela = "mapfiles";
  336 + $coluna = "id_tema";
  337 + if($id != ""){
  338 + $f = verificaFilhos();
  339 + }
  340 + if($f && $f != ""){
  341 + retornaJSON("erro");
  342 + exit;
  343 + }
  344 + else{
  345 + if(file_exists("$locaplic/temas/".$codigoMap.".map")){
  346 + unlink("$locaplic/temas/".$codigoMap.".map");
  347 + }
  348 + else{
  349 + if(file_exists("$locaplic/temas/".$codigoMap.".gvp")){
  350 + unlink("$locaplic/temas/".$codigoMap.".gvp");
  351 + }
  352 + if(file_exists("$locaplic/temas/".$codigoMap.".php")){
  353 + unlink("$locaplic/temas/".$codigoMap.".php");
  354 + }
  355 + }
  356 + $tabela = "i3geoadmin_temas";
  357 + if($id && $id != ""){
  358 + exclui($esquemaadmin.$tabela,$coluna,$id);
  359 + }
  360 + retornaJSON("ok");
  361 + exit;
  362 + }
  363 + break;
  364 + /*
  365 + Valor: REFAZERLAYER
  366 +
  367 + Altera um layer existente em um mapfile com base em um layer existente em outro mapfile
  368 +
  369 + Parametros:
  370 +
  371 + codigomap {string} - nome do mapfile existente em i3geo/temas que ser&aacute; atualizado (sem .map)
  372 +
  373 + maporigem {string} - nome completo do arquivo mapfile que contem o layer que ser&aacute; utilizado para alterar o original
  374 +
  375 + nomelayer {string} - codigo do layer em mapfile que ser&aacute; utilizado para atualizar codigoMap
  376 +
  377 + Retorno:
  378 +
  379 + {JSON}
  380 + */
  381 + case "REFAZERLAYER":
  382 + retornaJSON(refazerLayer());
  383 + exit;
  384 + break;
  385 + /*
  386 + Valor: CLONARMAPFILE
  387 +
  388 + Copia um mapfile existente
  389 +
  390 + Parametros:
  391 +
  392 + codigomap {string} - nome do mapfile existente em i3geo/temas que ser&aacute; clonado (sem .map)
  393 +
  394 + novomap {string} - nome do mapfile que ser&aacute; criado
  395 +
  396 + Retorno:
  397 +
  398 + {JSON}
  399 + */
  400 + case "CLONARMAPFILE":
  401 + retornaJSON(clonarMapfile());
  402 + exit;
  403 + break;
  404 + /*
  405 + Valor: CRIARNOVOLAYER
  406 +
  407 + Cria um novo layer em um mapfile
  408 +
  409 + O novo layer receber&aacute; um nome aleat�rio, que pode ser modificado posteriormente. Por default, esse novo layer ser&aacute; do tipo linear
  410 +
  411 + Parametros:
  412 +
  413 + codigoMap {string} - nome do mapfile (sem .map)
  414 +
  415 + Retorno:
  416 +
  417 + {JSON}
  418 + */
  419 + case "CRIARNOVOLAYER":
  420 + retornaJSON(criarNovoLayer());
  421 + exit;
  422 + break;
  423 + /*
  424 + Valor: EXCLUIRLAYER
  425 +
  426 + Exclui um layer de um mapfile
  427 +
  428 + Parametros:
  429 +
  430 + codigoMap {string} - nome do mapfile (sem .map)
  431 +
  432 + codigoLayer {string} - 'name' do layer existente no mapfile
  433 +
  434 + Retorno:
  435 +
  436 + {JSON}
  437 + */
  438 + case "EXCLUIRLAYER":
  439 + retornaJSON(excluirLayer());
  440 + exit;
  441 + break;
  442 +
  443 + /*
  444 + Valor: LISTACLASSES
  445 +
  446 + Lista as classes da legenda de um layer em um mapfile
  447 +
  448 + Parametros:
  449 +
  450 + codigoMap {string} - nome do mapfile (sem .map)
  451 +
  452 + codigoLayer {string} - 'name' do layer existente no mapfile
  453 +
  454 + Retorno:
  455 +
  456 + {JSON}
  457 + */
  458 + case "LISTACLASSES":
  459 + retornaJSON(listaClasses());
  460 + exit;
  461 + break;
  462 + /*
  463 + Valor: AUTOCLASSESLAYER
  464 +
  465 + Cria classes em um layer com base na tabela de atributos
  466 +
  467 + Parametros:
  468 +
  469 + codigoMap {string} - nome do mapfile (sem .map)
  470 +
  471 + codigoLayer {string} - 'name' do layer existente no mapfile
  472 +
  473 + itemExpressao - item da tabela de atributos que cont&eacute;m os valores &uacute;nicos para as classes
  474 +
  475 + itemNome - item da tabela de atributos que cont&eacute;m os nomes de cada classe
  476 +
  477 + Retorno:
  478 +
  479 + {JSON}
  480 + */
  481 + case "AUTOCLASSESLAYER":
  482 + autoClassesLayer();
  483 + retornaJSON(listaClasses());
  484 + exit;
  485 + break;
  486 + /*
  487 + Valor: CRIARNOVACLASSE
  488 +
  489 + Cria uma nova classe em um layer
  490 +
  491 + Parametros:
  492 +
  493 + codigoMap {string} - nome do mapfile (sem .map)
  494 +
  495 + codigoLayer {string} - 'name' do layer existente no mapfile
  496 +
  497 + Retorno:
  498 +
  499 + {JSON}
  500 + */
  501 + case "CRIARNOVACLASSE":
  502 + retornaJSON(criarNovaClasse());
  503 + exit;
  504 + break;
  505 + /*
  506 + Valor: EXCLUIRCLASSE
  507 +
  508 + Cria uma nova classe em um layer
  509 +
  510 + Parametros:
  511 +
  512 + codigoMap {string} - nome do mapfile (sem .map)
  513 +
  514 + codigoLayer {string} - 'name' do layer existente no mapfile
  515 +
  516 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  517 +
  518 + Retorno:
  519 +
  520 + {JSON}
  521 + */
  522 + case "EXCLUIRCLASSE":
  523 + excluirClasse();
  524 + retornaJSON(listaClasses());
  525 + exit;
  526 + break;
  527 + /*
  528 + Valor: LISTAESTILOS
  529 +
  530 + Lista de estilos existentes em uma classe de um layer
  531 +
  532 + Parametros:
  533 +
  534 + codigoMap {string} - nome do mapfile (sem .map)
  535 +
  536 + codigoLayer {string} - 'name' do layer existente no mapfile
  537 +
  538 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  539 +
  540 + Retorno:
  541 +
  542 + {JSON}
  543 + */
  544 + case "LISTAESTILOS":
  545 + retornaJSON(listaEstilos());
  546 + exit;
  547 + break;
  548 + /*
  549 + Valor: CRIARNOVOESTILO
  550 +
  551 + Adiciona um novo estilo em uma classe
  552 +
  553 + Parametros:
  554 +
  555 + codigoMap {string} - nome do mapfile (sem .map)
  556 +
  557 + codigoLayer {string} - 'name' do layer existente no mapfile
  558 +
  559 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  560 +
  561 + Retorno:
  562 +
  563 + {JSON}
  564 + */
  565 + case "CRIARNOVOESTILO":
  566 + retornaJSON(criarNovoEstilo());
  567 + exit;
  568 + break;
  569 + /*
  570 + Valor: EXCLUIRESTILO
  571 +
  572 + Exclui um estilo de uma classe
  573 +
  574 + Parametros:
  575 +
  576 + codigoMap {string} - nome do mapfile (sem .map)
  577 +
  578 + codigoLayer {string} - 'name' do layer existente no mapfile
  579 +
  580 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  581 +
  582 + indiceEstilo {numerico} - &iacute;ndice do estilo (de 0 at&eacute; n&uacute;mero de estilos-1)
  583 +
  584 + Retorno:
  585 +
  586 + {JSON}
  587 + */
  588 + case "EXCLUIRESTILO":
  589 + excluirEstilo();
  590 + retornaJSON(listaEstilos());
  591 + exit;
  592 + break;
  593 + /*
  594 + Valor: PEGAESTILO
  595 +
  596 + Obt&eacute;m os dados de um estilo de uma classe
  597 +
  598 + Parametros:
  599 +
  600 + codigoMap {string} - nome do mapfile (sem .map)
  601 +
  602 + codigoLayer {string} - 'name' do layer existente no mapfile
  603 +
  604 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  605 +
  606 + indiceEstilo {numerico} - &iacute;ndice do estilo (de 0 at&eacute; n&uacute;mero de estilos-1)
  607 +
  608 + Retorno:
  609 +
  610 + {JSON}
  611 + */
  612 + case "PEGAESTILO":
  613 + retornaJSON(pegaEstilo());
  614 + exit;
  615 + break;
  616 + /*
  617 + Valor: ALTERARESTILO
  618 +
  619 + Altera um estilo de uma classe
  620 +
  621 + Parametros:
  622 +
  623 + codigoMap {string} - nome do mapfile (sem .map)
  624 +
  625 + codigoLayer {string} - 'name' do layer existente no mapfile
  626 +
  627 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  628 +
  629 + indiceEstilo {numerico} - &iacute;ndice do estilo (de 0 at&eacute; n&uacute;mero de estilos-1)
  630 +
  631 + angle
  632 +
  633 + maxwidth
  634 +
  635 + minwidth
  636 +
  637 + width
  638 +
  639 + outlinecolor
  640 +
  641 + backgroundcolor
  642 +
  643 + antialias
  644 +
  645 + offsety
  646 +
  647 + offsetx
  648 +
  649 + maxsize
  650 +
  651 + minsize
  652 +
  653 + size
  654 +
  655 + color
  656 +
  657 + symbolname
  658 +
  659 + Retorno:
  660 +
  661 + {JSON}
  662 + */
  663 + case "ALTERARESTILO":
  664 + alterarEstilo();
  665 + retornaJSON(pegaEstilo());
  666 + exit;
  667 + break;
  668 + /*
  669 + Valor: PEGACONEXAO
  670 +
  671 + Obt&eacute;m os valores dos elementos de conex&atilde;o com uma base de dados de um layer
  672 +
  673 + Parametros:
  674 +
  675 + codigoMap {string} - nome do mapfile (sem .map)
  676 +
  677 + codigoLayer {string} - 'name' do layer existente no mapfile
  678 +
  679 + Retorno:
  680 +
  681 + {JSON}
  682 + */
  683 + case "PEGACONEXAO":
  684 + retornaJSON(pegaConexao());
  685 + exit;
  686 + break;
  687 + /*
  688 + Valor: ALTERARCONEXAO
  689 +
  690 + Altera os valores dos elementos de conex&atilde;o com uma base de dados de um layer
  691 +
  692 + Parametros:
  693 +
  694 + codigoMap {string} - nome do mapfile (sem .map)
  695 +
  696 + codigoLayer {string} - 'name' do layer existente no mapfile
  697 +
  698 + connection
  699 +
  700 + connectiontype
  701 +
  702 + data
  703 +
  704 + tileitem
  705 +
  706 + tileindex
  707 +
  708 + type
  709 +
  710 + Retorno:
  711 +
  712 + {JSON}
  713 + */
  714 + case "ALTERARCONEXAO":
  715 + $retorno = alterarConexao();
  716 + if($testar == "false")
  717 + retornaJSON(pegaConexao());
  718 + else
  719 + retornaJSON(array("url"=>$retorno));
  720 + exit;
  721 + break;
  722 + /*
  723 + Valor: PEGAMETADADOS
  724 +
  725 + Obt&eacute;m os valores dos elementos de metadados de um layer
  726 +
  727 + Parametros:
  728 +
  729 + codigoMap {string} - nome do mapfile (sem .map)
  730 +
  731 + codigoLayer {string} - 'name' do layer existente no mapfile
  732 +
  733 + Retorno:
  734 +
  735 + {JSON}
  736 + */
  737 + case "PEGAMETADADOS":
  738 + retornaJSON(pegaMetadados());
  739 + exit;
  740 + break;
  741 + /*
  742 + Valor: PEGATITULO
  743 +
  744 + Obt&eacute;m os valores de titulo, descricao, etc
  745 +
  746 + Parametros:
  747 +
  748 + codigoMap {string} - nome do mapfile (sem .map)
  749 +
  750 + codigoLayer {string} - 'name' do layer existente no mapfile
  751 +
  752 + Retorno:
  753 +
  754 + {JSON}
  755 + */
  756 + case "PEGATITULO":
  757 + retornaJSON(pegaTitulo());
  758 + exit;
  759 + break;
  760 + case "ALTERARTITULO":
  761 + alterarTitulo();
  762 + retornaJSON(pegaTitulo());
  763 + exit;
  764 + break;
  765 + case "ALTERARNOMETEMA":
  766 + alterarNomeTema();
  767 + $codigoLayer = $codigoMap;
  768 + retornaJSON(pegaTitulo());
  769 + exit;
  770 + break;
  771 + case "PEGADISPO":
  772 + retornaJSON(pegaDispo());
  773 + exit;
  774 + break;
  775 + case "ALTERARDISPO":
  776 + alterarDispo();
  777 + alteraTemas();
  778 + retornaJSON(pegaDispo());
  779 + exit;
  780 + break;
  781 + case "PEGACOMPORT":
  782 + retornaJSON(pegaComport());
  783 + exit;
  784 + break;
  785 + case "ALTERARCOMPORT":
  786 + alterarComport();
  787 + retornaJSON(pegaComport());
  788 + exit;
  789 + break;
  790 + case "PEGAEDITAVEL":
  791 + retornaJSON(pegaEditavel());
  792 + exit;
  793 + break;
  794 + case "ALTERAREDITAVEL":
  795 + alterarEditavel();
  796 + retornaJSON(pegaEditavel());
  797 + exit;
  798 + break;
  799 +
  800 + /*
  801 + Valor: ALTERARMETADADOS
  802 +
  803 + Altera os valores dos elementos de metadados de um layer
  804 +
  805 + Parametros:
  806 +
  807 + codigoMap {string} - nome do mapfile (sem .map)
  808 +
  809 + codigoLayer {string} - 'name' do layer existente no mapfile
  810 +
  811 + iconetema
  812 +
  813 + ltempoformatodata
  814 +
  815 + ltempoiteminicio
  816 +
  817 + ltempoitemfim
  818 +
  819 + ltempoitemtitulo
  820 +
  821 + ltempoitemdescricao
  822 +
  823 + ltempoitemtip
  824 +
  825 + ltempoitemimagem
  826 +
  827 + ltempoitemicone
  828 +
  829 + ltempoitemlink
  830 +
  831 + description_template
  832 +
  833 + palletestep
  834 +
  835 + palletefile
  836 +
  837 + arquivodownload
  838 +
  839 + aplicaextensao
  840 +
  841 + classestamanho
  842 +
  843 + classessimbolo
  844 +
  845 + classescor
  846 +
  847 + classesnome
  848 +
  849 + classesitem
  850 +
  851 + mensagem
  852 +
  853 + identifica
  854 +
  855 + transitioneffect
  856 +
  857 + extensao
  858 +
  859 + escondido
  860 +
  861 + download
  862 +
  863 + escala
  864 +
  865 + tema
  866 +
  867 + classe
  868 +
  869 + tip
  870 +
  871 + itenslink
  872 +
  873 + itens
  874 +
  875 + itensdesc
  876 +
  877 + editorsql
  878 +
  879 + cache
  880 +
  881 + permitecomentario
  882 +
  883 + itembuscarapida
  884 +
  885 + Retorno:
  886 +
  887 + {JSON}
  888 + */
  889 + case "ALTERARMETADADOS":
  890 + alterarMetadados();
  891 + retornaJSON(pegaMetadados());
  892 + exit;
  893 + break;
  894 + /*
  895 + Valor: PEGAGERAL
  896 +
  897 + Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o geral de um layer
  898 +
  899 + Parametros:
  900 +
  901 + codigoMap {string} - nome do mapfile (sem .map)
  902 +
  903 + codigoLayer {string} - 'name' do layer existente no mapfile
  904 +
  905 + Retorno:
  906 +
  907 + {JSON}
  908 + */
  909 + case "PEGAGERAL":
  910 + retornaJSON(pegaGeral());
  911 + exit;
  912 + break;
  913 + /*
  914 + Valor: ALTERARGERAL
  915 +
  916 + Modifica os valores dos elementos de configura&ccedil;&atilde;o geral de um layer
  917 +
  918 + Parametros:
  919 +
  920 + codigoMap {string} - nome do mapfile (sem .map)
  921 +
  922 + codigoLayer {string} - 'name' do layer existente no mapfile
  923 +
  924 + testar
  925 +
  926 + name
  927 +
  928 + projection
  929 +
  930 + sizeunits
  931 +
  932 + status
  933 +
  934 + toleranceunits
  935 +
  936 + tolerance
  937 +
  938 + symbolscale
  939 +
  940 + opacity
  941 +
  942 + offsite
  943 +
  944 + minscale
  945 +
  946 + maxscale
  947 +
  948 + labelsizeitem
  949 +
  950 + labelminscale
  951 +
  952 + labelmaxscale
  953 +
  954 + labelitem
  955 +
  956 + group
  957 +
  958 + filteritem
  959 +
  960 + type
  961 +
  962 + filter
  963 +
  964 + Retorno:
  965 +
  966 + {JSON}
  967 + */
  968 + case "ALTERARGERAL":
  969 + $retorno = alterarGeral();
  970 + if($testar == "false")
  971 + {
  972 + $codigoLayer = $name;
  973 + retornaJSON(pegaGeral());
  974 + }
  975 + else
  976 + retornaJSON(array("url"=>$retorno));
  977 + exit;
  978 + break;
  979 + /*
  980 + Valor: PEGACLASSEGERAL
  981 +
  982 + Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o geral de uma classe
  983 +
  984 + Parametros:
  985 +
  986 + codigoMap {string} - nome do mapfile (sem .map)
  987 +
  988 + codigoLayer {string} - 'name' do layer existente no mapfile
  989 +
  990 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  991 +
  992 + Retorno:
  993 +
  994 + {JSON}
  995 + */
  996 + case "PEGACLASSEGERAL":
  997 + retornaJSON(pegaClasseGeral());
  998 + exit;
  999 + break;
  1000 + /*
  1001 + Valor: ALTERARCLASSEGERAL
  1002 +
  1003 + Altera os valores dos elementos de configura&ccedil;&atilde;o geral de uma classe
  1004 +
  1005 + Parametros:
  1006 +
  1007 + codigoMap {string} - nome do mapfile (sem .map)
  1008 +
  1009 + codigoLayer {string} - 'name' do layer existente no mapfile
  1010 +
  1011 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  1012 +
  1013 + status
  1014 +
  1015 + minscale
  1016 +
  1017 + maxscale
  1018 +
  1019 + name
  1020 +
  1021 + expression
  1022 +
  1023 + keyimage
  1024 +
  1025 + title
  1026 +
  1027 + Retorno:
  1028 +
  1029 + {JSON}
  1030 + */
  1031 + case "ALTERARCLASSEGERAL":
  1032 + alterarClasseGeral();
  1033 + retornaJSON(pegaClasseGeral());
  1034 + exit;
  1035 + break;
  1036 + /*
  1037 + Valor: PEGACLASSELABEL
  1038 +
  1039 + Obt&eacute;m os valores dos elementos de configura&ccedil;&atilde;o da topon&iacute;mia de uma classe
  1040 +
  1041 + Parametros:
  1042 +
  1043 + codigoMap {string} - nome do mapfile (sem .map)
  1044 +
  1045 + codigoLayer {string} - 'name' do layer existente no mapfile
  1046 +
  1047 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  1048 +
  1049 + Retorno:
  1050 +
  1051 + {JSON}
  1052 + */
  1053 + case "PEGACLASSELABEL":
  1054 + retornaJSON(pegaClasseLabel());
  1055 + exit;
  1056 + break;
  1057 + /*
  1058 + Valor: ALTERARCLASSELABEL
  1059 +
  1060 + Altera os valores dos elementos de configura&ccedil;&atilde;o da topon&iacute;mia de uma classe
  1061 +
  1062 + Parametros:
  1063 +
  1064 + codigoMap {string} - nome do mapfile (sem .map)
  1065 +
  1066 + codigoLayer {string} - 'name' do layer existente no mapfile
  1067 +
  1068 + indiceClasse {numerico} - &iacute;ndice da classe (de 0 at&eacute; n&uacute;mero de classes-1)
  1069 +
  1070 + autoangle
  1071 +
  1072 + encoding
  1073 +
  1074 + force
  1075 +
  1076 + partials
  1077 +
  1078 + mindistance
  1079 +
  1080 + minfeaturesize
  1081 +
  1082 + wrap
  1083 +
  1084 + antialias
  1085 +
  1086 + buffer
  1087 +
  1088 + angle
  1089 +
  1090 + offsety
  1091 +
  1092 + offsetx
  1093 +
  1094 + position
  1095 +
  1096 + maxsize
  1097 +
  1098 + minsize
  1099 +
  1100 + size
  1101 +
  1102 + backgroundshadowsizey
  1103 +
  1104 + backgroundshadowsizex
  1105 +
  1106 + shadowsizey
  1107 +
  1108 + shadowsizex
  1109 +
  1110 + shadowcolor
  1111 +
  1112 + outlinecolor
  1113 +
  1114 + color
  1115 +
  1116 + backgroundshadowcolor
  1117 +
  1118 + backgroundcolor
  1119 +
  1120 + type
  1121 +
  1122 + font
  1123 +
  1124 + Retorno:
  1125 +
  1126 + {JSON}
  1127 + */
  1128 + case "ALTERARCLASSELABEL":
  1129 + alterarClasseLabel();
  1130 + retornaJSON(pegaClasseLabel());
  1131 + exit;
  1132 + break;
  1133 + case "MOVIMENTANO":
  1134 + $res = sobeDesce();
  1135 + retornaJSON($res);
  1136 + exit;
  1137 + break;
  1138 + case "ADICIONAGRUPOUSRTEMA":
  1139 + retornaJSON(adicionaGrupoUsrTema());
  1140 + exit;
  1141 + break;
  1142 + case "EXCLUIRGRUPOUSRTEMA":
  1143 + retornaJSON(excluirGrupoUsrTema());
  1144 + exit;
  1145 + break;
  1146 +}
  1147 +function clonarMapfile()
  1148 +{
  1149 + global $codigomap, $locaplic;
  1150 + //error_reporting(0);
  1151 + $arqtema = $locaplic."/temas/".$codigomap.".map";
  1152 + $novotema = $locaplic."/temas/".$_GET["novomap"].".map";
  1153 + copy($arqtema,$novotema);
  1154 + $mapa = ms_newMapObj($novotema);
  1155 + $layer = @$mapa->getlayerbyname($codigomap);
  1156 + $layer->set("name",$novomap);
  1157 + $mapa->save($novotema);
  1158 + removeCabecalho($novotema);
  1159 + return array("data"=>"ok");
  1160 +}
  1161 +function refazerLayer()
  1162 +{
  1163 + global $nomelayer, $codigomap, $locaplic, $dir_tmp, $cachedir;
  1164 +
  1165 + $maporigem = $_GET["maporigem"];
  1166 +
  1167 + //error_reporting(0);
  1168 + $cache = $_GET["cache"];
  1169 + if(empty($cache)){
  1170 + $cache = "";
  1171 + }
  1172 + $classe = $_GET["classe"];
  1173 + if(empty($classe)){
  1174 + $classe = "";
  1175 + }
  1176 + $identifica = $_GET["identifica"];
  1177 + if(empty($identifica)){
  1178 + $identifica = "sim";
  1179 + }
  1180 + $mapa = ms_newMapObj($maporigem);
  1181 + $arqtema = $locaplic."/temas/".$codigomap.".map";
  1182 + $mapatema = ms_newMapObj($arqtema);
  1183 + $layeroriginal = @$mapatema->getlayerbyname($codigomap);
  1184 + $layernovo = @$mapa->getlayerbyname($nomelayer);
  1185 + if($layeroriginal != "" && $layernovo != "")
  1186 + {
  1187 + //$plugin = $layeroriginal->getmetadata("PLUGINI3GEO");
  1188 + $layeroriginal->set("status",MS_DELETE);
  1189 + $nl = ms_newLayerObj($mapatema,$layernovo);
  1190 + $nl->set("name",$codigomap);
  1191 + //$nl->setmetadata("PLUGINI3GEO",$plugin);
  1192 + $nl->setmetadata("nomeoriginal","");
  1193 + $nl->setmetadata("arquivotemaoriginal","");
  1194 + $nl->setmetadata("olopacity","");
  1195 + $nl->setmetadata("olstatus","");
  1196 + $nl->setmetadata("gmopacity","");
  1197 + $nl->setmetadata("gmstatus","");
  1198 + $nl->setmetadata("FILTROORIGINAL","");
  1199 + $nl->setmetadata("DATAORIGINAL","");
  1200 + $nl->setmetadata("cache",$cache);
  1201 + $nl->setmetadata("classe",$classe);
  1202 + $nl->setmetadata("identifica",$identifica);
  1203 + $numclasses = $nl->numclasses;
  1204 + if ($numclasses > 0)
  1205 + {
  1206 + for ($i=0; $i < $numclasses; $i++)
  1207 + {
  1208 + $classe = $nl->getClass($i);
  1209 + $classe->set("title","");
  1210 + }
  1211 + }
  1212 + $mapatema->save($arqtema);
  1213 + removeCabecalho($arqtema);
  1214 + //apaga o cache
  1215 + include($locaplic."/admin1/php/funcoesAdmin.php");
  1216 + \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigomap, $cachedir, $dir_tmp);
  1217 +
  1218 +
  1219 + return array("data"=>"ok");
  1220 + }
  1221 + return "erro";
  1222 +}
  1223 +function sobeDesce()
  1224 +{
  1225 + global $movimento,$tipo,$codigoMap,$codigoLayer,$locaplic;
  1226 +
  1227 + $indiceClasse = $_GET["indiceClasse"];
  1228 + $indiceEstilo = $_GET["indiceEstilo"];
  1229 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1230 + $mapa = ms_newMapObj($mapfile);
  1231 + $layer = $mapa->getlayerbyname($codigoLayer);
  1232 + if($movimento == "sobe")
  1233 + {
  1234 + if($tipo == "layer")
  1235 + {
  1236 + $indice = $layer->index;
  1237 + $mapa->moveLayerUp($indice);
  1238 + }
  1239 + if($tipo == "classe")
  1240 + {
  1241 + $layer->moveclassup($indiceClasse);
  1242 + }
  1243 + if($tipo == "estilo")
  1244 + {
  1245 + $classe = $layer->getclass($indiceClasse);
  1246 + $classe->movestyleup($indiceEstilo);
  1247 + }
  1248 +
  1249 + }
  1250 + if($movimento == "desce")
  1251 + {
  1252 + if($tipo == "layer")
  1253 + {
  1254 + $indice = $layer->index;
  1255 + $mapa->moveLayerDown($indice);
  1256 + }
  1257 + if($tipo == "classe")
  1258 + {
  1259 + $layer->moveclassdown($indiceClasse);
  1260 + }
  1261 + if($tipo == "estilo")
  1262 + {
  1263 + $classe = $layer->getclass($indiceClasse);
  1264 + $classe->movestyledown($indiceEstilo);
  1265 + }
  1266 + }
  1267 + $mapa->save($mapfile);
  1268 + removeCabecalho($mapfile);
  1269 + return "ok";
  1270 +}
  1271 +//essa funcao e usada tambem por i3geo/ferramentas/upload/upload.php
  1272 +function criarNovoMap(){
  1273 + global $locaplic,$esquemaadmin;
  1274 +
  1275 + $arq = $locaplic."/temas/".$_GET["codigo"].".map";
  1276 + if(empty($_GET["acessopublico"])){
  1277 + $_GET["acessopublico"] = "SIM";
  1278 + }
  1279 + if(!file_exists($arq)){
  1280 + if(empty($_GET["tipoLayer"])){
  1281 + $_GET["tipoLayer"] = "line";
  1282 + }
  1283 + $dados[] = "MAP";
  1284 + $dados[] = "SYMBOLSET ../symbols/simbolosv6.sym";
  1285 + $dados[] = 'FONTSET "../symbols/fontes.txt"';
  1286 + $dados[] = "LAYER";
  1287 + $dados[] = ' NAME "'.$_GET["codigo"].'"';
  1288 + $dados[] = ' TEMPLATE "none.htm"';
  1289 + if(!empty($_GET["metaestat"]) && $_GET["metaestat"] == "SIM"){
  1290 + $dados[] = ' CONNECTIONTYPE POSTGIS';
  1291 + $tipoLayer = "polygon";
  1292 + }
  1293 + elseif(!empty($conexao)){
  1294 + $dados[] = ' CONNECTIONTYPE POSTGIS';
  1295 + $dados[] = ' CONNECTION "'.$_GET["conexao"].'"';
  1296 + }
  1297 + $dados[] = " TYPE ".$_GET["tipoLayer"];
  1298 + if(empty($_GET["data"])){
  1299 + $dados[] = ' DATA ""';
  1300 + $dados[] = ' CONNECTION ""';
  1301 + }
  1302 + else{
  1303 + $dados[] = ' DATA "'.$_GET["data"].'"';
  1304 + }
  1305 + $dados[] = ' STATUS DEFAULT';
  1306 + $dados[] = ' METADATA';
  1307 + $dados[] = ' TEMA "'.$_GET["nome"].'"';
  1308 + $dados[] = ' CLASSE "SIM"';
  1309 + $tipoa_tema = "";
  1310 + if(!empty($_GET["metaestat"]) && $_GET["metaestat"] == "SIM"){
  1311 + $dados[] = ' METAESTAT "SIM"';
  1312 + //para marcar no banco de dados de administracao
  1313 + $tipoa_tema = "META";
  1314 + //METAESTAT_CODIGO_TIPO_REGIAO
  1315 + //ID_MEDIDA_VARIAVEL
  1316 + }
  1317 + $acessopublico = $_GET["acessopublico"];
  1318 + $dados[] = ' permiteogc "'.$acessopublico.'"';
  1319 + $dados[] = ' permitedownload "'.$acessopublico.'"';
  1320 + $dados[] = ' permitekml "'.$acessopublico.'"';
  1321 + $dados[] = ' permitekmz "'.$acessopublico.'"';
  1322 +
  1323 + $dados[] = ' END';
  1324 + $dados[] = ' CLASS';
  1325 + $dados[] = ' NAME ""';
  1326 + $dados[] = ' STYLE';
  1327 + $dados[] = ' COLOR 0 0 0';
  1328 + $dados[] = ' SIZE 12';
  1329 + if($tipoLayer == "point"){
  1330 + $dados[] = " SYMBOL 'ponto'";
  1331 + }
  1332 + $dados[] = ' END';
  1333 + $dados[] = ' END';
  1334 + $dados[] = "END";
  1335 + $dados[] = "END";
  1336 + $fp = fopen($arq,"w");
  1337 + foreach ($dados as $dado)
  1338 + {
  1339 + fwrite($fp,$dado."\n");
  1340 + }
  1341 +
  1342 + include("conexao.php");
  1343 + if($convUTF){
  1344 + $_GET["nome"] = utf8_encode($_GET["nome"]);
  1345 + $_GET["desc"] = utf8_encode($_GET["desc"]);
  1346 + }
  1347 + $dataCol = array(
  1348 + "link_tema" => '',
  1349 + "kml_tema" => $acessopublico,
  1350 + "kmz_tema" => $acessopublico,
  1351 + "ogc_tema" => $acessopublico,
  1352 + "download_tema" => $acessopublico,
  1353 + "desc_tema" => '',
  1354 + "tipoa_tema" => $tipoa_tema,
  1355 + "tags_tema" => '',
  1356 + "nome_tema" => $_GET["nome"],
  1357 + "codigo_tema" => $_GET["codigo"],
  1358 + "it" => $_GET["it"],
  1359 + "es" => $_GET["es"],
  1360 + "en" => $_GET["en"]
  1361 + );
  1362 + i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
  1363 + $dbh = null;
  1364 + $dbhw = null;
  1365 + return "ok";
  1366 + }
  1367 + return "erro";
  1368 +}
  1369 +function criarNovoLayer()
  1370 +{
  1371 + global $locaplic,$codigoMap;
  1372 +
  1373 + include_once("$locaplic/classesphp/funcoes_gerais.php");
  1374 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1375 + $mapa = ms_newMapObj($mapfile);
  1376 + $nl = ms_newLayerObj($mapa);
  1377 + $nl->set("name",nomeRandomico());
  1378 + $nl->set("type",MS_LAYER_LINE);
  1379 + $mapa->save($mapfile);
  1380 + removeCabecalho($mapfile);
  1381 + return array("layers"=>(array($nl->name)));
  1382 +}
  1383 +function autoClassesLayer()
  1384 +{
  1385 + global $codigoMap,$codigoLayer,$locaplic,$dir_tmp,$postgis_mapa;
  1386 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1387 + include_once("$locaplic/classesphp/classe_alteraclasse.php");
  1388 + //error_reporting(0);
  1389 + $nometemp = $dir_tmp."/".nomerandomico().".map";
  1390 +
  1391 + $versao = versao();
  1392 + $versao = $versao["principal"];
  1393 + if($base == "" || !isset($base)){
  1394 + $base = "";
  1395 + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
  1396 + {
  1397 + $base = $locaplic."/aplicmap/geral1windowsv".$versao.".map";
  1398 + }
  1399 + else
  1400 + {
  1401 + if($base == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){
  1402 + $base = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map";
  1403 + }
  1404 + if($base == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
  1405 + $base = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map";
  1406 + }
  1407 + if($base == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
  1408 + $base = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map";
  1409 + }
  1410 + if($base == "")
  1411 + {
  1412 + $base = $locaplic."/aplicmap/geral1v".$versao.".map";
  1413 + }
  1414 + }
  1415 + }
  1416 + else{
  1417 + if(!file_exists($base))
  1418 + {
  1419 + $base = $locaplic."/aplicmap/".$base;
  1420 + }
  1421 + }
  1422 +
  1423 + $mapageral = ms_newMapObj($base);
  1424 +
  1425 + $numlayers = $mapageral->numlayers;
  1426 + for ($i=0;$i < $numlayers;$i++)
  1427 + {
  1428 + $layertemp = $mapageral->getlayer($i);
  1429 + $layertemp->set("status",MS_DELETE);
  1430 + }
  1431 +
  1432 + $mapatemp = ms_newMapObj($mapfile);
  1433 + $numlayers = $mapatemp->numlayers;
  1434 + for ($i=0;$i < $numlayers;$i++){
  1435 + $layertemp = $mapatemp->getlayer($i);
  1436 + //troca string de conexao com alias
  1437 + $lcon = $layertemp->connection;
  1438 + if ($layertemp->connectiontype == MS_POSTGIS){
  1439 + if (in_array($lcon,array_keys($postgis_mapa))){
  1440 + $layertemp->set("connection",$postgis_mapa[$lcon]);
  1441 + }
  1442 + }
  1443 + ms_newLayerObj($mapageral, $layertemp);
  1444 + }
  1445 + $mapageral->save($nometemp);
  1446 + $m = new Alteraclasse($nometemp,$codigoLayer);
  1447 + $m->valorunico($_GET["itemExpressao"],"",$_GET["itemNome"]);
  1448 + $m->salva();
  1449 + $mapatemp = ms_newMapObj($nometemp);
  1450 +
  1451 + $numlayers = $mapatemp->numlayers;
  1452 + for ($i=0;$i < $numlayers;$i++){
  1453 + $layertemp = $mapatemp->getlayer($i);
  1454 + //troca string de conexao com alias
  1455 + if ($layertemp->connectiontype == MS_POSTGIS){
  1456 + $layertemp->set("connection",$lcon);
  1457 + }
  1458 + }
  1459 +
  1460 + $mapatemp->save($mapfile);
  1461 + removeCabecalho($mapfile);
  1462 +}
  1463 +function criarNovaClasse()
  1464 +{
  1465 + global $codigoMap,$codigoLayer,$locaplic;
  1466 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1467 + $mapa = ms_newMapObj($mapfile);
  1468 + $nl = $mapa->getlayerbyname($codigoLayer);
  1469 + $dados = array();
  1470 + if(strtoupper($nl->getmetadata("metaestat")) === "SIM"){
  1471 + return "erro";
  1472 + }
  1473 + $nclasses = $nl->numclasses;
  1474 + $classe = ms_newClassObj($nl);
  1475 + $mapa->save($mapfile);
  1476 + removeCabecalho($mapfile);
  1477 + $dados[] = array("indice"=>($nclasses),"nome"=>(""));
  1478 + return $dados;
  1479 +}
  1480 +function criarNovoEstilo()
  1481 +{
  1482 + global $codigoMap,$codigoLayer,$locaplic;
  1483 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1484 + $mapa = ms_newMapObj($mapfile);
  1485 + $nl = $mapa->getlayerbyname($codigoLayer);
  1486 + $classObj = $nl->getclass($_GET["indiceClasse"]);
  1487 + $numestilos = $classObj->numstyles;
  1488 + $nestilo = ms_newStyleObj($classObj);
  1489 + $mapa->save($mapfile);
  1490 + removeCabecalho($mapfile);
  1491 + $dados[] = array("estilo"=>$numestilos);
  1492 + return $dados;
  1493 +}
  1494 +function pegaItensLayer()
  1495 +{
  1496 + global $codigoMap,$locaplic,$codigoLayer,$postgis_mapa;
  1497 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1498 + $mapa = ms_newMapObj($mapfile);
  1499 + $layer = $mapa->getlayerbyname($codigoLayer);
  1500 + $lcon = $layer->connection;
  1501 + if ($layer->connectiontype == MS_POSTGIS){
  1502 + if (in_array($lcon,array_keys($postgis_mapa))){
  1503 + $layer->set("connection",$postgis_mapa[$lcon]);
  1504 + }
  1505 + }
  1506 + $layer->open();
  1507 + $itens = $layer->getitems();
  1508 + $layer->close();
  1509 + $dados["itens"] = $itens;
  1510 + return $dados;
  1511 +}
  1512 +function adicionaGrupoUsrTema(){
  1513 + global $id_tema,$id_grupo,$locaplic,$esquemaadmin;
  1514 + include($locaplic."/admin/php/conexao.php");
  1515 + $sql = "select * from ".$esquemaadmin."i3geousr_grupotema where id_tema = $id_tema and id_grupo = $id_grupo";
  1516 + $q = $dbh->query($sql,PDO::FETCH_ASSOC);
  1517 + if($q){
  1518 + $teste = $q->fetchAll();
  1519 + if(count($teste) == 0){
  1520 + $dataCol = array(
  1521 + "id_tema" => $id_tema,
  1522 + "id_grupo" => $id_grupo
  1523 + );
  1524 + i3GeoAdminInsert($dbhw,"i3geousr_grupotema",$dataCol);
  1525 + }
  1526 + }
  1527 + return "ok";
  1528 +}
  1529 +function excluirGrupoUsrTema(){
  1530 + global $id_tema,$id_grupo,$locaplic,$esquemaadmin;
  1531 + include($locaplic."/admin/php/conexao.php");
  1532 + $sql = "DELETE from ".$esquemaadmin."i3geousr_grupotema where id_tema = ? and id_grupo = ? ";
  1533 + $prep = $dbhw->prepare($sql);
  1534 + $prep->execute(array($id_tema,$id_grupo));
  1535 + i3GeoAdminInsertLog($dbhw,$sql,array($id_tema,$id_grupo));
  1536 + return "ok";
  1537 +}
  1538 +function pegaLayers()
  1539 +{
  1540 + global $codigoMap,$locaplic,$esquemaadmin;
  1541 + $dados = array();
  1542 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1543 + //echo $mapfile;exit;
  1544 + $mapa = ms_newMapObj($mapfile);
  1545 + $layers = $mapa->getalllayernames();
  1546 + $dados["layers"] = $layers;
  1547 + //lista de grupo de usuarios
  1548 + $gruposusr = array();
  1549 + include($locaplic."/admin/php/conexao.php");
  1550 + $sql = "
  1551 + select ".$esquemaadmin."i3geoadmin_temas.codigo_tema, ".$esquemaadmin."i3geousr_grupos.id_grupo,
  1552 + ".$esquemaadmin."i3geousr_grupos.nome, ".$esquemaadmin."i3geousr_grupos.descricao,
  1553 + ".$esquemaadmin."i3geousr_grupotema.id_tema
  1554 + from
  1555 + ".$esquemaadmin."i3geoadmin_temas
  1556 + join ".$esquemaadmin."i3geousr_grupotema
  1557 + on ".$esquemaadmin."i3geousr_grupotema.id_grupo = ".$esquemaadmin."i3geousr_grupos.id_grupo
  1558 + join ".$esquemaadmin."i3geousr_grupos
  1559 + on ".$esquemaadmin."i3geoadmin_temas.id_tema = ".$esquemaadmin."i3geousr_grupotema.id_tema
  1560 + where codigo_tema = '".$codigoMap."'
  1561 + ";
  1562 + $q = $dbh->query($sql,PDO::FETCH_ASSOC);
  1563 + if($q){
  1564 + $gruposusr = $q->fetchAll();
  1565 + }
  1566 + $dados["gruposusr"] = $gruposusr;
  1567 + return $dados;
  1568 +}
  1569 +function listaClasses()
  1570 +{
  1571 + global $codigoMap,$codigoLayer,$locaplic;
  1572 + $dados = array();
  1573 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1574 + $mapa = ms_newMapObj($mapfile);
  1575 + $layer = $mapa->getlayerbyname($codigoLayer);
  1576 + if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
  1577 + return $dados;
  1578 + }
  1579 + $nclasses = $layer->numclasses;
  1580 + for($i=0;$i<$nclasses;++$i)
  1581 + {
  1582 + $classe = $layer->getclass($i);
  1583 + $texto = $classe->name;
  1584 + $dados[] = array("indice"=>$i,"nome"=>base64_encode($texto));
  1585 + }
  1586 + return $dados;
  1587 +}
  1588 +function listaEstilos()
  1589 +{
  1590 + global $codigoMap,$codigoLayer,$locaplic;
  1591 + $dados = array();
  1592 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1593 + $mapa = ms_newMapObj($mapfile);
  1594 + $layer = $mapa->getlayerbyname($codigoLayer);
  1595 + if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
  1596 + return $dados;
  1597 + }
  1598 + $classe = $layer->getclass($_GET["indiceClasse"]);
  1599 + $numestilos = $classe->numstyles;
  1600 + for($i=0;$i<$numestilos;++$i)
  1601 + {
  1602 + $dados[] = array("estilo"=>$i);
  1603 + }
  1604 + return $dados;
  1605 +}
  1606 +
  1607 +function excluirLayer()
  1608 +{
  1609 + global $codigoMap,$codigoLayer,$locaplic;
  1610 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1611 + $mapa = ms_newMapObj($mapfile);
  1612 + $nl = $mapa->getlayerbyname($codigoLayer);
  1613 + $nl->set("status",MS_DELETE);
  1614 + $mapa->save($mapfile);
  1615 + removeCabecalho($mapfile);
  1616 + return "ok";
  1617 +}
  1618 +function excluirClasse()
  1619 +{
  1620 + global $codigoMap,$codigoLayer,$locaplic;
  1621 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1622 + $mapa = ms_newMapObj($mapfile);
  1623 + $nl = $mapa->getlayerbyname($codigoLayer);
  1624 + $classObj = $nl->getclass($_GET["indiceClasse"]);
  1625 + $classObj->set("status",MS_DELETE);
  1626 + $mapa->save($mapfile);
  1627 + removeCabecalho($mapfile);
  1628 + return "ok";
  1629 +}
  1630 +function excluirEstilo()
  1631 +{
  1632 + global $codigoMap,$codigoLayer,$locaplic;
  1633 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1634 + $mapa = ms_newMapObj($mapfile);
  1635 + $nl = $mapa->getlayerbyname($codigoLayer);
  1636 + $classObj = $nl->getclass($_GET["indiceClasse"]);
  1637 + $classObj->deletestyle($_GET["indiceEstilo"]);
  1638 + $mapa->save($mapfile);
  1639 + removeCabecalho($mapfile);
  1640 + return "ok";
  1641 +}
  1642 +function pegaComport()
  1643 +{
  1644 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  1645 + $dados = array();
  1646 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1647 + $mapa = ms_newMapObj($mapfile);
  1648 + $layer = $mapa->getlayerbyname($codigoLayer);
  1649 + $v = versao();
  1650 + $dados["aplicaextensao"] = $layer->getmetadata("aplicaextensao");
  1651 + $dados["permitecomentario"] = $layer->getmetadata("permitecomentario");
  1652 + $dados["temporizador"] = $layer->getmetadata("temporizador");
  1653 + $dados["classe"] = $layer->getmetadata("classe");
  1654 + $dados["legendaimg"] = $layer->getmetadata("legendaimg");
  1655 + $dados["escondido"] = $layer->getmetadata("escondido");
  1656 + $dados["identifica"] = $layer->getmetadata("identifica");
  1657 + $dados["transitioneffect"] = $layer->getmetadata("transitioneffect");
  1658 + $dados["status"] = $layer->status;
  1659 + $dados["offsite"] = $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
  1660 + $v["principal"] == "4" ? $dados["opacity"] = $layer->transparency : $dados["opacity"] = $layer->opacity;
  1661 + $dados["maxscale"] = $layer->maxscaledenom;
  1662 + $dados["minscale"] = $layer->minscaledenom;
  1663 + $dados["labelitem"] = $layer->labelitem;
  1664 + $dados["labelmaxscale"] = $layer->labelmaxscaledenom;
  1665 + $dados["labelminscale"] = $layer->labelminscaledenom;
  1666 + $dados["symbolscale"] = $layer->symbolscaledenom;
  1667 + $dados["tolerance"] = $layer->tolerance;
  1668 + $dados["toleranceunits"] = $layer->toleranceunits;
  1669 + $dados["sizeunits"] = $layer->sizeunits;
  1670 +
  1671 + $dados["codigoMap"] = $codigoMap;
  1672 + $dados["codigoLayer"] = $codigoLayer;
  1673 + return $dados;
  1674 +}
  1675 +function alterarComport()
  1676 +{
  1677 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
  1678 + $v = versao();
  1679 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1680 + $mapa = ms_newMapObj($mapfile);
  1681 + $layer = $mapa->getlayerbyname($codigoLayer);
  1682 + $layer->setmetadata("aplicaextensao",$_GET["aplicaextensao"]);
  1683 + $layer->setmetadata("permitecomentario",$_GET["permitecomentario"]);
  1684 + $layer->setmetadata("temporizador",$_GET["temporizador"]);
  1685 + $layer->setmetadata("classe",$_GET["classe"]);
  1686 + $layer->setmetadata("legendaimg",$_GET["legendaimg"]);
  1687 + $layer->setmetadata("escondido",$_GET["escondido"]);
  1688 + $layer->setmetadata("identifica",$_GET["identifica"]);
  1689 + $layer->setmetadata("transitioneffect",$_GET["transitioneffect"]);
  1690 + $layer->set("status",$_GET["status"]);
  1691 + if($_GET["offsite"] == -1 || $_GET["offsite"] == "null")
  1692 + {
  1693 + $_GET["offsite"] = "-1,-1,-1";
  1694 + }
  1695 + $cor = $layer->offsite;
  1696 + $c = explode(",",$_GET["offsite"]);
  1697 + if(count($c) < 3)
  1698 + $c = explode(" ",$_GET["offsite"]);
  1699 + $cor->setrgb($c[0],$c[1],$c[2]);
  1700 + $layer->offsite->red.",".$layer->offsite->green.",".$layer->offsite->blue;
  1701 + $v["principal"] == "4" ? $layer->set("transparency",$_GET["opacity"]) : $layer->set("opacity",$_GET["opacity"]);
  1702 + $layer->set("maxscaledenom",$_GET["maxscale"]);
  1703 + $layer->set("minscaledenom",$_GET["minscale"]);
  1704 + $layer->set("labelitem",$_GET["labelitem"]);
  1705 + $layer->set("labelmaxscaledenom",$_GET["labelmaxscale"]);
  1706 + $layer->set("labelminscaledenom",$_GET["labelminscale"]);
  1707 + $layer->set("symbolscaledenom",$_GET["symbolscale"]);
  1708 + $layer->set("tolerance",$_GET["tolerance"]);
  1709 + $layer->set("toleranceunits",$_GET["toleranceunits"]);
  1710 + $layer->set("sizeunits",$_GET["sizeunits"]);
  1711 +
  1712 + $mapa->save($mapfile);
  1713 + removeCabecalho($mapfile);
  1714 + return "ok";
  1715 +}
  1716 +function pegaTitulo()
  1717 +{
  1718 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  1719 + $dados = array();
  1720 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1721 + $mapa = ms_newMapObj($mapfile);
  1722 + $layer = $mapa->getlayerbyname($codigoLayer);
  1723 + $dados["name"] = $layer->name;
  1724 + $dados["tema"] = mb_convert_encoding($layer->getmetadata("tema"),"UTF-8","ISO-8859-1");
  1725 + $dados["iconetema"] = $layer->getmetadata("iconetema");
  1726 + $dados["mensagem"] = mb_convert_encoding($layer->getmetadata("mensagem"),"UTF-8","ISO-8859-1");
  1727 + $dados["escala"] = $layer->getmetadata("escala");
  1728 + $dados["extensao"] = $layer->getmetadata("extensao");
  1729 + $dados["group"] = $layer->group;
  1730 + $dados["codigoMap"] = $codigoMap;
  1731 + $dados["codigoLayer"] = $codigoLayer;
  1732 + return $dados;
  1733 +}
  1734 +function alterarNomeTema(){
  1735 + global $locaplic,$codigoMap, $esquemaadmin;
  1736 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1737 + $mapa = ms_newMapObj($mapfile);
  1738 + $layer = $mapa->getlayerbyname($codigoMap);
  1739 + if($layer){
  1740 + $layer->setmetadata("tema",$_GET["novoNome"]);
  1741 + $mapa->save($mapfile);
  1742 + removeCabecalho($mapfile);
  1743 + include("conexao.php");
  1744 + if($convUTF){
  1745 + $_GET["novoNome"] = utf8_encode($_GET["novoNome"]);
  1746 + }
  1747 + $dataCol = array(
  1748 + "nome_tema" => $_GET["novoNome"]
  1749 + );
  1750 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol," WHERE codigo_tema='$codigoMap'");
  1751 + $dbhw = null;
  1752 + $dbh = null;
  1753 + }
  1754 + return "ok";
  1755 +}
  1756 +function alterarTitulo()
  1757 +{
  1758 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
  1759 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1760 + $mapa = ms_newMapObj($mapfile);
  1761 + $layer = $mapa->getlayerbyname($codigoLayer);
  1762 +
  1763 + $layer->set("name",$_GET["name"]);
  1764 + $layer->setmetadata("tema",$_GET["tema"]);
  1765 + $layer->setmetadata("iconetema",$_GET["iconetema"]);
  1766 + $layer->setmetadata("mensagem",$_GET["mensagem"]);
  1767 + $layer->setmetadata("escala",$_GET["escala"]);
  1768 + $layer->setmetadata("extensao",$_GET["extensao"]);
  1769 + $layer->set("group",$_GET["group"]);
  1770 +
  1771 + $mapa->save($mapfile);
  1772 + removeCabecalho($mapfile);
  1773 + $codigoLayer = $_GET["name"];
  1774 + return "ok";
  1775 +}
  1776 +function pegaDispo()
  1777 +{
  1778 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  1779 + $dados = array();
  1780 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1781 + $mapa = ms_newMapObj($mapfile);
  1782 + $layer = $mapa->getlayerbyname($codigoLayer);
  1783 + $dados["download"] = $layer->getmetadata("download");
  1784 + $dados["arquivodownload"] = $layer->getmetadata("arquivodownload");
  1785 + $dados["arquivokmz"] = $layer->getmetadata("arquivokmz");
  1786 + $dados["ogc_tema"] = $layer->getmetadata("permiteogc");
  1787 + $dados["download_tema"] = $layer->getmetadata("permitedownload");
  1788 + $dados["kml_tema"] = $layer->getmetadata("permitekml");
  1789 + $dados["kmz_tema"] = $layer->getmetadata("permitekmz");
  1790 + $dados["codigoMap"] = $codigoMap;
  1791 + $dados["codigoLayer"] = $codigoLayer;
  1792 + return $dados;
  1793 +}
  1794 +function pegaEditavel()
  1795 +{
  1796 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  1797 + $dados = array();
  1798 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1799 + $mapa = ms_newMapObj($mapfile);
  1800 + $layer = $mapa->getlayerbyname($codigoLayer);
  1801 + $dados["editavel"] = $layer->getmetadata("EDITAVEL"); //SIM ou NAO
  1802 + $dados["colunaidunico"] = $layer->getmetadata("COLUNAIDUNICO");
  1803 + $dados["tabelaeditavel"] = $layer->getmetadata("TABELAEDITAVEL");
  1804 + $dados["esquematabelaeditavel"] = $layer->getmetadata("ESQUEMATABELAEDITAVEL");
  1805 + $dados["colunageometria"] = $layer->getmetadata("COLUNAGEOMETRIA");
  1806 + $dados["codigoMap"] = $codigoMap;
  1807 + $dados["codigoLayer"] = $codigoLayer;
  1808 + return $dados;
  1809 +}
  1810 +function alterarEditavel()
  1811 +{
  1812 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
  1813 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1814 + $mapa = ms_newMapObj($mapfile);
  1815 + $layer = $mapa->getlayerbyname($codigoLayer);
  1816 + $layer->setmetadata("EDITAVEL",$_GET["editavel"]);
  1817 + $layer->setmetadata("COLUNAIDUNICO",$_GET["colunaidunico"]);
  1818 + $layer->setmetadata("TABELAEDITAVEL",$_GET["tabelaeditavel"]);
  1819 + $layer->setmetadata("ESQUEMATABELAEDITAVEL",$_GET["esquematabelaeditavel"]);
  1820 + $layer->setmetadata("COLUNAGEOMETRIA",$_GET["colunageometria"]);
  1821 + $layer->setmetadata("cache","");
  1822 + $mapa->save($mapfile);
  1823 + removeCabecalho($mapfile);
  1824 + return "ok";
  1825 +}
  1826 +function alterarDispo()
  1827 +{
  1828 + global $dir_tmp,$codigoMap,$codigoLayer,$locaplic;
  1829 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1830 + $mapa = ms_newMapObj($mapfile);
  1831 + $layer = $mapa->getlayerbyname($codigoLayer);
  1832 + $layer->setmetadata("download",$_GET["download"]);
  1833 + $layer->setmetadata("arquivodownload",$_GET["arquivodownload"]);
  1834 + $layer->setmetadata("arquivokmz",$_GET["arquivokmz"]);
  1835 + $layer->setmetadata("permiteogc",$_GET["ogc_tema"]);
  1836 + $layer->setmetadata("permitekml",$_GET["kml_tema"]);
  1837 + $layer->setmetadata("permitekmz",$_GET["kmz_tema"]);
  1838 + $layer->setmetadata("permitedownload",$_GET["download_tema"]);
  1839 + $mapa->save($mapfile);
  1840 + removeCabecalho($mapfile);
  1841 + return "ok";
  1842 +}
  1843 +//essa funcao existe tambem em menutemas.php
  1844 +function alteraTemas(){
  1845 + global $esquemaadmin,$codigoLayer,$locaplic;
  1846 + include("conexao.php");
  1847 + $dataCol = array(
  1848 + "download_tema" => $_GET["download_tema"],
  1849 + "ogc_tema" => $_GET["ogc_tema"],
  1850 + "kml_tema" => $_GET["kml_tema"],
  1851 + "kmz_tema" => $_GET["kmz_tema"]
  1852 + );
  1853 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoLayer'");
  1854 + $dbhw = null;
  1855 + $dbh = null;
  1856 +}
  1857 +
  1858 +function pegaConexao()
  1859 +{
  1860 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  1861 + $dados = array();
  1862 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1863 + $mapa = ms_newMapObj($mapfile);
  1864 + $layer = $mapa->getlayerbyname($codigoLayer);
  1865 + $dados["connection"] = $layer->connection;
  1866 + $dados["connectiontype"] = $layer->connectiontype;
  1867 + $dados["data"] = $layer->data;
  1868 + $dados["tileindex"] = $layer->tileindex;
  1869 + $dados["tileitem"] = $layer->tileitem;
  1870 + $dados["cache"] = $layer->getmetadata("cache");
  1871 + $dados["tiles"] = $layer->getmetadata("tiles");
  1872 + $dados["cortepixels"] = $layer->getmetadata("cortepixels");
  1873 + if($dados["cortepixels"] == ""){
  1874 + $dados["cortepixels"] = 0;
  1875 + }
  1876 + if($dados["tileindex"] == ""){
  1877 + $dados["tileitem"] = "";
  1878 + }
  1879 + if(is_array($postgis_mapa))
  1880 + $dados["postgis_mapa"] = array_keys($postgis_mapa);
  1881 + else
  1882 + $dados["postgis_mapa"] = $postgis_mapa;
  1883 + $dados["codigoMap"] = $codigoMap;
  1884 + $dados["codigoLayer"] = $codigoLayer;
  1885 + $dados["type"] = $layer->type;
  1886 + $dados["filter"] = $layer->getfilterstring();
  1887 + if($dados["filter"]== ""){
  1888 + $dados["filter"] = "";
  1889 + }
  1890 + $dados["filteritem"] = $layer->filteritem;
  1891 + $dados["projection"] = $layer->getProjection();
  1892 + if($dados["projection"] == "null")
  1893 + {
  1894 + $dados["projection"] = "";
  1895 + }
  1896 + $dados["projection"] = str_replace("+i","i",$dados["projection"]);
  1897 + $dados["convcaracter"] = $layer->getmetadata("convcaracter");
  1898 + //informacoes sobre a integracao com o sistema de metadados estatisticos
  1899 + $dados["metaestat"] = $layer->getmetadata("metaestat");
  1900 + if($dados["metaestat"] == ""){
  1901 + $dados["metaestat"] = "NAO";
  1902 + }
  1903 + $dados["metaestat_id_medida_variavel"] = $layer->getmetadata("metaestat_id_medida_variavel");
  1904 +
  1905 + $dados["colunas"] = implode(",",pegaItens($layer));
  1906 +
  1907 + if($layer->connectiontype == 7 || $layer->connectiontype == 9){
  1908 + $dados["tipooriginal"] = $layer->getmetadata("tipooriginal");
  1909 + }
  1910 + return $dados;
  1911 +}
  1912 +function alterarConexao()
  1913 +{
  1914 + global $esquemaadmin,$dir_tmp,$codigoMap,$codigoLayer,$locaplic;
  1915 + if($_GET["data"] != ""){
  1916 + $_GET["data"] = base64_decode($_GET["data"]);
  1917 + }
  1918 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  1919 + $mapa = ms_newMapObj($mapfile);
  1920 + $layer = $mapa->getlayerbyname($codigoLayer);
  1921 + //quando o layer estiver conectado com o METAESTAT, alguns parametros sao default
  1922 + include("conexao.php");
  1923 + //e necessario atualizar o banco de dados de administracao, por isso e feito a verificacao do registro ou nao do mapfile no banco
  1924 + $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigoMap'";
  1925 + $dados = pegaDados($sql);
  1926 + if(count($dados) == 0){
  1927 + $dataCol = array(
  1928 + "tipoa_tema" => "META",
  1929 + "nome_tema" => $codigoMap,
  1930 + "codigo_tema" => $codigoMap,
  1931 + "kml_tema" => "SIM",
  1932 + "kmz_tema" => "NAO",
  1933 + "ogc_tema" => "SIM",
  1934 + "download_tema" => "SIM",
  1935 + "tags_tema" => "",
  1936 + "link_tema" => "",
  1937 + "desc_tema" => ""
  1938 + );
  1939 + i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
  1940 + }
  1941 + if(strtoupper($metaestat) == "SIM"){
  1942 + $_GET["connectiontype"] = 6;
  1943 + $_GET["filteritem"] = "";
  1944 + $_GET["filter"] = "";
  1945 + $_GET["data"] = "";
  1946 + $_GET["connection"] = "";
  1947 + $dataCol = array(
  1948 + "tipoa_tema" => "META"
  1949 + );
  1950 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");
  1951 + $layer->setmetadata("metaestat","SIM");
  1952 + $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL",$_GET["metaestat_id_medida_variavel"]);
  1953 + }
  1954 + else{
  1955 + $layer->setmetadata("METAESTAT_CODIGO_TIPO_REGIAO","");
  1956 + $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL","");
  1957 + $layer->setmetadata("metaestat","");
  1958 + $dataCol = array(
  1959 + "tipoa_tema" => ""
  1960 + );
  1961 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE codigo_tema = '$codigoMap'");
  1962 + }
  1963 + $layer->set("connection",$_GET["connection"]);
  1964 + if(ms_GetVersionInt() > 50201){
  1965 + $layer->setconnectiontype($_GET["connectiontype"]);
  1966 + }
  1967 + else{
  1968 + $layer->set("connectiontype",$_GET["connectiontype"]);
  1969 + }
  1970 + $layer->set("data",$_GET["data"]);
  1971 + $layer->set("tileitem",$_GET["tileitem"]);
  1972 + $layer->set("tileindex",$_GET["tileindex"]);
  1973 + $layer->set("type",$_GET["type"]);
  1974 + if($_GET["type"] == 0){
  1975 + $c = $layer->getClass(0);
  1976 + $e = $c->getStyle(0);
  1977 + if($e->symbolname == ""){
  1978 + $e->set("symbolname","ponto");
  1979 + }
  1980 + }
  1981 + if($_GET["type"] == 1){
  1982 + $c = $layer->getClass(0);
  1983 + $e = $c->getStyle(0);
  1984 + if($e->symbolname == "" || $e->symbolname == "ponto"){
  1985 + $e->set("symbolname","linha");
  1986 + }
  1987 + }
  1988 + if($_GET["type"] == 2){
  1989 + $c = $layer->getClass(0);
  1990 + $e = $c->getStyle(0);
  1991 + if($e->symbolname == "linha" || $e->symbolname == "ponto"){
  1992 + $e->set("symbolname"," ");
  1993 + }
  1994 + }
  1995 + $layer->setfilter($_GET["filter"]);
  1996 + $layer->set("filteritem",$_GET["filteritem"]);
  1997 + if($layer->getprojection() == MS_TRUE)
  1998 + $layer->setprojection($_GET["projection"]);
  1999 + if($layer->getprojection() == MS_FALSE && $_GET["projection"] != "")
  2000 + $layer->setprojection($_GET["projection"]);
  2001 + if($layer->connectiontype == 7 || $layer->connectiontype== 9){
  2002 + $layer->setmetadata("tipooriginal",$_GET["tipooriginal"]);
  2003 + }
  2004 + $layer->setmetadata("cache",$_GET["cache"]);
  2005 + $layer->setmetadata("tiles",$_GET["tiles"]);
  2006 + if($_GET["cortepixels"] == ""){
  2007 + $_GET["cortepixels"] = 0;
  2008 + }
  2009 + $layer->setmetadata("cortepixels",$_GET["cortepixels"]);
  2010 +
  2011 + $layer->setmetadata("convcaracter",$_GET["convcaracter"]);
  2012 + if($_GET["testar"] == "true")
  2013 + {
  2014 + $nome = $dir_tmp."/".$codigoMap.".map";
  2015 + $mapa->save($nome);
  2016 + removeCabecalho($nome,true);
  2017 + return $nome;
  2018 + }
  2019 + else
  2020 + {
  2021 + $mapa->save($mapfile);
  2022 + removeCabecalho($mapfile);
  2023 + return "ok";
  2024 + }
  2025 +}
  2026 +function pegaMetadados()
  2027 +{
  2028 + global $codigoMap,$codigoLayer,$locaplic,$postgis_mapa;
  2029 + //error_reporting(0);
  2030 + $dados = array();
  2031 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2032 + $mapa = ms_newMapObj($mapfile);
  2033 + $layer = $mapa->getlayerbyname($codigoLayer);
  2034 + $dados["type"] = $layer->type;
  2035 + $dados["connectiontype"] = $layer->connectiontype;
  2036 + $dados["itens"] = $layer->getmetadata("itens");
  2037 + $dados["itensdesc"] = mb_convert_encoding($layer->getmetadata("itensdesc"),"UTF-8","ISO-8859-1"); //$layer->getmetadata("itensdesc");
  2038 + $dados["itenslink"] = $layer->getmetadata("itenslink");
  2039 + $dados["tip"] = $layer->getmetadata("tip");
  2040 + $dados["classesitem"] = $layer->getmetadata("classesitem");
  2041 + $dados["classesnome"] = $layer->getmetadata("classesnome");
  2042 + $dados["classescor"] = $layer->getmetadata("classescor");
  2043 + $dados["classessimbolo"] = $layer->getmetadata("classessimbolo");
  2044 + $dados["classestamanho"] = $layer->getmetadata("classestamanho");
  2045 + $dados["palletefile"] = $layer->getmetadata("palletefile");
  2046 + $dados["palletestep"] = $layer->getmetadata("palletestep");
  2047 + $dados["description_template"] = $layer->getmetadata("description_template");
  2048 + $dados["editorsql"] = $layer->getmetadata("editorsql");
  2049 + $dados["codigoMap"] = $codigoMap;
  2050 + $dados["codigoLayer"] = $codigoLayer;
  2051 + $lcon = $layer->connection;
  2052 + if ($layer->connectiontype == MS_POSTGIS){
  2053 + if (in_array($lcon,array_keys($postgis_mapa)))
  2054 + {
  2055 + //echo $postgis_mapa[$lcon];exit;
  2056 + $layer->set("connection",$postgis_mapa[$lcon]);
  2057 + }
  2058 + }
  2059 + $dados["colunas"] = implode(" ,",pegaItens($layer));
  2060 + $layer->set("connection",$lcon);
  2061 +
  2062 + $dados["ltempoformatodata"] = $layer->getmetadata("ltempoformatodata");
  2063 + $dados["ltempoiteminicio"] = $layer->getmetadata("ltempoiteminicio");
  2064 + $dados["ltempoitemfim"] = $layer->getmetadata("ltempoitemfim");
  2065 + $dados["ltempoitemtitulo"] = $layer->getmetadata("ltempoitemtitulo");
  2066 + $dados["ltempoitemdescricao"] = $layer->getmetadata("ltempoitemdescricao");
  2067 + $dados["ltempoconvencode"] = $layer->getmetadata("ltempoconvencode");
  2068 + $dados["ltempoitemtip"] = $layer->getmetadata("ltempoitemtip");
  2069 + $dados["ltempoitemimagem"] = $layer->getmetadata("ltempoitemimagem");
  2070 + $dados["ltempoitemicone"] = $layer->getmetadata("ltempoitemicone");
  2071 + $dados["ltempoitemlink"] = $layer->getmetadata("ltempoitemlink");
  2072 +
  2073 + $dados["itembuscarapida"] = $layer->getmetadata("itembuscarapida");
  2074 + if($layer->connectiontype == 7 || $layer->connectiontype == 9){
  2075 + $dados["wms_srs"] = $layer->getmetadata("wms_srs");
  2076 + $dados["wms_name"] = $layer->getmetadata("wms_name");
  2077 + $dados["wms_server_version"] = $layer->getmetadata("wms_server_version");
  2078 + $dados["wms_format"] = $layer->getmetadata("wms_format");
  2079 + $dados["wms_auth_username"] = $layer->getmetadata("wms_auth_username");
  2080 + $dados["wms_auth_password"] = $layer->getmetadata("wms_auth_password");
  2081 + $dados["wms_auth_type"] = $layer->getmetadata("wms_auth_type");
  2082 + $dados["wms_connectiontimeout"] = $layer->getmetadata("wms_connectiontimeout");
  2083 + $dados["wms_latlonboundingbox"] = $layer->getmetadata("wms_latlonboundingbox");
  2084 + $dados["wms_proxy_auth_type"] = $layer->getmetadata("wms_proxy_auth_type");
  2085 +
  2086 + $dados["wms_proxy_host"] = $layer->getmetadata("wms_proxy_host");
  2087 + $dados["wms_proxy_port"] = $layer->getmetadata("wms_proxy_port");
  2088 + $dados["wms_proxy_type"] = $layer->getmetadata("wms_proxy_type");
  2089 + $dados["wms_proxy_username"] = $layer->getmetadata("wms_proxy_username");
  2090 + $dados["wms_proxy_password"] = $layer->getmetadata("wms_proxy_password");
  2091 + $dados["wms_sld_body"] = $layer->getmetadata("wms_sld_body");
  2092 + $dados["wms_sld_url"] = $layer->getmetadata("wms_sld_url");
  2093 + $dados["wms_style"] = $layer->getmetadata("wms_style");
  2094 + $dados["wms_bgcolor"] = $layer->getmetadata("wms_bgcolor");
  2095 + $dados["wms_transparent"] = $layer->getmetadata("wms_transparent");
  2096 + $dados["wms_time"] = $layer->getmetadata("wms_time");
  2097 + $dados["wms_tile"] = $layer->getmetadata("wms_tile");
  2098 + }
  2099 + return $dados;
  2100 +}
  2101 +function alterarMetadados()
  2102 +{
  2103 + global $codigoMap,$codigoLayer,$locaplic;
  2104 + $dados = array();
  2105 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2106 + $mapa = ms_newMapObj($mapfile);
  2107 + $layer = $mapa->getlayerbyname($codigoLayer);
  2108 + if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
  2109 + return "erro. Layer METAESTAT";
  2110 + }
  2111 + $_GET["itens"] = str_replace(", ",",",$_GET["itens"]);
  2112 + $_GET["itens"] = str_replace(" ,",",",$_GET["itens"]);
  2113 + $layer->setmetadata("itens",$_GET["itens"]);
  2114 + $_GET["itensdesc"] = str_replace(", ",",",$_GET["itensdesc"]);
  2115 + $_GET["itensdesc"] = str_replace(" ,",",",$_GET["itensdesc"]);
  2116 + $layer->setmetadata("itensdesc",$_GET["itensdesc"]);
  2117 + $layer->setmetadata("itenslink",$_GET["itenslink"]);
  2118 + $_GET["tip"] = str_replace(", ",",",$_GET["tip"]);
  2119 + $_GET["tip"] = str_replace(" ,",",",$_GET["tip"]);
  2120 + $layer->setmetadata("tip",$_GET["tip"]);
  2121 + $layer->setmetadata("classesitem",$_GET["classesitem"]);
  2122 + $layer->setmetadata("classesnome",$_GET["classesnome"]);
  2123 + $layer->setmetadata("classescor",$_GET["classescor"]);
  2124 + $layer->setmetadata("classessimbolo",$_GET["classessimbolo"]);
  2125 + $layer->setmetadata("classestamanho",$_GET["classestamanho"]);
  2126 + $layer->setmetadata("palletefile",$_GET["palletefile"]);
  2127 + $layer->setmetadata("palletestep",$_GET["palletestep"]);
  2128 + $layer->setmetadata("description_template",$_GET["description_template"]);
  2129 + $layer->setmetadata("editorsql",$_GET["editorsql"]);
  2130 + $layer->setmetadata("ltempoformatodata",$_GET["ltempoformatodata"]);
  2131 + $layer->setmetadata("ltempoiteminicio",$_GET["ltempoiteminicio"]);
  2132 + $layer->setmetadata("ltempoitemfim",$_GET["ltempoitemfim"]);
  2133 + $layer->setmetadata("ltempoitemtitulo",$_GET["ltempoitemtitulo"]);
  2134 + $layer->setmetadata("ltempoconvencode",$_GET["ltempoconvencode"]);
  2135 + $layer->setmetadata("ltempoitemdescricao",$_GET["ltempoitemdescricao"]);
  2136 + $layer->setmetadata("ltempoitemtip",$_GET["ltempoitemtip"]);
  2137 + $layer->setmetadata("ltempoitemimagem",$_GET["ltempoitemimagem"]);
  2138 + $layer->setmetadata("ltempoitemicone",$_GET["ltempoitemicone"]);
  2139 + $layer->setmetadata("ltempoitemlink",$_GET["ltempoitemlink"]);
  2140 +
  2141 + $layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]);
  2142 + if($layer->connectiontype == 7 || $layer->connectiontype== 9){
  2143 + $layer->setmetadata("wms_srs",$_GET["wms_srs"]);
  2144 + $layer->setmetadata("wms_name",$_GET["wms_name"]);
  2145 + $layer->setmetadata("wms_server_version",$_GET["wms_server_version"]);
  2146 + $layer->setmetadata("wms_format",$_GET["wms_format"]);
  2147 + if($_GET["wms_auth_username"] != ""){
  2148 + $layer->setmetadata("wms_auth_username",$_GET["wms_auth_username"]);
  2149 + $layer->setmetadata("wms_auth_password",$_GET["wms_auth_password"]);
  2150 + $layer->setmetadata("wms_auth_type",$_GET["wms_auth_type"]);
  2151 + }
  2152 + $layer->setmetadata("wms_connectiontimeout",$_GET["wms_connectiontimeout"]);
  2153 + if($_GET["wms_latlonboundingbox"] != "")
  2154 + {
  2155 + $layer->setmetadata("wms_latlonboundingbox",$_GET["wms_latlonboundingbox"]);
  2156 + }
  2157 + if($_GET["wms_proxy_host"] != ""){
  2158 + $layer->setmetadata("wms_proxy_auth_type",$_GET["wms_proxy_auth_type"]);
  2159 + $layer->setmetadata("wms_proxy_host",$_GET["wms_proxy_host"]);
  2160 + $layer->setmetadata("wms_proxy_port",$_GET["wms_proxy_port"]);
  2161 + $layer->setmetadata("wms_proxy_type",$_GET["wms_proxy_type"]);
  2162 + $layer->setmetadata("wms_proxy_username",$_GET["wms_proxy_username"]);
  2163 + $layer->setmetadata("wms_proxy_password",$_GET["wms_proxy_password"]);
  2164 + }
  2165 + if($_GET["wms_sld_body"] != "")
  2166 + {
  2167 + $layer->setmetadata("wms_sld_body",$_GET["wms_sld_body"]);
  2168 + }
  2169 + if($_GET["wms_sld_url"] != "")
  2170 + {
  2171 + $layer->setmetadata("wms_sld_url",$_GET["wms_sld_url"]);
  2172 + }
  2173 + $layer->setmetadata("wms_style",$_GET["wms_style"]);
  2174 + if($_GET["wms_bgcolor"] != "")
  2175 + $layer->setmetadata("wms_bgcolor",$_GET["wms_bgcolor"]);
  2176 + if($_GET["wms_transparent"] != "")
  2177 + $layer->setmetadata("wms_transparent",$_GET["wms_transparent"]);
  2178 + if($_GET["wms_time"] != "")
  2179 + $layer->setmetadata("wms_time",$_GET["wms_time"]);
  2180 + if($_GET["wms_tile"] != "")
  2181 + $layer->setmetadata("wms_tile",$_GET["wms_tile"]);
  2182 + $layer->setmetadata("tipooriginal",$_GET["tipooriginal"]);
  2183 + }
  2184 + $mapa->save($mapfile);
  2185 + removeCabecalho($mapfile);
  2186 + return "ok";
  2187 +}
  2188 +function pegaClasseGeral()
  2189 +{
  2190 + global $codigoMap,$codigoLayer,$locaplic;
  2191 +
  2192 + //error_reporting(0);
  2193 + $dados = array();
  2194 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2195 + $mapa = ms_newMapObj($mapfile);
  2196 + $layer = $mapa->getlayerbyname($codigoLayer);
  2197 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2198 + $dados["name"] = base64_encode($classe->name);
  2199 + $dados["title"] = base64_encode($classe->title);
  2200 + $temp = $classe->getExpressionString();
  2201 + //$temp = str_replace("[","_C",$temp);
  2202 + //$temp = str_replace("]","C_",$temp);
  2203 + //$temp = str_replace("'","_A_",$temp);
  2204 + //substitui caracteres que d&atilde;o problemas
  2205 + $dados["expression"] = base64_encode($temp);
  2206 + $dados["keyimage"] = $classe->keyimage;
  2207 + $dados["maxscale"] = $classe->maxscaledenom;
  2208 + $dados["minscale"] = $classe->minscaledenom;
  2209 + $dados["status"] = $classe->status;
  2210 + //$dados["text"] = $classe->getTextString();
  2211 + $dados["codigoMap"] = $codigoMap;
  2212 + $dados["codigoLayer"] = $codigoLayer;
  2213 + $dados["indiceClasse"] = $_GET["indiceClasse"];
  2214 + $dados["colunas"] = implode(" ,",pegaItens($layer));
  2215 + return $dados;
  2216 +}
  2217 +function alterarClasseGeral()
  2218 +{
  2219 + global $codigoMap,$codigoLayer,$locaplic;
  2220 + $dados = array();
  2221 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2222 + $mapa = ms_newMapObj($mapfile);
  2223 + $layer = $mapa->getlayerbyname($codigoLayer);
  2224 + if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
  2225 + return "erro. Layer METAESTAT";
  2226 + }
  2227 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2228 + $classe->set("name",base64_decode($_GET["name"]));
  2229 + $classe->set("title",base64_decode($_GET["title"]));
  2230 + $classe->setexpression(base64_decode($_GET["expression"]));
  2231 + $classe->set("keyimage",$_GET["keyimage"]);
  2232 + $classe->set("maxscaledenom",$_GET["maxscale"]);
  2233 + $classe->set("minscaledenom",$_GET["minscale"]);
  2234 + $classe->set("status",$_GET["status"]);
  2235 + $mapa->save($mapfile);
  2236 + removeCabecalho($mapfile);
  2237 + return "ok";
  2238 +}
  2239 +function pegaClasseLabel()
  2240 +{
  2241 + global $codigoMap,$codigoLayer,$locaplic;
  2242 + $dados = array();
  2243 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2244 + $mapa = ms_newMapObj($mapfile);
  2245 + $layer = $mapa->getlayerbyname($codigoLayer);
  2246 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2247 +
  2248 + $v = versao();
  2249 + $vi = $v["inteiro"];
  2250 + if($vi >= 60200){
  2251 + $nlabels = $classe->numlabels;
  2252 + if($nlabels > 0){
  2253 + $label = $classe->getLabel(0);
  2254 + }
  2255 + else{
  2256 + $label = "";
  2257 + }
  2258 + }
  2259 + else{
  2260 + $label = $classe->label;
  2261 + }
  2262 + if ($label != "")
  2263 + {
  2264 + $dados["font"] = $label->font;
  2265 + $dados["type"] = $label->type;
  2266 + //$dados["backgroundcolor"] = $label->backgroundcolor->red.",".$label->backgroundcolor->green.",".$label->backgroundcolor->blue;
  2267 + //$dados["backgroundshadowcolor"] = $label->backgroundshadowcolor->red.",".$label->backgroundshadowcolor->green.",".$label->backgroundshadowcolor->blue;
  2268 + $dados["color"] = $label->color->red.",".$label->color->green.",".$label->color->blue;
  2269 + $dados["outlinecolor"] = $label->outlinecolor->red.",".$label->outlinecolor->green.",".$label->outlinecolor->blue;
  2270 + $dados["shadowcolor"] = $label->shadowcolor->red.",".$label->shadowcolor->green.",".$label->shadowcolor->blue;
  2271 + $dados["shadowsizex"] = $label->shadowsizex;
  2272 + $dados["shadowsizey"] = $label->shadowsizey;
  2273 + //$dados["backgroundshadowsizex"] = $label->backgroundshadowsizex;
  2274 + //$dados["backgroundshadowsizey"] = $label->backgroundshadowsizey;
  2275 + $dados["size"] = $label->size;
  2276 +
  2277 + $dados["minsize"] = $label->minsize;
  2278 + $dados["maxsize"] = $label->maxsize;
  2279 + $dados["position"] = $label->position;
  2280 + $dados["offsetx"] = $label->offsetx;
  2281 + $dados["offsety"] = $label->offsety;
  2282 + $dados["angle"] = $label->angle;
  2283 + //$dados["autoangle"] = $label->autoangle;
  2284 + $dados["buffer"] = $label->buffer;
  2285 + //$dados["antialias"] = $label->antialias;
  2286 + $dados["wrap"] = $label->wrap;
  2287 + $dados["minfeaturesize"] = $label->minfeaturesize;
  2288 + $dados["autominfeaturesize"] = $label->autominfeaturesize;
  2289 + $dados["mindistance"] = $label->mindistance;
  2290 + $dados["partials"] = $label->partials;
  2291 + $dados["force"] = $label->force;
  2292 + $dados["encoding"] = $label->encoding;
  2293 + }
  2294 + $dados["codigoMap"] = $codigoMap;
  2295 + $dados["codigoLayer"] = $codigoLayer;
  2296 + $dados["indiceClasse"] = $indiceClasse;
  2297 + $dados["colunas"] = implode(" ,",pegaItens($layer));
  2298 + $arq = $locaplic."/symbols/fontes.txt";
  2299 + $h = fopen ($arq,"r");
  2300 + while ($i = fscanf ($h, "%s\t%s\t"))
  2301 + {
  2302 + list ($f,$g) = $i;
  2303 + $nome[] = $f;
  2304 + }
  2305 + $dados["fontes"] = $nome;
  2306 + return $dados;
  2307 +}
  2308 +function alterarClasseLabel()
  2309 +{
  2310 + global $codigoMap,$codigoLayer,$locaplic;
  2311 + if(!isset($_GET["text"])){
  2312 + $_GET["text"] = "";
  2313 + }
  2314 + else{
  2315 + $_GET["text"] = "[".$_GET["text"]."]";
  2316 + }
  2317 + $dados = array();
  2318 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2319 + $mapa = ms_newMapObj($mapfile);
  2320 + $layer = $mapa->getlayerbyname($codigoLayer);
  2321 + if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
  2322 + return "erro. Layer METAESTAT";
  2323 + }
  2324 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2325 + $v = versao();
  2326 + $vi = $v["inteiro"];
  2327 + if($vi >= 60300){
  2328 + while($classe->numlabels > 0){
  2329 + $classe->removeLabel(0);
  2330 + }
  2331 + }
  2332 + if($text == ""){
  2333 + if($vi >= 60300){
  2334 + $indiceLabel = $classe->addLabel(new labelObj());
  2335 + $label = $classe->getLabel($indiceLabel);
  2336 + }
  2337 + else{
  2338 + $label = $classe->label;
  2339 + }
  2340 + }
  2341 + elseif ($vi >= 60300 && $classe->numlabels == 0){
  2342 + if($wrap != ""){
  2343 + $s = "CLASS LABEL WRAP '$wrap' TEXT '".$_GET["text"]."' END END";
  2344 + $classe->updateFromString($s);
  2345 + }
  2346 + else{
  2347 + $s = "CLASS LABEL TEXT '".$_GET["text"]."' END END";
  2348 + $classe->updateFromString($s);
  2349 + }
  2350 + }
  2351 +
  2352 + if($vi >= 60300){
  2353 + $label = $classe->getLabel(0);
  2354 + }
  2355 + else{
  2356 + $label = $classe->label;
  2357 + }
  2358 +
  2359 + if($wrap != ""){
  2360 + $label->set("maxlength",1);
  2361 + }
  2362 + if($_GET["fonte"] != "bitmap"){
  2363 + //para funcionar na versao 7 do mapserver
  2364 + $label->updateFromString("LABEL type truetype END");
  2365 + $label->set("font",$_GET["fonte"]);
  2366 + $label->set("size",$_GET["tamanho"]);
  2367 + }
  2368 + else{
  2369 + //para funcionar na versao 7 do mapserver
  2370 + $label->updateFromString("LABEL type bitmap END");
  2371 + $t = MS_TINY;
  2372 + if ($_GET["tamanho"] > 5 ){
  2373 + $t = MS_TINY;
  2374 + }
  2375 + if ($_GET["tamanho"] >= 7 ){
  2376 + $t = MS_SMALL;
  2377 + }
  2378 + if ($_GET["tamanho"] >= 10 ){
  2379 + $t = MS_MEDIUM;
  2380 + }
  2381 + if ($_GET["tamanho"] >= 12 ){
  2382 + $t = MS_LARGE;
  2383 + }
  2384 + if ($_GET["tamanho"] >= 14 ){
  2385 + $t = MS_GIANT;
  2386 + }
  2387 + $label->set("size",$t);
  2388 + }
  2389 + if ($label != ""){
  2390 + //$label->set("type",$type);
  2391 + corE($label,$_GET["backgroundcolor"],"backgroundcolor");
  2392 + corE($label,$_GET["backgroundshadowcolor"],"backgroundshadowcolor");
  2393 + corE($label,$_GET["color"],"color");
  2394 + corE($label,$_GET["outlinecolor"],"outlinecolor");
  2395 + if(!empty($_GET["sombra"]) && !empty($_GET["backgroundshadowsizex"])){
  2396 + corE($label,$_GET["sombra"],"backgroundshadowcolor",$_GET["backgroundshadowsizex"],$_GET["backgroundshadowsizey"]);
  2397 + }
  2398 + $label->set("shadowsizex",$_GET["shadowsizex"]);
  2399 + $label->set("shadowsizey",$_GET["shadowsizey"]);
  2400 + //$label->set("backgroundshadowsizex",$backgroundshadowsizex);
  2401 + //$label->set("backgroundshadowsizey",$backgroundshadowsizey);
  2402 +
  2403 + $label->set("minsize",$_GET["minsize"]);
  2404 + $label->set("maxsize",$_GET["maxsize"]);
  2405 + //$label->set("position",$position);
  2406 +
  2407 + $label->set("offsetx",$_GET["offsetx"]);
  2408 + $label->set("offsety",$_GET["offsety"]);
  2409 + $label->set("angle",$_GET["angle"]);
  2410 +
  2411 + //$label->set("autoangle",$autoangle);
  2412 + //$label->set("buffer",$buffer);
  2413 + //$label->set("antialias",$antialias);
  2414 + $label->set("wrap",$_GET["wrap"]);
  2415 + $label->set("minfeaturesize",$_GET["minfeaturesize"]);
  2416 + $label->set("mindistance",$_GET["mindistance"]);
  2417 + $label->set("partials",$_GET["partials"]);
  2418 + $label->set("force",$_GET["force"]);
  2419 + $label->set("encoding",$_GET["encoding"]);
  2420 +
  2421 + $p = array("MS_AUTO"=>MS_AUTO,"MS_UL"=>MS_UL,"MS_LR"=>MS_LR,"MS_UR"=>MS_UR,"MS_LL"=>MS_LL,"MS_CR"=>MS_CR,"MS_CL"=>MS_CL,"MS_UC"=>MS_UC,"MS_LC"=>MS_LC,"MS_CC"=>MS_CC);
  2422 + $label->set("position",$p[$_GET["position"]]);
  2423 + }
  2424 + $mapa->save($mapfile);
  2425 + removeCabecalho($mapfile);
  2426 + return "ok";
  2427 +}
  2428 +function pegaEstilo()
  2429 +{
  2430 + global $codigoMap,$codigoLayer,$locaplic;
  2431 + $dados = array();
  2432 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2433 + $mapa = ms_newMapObj($mapfile);
  2434 + $layer = $mapa->getlayerbyname($codigoLayer);
  2435 + $nclasses = $layer->numclasses;
  2436 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2437 + $estilo = $classe->getstyle($_GET["indiceEstilo"]);
  2438 + $dados["symbolname"] = $estilo->symbolname;
  2439 +
  2440 + $dados["color"] = $estilo->color->red.",".$estilo->color->green.",".$estilo->color->blue;
  2441 + $dados["size"] = $estilo->size;
  2442 + $dados["minsize"] = $estilo->minsize;
  2443 + $dados["maxsize"] = $estilo->maxsize;
  2444 + $dados["offsetx"] = $estilo->offsetx;
  2445 + $dados["offsety"] = $estilo->offsety;
  2446 +
  2447 + //$dados["antialias"] = $estilo->antialias;
  2448 +
  2449 + $dados["backgroundcolor"] = $estilo->backgroundcolor->red.",".$estilo->backgroundcolor->green.",".$estilo->backgroundcolor->blue;
  2450 + $dados["outlinecolor"] = $estilo->outlinecolor->red.",".$estilo->outlinecolor->green.",".$estilo->outlinecolor->blue;
  2451 + $dados["width"] = $estilo->width;
  2452 +
  2453 + $dados["minwidth"] = $estilo->minwidth;
  2454 + $dados["maxwidth"] = $estilo->maxwidth;
  2455 + $dados["angle"] = $estilo->angle;
  2456 + $dados["codigoMap"] = $codigoMap;
  2457 +
  2458 + $dados["codigoLayer"] = $codigoLayer;
  2459 + $dados["indiceClasse"] = $indiceClasse;
  2460 + $dados["indiceEstilo"] = $indiceEstilo;
  2461 + $dados["type"] = $layer->type;
  2462 + return $dados;
  2463 +}
  2464 +function alterarEstilo()
  2465 +{
  2466 + global $codigoMap,$codigoLayer,$locaplic;
  2467 + $dados = array();
  2468 + $mapfile = $locaplic."/temas/".$codigoMap.".map";
  2469 + $mapa = ms_newMapObj($mapfile);
  2470 + $layer = $mapa->getlayerbyname($codigoLayer);
  2471 + if(strtoupper($layer->getmetadata("metaestat")) === "SIM"){
  2472 + return "erro. Layer METAESTAT";
  2473 + }
  2474 + $nclasses = $layer->numclasses;
  2475 + $classe = $layer->getclass($_GET["indiceClasse"]);
  2476 + $estilo = $classe->getstyle($_GET["indiceEstilo"]);
  2477 + if(!empty($_GET["symbolname"])){
  2478 + $estilo->set("symbolname",$_GET["symbolname"]);
  2479 + }
  2480 + if(empty($_GET["symbolname"])){
  2481 + $estilo->set("symbolname"," ");
  2482 + }
  2483 + corE($estilo,$color,"color");
  2484 +
  2485 + $estilo->set("size",$_GET["size"]);
  2486 + $estilo->set("minsize",$_GET["minsize"]);
  2487 + $estilo->set("maxsize",$_GET["maxsize"]);
  2488 + $estilo->set("offsetx",$_GET["offsetx"]);
  2489 + $estilo->set("offsety",$_GET["offsety"]);
  2490 + $estilo->set("antialias",$_GET["antialias"]);
  2491 + corE($estilo,$_GET["backgroundcolor"],"backgroundcolor");
  2492 + corE($estilo,$_GET["outlinecolor"],"outlinecolor");
  2493 + $estilo->set("width",$_GET["width"]);
  2494 + $estilo->set("minwidth",$_GET["minwidth"]);
  2495 + $estilo->set("maxwidth",$_GET["maxwidth"]);
  2496 + $estilo->set("angle",$_GET["angle"]);
  2497 + //$estilo->set("opacity",$opacity);
  2498 + $mapa->save($mapfile);
  2499 + removeCabecalho($mapfile);
  2500 + return "ok";
  2501 +}
  2502 +
  2503 +function removeCabecalho($arq,$symbolset=true)
  2504 +{
  2505 + global $dir_tmp;
  2506 + //remove o cache OGC
  2507 + $nomeMapfileTmp = $dir_tmp."/ogc_".md5($arq).".map";
  2508 + $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp);
  2509 + $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp);
  2510 + if(file_exists($nomeMapfileTmp)){
  2511 + chmod($nomeMapfileTmp,0777);
  2512 + unlink($nomeMapfileTmp);
  2513 + }
  2514 + //echo $nomeMapfileTmp;exit;
  2515 + //remove o cache OGC
  2516 + $handle = fopen($arq, "r");
  2517 + if ($handle)
  2518 + {
  2519 + $cabeca = array();
  2520 + if($symbolset)
  2521 + {
  2522 + $cabeca[] = "MAP\n";
  2523 + //$final[] = "SYMBOLSET ../symbols/simbolos.sym\n";
  2524 + //$final[] = "FONTSET ".'"'."../symbols/fontes.txt".'"'."\n";
  2525 + }
  2526 + $grava = false;
  2527 + while (!feof($handle))
  2528 + {
  2529 + $linha = fgets($handle);
  2530 + if($symbolset)
  2531 + {
  2532 + if(strpos(strtoupper($linha),"SYMBOLSET") !== false)
  2533 + {
  2534 + $cabeca[] = $linha;
  2535 + }
  2536 + if(strpos(strtoupper($linha),"FONTSET") !== false)
  2537 + {
  2538 + $cabeca[] = $linha;
  2539 + }
  2540 + }
  2541 + if(strtoupper(trim($linha)) == "LAYER")
  2542 + {
  2543 + $grava = true;
  2544 + }
  2545 + if($grava)
  2546 + {
  2547 + $final[] = rtrim($linha, "\r\n") . PHP_EOL;
  2548 + }
  2549 + }
  2550 + fclose($handle);
  2551 + }
  2552 + $final = array_merge($cabeca,$final);
  2553 + $handle = fopen($arq, "w+");
  2554 + $testar = array("LEGENDAWMS","LEGENDAIMG","KEYIMAGE","TILEINDEX","TILEITEM","SYMBOL","LABELITEM","FILTERITEM","GROUP","ENCODING","TIP","CLASSE","ITENSDESC","CLASSESNOME","ITENSLINK","ESCALA","CLASSESSIMBOLO","MENSAGEM","EXTENSAO","CLASSESITEM","ESCONDIDO","CLASSESCOR","DOWNLOAD","CLASSESTAMANHO","ITENS","TEMA","APLICAEXTENSAO","IDENTIFICA","TRANSITIONEFFECT");
  2555 + foreach ($final as $f)
  2556 + {
  2557 + //
  2558 + //remove resultados em branco
  2559 + //e grava a linha
  2560 + //
  2561 + $teste = strtoupper($f);
  2562 + $teste = trim($teste);
  2563 + $teste = str_replace(array(" ","'",'"'),"",$teste);
  2564 + //$teste = str_replace("'","",$teste);
  2565 + //$teste = str_replace('"',"",$teste);
  2566 + $teste = preg_replace('/[\n\r\t ]*/', '', $teste);
  2567 + $passou = true;
  2568 + foreach ($testar as $t)
  2569 + {
  2570 + if($teste == $t){
  2571 + $passou = false;
  2572 + }
  2573 + }
  2574 + if($passou == true){
  2575 + fwrite($handle,$f);
  2576 + }
  2577 + }
  2578 + fclose($handle);
  2579 + //chmod($arq, 0666);
  2580 +}
  2581 +function rrmdir($dir) {
  2582 + if (is_dir($dir)) {
  2583 + //chmod($dir,0777);
  2584 + $objects = scandir($dir);
  2585 + foreach ($objects as $object) {
  2586 + if ($object != "." && $object != "..") {
  2587 + //chmod($dir."/".$object,0777);
  2588 + if (filetype($dir."/".$object) == "dir"){
  2589 + rrmdir($dir."/".$object);
  2590 + } else {
  2591 + rename($dir."/".$object,$dir."/".$object."_removido");
  2592 + }
  2593 + }
  2594 + }
  2595 + reset($objects);
  2596 + rmdir($dir);
  2597 + }
  2598 +}
  2599 +?>
0 \ No newline at end of file 2600 \ No newline at end of file
admin1/catalogo/mapfile/editor/exec.php
1 <?php 1 <?php
  2 +/****************************************************************/
  3 +//include (dirname ( __FILE__ ) . "/../../../../ms_configura.php");
  4 +//
  5 +//checa login
  6 +//valida _GET e _POST, juntando em _GET
  7 +//pega algumas variaveis de uso mais comum
  8 +//session_start
  9 +//
  10 +include ("../../../php/checaLogin.php");
  11 +\admin\php\login\checaLogin();
  12 +//funcoes de administracao
  13 +include ($_SESSION["locaplic"]."/admin1/php/funcoesAdmin.php");
  14 +//
  15 +//carrega outras funcoes e extensoes do PHP
  16 +//
  17 +include ($_SESSION["locaplic"]."/classesphp/carrega_ext.php");
  18 +//
  19 +//carrega as funcoes locais
  20 +//depende de funcoesAdmin.php
  21 +//
2 22
  23 +include ("funcoes.php");
  24 +
  25 +//
  26 +//conexao com o banco de administracao
  27 +//cria as variaveis $dbh e $dbhw alem de conexaoadmin
  28 +//
  29 +//include ($_SESSION["locaplic"]."/admin1/php/conexao.php");
  30 +/***************************************************************/
  31 +//if (\admin\php\funcoesAdmin\verificaOperacaoSessao ( "admin/html/editormapfile" ) === false) {
  32 + //header ( "HTTP/1.1 403 Vc nao pode realizar essa operacao" );
  33 + //exit ();
  34 +//}
  35 +
  36 +$codigo = $_GET ["codigomap"];
  37 +
  38 +$codigo = str_replace ( " ", "", \admin\php\funcoesAdmin\removeAcentos ( $codigo ) );
  39 +
  40 +$codigo = str_replace ( ".", "", $codigo );
  41 +$codigo = strip_tags ( $codigo );
  42 +$codigo = htmlspecialchars ( $codigo, ENT_QUOTES );
  43 +
  44 +$funcao = strtoupper ( $funcao );
  45 +switch ($funcao) {
  46 + case "REFAZERLAYER" :
  47 + $dados = \admin\catalogo\mapfile\editor\refazerLayer (
  48 + $_GET["nomelayer"],
  49 + $codigo,
  50 + $_SESSION["locaplic"],
  51 + $_SESSION["dir_tmp"],
  52 + $_SESSION["cachedir"],
  53 + $_GET["maporigem"],
  54 + $_GET["classe"],
  55 + $_GET["cache"],
  56 + $_GET["identifica"]
  57 + );
  58 + if ($dados === false) {
  59 + header ( "HTTP/1.1 500 erro ao definir as propriedades" );
  60 + }
  61 + \admin\php\funcoesAdmin\retornaJSON ( array (
  62 + "dados" => $dados
  63 + ) );
  64 + break;
  65 +}
3 ?> 66 ?>
4 \ No newline at end of file 67 \ No newline at end of file
admin1/catalogo/mapfile/editor/funcoes.php
1 <?php 1 <?php
2 namespace admin\catalogo\mapfile\editor; 2 namespace admin\catalogo\mapfile\editor;
3 -function textoMapfile($codigo) {  
4 - global $dbhw;  
5 - $locaplic = $_SESSION["locaplic"];  
6 - $mapfile = $locaplic . "/temas/" . $codigo . ".map";  
7 - if (! file_exists ( $mapfile )) {  
8 - return "Arquivo $codigo n&atilde;o existe.";  
9 - }  
10 - // testa  
11 - try {  
12 - ms_newMapObj ( $mapfile );  
13 - } catch ( Exception $e ) {  
14 - $texto = file_get_contents ( $mapfile );  
15 - if (mb_detect_encoding ( $texto, 'UTF-8, ISO-8859-1' ) == "ISO-8859-1") {  
16 - return utf8_encode ( $texto );  
17 - } else {  
18 - return $texto;  
19 - }  
20 - }  
21 - if (@ms_newMapObj ( $mapfile )) {  
22 - // verifica os metadata que sao armazenados tambem no banco de dados de administracao  
23 - // isso e necessario para manter a consistencia caso o usuario altere manualmente os valores  
24 - // cria o objeto map  
25 - $mapa = ms_newMapObj ( $mapfile );  
26 - $layer = @$mapa->getlayerbyname ( $codigo );  
27 - $erro = "";  
28 - if ($layer == "") {  
29 - $erro = "Aten&ccedil;&atilde;o: n&atilde;o existe nenhum LAYER com NAME igual a " . $codigo;  
30 - } else {  
31 - // pega o metadata  
32 - $meta = $layer->getmetadata ( "permitedownload" );  
33 - $meta = strtoupper ( $meta );  
34 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
35 - // grava no banco  
36 - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET download_tema='$meta' WHERE codigo_tema = '$codigo'" );  
37 - }  
38 - $meta = $layer->getmetadata ( "permiteogc" );  
39 - $meta = strtoupper ( $meta );  
40 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
41 - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET ogc_tema='$meta' WHERE codigo_tema = '$codigo'" );  
42 - }  
43 - $meta = $layer->getmetadata ( "permitekml" );  
44 - $meta = strtoupper ( $meta );  
45 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
46 - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET kml_tema='$meta' WHERE codigo_tema = '$codigo'" );  
47 - }  
48 - $meta = $layer->getmetadata ( "permitekmz" );  
49 - $meta = strtoupper ( $meta );  
50 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
51 - $dbhw->query ( "UPDATE " . $esquemaadmin . "i3geoadmin_temas SET kmz_tema='$meta' WHERE codigo_tema = '$codigo'" );  
52 - }  
53 - }  
54 - }  
55 - $texto = file_get_contents ( $mapfile );  
56 - if (mb_detect_encoding ( $texto, 'UTF-8, ISO-8859-1' ) == "ISO-8859-1") {  
57 - $texto = utf8_encode ( $texto );  
58 - }  
59 - return array (  
60 - "texto" => $texto,  
61 - "erro"=> $erro  
62 - ); 3 +
  4 +function textoMapfile($codigo)
  5 +{
  6 + global $dbhw;
  7 + $locaplic = $_SESSION["locaplic"];
  8 + $mapfile = $locaplic . "/temas/" . $codigo . ".map";
  9 + if (! file_exists($mapfile)) {
  10 + return "Arquivo $codigo n&atilde;o existe.";
  11 + }
  12 + // testa
  13 + try {
  14 + ms_newMapObj($mapfile);
  15 + } catch (Exception $e) {
  16 + $texto = file_get_contents($mapfile);
  17 + if (mb_detect_encoding($texto, 'UTF-8, ISO-8859-1') == "ISO-8859-1") {
  18 + return utf8_encode($texto);
  19 + } else {
  20 + return $texto;
  21 + }
  22 + }
  23 + if (@ms_newMapObj($mapfile)) {
  24 + // verifica os metadata que sao armazenados tambem no banco de dados de administracao
  25 + // isso e necessario para manter a consistencia caso o usuario altere manualmente os valores
  26 + // cria o objeto map
  27 + $mapa = ms_newMapObj($mapfile);
  28 + $layer = @$mapa->getlayerbyname($codigo);
  29 + $erro = "";
  30 + if ($layer == "") {
  31 + $erro = "Aten&ccedil;&atilde;o: n&atilde;o existe nenhum LAYER com NAME igual a " . $codigo;
  32 + } else {
  33 + // pega o metadata
  34 + $meta = $layer->getmetadata("permitedownload");
  35 + $meta = strtoupper($meta);
  36 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  37 + // grava no banco
  38 + $dbhw->query("UPDATE " . $esquemaadmin . "i3geoadmin_temas SET download_tema='$meta' WHERE codigo_tema = '$codigo'");
  39 + }
  40 + $meta = $layer->getmetadata("permiteogc");
  41 + $meta = strtoupper($meta);
  42 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  43 + $dbhw->query("UPDATE " . $esquemaadmin . "i3geoadmin_temas SET ogc_tema='$meta' WHERE codigo_tema = '$codigo'");
  44 + }
  45 + $meta = $layer->getmetadata("permitekml");
  46 + $meta = strtoupper($meta);
  47 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  48 + $dbhw->query("UPDATE " . $esquemaadmin . "i3geoadmin_temas SET kml_tema='$meta' WHERE codigo_tema = '$codigo'");
  49 + }
  50 + $meta = $layer->getmetadata("permitekmz");
  51 + $meta = strtoupper($meta);
  52 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  53 + $dbhw->query("UPDATE " . $esquemaadmin . "i3geoadmin_temas SET kmz_tema='$meta' WHERE codigo_tema = '$codigo'");
  54 + }
  55 + }
  56 + }
  57 + $texto = file_get_contents($mapfile);
  58 + if (mb_detect_encoding($texto, 'UTF-8, ISO-8859-1') == "ISO-8859-1") {
  59 + $texto = utf8_encode($texto);
  60 + }
  61 + return array(
  62 + "texto" => $texto,
  63 + "erro" => $erro
  64 + );
63 } 65 }
64 -function salvaMapfile() {  
65 - global $dbhw, $codigo, $gravarTexto;  
66 - $esquemaadmin = $_SESSION["esquemaadmin"];  
67 - $locaplic = $_SESSION["locaplic"];  
68 - if (empty ( $gravarTexto )) {  
69 - return;  
70 - }  
71 - $mapfile = $locaplic . "/temas/" . $codigo . ".map";  
72 - $original = file_get_contents ( $mapfile );  
73 - $fp = fopen ( $mapfile, "w" );  
74 - if ($fp == false) {  
75 - echo "<span style=color:red <b>N&atilde;o foi poss&iacute;vel salvar o arquivo. Verifique as permiss&otilde;es ou se h&aacute; algum erro no mapfile</b></span><br><br>";  
76 - exit ();  
77 - } else {  
78 - // remove itens vazios  
79 - $novoTexto = array ();  
80 - $testar = array (  
81 - "TEMPORIZADOR",  
82 - "PALLETESTEP",  
83 - "LTEMPOITEMIMAGEM",  
84 - "METAESTAT_ID_MEDIDA_VARIAVEL",  
85 - "GMOPACITY",  
86 - "GMSTATUS",  
87 - "ICONETEMA",  
88 - "LTEMPOITEMTITULO",  
89 - "DESCRIPTION_TEMPLATE",  
90 - "LTEMPOITEMLINK",  
91 - "TILES",  
92 - "METAESTAT_CODIGO_TIPO_REGIAO",  
93 - "ARQUIVOTEMAORIGINAL",  
94 - "PALLETEFILE",  
95 - "NOMEORIGINAL",  
96 - "OLSTATUS",  
97 - "PERMITEDOWNLOAD",  
98 - "LTEMPOFORMATODATA",  
99 - "FILTROORIGINAL",  
100 - "PERMITECOMENTARIO",  
101 - "LTEMPOITEMICONE",  
102 - "DATAORIGINAL",  
103 - "PLUGINI3GEO",  
104 - "METAESTAT",  
105 - "ITEMBUSCARAPIDA",  
106 - "ARQUIVODOWNLOAD",  
107 - "ARQUIVOKMZ",  
108 - "PERMITEKML",  
109 - "PERMITEOGC",  
110 - "CONVCARACTER",  
111 - "CORTEPIXELS",  
112 - "EDITORSQL",  
113 - "LTEMPOCONVENCODE",  
114 - "LTEMPOITEMFIM",  
115 - "OLOPACITY",  
116 - "LEGENDAWMS",  
117 - "LEGENDAIMG",  
118 - "KEYIMAGE",  
119 - "TILEINDEX",  
120 - "TILEITEM",  
121 - "SYMBOL",  
122 - "LABELITEM",  
123 - "FILTERITEM",  
124 - "GROUP",  
125 - "ENCODING",  
126 - "TIP",  
127 - "CLASSE",  
128 - "ITENSDESC",  
129 - "CLASSESNOME",  
130 - "ITENSLINK",  
131 - "ESCALA",  
132 - "CLASSESSIMBOLO",  
133 - "MENSAGEM",  
134 - "EXTENSAO",  
135 - "CLASSESITEM",  
136 - "ESCONDIDO",  
137 - "CLASSESCOR",  
138 - "DOWNLOAD",  
139 - "CLASSESTAMANHO",  
140 - "ITENS",  
141 - "TEMA",  
142 - "APLICAEXTENSAO",  
143 - "IDENTIFICA",  
144 - "TRANSITIONEFFECT"  
145 - );  
146 - foreach ( preg_split ( '~[\r\n]+~', $gravarTexto ) as $line ) {  
147 - $teste = strtoupper ( $line );  
148 - $teste = trim ( $teste );  
149 - $teste = str_replace ( array (  
150 - " ",  
151 - "'",  
152 - '"'  
153 - ), "", $teste );  
154 - $teste = preg_replace ( '/[\n\r\t ]*/', '', $teste );  
155 - $passou = true;  
156 - foreach ( $testar as $t ) {  
157 - if ($teste == $t) {  
158 - $passou = false;  
159 - }  
160 - }  
161 - if ($passou == true) {  
162 - if (mb_detect_encoding ( $line, 'UTF-8' ) == "UTF-8") {  
163 - $line = mb_convert_encoding ( $line, "ISO-8859-1", "UTF-8" );  
164 - }  
165 - $novoTexto [] = $line;  
166 - }  
167 - }  
168 - fwrite ( $fp, implode ( "\r\n", $novoTexto ) );  
169 - }  
170 - fclose ( $fp );  
171 - // testa o mapfile  
172 - ms_ResetErrorList ();  
173 - if (! @ms_newMapObj ( $mapfile )) {  
174 - echo "Erro no arquivo sera mantido o original<br>";  
175 - $error = ms_GetErrorObj ();  
176 - while ( $error && $error->code != MS_NOERR ) {  
177 - printf ( "<br>Error in %s: %s<br>\n", $error->routine, $error->message );  
178 - $error = $error->next ();  
179 - }  
180 - $fp = fopen ( $mapfile, "w" );  
181 - fwrite ( $fp, $original );  
182 - fclose ( $fp );  
183 - exit ();  
184 - }  
185 66
186 - // verifica os metadata que sao armazenados tambem no banco de dados de administracao  
187 - // isso e necessario para manter a consistencia caso o usuario altere manualmente os valores 67 +function salvaMapfile()
  68 +{
  69 + global $dbhw, $codigo, $gravarTexto;
  70 + $esquemaadmin = $_SESSION["esquemaadmin"];
  71 + $locaplic = $_SESSION["locaplic"];
  72 + if (empty($gravarTexto)) {
  73 + return;
  74 + }
  75 + $mapfile = $locaplic . "/temas/" . $codigo . ".map";
  76 + $original = file_get_contents($mapfile);
  77 + $fp = fopen($mapfile, "w");
  78 + if ($fp == false) {
  79 + echo "<span style=color:red <b>N&atilde;o foi poss&iacute;vel salvar o arquivo. Verifique as permiss&otilde;es ou se h&aacute; algum erro no mapfile</b></span><br><br>";
  80 + exit();
  81 + } else {
  82 + // remove itens vazios
  83 + $novoTexto = array();
  84 + $testar = array(
  85 + "TEMPORIZADOR",
  86 + "PALLETESTEP",
  87 + "LTEMPOITEMIMAGEM",
  88 + "METAESTAT_ID_MEDIDA_VARIAVEL",
  89 + "GMOPACITY",
  90 + "GMSTATUS",
  91 + "ICONETEMA",
  92 + "LTEMPOITEMTITULO",
  93 + "DESCRIPTION_TEMPLATE",
  94 + "LTEMPOITEMLINK",
  95 + "TILES",
  96 + "METAESTAT_CODIGO_TIPO_REGIAO",
  97 + "ARQUIVOTEMAORIGINAL",
  98 + "PALLETEFILE",
  99 + "NOMEORIGINAL",
  100 + "OLSTATUS",
  101 + "PERMITEDOWNLOAD",
  102 + "LTEMPOFORMATODATA",
  103 + "FILTROORIGINAL",
  104 + "PERMITECOMENTARIO",
  105 + "LTEMPOITEMICONE",
  106 + "DATAORIGINAL",
  107 + "PLUGINI3GEO",
  108 + "METAESTAT",
  109 + "ITEMBUSCARAPIDA",
  110 + "ARQUIVODOWNLOAD",
  111 + "ARQUIVOKMZ",
  112 + "PERMITEKML",
  113 + "PERMITEOGC",
  114 + "CONVCARACTER",
  115 + "CORTEPIXELS",
  116 + "EDITORSQL",
  117 + "LTEMPOCONVENCODE",
  118 + "LTEMPOITEMFIM",
  119 + "OLOPACITY",
  120 + "LEGENDAWMS",
  121 + "LEGENDAIMG",
  122 + "KEYIMAGE",
  123 + "TILEINDEX",
  124 + "TILEITEM",
  125 + "SYMBOL",
  126 + "LABELITEM",
  127 + "FILTERITEM",
  128 + "GROUP",
  129 + "ENCODING",
  130 + "TIP",
  131 + "CLASSE",
  132 + "ITENSDESC",
  133 + "CLASSESNOME",
  134 + "ITENSLINK",
  135 + "ESCALA",
  136 + "CLASSESSIMBOLO",
  137 + "MENSAGEM",
  138 + "EXTENSAO",
  139 + "CLASSESITEM",
  140 + "ESCONDIDO",
  141 + "CLASSESCOR",
  142 + "DOWNLOAD",
  143 + "CLASSESTAMANHO",
  144 + "ITENS",
  145 + "TEMA",
  146 + "APLICAEXTENSAO",
  147 + "IDENTIFICA",
  148 + "TRANSITIONEFFECT"
  149 + );
  150 + foreach (preg_split('~[\r\n]+~', $gravarTexto) as $line) {
  151 + $teste = strtoupper($line);
  152 + $teste = trim($teste);
  153 + $teste = str_replace(array(
  154 + " ",
  155 + "'",
  156 + '"'
  157 + ), "", $teste);
  158 + $teste = preg_replace('/[\n\r\t ]*/', '', $teste);
  159 + $passou = true;
  160 + foreach ($testar as $t) {
  161 + if ($teste == $t) {
  162 + $passou = false;
  163 + }
  164 + }
  165 + if ($passou == true) {
  166 + if (mb_detect_encoding($line, 'UTF-8') == "UTF-8") {
  167 + $line = mb_convert_encoding($line, "ISO-8859-1", "UTF-8");
  168 + }
  169 + $novoTexto[] = $line;
  170 + }
  171 + }
  172 + fwrite($fp, implode("\r\n", $novoTexto));
  173 + }
  174 + fclose($fp);
  175 + // testa o mapfile
  176 + ms_ResetErrorList();
  177 + if (! @ms_newMapObj($mapfile)) {
  178 + echo "Erro no arquivo sera mantido o original<br>";
  179 + $error = ms_GetErrorObj();
  180 + while ($error && $error->code != MS_NOERR) {
  181 + printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message);
  182 + $error = $error->next();
  183 + }
  184 + $fp = fopen($mapfile, "w");
  185 + fwrite($fp, $original);
  186 + fclose($fp);
  187 + exit();
  188 + }
  189 +
  190 + // verifica os metadata que sao armazenados tambem no banco de dados de administracao
  191 + // isso e necessario para manter a consistencia caso o usuario altere manualmente os valores
188 192
189 - // cria o objeto map  
190 - $mapa = ms_newMapObj ( $mapfile ); 193 + // cria o objeto map
  194 + $mapa = ms_newMapObj($mapfile);
191 195
192 - $layer = $mapa->getlayerbyname ( $codigo );  
193 - if ($layer == "") {  
194 - return "<br><span style='color:red;'>Atenção: não existe nenhum LAYER com NAME igual a " . $codigo . "</span><br>";  
195 - } else {  
196 - // pega o metadata  
197 - $meta = $layer->getmetadata ( "permitedownload" );  
198 - $meta = strtoupper ( $meta );  
199 - $dataCol = array();  
200 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
201 - $dataCol["download_tema"] = $meta;  
202 - }  
203 - $meta = $layer->getmetadata ( "permiteogc" );  
204 - $meta = strtoupper ( $meta );  
205 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
206 - $dataCol["ogc_tema"] = $meta;  
207 - }  
208 - $meta = $layer->getmetadata ( "permitekml" );  
209 - $meta = strtoupper ( $meta );  
210 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
211 - $dataCol["kml_tema"] = $meta;  
212 - }  
213 - $meta = $layer->getmetadata ( "permitekmz" );  
214 - $meta = strtoupper ( $meta );  
215 - if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {  
216 - $dataCol["kmz_tema"] = $meta;  
217 - }  
218 - $resultado = \admin\php\funcoesAdmin\i3GeoAdminUpdate ( $dbhw, "i3geoadmin_temas", $dataCol, "WHERE codigo_tema = '$codigo'" );  
219 - } 196 + $layer = $mapa->getlayerbyname($codigo);
  197 + if ($layer == "") {
  198 + return "<br><span style='color:red;'>Atenção: não existe nenhum LAYER com NAME igual a " . $codigo . "</span><br>";
  199 + } else {
  200 + // pega o metadata
  201 + $meta = $layer->getmetadata("permitedownload");
  202 + $meta = strtoupper($meta);
  203 + $dataCol = array();
  204 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  205 + $dataCol["download_tema"] = $meta;
  206 + }
  207 + $meta = $layer->getmetadata("permiteogc");
  208 + $meta = strtoupper($meta);
  209 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  210 + $dataCol["ogc_tema"] = $meta;
  211 + }
  212 + $meta = $layer->getmetadata("permitekml");
  213 + $meta = strtoupper($meta);
  214 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  215 + $dataCol["kml_tema"] = $meta;
  216 + }
  217 + $meta = $layer->getmetadata("permitekmz");
  218 + $meta = strtoupper($meta);
  219 + if ($meta != "" && ($meta == "SIM" || $meta == "NAO")) {
  220 + $dataCol["kmz_tema"] = $meta;
  221 + }
  222 + $resultado = \admin\php\funcoesAdmin\i3GeoAdminUpdate($dbhw, "i3geoadmin_temas", $dataCol, "WHERE codigo_tema = '$codigo'");
  223 + }
220 224
221 - \admin\php\funcoesAdmin\removeCabecalhoMapfile ( $mapfile );  
222 - \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigo, $_SESSION["cachedir"], $_SESSION["dir_tmp"]); 225 + \admin\php\funcoesAdmin\removeCabecalhoMapfile($mapfile);
  226 + \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigo, $_SESSION["cachedir"], $_SESSION["dir_tmp"]);
  227 +}
223 228
  229 +//
  230 +// salva um LAYER existente em um mapfile temporario na pasta i3geo/temas
  231 +// utilizado no editor de mapfiles
  232 +//
  233 +function refazerLayer($nomelayer, $codigomap, $locaplic, $dir_tmp, $cachedir, $maporigem, $classe, $cache = "", $identifica = "sim")
  234 +{
  235 + // error_reporting(0);
  236 + if (empty($cache)) {
  237 + $cache = "";
  238 + }
  239 + if (empty($classe)) {
  240 + $classe = "";
  241 + }
  242 + if (empty($identifica)) {
  243 + $identifica = "sim";
  244 + }
  245 + $mapa = ms_newMapObj($maporigem);
  246 + $arqtema = $locaplic . "/temas/" . $codigomap . ".map";
  247 + $mapatema = ms_newMapObj($arqtema);
  248 + $layeroriginal = @$mapatema->getlayerbyname($codigomap);
  249 + $layernovo = @$mapa->getlayerbyname($nomelayer);
  250 + if ($layeroriginal != "" && $layernovo != "") {
  251 + // $plugin = $layeroriginal->getmetadata("PLUGINI3GEO");
  252 + $layeroriginal->set("status", MS_DELETE);
  253 + $nl = ms_newLayerObj($mapatema, $layernovo);
  254 + $nl->set("name", $codigomap);
  255 + // $nl->setmetadata("PLUGINI3GEO",$plugin);
  256 + $nl->setmetadata("nomeoriginal", "");
  257 + $nl->setmetadata("arquivotemaoriginal", "");
  258 + $nl->setmetadata("olopacity", "");
  259 + $nl->setmetadata("olstatus", "");
  260 + $nl->setmetadata("gmopacity", "");
  261 + $nl->setmetadata("gmstatus", "");
  262 + $nl->setmetadata("FILTROORIGINAL", "");
  263 + $nl->setmetadata("DATAORIGINAL", "");
  264 + $nl->setmetadata("cache", $cache);
  265 + $nl->setmetadata("classe", $classe);
  266 + $nl->setmetadata("identifica", $identifica);
  267 + $numclasses = $nl->numclasses;
  268 + if ($numclasses > 0) {
  269 + for ($i = 0; $i < $numclasses; $i ++) {
  270 + $classe = $nl->getClass($i);
  271 + $classe->set("title", "");
  272 + }
  273 + }
  274 + $mapatema->save($arqtema);
  275 + \admin\php\funcoesAdmin\removeCabecalhoMapfile($arqtema, $symbolset = true);
  276 + // apaga o cache
  277 + \admin\php\funcoesAdmin\limpaCacheImg($locaplic, $codigomap, $cachedir, $dir_tmp);
  278 + return array(
  279 + "data" => "ok"
  280 + );
  281 + }
  282 + return false;
224 } 283 }
225 ?> 284 ?>
226 \ No newline at end of file 285 \ No newline at end of file
classesphp/classe_metaestatinfo.php
@@ -505,7 +505,7 @@ class MetaestatInfo{ @@ -505,7 +505,7 @@ class MetaestatInfo{
505 //Layers adicionados aqui sao marcados com o metadata METAESTAT "SIM" 505 //Layers adicionados aqui sao marcados com o metadata METAESTAT "SIM"
506 //O codigo_tipo_regiao e marcado com o metadata METAESTAT_CODIGO_TIPO_REGIAO 506 //O codigo_tipo_regiao e marcado com o metadata METAESTAT_CODIGO_TIPO_REGIAO
507 //O id da medida da variavel e marcado com o metadata METAESTAT_ID_MEDIDA_VARIAVEL 507 //O id da medida da variavel e marcado com o metadata METAESTAT_ID_MEDIDA_VARIAVEL
508 - //outros metadados tambem sao utilizados, veja em admin/php/editormapfile.php 508 +
509 $arq = $this->dir_tmp."/".$this->nomecache.".map"; 509 $arq = $this->dir_tmp."/".$this->nomecache.".map";
510 if(!file_exists($arq)){ 510 if(!file_exists($arq)){
511 $meta = $this->listaMedidaVariavel("",$id_medida_variavel); 511 $meta = $this->listaMedidaVariavel("",$id_medida_variavel);
css/i3geo7.css.php 100755 → 100644
ferramentas/atalhoscamada/index.js
@@ -51,7 +51,6 @@ i3GEOF.atalhoscamada = @@ -51,7 +51,6 @@ i3GEOF.atalhoscamada =
51 dicionario["sql"] = $trad("t41"); 51 dicionario["sql"] = $trad("t41");
52 dicionario["comentar"] = $trad("t45"); 52 dicionario["comentar"] = $trad("t45");
53 dicionario["wms"] = "WMS-OGC"; 53 dicionario["wms"] = "WMS-OGC";
54 - dicionario["salvamapfile"] = $trad("t44");  
55 dicionario["tme"] = $trad("t49"); 54 dicionario["tme"] = $trad("t49");
56 dicionario["topo"] = $trad("x56"); 55 dicionario["topo"] = $trad("x56");
57 dicionario["idjanela"] = idjanela; 56 dicionario["idjanela"] = idjanela;
@@ -181,7 +180,6 @@ i3GEOF.atalhoscamada = @@ -181,7 +180,6 @@ i3GEOF.atalhoscamada =
181 * Esse parametro e usado na hora de salvar o mapa 180 * Esse parametro e usado na hora de salvar o mapa
182 * Para isso, a funcao salvarmapfile deve ser preparada para obter o parametro 181 * Para isso, a funcao salvarmapfile deve ser preparada para obter o parametro
183 * e enviar para a funcao php 182 * e enviar para a funcao php
184 - * veja em i3GEOF.salvamapfile.salva  
185 * 183 *
186 * conv indica se deve ser feita a conversao de checked para sim/nao 184 * conv indica se deve ser feita a conversao de checked para sim/nao
187 */ 185 */
ferramentas/editorgm/editorgm_compacto.js 100755 → 100644
ferramentas/editorol/editorol_compacto.js 100755 → 100644
ferramentas/salvamapfile/index.js
@@ -172,7 +172,7 @@ i3GEOF.salvamapfile = { @@ -172,7 +172,7 @@ i3GEOF.salvamapfile = {
172 //esses parametros podem ter sido alterados por outra ferramenta 172 //esses parametros podem ter sido alterados por outra ferramenta
173 // 173 //
174 tema = i3GEO.arvoreDeCamadas.pegaTema(nome); 174 tema = i3GEO.arvoreDeCamadas.pegaTema(nome);
175 - p = i3GEO.configura.locaplic+"/admin/php/editormapfile.php?funcao=REFAZERLAYER" 175 + p = i3GEO.configura.locaplic+"/admin1/catalogo/mapfile/editor/exec.php?funcao=REFAZERLAYER"
176 + "&codigomap="+nome 176 + "&codigomap="+nome
177 + "&maporigem=" + mapfile 177 + "&maporigem=" + mapfile
178 + "&nomelayer="+nomelayer 178 + "&nomelayer="+nomelayer
js/compactados/ajuda_compacto.js 100755 → 100644
js/compactados/analise_compacto.js 100755 → 100644
js/compactados/arvoredecamadas_compacto.js 100755 → 100644
js/compactados/arvoredetemas_compacto.js 100755 → 100644
js/compactados/base64_compacto.js 100755 → 100644
js/compactados/busca_compacto.js 100755 → 100644
js/compactados/caixaDeFerramentas_compacto.js 100755 → 100644
js/compactados/calculo_compacto.js 100755 → 100644
js/compactados/catalogoDir_compacto.js 100755 → 100644
js/compactados/catalogoEstrelas_compacto.js 100755 → 100644
js/compactados/catalogoInde_compacto.js 100755 → 100644
js/compactados/catalogoMapas_compacto.js 100755 → 100644
js/compactados/catalogoMenus_compacto.js 100755 → 100644
js/compactados/catalogoMetaestat_compacto.js 100755 → 100644
js/compactados/catalogoOgc_compacto.js 100755 → 100644
js/compactados/catalogoRegioes_compacto.js 100755 → 100644
js/compactados/catalogoSistemas_compacto.js 100755 → 100644
js/compactados/configura_compacto.js 100755 → 100644
js/compactados/coordenadas_compacto.js 100755 → 100644
js/compactados/desenho_compacto.js 100755 → 100644
js/compactados/dicionario_ajuda_compacto.js 100755 → 100644
js/compactados/dicionario_compacto.js 100755 → 100644
js/compactados/editor_compacto.js 100755 → 100644
js/compactados/eventos_compacto.js 100755 → 100644
js/compactados/guias_compacto.js 100755 → 100644
js/compactados/idioma_compacto.js 100755 → 100644
js/compactados/ini_i3geo_compacto.js 100755 → 100644
js/compactados/interface_compacto.js 100755 → 100644
js/compactados/janela_compacto.js 100755 → 100644
js/compactados/legenda_compacto.js 100755 → 100644
js/compactados/login_compacto.js 100755 → 100644
1 -if(typeof(i3GEOF)==='undefined'){var i3GEOF={}}i3GEO.login={divnomelogin:"i3GEONomeLogin",recarrega:false,funcaoLoginOk:null,funcaoLoginErro:null,anulaCookie:function(){i3GEO.util.insereCookie("i3geocodigologin","",0);i3GEO.util.insereCookie("i3geousuariologin","",0);i3GEO.util.insereCookie("i3geousuarionome","",0);i3GEO.util.insereCookie("i3GeoLogin","",0)},verificaCookieLogin:function(){var a=i3GEO.util.pegaCookie("i3geocodigologin"),b=i3GEO.util.pegaCookie("i3geousuarionome");if(a&&b&&a!=""&&b!=""){return true}else{return false}},verificaOperacao:function(operacao,locaplic,funcaoOk,tipo,funcaoErro){var p="",cp,temp,resultado=true;if(!i3GEO.login.verificaCookieLogin()){if(!funcaoErro){alert("Login...!")}else{funcaoErro.call()}return false}if(!locaplic){locaplic=i3GEO.configura.locaplic}temp=function(retorno){if(retorno.data=="naopermitido"){alert($trad("naoPermitido"));return false}if(retorno.data=="sim"){resultado=true}else{resultado=false}if(resultado===true){if(funcaoOk&&funcaoOk!=""){funcaoOk.call()}}else{if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML="";i3GEO.login.anulaCookie()}if(funcaoErro&&funcaoErro!=""&&resultado===false){funcaoErro.call()}}return resultado};if(!tipo||tipo==="sessao"){p=locaplic+"/admin/php/login.php?funcao=validaoperacaosessao"}if(tipo==="banco"){p=locaplic+"/admin/php/login.php?funcao=validaoperacaobanco"}cp=new cpaint();cp.set_response_type("JSON");cp.set_transfer_mode("POST");cp.call(p,"login",temp,"&operacao="+operacao)},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:"Admin/Login",id:"i3GeoAdmin"});obj.submenus.i3GeoAdmin=[];obj.submenus.i3GeoAdmin.push({id:"omenudataAdminu1",text:"Login",url:"javascript:i3GEO.login.dialogo.abreLogin()"},{id:"omenudataAdminu2",text:"Logout",url:"javascript:i3GEO.login.dialogo.abreLogout()"},{id:"omenudataAdmin5",text:$trad("x88"),url:"javascript:i3GEO.mapa.dialogo.preferencias()"});return obj},dialogo:{abreLogin:function(locaplic,template){var js;if(!template||template==""){template="template_mst.html"}if(!locaplic||locaplic==""){locaplic=i3GEO.configura.locaplic}if(typeof(i3GEOF.loginusuario)==='undefined'){js=locaplic+"/ferramentas/loginusuario/dependencias.php?template="+template;i3GEO.util.scriptTag(js,"i3GEOF.loginusuario.criaJanelaFlutuante()","i3GEOF.loginusuario_script()")}else{i3GEOF.loginusuario.criaJanelaFlutuante()}},abreLogout:function(){var r=confirm($trad("x26"));if(r==true){i3GEO.login.anulaCookie();i3GEO.janela.destroi("i3GEOF.loginusuario");if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML=""}if(i3GEO.login.recarrega===true){document.location.reload()}if(i3GEO.parametros){i3GEO.parametros.editor="nao";i3GEO.catalogoMenus.listaMenus()}}}}};  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +if(typeof(i3GEOF)==='undefined'){var i3GEOF={}}i3GEO.login={divnomelogin:"i3GEONomeLogin",recarrega:false,funcaoLoginOk:null,funcaoLoginErro:null,anulaCookie:function(){i3GEO.util.insereCookie("i3geocodigologin","",0);i3GEO.util.insereCookie("i3geousuariologin","",0);i3GEO.util.insereCookie("i3geousuarionome","",0);i3GEO.util.insereCookie("i3GeoLogin","",0)},verificaCookieLogin:function(){var a=i3GEO.util.pegaCookie("i3geocodigologin"),b=i3GEO.util.pegaCookie("i3geousuarionome");if(a&&b&&a!=""&&b!=""){return true}else{return false}},verificaOperacao:function(operacao,locaplic,funcaoOk,tipo,funcaoErro){var p="",cp,temp,resultado=true;if(!i3GEO.login.verificaCookieLogin()){if(!funcaoErro){alert("Login...!")}else{funcaoErro.call()}return false}if(!locaplic){locaplic=i3GEO.configura.locaplic}temp=function(retorno){if(retorno.data=="naopermitido"){alert($trad("naoPermitido"));return false}if(retorno.data=="sim"){resultado=true}else{resultado=false}if(resultado===true){if(funcaoOk&&funcaoOk!=""){funcaoOk.call()}}else{if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML="";i3GEO.login.anulaCookie()}if(funcaoErro&&funcaoErro!=""&&resultado===false){funcaoErro.call()}}return resultado};if(!tipo||tipo==="sessao"){p=locaplic+"/admin1/php/login.php?funcao=validaoperacaosessao"}if(tipo==="banco"){p=locaplic+"/admin1/php/login.php?funcao=validaoperacaobanco"}cp=new cpaint();cp.set_response_type("JSON");cp.set_transfer_mode("POST");cp.call(p,"login",temp,"&operacao="+operacao)},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:"Admin/Login",id:"i3GeoAdmin"});obj.submenus.i3GeoAdmin=[];obj.submenus.i3GeoAdmin.push({id:"omenudataAdminu1",text:"Login",url:"javascript:i3GEO.login.dialogo.abreLogin()"},{id:"omenudataAdminu2",text:"Logout",url:"javascript:i3GEO.login.dialogo.abreLogout()"},{id:"omenudataAdmin5",text:$trad("x88"),url:"javascript:i3GEO.mapa.dialogo.preferencias()"});return obj},dialogo:{abreLogin:function(locaplic,template){var js;if(!template||template==""){template="template_mst.html"}if(!locaplic||locaplic==""){locaplic=i3GEO.configura.locaplic}if(typeof(i3GEOF.loginusuario)==='undefined'){js=locaplic+"/ferramentas/loginusuario/dependencias.php?template="+template;i3GEO.util.scriptTag(js,"i3GEOF.loginusuario.criaJanelaFlutuante()","i3GEOF.loginusuario_script()")}else{i3GEOF.loginusuario.criaJanelaFlutuante()}},abreLogout:function(){var r=confirm($trad("x26"));if(r==true){i3GEO.login.anulaCookie();i3GEO.janela.destroi("i3GEOF.loginusuario");if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML=""}if(i3GEO.login.recarrega===true){document.location.reload()}if(i3GEO.parametros){i3GEO.parametros.editor="nao";i3GEO.catalogoMenus.listaMenus()}}}}};
3 \ No newline at end of file 3 \ No newline at end of file
js/compactados/mapa_compacto.js 100755 → 100644
js/compactados/maparef_compacto.js 100755 → 100644
js/compactados/marcador_compacto.js 100755 → 100644
js/compactados/mustache.js 100755 → 100644
js/compactados/navega_compacto.js 100755 → 100644
js/compactados/php_compacto.js 100755 → 100644
js/compactados/plugini3geo_compacto.js 100755 → 100644
js/compactados/proj4js.js 100755 → 100644
js/compactados/social_compacto.js 100755 → 100644
js/compactados/tema_compacto.js 100755 → 100644
js/compactados/util_compacto.js 100755 → 100644
js/compactados/wicket.js 100755 → 100644
js/i3geo_tudo_compacto7.js
@@ -278,7 +278,7 @@ if(typeof(i3GEO)===&#39;undefined&#39;){var i3GEO={}}i3GEO.coordenadas={padrao:&quot;geoProj&quot; @@ -278,7 +278,7 @@ if(typeof(i3GEO)===&#39;undefined&#39;){var i3GEO={}}i3GEO.coordenadas={padrao:&quot;geoProj&quot;
278 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.social={curtirFacebook:function(url,tipo){if(tipo==="comtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&width=160&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:160px; height:21px;' allowTransparency='true'></iframe>"}if(tipo==="semtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>"}},publicarTwitter:function(url,tipo){var re=new RegExp("=","g");url=url.replace(re,'%3d');if(tipo==="comtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=horizontal&via=i3geo&url='+url+'" style="width:100px; height:21px;"></iframe>'}if(tipo==="semtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=none&via=i3geo&url='+url+'" style="width:65px; height:21px;"></iframe>'}},compartilhar:function(id,urlcf,urlpt,tipo,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}if(!tipo){tipo="comtotal"}var onde=$i(id),tabela="";if(tipo==="comtotal"){tabela+="<table style='width:250px' ><tr>"}if(tipo==="semtotal"){tabela+="<table style='width:115px' ><tr>"}if(onde||id===""){if(urlpt!==""){tabela+="<td>"+i3GEO.social.publicarTwitter(urlpt,tipo)+"</td>"}if(urlcf!==""){tabela+="<td>"+i3GEO.social.curtirFacebook(urlcf,tipo)+"</td>"}tabela+="</tr></table>";if(id!==""){onde.innerHTML=tabela}return tabela}else{return false}},bookmark:function(link,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}var ins="<img style='cursor:pointer' src='"+locaplic+"/imagens/delicious.gif' onclick='javascript:window.open(\"http://del.icio.us/post?url="+link+"\")' title='Delicious'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/digg.gif' onclick='javascript:window.open(\"http://digg.com/submit/post?url="+link+"\")' title='Digg'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/facebook.gif' onclick='javascript:window.open(\"http://www.facebook.com/sharer.php?u="+link+"\")' title='Facebook'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/stumbleupon.gif' onclick='javascript:window.open(\"http://www.stumbleupon.com/submit?url="+link+"\")' title='StumbleUpon'/>";return ins}}; 278 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.social={curtirFacebook:function(url,tipo){if(tipo==="comtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&width=160&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:160px; height:21px;' allowTransparency='true'></iframe>"}if(tipo==="semtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>"}},publicarTwitter:function(url,tipo){var re=new RegExp("=","g");url=url.replace(re,'%3d');if(tipo==="comtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=horizontal&via=i3geo&url='+url+'" style="width:100px; height:21px;"></iframe>'}if(tipo==="semtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=none&via=i3geo&url='+url+'" style="width:65px; height:21px;"></iframe>'}},compartilhar:function(id,urlcf,urlpt,tipo,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}if(!tipo){tipo="comtotal"}var onde=$i(id),tabela="";if(tipo==="comtotal"){tabela+="<table style='width:250px' ><tr>"}if(tipo==="semtotal"){tabela+="<table style='width:115px' ><tr>"}if(onde||id===""){if(urlpt!==""){tabela+="<td>"+i3GEO.social.publicarTwitter(urlpt,tipo)+"</td>"}if(urlcf!==""){tabela+="<td>"+i3GEO.social.curtirFacebook(urlcf,tipo)+"</td>"}tabela+="</tr></table>";if(id!==""){onde.innerHTML=tabela}return tabela}else{return false}},bookmark:function(link,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}var ins="<img style='cursor:pointer' src='"+locaplic+"/imagens/delicious.gif' onclick='javascript:window.open(\"http://del.icio.us/post?url="+link+"\")' title='Delicious'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/digg.gif' onclick='javascript:window.open(\"http://digg.com/submit/post?url="+link+"\")' title='Digg'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/facebook.gif' onclick='javascript:window.open(\"http://www.facebook.com/sharer.php?u="+link+"\")' title='Facebook'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/stumbleupon.gif' onclick='javascript:window.open(\"http://www.stumbleupon.com/submit?url="+link+"\")' title='StumbleUpon'/>";return ins}};
279 // 279 //
280 //compactados/login_compacto.js 280 //compactados/login_compacto.js
281 -if(typeof(i3GEOF)==='undefined'){var i3GEOF={}}i3GEO.login={divnomelogin:"i3GEONomeLogin",recarrega:false,funcaoLoginOk:null,funcaoLoginErro:null,anulaCookie:function(){i3GEO.util.insereCookie("i3geocodigologin","",0);i3GEO.util.insereCookie("i3geousuariologin","",0);i3GEO.util.insereCookie("i3geousuarionome","",0);i3GEO.util.insereCookie("i3GeoLogin","",0)},verificaCookieLogin:function(){var a=i3GEO.util.pegaCookie("i3geocodigologin"),b=i3GEO.util.pegaCookie("i3geousuarionome");if(a&&b&&a!=""&&b!=""){return true}else{return false}},verificaOperacao:function(operacao,locaplic,funcaoOk,tipo,funcaoErro){var p="",cp,temp,resultado=true;if(!i3GEO.login.verificaCookieLogin()){if(!funcaoErro){alert("Login...!")}else{funcaoErro.call()}return false}if(!locaplic){locaplic=i3GEO.configura.locaplic}temp=function(retorno){if(retorno.data=="naopermitido"){alert($trad("naoPermitido"));return false}if(retorno.data=="sim"){resultado=true}else{resultado=false}if(resultado===true){if(funcaoOk&&funcaoOk!=""){funcaoOk.call()}}else{if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML="";i3GEO.login.anulaCookie()}if(funcaoErro&&funcaoErro!=""&&resultado===false){funcaoErro.call()}}return resultado};if(!tipo||tipo==="sessao"){p=locaplic+"/admin/php/login.php?funcao=validaoperacaosessao"}if(tipo==="banco"){p=locaplic+"/admin/php/login.php?funcao=validaoperacaobanco"}cp=new cpaint();cp.set_response_type("JSON");cp.set_transfer_mode("POST");cp.call(p,"login",temp,"&operacao="+operacao)},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:"Admin/Login",id:"i3GeoAdmin"});obj.submenus.i3GeoAdmin=[];obj.submenus.i3GeoAdmin.push({id:"omenudataAdminu1",text:"Login",url:"javascript:i3GEO.login.dialogo.abreLogin()"},{id:"omenudataAdminu2",text:"Logout",url:"javascript:i3GEO.login.dialogo.abreLogout()"},{id:"omenudataAdmin5",text:$trad("x88"),url:"javascript:i3GEO.mapa.dialogo.preferencias()"});return obj},dialogo:{abreLogin:function(locaplic,template){var js;if(!template||template==""){template="template_mst.html"}if(!locaplic||locaplic==""){locaplic=i3GEO.configura.locaplic}if(typeof(i3GEOF.loginusuario)==='undefined'){js=locaplic+"/ferramentas/loginusuario/dependencias.php?template="+template;i3GEO.util.scriptTag(js,"i3GEOF.loginusuario.criaJanelaFlutuante()","i3GEOF.loginusuario_script()")}else{i3GEOF.loginusuario.criaJanelaFlutuante()}},abreLogout:function(){var r=confirm($trad("x26"));if(r==true){i3GEO.login.anulaCookie();i3GEO.janela.destroi("i3GEOF.loginusuario");if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML=""}if(i3GEO.login.recarrega===true){document.location.reload()}if(i3GEO.parametros){i3GEO.parametros.editor="nao";i3GEO.catalogoMenus.listaMenus()}}}}}; 281 +if(typeof(i3GEOF)==='undefined'){var i3GEOF={}}i3GEO.login={divnomelogin:"i3GEONomeLogin",recarrega:false,funcaoLoginOk:null,funcaoLoginErro:null,anulaCookie:function(){i3GEO.util.insereCookie("i3geocodigologin","",0);i3GEO.util.insereCookie("i3geousuariologin","",0);i3GEO.util.insereCookie("i3geousuarionome","",0);i3GEO.util.insereCookie("i3GeoLogin","",0)},verificaCookieLogin:function(){var a=i3GEO.util.pegaCookie("i3geocodigologin"),b=i3GEO.util.pegaCookie("i3geousuarionome");if(a&&b&&a!=""&&b!=""){return true}else{return false}},verificaOperacao:function(operacao,locaplic,funcaoOk,tipo,funcaoErro){var p="",cp,temp,resultado=true;if(!i3GEO.login.verificaCookieLogin()){if(!funcaoErro){alert("Login...!")}else{funcaoErro.call()}return false}if(!locaplic){locaplic=i3GEO.configura.locaplic}temp=function(retorno){if(retorno.data=="naopermitido"){alert($trad("naoPermitido"));return false}if(retorno.data=="sim"){resultado=true}else{resultado=false}if(resultado===true){if(funcaoOk&&funcaoOk!=""){funcaoOk.call()}}else{if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML="";i3GEO.login.anulaCookie()}if(funcaoErro&&funcaoErro!=""&&resultado===false){funcaoErro.call()}}return resultado};if(!tipo||tipo==="sessao"){p=locaplic+"/admin1/php/login.php?funcao=validaoperacaosessao"}if(tipo==="banco"){p=locaplic+"/admin1/php/login.php?funcao=validaoperacaobanco"}cp=new cpaint();cp.set_response_type("JSON");cp.set_transfer_mode("POST");cp.call(p,"login",temp,"&operacao="+operacao)},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:"Admin/Login",id:"i3GeoAdmin"});obj.submenus.i3GeoAdmin=[];obj.submenus.i3GeoAdmin.push({id:"omenudataAdminu1",text:"Login",url:"javascript:i3GEO.login.dialogo.abreLogin()"},{id:"omenudataAdminu2",text:"Logout",url:"javascript:i3GEO.login.dialogo.abreLogout()"},{id:"omenudataAdmin5",text:$trad("x88"),url:"javascript:i3GEO.mapa.dialogo.preferencias()"});return obj},dialogo:{abreLogin:function(locaplic,template){var js;if(!template||template==""){template="template_mst.html"}if(!locaplic||locaplic==""){locaplic=i3GEO.configura.locaplic}if(typeof(i3GEOF.loginusuario)==='undefined'){js=locaplic+"/ferramentas/loginusuario/dependencias.php?template="+template;i3GEO.util.scriptTag(js,"i3GEOF.loginusuario.criaJanelaFlutuante()","i3GEOF.loginusuario_script()")}else{i3GEOF.loginusuario.criaJanelaFlutuante()}},abreLogout:function(){var r=confirm($trad("x26"));if(r==true){i3GEO.login.anulaCookie();i3GEO.janela.destroi("i3GEOF.loginusuario");if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML=""}if(i3GEO.login.recarrega===true){document.location.reload()}if(i3GEO.parametros){i3GEO.parametros.editor="nao";i3GEO.catalogoMenus.listaMenus()}}}}};
282 // 282 //
283 //compactados/marcador_compacto.js 283 //compactados/marcador_compacto.js
284 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.marcador={IDONDE:"",TEMPLATE:"",config:{"template":"templates/ferramentasSend.html"},carregaTemplates:function(){$.get(i3GEO.marcador.config.template,function(template){i3GEO.template.marcador=template;i3GEO.marcador.inicia()})},inicia:function(obj){if(obj&&$(obj).attr("data-template")!=undefined){i3GEO.marcador.config.template=$(obj).attr("data-template")}if(!i3GEO.template.marcador){i3GEO.marcador.carregaTemplates();return}else{var janela=i3GEO.janela.cria("380px","400px","","","","<span class='i3GeoTituloJanelaBsNolink' >"+$trad("x79")+"</span></div>","i3GEOmarcador",false,"hd","","","",true,"","","","");i3GEO.marcador.IDONDE=janela[2].id;i3GEO.marcador.redesenha()}},prompt:function(){i3GEO.janela.prompt($trad("x77"),i3GEO.marcador.armazena,"")},armazena:function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),ext=i3GEO.parametros.mapexten,nome="Marcador",valor;if($i("i3GEOjanelaprompt")){nome=$i("i3GEOjanelaprompt").value}valor=nome+"|"+ext;if(cookies){cookies+=":"}else{cookies=""}valor=cookies+valor;i3GEO.util.insereCookie("marcadoresDoI3Geo",valor,365);i3GEO.marcador.redesenha()},redesenha:function(){var t=Mustache.to_html("{{#data}}"+i3GEO.template.marcador+"{{/data}}",{"data":i3GEO.marcador.itensMenu()});$("#"+i3GEO.marcador.IDONDE).html("<div class='container-fluid'>"+t+"</div>")},exporta:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),texto;if(!c){c=""}texto="<p class=paragrafo >"+$trad("x78")+"</p><div class='i3geoForm i3geoFormIconeEdita' ><input type=text value='"+c+"' onclick='javascript:this.select()'/></div>";i3GEO.janela.mensagemSimples(texto,$trad("x79"))},exportaShp:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),temp=function(retorno){i3GEO.temaAtivo=retorno.data;i3GEO.atualiza()};if(c){i3GEO.php.marcadores2shp(temp)}},importa:function(){var temp=function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),novos="";if($i("i3GEOjanelaprompt")){novos=$i("i3GEOjanelaprompt").value}if(cookies){cookies+=":"}else{cookies=""}novos=cookies+novos;i3GEO.util.insereCookie("marcadoresDoI3Geo",novos,365);i3GEO.marcador.redesenha()};i3GEO.janela.prompt($trad("x83"),temp,"")},remove:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp,novos=[];for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]!==nomeMarcador){novos.push(valores[i])}}i3GEO.util.insereCookie("marcadoresDoI3Geo",novos.join(":"),365);i3GEO.marcador.redesenha()},recuperaZoom:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]===nomeMarcador){i3GEO.navega.zoomExt("","","",temp[1]);return}}},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:$trad("x79"),id:"i3GeoMenuMarcador"});obj.submenus.i3GeoMenuMarcador=i3GEO.marcador.itensMenu();return obj},itensMenu:function(){var itens=[],cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores,n,i,temp;itens.push({nome:$trad("x82"),url:"javascript:i3GEO.marcador.prompt()"},{nome:$trad("x80"),url:"javascript:i3GEO.marcador.exporta()"},{nome:$trad("x81"),url:"javascript:i3GEO.marcador.importa()"},{nome:$trad("x84"),url:"javascript:i3GEO.marcador.exportaShp()"});if(cookie){valores=cookie.split(":");n=valores.length;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp.length===2){itens.push({nome:temp[0],url:"javascript:i3GEO.marcador.recuperaZoom('"+temp[0]+"')",opcional:"<a href='javascript:void(0)' onclick='i3GEO.marcador.remove(\""+temp[0]+"\")' class='btn btn-danger btn-fab btn-fab-mini' role='button'><span class='material-icons md-18'>delete_forever</span></a>"})}}}return itens}}; 284 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.marcador={IDONDE:"",TEMPLATE:"",config:{"template":"templates/ferramentasSend.html"},carregaTemplates:function(){$.get(i3GEO.marcador.config.template,function(template){i3GEO.template.marcador=template;i3GEO.marcador.inicia()})},inicia:function(obj){if(obj&&$(obj).attr("data-template")!=undefined){i3GEO.marcador.config.template=$(obj).attr("data-template")}if(!i3GEO.template.marcador){i3GEO.marcador.carregaTemplates();return}else{var janela=i3GEO.janela.cria("380px","400px","","","","<span class='i3GeoTituloJanelaBsNolink' >"+$trad("x79")+"</span></div>","i3GEOmarcador",false,"hd","","","",true,"","","","");i3GEO.marcador.IDONDE=janela[2].id;i3GEO.marcador.redesenha()}},prompt:function(){i3GEO.janela.prompt($trad("x77"),i3GEO.marcador.armazena,"")},armazena:function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),ext=i3GEO.parametros.mapexten,nome="Marcador",valor;if($i("i3GEOjanelaprompt")){nome=$i("i3GEOjanelaprompt").value}valor=nome+"|"+ext;if(cookies){cookies+=":"}else{cookies=""}valor=cookies+valor;i3GEO.util.insereCookie("marcadoresDoI3Geo",valor,365);i3GEO.marcador.redesenha()},redesenha:function(){var t=Mustache.to_html("{{#data}}"+i3GEO.template.marcador+"{{/data}}",{"data":i3GEO.marcador.itensMenu()});$("#"+i3GEO.marcador.IDONDE).html("<div class='container-fluid'>"+t+"</div>")},exporta:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),texto;if(!c){c=""}texto="<p class=paragrafo >"+$trad("x78")+"</p><div class='i3geoForm i3geoFormIconeEdita' ><input type=text value='"+c+"' onclick='javascript:this.select()'/></div>";i3GEO.janela.mensagemSimples(texto,$trad("x79"))},exportaShp:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),temp=function(retorno){i3GEO.temaAtivo=retorno.data;i3GEO.atualiza()};if(c){i3GEO.php.marcadores2shp(temp)}},importa:function(){var temp=function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),novos="";if($i("i3GEOjanelaprompt")){novos=$i("i3GEOjanelaprompt").value}if(cookies){cookies+=":"}else{cookies=""}novos=cookies+novos;i3GEO.util.insereCookie("marcadoresDoI3Geo",novos,365);i3GEO.marcador.redesenha()};i3GEO.janela.prompt($trad("x83"),temp,"")},remove:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp,novos=[];for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]!==nomeMarcador){novos.push(valores[i])}}i3GEO.util.insereCookie("marcadoresDoI3Geo",novos.join(":"),365);i3GEO.marcador.redesenha()},recuperaZoom:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]===nomeMarcador){i3GEO.navega.zoomExt("","","",temp[1]);return}}},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:$trad("x79"),id:"i3GeoMenuMarcador"});obj.submenus.i3GeoMenuMarcador=i3GEO.marcador.itensMenu();return obj},itensMenu:function(){var itens=[],cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores,n,i,temp;itens.push({nome:$trad("x82"),url:"javascript:i3GEO.marcador.prompt()"},{nome:$trad("x80"),url:"javascript:i3GEO.marcador.exporta()"},{nome:$trad("x81"),url:"javascript:i3GEO.marcador.importa()"},{nome:$trad("x84"),url:"javascript:i3GEO.marcador.exportaShp()"});if(cookie){valores=cookie.split(":");n=valores.length;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp.length===2){itens.push({nome:temp[0],url:"javascript:i3GEO.marcador.recuperaZoom('"+temp[0]+"')",opcional:"<a href='javascript:void(0)' onclick='i3GEO.marcador.remove(\""+temp[0]+"\")' class='btn btn-danger btn-fab btn-fab-mini' role='button'><span class='material-icons md-18'>delete_forever</span></a>"})}}}return itens}};
js/i3geo_tudo_compacto7.js.php 100755 → 100644
@@ -278,7 +278,7 @@ if(typeof(i3GEO)===&#39;undefined&#39;){var i3GEO={}}i3GEO.coordenadas={padrao:&quot;geoProj&quot; @@ -278,7 +278,7 @@ if(typeof(i3GEO)===&#39;undefined&#39;){var i3GEO={}}i3GEO.coordenadas={padrao:&quot;geoProj&quot;
278 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.social={curtirFacebook:function(url,tipo){if(tipo==="comtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&width=160&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:160px; height:21px;' allowTransparency='true'></iframe>"}if(tipo==="semtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>"}},publicarTwitter:function(url,tipo){var re=new RegExp("=","g");url=url.replace(re,'%3d');if(tipo==="comtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=horizontal&via=i3geo&url='+url+'" style="width:100px; height:21px;"></iframe>'}if(tipo==="semtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=none&via=i3geo&url='+url+'" style="width:65px; height:21px;"></iframe>'}},compartilhar:function(id,urlcf,urlpt,tipo,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}if(!tipo){tipo="comtotal"}var onde=$i(id),tabela="";if(tipo==="comtotal"){tabela+="<table style='width:250px' ><tr>"}if(tipo==="semtotal"){tabela+="<table style='width:115px' ><tr>"}if(onde||id===""){if(urlpt!==""){tabela+="<td>"+i3GEO.social.publicarTwitter(urlpt,tipo)+"</td>"}if(urlcf!==""){tabela+="<td>"+i3GEO.social.curtirFacebook(urlcf,tipo)+"</td>"}tabela+="</tr></table>";if(id!==""){onde.innerHTML=tabela}return tabela}else{return false}},bookmark:function(link,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}var ins="<img style='cursor:pointer' src='"+locaplic+"/imagens/delicious.gif' onclick='javascript:window.open(\"http://del.icio.us/post?url="+link+"\")' title='Delicious'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/digg.gif' onclick='javascript:window.open(\"http://digg.com/submit/post?url="+link+"\")' title='Digg'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/facebook.gif' onclick='javascript:window.open(\"http://www.facebook.com/sharer.php?u="+link+"\")' title='Facebook'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/stumbleupon.gif' onclick='javascript:window.open(\"http://www.stumbleupon.com/submit?url="+link+"\")' title='StumbleUpon'/>";return ins}}; 278 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.social={curtirFacebook:function(url,tipo){if(tipo==="comtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&width=160&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:160px; height:21px;' allowTransparency='true'></iframe>"}if(tipo==="semtotal"){return"<iframe src='http://www.facebook.com/plugins/like.php?href="+url+"&layout=button_count&show_faces=false&action=like&colorscheme=light&height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:100px; height:21px;' allowTransparency='true'></iframe>"}},publicarTwitter:function(url,tipo){var re=new RegExp("=","g");url=url.replace(re,'%3d');if(tipo==="comtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=horizontal&via=i3geo&url='+url+'" style="width:100px; height:21px;"></iframe>'}if(tipo==="semtotal"){return'<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?count=none&via=i3geo&url='+url+'" style="width:65px; height:21px;"></iframe>'}},compartilhar:function(id,urlcf,urlpt,tipo,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}if(!tipo){tipo="comtotal"}var onde=$i(id),tabela="";if(tipo==="comtotal"){tabela+="<table style='width:250px' ><tr>"}if(tipo==="semtotal"){tabela+="<table style='width:115px' ><tr>"}if(onde||id===""){if(urlpt!==""){tabela+="<td>"+i3GEO.social.publicarTwitter(urlpt,tipo)+"</td>"}if(urlcf!==""){tabela+="<td>"+i3GEO.social.curtirFacebook(urlcf,tipo)+"</td>"}tabela+="</tr></table>";if(id!==""){onde.innerHTML=tabela}return tabela}else{return false}},bookmark:function(link,locaplic){if(!locaplic){locaplic=i3GEO.configura.locaplic}var ins="<img style='cursor:pointer' src='"+locaplic+"/imagens/delicious.gif' onclick='javascript:window.open(\"http://del.icio.us/post?url="+link+"\")' title='Delicious'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/digg.gif' onclick='javascript:window.open(\"http://digg.com/submit/post?url="+link+"\")' title='Digg'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/facebook.gif' onclick='javascript:window.open(\"http://www.facebook.com/sharer.php?u="+link+"\")' title='Facebook'/> ";ins+="<img style='cursor:pointer' src='"+locaplic+"/imagens/stumbleupon.gif' onclick='javascript:window.open(\"http://www.stumbleupon.com/submit?url="+link+"\")' title='StumbleUpon'/>";return ins}};
279 // 279 //
280 //compactados/login_compacto.js 280 //compactados/login_compacto.js
281 -if(typeof(i3GEOF)==='undefined'){var i3GEOF={}}i3GEO.login={divnomelogin:"i3GEONomeLogin",recarrega:false,funcaoLoginOk:null,funcaoLoginErro:null,anulaCookie:function(){i3GEO.util.insereCookie("i3geocodigologin","",0);i3GEO.util.insereCookie("i3geousuariologin","",0);i3GEO.util.insereCookie("i3geousuarionome","",0);i3GEO.util.insereCookie("i3GeoLogin","",0)},verificaCookieLogin:function(){var a=i3GEO.util.pegaCookie("i3geocodigologin"),b=i3GEO.util.pegaCookie("i3geousuarionome");if(a&&b&&a!=""&&b!=""){return true}else{return false}},verificaOperacao:function(operacao,locaplic,funcaoOk,tipo,funcaoErro){var p="",cp,temp,resultado=true;if(!i3GEO.login.verificaCookieLogin()){if(!funcaoErro){alert("Login...!")}else{funcaoErro.call()}return false}if(!locaplic){locaplic=i3GEO.configura.locaplic}temp=function(retorno){if(retorno.data=="naopermitido"){alert($trad("naoPermitido"));return false}if(retorno.data=="sim"){resultado=true}else{resultado=false}if(resultado===true){if(funcaoOk&&funcaoOk!=""){funcaoOk.call()}}else{if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML="";i3GEO.login.anulaCookie()}if(funcaoErro&&funcaoErro!=""&&resultado===false){funcaoErro.call()}}return resultado};if(!tipo||tipo==="sessao"){p=locaplic+"/admin/php/login.php?funcao=validaoperacaosessao"}if(tipo==="banco"){p=locaplic+"/admin/php/login.php?funcao=validaoperacaobanco"}cp=new cpaint();cp.set_response_type("JSON");cp.set_transfer_mode("POST");cp.call(p,"login",temp,"&operacao="+operacao)},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:"Admin/Login",id:"i3GeoAdmin"});obj.submenus.i3GeoAdmin=[];obj.submenus.i3GeoAdmin.push({id:"omenudataAdminu1",text:"Login",url:"javascript:i3GEO.login.dialogo.abreLogin()"},{id:"omenudataAdminu2",text:"Logout",url:"javascript:i3GEO.login.dialogo.abreLogout()"},{id:"omenudataAdmin5",text:$trad("x88"),url:"javascript:i3GEO.mapa.dialogo.preferencias()"});return obj},dialogo:{abreLogin:function(locaplic,template){var js;if(!template||template==""){template="template_mst.html"}if(!locaplic||locaplic==""){locaplic=i3GEO.configura.locaplic}if(typeof(i3GEOF.loginusuario)==='undefined'){js=locaplic+"/ferramentas/loginusuario/dependencias.php?template="+template;i3GEO.util.scriptTag(js,"i3GEOF.loginusuario.criaJanelaFlutuante()","i3GEOF.loginusuario_script()")}else{i3GEOF.loginusuario.criaJanelaFlutuante()}},abreLogout:function(){var r=confirm($trad("x26"));if(r==true){i3GEO.login.anulaCookie();i3GEO.janela.destroi("i3GEOF.loginusuario");if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML=""}if(i3GEO.login.recarrega===true){document.location.reload()}if(i3GEO.parametros){i3GEO.parametros.editor="nao";i3GEO.catalogoMenus.listaMenus()}}}}}; 281 +if(typeof(i3GEOF)==='undefined'){var i3GEOF={}}i3GEO.login={divnomelogin:"i3GEONomeLogin",recarrega:false,funcaoLoginOk:null,funcaoLoginErro:null,anulaCookie:function(){i3GEO.util.insereCookie("i3geocodigologin","",0);i3GEO.util.insereCookie("i3geousuariologin","",0);i3GEO.util.insereCookie("i3geousuarionome","",0);i3GEO.util.insereCookie("i3GeoLogin","",0)},verificaCookieLogin:function(){var a=i3GEO.util.pegaCookie("i3geocodigologin"),b=i3GEO.util.pegaCookie("i3geousuarionome");if(a&&b&&a!=""&&b!=""){return true}else{return false}},verificaOperacao:function(operacao,locaplic,funcaoOk,tipo,funcaoErro){var p="",cp,temp,resultado=true;if(!i3GEO.login.verificaCookieLogin()){if(!funcaoErro){alert("Login...!")}else{funcaoErro.call()}return false}if(!locaplic){locaplic=i3GEO.configura.locaplic}temp=function(retorno){if(retorno.data=="naopermitido"){alert($trad("naoPermitido"));return false}if(retorno.data=="sim"){resultado=true}else{resultado=false}if(resultado===true){if(funcaoOk&&funcaoOk!=""){funcaoOk.call()}}else{if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML="";i3GEO.login.anulaCookie()}if(funcaoErro&&funcaoErro!=""&&resultado===false){funcaoErro.call()}}return resultado};if(!tipo||tipo==="sessao"){p=locaplic+"/admin1/php/login.php?funcao=validaoperacaosessao"}if(tipo==="banco"){p=locaplic+"/admin1/php/login.php?funcao=validaoperacaobanco"}cp=new cpaint();cp.set_response_type("JSON");cp.set_transfer_mode("POST");cp.call(p,"login",temp,"&operacao="+operacao)},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:"Admin/Login",id:"i3GeoAdmin"});obj.submenus.i3GeoAdmin=[];obj.submenus.i3GeoAdmin.push({id:"omenudataAdminu1",text:"Login",url:"javascript:i3GEO.login.dialogo.abreLogin()"},{id:"omenudataAdminu2",text:"Logout",url:"javascript:i3GEO.login.dialogo.abreLogout()"},{id:"omenudataAdmin5",text:$trad("x88"),url:"javascript:i3GEO.mapa.dialogo.preferencias()"});return obj},dialogo:{abreLogin:function(locaplic,template){var js;if(!template||template==""){template="template_mst.html"}if(!locaplic||locaplic==""){locaplic=i3GEO.configura.locaplic}if(typeof(i3GEOF.loginusuario)==='undefined'){js=locaplic+"/ferramentas/loginusuario/dependencias.php?template="+template;i3GEO.util.scriptTag(js,"i3GEOF.loginusuario.criaJanelaFlutuante()","i3GEOF.loginusuario_script()")}else{i3GEOF.loginusuario.criaJanelaFlutuante()}},abreLogout:function(){var r=confirm($trad("x26"));if(r==true){i3GEO.login.anulaCookie();i3GEO.janela.destroi("i3GEOF.loginusuario");if($i(i3GEO.login.divnomelogin)){$i(i3GEO.login.divnomelogin).innerHTML=""}if(i3GEO.login.recarrega===true){document.location.reload()}if(i3GEO.parametros){i3GEO.parametros.editor="nao";i3GEO.catalogoMenus.listaMenus()}}}}};
282 // 282 //
283 //compactados/marcador_compacto.js 283 //compactados/marcador_compacto.js
284 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.marcador={IDONDE:"",TEMPLATE:"",config:{"template":"templates/ferramentasSend.html"},carregaTemplates:function(){$.get(i3GEO.marcador.config.template,function(template){i3GEO.template.marcador=template;i3GEO.marcador.inicia()})},inicia:function(obj){if(obj&&$(obj).attr("data-template")!=undefined){i3GEO.marcador.config.template=$(obj).attr("data-template")}if(!i3GEO.template.marcador){i3GEO.marcador.carregaTemplates();return}else{var janela=i3GEO.janela.cria("380px","400px","","","","<span class='i3GeoTituloJanelaBsNolink' >"+$trad("x79")+"</span></div>","i3GEOmarcador",false,"hd","","","",true,"","","","");i3GEO.marcador.IDONDE=janela[2].id;i3GEO.marcador.redesenha()}},prompt:function(){i3GEO.janela.prompt($trad("x77"),i3GEO.marcador.armazena,"")},armazena:function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),ext=i3GEO.parametros.mapexten,nome="Marcador",valor;if($i("i3GEOjanelaprompt")){nome=$i("i3GEOjanelaprompt").value}valor=nome+"|"+ext;if(cookies){cookies+=":"}else{cookies=""}valor=cookies+valor;i3GEO.util.insereCookie("marcadoresDoI3Geo",valor,365);i3GEO.marcador.redesenha()},redesenha:function(){var t=Mustache.to_html("{{#data}}"+i3GEO.template.marcador+"{{/data}}",{"data":i3GEO.marcador.itensMenu()});$("#"+i3GEO.marcador.IDONDE).html("<div class='container-fluid'>"+t+"</div>")},exporta:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),texto;if(!c){c=""}texto="<p class=paragrafo >"+$trad("x78")+"</p><div class='i3geoForm i3geoFormIconeEdita' ><input type=text value='"+c+"' onclick='javascript:this.select()'/></div>";i3GEO.janela.mensagemSimples(texto,$trad("x79"))},exportaShp:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),temp=function(retorno){i3GEO.temaAtivo=retorno.data;i3GEO.atualiza()};if(c){i3GEO.php.marcadores2shp(temp)}},importa:function(){var temp=function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),novos="";if($i("i3GEOjanelaprompt")){novos=$i("i3GEOjanelaprompt").value}if(cookies){cookies+=":"}else{cookies=""}novos=cookies+novos;i3GEO.util.insereCookie("marcadoresDoI3Geo",novos,365);i3GEO.marcador.redesenha()};i3GEO.janela.prompt($trad("x83"),temp,"")},remove:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp,novos=[];for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]!==nomeMarcador){novos.push(valores[i])}}i3GEO.util.insereCookie("marcadoresDoI3Geo",novos.join(":"),365);i3GEO.marcador.redesenha()},recuperaZoom:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]===nomeMarcador){i3GEO.navega.zoomExt("","","",temp[1]);return}}},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:$trad("x79"),id:"i3GeoMenuMarcador"});obj.submenus.i3GeoMenuMarcador=i3GEO.marcador.itensMenu();return obj},itensMenu:function(){var itens=[],cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores,n,i,temp;itens.push({nome:$trad("x82"),url:"javascript:i3GEO.marcador.prompt()"},{nome:$trad("x80"),url:"javascript:i3GEO.marcador.exporta()"},{nome:$trad("x81"),url:"javascript:i3GEO.marcador.importa()"},{nome:$trad("x84"),url:"javascript:i3GEO.marcador.exportaShp()"});if(cookie){valores=cookie.split(":");n=valores.length;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp.length===2){itens.push({nome:temp[0],url:"javascript:i3GEO.marcador.recuperaZoom('"+temp[0]+"')",opcional:"<a href='javascript:void(0)' onclick='i3GEO.marcador.remove(\""+temp[0]+"\")' class='btn btn-danger btn-fab btn-fab-mini' role='button'><span class='material-icons md-18'>delete_forever</span></a>"})}}}return itens}}; 284 if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.marcador={IDONDE:"",TEMPLATE:"",config:{"template":"templates/ferramentasSend.html"},carregaTemplates:function(){$.get(i3GEO.marcador.config.template,function(template){i3GEO.template.marcador=template;i3GEO.marcador.inicia()})},inicia:function(obj){if(obj&&$(obj).attr("data-template")!=undefined){i3GEO.marcador.config.template=$(obj).attr("data-template")}if(!i3GEO.template.marcador){i3GEO.marcador.carregaTemplates();return}else{var janela=i3GEO.janela.cria("380px","400px","","","","<span class='i3GeoTituloJanelaBsNolink' >"+$trad("x79")+"</span></div>","i3GEOmarcador",false,"hd","","","",true,"","","","");i3GEO.marcador.IDONDE=janela[2].id;i3GEO.marcador.redesenha()}},prompt:function(){i3GEO.janela.prompt($trad("x77"),i3GEO.marcador.armazena,"")},armazena:function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),ext=i3GEO.parametros.mapexten,nome="Marcador",valor;if($i("i3GEOjanelaprompt")){nome=$i("i3GEOjanelaprompt").value}valor=nome+"|"+ext;if(cookies){cookies+=":"}else{cookies=""}valor=cookies+valor;i3GEO.util.insereCookie("marcadoresDoI3Geo",valor,365);i3GEO.marcador.redesenha()},redesenha:function(){var t=Mustache.to_html("{{#data}}"+i3GEO.template.marcador+"{{/data}}",{"data":i3GEO.marcador.itensMenu()});$("#"+i3GEO.marcador.IDONDE).html("<div class='container-fluid'>"+t+"</div>")},exporta:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),texto;if(!c){c=""}texto="<p class=paragrafo >"+$trad("x78")+"</p><div class='i3geoForm i3geoFormIconeEdita' ><input type=text value='"+c+"' onclick='javascript:this.select()'/></div>";i3GEO.janela.mensagemSimples(texto,$trad("x79"))},exportaShp:function(){var c=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),temp=function(retorno){i3GEO.temaAtivo=retorno.data;i3GEO.atualiza()};if(c){i3GEO.php.marcadores2shp(temp)}},importa:function(){var temp=function(){var cookies=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),novos="";if($i("i3GEOjanelaprompt")){novos=$i("i3GEOjanelaprompt").value}if(cookies){cookies+=":"}else{cookies=""}novos=cookies+novos;i3GEO.util.insereCookie("marcadoresDoI3Geo",novos,365);i3GEO.marcador.redesenha()};i3GEO.janela.prompt($trad("x83"),temp,"")},remove:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp,novos=[];for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]!==nomeMarcador){novos.push(valores[i])}}i3GEO.util.insereCookie("marcadoresDoI3Geo",novos.join(":"),365);i3GEO.marcador.redesenha()},recuperaZoom:function(nomeMarcador){var cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores=cookie.split(":"),n=valores.length,i,temp;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp[0]&&temp[0]===nomeMarcador){i3GEO.navega.zoomExt("","","",temp[1]);return}}},adicionaMenuSuspenso:function(obj){obj.menu.push({nome:$trad("x79"),id:"i3GeoMenuMarcador"});obj.submenus.i3GeoMenuMarcador=i3GEO.marcador.itensMenu();return obj},itensMenu:function(){var itens=[],cookie=i3GEO.util.pegaCookie("marcadoresDoI3Geo"),valores,n,i,temp;itens.push({nome:$trad("x82"),url:"javascript:i3GEO.marcador.prompt()"},{nome:$trad("x80"),url:"javascript:i3GEO.marcador.exporta()"},{nome:$trad("x81"),url:"javascript:i3GEO.marcador.importa()"},{nome:$trad("x84"),url:"javascript:i3GEO.marcador.exportaShp()"});if(cookie){valores=cookie.split(":");n=valores.length;for(i=0;i<n;i++){temp=valores[i].split("|");if(temp.length===2){itens.push({nome:temp[0],url:"javascript:i3GEO.marcador.recuperaZoom('"+temp[0]+"')",opcional:"<a href='javascript:void(0)' onclick='i3GEO.marcador.remove(\""+temp[0]+"\")' class='btn btn-danger btn-fab btn-fab-mini' role='button'><span class='material-icons md-18'>delete_forever</span></a>"})}}}return itens}};
pacotes/cpaint/cpaint2_compacto.inc.js 100755 → 100644
pacotes/mobileesp/mdetect_compacto.js 100755 → 100644
pacotes/yui290/build/carousel/carousel_compacto.js 100755 → 100644
pacotes/yui290/build/container/container_compacto.js 100755 → 100644
pacotes/yui290/build/container/container_core_compacto.js 100755 → 100644
pacotes/yui290/build/resize/resize_compacto.js 100755 → 100644
pacotes/yui290/build/treeview/treeview_compacto.js 100755 → 100644
pacotes/yui290/build/utilities/utilities_compacto.js 100755 → 100644
temas/_lbiomashp.map
@@ -2,45 +2,48 @@ MAP @@ -2,45 +2,48 @@ MAP
2 FONTSET "../symbols/fontes.txt" 2 FONTSET "../symbols/fontes.txt"
3 SYMBOLSET "../symbols/simbolosv6.sym" 3 SYMBOLSET "../symbols/simbolosv6.sym"
4 LAYER 4 LAYER
  5 + COMPOSITE
  6 + OPACITY 90
  7 + END # COMPOSITE
5 CONNECTION "" 8 CONNECTION ""
6 DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" 9 DATA "/var/www/i3geo/aplicmap/dados/biomas.shp"
7 METADATA 10 METADATA
8 - "TIP" "CD_LEGENDA"  
9 "cache" "sim" 11 "cache" "sim"
10 - "CLASSE" "SIM" 12 + "TIP" "CD_LEGENDA"
11 "olopacity" "" 13 "olopacity" ""
  14 + "CLASSE" "SIM"
12 "animagif" "" 15 "animagif" ""
13 "permitekmz" "SIM" 16 "permitekmz" "SIM"
14 "gmopacity" "" 17 "gmopacity" ""
15 "gmstatus" "" 18 "gmstatus" ""
16 "ITENSDESC" "Teste de acentuação" 19 "ITENSDESC" "Teste de acentuação"
17 - "TILES" "SIM"  
18 - "ESCALA" "250000"  
19 "editavel" "" 20 "editavel" ""
  21 + "ESCALA" "250000"
  22 + "TILES" "SIM"
20 "arquivotemaoriginal" "" 23 "arquivotemaoriginal" ""
21 "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909" 24 "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909"
22 - "nomeoriginal" ""  
23 "olstatus" "" 25 "olstatus" ""
  26 + "nomeoriginal" ""
24 "permitedownload" "SIM" 27 "permitedownload" "SIM"
25 - "FILTROORIGINAL" ""  
26 "permitecomentario" "NAO" 28 "permitecomentario" "NAO"
27 - "DATAORIGINAL" "" 29 + "FILTROORIGINAL" ""
28 "escondido" "NAO" 30 "escondido" "NAO"
29 - "download" "SIM" 31 + "DATAORIGINAL" ""
30 "esquematabelaeditavel" "" 32 "esquematabelaeditavel" ""
  33 + "download" "SIM"
31 "itembuscarapida" "CD_LEGENDA" 34 "itembuscarapida" "CD_LEGENDA"
32 - "ITENS" "CD_LEGENDA"  
33 "tme" "" 35 "tme" ""
34 - "permitekml" "SIM"  
35 - "permiteogc" "SIM" 36 + "ITENS" "CD_LEGENDA"
36 "transitioneffect" "NAO" 37 "transitioneffect" "NAO"
37 - "convcaracter" "SIM" 38 + "permiteogc" "SIM"
  39 + "permitekml" "SIM"
38 "TEMA" "Biomas shapefile (acentuação)" 40 "TEMA" "Biomas shapefile (acentuação)"
39 - "colunaidunico" "" 41 + "convcaracter" "SIM"
40 "colunageometria" "" 42 "colunageometria" ""
  43 + "colunaidunico" ""
41 "identifica" "sim" 44 "identifica" "sim"
42 - "tabelaeditavel" ""  
43 "storymap" "" 45 "storymap" ""
  46 + "tabelaeditavel" ""
44 END # METADATA 47 END # METADATA
45 NAME "_lbiomashp" 48 NAME "_lbiomashp"
46 PROCESSING "ITEMS=CD_LEGENDA" 49 PROCESSING "ITEMS=CD_LEGENDA"
@@ -49,7 +52,6 @@ MAP @@ -49,7 +52,6 @@ MAP
49 STATUS DEFAULT 52 STATUS DEFAULT
50 TEMPLATE "none.htm" 53 TEMPLATE "none.htm"
51 TILEITEM "location" 54 TILEITEM "location"
52 - OPACITY 90  
53 TYPE POLYGON 55 TYPE POLYGON
54 UNITS METERS 56 UNITS METERS
55 CLASS 57 CLASS
@@ -74,7 +76,7 @@ MAP @@ -74,7 +76,7 @@ MAP
74 NAME "CERRADO" 76 NAME "CERRADO"
75 EXPRESSION ('[CD_LEGENDA]'eq'CERRADO') 77 EXPRESSION ('[CD_LEGENDA]'eq'CERRADO')
76 STYLE 78 STYLE
77 - COLOR 57 32 234 79 + COLOR 202 223 14
78 OUTLINECOLOR 255 255 255 80 OUTLINECOLOR 255 255 255
79 END # STYLE 81 END # STYLE
80 TITLE "" 82 TITLE ""