Commit 7caf825c1aeb6641c6c8e8fd9dbaf73f0ba52d86

Authored by Edmar Moretti
1 parent ca601577

inclusão da opção de cruzamento da nuvem de tags com rss

classesphp/classe_menutemas.php
@@ -643,9 +643,9 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. @@ -643,9 +643,9 @@ rss - (opcional) endereço de um RSS para cruzar com as tags.
643 foreach ( simplexml_load_file ($rss)->channel->item as $item ) 643 foreach ( simplexml_load_file ($rss)->channel->item as $item )
644 { 644 {
645 if($conta < 20) 645 if($conta < 20)
646 - $noticiasRSS[] = array("desc"=>$item->description,"titulo"=>$item->title,"link"=>$item->link); 646 + $noticiasRSS[] = array("desc"=>(ixml($item,"description")),"titulo"=>(ixml($item,"title")),"link"=>(ixml($item,"link")));
647 $conta++; 647 $conta++;
648 - } 648 + }
649 } 649 }
650 $this->xml = array(); 650 $this->xml = array();
651 if (file_exists("../ms_configura.php")) 651 if (file_exists("../ms_configura.php"))
@@ -715,15 +715,19 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. @@ -715,15 +715,19 @@ rss - (opcional) endereço de um RSS para cruzar com as tags.
715 { 715 {
716 $resultado[$tag] = array($tid); 716 $resultado[$tag] = array($tid);
717 //busca noticias 717 //busca noticias
718 - if($rrs != "") 718 + if(count($noticiasRSS) > 0)
719 { 719 {
720 foreach($noticiasRSS as $noticia) 720 foreach($noticiasRSS as $noticia)
721 { 721 {
722 - $titulo = explode(" ",strtolower(removeAcentos($noticia["desc"])));  
723 - $t = removeAcentos($tag); 722 + $titulo = explode(" ",strtolower($this->removeAcentos($noticia["desc"])));
  723 + $t = $this->removeAcentos($tag);
724 if(in_array(strtolower($t),$titulo)) 724 if(in_array(strtolower($t),$titulo))
725 { 725 {
  726 + //echo $noticia["link"]."<br>";
  727 + if(!$noticias[$tag])
726 $noticias[$tag] = array("titulo"=>$noticia["titulo"],"link"=>$noticia["link"]); 728 $noticias[$tag] = array("titulo"=>$noticia["titulo"],"link"=>$noticia["link"]);
  729 + else
  730 + $noticias[$tag] = array_merge($noticias[$tag],array("titulo"=>$noticia["titulo"],"link"=>$noticia["link"]));
727 } 731 }
728 } 732 }
729 } 733 }
@@ -744,10 +748,11 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. @@ -744,10 +748,11 @@ rss - (opcional) endereço de um RSS para cruzar com as tags.
744 ksort($resultado); 748 ksort($resultado);
745 foreach(array_keys($resultado) as $k) 749 foreach(array_keys($resultado) as $k)
746 { 750 {
  751 +
747 if($noticias[$k]) 752 if($noticias[$k])
748 - {$not = $noticias[$k];} 753 + {$not = array($noticias[$k]);}
749 else 754 else
750 - {$not = "";} 755 + {$not = array();}
751 $final[] = array("tag"=>$k,"temas"=>$resultado[$k],"noticias"=>$not); 756 $final[] = array("tag"=>$k,"temas"=>$resultado[$k],"noticias"=>$not);
752 } 757 }
753 return ($final); 758 return ($final);
ferramentas/nuvemtags/index.htm
@@ -8,7 +8,20 @@ @@ -8,7 +8,20 @@
8 <title></title> 8 <title></title>
9 </head> 9 </head>
10 <body class="yui-skin-sam;" style="overflow:auto;"> 10 <body class="yui-skin-sam;" style="overflow:auto;">
11 - <div style="top:2px;left:5px;display:block;width:90%" id="resultado" >Aguarde...</div> 11 + <div style="width:95%;top:5px;left:0px">
  12 + Voc&ecirc; pode cruzar a nuvem de tags com um RSS de notícias. Digite abaixo o endere&ccedil;o do RSS:
  13 + <table class=lista >
  14 + <tr>
  15 + <td>
  16 + <input size=45 class=digitar type=text value="" id=texto />
  17 + </td>
  18 + <td>
  19 + <div onclick='buscarss()' style='text-align:left;left:0px'><input id=botao1 size=18 class=executar type='buttom' value='Cruzar' /></div>
  20 + </td>
  21 + </tr>
  22 + </table>
  23 + </div>
  24 + <br><div style="top:2px;left:5px;display:block;width:90%" id="resultado" >Aguarde...</div>
12 <script src="../i3geo_tudo_compacto.js.php" type="text/javascript"></script> 25 <script src="../i3geo_tudo_compacto.js.php" type="text/javascript"></script>
13 <script language="JavaScript" type="text/javascript" src="index.js"></script> 26 <script language="JavaScript" type="text/javascript" src="index.js"></script>
14 </body> 27 </body>
ferramentas/nuvemtags/index.js
@@ -20,6 +20,12 @@ Free Software Foundation, Inc., no endereço @@ -20,6 +20,12 @@ Free Software Foundation, Inc., no endereço
20 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. 20 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
21 */ 21 */
22 //inicializa 22 //inicializa
  23 +YAHOO.example.init = function ()
  24 +{
  25 + function onPushButtonsMarkupReady()
  26 + {new YAHOO.widget.Button("botao1");}
  27 + YAHOO.util.Event.onContentReady("botao1", onPushButtonsMarkupReady);
  28 +}()
23 aguarde("block") 29 aguarde("block")
24 parametrosURL() 30 parametrosURL()
25 inicio = 0; 31 inicio = 0;
@@ -35,9 +41,23 @@ function montaNuvem(r) @@ -35,9 +41,23 @@ function montaNuvem(r)
35 { 41 {
36 if(retorno.data[i].temas.length*1 >= inicio) 42 if(retorno.data[i].temas.length*1 >= inicio)
37 { 43 {
  44 + var cor = "98,186,192";
38 var h = retorno.data[i].temas.length*1 + 6 45 var h = retorno.data[i].temas.length*1 + 6
39 if(h > 23){var h = 23;} 46 if(h > 23){var h = 23;}
40 - tags += "<span> </span> <span onmouseout='this.style.textDecoration=\"none\"' onmouseover='this.style.textDecoration=\"underline\"' onclick='procurar(this)' style='cursor:pointer;vertical-align:middle;color:rgb(98,186,192);font-size:"+h+"pt;'>"+retorno.data[i].tag+"</span>" 47 + {
  48 + var linkrss = "";
  49 + if(retorno.data[i].noticias.length > 0)
  50 + {
  51 + var cor = "255,0,0";
  52 + for (r=0;r<retorno.data[i].noticias.length;r++)
  53 + {
  54 + linkrss += "<span><a href='"+retorno.data[i].noticias[r].link+"' target=blanck ><img style=cursor:pointer src='../../imagens/mais.png' title='"+retorno.data[i].noticias[r].titulo+"'/></a></span>" ;
  55 + }
  56 +
  57 + }
  58 +
  59 + tags += "<span> </span> <span onmouseout='this.style.textDecoration=\"none\"' onmouseover='this.style.textDecoration=\"underline\"' onclick='procurar(this)' style='cursor:pointer;vertical-align:middle;color:rgb("+cor+");font-size:"+h+"pt;'>"+retorno.data[i].tag+"</span>"+linkrss
  60 + }
41 } 61 }
42 } 62 }
43 } 63 }
@@ -46,13 +66,12 @@ function montaNuvem(r) @@ -46,13 +66,12 @@ function montaNuvem(r)
46 $i("resultado").innerHTML = tags; 66 $i("resultado").innerHTML = tags;
47 aguarde("none") 67 aguarde("none")
48 } 68 }
49 -  
50 //pega a lista de tags 69 //pega a lista de tags
51 $i("resultado").innerHTML = "Aguarde..."; 70 $i("resultado").innerHTML = "Aguarde...";
52 var cp = new cpaint(); 71 var cp = new cpaint();
53 cp.set_response_type("JSON"); 72 cp.set_response_type("JSON");
54 //cp.set_debug(2) 73 //cp.set_debug(2)
55 -var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=listaTags&sid="+g_sid; 74 +var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=listaTags&rss=&g_sid="+g_sid;
56 cp.call(p,"listaTags",montaNuvem); 75 cp.call(p,"listaTags",montaNuvem);
57 76
58 function procurar(texto) 77 function procurar(texto)
@@ -62,4 +81,17 @@ function procurar(texto) @@ -62,4 +81,17 @@ function procurar(texto)
62 window.parent.document.getElementById("buscatema").value = texto.innerHTML 81 window.parent.document.getElementById("buscatema").value = texto.innerHTML
63 window.parent.procurartemas() 82 window.parent.procurartemas()
64 } 83 }
  84 +}
  85 +
  86 +function buscarss()
  87 +{
  88 + var rss = $i("texto").value
  89 + if (rss == ""){alert("Digite um endereco RSS");return;}
  90 + aguarde("block")
  91 + $i("resultado").innerHTML = "Aguarde...";
  92 + var cp = new cpaint();
  93 + cp.set_response_type("JSON");
  94 + //cp.set_debug(2)
  95 + var p = g_locaplic+"/classesphp/mapa_controle.php?funcao=listaTags&g_sid="+g_sid+"&rss="+rss;
  96 + cp.call(p,"listaTags",montaNuvem);
65 } 97 }
66 \ No newline at end of file 98 \ No newline at end of file
ferramentas/wiki/funcoes.php
1 <?php 1 <?php
2 error_reporting(0); 2 error_reporting(0);
3 -set_time_limit(600); 3 +//set_time_limit(600);
4 require_once("../../pacotes/cpaint/cpaint2.inc.php"); 4 require_once("../../pacotes/cpaint/cpaint2.inc.php");
5 require_once("../../classesphp/pega_variaveis.php"); 5 require_once("../../classesphp/pega_variaveis.php");
6 $cp = new cpaint(); 6 $cp = new cpaint();