Änderungen von Dokument Panel Macro

Zuletzt geändert von xwikiadmin am 2025/01/07 11:39

Von Version 3.1
bearbeitet von xwikiadmin
am 2023/04/25 10:54
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros/1.7.1]
Auf Version 1.1
bearbeitet von xwikiadmin
am 2022/02/23 10:52
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros/1.2.1]

Zusammenfassung

Details

XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,100 +1,83 @@
1 -{{velocity output="false"}}
2 -#macro (executeMacro)
3 - #set ($discard = $xwiki.ssx.use('XWiki.Macros.Panel'))
4 - #set ($panelTitle = "$!xcontext.macro.params.title")
5 - #set ($borderColor = "$!xcontext.macro.params.borderColor")
6 - #set ($borderWidth = "$!xcontext.macro.params.borderWidth")
7 - #set ($borderStyle = "$!xcontext.macro.params.borderStyle")
8 - #set ($borderRadius = "$!xcontext.macro.params.borderRadius")
9 - #set ($bgColor = "$!xcontext.macro.params.bgColor")
10 - #set ($contentTextColor = "$!xcontext.macro.params.contentTextColor")
11 - #set ($titleBGColor = "$!xcontext.macro.params.titleBGColor")
12 - #set ($titleColor = "$!xcontext.macro.params.titleColor")
13 - #set ($width = "$!xcontext.macro.params.width")
14 - #set ($classes = "$!xcontext.macro.params.classes")
15 - ## Panel border style
16 - #set ($panelBorderStyle = '')
17 - #if ($width != '')
18 - #set ($panelBorderStyle = "${panelBorderStyle}width: $width; ")
19 - #end
20 - #if ($borderStyle != '')
21 - #set ($panelBorderStyle = "${panelBorderStyle}border: $borderStyle; ")
22 - #end
23 - #if ($borderColor != '')
24 - #set ($panelBorderStyle = "${panelBorderStyle}border-color: $borderColor; ")
25 - #end
26 - #if ($borderWidth != '')
27 - #set ($panelBorderStyle = "${panelBorderStyle}border-width: ${borderWidth}px; ")
28 - #end
29 - #if ($borderRadius != '')
30 - #set ($panelBorderStyle = "${panelBorderStyle}border-radius: $borderRadius; ")
31 - #end
32 - ## Panel title style.
33 - #set ($panelTitleStyle = '')
34 - #if ($titleBGColor != '')
35 - #set ($panelTitleStyle = "${panelTitleStyle}background-color: $titleBGColor; ")
36 - #end
37 - #if ($titleColor != '')
38 - #set ($panelTitleStyle = "${panelTitleStyle}color: $titleColor; ")
39 - #end
40 - ## Panel content style.
41 - #set ($panelContentStyle = '')
42 - #if ($bgColor != '')
43 - #set ($panelContentStyle = "${panelContentStyle}background-color: $bgColor; ")
44 - #end
45 - #if ($contentTextColor != '')
46 - #set ($panelContentStyle = "${panelContentStyle}color: $contentTextColor; ")
47 - #end
48 - #*
49 - If there is a bootstrap class provided, the panel needs an inner container in order to properly handle the borders.
50 - Wraper structure with bootstrap class:
51 - <div class="macro-panel col-sm-12"><div class="macro-border">TITLE and CONTENT</div></div>
52 - Wraper structure without bootstrap class:
53 - <div class="macro-panel macro-border">TITLE and CONTENT</div>
54 - *#
55 - #set ($macroBorderClass = 'macro-border')
56 - #if ("$!classes" != '')
57 - (% class="macro-panel $classes" %)(((
58 - #else
59 - #set ($macroBorderClass = "$macroBorderClass macro-panel")
60 - #end
61 - (% class="$macroBorderClass" style="$panelBorderStyle" %)(((
62 - #if( $panelTitle != '')
63 - (% class="macro-panel-title" style="$panelTitleStyle"%)(((
64 - ## Since 11.5 the content of the macro can be edited in WYSIWYG editor.
65 - #if ($services.rendering.getMacroDescriptor($services.rendering.resolveMacroId('wikimacroparameter')))
66 - {{wikimacroparameter name="title" /}}
67 - #else
68 - $panelTitle
69 - #end
70 - )))
71 - #end
72 - (% class="macro-panel-content" style="$panelContentStyle"%)(((
1 +{{velocity}}
2 +#set ($discard = $xwiki.ssx.use('XWiki.Macros.Panel'))
3 +#set ($panelTitle = "$!xcontext.macro.params.title")
4 +#set ($borderColor = "$!xcontext.macro.params.borderColor")
5 +#set ($borderWidth = "$!xcontext.macro.params.borderWidth")
6 +#set ($borderStyle = "$!xcontext.macro.params.borderStyle")
7 +#set ($borderRadius = "$!xcontext.macro.params.borderRadius")
8 +#set ($bgColor = "$!xcontext.macro.params.bgColor")
9 +#set ($contentTextColor = "$!xcontext.macro.params.contentTextColor")
10 +#set ($titleBGColor = "$!xcontext.macro.params.titleBGColor")
11 +#set ($titleColor = "$!xcontext.macro.params.titleColor")
12 +#set ($width = "$!xcontext.macro.params.width")
13 +#set ($classes = "$!xcontext.macro.params.classes")
14 +## Panel border style
15 +#set ($panelBorderStyle = '')
16 +#if ($width != '')
17 + #set ($panelBorderStyle = "${panelBorderStyle}width: $width; ")
18 +#end
19 +#if ($borderStyle != '')
20 + #set ($panelBorderStyle = "${panelBorderStyle}border: $borderStyle; ")
21 +#end
22 +#if ($borderColor != '')
23 + #set ($panelBorderStyle = "${panelBorderStyle}border-color: $borderColor; ")
24 +#end
25 +#if ($borderWidth != '')
26 + #set ($panelBorderStyle = "${panelBorderStyle}border-width: ${borderWidth}px; ")
27 +#end
28 +#if ($borderRadius != '')
29 + #set ($panelBorderStyle = "${panelBorderStyle}border-radius: $borderRadius; ")
30 +#end
31 +## Panel title style.
32 +#set ($panelTitleStyle = '')
33 +#if ($titleBGColor != '')
34 + #set ($panelTitleStyle = "${panelTitleStyle}background-color: $titleBGColor; ")
35 +#end
36 +#if ($titleColor != '')
37 + #set ($panelTitleStyle = "${panelTitleStyle}color: $titleColor; ")
38 +#end
39 +## Panel content style.
40 +#set ($panelContentStyle = '')
41 +#if ($bgColor != '')
42 + #set ($panelContentStyle = "${panelContentStyle}background-color: $bgColor; ")
43 +#end
44 +#if ($contentTextColor != '')
45 + #set ($panelContentStyle = "${panelContentStyle}color: $contentTextColor; ")
46 +#end
47 +#*
48 + If there is a bootstrap class provided, the panel needs an inner container in order to properly handle the borders.
49 + Wraper structure with bootstrap class:
50 + <div class="macro-panel col-sm-12"><div class="macro-border">TITLE and CONTENT</div></div>
51 + Wraper structure without bootstrap class:
52 + <div class="macro-panel macro-border">TITLE and CONTENT</div>
53 +*#
54 +#set ($macroBorderClass = 'macro-border')
55 +#if ("$!classes" != '')
56 + (% class="macro-panel $classes" %)(((
57 +#else
58 + #set ($macroBorderClass = "$macroBorderClass macro-panel")
59 +#end
60 +(% class="$macroBorderClass" style="$panelBorderStyle" %)(((
61 + #if( $panelTitle != '')
62 + (% class="macro-panel-title" style="$panelTitleStyle"%)(((
73 73   ## Since 11.5 the content of the macro can be edited in WYSIWYG editor.
74 - #if ($services.rendering.getMacroDescriptor($services.rendering.resolveMacroId('wikimacrocontent')))
75 - {{wikimacrocontent /}}
64 + #if ($services.rendering.getMacroDescriptor($services.rendering.resolveMacroId('wikimacroparameter')))
65 + {{wikimacroparameter name="title" /}}
76 76   #else
77 - $!xcontext.macro.content
67 + $panelTitle
78 78   #end
79 79   )))
80 - )))
81 - #if ("$!classes" != '')
82 - )))
83 83   #end
71 + (% class="macro-panel-content" style="$panelContentStyle"%)(((
72 + ## Since 11.5 the content of the macro can be edited in WYSIWYG editor.
73 + #if ($services.rendering.getMacroDescriptor($services.rendering.resolveMacroId('wikimacrocontent')))
74 + {{wikimacrocontent /}}
75 + #else
76 + $!xcontext.macro.content
77 + #end
78 + )))
79 +)))
80 +#if ("$!classes" != '')
81 + )))
84 84  #end
85 85  {{/velocity}}
86 -
87 -{{include reference="Licenses.Code.VelocityMacros"/}}
88 -
89 -{{velocity}}
90 -## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
91 -## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
92 -## don't have view right on those pages.
93 -#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
94 - #executeMacro
95 -#else
96 - {{error}}
97 - #getMissingLicenseMessage('proMacros.extension.name')
98 - {{/error}}
99 -#end
100 -{{/velocity}}