Allgemeine Aktionen:
Anmelden
Erstellen
▼
:
Kommentar erstellen
Wiki
▼
:
Dokumentenindex
»
Space:
Blog
▼
:
Dokumentenverzeichnis
»
Seite:
Archive
Suche
Aktionen:
Exportieren
▼
:
Als PDF exportieren
Als RTF exportieren
Als HTML exportieren
Weitere Aktionen
▼
:
Druckvorschau
Zeige den Quellcode
Willkommen in den metamagix Wikis!
»
The Wiki Blog
»
Blog Archive
Wiki-Quellcode von
Blog Archive
Zuletzt geändert von
Administrator
am 2008/12/22 03:59
Inhalt
·
Kommentare
(0)
·
Anmerkungen
(0)
·
Anhänge
(0)
·
Historie
·
Information
Zeilennummern anzeigen
{{include document="Blog.BlogCode"/}} {{velocity filter="none"}} {{html clean="false" wiki="true"}} ## ## ## #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) * [[$year ($yearArticleCount)>>Blog.Archive?space=${blogDoc.space}&year=${year}]] #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) ** [[$monthFormatter.print($tempDate) (${monthArticleCount})>>Blog.Archive?space=${blogDoc.space}&year=${year}&month=${month}]] #end #end #end #end #else #info($msg.get('xe.blog.archive.noarticle')) #end #end ## ## ## #macro(displayBlogYearArchive $blogDoc $year) = $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) == [[$monthFormatter.print($tempDate) (${monthArticleCount})>>Blog.Archive?space=${blogDoc.space}&year=${year}&month=${month}]] == #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) * [[$entryDoc.display('title', 'view', $entryObj)>>$entryDoc]]#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))## = $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 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 {{/html}} {{/velocity}}
Recent Blog Posts
First blog post
Blog Categories
News
(1)
Other
(0)
Personal
(0)
Blog Archive