Wiki source code of TwitterMacros

Version 5.1 by Ludovic Dubost on 2009/01/02 16:13

Hide last authors
Ludovic Dubost 1.1 1 #**
2 * Twitter macros allowing to display twitter data
3 *#
4
5 #macro(twitter_display $list)
6 <table>
Ludovic Dubost 2.1 7 #foreach($msg in $list)
Ludovic Dubost 1.1 8 <tr>
9 <td style="border: 0px; border-bottom:1px dashed #D2DADA;">
Ludovic Dubost 3.1 10 <a href="$msg.user.URL">$msg.user.name</a> $msg.text
Ludovic Dubost 1.1 11 <span style="color: #A2AAAA; font-size: 10px;">$xwiki.formatDate($msg.createdAt) #if($msg.source!="")from $msg.source #end</span>
12 </td>
13 </tr>
14 #end
Ludovic Dubost 2.1 15 </table>
Ludovic Dubost 1.1 16 #end
17
Ludovic Dubost 2.1 18
Ludovic Dubost 1.1 19 #macro(twitter_search $text)
Ludovic Dubost 4.1 20 #if(!$twitter)
Ludovic Dubost 1.1 21 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy"))
22 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008"))
Ludovic Dubost 4.1 23 #end
Ludovic Dubost 1.1 24 #twitter_display($tg.search($text))
25 #end
26
27 #macro(twitter_user $user)
Ludovic Dubost 4.1 28 #if(!$twitter)
Ludovic Dubost 1.1 29 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy"))
30 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008"))
Ludovic Dubost 4.1 31 #end
Ludovic Dubost 1.1 32 #twitter_display($twitter.getUserTimeline($user))
33 #end
34
35 #macro(twitter_friends $user)
Ludovic Dubost 4.1 36 #if(!$twitter)
Ludovic Dubost 1.1 37 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy"))
38 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008"))
Ludovic Dubost 4.1 39 #end
Ludovic Dubost 5.1 40 #twitter_display($twitter.getFriendsTimeline("xwikiapi"))
Ludovic Dubost 1.1 41 #end