Changes for page BlogPostLayoutIDoc

Last modified by Administrator on 03.08.2023 14:17

From version 1.3
edited by Administrator
on 18.09.2017 06:43
Change comment: Update document after refactoring.
To version 10.14
edited by Administrator
on 18.09.2017 07:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,1 +1,0 @@
1 -zzz
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,0 +1,97 @@
1 +{{include reference='Blog.BlogCode' /}}
2 +
3 +{{include reference='Blog.BlogPostLayoutMacros' /}}
4 +
5 +{{velocity}}
6 +#if ($services.security.authorization.hasAccess('view', $xcontext.macro.params.reference))
7 +#set ($postDoc = $xwiki.getDocument($xcontext.macro.params.reference))
8 +#getEntryObject($postDoc $postObj)
9 +#if ("$!postObj" != '')
10 +#set ($useSummary = false)
11 +#set ($displayTitle = true)
12 +#set ($displayCalendar = true)
13 +#set ($displayCalendarImage = true)
14 +#set ($displayActions = true)
15 +#set ($previousPostReference = '')
16 +#extractLayoutParametersFromString($xcontext.macro.params.params $macroAdditionalParams)
17 +##
18 +#if ("$!macroAdditionalParams.get('useSummary')" == 'true')
19 + #set ($useSummary = true)
20 +#end
21 +##
22 +#if ("$!macroAdditionalParams.get('displayTitle')" == 'false')
23 + #set ($displayTitle = false)
24 +#end
25 +##
26 +#if ("$!macroAdditionalParams.get('displayImage')" == 'true')
27 + #set ($displayImage = true)
28 +#end
29 +##
30 +#if ("$!macroAdditionalParams.get('displayCalendar')" == 'false')
31 + #set ($displayCalendar = false)
32 + #set ($displayImage = false)## DisplayCalendar has the priority
33 +#end
34 +##
35 +#if ("$!macroAdditionalParams.get('previousPostReference')" != '')
36 + #set ($previousPostReference = $macroAdditionalParams.get('previousPostReference'))
37 +#end
38 +##S
39 +#if ("$!macroAdditionalParams.get('displayActions')" == 'false')
40 + #set ($displayActions = false)
41 +#end
42 +#getEntryDate($postDoc $postObj $postDate)
43 +#set($postDateStr = $xwiki.formatDate($postDate, 'yyyyMMMMdd'))
44 +#if ($previousPostReference != '')
45 + #set ($prevPostDoc = $xwiki.getDocument($previousPostReference))
46 + #set ($prevPostObj = $prevPostDoc.getObject($blogPostClassname))
47 + #getEntryDate($prevPostDoc $prevPostObj $prevPostDate)
48 + #set($prevPostDateStr = $xwiki.formatDate($prevPostDate, 'yyyyMMMMdd'))
49 + #if ($postDateStr == $prevPostDateStr)
50 + #set ($displayCalendarImage = false)
51 + #end
52 +#end
53 +#if ($displayCalendar)(% class="blogDay" %)(((#end
54 +#if ($displayCalendar && $displayCalendarImage)#displayBlogDate($postDate)#end
55 +## #displayEntry($postDoc $postObj $useSummary $displayTitle $displayActions)
56 +## #macro(displayEntry $entryDoc $entryObj $onlyExtract $shouldDisplayTitle $shouldDisplayActions)
57 + #isPublished($postObj $isPublished)
58 + #isHidden($postObj $isHidden)
59 + #if($doc.fullName == $postDoc.fullName)
60 + (% class="hentry single-article" %)(((
61 + #else
62 + (% class="hentry#if(!$isPublished) unpublished-article#elseif($isHidden) hidden-article#end" %)(((
63 + #end
64 + #if ($displayActions)
65 + #displayEntryTools($postDoc $postObj)
66 + #end
67 + #if($displayTitle)
68 + #displayEntryTitle($postDoc $postObj)
69 + #end
70 + #if($doc.fullName == $postDoc.fullName)
71 + #if(!$isPublished)
72 + {{warning}}{{translation key='blog.code.published'/}}{{/warning}}
73 + #elseif($isHidden)
74 + {{warning}}{{translation key='blog.code.hidden'/}}{{/warning}}
75 + #end
76 + #end
77 + #displayEntryContent($postDoc $postObj $useSummary)
78 +## #displayEntryFooter($postDoc $postObj)
79 +
80 +## #macro(displayEntryFooter $entryDoc $entryObj)
81 + (% class="entry-footer" %)(((
82 + [[{{translation key='blog.code.permalink'/}}>>$postDoc||rel="bookmark"]] ##
83 + (% class="separator" %)·(%%) [[{{translation key='blog.code.comments'/}}>>$postDoc||anchor="Comments"]] (% class="itemCount" %)($postDoc.comments.size())(%%) ##
84 + )))## entry-footer
85 +## #end
86 +
87 +
88 + )))## hentry
89 +## #end
90 +#if ($displayCalendar))))#end
91 +#else
92 +{{error}}$services.localization.render('blog.blogpostlayout.notpost', [$xcontext.macro.params.reference]){{/error}}
93 +#end
94 +#else
95 +{{error}}$services.localization.render('blog.blogpostlayout.post_view_not_allowed', [$xcontext.macro.params.reference]){{/error}}
96 +#end
97 +{{/velocity}}
Macro content availability
... ... @@ -1,0 +1,1 @@
1 +Optional
Macro description
... ... @@ -1,0 +1,1 @@
1 +Makro pro zobrazení příspěvku iDoc
Macro id
... ... @@ -1,0 +1,1 @@
1 +blogPostLayoutMyLayout
Macro name
... ... @@ -1,0 +1,1 @@
1 +Blog Post Layout My Layout
Macro visibility
... ... @@ -1,0 +1,1 @@
1 +Global
XWiki.WikiMacroParameterClass[0]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The document reference of the blog post
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +Yes
Parameter name
... ... @@ -1,0 +1,1 @@
1 +reference
XWiki.WikiMacroParameterClass[1]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +Additional parameters of the blog post layout
Parameter name
... ... @@ -1,0 +1,1 @@
1 +params