Wiki source code of TwitterMacros

Version 13.1 by Ludovic Dubost on 2009/01/02 16:49

Show last authors
1 #**
2 * Twitter macros allowing to display twitter data
3 *#
4
5 #macro(twitter_display $list $nb $withuser)
6 {pre}
7 #foreach($msg in $list)
8 #if($velocityCount<$nb)
9 <div style="border: 0px; border-bottom:1px dashed #D2DADA;">
10 #if($withuser)<a href="$msg.user.URL">$msg.user.name</a>#end $msg.text
11 <span style="color: #A2AAAA; font-size: 10px;">$xwiki.formatDate($msg.createdAt) #if($msg.source!="")from $msg.source #end</span>
12 </div>
13 #end
14 #end
15 {/pre}
16 #end
17
18
19 #macro(twitter_search $text $nb)
20 #if(!$twitter)
21 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy"))
22 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008"))
23 #end
24 #twitter_display($tg.search($text) $nb true)
25 #end
26
27 #macro(twitter_user $user $nb)
28 #if(!$twitter)
29 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy"))
30 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008"))
31 #end
32 #twitter_display($twitter.getUserTimeline($user) $nb false)
33 #end