General Actions:
Log-in
Wiki:
Courses
▼
:
Document Index
»
Space:
Blog
▼
:
Document Index
»
Page:
Archive
Search
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Welcome to L3D's XWiki for Courses
»
The Wiki Blog
»
Blog Archive
Wiki source code of
Blog Archive
Last modified by
Administrator
on 2008/12/21 19:59
Content
·
Comments
(0)
·
Attachments
(0)
·
History
·
Information
Show line numbers
{{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
Storm Drain Survey
Computer Science Department Wikipedia Article
Delicious Cookies!!!
Assignment 13 posted
Makeshift Crew Project Survey for Cookies!!!
Assignments 11 & 12 Posted
Assignment 10 Posted
Assignment 9 (Project Progress Report) Posted
Organize Your Projects
A8 Posted
Blog Categories
News
(10)
Other
(2)
Personal
(1)
Survey
(1)
Blog Archive
2009
(1)
Quick Links
DSSF 2008
DCNM 2009
HCCF 2010
Document Index
Sandbox
My Recent Modifications
ASSIGNMENTNAME