Commit 3bace88fc87fbe778b9f079c157fbfbbf497d8e8
1 parent
755a761e
Exists in
master
and in
7 other branches
Inclusão de opção para armazenar as tabelas abertas ao salvar um mapa
Showing
6 changed files
with
74 additions
and
6 deletions
Show diff stats
admin/php/mapas.php
| @@ -174,7 +174,7 @@ switch (strtoupper($funcao)) | @@ -174,7 +174,7 @@ switch (strtoupper($funcao)) | ||
| 174 | break; | 174 | break; |
| 175 | } | 175 | } |
| 176 | function salvaMapfile(){ | 176 | function salvaMapfile(){ |
| 177 | - global $esquemaadmin,$nome_mapa,$arqmapfile,$url,$id_mapa,$preferenciasbase64,$geometriasbase64,$graficosbase64,$ext; | 177 | + global $esquemaadmin,$nome_mapa,$arqmapfile,$url,$id_mapa,$preferenciasbase64,$geometriasbase64,$graficosbase64,$tabelasbase64,$ext; |
| 178 | //as preferencias sao criadas via javascript e guardadas junto com o mapa | 178 | //as preferencias sao criadas via javascript e guardadas junto com o mapa |
| 179 | try{ | 179 | try{ |
| 180 | // | 180 | // |
| @@ -186,10 +186,11 @@ function salvaMapfile(){ | @@ -186,10 +186,11 @@ function salvaMapfile(){ | ||
| 186 | //o parser para reconstruir os valores e feito em javascript, no cliente | 186 | //o parser para reconstruir os valores e feito em javascript, no cliente |
| 187 | // | 187 | // |
| 188 | $customizacoesinit = array(); | 188 | $customizacoesinit = array(); |
| 189 | - if(isset($preferenciasbase64) || isset($geometriasbase64) || isset($graficosbase64)){ | 189 | + if(isset($preferenciasbase64) || isset($geometriasbase64) || isset($graficosbase64) || isset($tabelasbase64)){ |
| 190 | $customizacoesinit[] = '"preferenciasbase64":"'.$preferenciasbase64.'"'; | 190 | $customizacoesinit[] = '"preferenciasbase64":"'.$preferenciasbase64.'"'; |
| 191 | $customizacoesinit[] = '"geometriasbase64":"'.$geometriasbase64.'"'; | 191 | $customizacoesinit[] = '"geometriasbase64":"'.$geometriasbase64.'"'; |
| 192 | $customizacoesinit[] = '"graficosbase64":"'.$graficosbase64.'"'; | 192 | $customizacoesinit[] = '"graficosbase64":"'.$graficosbase64.'"'; |
| 193 | + $customizacoesinit[] = '"tabelasbase64":"'.$tabelasbase64.'"'; | ||
| 193 | $m = ms_newMapObj($arqmapfile); | 194 | $m = ms_newMapObj($arqmapfile); |
| 194 | $m->setmetadata("CUSTOMIZACOESINIT",'{'.implode(",",$customizacoesinit).'}'); | 195 | $m->setmetadata("CUSTOMIZACOESINIT",'{'.implode(",",$customizacoesinit).'}'); |
| 195 | $m->save($arqmapfile); | 196 | $m->save($arqmapfile); |
classesjs/classe_i3geo.js
| @@ -512,6 +512,11 @@ var i3GEO = { | @@ -512,6 +512,11 @@ var i3GEO = { | ||
| 512 | && preferencias.graficosbase64 != "") { | 512 | && preferencias.graficosbase64 != "") { |
| 513 | i3GEO.mapa.restauraGraficos(preferencias.graficosbase64); | 513 | i3GEO.mapa.restauraGraficos(preferencias.graficosbase64); |
| 514 | } | 514 | } |
| 515 | + // recupera as tabelas | ||
| 516 | + if (preferencias.tabelasbase64 | ||
| 517 | + && preferencias.tabelasbase64 != "") { | ||
| 518 | + i3GEO.mapa.restauraTabelas(preferencias.tabelasbase64); | ||
| 519 | + } | ||
| 515 | } | 520 | } |
| 516 | } else { | 521 | } else { |
| 517 | alert("Erro. Impossivel criar o mapa " | 522 | alert("Erro. Impossivel criar o mapa " |
classesjs/classe_mapa.js
| @@ -432,6 +432,24 @@ i3GEO.mapa = | @@ -432,6 +432,24 @@ i3GEO.mapa = | ||
| 432 | true); | 432 | true); |
| 433 | } | 433 | } |
| 434 | }, | 434 | }, |
| 435 | + /** | ||
| 436 | + * Function: restauraTabelas | ||
| 437 | + * | ||
| 438 | + * Descompacta tabelas salvos no mapa atual | ||
| 439 | + */ | ||
| 440 | + restauraTabelas : function(tabelas) { | ||
| 441 | + // carrega o script do editor vetorial | ||
| 442 | + if (graficos.length > 0) { | ||
| 443 | + var inicia = function() { | ||
| 444 | + i3GEOF.tabela.restauraTabelas(tabelas); | ||
| 445 | + }; | ||
| 446 | + i3GEO.util.scriptTag( | ||
| 447 | + i3GEO.configura.locaplic + "/ferramentas/tabela/dependencias.php", | ||
| 448 | + inicia, | ||
| 449 | + "tabela", | ||
| 450 | + true); | ||
| 451 | + } | ||
| 452 | + }, | ||
| 435 | // | 453 | // |
| 436 | // aplica as preferencias armazenadas localmente ou vindas de um mapa salvo no banco de dados | 454 | // aplica as preferencias armazenadas localmente ou vindas de um mapa salvo no banco de dados |
| 437 | // | 455 | // |
classesjs/classe_php.js
| @@ -1599,7 +1599,7 @@ i3GEO.php = | @@ -1599,7 +1599,7 @@ i3GEO.php = | ||
| 1599 | * | 1599 | * |
| 1600 | * Salva o mapfile atual no banco de dados de administracao | 1600 | * Salva o mapfile atual no banco de dados de administracao |
| 1601 | */ | 1601 | */ |
| 1602 | - salvaMapaBanco : function(funcao, titulo, id_mapa, preferencias, geometrias, graficos) { | 1602 | + salvaMapaBanco : function(funcao, titulo, id_mapa, preferencias, geometrias, graficos, tabelas) { |
| 1603 | // pega as preferencias do usuario tambem | 1603 | // pega as preferencias do usuario tambem |
| 1604 | if (preferencias) { | 1604 | if (preferencias) { |
| 1605 | try { | 1605 | try { |
| @@ -1636,7 +1636,19 @@ i3GEO.php = | @@ -1636,7 +1636,19 @@ i3GEO.php = | ||
| 1636 | } else { | 1636 | } else { |
| 1637 | graficos = ""; | 1637 | graficos = ""; |
| 1638 | } | 1638 | } |
| 1639 | - | 1639 | + // pega as ferramentas do tipo tabela |
| 1640 | + if (tabelas && i3GEOF && i3GEOF.tabela) { | ||
| 1641 | + try { | ||
| 1642 | + tabelas = i3GEOF.tabela.compactaConfig(); | ||
| 1643 | + if (!tabelas) { | ||
| 1644 | + tabelas = ""; | ||
| 1645 | + } | ||
| 1646 | + } catch (e) { | ||
| 1647 | + tabelas = ""; | ||
| 1648 | + } | ||
| 1649 | + } else { | ||
| 1650 | + tabelas = ""; | ||
| 1651 | + } | ||
| 1640 | var url = (window.location.href.split("?")[0]), p = i3GEO.configura.locaplic + "/admin/php/mapas.php?"; | 1652 | var url = (window.location.href.split("?")[0]), p = i3GEO.configura.locaplic + "/admin/php/mapas.php?"; |
| 1641 | par = | 1653 | par = |
| 1642 | "funcao=salvaMapfile" + "&url=" + url.replace("#", "") + "&arqmapfile=" + i3GEO.parametros.mapfile + "&nome_mapa=" + titulo | 1654 | "funcao=salvaMapfile" + "&url=" + url.replace("#", "") + "&arqmapfile=" + i3GEO.parametros.mapfile + "&nome_mapa=" + titulo |
| @@ -1646,7 +1658,7 @@ i3GEO.php = | @@ -1646,7 +1658,7 @@ i3GEO.php = | ||
| 1646 | cp.set_transfer_mode('POST'); | 1658 | cp.set_transfer_mode('POST'); |
| 1647 | cp.set_response_type("JSON"); | 1659 | cp.set_response_type("JSON"); |
| 1648 | cp.call(p + par, "foo", funcao, "&preferenciasbase64=" + preferencias + "&geometriasbase64=" + geometrias + "&graficosbase64=" | 1660 | cp.call(p + par, "foo", funcao, "&preferenciasbase64=" + preferencias + "&geometriasbase64=" + geometrias + "&graficosbase64=" |
| 1649 | - + graficos); | 1661 | + + graficos + "&tabelasbase64=" + tabelas); |
| 1650 | }, | 1662 | }, |
| 1651 | /** | 1663 | /** |
| 1652 | * Function: marcadores2shp | 1664 | * Function: marcadores2shp |
ferramentas/graficointerativo1/index.js
| @@ -715,6 +715,7 @@ i3GEOF.graficointerativo1 = | @@ -715,6 +715,7 @@ i3GEOF.graficointerativo1 = | ||
| 715 | if (!i3GEO.Interface || !$i(idjanela + "i3GEOgraficointerativo1ComboTemas")) { | 715 | if (!i3GEO.Interface || !$i(idjanela + "i3GEOgraficointerativo1ComboTemas")) { |
| 716 | return; | 716 | return; |
| 717 | } | 717 | } |
| 718 | + //TODO permitir listar nao ligados | ||
| 718 | i3GEO.util.comboTemas(idjanela + "i3GEOgraficointerativo1ComboTemasId", function(retorno) { | 719 | i3GEO.util.comboTemas(idjanela + "i3GEOgraficointerativo1ComboTemasId", function(retorno) { |
| 719 | $i(idjanela + "i3GEOgraficointerativo1ComboTemas").innerHTML = retorno.dados; | 720 | $i(idjanela + "i3GEOgraficointerativo1ComboTemas").innerHTML = retorno.dados; |
| 720 | $i(idjanela + "i3GEOgraficointerativo1ComboTemas").style.display = "block"; | 721 | $i(idjanela + "i3GEOgraficointerativo1ComboTemas").style.display = "block"; |
ferramentas/tabela/index.js
| @@ -317,6 +317,7 @@ i3GEOF.tabela = | @@ -317,6 +317,7 @@ i3GEOF.tabela = | ||
| 317 | }; | 317 | }; |
| 318 | YAHOO.util.Event.addListener(janela[0].close, "click", temp); | 318 | YAHOO.util.Event.addListener(janela[0].close, "click", temp); |
| 319 | }, | 319 | }, |
| 320 | + //TODO listar mesmo os deligados | ||
| 320 | atualizaCombosCabecalhos : function() { | 321 | atualizaCombosCabecalhos : function() { |
| 321 | var i, id, n = i3GEOF.tabela.janelas.length; | 322 | var i, id, n = i3GEOF.tabela.janelas.length; |
| 322 | for (i = 0; i < n; i++) { | 323 | for (i = 0; i < n; i++) { |
| @@ -328,6 +329,36 @@ i3GEOF.tabela = | @@ -328,6 +329,36 @@ i3GEOF.tabela = | ||
| 328 | "ligadosComTabela"); | 329 | "ligadosComTabela"); |
| 329 | } | 330 | } |
| 330 | }, | 331 | }, |
| 332 | + /** | ||
| 333 | + * Obtem os parametros de cada janela e converte em base64. Cada janela e inserida como um item em um objeto A compactacao e | ||
| 334 | + * utilizada para salvar as configuracoes no mapfile atual | ||
| 335 | + */ | ||
| 336 | + compactaConfig : function() { | ||
| 337 | + var c, g, par, janelas, i, n, novoid; | ||
| 338 | + par = []; | ||
| 339 | + janelas = i3GEOF.tabela.janelas; | ||
| 340 | + n = janelas.length; | ||
| 341 | + //TODO retornaConfig nao existe | ||
| 342 | + for (i = 0; i < n; i++) { | ||
| 343 | + novoid = window.prompt($trad('idDaTabela',i3GEOF.tabela.dicionario),janelas[i]); | ||
| 344 | + c = i3GEOF.tabela.retornaConfig(janelas[i],novoid); | ||
| 345 | + par.push(c); | ||
| 346 | + } | ||
| 347 | + g = YAHOO.lang.JSON.stringify(par); | ||
| 348 | + return i3GEO.util.base64encode(g); | ||
| 349 | + }, | ||
| 350 | + restauraTabelas : function(par) { | ||
| 351 | + //TODO LISTAREGATIVO nao existe | ||
| 352 | + i3GEOF.tabela.LISTAREGATIVO = false; | ||
| 353 | + var n, i; | ||
| 354 | + par = i3GEO.util.base64decode(par); | ||
| 355 | + //alert(par) | ||
| 356 | + par = YAHOO.lang.JSON.parse(par); | ||
| 357 | + n = par.length; | ||
| 358 | + for (i = 0; i < n; i++) { | ||
| 359 | + i3GEOF.tabela.iniciaJanelaFlutuante(par[i]); | ||
| 360 | + } | ||
| 361 | + }, | ||
| 331 | /* | 362 | /* |
| 332 | * Function: ativaFoco | 363 | * Function: ativaFoco |
| 333 | * | 364 | * |
| @@ -1080,4 +1111,4 @@ i3GEOF.tabela = | @@ -1080,4 +1111,4 @@ i3GEOF.tabela = | ||
| 1080 | i3GEO.janela.tempoMsg(e); | 1111 | i3GEO.janela.tempoMsg(e); |
| 1081 | } | 1112 | } |
| 1082 | } | 1113 | } |
| 1083 | - }; | 1114 | + }; |
| 1084 | \ No newline at end of file | 1115 | \ No newline at end of file |