Alternate Whats New Snippet
Alternate version of the "What's new" snippet, without the "WatchListJob" entries. Just edit your "What's New" page and substitute its contents with the code below (updated to fix an issue with minor edits).Code
1 News
Find below all the recent news from the site blog and from the list of pages that have been changed recently.
<div>
<div id="webhomeblogdisplay" style="float:left; width: 49.9%;">
<div style="padding-right:20px;">
<h2 class="heading-1-1-1">Blog <a href="$xwiki.getURL("Main.BlogRss", "view", "xpage=rdf")" style=""><img src="$xwiki.getSkinFile("icons/black-rss.png")" alt="rss icon"/></a></h2>
#set($nbstart = $request.nbstart)
#set($category = "")
#set($nbitems = "3")
#includeMacros("Blog.Macros")
</div>
</div>
<div id="webhomeNewsdisplay" style="float:left; width: 50.1%;">
<div style="padding-left: 20px;">
<h2 class="heading-1-1-1">Recent changes <a href="$xwiki.getURL("Main.WebRss", "view", "xpage=rdf")" style=""><img src="$xwiki.getSkinFile("icons/black-rss.png")" alt="rss icon"/></a></h2>
#if(!$xwiki.hasMinorEdit() || $request.getParameter("showminor"))
#set ($sql = "where 1=1 order by doc.date desc")
#else
#set ($sql = ", XWikiRCSNodeInfo as ni where doc.id=ni.id.docId and ni.id.version2=1 group by doc.web, doc.name order by max(ni.date) desc")
#end
#set($showdata = 1)
#if(!$nb)
#set($nb = 30)
#end
#set($formatDate = "yyyy MMMM dd, HH:mm")
#set ($list = $xwiki.searchDocuments($sql , $nb , 0))
<ul>
#foreach ($item in $list)
#set($troubi ="non")
#if ($xwiki.hasAccessLevel("view", $context.user, "${context.database}:${item}"))
#set($bentrydoc = $xwiki.getDocument($item))
#if (!$bentrydoc.name.contains("WatchListJob"))
#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($createur = $xwiki.getUserName($bentrydoc.author))
<li>
#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($date2 = $!xwiki.formatDate($date,"yyyy MM dd HH:mm:ss"))
#end
#if($bentrydoc)
#set($date1 = $!xwiki.formatDate($!bentrydoc.date,"yyyy MM dd HH:mm:ss") )
#end
#if($date1.equals($date2) )
[$bentrydoc.name>${bentrydoc.web}.$bentrydoc.name] <em>- 1 new comment</em>
#set($troubi ="oui")
#set($desc = $cobj.getXWikiObject().get("comment").value)
#else
[$bentrydoc.name in $bentrydoc.web>${bentrydoc.web}.$bentrydoc.name]
#end
#else
#set($comment = "")
[$bentrydoc.name in $bentrydoc.web>${bentrydoc.web}.$bentrydoc.name.replaceAll("@","%40")]
#end
$xwiki.formatDate($bentrydoc.date,"yyyy MMM dd") at $xwiki.formatDate($bentrydoc.date,"HH:mm")
#if($troubi =="oui")
#set($createur = $xwiki.getUserName($cobj.author))
#end
#if ($createur == "XWikiGuest")
Guest
#else
$createur
#end
</li>
#end
#end
#end
</ul>
#if($xwiki.hasMinorEdit())
#if($request.getParameter("showminor"))
<a href="$xwiki.getURL($tdoc.getFullName(), "view", "")">Hide minor edits</a>
#else
<a href="$xwiki.getURL($tdoc.getFullName(), "view", "showminor")">Show minor edits</a>
#end
#end
</div>
</div>
<div style="clear:both; margin-bottom: 40px;"><!-- --></div>
</div>
Version 4.1 last modified by dpolistchuck on 08/05/2008 at 13:15
Document data
Attachments:
No attachments for this document
Comments: 0