Blog Archive
Log-in
|
Blog
:
Welcome to your wiki
>
Wiki blog
>
Blog Archive
Top Menu
Show
:
Comments
Attachments
History
Information
Stampa
:
Stampa
Anteprima di stampa
Esporta come PDF
Esporta in formato RTF
Esporta come HTML
Esporta in formato XAR
Wiki source code of
Blog Archive
Show line numbers
#includeMacros("Blog.BlogCode") ## ## ## #macro(displayBlogFullArchive $blogDoc) #getBlogEntriesBaseQuery($query) #set($query = "${query} and (doc.space = ’${blogDoc.space}’ or doc.parent = ’${blogDoc.fullName}’)") ## Create a Jodatime date formatter that will be used to format dates #set($monthFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern("MMMM")) #set($tempDate = $xwiki.jodatime.mutableDateTime) #set($currentYear = $xwiki.formatDate($util.date, ’yyyy’)) #set($currentMonth = $xwiki.formatDate($util.date, ’M’)) #set($firstYear = ’’) #set($lastYear = ’’) #foreach($firstEntry in $xwiki.searchDocuments("${query} order by year(publishDate.value)", 1, 0)) #set($discard = $xwiki.getDocument($firstEntry)) #getEntryObject($discard $entryObj) #getEntryDate($discard $entryObj $firstYear) #set($firstYear = $util.parseInt($xwiki.formatDate($firstYear, "yyyy"))) #end #foreach($lastEntry in $xwiki.searchDocuments("${query} order by year(publishDate.value) desc", 1, 0)) #set($discard = $xwiki.getDocument($lastEntry)) #getEntryObject($discard $entryObj) #getEntryDate($discard $entryObj $lastYear) #set($lastYear = $util.parseInt($xwiki.formatDate($lastYear, "yyyy"))) #end #if("$!{firstYear}" != ’’) ## At least one entry exists #foreach($year in [$firstYear..$lastYear]) #set($yearArticleCount = $xwiki.countDocuments("${query} and year(publishDate.value) = $year")) #if($yearArticleCount > 0) * <a href="$xwiki.getURL(’Blog.Archive’, ’view’, "space=${blogDoc.space}&year=${year}")">$year ($yearArticleCount)</a> #foreach($month in [1..12]) #set($monthArticleCount = $xwiki.countDocuments("${query} and year(publishDate.value) = $year and month(publishDate.value) = $month")) #if($monthArticleCount > 0) $tempDate.setMonthOfYear($month) ** <a href="$xwiki.getURL(’Blog.Archive’, ’view’, "space=${blogDoc.space}&year=${year}&month=${month}")">$monthFormatter.print($tempDate) (${monthArticleCount})</a> #end #end #end #end #else #info($msg.get("xe.blog.archive.noarticle")) #end #end ## ## ## #macro(displayBlogYearArchive $blogDoc $year) 1 $msg.get("xe.blog.archive.postsyear", [$year]) #getBlogEntriesBaseQuery($query) #set($query = "${query} and (doc.space = ’${blogDoc.space}’ or doc.parent = ’${blogDoc.fullName}’)") #set($query = "${query} and year(publishDate.value) = $year") ## Create a Jodatime date formatter that will be used to format dates #set($monthFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern(’MMMM’)) #set($tempDate = $xwiki.jodatime.mutableDateTime) #set($yearArticleCount = $xwiki.countDocuments("${query}")) #if($yearArticleCount > 0) #foreach($month in [1..12]) #set($monthArticleCount = $xwiki.countDocuments("${query} and month(publishDate.value) = $month")) #if($monthArticleCount > 0) $tempDate.setMonthOfYear($month) 1.1 <a href="$xwiki.getURL(’Blog.Archive’, ’view’, "space=${blogDoc.space}&year=${year}&month=${month}")">$monthFormatter.print($tempDate) (${monthArticleCount})</a> #foreach($entryDoc in $xwiki.wrapDocs($xwiki.searchDocuments("${query} and month(publishDate.value) = $month order by publishDate.value"))) #getEntryObject($entryDoc $entryObj) #isPublished($entryObj $isPublished) #isHidden($entryObj $isHidden) * <a href="$entryDoc.getURL()">$entryDoc.display(’title’, ’view’, $entryObj)</a>#if(!$isPublished) $msg.get("xe.blog.archive.unpublished")#elseif($isHidden) $msg.get("xe.blog.archive.hidden")#end #end #end #end #else #info($msg.get("xe.blog.archive.noarticlesyear")) #end #end ## ## ## #macro(displayBlogMonthArchive $blogDoc $year $month) #set($dateFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern(’MMMM yyyy’)) #set($tempDate = $xwiki.jodatime.mutableDateTime) $tempDate.setYear($util.parseInt($year))## $tempDate.setMonthOfYear($util.parseInt($month))## 1 $msg.get("xe.blog.archive.postsfor") $dateFormatter.print($tempDate) #getBlogEntriesBaseQuery($query) #set($query = "${query} and (doc.space = ’${blogDoc.space}’ or doc.parent = ’${blogDoc.fullName}’)") #set($query = "${query} and year(publishDate.value) = $year and month(publishDate.value) = $month") #set($monthArticleCount = $xwiki.countDocuments("${query}")) #if($monthArticleCount > 0) #foreach($entryDoc in $xwiki.wrapDocs($xwiki.searchDocuments("${query} order by publishDate.value"))) #getEntryObject($entryDoc $entryObj) #displayEntry($entryDoc $entryObj true) #end #else #info($msg.get("xe.blog.archive.noarticlesmonth")) #end #end ## ## ## #set($space = "$!{request.space}") #if($space == ’’) #set($space = ’Blog’) #end #getBlogDocument($space $blogDoc) #set($month = "$!{request.month}") #set($year = "$!{request.year}") #if($year == "") ## Show a brief history of the blog, a tree with first level = years, second level = months, and the number of entries from that year/month in every node. #displayBlogFullArchive($blogDoc) #else #if($month == ’’) ## Show an index of all posts in this year (titles only), with month names as subtitles #displayBlogYearArchive($blogDoc $year) #else ## Show all entries in the month (extract) #displayBlogMonthArchive($blogDoc $year $month) #end #end
Recent Blog Posts
The first post of your wiki's blog
Blog Categories
News
(1)
Other
(0)
Personal
(0)
Blog Archive
2009
(1)
Search
Quick Links
Wiki Dashboard
Document Index
Blog
Sandbox
My Recent Modifications
dany
|
marco