function montaNoLayer(codigo,indice){ var conteudo = " "; conteudo += " "; conteudo += "  "+indice+""; var d = {html:conteudo,id:codigo+"_"+indice,codigoMap:codigo,codigoLayer:indice}; return d; } function loadLayerData(node, fnLoadComplete) { var sUrl = "../php/editormapfile.php?funcao=listaClasses&codigoMap="+node.data.codigoMap+"&codigoLayer="+node.data.codigoLayer; var callback = { success: function(oResponse) { var dados = YAHOO.lang.JSON.parse(oResponse.responseText); montaParametrosTemas(node,dados,false); oResponse.argument.fnLoadComplete(); }, failure: function(oResponse) { oResponse.argument.fnLoadComplete(); }, argument: { "node": node, "fnLoadComplete": fnLoadComplete }, timeout: 25000 }; YAHOO.util.Connect.asyncRequest('GET', sUrl, callback); } /* Function: montaParametrosTemas Complementa as opções de edição básicas de um LAYER */ function montaParametrosTemas(no,dados,redesenha) { var codigoMap = no.data.codigoMap, codigoLayer = no.data.codigoLayer, id = codigoMap+"_"+codigoLayer, conteudo = "", tempNodeR = "", tempNode = "", d; if(!tree.getNodeByProperty("etiquetaDados",id)) { conteudo = " Conexão com os dados"; d = {tipo:"etiquetaDados",etiquetaDados:id,html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); tempNode.isLeaf = true; } if(!tree.getNodeByProperty("etiquetaTitulo",id)) { conteudo = " Título, escala, extensão"; d = {tipo:"etiquetaTitulo",etiquetaTitulo:id,html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } if(!tree.getNodeByProperty("etiquetaEditavel",id)) { conteudo = " Editável (define se o tema é editável)"; d = {tipo:"etiquetaEditavel",etiquetaEditavel:id,html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } if(!tree.getNodeByProperty("etiquetaComport",id)) { conteudo = " Comportamento no mapa"; d = {tipo:"etiquetaComport",etiquetaComport:id,html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } if(!tree.getNodeByProperty("etiquetaDispo",id)) { conteudo = " Disponibilidade (download, wms,...)"; d = {tipo:"etiquetaDispo",etiquetaDispo:id,html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } //rever if(!tree.getNodeByProperty("etiquetaMetadados",id)) { conteudo = " Miscelânea"; d = {tipo:"etiquetaMetadados",etiquetaMetadados:id,html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, no, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } if(!tree.getNodeByProperty("etiquetaClasses",id)) { d = {id:id,codigoLayer:codigoLayer,tipo:"etiquetaClasses",etiquetaClasses:id,html:" Classes"}; tempNodeR = new YAHOO.widget.HTMLNode(d, no, false,true); tempNodeR.isLeaf = false; tempNodeR.enableHighlight = false; conteudo = " Adicionar uma classe"; d = {html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, tempNodeR, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; conteudo = " Criar classes automaticamente"; d = {html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, tempNodeR, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; conteudo = " Testar"; d = {html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, tempNodeR, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } for (var i=0, j=dados.length; i Plugin (só é possível ativar um plugin por LAYER)"}; tempNodeR = new YAHOO.widget.HTMLNode(d, no, false,true); tempNodeR.isLeaf = false; tempNodeR.enableHighlight = false; var temp = i3GEO.pluginI3geo.PLUGINS; for (var i=0, j=temp.length; i "+temp[i].nome + " - " + temp[i].classe+""; d = {html:conteudo}; tempNode = new YAHOO.widget.HTMLNode(d, tempNodeR, false,true); tempNode.isLeaf = true; tempNode.enableHighlight = false; } } } tree.draw(); } /** * Pega a string de definicao de um plugin no LAYER e monta o formulario * * @param plugin * @param codigoMap * @param codigoLayer */ function pegaPluginLayer(plugin,codigoMap,codigoLayer){ core_montaEditor("","450px","500px","","Plugin",true,false,false); var sUrl = "../php/editormapfile.php?funcao=pegaPlugin&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer; var montaEditorPlugin = function(retorno){ var ins = "" + ""; //pega os campos do formulario ins += i3GEO.pluginI3geo.formAdmin(plugin,retorno); var ajuda = "

Mais informações:
" + i3GEO.pluginI3geo.linkAjuda(plugin) + "

"; $i("editor_bd").innerHTML = ins + ajuda; new YAHOO.widget.Button("salvarPlugin",{ onclick: { fn: function(){ salvarDadosEditorPlugin($i("editor_bd"),plugin,codigoMap,codigoLayer); } }}); new YAHOO.widget.Button("removerPlugin",{ onclick: { fn: function(){ salvarDadosEditorPlugin($i("editor_bd"),"",codigoMap,codigoLayer); } }}); }; core_pegaDados("Obtendo dados...",sUrl,montaEditorPlugin); } /* Function: adicionaNovoLayer Adiciona um novo layer */ function adicionaNovoLayer(codigoMap) { core_carregando("ativa"); core_carregando(" adicionando um novo layer"); sUrl = "../php/editormapfile.php?funcao=criarNovoLayer&codigoMap="+codigoMap; var callback = { success:function(o) { try { if(YAHOO.lang.JSON.parse(o.responseText) == "erro") { core_carregando("Erro"); setTimeout("core_carregando('desativa')",3000); } else { var dados = YAHOO.lang.JSON.parse(o.responseText); var no = tree.getNodeByProperty("etiquetaLayers",codigoMap); var tempNode = new YAHOO.widget.HTMLNode(montaNoLayer(codigoMap,dados.layers[0]), no, false,true); tempNode.setDynamicLoad(loadLayerData, iconMode); tempNode.isLeaf = false; tempNode.enableHighlight = false; tree.draw(); //editorGeral(codigoMap,dados.layers[0]); editorTitulo(codigoMap,dados.layers[0]); core_carregando("desativa"); } } catch(e){core_handleFailure(e,o.responseText);} }, failure:core_handleFailure, argument: { foo:"foo", bar:"bar" } }; core_makeRequest(sUrl,callback); } /* Function: excluirLayer Exclui um layer */ function excluirLayer(codigoMap,codigoLayer) { var mensagem = " excluindo "+codigoLayer; var no = tree.getNodeByProperty("id",codigoMap+"_"+codigoLayer); var sUrl = "../php/editormapfile.php?funcao=excluirLayer&codigoMap="+codigoMap+"&codigoLayer="+codigoLayer; core_excluiNoTree(sUrl,no,mensagem,codigoLayer); }