Commit 682d2352b1556aa7608e2f0bd16e70a79d058041
1 parent
363f8c7e
Exists in
master
and in
7 other branches
Opção para mudar id do grafico ao salvar um mapa
Showing
2 changed files
with
24 additions
and
9 deletions
Show diff stats
ferramentas/graficointerativo1/dicionario.js
| ... | ... | @@ -426,5 +426,13 @@ i3GEOF.graficointerativo1.dicionario = |
| 426 | 426 | es : "", |
| 427 | 427 | it : "" |
| 428 | 428 | } |
| 429 | + ], | |
| 430 | + "idDoGrafico" : [ | |
| 431 | + { | |
| 432 | + pt : "ID do gráfico", | |
| 433 | + en : "", | |
| 434 | + es : "", | |
| 435 | + it : "" | |
| 436 | + } | |
| 429 | 437 | ] |
| 430 | 438 | }; |
| 431 | 439 | \ No newline at end of file | ... | ... |
ferramentas/graficointerativo1/index.js
| ... | ... | @@ -277,12 +277,13 @@ i3GEOF.graficointerativo1 = |
| 277 | 277 | * utilizada para salvar as configuracoes no mapfile atual |
| 278 | 278 | */ |
| 279 | 279 | compactaConfig : function() { |
| 280 | - var c, g, par, janelas, i, n; | |
| 280 | + var c, g, par, janelas, i, n, novoid; | |
| 281 | 281 | par = []; |
| 282 | 282 | janelas = i3GEOF.graficointerativo1.janelas; |
| 283 | 283 | n = janelas.length; |
| 284 | 284 | for (i = 0; i < n; i++) { |
| 285 | - c = i3GEOF.graficointerativo1.retornaConfig(janelas[i]); | |
| 285 | + novoid = window.prompt($trad('idDoGrafico',i3GEOF.salvaMapa.dicionario),janelas[i]); | |
| 286 | + c = i3GEOF.graficointerativo1.retornaConfig(janelas[i],novoid); | |
| 286 | 287 | par.push(c); |
| 287 | 288 | } |
| 288 | 289 | g = YAHOO.lang.JSON.stringify(par); |
| ... | ... | @@ -303,20 +304,24 @@ i3GEOF.graficointerativo1 = |
| 303 | 304 | * |
| 304 | 305 | * A funcao i3GEO.php.salvaMapaBanco utiliza retornaConfig e cria um objeto que ira armazenar os parametros de cada janela |
| 305 | 306 | */ |
| 306 | - retornaConfig : function(idjanela) { | |
| 307 | + retornaConfig : function(idjanela,novoid) { | |
| 307 | 308 | // as chaves do objeto correspondem ao ID de cada elemento |
| 308 | - var d, c, par, objs, obj = "", valoresCombosItens = {}; | |
| 309 | + var tmpid,d, c, par, objs, obj = "", valoresCombosItens = {}; | |
| 309 | 310 | par = i3GEOF.graficointerativo1.propJanelas[idjanela]; |
| 310 | 311 | c = $i(idjanela); |
| 312 | + if(!novoid){ | |
| 313 | + novoid = idjanela; | |
| 314 | + } | |
| 311 | 315 | // pega todos os elementos do tipo input |
| 312 | 316 | objs = c.getElementsByTagName("input"); |
| 313 | 317 | for (obj in objs) { |
| 314 | 318 | // nao inclui agora os dados e cores |
| 315 | 319 | if (objs[obj].id && objs[obj].id != "" && objs[obj].id.search(idjanela + "i3GEOgraficointerativo1Dados") < 0) { |
| 320 | + tmpid = objs[obj].id.replace(idjanela,novoid); | |
| 316 | 321 | if (objs[obj].type === "text") { |
| 317 | - par[objs[obj].id] = objs[obj].value; | |
| 322 | + par[tmpid] = objs[obj].value; | |
| 318 | 323 | } else { |
| 319 | - par[objs[obj].id] = objs[obj].checked; | |
| 324 | + par[tmpid] = objs[obj].checked; | |
| 320 | 325 | } |
| 321 | 326 | } |
| 322 | 327 | } |
| ... | ... | @@ -324,7 +329,8 @@ i3GEOF.graficointerativo1 = |
| 324 | 329 | objs = c.getElementsByTagName("select"); |
| 325 | 330 | for (obj in objs) { |
| 326 | 331 | if (objs[obj].id && objs[obj].id != "") { |
| 327 | - par[objs[obj].id] = objs[obj].value; | |
| 332 | + tmpid = objs[obj].id.replace(idjanela,novoid); | |
| 333 | + par[tmpid] = objs[obj].value; | |
| 328 | 334 | } |
| 329 | 335 | } |
| 330 | 336 | // se a janela esta marcada para ser atualizada ao navegar, os dados nao devem ser incluidos |
| ... | ... | @@ -334,7 +340,8 @@ i3GEOF.graficointerativo1 = |
| 334 | 340 | objs = d.getElementsByTagName("input"); |
| 335 | 341 | for (obj in objs) { |
| 336 | 342 | if (objs[obj].id) { |
| 337 | - par[objs[obj].id] = objs[obj].value; | |
| 343 | + tmpid = objs[obj].id.replace(idjanela,novoid); | |
| 344 | + par[tmpid] = objs[obj].value; | |
| 338 | 345 | } |
| 339 | 346 | } |
| 340 | 347 | } else { |
| ... | ... | @@ -359,7 +366,7 @@ i3GEOF.graficointerativo1 = |
| 359 | 366 | } |
| 360 | 367 | } |
| 361 | 368 | par["valoresCombosItens"] = valoresCombosItens; |
| 362 | - par["idjanela"] = idjanela; | |
| 369 | + par["idjanela"] = novoid; | |
| 363 | 370 | par["w"] = c.style.width; |
| 364 | 371 | par["h"] = c.style.height; |
| 365 | 372 | return par; | ... | ... |