Wiki source code of News

Version 28.1 by Vincent Massol on 2008/01/30

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

Get Connected