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
Show line numbers
#set($thepage = $xwiki.getDocument("XWiki.recentComments")) #set($thestring = "<table class='stats' cellspacing='0' cellpadding='0'>") #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") #set($showdata = 1) #set($nb = 150) #set($formatDate = "yyyy MMMM dd, HH:mm") #set($list = $xwiki.searchDocuments($sql , $nb , 0)) #set($now2y = $datetool.getYear()) ##set($now2y = $mathtool.toInteger("$now2ystring")) #set($now2m = $datetool.getMonth()) ##set($now2m = $mathtool.toInteger("$now2mstring")) #set($now2d = $datetool.getDay()) ##set($now2d = $mathtool.toInteger("$now2dstring")) #set($now2 = $now2y * 365 + $now2m * 30 + $now2d + 30) #set($count = 0) #foreach ($item in $list) #if ($count < 5) #set($troubi ="non") #if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}")) #set($bentrydoc = $xwiki.getDocument($item)) #set($cclass = $xwiki.getDocument("XWiki.XWikiComments").getxWikiClass()) #set($comment = $cclass.newObject()) #if($xwiki.getWebPreferenceAsInt("commentsorder",1)==0) #set($comments = $bentrydoc.getComments()) #else #set($comments = $bentrydoc.getComments(false)) #end #set($postsPerPage = $bentrydoc.getObjects("BBCode.PostClass")) #if($comments.size()>0) #set($i = 0) #set($cobj = $comments.get($i)) #set($comment = $bentrydoc.display("comment", "view", $cobj)) #set($date = $cobj.getXWikiObject().get("date").value) #if($date) #set($date2y = $datetool.getYear($date)) #set($date2m = $datetool.getMonth($date)) #set($date2d = $datetool.getDay($date)) #set($date2 = $date2y * 365 + $date2m * 30 + $date2d) #end ##"Recent" comments should be comments that have been left in the (roughly) last 10 days #if(($now2 - $date2)<14) ##We don't want to display more than X recent comments, so for increase the comment counter #set($count = $count + 1) #set($name = $bentrydoc.name) #if($name.length() >= 22) #set($names= "${name.substring(0, 20)}") #set($names= $names.concat('...')) #else #set($names= $name) #end #set($createur = $xwiki.getUserName($cobj.author)) #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 ") #if ($createur == 'XWikiGuest') #set($thestring = "$thestring" + "Guest") #else #set($thestring = "$thestring" + "$createur") #end #set($thestring = "$thestring" + "</span></td></tr>") #end #elseif($postsPerPage.size()>0) #set($newestPost = $postsPerPage.lastElement()) #set($date = $newestPost.get("postdate")) #set($date2dstring = $date.substring(0,2)) #set($date2mstring = $date.substring(3,5)) #set($date2ystring = $date.substring(6,10)) #set($dater2d = $mathtool.toInteger("$date2dstring")) #set($dater2m = $mathtool.toInteger("$date2mstring")) #set($dater2y = $mathtool.toInteger("$date2ystring")) #set($dater2 = $dater2y * 365 + $dater2m * 30 + $dater2d) ##"Recent" comments should be comments that have been left in the (roughly) last 10 days// #if(($now2 - $dater2)<14) ## We don't want to display more than X recent comments, so for increase the comment counter// #set($count = $count + 1) #set($name = $bentrydoc.name) #if($name.length() >= 22) #set($names= "${name.substring(0, 20)}") #set($names= $names.concat('...')) #else #set($names= $name) #end #set($newestAuthor = $newestPost.get("postauthor")) #set($createur = $xwiki.getUserName("$newestAuthor")) #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>") #end #end #end #end #end #set($thestring = "$thestring" + "</table>") $thepage.setContent("$thestring") $thepage.save()
Welcome
Welcome to this XWiki!
Quick Links
DSSF 2008
DCNM 2009
HCCF 2010
Document Index
Sandbox
My Recent Modifications
ASSIGNMENTNAME