From f5735d7b7b788f60e963d1a0e6760eecb3261897 Mon Sep 17 00:00:00 2001
From: Edmar Moretti
Date: Tue, 4 Nov 2008 11:09:21 +0000
Subject: [PATCH] Inclusão da janela de abertura na árvore hiperbólica para os nós do tipo TAG
---
admin/hiperbolica.php | 62 +++++++++++++++++++++++++++++++++++++++++++-------------------
admin/index.html | 1 -
admin/js/core.js | 8 +++++++-
admin/php/menutemas.php | 29 ++++++++++++++++++++++++++++-
4 files changed, 78 insertions(+), 22 deletions(-)
diff --git a/admin/hiperbolica.php b/admin/hiperbolica.php
index 134afeb..d66deb3 100644
--- a/admin/hiperbolica.php
+++ b/admin/hiperbolica.php
@@ -5,41 +5,60 @@ $xml .= "";
include("../ms_configura.php");
include("$locaplic/admin/php/admin.php");
$menus = pegaDados("SELECT * from i3geoadmin_menus order by nome_menu ",$locaplic);
-$xml .= '';
+$xml .= '';
$contador = 0;
$xml .= ' '."\n";
foreach ($menus as $menu)
{
$id = $menu["id_menu"];
- $nome = str_replace("&","&",$menu["nome_menu"]);
+ $nome = html_entity_decode($menu["nome_menu"]);
+ //menu
$xml .= ' '."\n";
$grupos = pegaDados("select i3geoadmin_grupos.nome_grupo,id_n1,id_menu from i3geoadmin_n1 LEFT JOIN i3geoadmin_grupos ON i3geoadmin_n1.id_grupo = i3geoadmin_grupos.id_grupo where id_menu='$id' order by ordem",$locaplic);
for($i=0;$i < count($grupos);++$i)
{
$contador++;
- $nome = str_replace("&","&",$grupos[$i]["nome_grupo"]);
+ $nome = html_entity_decode($grupos[$i]["nome_grupo"]);
$idgrupo = $grupos[$i]["id_n1"];
+ //grupo
$xml .= ' '."\n";
+ $contador++;
+ $xml .= ' '."\n";
+
$subgrupos = pegaDados("select i3geoadmin_subgrupos.nome_subgrupo,i3geoadmin_n2.id_n2 from i3geoadmin_n2 LEFT JOIN i3geoadmin_subgrupos ON i3geoadmin_n2.id_subgrupo = i3geoadmin_subgrupos.id_subgrupo where i3geoadmin_n2.id_n1='$idgrupo' order by ordem",$locaplic);
for($j=0;$j < count($subgrupos);++$j)
{
$contador++;
- $nome = str_replace("&","&",$subgrupos[$j]["nome_subgrupo"]);
- $xml .= ' '."\n";
+ $nome = html_entity_decode($subgrupos[$j]["nome_subgrupo"]);
+ //subgrupo
+ $xml .= ' '."\n";
+ $contador++;
+ $xml .= ' '."\n";
$id_n2 = $subgrupos[$j]["id_n2"];
- $temas = pegaDados("select i3geoadmin_temas.tags_tema,i3geoadmin_temas.nome_tema,i3geoadmin_n3.id_n3 from i3geoadmin_n3 LEFT JOIN i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema where i3geoadmin_n3.id_n2='$id_n2' order by ordem",$locaplic);
+ $temas = pegaDados("select i3geoadmin_temas.tags_tema,i3geoadmin_temas.nome_tema,i3geoadmin_temas.codigo_tema,i3geoadmin_n3.id_n3 from i3geoadmin_n3 LEFT JOIN i3geoadmin_temas ON i3geoadmin_n3.id_tema = i3geoadmin_temas.id_tema where i3geoadmin_n3.id_n2='$id_n2' order by ordem",$locaplic);
for($k=0;$k < count($temas);++$k)
{
$contador++;
- $nome = str_replace("&","&",$temas[$k]["nome_tema"]);
- $xml .= ' '."\n";
- $tags = explode(" ",$temas[$k]["tags_tema"]);
- foreach($tags as $tag)
+ $nome = html_entity_decode($temas[$k]["nome_tema"]);
+ $nid = "tema,".$temas[$k]["codigo_tema"];
+ if($nome != "")
{
+ //tema
+ $xml .= ' '."\n";
$contador++;
- $tag = str_replace("&","&",$tag);
- if($tag != "")
- $xml .= ' '."\n";
+ $tags = explode(" ",$temas[$k]["tags_tema"]);
+ if(count($tags) > 0)
+ {
+ //tags
+ $xml .= ' '."\n";
+ foreach($tags as $tag)
+ {
+ $contador++;
+ $tag = html_entity_decode($tag);
+ if($tag != "")
+ $xml .= ' '."\n";
+ }
+ }
}
}
}
@@ -52,7 +71,7 @@ $grupos = pegaDados("select i3geoadmin_grupos.nome_grupo,id_n1,id_menu from i3ge
for($i=0;$i < count($grupos);++$i)
{
$contador++;
- $nome = str_replace("&","&",$grupos[$i]["nome_grupo"]);
+ $nome = html_entity_decode($grupos[$i]["nome_grupo"]);
$idgrupo = $grupos[$i]["id_n1"];
$xml .= ' '."\n";
$temastag = pegaDados("select d.tags_tema as tags,d.id_tema as tema from i3geoadmin_n2 as b,i3geoadmin_n1 as a,i3geoadmin_n3 as c,i3geoadmin_temas as d where a.id_grupo = '$idgrupo' and a.id_n1 = b.id_n1 and c.id_n2 = b.id_n2 and c.id_tema = d.id_tema group by tema",$locaplic);
@@ -63,12 +82,17 @@ for($i=0;$i < count($grupos);++$i)
}
$arrayTag = array_unique($arrayTag);
//var_dump($arrayTag);
- foreach($arrayTag as $tag)
+ if(count($arrayTag > 0))
{
- $tag = str_replace("&","&",$tag);
$contador++;
- if($tag != "")
- $xml .= ' '."\n";
+ $xml .= ' '."\n";
+ foreach($arrayTag as $tag)
+ {
+ $tag = html_entity_decode($tag);
+ $contador++;
+ if($tag != "")
+ $xml .= ' '."\n";
+ }
}
}
$id = $contador;
@@ -82,7 +106,7 @@ foreach ($tipos as $tipo)
foreach($ws as $w)
{
$contador++;
- $nome = str_replace("&","&",$w["nome_ws"]);
+ $nome = html_entity_decode($w["nome_ws"]);
if($nome != "")
$xml .= ' '."\n";
}
diff --git a/admin/index.html b/admin/index.html
index 78bbdb3..9af046f 100644
--- a/admin/index.html
+++ b/admin/index.html
@@ -86,7 +86,6 @@ que por sua vez contém temas.
| Ajuda |
| Editar a lista de perfis |
| Editar a lista de tags (palavras-chave) |
- | Editar a lista de temas |
| Editar a árvore dos menus |
| Importar XML |
diff --git a/admin/js/core.js b/admin/js/core.js
index b870369..9236c33 100644
--- a/admin/js/core.js
+++ b/admin/js/core.js
@@ -864,6 +864,7 @@ funcaoRetorno - funcao que será executada ao terminar a busca pelos dados
*/
function core_pegaDados(mensagem,sUrl,funcaoRetorno)
{
+ if("mensagem" != "")
core_carregando(mensagem);
var callback =
{
@@ -871,7 +872,12 @@ function core_pegaDados(mensagem,sUrl,funcaoRetorno)
{
try
{eval(funcaoRetorno+"(YAHOO.lang.JSON.parse(o.responseText))");}
- catch(e){core_carregando("desativa");core_handleFailure(o,o.responseText);}
+ catch(e)
+ {
+ if("mensagem" != "")
+ core_carregando("desativa");
+ core_handleFailure(o,o.responseText);
+ }
},
failure:core_handleFailure,
argument: { foo:"foo", bar:"bar" }
diff --git a/admin/php/menutemas.php b/admin/php/menutemas.php
index 71c2fe6..de71c2c 100644
--- a/admin/php/menutemas.php
+++ b/admin/php/menutemas.php
@@ -55,6 +55,33 @@ switch ($funcao)
exit;
break;
+ case "pegaTagsPorMapfile":
+ $q = pegaDados("select link_tema,tags_tema,codigo_tema,nome_tema from i3geoadmin_temas");
+ $temas = array();
+ $temaExiste = array();
+ foreach($q as $row)
+ {
+ $ts = html_entity_decode($row['tags_tema']);
+ $i = $row['codigo_tema'];
+ $nome = $row['nome_tema'];
+ $link = $row['link_tema'];
+ $tags = explode(" ",$ts);
+ foreach($tags as $t)
+ {
+ if (removeAcentos($t) == $tag)
+ {
+ if(!isset($temaExiste[$i]))
+ {
+ $temas[] = array("codigoMap"=>$i,"nome"=>$nome,"link"=>$link);
+ $temaExiste[$i] = 0;
+ }
+ }
+ }
+ }
+ retornaJSON($temas);
+ exit;
+ break;
+
case "pegaPerfis":
$dados = pegaDados('SELECT * from i3geoadmin_perfis order by perfil');
if(count($dados) == 0){$dados = array("id_perfil"=>"","perfil"=>"");}
@@ -561,7 +588,7 @@ function alteraTags()
//exclui os registros do tag alterado nos temas
if($original != "")
{
- $q = $dbh->query("select * from i3geoadmin_temas");
+ $q = $dbh->query("select tags_tema,id_tema from i3geoadmin_temas");
foreach($q as $row)
{
$ts = $row['tags_tema'];
--
libgit2 0.21.2