From 7caf825c1aeb6641c6c8e8fd9dbaf73f0ba52d86 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 8 Jul 2008 15:19:02 +0000 Subject: [PATCH] inclusão da opção de cruzamento da nuvem de tags com rss --- classesphp/classe_menutemas.php | 19 ++++++++++++------- ferramentas/nuvemtags/index.htm | 15 ++++++++++++++- ferramentas/nuvemtags/index.js | 38 +++++++++++++++++++++++++++++++++++--- ferramentas/wiki/funcoes.php | 2 +- 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/classesphp/classe_menutemas.php b/classesphp/classe_menutemas.php index 65164e2..7e78490 100644 --- a/classesphp/classe_menutemas.php +++ b/classesphp/classe_menutemas.php @@ -643,9 +643,9 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. foreach ( simplexml_load_file ($rss)->channel->item as $item ) { if($conta < 20) - $noticiasRSS[] = array("desc"=>$item->description,"titulo"=>$item->title,"link"=>$item->link); + $noticiasRSS[] = array("desc"=>(ixml($item,"description")),"titulo"=>(ixml($item,"title")),"link"=>(ixml($item,"link"))); $conta++; - } + } } $this->xml = array(); if (file_exists("../ms_configura.php")) @@ -715,15 +715,19 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. { $resultado[$tag] = array($tid); //busca noticias - if($rrs != "") + if(count($noticiasRSS) > 0) { foreach($noticiasRSS as $noticia) { - $titulo = explode(" ",strtolower(removeAcentos($noticia["desc"]))); - $t = removeAcentos($tag); + $titulo = explode(" ",strtolower($this->removeAcentos($noticia["desc"]))); + $t = $this->removeAcentos($tag); if(in_array(strtolower($t),$titulo)) { + //echo $noticia["link"]."
"; + if(!$noticias[$tag]) $noticias[$tag] = array("titulo"=>$noticia["titulo"],"link"=>$noticia["link"]); + else + $noticias[$tag] = array_merge($noticias[$tag],array("titulo"=>$noticia["titulo"],"link"=>$noticia["link"])); } } } @@ -744,10 +748,11 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. ksort($resultado); foreach(array_keys($resultado) as $k) { + if($noticias[$k]) - {$not = $noticias[$k];} + {$not = array($noticias[$k]);} else - {$not = "";} + {$not = array();} $final[] = array("tag"=>$k,"temas"=>$resultado[$k],"noticias"=>$not); } return ($final); diff --git a/ferramentas/nuvemtags/index.htm b/ferramentas/nuvemtags/index.htm index 8f8b1a3..cf648c2 100644 --- a/ferramentas/nuvemtags/index.htm +++ b/ferramentas/nuvemtags/index.htm @@ -8,7 +8,20 @@ -
Aguarde...
+
+ Você pode cruzar a nuvem de tags com um RSS de notícias. Digite abaixo o endereço do RSS: + + + + + +
+ + +
+
+
+
Aguarde...
diff --git a/ferramentas/nuvemtags/index.js b/ferramentas/nuvemtags/index.js index 10cb5ed..d20fb6d 100644 --- a/ferramentas/nuvemtags/index.js +++ b/ferramentas/nuvemtags/index.js @@ -20,6 +20,12 @@ Free Software Foundation, Inc., no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. */ //inicializa +YAHOO.example.init = function () +{ + function onPushButtonsMarkupReady() + {new YAHOO.widget.Button("botao1");} + YAHOO.util.Event.onContentReady("botao1", onPushButtonsMarkupReady); +}() aguarde("block") parametrosURL() inicio = 0; @@ -35,9 +41,23 @@ function montaNuvem(r) { if(retorno.data[i].temas.length*1 >= inicio) { + var cor = "98,186,192"; var h = retorno.data[i].temas.length*1 + 6 if(h > 23){var h = 23;} - tags += " "+retorno.data[i].tag+"" + { + var linkrss = ""; + if(retorno.data[i].noticias.length > 0) + { + var cor = "255,0,0"; + for (r=0;r" ; + } + + } + + tags += " "+retorno.data[i].tag+""+linkrss + } } } } @@ -46,13 +66,12 @@ function montaNuvem(r) $i("resultado").innerHTML = tags; aguarde("none") } - //pega a lista de tags $i("resultado").innerHTML = "Aguarde..."; var cp = new cpaint(); cp.set_response_type("JSON"); //cp.set_debug(2) -var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=listaTags&sid="+g_sid; +var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=listaTags&rss=&g_sid="+g_sid; cp.call(p,"listaTags",montaNuvem); function procurar(texto) @@ -62,4 +81,17 @@ function procurar(texto) window.parent.document.getElementById("buscatema").value = texto.innerHTML window.parent.procurartemas() } +} + +function buscarss() +{ + var rss = $i("texto").value + if (rss == ""){alert("Digite um endereco RSS");return;} + aguarde("block") + $i("resultado").innerHTML = "Aguarde..."; + var cp = new cpaint(); + cp.set_response_type("JSON"); + //cp.set_debug(2) + var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=listaTags&g_sid="+g_sid+"&rss="+rss; + cp.call(p,"listaTags",montaNuvem); } \ No newline at end of file diff --git a/ferramentas/wiki/funcoes.php b/ferramentas/wiki/funcoes.php index cb7865b..61f33db 100644 --- a/ferramentas/wiki/funcoes.php +++ b/ferramentas/wiki/funcoes.php @@ -1,6 +1,6 @@