Toggle navigation
Anmelden
Registrieren
Home
Dokumentenindex
Benutzerverzeichnis
Application Index
Global
Sprachen
Standardsprache
Wiki Verzeichnis
Das Wiki Blog
Blog Archive
Wiki-Quellcode von
Blog Archive
Zuletzt geändert von
Marcel Heckel
am 2017/01/25 10:29
Kopieren
Exportieren
Druckvorschau
Zeige den Quellcode
Siblings
Inhalt
×
Exportieren
Office Formats
Als PDF exportieren
Other Formats
Als HTML exportieren
Zeilennummern anzeigen
{{include reference="Blog.BlogCode"/}} {{velocity filter="none"}} {{html clean="false" wiki="true"}} ## ## ## #macro(displayBlogFullArchive $blogDoc) #getBlogEntriesBaseQuery($query) #set($query = "${query} and (doc.space = ? or doc.parent = ?)") #set ($queryParams = [$blogDoc.space, $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($datetool.date, 'yyyy')) #set($currentMonth = $xwiki.formatDate($datetool.date, 'M')) #set($firstYear = '') #set($lastYear = '') #foreach($firstEntry in $services.query.hql("${query} order by year(publishDate.value)").setLimit(1).bindValues($queryParams).execute()) #set($discard = $xwiki.getDocument($firstEntry)) #getEntryObject($discard $entryObj) #getEntryDate($discard $entryObj $firstYear) #set($firstYear = $mathtool.toInteger($xwiki.formatDate($firstYear, 'yyyy'))) #end #foreach($lastEntry in $services.query.hql("${query} order by year(publishDate.value) desc").setLimit(1).bindValues($queryParams).execute()) #set($discard = $xwiki.getDocument($lastEntry)) #getEntryObject($discard $entryObj) #getEntryDate($discard $entryObj $lastYear) #set($lastYear = $mathtool.toInteger($xwiki.formatDate($lastYear, 'yyyy'))) #end #if("$!{firstYear}" != '') ## At least one entry exists #foreach($year in [$firstYear..$lastYear]) #set($yearArticleCount = $services.query.hql("${query} and year(publishDate.value) = $year").bindValues($queryParams).count()) #if($yearArticleCount > 0) #set ($queryString = "space=$escapetool.url($blogDoc.space)&year=${year}") * [[$year ($yearArticleCount)>>Blog.Archive||queryString="${queryString}"]] #foreach($month in [1..12]) #set ($statement = "${query} and year(publishDate.value) = $year and month(publishDate.value) = $month") #set ($monthArticleCount = $services.query.hql($statement).bindValues($queryParams).count()) #if($monthArticleCount > 0) $tempDate.setMonthOfYear($month) #set($queryString = "space=${escapetool.url($blogDoc.space)}&year=${year}&month=${month}") ** [[$monthFormatter.print($tempDate) (${monthArticleCount})>>Blog.Archive||queryString="${queryString}"]] #end #end #end #end #else #info($services.localization.render('xe.blog.archive.noarticle')) #end #end ## ## ## #macro(displayBlogYearArchive $blogDoc $year) = $services.localization.render('xe.blog.archive.postsyear', [$year]) = #getBlogEntriesBaseQuery($query) #set($query = "${query} and (doc.space = ? or doc.parent = ?)") #set($queryParams = [$blogDoc.space, $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 = $services.query.hql($query).bindValues($queryParams).count()) #if($yearArticleCount > 0) #foreach($month in [1..12]) #set($monthArticleCount = $services.query.hql("${query} and month(publishDate.value) = $month").bindValues($queryParams).count()) #if($monthArticleCount > 0) $tempDate.setMonthOfYear($month) #set($queryString = "space=${escapetool.url($blogDoc.space)}&year=${year}&month=${month}") == [[$monthFormatter.print($tempDate) (${monthArticleCount})>>Blog.Archive||queryString="${queryString}"]] == #foreach($entryDoc in $xwiki.wrapDocs($services.query.hql("${query} and month(publishDate.value) = $month order by publishDate.value", $queryParams).execute())) #getEntryObject($entryDoc $entryObj) #isPublished($entryObj $isPublished) #isHidden($entryObj $isHidden) * [[$entryDoc.display('title', 'view', $entryObj)>>$entryDoc]]#if(!$isPublished) $services.localization.render('xe.blog.archive.unpublished')#elseif($isHidden) $services.localization.render('xe.blog.archive.hidden')#end #end #end #end #else #info($services.localization.render('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($mathtool.toInteger($year))## $tempDate.setMonthOfYear($mathtool.toInteger($month))## = $services.localization.render('xe.blog.archive.postsfor') $dateFormatter.print($tempDate) = #getBlogEntriesBaseQuery($query) #set($query = "${query} and (doc.space = ? or doc.parent = ?)") #set ($queryParams = [$blogDoc.space, $blogDoc.fullName]) #set($query = "${query} and year(publishDate.value) = $year and month(publishDate.value) = $month") #set($monthArticleCount = $services.query.hql($query).bindValues($queryParams).count()) #if($monthArticleCount > 0) #foreach($entryDoc in $xwiki.wrapDocs($services.query.hql("${query} order by publishDate.value").bindValues($queryParams).execute())) #getEntryObject($entryDoc $entryObj) #displayEntry($entryDoc $entryObj true true) #end #else #info($services.localization.render('xe.blog.archive.noarticlesmonth')) #end #end ## ## ## #set($space = "$!{request.space}") #if($space == '') #set($space = 'Blog') #end #getBlogDocument($space $blogDoc) #set ($month = "$!{mathtool.toInteger($request.month)}") #set ($year = "$!{mathtool.toInteger($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}}
Suchen
Suchabfrage
Los
Navigation
Zuletzt besucht
Blog Archive
Tagcloud
Es wurde bisher noch kein Dokument mit einem Tag versehen.
Neuste Blog Beiträge
First blog post
Blog Kategorien
All
News
(1)
Other
(0)
Personal
(0)
Blog Archiv
2009
(1)