Changes for page TwitterMacros
Last modified by Ludovic Dubost on 2009/01/02 17:09
From version 2.1
edited by Ludovic Dubost
on 2009/01/02 15:22
on 2009/01/02 15:22
Change comment:
There is no comment for this version
To version 20.1
edited by Ludovic Dubost
on 2009/01/02 17:09
on 2009/01/02 17:09
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -2,34 +2,58 @@ 2 2 * Twitter macros allowing to display twitter data 3 3 *# 4 4 5 -#macro(twitter_display $list) 6 -<table> 5 +#** 6 + * Display a list of statuses 7 + * @param list list or array of twitter4j status objects 8 + * @param nb maximum number of status to display 9 + * @param withuser display or not the user name 10 + *# 11 +#macro(twitter_display $list $nb $withuser) 12 +{pre} 7 7 #foreach($msg in $list) 8 - <tr>9 -< td style="border: 0px; border-bottom:1px dashed #D2DADA;">10 -<a href="$msg.user. url">$msg.user.name</a> $msg.text14 +#if($velocityCount<$nb) 15 +<div style="border: 0px; border-bottom:1px dashed #D2DADA;"> 16 +#if($withuser)<a href="$msg.user.URL">$msg.user.name</a>#end $msg.text 11 11 <span style="color: #A2AAAA; font-size: 10px;">$xwiki.formatDate($msg.createdAt) #if($msg.source!="")from $msg.source #end</span> 12 -</td> 13 -</tr> 18 +</div> 14 14 #end 15 -</table> 16 16 #end 21 +{/pre} 22 +#end 17 17 18 - 19 -#macro(twitter_search $text) 24 +#** 25 + * Twitter display of the last 'n' statuses containing a text 26 + * @param text text to search for 27 + * @param nb maximum number of status to display 28 + *# 29 +#macro(twitter_search $text $nb) 30 +#if(!$twitter) 20 20 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy")) 21 21 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008")) 22 -#twitter_display($tg.search($text)) 23 23 #end 34 +#twitter_display($tg.search($text) $nb true) 35 +#end 24 24 25 -#macro(twitter_user $user) 37 +#** 38 + * Twitter display of the last 'n' statuses of a user 39 + * @param user twitter user id 40 + * @param nb maximum number of status to display 41 + *# 42 +#macro(twitter_user $user $nb) 43 +#if(!$twitter) 26 26 #set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy")) 27 27 #set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008")) 28 -#twitter_display($twitter.getUserTimeline($user)) 29 29 #end 47 +#twitter_display($twitter.getUserTimeline($user) $nb false) 48 +#end 30 30 31 -#macro(twitter_friends $user) 32 -#set($tg = $xwiki.parseGroovyFromPage("Twitter.TwitterGroovy", "Twitter.TwitterGroovy")) 33 -#set($twitter = $tg.getTwitter("xwikiapi", "xwapi2008")) 34 -#twitter_display($twitter.getFriendsTimeline($user)) 50 +#** 51 + * Twitter Badge displaying the last status of a user 52 + * @param user twitter user id 53 + *# 54 +#macro(twitter_badge $user) 55 +{pre} 56 +<div style="width:160px;text-align:center"><embed src="http://twitter.com/flash/twitter_badge.swf" flashvars="color1=3368652&type=user&id=1749071" quality="high" width="160" height="160" name="twitter_badge" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br><a style="font-size: 10px; color: #3366CC; text-decoration: none" href="http://twitter.com/$user">follow $user at http://twitter.com</a></div> 57 +{/pre} 35 35 #end 59 +