Wiki source code of TwitterMacros

Version 8.1 by Ludovic Dubost on 2009/01/02 16:36

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