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 verstecken
1: {{include document="Blog.BlogCode"/}} 2: 3: {{velocity filter="none"}} 4: {{html clean="false" wiki="true"}} 5: ## 6: ## 7: ## 8: #macro(displayBlogFullArchive $blogDoc) 9: #getBlogEntriesBaseQuery($query) 10: #set($query = "${query} and (doc.space = '${blogDoc.space}' or doc.parent = '${blogDoc.fullName}')") 11: ## Create a Jodatime date formatter that will be used to format dates 12: #set($monthFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern('MMMM')) 13: #set($tempDate = $xwiki.jodatime.mutableDateTime) 14: #set($currentYear = $xwiki.formatDate($util.date, 'yyyy')) 15: #set($currentMonth = $xwiki.formatDate($util.date, 'M')) 16: #set($firstYear = '') 17: #set($lastYear = '') 18: #foreach($firstEntry in $xwiki.searchDocuments("${query} order by year(publishDate.value)", 1, 0)) 19: #set($discard = $xwiki.getDocument($firstEntry)) 20: #getEntryObject($discard $entryObj) 21: #getEntryDate($discard $entryObj $firstYear) 22: #set($firstYear = $util.parseInt($xwiki.formatDate($firstYear, 'yyyy'))) 23: #end 24: #foreach($lastEntry in $xwiki.searchDocuments("${query} order by year(publishDate.value) desc", 1, 0)) 25: #set($discard = $xwiki.getDocument($lastEntry)) 26: #getEntryObject($discard $entryObj) 27: #getEntryDate($discard $entryObj $lastYear) 28: #set($lastYear = $util.parseInt($xwiki.formatDate($lastYear, 'yyyy'))) 29: #end 30: #if("$!{firstYear}" != '') ## At least one entry exists 31: #foreach($year in [$firstYear..$lastYear]) 32: #set($yearArticleCount = $xwiki.countDocuments("${query} and year(publishDate.value) = $year")) 33: #if($yearArticleCount > 0) 34: * [[$year ($yearArticleCount)>>Blog.Archive?space=${blogDoc.space}&year=${year}]] 35: #foreach($month in [1..12]) 36: #set($monthArticleCount = $xwiki.countDocuments("${query} and year(publishDate.value) = $year and month(publishDate.value) = $month")) 37: #if($monthArticleCount > 0) 38: $tempDate.setMonthOfYear($month) 39: ** [[$monthFormatter.print($tempDate) (${monthArticleCount})>>Blog.Archive?space=${blogDoc.space}&year=${year}&month=${month}]] 40: #end 41: #end 42: #end 43: #end 44: #else 45: #info($msg.get('xe.blog.archive.noarticle')) 46: #end 47: #end 48: ## 49: ## 50: ## 51: #macro(displayBlogYearArchive $blogDoc $year) 52: = $msg.get('xe.blog.archive.postsyear', [$year]) = 53: #getBlogEntriesBaseQuery($query) 54: #set($query = "${query} and (doc.space = '${blogDoc.space}' or doc.parent = '${blogDoc.fullName}')") 55: #set($query = "${query} and year(publishDate.value) = $year") 56: ## Create a Jodatime date formatter that will be used to format dates 57: #set($monthFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern('MMMM')) 58: #set($tempDate = $xwiki.jodatime.mutableDateTime) 59: #set($yearArticleCount = $xwiki.countDocuments(${query})) 60: #if($yearArticleCount > 0) 61: #foreach($month in [1..12]) 62: #set($monthArticleCount = $xwiki.countDocuments("${query} and month(publishDate.value) = $month")) 63: #if($monthArticleCount > 0) 64: $tempDate.setMonthOfYear($month) 65: == [[$monthFormatter.print($tempDate) (${monthArticleCount})>>Blog.Archive?space=${blogDoc.space}&year=${year}&month=${month}]] == 66: #foreach($entryDoc in $xwiki.wrapDocs($xwiki.searchDocuments("${query} and month(publishDate.value) = $month order by publishDate.value"))) 67: #getEntryObject($entryDoc $entryObj) 68: #isPublished($entryObj $isPublished) 69: #isHidden($entryObj $isHidden) 70: * [[$entryDoc.display('title', 'view', $entryObj)>>$entryDoc]]#if(!$isPublished) $msg.get('xe.blog.archive.unpublished')#elseif($isHidden) $msg.get('xe.blog.archive.hidden')#end 71: 72: #end 73: #end 74: #end 75: #else 76: #info($msg.get('xe.blog.archive.noarticlesyear')) 77: #end 78: #end 79: ## 80: ## 81: ## 82: #macro(displayBlogMonthArchive $blogDoc $year $month) 83: #set($dateFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern('MMMM yyyy')) 84: #set($tempDate = $xwiki.jodatime.mutableDateTime) 85: $tempDate.setYear($util.parseInt($year))## 86: $tempDate.setMonthOfYear($util.parseInt($month))## 87: = $msg.get('xe.blog.archive.postsfor') $dateFormatter.print($tempDate) = 88: #getBlogEntriesBaseQuery($query) 89: #set($query = "${query} and (doc.space = '${blogDoc.space}' or doc.parent = '${blogDoc.fullName}')") 90: #set($query = "${query} and year(publishDate.value) = $year and month(publishDate.value) = $month") 91: #set($monthArticleCount = $xwiki.countDocuments(${query})) 92: #if($monthArticleCount > 0) 93: #foreach($entryDoc in $xwiki.wrapDocs($xwiki.searchDocuments("${query} order by publishDate.value"))) 94: #getEntryObject($entryDoc $entryObj) 95: #displayEntry($entryDoc $entryObj true true) 96: #end 97: #else 98: #info($msg.get('xe.blog.archive.noarticlesmonth')) 99: #end 100: #end 101: ## 102: ## 103: ## 104: #set($space = "$!{request.space}") 105: #if($space == '') 106: #set($space = 'Blog') 107: #end 108: #getBlogDocument($space $blogDoc) 109: #set($month = "$!{request.month}") 110: #set($year = "$!{request.year}") 111: #if($year == '') 112: ## 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. 113: #displayBlogFullArchive($blogDoc) 114: #else 115: #if($month == '') 116: ## Show an index of all posts in this year (titles only), with month names as subtitles 117: #displayBlogYearArchive($blogDoc $year) 118: #else 119: ## Show all entries in the month (extract) 120: #displayBlogMonthArchive($blogDoc $year $month) 121: #end 122: #end 123: {{/html}} 124: {{/velocity}}
Recent Blog Posts
First blog post
Blog Categories
News
(1)
Other
(0)
Personal
(0)
Blog Archive