General Actions:
Log-in
Wiki:
Courses
▼
:
Document Index
»
Space:
XWiki
▼
:
Document Index
»
Page:
recentCommentsUpdater
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
recentCommentsUpdater
Wiki source code of
recentCommentsUpdater
Last modified by
Holger Dick
on 2010/08/20 15:47
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: 2: #set($thepage = $xwiki.getDocument("XWiki.recentComments")) 3: #set($thestring = "<table class='stats' cellspacing='0' cellpadding='0'>") 4: #set($sql = "where doc.space not like 'Scheduler' and doc.space not like 'Panels' and year(doc.date) = year(current_date()) order by doc.date desc") 5: #set($showdata = 1) 6: #set($nb = 150) 7: #set($formatDate = "yyyy MMMM dd, HH:mm") 8: #set($list = $xwiki.searchDocuments($sql , $nb , 0)) 9: #set($now2y = $datetool.getYear()) 10: ##set($now2y = $mathtool.toInteger("$now2ystring")) 11: #set($now2m = $datetool.getMonth()) 12: ##set($now2m = $mathtool.toInteger("$now2mstring")) 13: #set($now2d = $datetool.getDay()) 14: ##set($now2d = $mathtool.toInteger("$now2dstring")) 15: #set($now2 = $now2y * 365 + $now2m * 30 + $now2d + 30) 16: #set($count = 0) 17: #foreach ($item in $list) 18: #if ($count < 5) 19: #set($troubi ="non") 20: #if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}")) 21: #set($bentrydoc = $xwiki.getDocument($item)) 22: #set($cclass = $xwiki.getDocument("XWiki.XWikiComments").getxWikiClass()) 23: #set($comment = $cclass.newObject()) 24: #if($xwiki.getWebPreferenceAsInt("commentsorder",1)==0) 25: #set($comments = $bentrydoc.getComments()) 26: #else 27: #set($comments = $bentrydoc.getComments(false)) 28: #end 29: #set($postsPerPage = $bentrydoc.getObjects("BBCode.PostClass")) 30: #if($comments.size()>0) 31: #set($i = 0) 32: #set($cobj = $comments.get($i)) 33: #set($comment = $bentrydoc.display("comment", "view", $cobj)) 34: #set($date = $cobj.getXWikiObject().get("date").value) 35: #if($date) 36: #set($date2y = $datetool.getYear($date)) 37: #set($date2m = $datetool.getMonth($date)) 38: #set($date2d = $datetool.getDay($date)) 39: #set($date2 = $date2y * 365 + $date2m * 30 + $date2d) 40: #end 41: ##"Recent" comments should be comments that have been left in the (roughly) last 10 days 42: #if(($now2 - $date2)<14) 43: ##We don't want to display more than X recent comments, so for increase the comment counter 44: #set($count = $count + 1) 45: #set($name = $bentrydoc.name) 46: #if($name.length() >= 22) 47: #set($names= "${name.substring(0, 20)}") 48: #set($names= $names.concat('...')) 49: #else 50: #set($names= $name) 51: #end 52: #set($createur = $xwiki.getUserName($cobj.author)) 53: #set($thestring = "$thestring" + "<tr><td style='border-width: 0px 0px 1px 0px; border-style: dashed; border-color: white;'>[$names>${bentrydoc.fullName}]<br/><span style='font-size: 0.7em; text-indent: 70px;'> $xwiki.formatDate($date,'MMM dd') by ") 54: #if ($createur == 'XWikiGuest') 55: #set($thestring = "$thestring" + "Guest") 56: #else 57: #set($thestring = "$thestring" + "$createur") 58: #end 59: #set($thestring = "$thestring" + "</span></td></tr>") 60: #end 61: #elseif($postsPerPage.size()>0) 62: #set($newestPost = $postsPerPage.lastElement()) 63: #set($date = $newestPost.get("postdate")) 64: #set($date2dstring = $date.substring(0,2)) 65: #set($date2mstring = $date.substring(3,5)) 66: #set($date2ystring = $date.substring(6,10)) 67: #set($dater2d = $mathtool.toInteger("$date2dstring")) 68: #set($dater2m = $mathtool.toInteger("$date2mstring")) 69: #set($dater2y = $mathtool.toInteger("$date2ystring")) 70: #set($dater2 = $dater2y * 365 + $dater2m * 30 + $dater2d) 71: ##"Recent" comments should be comments that have been left in the (roughly) last 10 days// 72: #if(($now2 - $dater2)<14) 73: ## We don't want to display more than X recent comments, so for increase the comment counter// 74: #set($count = $count + 1) 75: #set($name = $bentrydoc.name) 76: #if($name.length() >= 22) 77: #set($names= "${name.substring(0, 20)}") 78: #set($names= $names.concat('...')) 79: #else 80: #set($names= $name) 81: #end 82: #set($newestAuthor = $newestPost.get("postauthor")) 83: #set($createur = $xwiki.getUserName("$newestAuthor")) 84: #set($thestring = "$thestring" + "<tr><td style='border-width: 0px 0px 1px 0px; border-style: dashed; border-color: white;'>[$names>${bentrydoc.fullName}]<br/><span style='font-size: 0.7em; text-indent: 70px;'> " + "$date.substring(0,10)" +" by " + "$createur" + "</span></td></tr>") 85: #end 86: #end 87: #end 88: #end 89: #end 90: #set($thestring = "$thestring" + "</table>") 91: $thepage.setContent("$thestring") 92: $thepage.save()
Welcome
Welcome to this XWiki!
Quick Links
DSSF 2008
DCNM 2009
HCCF 2010
Document Index
Sandbox
My Recent Modifications
ASSIGNMENTNAME