Commit 20aed09b31bf98afe9ae4ef02a8d59d4b504d94d
1 parent
a560b6c9
Exists in
master
and in
7 other branches
Reformulação da interface do geradordelinks e dos javascripts que agora utiliza …
…o diretório classesjs. O javascript foi transformado em uma API
Showing
1 changed file
with
20 additions
and
377 deletions
Show diff stats
geradordelinks.htm
| ... | ... | @@ -11,10 +11,7 @@ |
| 11 | 11 | P |
| 12 | 12 | {COLOR: #2F4632;text-align: justify;font-size: 12px;font-family: Verdana, Arial, Helvetica, sans-serif;} |
| 13 | 13 | </style> |
| 14 | -<script src="pacotes/cpaint/cpaint2.inc.compressed.js" type="text/javascript"></script> | |
| 15 | -<script type="text/javascript" src="pacotes/openlayers/OpenLayers.js"></script> | |
| 16 | -<script type="text/javascript" src="classesjs/compactados/funcoes_compacto.js"></script> | |
| 17 | - | |
| 14 | +<script type="text/javascript" src="classesjs/geradordelinks.js"></script> | |
| 18 | 15 | </head> |
| 19 | 16 | <body style="background-color:white;text-align:left;left:0px;"> |
| 20 | 17 | <!--<div id=banner style=position:relative;top:0px;left:0px;text-align:left > |
| ... | ... | @@ -85,36 +82,14 @@ dos pontos em décimos de grau (exemplo: -54 -12 -54 1 -51 -15) (opcional):</b></ |
| 85 | 82 | </select> |
| 86 | 83 | </div> |
| 87 | 84 | </div> |
| 88 | -<div style='width:550px;top:35px;left:10px;text-align:left;border:1px gray solid;' > | |
| 89 | - <div style=margin:10px;text-align:left; > | |
| 90 | - <p><b>Utilize o mapa para definir as coordenadas geográficas do mapa, ou digite os valores desejados (opcional):</b></p> | |
| 91 | - <div id=mapa1 style="width:250px;height:250px;border:1px solid blue;display:none"></div> | |
| 92 | - <div style=position:absolute;top:40px;left:270px;text-align:left; > | |
| 93 | - Coordenadas geográficas em décimos de grau:<br><br> | |
| 94 | - Longitude mínima:<br> | |
| 95 | - <div style=padding:5px;width:80px; id=paiXmin > | |
| 96 | - <input onchange="crialink()" type=text size=10 value="" id=xmin /> | |
| 97 | - </div><br> | |
| 98 | - Longitude máxima:<br> | |
| 99 | - <div style=padding:5px;width:80px; id=paiXmax > | |
| 100 | - <input onchange="crialink()" type=text size=10 value="" id=xmax /> | |
| 101 | - </div><br> | |
| 102 | - Latitude mínima:<br> | |
| 103 | - <div style=padding:5px;width:80px; id=paiYmin > | |
| 104 | - <input onchange="crialink()" type=text size=10 value="" id=ymin /> | |
| 105 | - </div><br> | |
| 106 | - Latitude máxima:<br> | |
| 107 | - <div style=padding:5px;width:80px; id=paiYmax > | |
| 108 | - <input onchange="crialink()" type=text size=10 value="" id=ymax /> | |
| 109 | - </div><br> | |
| 110 | - <input class=executar type=button value="capturar" onclick="capturageo()" /> | |
| 111 | - </div> | |
| 112 | - </div> | |
| 85 | +<div id=buscageo style='width:550px;top:35px;left:10px;text-align:left;border:1px gray solid;' > | |
| 113 | 86 | </div> |
| 114 | 87 | </body> |
| 115 | 88 | <script> |
| 116 | 89 | /* |
| 117 | -Title: Aplicativo para geração de links | |
| 90 | +Title: i3geo/geradordelinks.htm | |
| 91 | + | |
| 92 | +Aplicativo para geração de links | |
| 118 | 93 | |
| 119 | 94 | Esse aplicativo permite ao usuário gerar links para abertura do i3geo. |
| 120 | 95 | |
| ... | ... | @@ -138,356 +113,24 @@ GNU junto com este programa; se não, escreva para a |
| 138 | 113 | Free Software Foundation, Inc., no endereço |
| 139 | 114 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
| 140 | 115 | |
| 141 | -File: i3geo/geradordelinks.htm | |
| 142 | - | |
| 143 | -*/ | |
| 144 | -navm = false | |
| 145 | -navn = false | |
| 146 | -var app = navigator.appName.substring(0,1); | |
| 147 | -if (app=='N') navn=true; else navm=true; | |
| 148 | - | |
| 149 | -$inputText("paiPontos","","pontos","","","") | |
| 150 | -$inputText("paiNometemapontos","","nometemapontos","","","") | |
| 151 | -$inputText("paiPerfil","","perfil","","","") | |
| 152 | -$inputText("paiXmin","","xmin","","","") | |
| 153 | -$inputText("paiXmax","","xmax","","","") | |
| 154 | -$inputText("paiYmin","","ymin","","","") | |
| 155 | -$inputText("paiYmax","","ymax","","","") | |
| 156 | - | |
| 157 | -/* | |
| 158 | -Variable: g_locaplic | |
| 159 | - | |
| 160 | -Localização da instalação do i3geo. | |
| 161 | -*/ | |
| 162 | -g_locaplic = "http://"+window.location.host+"/i3geo"; | |
| 163 | -i3geo_gl_seltema("estadosl") | |
| 164 | -i3geo_gl_crialink() | |
| 165 | -i3geo_gl_pegagrupos() | |
| 166 | -i3geo_gl_init() | |
| 167 | - | |
| 168 | -/* | |
| 169 | -Function: i3geo_gl_crialink | |
| 170 | - | |
| 171 | -Cria o link e mostra na tela. | |
| 172 | - | |
| 173 | -*/ | |
| 174 | -function i3geo_gl_crialink() | |
| 175 | -{ | |
| 176 | - var ins = g_locaplic+"/ms_criamapa.php?"; | |
| 177 | - var iguias = $i("temasa").getElementsByTagName("input"); | |
| 178 | - var tsl = new Array(); //temas ligados | |
| 179 | - var tsd = new Array(); //temas | |
| 180 | - for (i=0;i<iguias.length; i++) | |
| 181 | - { | |
| 182 | - if (iguias[i].type == "checkbox") | |
| 183 | - { | |
| 184 | - tsd.push(iguias[i].value); | |
| 185 | - if (iguias[i].checked == true) | |
| 186 | - {tsl.push(iguias[i].value);} | |
| 187 | - } | |
| 188 | - } | |
| 189 | - if(tsd.length > 0) | |
| 190 | - {ins += "&temasa="+tsd.join(" ")} | |
| 191 | - if(tsl.length > 0) | |
| 192 | - {ins += "&layers="+tsl.join(" ")} | |
| 193 | - if($i("pontos").value != "") | |
| 194 | - { | |
| 195 | - ins += "&pontos="+$i("pontos").value | |
| 196 | - ins += "&nometemapontos="+$i("nometemapontos").value | |
| 197 | - } | |
| 198 | - if($i("perfil").value != "") | |
| 199 | - { | |
| 200 | - ins += "&perfil="+$i("perfil").value | |
| 201 | - } | |
| 202 | - if($i("interface").value != "") | |
| 203 | - { | |
| 204 | - ins += "&interface="+$i("interface").value | |
| 205 | - } | |
| 206 | - if($i("xmin").value != "") | |
| 207 | - { | |
| 208 | - ins += "&mapext="+$i("xmin").value+" " | |
| 209 | - ins += $i("ymin").value+" " | |
| 210 | - ins += $i("xmax").value+" " | |
| 211 | - ins += $i("ymax").value | |
| 212 | - } | |
| 213 | - $i("link").href = ins | |
| 214 | - $i("link").innerHTML = ins | |
| 215 | -} | |
| 216 | -/* | |
| 217 | -Function: i3geo_gl_pegagrupos | |
| 218 | - | |
| 219 | -Pega a lista de grupos existentes no menu de temas do i3geo. | |
| 220 | -*/ | |
| 221 | -function i3geo_gl_pegagrupos() | |
| 222 | -{ | |
| 223 | - var p = "classesphp/mapa_controle.php?funcao=pegalistadegrupos&map_file=''"; | |
| 224 | - var cp = new cpaint(); | |
| 225 | - //cp.set_debug(2) | |
| 226 | - cp.set_response_type("JSON"); | |
| 227 | - cp.call(p,"pegalistadegrupos",combogrupos); | |
| 228 | -} | |
| 229 | -/* | |
| 230 | -Function: combogrupos | |
| 231 | - | |
| 232 | -Monta um combo com a lista de grupos. | |
| 233 | -*/ | |
| 234 | -function combogrupos(retorno) | |
| 235 | -{ | |
| 236 | - obGrupos = retorno.data | |
| 237 | - var ins = "<select style=width:250px onchange='combosubgrupos(this.value)' ><option value='' >Escolha um grupo:</option>" | |
| 238 | - for (ig=0;ig<obGrupos.grupos.length; ig++) | |
| 239 | - { | |
| 240 | - if(obGrupos.grupos[ig].nome) | |
| 241 | - ins += "<option value="+ig+" >"+obGrupos.grupos[ig].nome+"</option>" | |
| 242 | - } | |
| 243 | - $i("grupos").innerHTML = ins+"</select>" | |
| 244 | - combosubgrupos(-1) | |
| 245 | -} | |
| 246 | -/* | |
| 247 | -Function: combosubgrupos | |
| 248 | - | |
| 249 | -Monta um combo com a lista de subgrupos de um grupo. | |
| 250 | - | |
| 251 | -Chamado pela função combogrupos. | |
| 116 | +Veja: | |
| 252 | 117 | |
| 253 | -Parameters: | |
| 254 | - | |
| 255 | -i - id que identifica o grupo escolhido. | |
| 256 | -*/ | |
| 257 | -function combosubgrupos(i) | |
| 258 | -{ | |
| 259 | - var ins = "<select style=width:250px onchange='combotemas("+i+",this.value)' ><option value='' >Escolha um sub-grupo:</option>" | |
| 260 | - if (obGrupos.grupos[i]) | |
| 261 | - { | |
| 262 | - for (ig=0;ig<obGrupos.grupos[i].subgrupos.length; ig++) | |
| 263 | - { | |
| 264 | - ins += "<option value="+ig+" >"+obGrupos.grupos[i].subgrupos[ig].nome+"</option>" | |
| 265 | - } | |
| 266 | - } | |
| 267 | - $i("subgrupos").innerHTML = ins+"</select>" | |
| 268 | - combotemasgrupo(i) | |
| 269 | -} | |
| 270 | -/* | |
| 271 | -Function: combotemasgrupo | |
| 272 | - | |
| 273 | -Monta um combo com a lista de temas vinculados diretamente a um grupo. | |
| 274 | - | |
| 275 | -Chamado pela função combosubgrupos. | |
| 276 | - | |
| 277 | -Parameters: | |
| 278 | - | |
| 279 | -i - id que identifica o grupo escolhido. | |
| 280 | -*/ | |
| 281 | -function combotemasgrupo(i) | |
| 282 | -{ | |
| 283 | - var ins = "<select style=width:250px MULTIPLE SIZE=10 onchange=i3geo_gl_seltema(this.value) ><option value='' >Clique no tema para incluir:</option>" | |
| 284 | - if (obGrupos.grupos[i]) | |
| 285 | - { | |
| 286 | - for (ig=0;ig<obGrupos.grupos[i].temasgrupo.length; ig++) | |
| 287 | - { | |
| 288 | - ins += "<option value="+obGrupos.grupos[i].temasgrupo[ig].tid+" >"+obGrupos.grupos[i].temasgrupo[ig].nome+"</option>" | |
| 289 | - } | |
| 290 | - } | |
| 291 | - $i("temas").innerHTML = ins+"</select>" | |
| 292 | -} | |
| 293 | -/* | |
| 294 | -Function: combotemas | |
| 118 | +<i3geo/classesjs/geradordelinks.js> | |
| 295 | 119 | |
| 296 | -Monta um combo com a lista de temas ligados a um sub-grupo. | |
| 297 | - | |
| 298 | -Parameters: | |
| 299 | - | |
| 300 | -grupo - id que identifica um grupo | |
| 301 | - | |
| 302 | -sub - id que identifica um subgrupo | |
| 303 | -*/ | |
| 304 | -function combotemas(grupo,sub) | |
| 305 | -{ | |
| 306 | - var monta = function(retorno) | |
| 307 | - { | |
| 308 | - var ins = "<select style=width:250px MULTIPLE SIZE=10 onchange=i3geo_gl_seltema(this.value) ><option value='' >Clique no tema para incluir:</option>" | |
| 309 | - for (ig=0;ig<retorno.data.temas.length; ig++) | |
| 310 | - { | |
| 311 | - ins += "<option value="+retorno.data.temas[ig].tid+" >"+retorno.data.temas[ig].nome+"</option>" | |
| 312 | - } | |
| 313 | - $i("temas").innerHTML = ins+"</select>" | |
| 314 | - } | |
| 315 | - var p = "classesphp/mapa_controle.php?funcao=pegalistadetemas&map_file=''&grupo="+grupo+"&subgrupo="+sub; | |
| 316 | - var cp = new cpaint(); | |
| 317 | - //cp.set_debug(2) | |
| 318 | - cp.set_response_type("JSON"); | |
| 319 | - cp.call(p,"pegalistadetemas",monta); | |
| 320 | -} | |
| 321 | -/* | |
| 322 | -Function i3geo_gl_seltema | |
| 323 | - | |
| 324 | -Acrescenta um tema no link. | |
| 325 | - | |
| 326 | -Além de acrescentar o tema no link, o tema é acrescentado na lista de gerenciamento dos temas já escolhidos. | |
| 327 | - | |
| 328 | -Parameters: | |
| 329 | - | |
| 330 | -idtema - codigo do tema que será crescentado | |
| 331 | -*/ | |
| 332 | -function i3geo_gl_seltema(idtema) | |
| 333 | -{ | |
| 334 | - var novodiv = document.createElement("div"); | |
| 335 | - novodiv.style.textAlign="left" | |
| 336 | - novodiv.id = idtema | |
| 337 | - $i("temasa").appendChild(novodiv); | |
| 338 | - var novoel = document.createElement("img"); | |
| 339 | - novoel.title = "excluir" | |
| 340 | - novoel.onclick = excluir | |
| 341 | - novoel.src = "imagens/x.png" | |
| 342 | - novodiv.appendChild(novoel); | |
| 343 | - var novoel = document.createElement("img"); | |
| 344 | - novoel.title = "subir" | |
| 345 | - novoel.src = "imagens/sobe.gif" | |
| 346 | - novoel.onclick = subir | |
| 347 | - novodiv.appendChild(novoel); | |
| 348 | - var novoel = document.createElement("img"); | |
| 349 | - novoel.title = "descer" | |
| 350 | - novoel.src = "imagens/desce.gif" | |
| 351 | - novoel.onclick = descer | |
| 352 | - novodiv.appendChild(novoel); | |
| 353 | - var novoel = document.createElement("input"); | |
| 354 | - novoel.onclick = i3geo_gl_crialink | |
| 355 | - novoel.title = "visível/não visível" | |
| 356 | - novoel.type = "checkbox" | |
| 357 | - novoel.style.cursor="pointer" | |
| 358 | - novoel.style.top="3px" | |
| 359 | - novoel.style.position="relative" | |
| 360 | - novoel.style.border="0px" | |
| 361 | - novoel.value=idtema | |
| 362 | - novodiv.appendChild(novoel); | |
| 363 | - var novoel = document.createElement("span"); | |
| 364 | - novoel.innerHTML = idtema | |
| 365 | - novodiv.appendChild(novoel); | |
| 366 | - novodiv.appendChild(document.createElement("br")); | |
| 367 | - i3geo_gl_crialink() | |
| 368 | -} | |
| 369 | -/* | |
| 370 | -Function: descer | |
| 371 | - | |
| 372 | -Desce um tema na lista de temas selecionados. | |
| 373 | - | |
| 374 | -Parameters: | |
| 375 | - | |
| 376 | -e - elemento do DOM. | |
| 377 | -*/ | |
| 378 | -function descer(e) | |
| 379 | -{ | |
| 380 | - var pai = pegaElementoPai(e) | |
| 381 | - divpai = pai.parentNode | |
| 382 | - if(pai.nextSibling) | |
| 383 | - divpai.insertBefore(pai,pai.nextSibling.nextSibling) | |
| 384 | - i3geo_gl_crialink() | |
| 385 | -} | |
| 386 | -/* | |
| 387 | -Function: subir | |
| 388 | - | |
| 389 | -Sobe um tema na lista de temas selecionados | |
| 390 | - | |
| 391 | -Parameters: | |
| 392 | - | |
| 393 | -e - elemento do DOM. | |
| 394 | -*/ | |
| 395 | -function subir(e) | |
| 396 | -{ | |
| 397 | - var pai = pegaElementoPai(e) | |
| 398 | - divpai = pai.parentNode | |
| 399 | - divpai.insertBefore(pai,pai.previousSibling) | |
| 400 | - i3geo_gl_crialink() | |
| 401 | -} | |
| 402 | -/* | |
| 403 | -Function: excluir | |
| 404 | - | |
| 405 | -Exclui um tema da lista de temas selecionados | |
| 406 | - | |
| 407 | -Parameters: | |
| 408 | - | |
| 409 | -e - elemento do DOM. | |
| 410 | -*/ | |
| 411 | -function excluir(e) | |
| 412 | -{ | |
| 413 | - var pai = pegaElementoPai(e) | |
| 414 | - pai.parentNode.removeChild(pai) | |
| 415 | - i3geo_gl_crialink() | |
| 416 | -} | |
| 417 | -/* | |
| 418 | -Function: pegaElementoPai | |
| 419 | - | |
| 420 | -Pega o elemento pai de um elemento clicado para identificar o código do tema. | |
| 421 | - | |
| 422 | -Parameters: | |
| 423 | - | |
| 424 | -e - elemento do DOM. | |
| 425 | -*/ | |
| 426 | -function pegaElementoPai(e) | |
| 427 | -{ | |
| 428 | - var targ | |
| 429 | - if (!e) var e = window.event | |
| 430 | - if (e.target) targ = e.target | |
| 431 | - else if (e.srcElement) targ = e.srcElement | |
| 432 | - if (targ.nodeType == 3) // defeat Safari bug | |
| 433 | - targ = targ.parentNode | |
| 434 | - var tname | |
| 435 | - tparent=targ.parentNode | |
| 436 | - return(tparent) | |
| 437 | -} | |
| 438 | -/* | |
| 439 | -Function: i3geo_gl_init | |
| 440 | - | |
| 441 | -Inicialliza o OpenLayers para permitir ao usuário escolher a abrangência espacial do link. | |
| 442 | -*/ | |
| 443 | -function i3geo_gl_init() | |
| 444 | -{ | |
| 445 | - $i("mapa1").style.display = "block"; | |
| 446 | - OL = new OpenLayers.Map('mapa1',{controls:[],numZoomLevels: 13}); | |
| 447 | - // | |
| 448 | - //layers | |
| 449 | - // | |
| 450 | - var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0",{layers: 'basic'},{isBaseLayer: true} ); | |
| 451 | - ol_wms.setVisibility(true); | |
| 452 | - OL.addLayer(ol_wms); | |
| 453 | - var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic","http://wms.jpl.nasa.gov/wms.cgi", {layers: "global_mosaic"},{isBaseLayer: false}); | |
| 454 | - jpl_wms.setVisibility(false); | |
| 455 | - OL.addLayer(jpl_wms); | |
| 456 | - var base = new OpenLayers.Layer.WMS( "Cartografia", "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",{layers:'baseraster',transparent:'true',format:'image/png'},{isBaseLayer:false}); | |
| 457 | - base.setVisibility(false); | |
| 458 | - OL.addLayer(base); | |
| 459 | - // | |
| 460 | - //zoom e controle de layers | |
| 461 | - // | |
| 462 | - var ls = new OpenLayers.Control.LayerSwitcher() | |
| 463 | - OL.addControl(ls); | |
| 464 | - $i(ls.id).style.zIndex=2000; | |
| 465 | - OL.setCenter(new OpenLayers.LonLat(-55,-14), 2); | |
| 466 | - var panel = new OpenLayers.Control.NavToolbar(); | |
| 467 | - OL.addControl(panel); | |
| 468 | - panel.div.style.left="-4px"; | |
| 469 | - panel.div.style.top="-298px"; | |
| 470 | - var zb = new OpenLayers.Control.PanZoomBar(); | |
| 471 | - OL.addControl(zb); | |
| 472 | - $i("OpenLayers_Control_PanZoom_pandown").style.display="none" | |
| 473 | - $i("OpenLayers_Control_PanZoom_panup").style.display="none" | |
| 474 | - $i("OpenLayers_Control_PanZoom_panleft").style.display="none" | |
| 475 | - $i("OpenLayers_Control_PanZoom_panright").style.display="none" | |
| 476 | - zb.div.style.left="-8px" | |
| 477 | -} | |
| 478 | -/* | |
| 479 | -Function: capturageo | |
| 120 | +File: i3geo/geradordelinks.htm | |
| 480 | 121 | |
| 481 | -Pega as coordenadas geográficas da extensão definida no OpenLayers. | |
| 482 | 122 | */ |
| 483 | -function capturageo() | |
| 484 | -{ | |
| 485 | - var b = OL.getExtent(); | |
| 486 | - $i("xmin").value = b.left | |
| 487 | - $i("xmax").value = b.right | |
| 488 | - $i("ymin").value = b.bottom | |
| 489 | - $i("ymax").value = b.top | |
| 490 | - i3geo_gl_crialink() | |
| 491 | -} | |
| 123 | +var g_locaplic = "http://"+window.location.host+"/i3geo"; | |
| 124 | +var i3geo_gl_configura = new i3geo_gl_configura( | |
| 125 | + "http://localhost/i3geo", | |
| 126 | + "estadosl", | |
| 127 | + "temasa", | |
| 128 | + "link", | |
| 129 | + "grupos", | |
| 130 | + "subgrupos", | |
| 131 | + "temas", | |
| 132 | + "buscageo" | |
| 133 | + ) | |
| 134 | +i3geo_gl_inicia(i3geo_gl_configura) | |
| 492 | 135 | </script> |
| 493 | 136 | </html> | ... | ... |