diff --git a/admin/admin.db b/admin/admin.db index 44e4387..7d9f7bf 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/admin/imagens/bookmarks.png b/admin/imagens/bookmarks.png new file mode 100644 index 0000000..cf3a425 Binary files /dev/null and b/admin/imagens/bookmarks.png differ diff --git a/admin/js/editormapfile.js b/admin/js/editormapfile.js index 786a34b..1e69e89 100644 --- a/admin/js/editormapfile.js +++ b/admin/js/editormapfile.js @@ -32,7 +32,7 @@ i3geo/admin/js/editormapfile.js contaN = 0; -//TODO incluir favoritos +favoritosNode = ""; objcontype = [ {texto:"MS_INLINE",valor:"0"}, {texto:"MS_SHAPEFILE",valor:"1"}, @@ -215,34 +215,28 @@ Monta a árvore */ -function montaArvore() -{ - YAHOO.example.treeExample = new function() - { +function montaArvore(){ + YAHOO.example.treeExample = new function(){ tree = ""; - function changeIconMode() - {buildTree();} - function loadNodeData(node, fnLoadComplete) - { + function changeIconMode(){ + buildTree(); + } + function loadNodeData(node, fnLoadComplete){ if(node.data.codigoMap == undefined){ fnLoadComplete.call(); return; } var sUrl = "../php/editormapfile.php?funcao=pegaLayers&codigoMap="+node.data.codigoMap; - var callback = - { - success: function(oResponse) - { + var callback = { + success: function(oResponse){ var dados = YAHOO.lang.JSON.parse(oResponse.responseText); montaRaizTema(node,dados); oResponse.argument.fnLoadComplete(); }, - failure: function(oResponse) - { + failure: function(oResponse){ oResponse.argument.fnLoadComplete(); }, - argument: - { + argument: { "node": node, "fnLoadComplete": fnLoadComplete }, @@ -250,11 +244,12 @@ function montaArvore() }; YAHOO.util.Connect.asyncRequest('GET', sUrl, callback); } - function buildTree() - { + function buildTree(){ tree = new YAHOO.widget.TreeView("tabela"); tree.setDynamicLoad(loadNodeData, 0); var root = tree.getRoot(); + favoritosNode = new YAHOO.widget.TextNode('Favoritos', root, true); + favoritosNode.isLeaf = false; if(letraAtual == ""){ var tempNode = new YAHOO.widget.TextNode('Todos', root, false); tempNode.isLeaf = true; @@ -268,54 +263,117 @@ function montaArvore() } buildTree(); }(); - montaNosRaiz("nao"); + montaFavoritos(); + montaNosRaiz("nao"); + tree.draw(); +} +favoritosArray = []; +retornaFavoritosArray(); +function retornaFavoritosArray(){ + var temp = i3GEO.util.pegaCookie("I3GEOfavoritosEditorMapfile"); + if(temp){ + favoritosArray = temp.split(","); + } + else{ + favoritosArray = []; + } + return favoritosArray; +} +function registraFavoritos(codigoTema){ + favoritosArray.remove(codigoTema); + favoritosArray.push(codigoTema); + i3GEO.util.insereCookie("I3GEOfavoritosEditorMapfile", favoritosArray.toString(",")); + montaFavoritos(); + tree.draw(); +} +function removeFavoritos(codigoTema,redesenha){ + var temp = tree.getNodeByProperty("id",codigoTema+"favorito"); + if(temp){ + tree.removeNode(temp); + } + favoritosArray.remove(codigoTema); + i3GEO.util.insereCookie("I3GEOfavoritosEditorMapfile", favoritosArray.toString(",")); + if(redesenha){ tree.draw(); + } } -function montaNosRaiz(redesenha) -{ - var root = tree.getRoot(); - var nos = new Array(); - var conteudo = ""; +function montaFavoritos(){ + var mapfile, i, j, conteudo, iconePlus, d, tempNode; + for (i=0, j=$mapfiles.length; i"; + } + + i = "margin-left:2px;width:12px;position:relative;cursor:pointer;top:2px"; + conteudo += " "; + conteudo += " "; + if(i3GEO.util.in_array(mapfile.codigo,favoritosArray)){ + conteudo += " "; + } + else{ + conteudo += " "; + } + if(iconePlus){ + conteudo += " "; + } + conteudo += " "; + conteudo += " "; + if(iconePlus){ + conteudo += " "; + } + //opcao de download se for gvsig + if(mapfile.extensao === "gvp"){ + conteudo += " "; + } + if(mapfile.extensao === "map" || mapfile.extensao === "gvp"){ + conteudo += " "; + conteudo += " "; + } + conteudo += " "; + conteudo += " "; + conteudo += " "+mapfile.codigo+" "+mapfile.nome+""; + conteudo += "
"; + if(mapfile.imagem != "" && $i("mostraMini").checked == true){ + conteudo += "
"; + } + return conteudo; +} +function montaNosRaiz(redesenha){ + var root = tree.getRoot(), nos = new Array(), conteudo = "", iconePlus = true; for (var i=0, j=$mapfiles.length; i"; - } - conteudo += " "; - conteudo += " "; - if(iconePlus){ - conteudo += " "; - } - conteudo += " "; - conteudo += " "; - if(iconePlus){ - conteudo += " "; - } - //opcao de download se for gvsig - if($mapfiles[i].extensao === "gvp"){ - conteudo += " "; - } - if($mapfiles[i].extensao === "map" || $mapfiles[i].extensao === "gvp"){ - conteudo += " "; - conteudo += " "; - } - conteudo += " "; - conteudo += " "; - conteudo += " "+$mapfiles[i].codigo+" "+$mapfiles[i].nome+""; - conteudo += "
"; - if($mapfiles[i].imagem != "" && $i("mostraMini").checked == true){ - conteudo += "
"; } + conteudo = montaTextoTemaMapfile($mapfiles[i]); var d = {html:conteudo,tipo:"mapfile",id_tema:$mapfiles[i].id_tema,id:$mapfiles[i].codigo,codigoMap:$mapfiles[i].codigo}; var tempNode = new YAHOO.widget.HTMLNode(d, root, false,iconePlus); tempNode.enableHighlight = false; nos.push(tempNode); } - if(redesenha=="sim") - tree.draw(); + if(redesenha=="sim"){ + tree.draw(); + } return nos; } function testarMapfileRapido(codigoMap,extensao) @@ -541,6 +599,7 @@ Exclui um mapfile */ function excluirMapfile(codigoMap) { + removeFavoritos(codigoMap,false); var mensagem = " excluindo "+codigoMap; var no = tree.getNodeByProperty("id",codigoMap); var sUrl = "../php/editormapfile.php?funcao=excluirMapfile&codigoMap="+codigoMap; -- libgit2 0.21.2