Toggle the parent tree of Macros for the Blog application. Wiki blog Toggle the hierarchy tree under Wiki blog. Macros for the Blog application Toggle the hierarchy tree under Macros for the Blog application.
From version
4.1
edited by superadmin
on 2026/12/02 00:14
edited by superadmin
on 2026/12/02 05:36
Summary
Details
Page properties
...
...
@@ -1,1 +1,1 @@
1
-XWiki 1.0
1
+XWiki 2 .1
...
...
@@ -1,4 +1,6 @@
1
-#includeMacros("Blog.BlogParameters")
1
+{{include reference="Blog.BlogParameters" author="target" /}}
2
+
3
+{{velocity output="false"}}
2
2
##
3
3
##
4
4
##
...
...
@@ -104,7 +104,12 @@
104
104
* @param title The resulting title.
105
105
*###
106
106
#macro(getBlogTitle $blogDoc $title)
107
- #getBlogProperty($blogDoc 'title' $!blogDoc.displayTitle $title)
109
+ ## The blog title is the rendered document title. It is displayed as data (never evaluated as
110
+ ## Velocity), so an unprivileged user storing script in Blog.BlogClass.title cannot run it. See
111
+ ## Blog.BlogSheet, which renders the title literally and falls back to the blog.code.title
112
+ ## translation when the stored title is empty.
113
+ #set ($title = $NULL)
114
+ #setVariable ("$title" $!blogDoc.displayTitle)
108
108
#end
109
109
##
110
110
##
...
...
@@ -117,7 +117,9 @@
117
117
* @param description The resulting description.
118
118
*###
119
119
#macro(getBlogDescription $blogDoc $description)
120
- #getBlogProperty($blogDoc 'description' '' $description)
127
+ #getBlogProperty($blogDoc 'description' '' $result)
128
+ #set ($description = $NULL)
129
+ #setVariable ("$description" $result)
121
121
#end
122
122
##
123
123
##
...
...
@@ -343,7 +343,9 @@
343
343
* @param displayType The resulting string. If the blog object does not define anything, it is considered paginated.
344
344
*###
345
345
#macro(getBlogDisplayType $blogDoc $displayType)
346
- #getBlogProperty($blogDoc 'displayType' 'paginated' $displayType)
355
+ #getBlogProperty($blogDoc 'displayType' 'paginated' $result)
356
+ #set ($displayType = $NULL)
357
+ #setVariable ("$displayType" $result)
347
347
#end
348
348
##
349
349
##
...
...
@@ -835,10 +835,12 @@
835
835
* @param propertyValue The resulting value.
836
836
*###
837
837
#macro(getBlogProperty $blogDoc $propertyName $defaultValue $propertyValue)
838
- #set($propertyValue = "$!{blogDoc.getObject(${blogClassname}).getProperty($propertyName).value}")
839
- #if($propertyValue == '')
840
- #set($propertyValue = $defaultValue)
849
+ #set($res ult = "$!{blogDoc.getObject(${blogClassname}).getProperty($propertyName).value}")
850
+ #if($res ult == '')
851
+ #set($res ult = $defaultValue)
841
841
#end
853
+ #set ($propertyValue = $NULL)
854
+ #setVariable ("$propertyValue" $result)
842
842
#end
843
843
## Compatibility helpers from the installed Blog 9.15.15 package.
844
844
#macro(bindQueryParameters $queryObj $queryParams)
...
...
@@ -1028,3 +1028,5 @@
1028
1028
#setVariable("$isDefault" $result)
1029
1029
#end
1030
1030
1044
+{{/velocity}}
1045
+
Toggle the right panel column.
#includeMacros("Blog.BlogCode") #getBlogEntriesBaseQuery($query) #set($query = "$!{query} and isPublished.value = 1") #set($recentEntries = $xwiki.searchDocuments("${query} order by publishDate.value desc", 10, 0)) #if($recentEntries.size() > 0 || $showEmptyPanels) #panelheader('Recent Blog Posts') #foreach($entryDoc in $xwiki.wrapDocs($recentEntries)) #getEntryObject($entryDoc $entryObj)
[$!{entryDoc.display('title', 'view', $entryObj)}>$!{entryDoc.fullName}] #end #panelfooter() #end
#includeMacros("Blog.BlogCode") #getBlogEntriesBaseQuery($query) #set($query = "$!{query} and isPublished.value = 0") #set($unpublishedEntries = $xwiki.searchDocuments("${query} order by publishDate.value desc", 5, 0)) #if($unpublishedEntries.size() > 0 || $showEmptyPanels) #panelheader("Unpublished Posts") #foreach($entryDoc in $xwiki.wrapDocs($unpublishedEntries)) #getEntryObject($entryDoc $entryObj)
[$!{entryDoc.display('title', 'view', $entryObj)}>$!{entryDoc.fullName}] #end [View all ($xwiki.countDocuments($query))>Blog.Unpublished] #panelfooter() #end
#includeMacros("Blog.CategoriesCode") #panelheader('Blog Categories') #getCategoriesHierarchy('Blog' $tree) #displayCategoriesHierarchy($tree 'simple') #if($xwiki.hasAdminRights()) <div style="font-size:75%;">(<a href="$xwiki.getURL('Blog.ManageCategories')">Edit Categories</a>)</div> #end #panelfooter()
{{include reference="Blog.BlogCode"/}}
{{velocity}}
#getAllBlogPostsQueryBasedOnDisplayContext($doc $query $queryParams)
#bindQueryParameters($queryObj $queryParams)
{{/velocity}}