Commit 7caf825c1aeb6641c6c8e8fd9dbaf73f0ba52d86
1 parent
ca601577
Exists in
master
and in
7 other branches
inclusão da opção de cruzamento da nuvem de tags com rss
Showing
4 changed files
with
62 additions
and
12 deletions
Show diff stats
classesphp/classe_menutemas.php
... | ... | @@ -643,9 +643,9 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. |
643 | 643 | foreach ( simplexml_load_file ($rss)->channel->item as $item ) |
644 | 644 | { |
645 | 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 | 647 | $conta++; |
648 | - } | |
648 | + } | |
649 | 649 | } |
650 | 650 | $this->xml = array(); |
651 | 651 | if (file_exists("../ms_configura.php")) |
... | ... | @@ -715,15 +715,19 @@ rss - (opcional) endereço de um RSS para cruzar com as tags. |
715 | 715 | { |
716 | 716 | $resultado[$tag] = array($tid); |
717 | 717 | //busca noticias |
718 | - if($rrs != "") | |
718 | + if(count($noticiasRSS) > 0) | |
719 | 719 | { |
720 | 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 | 724 | if(in_array(strtolower($t),$titulo)) |
725 | 725 | { |
726 | + //echo $noticia["link"]."<br>"; | |
727 | + if(!$noticias[$tag]) | |
726 | 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 | 748 | ksort($resultado); |
745 | 749 | foreach(array_keys($resultado) as $k) |
746 | 750 | { |
751 | + | |
747 | 752 | if($noticias[$k]) |
748 | - {$not = $noticias[$k];} | |
753 | + {$not = array($noticias[$k]);} | |
749 | 754 | else |
750 | - {$not = "";} | |
755 | + {$not = array();} | |
751 | 756 | $final[] = array("tag"=>$k,"temas"=>$resultado[$k],"noticias"=>$not); |
752 | 757 | } |
753 | 758 | return ($final); | ... | ... |
ferramentas/nuvemtags/index.htm
... | ... | @@ -8,7 +8,20 @@ |
8 | 8 | <title></title> |
9 | 9 | </head> |
10 | 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ê pode cruzar a nuvem de tags com um RSS de notícias. Digite abaixo o endereç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 | 25 | <script src="../i3geo_tudo_compacto.js.php" type="text/javascript"></script> |
13 | 26 | <script language="JavaScript" type="text/javascript" src="index.js"></script> |
14 | 27 | </body> | ... | ... |
ferramentas/nuvemtags/index.js
... | ... | @@ -20,6 +20,12 @@ Free Software Foundation, Inc., no endereço |
20 | 20 | 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. |
21 | 21 | */ |
22 | 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 | 29 | aguarde("block") |
24 | 30 | parametrosURL() |
25 | 31 | inicio = 0; |
... | ... | @@ -35,9 +41,23 @@ function montaNuvem(r) |
35 | 41 | { |
36 | 42 | if(retorno.data[i].temas.length*1 >= inicio) |
37 | 43 | { |
44 | + var cor = "98,186,192"; | |
38 | 45 | var h = retorno.data[i].temas.length*1 + 6 |
39 | 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 | 66 | $i("resultado").innerHTML = tags; |
47 | 67 | aguarde("none") |
48 | 68 | } |
49 | - | |
50 | 69 | //pega a lista de tags |
51 | 70 | $i("resultado").innerHTML = "Aguarde..."; |
52 | 71 | var cp = new cpaint(); |
53 | 72 | cp.set_response_type("JSON"); |
54 | 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 | 75 | cp.call(p,"listaTags",montaNuvem); |
57 | 76 | |
58 | 77 | function procurar(texto) |
... | ... | @@ -62,4 +81,17 @@ function procurar(texto) |
62 | 81 | window.parent.document.getElementById("buscatema").value = texto.innerHTML |
63 | 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 | 98 | \ No newline at end of file | ... | ... |