Wiki source code of News

Version 31.1 by Vincent Massol on 2008/05/08

Hide last authors
Vincent Massol 24.4 1 $context.setCacheDuration(300)
Vincent Massol 10.1 2 1 News
3
4 Find below all the recent news from the site blog and from the list of pages that have been changed recently.
5
Vincent Massol 1.1 6 #includeMacros("Main.Macros")
Vincent Massol 30.2 7 #set($wikinames = ["xwiki", "code", "enterprise", "manager", "watch", "platform", "dev", "workspaces"])
Vincent Massol 1.1 8 <div>
9 <div id="webhomeblogdisplay" style="float:left; width: 50%;">
10 <div style="padding-right:20px;">
Vincent Massol 30.1 11 <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>
12 #set($nbstart = $request.nbstart)
13 #set($category = "")
14 #set($nbitems = "4")
15 #includeMacros("Blog.Macros")
Vincent Massol 1.1 16 </div>
17 </div>
18 <div id="webhomeNewsdisplay" style="float:left; width: 50%;">
19 <div style="padding-left: 20px;">
Vincent Massol 11.1 20 <h2 class="heading-1-1-1">Recent Pages Changed <a href="$xwiki.getURL("Main.WebRss", "view", "xpage=rdf")" style=""><img src="$xwiki.getSkinFile("icons/black-rss.png")" alt="rss icon"/></a></h2>
Vincent Massol 1.1 21 #if(!$xwiki.hasMinorEdit() || $request.getParameter("showminor"))
Vincent Massol 31.1 22 #set ($sql = "where 1=1 and doc.comment <> 'Created user' and doc.name not like 'WatchListJob%' order by doc.date desc")
Vincent Massol 1.1 23 #else
Vincent Massol 31.1 24 #set ($sql = ", XWikiRCSNodeInfo as ni where doc.id=ni.id.docId and ni.id.version2=1 and doc.comment <> 'Created user' and doc.name not like 'WatchListJob%' group by doc.web, doc.name order by max(ni.date) desc")
Vincent Massol 1.1 25 #end
26 #set($showdata = 1)
27 #if(!$nb)
Vincent Massol 14.1 28 #set($nb = 30)
Vincent Massol 1.1 29 #end
30 #set($formatDate = "yyyy MMMM dd, HH:mm")
Thomas Mortagne 16.1 31 #getDocumentsModifs($list $sql $wikinames $nb)
Vincent Massol 1.1 32 <ul>
33 #foreach ($bentrydoc in $list)
34 #set($troubi ="non")
35 #if ($xwiki.hasAccessLevel("view", $context.user, $bentrydoc.prefixedFullName))
36 #set($cclass = $xwiki.getDocument("XWiki.XWikiComments").getxWikiClass())
37 #set($comment = $cclass.newObject())
38 #if($xwiki.getWebPreferenceAsInt("commentsorder",1)==0)
39 #set($comments = $bentrydoc.getComments())
40 #else
41 #set($comments = $bentrydoc.getComments(false))
42 #end
43 #set($createur = $xwiki.getUserName($bentrydoc.author))
44 <li>
45 #if($comments.size()>0)
46 #set($i = 0)
47 #set($cobj = $comments.get($i))
48 #set($comment = $bentrydoc.display("comment", "view", $cobj))
49 #set($date = $cobj.getXWikiObject().get("date").value)
50 #if($date)
51 #set($date2 = $!xwiki.formatDate($date,"yyyy MM dd HH:mm:ss"))
52 #end
53 #if($bentrydoc)
54 #set($date1 = $!xwiki.formatDate($!bentrydoc.date,"yyyy MM dd HH:mm:ss") )
55 #end
56 #if($date1.equals($date2) )
Vincent Massol 30.1 57 [$bentrydoc.name>$bentrydoc.prefixedFullName] <em>- 1 new comment</em>
Vincent Massol 1.1 58 #set($troubi ="oui")
59 #set($desc = $cobj.getXWikiObject().get("comment").value)
60 #else
Vincent Massol 30.1 61 [$bentrydoc.name in $bentrydoc.web>$bentrydoc.prefixedFullName]
Vincent Massol 1.1 62 #end
63 #else
64 #set($comment = "")
Vincent Massol 30.1 65 [$bentrydoc.name in $bentrydoc.web>$bentrydoc.prefixedFullName.replaceAll("@","%40")]
Vincent Massol 1.1 66 #end
67 $xwiki.formatDate($bentrydoc.date,"yyyy MMM dd") at $xwiki.formatDate($bentrydoc.date,"HH:mm")
68 #if($troubi =="oui")
69 #set($createur = $xwiki.getUserName($cobj.author))
70 #end
71 #if ($createur == "XWikiGuest")
72 Guest
73 #else
74 $createur
75 #end
76 </li>
77 #end
78 #end
79 </ul>
80 #if($xwiki.hasMinorEdit())
81 #if($request.getParameter("showminor"))
82 <a href="$xwiki.getURL($tdoc.getFullName(), "view", "")">Hide minor edits</a>
83 #else
84 <a href="$xwiki.getURL($tdoc.getFullName(), "view", "showminor")">Show minor edits</a>
85 #end
86 #end
Vincent Massol 25.1 87 <h2 class="heading-1-1-1">Recent Users Added</h2>
88 #set ($sql = "where 1=1 and doc.comment = 'Created user' order by doc.date desc")
89 #set($showdata = 1)
90 #set($nb = 10)
91 #set($formatDate = "yyyy MMMM dd, HH:mm")
92 #getDocumentsModifs($list $sql $wikinames $nb)
93 <ul>
94 #foreach ($bentrydoc in $list)
95 #set($troubi ="non")
96 #if ($xwiki.hasAccessLevel("view", $context.user, $bentrydoc.prefixedFullName))
97 #set($cclass = $xwiki.getDocument("XWiki.XWikiComments").getxWikiClass())
98 #set($comment = $cclass.newObject())
99 #if($xwiki.getWebPreferenceAsInt("commentsorder",1)==0)
100 #set($comments = $bentrydoc.getComments())
101 #else
102 #set($comments = $bentrydoc.getComments(false))
103 #end
104 #set($createur = $xwiki.getUserName($bentrydoc.author))
105 <li>
106 #if($comments.size()>0)
107 #set($i = 0)
108 #set($cobj = $comments.get($i))
109 #set($comment = $bentrydoc.display("comment", "view", $cobj))
110 #set($date = $cobj.getXWikiObject().get("date").value)
111 #if($date)
112 #set($date2 = $!xwiki.formatDate($date,"yyyy MM dd HH:mm:ss"))
113 #end
114 #if($bentrydoc)
115 #set($date1 = $!xwiki.formatDate($!bentrydoc.date,"yyyy MM dd HH:mm:ss") )
116 #end
117 #if($date1.equals($date2) )
Vincent Massol 30.1 118 [$bentrydoc.name>$bentrydoc.prefixedFullName] <em>- 1 new comment</em>
Vincent Massol 25.1 119 #set($troubi ="oui")
120 #set($desc = $cobj.getXWikiObject().get("comment").value)
121 #else
Vincent Massol 30.1 122 [$bentrydoc.name in $bentrydoc.web>$bentrydoc.prefixedFullName]
Vincent Massol 25.1 123 #end
124 #else
125 #set($comment = "")
Vincent Massol 30.1 126 [$bentrydoc.name in $bentrydoc.web>$bentrydoc.prefixedFullName.replaceAll("@","%40")]
Vincent Massol 25.1 127 #end
128 $xwiki.formatDate($bentrydoc.date,"yyyy MMM dd") at $xwiki.formatDate($bentrydoc.date,"HH:mm")
129 #if($troubi =="oui")
130 #set($createur = $xwiki.getUserName($cobj.author))
131 #end
132 #if ($createur == "XWikiGuest")
133 Guest
134 #else
135 $createur
136 #end
137 </li>
138 #end
139 #end
140 </ul>
Vincent Massol 1.1 141 </div>
142 </div>
143 <div style="clear:both; margin-bottom: 40px;"><!-- --></div>
144 </div>
145

Get Connected